Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectAction/index",["module","exports","require","liferay!object-web$codemirror/mode/groovy/groovy","@frontend-taglib-clay$clayui/tabs","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./tabs/ActionBuilder","./tabs/BasicInfo","./useObjectActionForm"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function Action({isApproved:t,objectAction:a,objectActionCodeEditorElements:s,objectActionExecutors:u,objectActionTriggers:d,objectDefinitionExternalReferenceCode:f,objectDefinitionId:b,objectDefinitionsRelationshipsURL:p,readOnly:j,requestParams:{method:y,url:g},successMessage:m,systemObject:v,validateExpressionURL:h}){const[E,O]=(0,o.useState)({}),{errors:A,handleChange:R,handleSubmit:w,setValues:_,values:D}=(0,l.useObjectActionForm)({initialValues:a,onSubmit:async e=>{e.parameters&&(null==e||delete e.parameters.lineCount),delete e.objectDefinitionId;try{await r.API.save(g,e,y),(0,r.saveAndReload)(),(0,r.openToast)({message:m})}catch(e){const{detail:t}=e,a=JSON.parse(t),n={},parseError=(e,t)=>{e.forEach((({fieldName:e,message:a,messages:n})=>{a?t[e]=a:(t[e]={},parseError(n,t[e]))}))};parseError(a,n),O(n);const o=new Set,getErrorMessage=e=>{Object.values(e).forEach((e=>{"string"==typeof e?o.has(e)||o.add(e):getErrorMessage(e)}))};getErrorMessage(n),o.forEach((e=>{(0,r.openToast)({message:e,type:"danger"})}))}}}),[C,L]=(0,o.useState)(0);return o.default.createElement(r.SidePanelForm,{onSubmit:w,title:Liferay.Language.get("new-action")},o.default.createElement(n.default,null,e.map(((e,t)=>o.default.createElement(n.default.Item,{active:C===t,key:t,onClick:()=>L(t)},e)))),o.default.createElement(n.default.Content,{activeIndex:C,fade:!0},o.default.createElement(n.default.TabPane,null,o.default.createElement(c.default,{errors:Object.keys(A).length?A:E,handleChange:R,isApproved:t,readOnly:j,setValues:_,values:D})),o.default.createElement(n.default.TabPane,null,o.default.createElement(i.default,{errors:Object.keys(A).length?A:E,isApproved:t,objectActionCodeEditorElements:s,objectActionExecutors:u,objectActionTriggers:d,objectDefinitionExternalReferenceCode:f,objectDefinitionId:null!=b?b:a.objectDefinitionId,objectDefinitionsRelationshipsURL:p,setValues:_,systemObject:v,validateExpressionURL:h,values:D}))))},a("liferay!object-web$codemirror/mode/groovy/groovy");var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/tabs")),r=a("@liferay/object-js-components-web"),o=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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var o=n?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=_interopRequireDefault(a("./tabs/ActionBuilder")),c=_interopRequireDefault(a("./tabs/BasicInfo")),l=a("./useObjectActionForm");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}}const e=[Liferay.Language.get("basic-info"),Liferay.Language.get("action-builder")]}}));
//# sourceMappingURL=index.js.map