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