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