"use strict";(self.webpackChunknocode_component=self.webpackChunknocode_component||[]).push([[8150,8832],{40180:function(e,n,t){t.r(n),t.d(n,{default:function(){return j}});var a=t(34716),o=t.n(a),r=t(70696),c=t.n(r),u=t(4884),l=t.n(u),i=t(3464),s=t.n(i),f=t(51400),v=t.n(f),d=t(25028),m=t.n(d),g=t(30112),h=t(72048),p=(t(21300),t(87912),t(97308),t(38456)),b=t.n(p),k=t(13939),C=t.n(k),w=t(67584),E=t.n(w),S=t(61260),D=t.n(S),F=t(65984),I=t.n(F),M="adya10sl_nocode-designer-wrapper",y=t(71252),N=t.n(y),R=t(81268),L=t(39756),_=t(57288),A=t(6523),G=t(47906),x=t(45984),O=t(37668),P=t(71500),T=t(38680);function U(e,n){var t=C()(e);if(o()){var a=o()(e);n&&(a=c()(a).call(a,(function(n){return l()(e,n).enumerable}))),t.push.apply(t,a)}return t}function W(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?U(Object(t),!0).forEach((function(n){(0,g.c)(e,n,t[n])})):s()?v()(e,s()(t)):U(Object(t)).forEach((function(n){m()(e,n,l()(t,n))}))}return e}var $=(0,F.memo)((function(e){var n=e.controlMeta,t=(0,F.useContext)(L.m).model,a=(0,F.useState)(null),o=(0,h.c)(a,2),r=o[0],c=o[1],u=(0,F.useState)(null),l=(0,h.c)(u,2),i=l[0],s=l[1],f=n.pageId,v=n.id,d=(0,F.useRef)(!1),m=t.getFormStatus(f),p=(0,R.F)("nocodeflow").Component,k=(null==p?void 0:p.NocodeFlow)||null,w=(0,F.useRef)(),S=(0,F.useRef)(),y=(0,F.useRef)(),U=(0,F.useState)(t.getGlobal(A.m2)||{}),$=(0,h.c)(U,2),j=$[0],K=$[1],B=(0,F.useState)(t.getGlobal(A._I)||{}),H=(0,h.c)(B,1)[0],Q=(0,F.useRef)(!1),Z=(0,F.useCallback)((function(e){var n,a,o=e.methodname,r=e.args;if(o===A.Gu){var c;Q.current=!1;var u=((null==r?void 0:r[0])||{}).errors,l=void 0===u?{}:u;Q.current=b()(c=C()(l)).call(c,(function(e){var n;return(null===(n=l[e])||void 0===n?void 0:n.length)>0}))||!1}switch(o){case"open":s(r),S.current=(null==r?void 0:r[0])||{};var i=S.current||{},f=i.procInstId,v=i.id,d=i.name;!function(e,n){window.sessionStorage.setItem(e,n),(0,O.Q9)("storage")}("nocode-flow-data-".concat(f||v),d),t.emitEvent(A.wS,d);break;case"closeWfSaveLoading":null==H||null===(n=H.saveStatus)||void 0===n||n.call(H),null===(a=y.current)||void 0===a||a.call(y),Q.current?Q.current=!1:t.emitEvent(A.cv,{type:A.iO,args:r});break;case T.c$:t.emitEvent(T.c$,r);break;default:!function(e,n){var t,a;null===(t=w.current)||void 0===t||null===(a=t.pubEvent)||void 0===a||a.call(t,e,n)}(o,r[0])}}),[w.current]),q=(0,F.useCallback)((function(){(0,_.fetchData)(f,"nocode/getWfDomainModel.do").then((function(e){e.data&&c(e.data)}))}),[f]),z=(0,F.useCallback)((function(e){e.forEach((function(e){return Z(e)}))}),[]),J=(0,F.useCallback)((function(e){if("updateFlowName"===e.type)re(e.payload)}),[]),V=(0,F.useCallback)((function(e){K(e)}),[K]),X=function(e){te("addNewRef",[e.formId])};(0,F.useEffect)((function(){window.noCodeDesignerRef={save:ae,getDesignerData:function(){return S.current}},q();var e=t.addControlAction("InvokeControlMethod",f,v,z),n=t.addEventListener(A._0,ae),a=t.addEventListener(A.A$,J),o=t.addEventListener(A.m2,V),r=t.addEventListener(A.ZN,X);return function(){var t;e(),n(),a(),null==o||o(),null===(t=y.current)||void 0===t||t.call(y),r()}}),[]);var Y=(0,F.useCallback)((function(e){S.current=e,t.emitEvent(A.iK,e,!0)}),[]),ee=(0,F.useCallback)((function(e){w.current=W({},e)}),[]);(0,F.useEffect)((function(){r&&i&&k&&!d.current&&(d.current=!0,t.emitEvent(A._E,!0))}),[r,i,k]);var ne=(0,F.useCallback)((function(e,n,a,o){return t.batchInvoke(e,f,n,a,o)}),[f]),te=(0,F.useCallback)((function(e,n){ne(e,v,n,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[])}),[v,ne]),ae=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"save";E()((function(){var n=e.split(","),t=oe(),a=n.length>1?D()(n).call(n,1):[e];te("designerBarClick",a,[t]),y.current=(0,P.showLoadingMessage)("流程保存中，请稍等...")}),20)},oe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=W(W({},S.current),e),t={};return t[v]=n,t},re=function(e){if(e&&w.current){var n=w.current.setDesignerDataRef;null==n||n({name:e})}},ce=(0,F.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,O.s9)(e,2e3,n)}),[]);t.getGlobal(A.m2);var ue=N()((0,g.c)({},M,!0));return r&&i&&k?I().createElement("div",{className:ue},I().createElement(k,{name:"NoCodeFlow",meta:r,data:i,onData:Y,invokeAction:te,batchInvoke:ne,onApi:ee,compareType:j,fetchControlData:t.fetchControlData,getControlText:t.getControlText,baseUrl:{attachment:t.getFileServer("attachment"),picture:t.getFileServer("picture")},invokeApi:{saveSyncData:function(e){E()((function(){var n=oe();te(A.kP,e,[n])}))},getUserSelectMenu:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];E()((function(){var n=oe();te("approverMenu",e,[n])}))}},flowStatus:m,webMsg:G.WebMsg,baseHooks:x.hooks,customUtils:{showFieldPermission:function(e){t.emitEvent("showFieldPermission",e)}},showMessage:ce})):null}));$.displayName="KDNocodeFlow";var j=$}}]);