Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/ObjectView/ViewBuilderScreen/ViewBuilderScreen",["module","exports","require","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","../ModalEditViewColumn/ModalEditViewColumn","../objectViewContext"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a("@frontend-taglib-clay$clayui/modal"),o=a("@liferay/object-js-components-web"),l=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var l=n?Object.getOwnPropertyDescriptor(e,o):null;l&&(l.get||l.set)?Object.defineProperty(a,o,l):a[o]=e[o]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),r=a("../ModalEditViewColumn/ModalEditViewColumn"),i=a("../objectViewContext");function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}const e=Liferay.ThemeDisplay.getDefaultLanguageId();var u=()=>{const[t,a]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),{observer:c,onClose:f}=(0,n.useModal)({onClose:()=>a(!1)}),[{objectFields:s,objectView:{objectViewColumns:g}},y]=(0,i.useViewContext)(),m=new Set(g.map((({objectFieldName:e})=>e))),b=s.filter((({name:e})=>m.has(e)));return l.default.createElement(l.default.Fragment,null,l.default.createElement(o.BuilderScreen,{emptyState:{buttonText:Liferay.Language.get("add-column"),description:Liferay.Language.get("add-columns-to-start-creating-a-view"),title:Liferay.Language.get("no-columns-added-yet")},firstColumnHeader:Liferay.Language.get("name"),hasDragAndDrop:!0,objectColumns:null!=g?g:[],onChangeColumnOrder:(e,t)=>{y({payload:{draggedIndex:e,targetIndex:t},type:i.TYPES.CHANGE_OBJECT_VIEW_COLUMN_ORDER})},onDeleteColumn:e=>{y({payload:{objectFieldName:e},type:i.TYPES.DELETE_OBJECT_VIEW_COLUMN}),y({payload:{objectFieldName:e},type:i.TYPES.DELETE_OBJECT_VIEW_SORT_COLUMN})},onEditingObjectFieldName:u,onVisibleEditModal:a,openModal:()=>{Liferay.Util.getOpener().Liferay.fire("openModalAddColumns",{getName:({label:t})=>t[e],header:Liferay.Language.get("add-columns"),items:s,onSave:e=>y({payload:{selectedObjectFields:e},type:i.TYPES.ADD_OBJECT_VIEW_COLUMN}),selected:b,title:Liferay.Language.get("select-the-columns")})},secondColumnHeader:Liferay.Language.get("column-label"),title:Liferay.Language.get("columns")}),t&&l.default.createElement(r.ModalEditViewColumn,{editingObjectFieldName:d,observer:c,onClose:f}))};t.default=u}}));
//# sourceMappingURL=ViewBuilderScreen.js.map