Liferay.Loader.define("@liferay/object-web@1.0.145/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}var _default=()=>{const[e,t]=(0,r.useState)(!1),[a,d]=(0,r.useState)(""),{observer:u,onClose:c}=(0,n.useModal)({onClose:()=>t(!1)}),[{creationLanguageId:f,objectFields:g,objectView:{objectViewColumns:s}},m]=(0,i.useViewContext)(),y=new Set(s.map((({objectFieldName:e})=>e))),b=g.filter((({name:e})=>y.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!=s?s:[],onChangeColumnOrder:(e,t)=>{m({payload:{draggedIndex:e,targetIndex:t},type:i.TYPES.CHANGE_OBJECT_VIEW_COLUMN_ORDER})},onDeleteColumn:e=>{m({payload:{objectFieldName:e},type:i.TYPES.DELETE_OBJECT_VIEW_COLUMN}),m({payload:{objectFieldName:e},type:i.TYPES.DELETE_OBJECT_VIEW_SORT_COLUMN})},onEditingObjectFieldName:d,onVisibleEditModal:t,openModal:()=>{Liferay.Util.getOpener().Liferay.fire("openModalAddColumns",{getName:({label:e,name:t})=>(0,o.getLocalizableLabel)(f,e,t),header:Liferay.Language.get("add-columns"),items:g,onSave:e=>m({payload:{creationLanguageId:f,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")}),e&&r.default.createElement(l.ModalEditViewColumn,{editingObjectFieldName:a,observer:u,onClose:c}))};t.default=_default}}));
//# sourceMappingURL=ViewBuilderScreen.js.map