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