Liferay.Loader.define("@liferay/object-web@1.0.181/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","../../../utils/constants","../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("../../../utils/constants"),d=a("../objectLayoutContext"),y=a("./HeaderDropdown"),f=a("./ModalAddObjectLayoutBox"),b=a("./ObjectLayoutBox"),s=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}}var _default=()=>{var e;const[{creationLanguageId:t,isViewOnly:a,objectLayout:p},g]=(0,d.useLayoutContext)(),[L,j]=(0,c.useState)(!1),[m,O]=(0,c.useState)(0),{observer:_,onClose:E}=(0,r.useModal)({onClose:()=>j(!1)});return c.default.createElement(c.default.Fragment,null,null==p||null===(e=p.objectLayoutTabs)||void 0===e?void 0:e.map((({name:e,objectLayoutBoxes:r,objectRelationshipId:f},p)=>{const L=0!==f&&f,m=L?"warning":"info";return c.default.createElement(u.Panel,{className:"layout-tab__tab",key:"layout_".concat(p)},c.default.createElement(u.PanelHeader,{contentLeft:c.default.createElement(n.default,{displayType:m},L?Liferay.Language.get("relationships"):Liferay.Language.get("fields")),contentRight:c.default.createElement(c.default.Fragment,null,!L&&c.default.createElement(l.default,{disabled:a,displayType:"secondary",onClick:()=>{j(!0),O(p)},small:!0},c.default.createElement(o.default,{symbol:"plus"}),c.default.createElement("span",{className:"ml-2"},Liferay.Language.get("add-block"))),c.default.createElement(y.HeaderDropdown,{addCategorization:()=>{g({payload:{name:{[i.defaultLanguageId]:Liferay.Language.get("categorization")},tabIndex:p,type:"categorization"},type:d.TYPES.ADD_OBJECT_LAYOUT_BOX})},deleteElement:()=>{g({payload:{tabIndex:p},type:d.TYPES.DELETE_OBJECT_LAYOUT_TAB})}})),title:(0,u.getLocalizableLabel)(t,e),type:"regular"}),!!(null==r?void 0:r.length)&&!L&&c.default.createElement(u.PanelBody,null,r.map((({collapsable:e,name:a,objectLayoutRows:l,type:o},n)=>c.default.createElement(b.ObjectLayoutBox,{boxIndex:n,collapsable:e,key:"box_".concat(n),label:(0,u.getLocalizableLabel)(t,a),objectLayoutRows:l,tabIndex:p,type:o})))),L&&c.default.createElement(u.PanelBody,null,c.default.createElement(s.ObjectLayoutRelationship,{objectRelationshipId:f})))})),L&&c.default.createElement(f.ModalAddObjectLayoutBox,{observer:_,onClose:E,tabIndex:m}))};t.default=_default}}));
//# sourceMappingURL=ObjectLayoutTabs.js.map