Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ListTypeDefinition/EditListTypeDefinition",["module","exports","require","@frontend-taglib-clay$clayui/alert","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./ListTypeFormBase","./ListTypeTable","./utils"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function EditListTypeDefinition({listTypeDefinitionId:e,readOnly:t}){const{errors:r,handleSubmit:u,setValues:s,values:f}=(0,l.useListTypeForm)({initialValues:{},onSubmit:async t=>{try{await a.API.updatePickList({externalReferenceCode:t.externalReferenceCode,id:parseInt(e,10),listTypeEntries:t.listTypeEntries,name_i18n:t.name_i18n}),(0,a.saveAndReload)(),(0,a.openToast)({message:Liferay.Language.get("the-picklist-was-updated-successfully")})}catch(e){const{message:t}=e;(0,a.openToast)({message:t,type:"danger"})}}});return(0,i.useEffect)((()=>{a.API.getPickList(parseInt(e,10)).then((e=>{e.name_i18n=(0,c.fixLocaleKeys)(e.name_i18n),e.listTypeEntries=e.listTypeEntries.map((e=>_objectSpread(_objectSpread({},e),{},{name_i18n:(0,c.fixLocaleKeys)(e.name_i18n)}))),s(e)}))}),[]),i.default.createElement(a.SidePanelForm,{onSubmit:u,readOnly:t,title:Liferay.Language.get("picklist")},0!==Object.keys(f).length&&i.default.createElement(i.default.Fragment,null,i.default.createElement(a.Card,{title:Liferay.Language.get("basic-info")},i.default.createElement(a.InputLocalized,{disabled:t,error:r.name_i18n,label:Liferay.Language.get("name"),onChange:e=>s({name_i18n:e}),required:!0,translations:f.name_i18n}),i.default.createElement(a.Input,{autoComplete:"off",error:r.externalReferenceCode,feedbackMessage:Liferay.Language.get("unique-key-for-referencing-the-picklist-definition"),label:Liferay.Language.get("external-reference-code"),onChange:({target:{value:e}})=>{s({externalReferenceCode:e})},required:!0,value:f.externalReferenceCode})),i.default.createElement(a.Card,{title:Liferay.Language.get("items")},i.default.createElement("div",{className:"container-fluid container-fluid-max-xl"},i.default.createElement(n.default,{displayType:"info",title:"Info"},Liferay.Language.get("updating-or-deleting-a-picklist-item-will-automatically-update-every-entry-that-is-using-the-specific-item-value"))),f.id&&i.default.createElement(o.default,{pickListId:f.id,readOnly:t,setValues:s,values:f}))))};var n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/alert")),a=r("@liferay/object-js-components-web"),i=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 r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),l=r("./ListTypeFormBase"),o=_interopRequireDefault(r("./ListTypeTable")),c=r("./utils");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}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=EditListTypeDefinition.js.map