Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ListTypeDefinition/ListTypeTable",["module","exports","require","@liferay/frontend-data-set-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function ListTypeTable({pickListId:e,readOnly:t,setValues:a,values:i}){const[l,o]=(0,n.useState)();return(0,n.useEffect)((()=>{const fireModal=t=>{Liferay.Util.getOpener().Liferay.fire("openListTypeEntriesModal",_objectSpread(_objectSpread({},t),{},{pickListId:e,reloadIframeWindow:window.location.reload.bind(window.location)}))};return Liferay.on("handleAddItems",(()=>{fireModal({header:Liferay.Language.get("new-item"),modalType:"add"})})),o(function getDataSetProps(e,t,a,r,i){const onActionDropdownItemClick=({action:t,itemData:n})=>{if("addListTypeEntry"===t.id&&e({header:Liferay.Language.get("edit-item"),itemExternalReferenceCode:n.externalReferenceCode,itemId:n.id,itemKey:n.key,modalType:"edit",name_i18n:n.name_i18n,readOnly:a}),"deleteListTypeEntry"===t.id){const{listTypeEntries:e}=i,t=null==e?void 0:e.filter((e=>e.key!==n.key));r(_objectSpread(_objectSpread({},i),{},{listTypeEntries:t}))}},l={href:"handleAddItems",label:Liferay.Language.get("add-item"),target:"event",type:"item"},o=a?[]:[l];return{actionParameterName:"",apiURL:"/o/headless-admin-list-type/v1.0/list-type-definitions/".concat(t,"/list-type-entries"),creationMenu:{primaryItems:o},currentURL:window.location.pathname+window.location.search,customDataRenderers:{itemNameRenderer:function itemNameRenderer({itemData:e,value:t}){return n.default.createElement("div",{className:"table-list-title"},n.default.createElement("a",{href:"#",onClick:()=>{onActionDropdownItemClick({action:{id:"addListTypeEntry"},itemData:e,value:t})}},t))}},customViewsEnabled:!1,formName:"fm",id:"com_liferay_object_web_internal_list_type_portlet_portlet_ListTypeDefinitionsPortlet-listTypeDefinitionItems",itemsActions:[{icon:"view",id:"addListTypeEntry",label:Liferay.Language.get("view")},{data:{id:"delete",method:"delete",permissionKey:"delete"},href:"/o/headless-admin-list-type/v1.0/list-type-entries/{id}",icon:"trash",id:"deleteListTypeEntry",label:"Delete",target:"async"}],namespace:"_com_liferay_object_web_internal_list_type_portlet_portlet_ListTypeDefinitionsPortlet_",onActionDropdownItemClick:onActionDropdownItemClick,pagination:{deltas:[{label:4},{label:8},{label:20},{label:40},{label:60}],initialDelta:8,initialPageNumber:0},portletId:"com_liferay_object_web_internal_list_type_portlet_portlet_ListTypeDefinitionsPortlet",showManagementBar:!0,showPagination:!0,showSearch:!0,style:"fluid",views:[{contentRenderer:"table",label:"Table",name:"table",schema:{fields:[{contentRenderer:"itemNameRenderer",expand:!1,fieldName:"name",label:Liferay.Language.get("name"),localizeLabel:!0,sortable:!1},{expand:!1,fieldName:"key",label:Liferay.Language.get("key"),localizeLabel:!0,sortable:!1},{expand:!1,fieldName:"externalReferenceCode",label:Liferay.Language.get("external-reference-code"),localizeLabel:!0,sortable:!1}]},thumbnail:"table"}]}}(fireModal,e,t,a,i)),()=>{Liferay.detach("handleAddItems")}}),[e,t,a,i]),l&&Object.keys(l).length?n.default.createElement(r.FrontendDataSet,l):null};var r=a("@liferay/frontend-data-set-web"),n=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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(a,n,i):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}}}));
//# sourceMappingURL=ListTypeTable.js.map