Liferay.Loader.define("change-tracking-web@2.0.84/publications/js/ChangeTrackingDiscardView",["module","exports","require","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/modal","@frontend-taglib-clay$clayui/pagination-bar","@frontend-taglib-clay$clayui/sticker","@frontend-taglib-clay$clayui/table","liferay!frontend-js-react-web$react","./ChangeTrackingRenderView"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function ChangeTrackingDiscardView({ctEntriesJSONArray:e,spritemap:t,typeNames:a,userInfo:d}){const[s,f]=(0,u.useState)(20),[m,p]=(0,u.useState)(1),[g,y]=(0,u.useState)(null),{observer:b,onClose:E}=(0,r.useModal)({onClose:()=>y(null)}),N=e.slice(0);for(let e=0;e<N.length;e++){const t=N[e],l=d[t.userId.toString()];t.portraitURL=l.portraitURL,t.userName=l.userName,t.typeName=a[t.modelClassNameId.toString()]}N.sort(((e,t)=>{const a=e.title.toLowerCase(),l=t.title.toLowerCase(),r=e.typeName.toLowerCase(),i=t.typeName.toLowerCase();return r<i?-1:r>i?1:a<l?-1:a>l?1:0}));return u.default.createElement(u.default.Fragment,null,g?u.default.createElement(r.default,{className:"publications-modal",observer:b,size:"full-screen",spritemap:t},u.default.createElement(r.default.Header,null,u.default.createElement("div",{className:"autofit-row"},u.default.createElement("div",{className:"autofit-col publications-discard-user-portrait"},u.default.createElement(n.default,{className:"sticker-user-icon ".concat(g.portraitURL?"":"user-icon-color-"+g.userId%10),"data-tooltip-align":"top",title:g.userName},g.portraitURL?u.default.createElement("div",{className:"sticker-overlay"},u.default.createElement("img",{className:"sticker-img",src:g.portraitURL})):u.default.createElement(l.default,{symbol:"user"}))),u.default.createElement("div",{className:"autofit-col"},u.default.createElement("div",{className:"modal-title"},g.title),u.default.createElement("div",{className:"modal-description"},g.description)))),u.default.createElement("div",{className:"publications-modal-body"},u.default.createElement(o.default,{dataURL:g.dataURL,showHeader:!1,spritemap:t}))):"",u.default.createElement(c.default,{className:"publications-table",hover:!0},u.default.createElement(c.default.Head,null,u.default.createElement(c.default.Row,null,u.default.createElement(c.default.Cell,{headingCell:!0,style:{width:"5%"}},Liferay.Language.get("user")),u.default.createElement(c.default.Cell,{headingCell:!0,style:{width:"95%"}},Liferay.Language.get("change")))),u.default.createElement(c.default.Body,null,(()=>{const e=[];let t="";const a=(e=>e.length>5?e.slice(s*(m-1),s*m):e)(N);for(let r=0;r<a.length;r++){const i=a[r];i.typeName!==t&&(t=i.typeName,e.push(u.default.createElement(c.default.Row,{divider:!0},u.default.createElement(c.default.Cell,{colSpan:2},i.typeName)))),e.push(u.default.createElement(c.default.Row,{className:"cursor-pointer",onClick:()=>y(i)},u.default.createElement(c.default.Cell,null,u.default.createElement(n.default,{className:"sticker-user-icon ".concat(i.portraitURL?"":"user-icon-color-"+i.userId%10),"data-tooltip-align":"top",title:i.userName},i.portraitURL?u.default.createElement("div",{className:"sticker-overlay"},u.default.createElement("img",{className:"sticker-img",src:i.portraitURL})):u.default.createElement(l.default,{symbol:"user"}))),u.default.createElement(c.default.Cell,null,u.default.createElement("div",{className:"publication-name"},i.title),u.default.createElement("div",{className:"publication-description"},i.description))))}return e})())),N.length<=5?"":u.default.createElement(i.ClayPaginationBarWithBasicItems,{activeDelta:s,activePage:m,deltas:[4,8,20,40,60].map((e=>({label:e}))),ellipsisBuffer:3,onDeltaChange:e=>{f(e),p(1)},onPageChange:e=>p(e),totalItems:N.length}))};var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),i=a("@frontend-taglib-clay$clayui/pagination-bar"),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/sticker")),c=_interopRequireDefault(a("@frontend-taglib-clay$clayui/table")),u=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),o=_interopRequireDefault(a("./ChangeTrackingRenderView"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=l?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(a,r,i):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=ChangeTrackingDiscardView.js.map