Liferay.Loader.define("@liferay/object-web@1.0.132/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"),r=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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var r=n?Object.getOwnPropertyDescriptor(e,o):null;r&&(r.get||r.set)?Object.defineProperty(a,o,r):a[o]=e[o]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),l=a("../ModalEditViewColumn/ModalEditViewColumn"),i=a("../objectViewContext");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}const e=Liferay.ThemeDisplay.getDefaultLanguageId();var _default=()=>{const[t,a]=(0,r.useState)(!1),[d,u]=(0,r.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 r.default.createElement(r.default.Fragment,null,r.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&&r.default.createElement(l.ModalEditViewColumn,{editingObjectFieldName:d,observer:c,onClose:f}))};t.default=_default}}));
//# sourceMappingURL=ViewBuilderScreen.js.map