Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/EditObjectValidation",["module","exports","require","@frontend-taglib-clay$clayui/tabs","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./DataValidation/ObjectValidationTabs","./ObjectValidationFormBase"],(function(e,t,a){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({objectValidationRule:t,objectValidationRuleElements:a,readOnly:n}){var r;const[c,d]=(0,i.useState)(0),[u,f]=(0,i.useState)({}),{errors:b,handleChange:m,handleSubmit:p,setValues:y,values:j}=(0,s.useObjectValidationForm)({initialValues:t,onSubmit:async e=>{delete e.lineCount;try{await o.API.save("/o/object-admin/v1.0/object-validation-rules/".concat(e.id),e),(0,o.saveAndReload)(),(0,o.openToast)({message:Liferay.Language.get("the-object-validation-was-updated-successfully")})}catch(e){const{detail:t,message:a}=e,{fieldName:n,message:l}=JSON.parse(t);f({[n]:l}),(0,o.openToast)({message:a,type:"danger"})}}});return(0,i.useEffect)((()=>{"script_placeholder"===t.script&&(t.script="")}),[]),i.default.createElement(o.SidePanelForm,{onSubmit:p,title:null===(r=t.name)||void 0===r?void 0:r[Liferay.ThemeDisplay.getDefaultLanguageId()]},i.default.createElement(l.default,{className:"side-panel-iframe__tabs"},e.map((({label:e},t)=>i.default.createElement(l.default.Item,{active:c===t,key:t,onClick:()=>d(t)},e)))),i.default.createElement(l.default.Content,{activeIndex:c,fade:!0},e.map((({Component:e,label:t},o)=>c===o?i.default.createElement(l.default.TabPane,{key:o},i.default.createElement(e,{componentLabel:t,disabled:n,errors:0!==Object.keys(b).length?b:u,handleChange:m,objectValidationRuleElements:a,setValues:y,values:j})):i.default.createElement(i.default.Fragment,{key:o})))))};var l=(n=a("@frontend-taglib-clay$clayui/tabs"))&&n.__esModule?n:{default:n},o=a("@liferay/object-js-components-web"),i=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var o=n?Object.getOwnPropertyDescriptor(e,l):null;o&&(o.get||o.set)?Object.defineProperty(a,l,o):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),r=a("./DataValidation/ObjectValidationTabs"),s=a("./ObjectValidationFormBase");function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}const e=[{Component:r.BasicInfo,label:Liferay.Language.get("basic-info")},{Component:r.Conditions,label:Liferay.Language.get("conditions")}]}}));
//# sourceMappingURL=EditObjectValidation.js.map