Liferay.Loader.define("@liferay/object-web@1.0.145/js/components/Layout/LayoutScreen/ObjectLayoutTabs",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/label","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","../objectLayoutContext","./HeaderDropdown","./ModalAddObjectLayoutBox","./ObjectLayoutBox","./ObjectLayoutRelationship"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),o=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/label")),r=a("@frontend-taglib-clay$clayui/modal"),u=a("@liferay/object-js-components-web"),c=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={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var n=l?Object.getOwnPropertyDescriptor(e,o):null;n&&(n.get||n.set)?Object.defineProperty(a,o,n):a[o]=e[o]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=a("../objectLayoutContext"),d=a("./HeaderDropdown"),y=a("./ModalAddObjectLayoutBox"),f=a("./ObjectLayoutBox"),b=a("./ObjectLayoutRelationship");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e=Liferay.ThemeDisplay.getDefaultLanguageId();var _default=()=>{var t;const[{isViewOnly:a,objectLayout:s},p]=(0,i.useLayoutContext)(),[g,L]=(0,c.useState)(!1),[j,m]=(0,c.useState)(0),{observer:O,onClose:_}=(0,r.useModal)({onClose:()=>L(!1)});return c.default.createElement(c.default.Fragment,null,null==s||null===(t=s.objectLayoutTabs)||void 0===t?void 0:t.map((({name:t,objectLayoutBoxes:r,objectRelationshipId:y},s)=>{const g=0!==y&&y,j=g?"warning":"info";return c.default.createElement(u.Panel,{className:"layout-tab__tab",key:"layout_".concat(s)},c.default.createElement(u.PanelHeader,{contentLeft:c.default.createElement(n.default,{displayType:j},g?Liferay.Language.get("relationships"):Liferay.Language.get("fields")),contentRight:c.default.createElement(c.default.Fragment,null,!g&&c.default.createElement(l.default,{disabled:a,displayType:"secondary",onClick:()=>{L(!0),m(s)},small:!0},c.default.createElement(o.default,{symbol:"plus"}),c.default.createElement("span",{className:"ml-2"},Liferay.Language.get("add-block"))),c.default.createElement(d.HeaderDropdown,{addCategorization:()=>{p({payload:{name:{[e]:Liferay.Language.get("categorization")},tabIndex:s,type:"categorization"},type:i.TYPES.ADD_OBJECT_LAYOUT_BOX})},deleteElement:()=>{p({payload:{tabIndex:s},type:i.TYPES.DELETE_OBJECT_LAYOUT_TAB})}})),title:t[e],type:"regular"}),!!(null==r?void 0:r.length)&&!g&&c.default.createElement(u.PanelBody,null,r.map((({collapsable:t,name:a,objectLayoutRows:l,type:o},n)=>c.default.createElement(f.ObjectLayoutBox,{boxIndex:n,collapsable:t,key:"box_".concat(n),label:a[e],objectLayoutRows:l,tabIndex:s,type:o})))),g&&c.default.createElement(u.PanelBody,null,c.default.createElement(b.ObjectLayoutRelationship,{objectRelationshipId:y})))})),g&&c.default.createElement(y.ModalAddObjectLayoutBox,{observer:O,onClose:_,tabIndex:j}))};t.default=_default}}));
//# sourceMappingURL=ObjectLayoutTabs.js.map