Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectField/EditObjectField",["module","exports","require","@frontend-taglib-clay$clayui/tabs","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./EditObjectField.scss","./Tabs/Advanced/AdvancedTab","./Tabs/BasicInfo/BasicInfo","./useObjectFieldForm"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function EditObjectField({creationLanguageId:t,filterOperators:a,forbiddenChars:c,forbiddenLastChars:u,forbiddenNames:f,isApproved:b,isDefaultStorageType:y,learnResources:p,objectDefinitionExternalReferenceCode:g,objectFieldId:j,objectFieldTypes:m,objectName:O,objectRelationshipId:h,readOnly:v,readOnlySidebarElements:T,sidebarElements:E,workflowStatusJSONArray:S}){const[w,F]=(0,i.useState)(0),{errors:I,handleChange:L,handleSubmit:_,setValues:P,values:C}=(0,o.useObjectFieldForm)({forbiddenChars:c,forbiddenLastChars:u,forbiddenNames:f,initialValues:d,onSubmit:async e=>{let{id:t}=e,a=function _objectWithoutProperties(e,t){if(null==e)return{};var a,r,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var a,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)a=i[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}(e,["id"]);delete a.defaultValue,delete a.listTypeDefinitionId,delete a.system;try{await n.API.save("/o/object-admin/v1.0/object-fields/".concat(t),a),(0,n.saveAndReload)(),(0,n.openToast)({message:Liferay.Language.get("the-object-field-was-updated-successfully")})}catch(e){(0,n.openToast)({message:e.message,type:"danger"})}}});(Liferay.FeatureFlags["LPS-170122"]||"Picklist"===C.businessType)&&e.length<2&&e.push(Liferay.Language.get("advanced"));return(0,i.useEffect)((()=>{(async()=>{const e=await n.API.getObjectField(j);P(e)})()}),[j]),i.default.createElement(n.SidePanelForm,{className:"lfr-objects__edit-object-field",onSubmit:_,readOnly:v,title:Liferay.Language.get("field")},Liferay.FeatureFlags["LPS-170122"]&&y||"Picklist"===C.businessType?i.default.createElement(i.default.Fragment,null,i.default.createElement(r.default,{className:"side-panel-iframe__tabs"},e.map(((e,t)=>i.default.createElement(r.default.Item,{active:w===t,key:t,onClick:()=>F(t)},e)))),i.default.createElement(r.default.Content,{activeIndex:w,fade:!0},i.default.createElement(r.default.TabPane,null,i.default.createElement(s.BasicInfo,{errors:I,filterOperators:a,handleChange:L,isApproved:b,isDefaultStorageType:y,objectDefinitionExternalReferenceCode:g,objectFieldTypes:m,objectName:O,objectRelationshipId:h,readOnly:v,setValues:P,values:C,workflowStatusJSONArray:S})),i.default.createElement(r.default.TabPane,null,i.default.createElement(l.AdvancedTab,{creationLanguageId:t,errors:I,isDefaultStorageType:y,learnResources:p,readOnlySidebarElements:T,setValues:P,sidebarElements:E,values:C})))):i.default.createElement(s.BasicInfo,{errors:I,filterOperators:a,handleChange:L,isApproved:b,isDefaultStorageType:y,objectDefinitionExternalReferenceCode:g,objectFieldTypes:m,objectName:O,objectRelationshipId:h,readOnly:v,setValues:P,values:C,workflowStatusJSONArray:S}))};var r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(a("@frontend-taglib-clay$clayui/tabs")),n=a("@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 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"));a("./EditObjectField.scss");var l=a("./Tabs/Advanced/AdvancedTab"),s=a("./Tabs/BasicInfo/BasicInfo"),o=a("./useObjectFieldForm");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}const e=[Liferay.Language.get("basic-info")],d={DBType:"",businessType:"Text",externalReferenceCode:"",id:0,indexed:!0,indexedAsKeyword:!1,indexedLanguageId:"en_US",label:{en_US:""},listTypeDefinitionId:0,name:"",objectFieldSettings:[],readOnlyConditionExpression:"",relationshipType:"",required:!1,state:!1,system:!1}}}));
//# sourceMappingURL=EditObjectField.js.map