(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[42489],{42489:function(de,Mr,e){"use strict";e.d(Mr,{I:function(){return ue}});var ve=e(20228),Br=e(11382),tr=e(28481),Pr=e(96156),n=e(28991),X=e(55507),fr=e(92137),me=e(84305),Rr=e(39559),ce=e(9715),dr=e(55843),Cr=e(81253),I=e(85893),Ar=e(78775),a=e(67294),Dr=e(29405),vr=0;function Kr(r){var t=(0,a.useState)(function(){return r.proFieldKey?r.proFieldKey.toString():(vr+=1,vr.toString())}),h=(0,tr.Z)(t,1),u=h[0],$=(0,a.useRef)(u),P=function(){var m=(0,fr.Z)((0,X.Z)().mark(function B(){var o,F;return(0,X.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,(o=r.request)===null||o===void 0?void 0:o.call(r,r.params,r);case 2:return F=l.sent,l.abrupt("return",F);case 4:case"end":return l.stop()}},B)}));return function(){return m.apply(this,arguments)}}();(0,a.useEffect)(function(){return function(){vr+=1}},[]);var S=(0,Dr.ZP)([$.current,r.params],P,{revalidateOnFocus:!1,shouldRetryOnError:!1,revalidateOnReconnect:!1}),v=S.data,s=S.error;return[v||s]}var Or=Kr,Nr=e(85061),J=e(90484),br=e(88306),Y=e(8880),Tr=e(74763),zr=e(92210);function Lr(r){return(0,J.Z)(r)!=="object"?!1:r===null?!0:!(a.isValidElement(r)||r.constructor===RegExp||r instanceof Map||r instanceof Set||r instanceof HTMLElement||r instanceof Blob||r instanceof File||Array.isArray(r))}var Hr=function(t,h){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,$=Object.keys(h).reduce(function(v,s){var m=h[s];return(0,Tr.Z)(m)||(v[s]=m),v},{});if(Object.keys($).length<1||typeof window=="undefined"||(0,J.Z)(t)!=="object"||(0,Tr.Z)(t)||t instanceof Blob)return t;var P=Array.isArray(t)?[]:{},S=function v(s,m){var B=Array.isArray(s),o=B?[]:{};return s==null||s===void 0?o:(Object.keys(s).forEach(function(F){var x=m?[m,F].flat(1):[F].flat(1),l=s[F],R=(0,br.Z)($,x),D=function i(g){return Array.isArray(g)&&g.forEach(function(Z,C){!Z||(typeof Z=="function"&&(l[C]=Z(l,F,s)),(0,J.Z)(Z)==="object"&&!Array.isArray(Z)&&Object.keys(Z).forEach(function(p){if(typeof Z[p]=="function"){var w=Z[p](s[F][C][p],F,s);l[C][p]=(0,J.Z)(w)==="object"?w[p]:w}}),(0,J.Z)(Z)==="object"&&Array.isArray(Z)&&i(Z))}),F},E=function(){var g=typeof R=="function"?R==null?void 0:R(l,F,s):D(R);if(Array.isArray(g)){o=(0,Y.Z)(o,g,l);return}(0,J.Z)(g)==="object"&&!Array.isArray(P)?P=(0,n.Z)((0,n.Z)({},P),g):(0,J.Z)(g)==="object"&&Array.isArray(P)?o=(0,n.Z)((0,n.Z)({},o),g):g&&(o=(0,Y.Z)(o,[g],l))};if(R&&typeof R=="function"&&E(),typeof window!="undefined"){if(Lr(l)){var U=v(l,x);if(Object.keys(U).length<1)return;o=(0,Y.Z)(o,[F],U);return}E()}}),u?o:s)};return P=Array.isArray(t)&&Array.isArray(P)?(0,Nr.Z)(S(t)):(0,zr.T)({},S(t),P),P},Wr=Hr,Gr=e(22270),Ir=e(48171),Jr=e(26369),Yr=e(60249),Qr=e(41036),Xr=e(56725),wr=e(75661),kr=e(23312),qr=e(45095),mr=e(97435),Vr=e(80334),ye=e(49111),_r=e(19650),ge=e(57663),jr=e(71577),re=function(t){var h=(0,Ar.YB)(),u=dr.Z.useFormInstance();if(t.render===!1)return null;var $=t.onSubmit,P=t.render,S=t.onReset,v=t.searchConfig,s=v===void 0?{}:v,m=t.submitButtonProps,B=t.resetButtonProps,o=B===void 0?{}:B,F=function(){u.submit(),$==null||$()},x=function(){u.resetFields(),S==null||S()},l=s.submitText,R=l===void 0?h.getMessage("tableForm.submit","\u63D0\u4EA4"):l,D=s.resetText,E=D===void 0?h.getMessage("tableForm.reset","\u91CD\u7F6E"):D,U=[];o!==!1&&U.push((0,a.createElement)(jr.Z,(0,n.Z)((0,n.Z)({},(0,mr.Z)(o,["preventDefault"])),{},{key:"rest",onClick:function(Z){var C;(o==null?void 0:o.preventDefault)||x(),o==null||(C=o.onClick)===null||C===void 0||C.call(o,Z)}}),E)),m!==!1&&U.push((0,a.createElement)(jr.Z,(0,n.Z)((0,n.Z)({type:"primary"},(0,mr.Z)(m||{},["preventDefault"])),{},{key:"submit",onClick:function(Z){var C;(m==null?void 0:m.preventDefault)||F(),m==null||(C=m.onClick)===null||C===void 0||C.call(m,Z)}}),R));var i=P?P((0,n.Z)((0,n.Z)({},t),{},{form:u,submit:F,reset:x}),U):U;return i?Array.isArray(i)?(i==null?void 0:i.length)<1?null:(i==null?void 0:i.length)===1?i[0]:(0,I.jsx)(_r.Z,{wrap:!0,children:i}):i:null},ee=re,te=e(66758),Sr=e(2514),ne=e(9105),ae=["children","contentRender","submitter","fieldProps","formItemProps","groupProps","transformKey","formRef","onInit","form","loading","formComponentType","extraUrlParams","syncToUrl","onUrlSearchChange","onReset","omitNil","isKeyPressSubmit","autoFocusFirstInput","grid","rowProps","colProps"],oe=["extraUrlParams","syncToUrl","isKeyPressSubmit","syncToUrlAsImportant","syncToInitialValues","children","contentRender","submitter","fieldProps","formItemProps","groupProps","dateFormatter","formRef","onInit","form","formComponentType","onReset","grid","rowProps","colProps","omitNil","request","params","initialValues","formKey","readonly"],cr=function(t,h,u){return t===!0?h:(0,Gr.h)(t,h,u)},$r=function(t){return!t||Array.isArray(t)?t:[t]};function ie(r){var t=r.children,h=r.contentRender,u=r.submitter,$=r.fieldProps,P=r.formItemProps,S=r.groupProps,v=r.transformKey,s=r.formRef,m=r.onInit,B=r.form,o=r.loading,F=r.formComponentType,x=r.extraUrlParams,l=x===void 0?{}:x,R=r.syncToUrl,D=r.onUrlSearchChange,E=r.onReset,U=r.omitNil,i=U===void 0?!0:U,g=r.isKeyPressSubmit,Z=r.autoFocusFirstInput,C=Z===void 0?!0:Z,p=r.grid,w=r.rowProps,ir=r.colProps,k=(0,Cr.Z)(r,ae),q=dr.Z.useFormInstance(),yr=(0,a.useContext)(Rr.ZP.SizeContext),K=(0,a.useRef)(B||q),ur=(0,Sr.zx)({grid:p,rowProps:w}),sr=ur.RowWrapper,nr=(0,Ir.J)(function(){return q}),M=(0,a.useMemo)(function(){return{getFieldsFormatValue:function(c){var y;return v((y=nr())===null||y===void 0?void 0:y.getFieldsValue(c),i)},getFieldFormatValue:function(){var c,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=$r(y);if(!d)throw new Error("nameList is require");var A=(c=nr())===null||c===void 0?void 0:c.getFieldValue(d),O=d?(0,Y.Z)({},d,A):A;return(0,br.Z)(v(O,i,d),d)},getFieldFormatValueObject:function(c){var y,d=$r(c),A=(y=nr())===null||y===void 0?void 0:y.getFieldValue(d),O=d?(0,Y.Z)({},d,A):A;return v(O,i,d)},validateFieldsReturnFormatValue:function(){var f=(0,fr.Z)((0,X.Z)().mark(function y(d){var A,O,Q;return(0,X.Z)().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:if(!(!Array.isArray(d)&&d)){H.next=2;break}throw new Error("nameList must be array");case 2:return H.next=4,(A=nr())===null||A===void 0?void 0:A.validateFields(d);case 4:return O=H.sent,Q=v(O,i),H.abrupt("return",Q||{});case 7:case"end":return H.stop()}},y)}));function c(y){return f.apply(this,arguments)}return c}(),formRef:K}},[i,v]),V=(0,a.useMemo)(function(){return a.Children.toArray(t).map(function(f,c){return c===0&&a.isValidElement(f)&&C?a.cloneElement(f,(0,n.Z)((0,n.Z)({},f.props),{},{autoFocus:C})):f})},[C,t]),z=(0,a.useMemo)(function(){return typeof u=="boolean"||!u?{}:u},[u]);(0,a.useImperativeHandle)(s,function(){return(0,n.Z)((0,n.Z)({},q),M)},[M,q]);var ar=(0,a.useMemo)(function(){if(u!==!1)return(0,I.jsx)(ee,(0,n.Z)((0,n.Z)({},z),{},{onReset:function(){var c,y,d=v((c=K.current)===null||c===void 0?void 0:c.getFieldsValue(),i);if(z==null||(y=z.onReset)===null||y===void 0||y.call(z,d),E==null||E(d),R){var A,O=Object.keys(v((A=K.current)===null||A===void 0?void 0:A.getFieldsValue(),!1)).reduce(function(Q,L){return(0,n.Z)((0,n.Z)({},Q),{},(0,Pr.Z)({},L,d[L]||void 0))},l);D(cr(R,O,"set"))}},submitButtonProps:(0,n.Z)({loading:o},z.submitButtonProps)}),"submitter")},[u,z,o,v,i,E,R,l,D]),lr=(0,a.useMemo)(function(){var f=p?(0,I.jsx)(sr,{children:V}):V;return h?h(f,ar,K.current):f},[p,sr,V,h,ar]),_=(0,Jr.Z)(r.initialValues);return(0,a.useEffect)(function(){if(!(R||!r.initialValues||!_||k.request)){var f=(0,Yr.Z)(r.initialValues,_);(0,Vr.ET)(f,"initialValues \u53EA\u5728 form \u521D\u59CB\u5316\u65F6\u751F\u6548\uFF0C\u5982\u679C\u4F60\u9700\u8981\u5F02\u6B65\u52A0\u8F7D\u63A8\u8350\u4F7F\u7528 request\uFF0C\u6216\u8005 initialValues ?
: null "),(0,Vr.ET)(f,"The initialValues only take effect when the form is initialized, if you need to load asynchronously recommended request, or the initialValues ? : null ")}},[r.initialValues]),(0,a.useEffect)(function(){var f,c,y=v((f=K.current)===null||f===void 0||(c=f.getFieldsValue)===null||c===void 0?void 0:c.call(f,!0),i);m==null||m(y,K.current)},[]),(0,I.jsx)(Qr.Z.Provider,{value:M,children:(0,I.jsx)(Rr.ZP.SizeContext.Provider,{value:k.size||yr,children:(0,I.jsxs)(Sr._p.Provider,{value:{grid:p,colProps:ir},children:[k.component!==!1&&(0,I.jsx)("input",{type:"text",style:{display:"none"}}),lr]})})})}var xr=0;function ue(r){var t=r.extraUrlParams,h=t===void 0?{}:t,u=r.syncToUrl,$=r.isKeyPressSubmit,P=r.syncToUrlAsImportant,S=P===void 0?!1:P,v=r.syncToInitialValues,s=v===void 0?!0:v,m=r.children,B=r.contentRender,o=r.submitter,F=r.fieldProps,x=r.formItemProps,l=r.groupProps,R=r.dateFormatter,D=R===void 0?"string":R,E=r.formRef,U=r.onInit,i=r.form,g=r.formComponentType,Z=r.onReset,C=r.grid,p=r.rowProps,w=r.colProps,ir=r.omitNil,k=ir===void 0?!0:ir,q=r.request,yr=r.params,K=r.initialValues,ur=r.formKey,sr=ur===void 0?xr:ur,nr=r.readonly,M=(0,Cr.Z)(r,oe),V=(0,a.useRef)({}),z=(0,Xr.Z)(!1),ar=(0,tr.Z)(z,2),lr=ar[0],_=ar[1],f=(0,qr.l)({},{disabled:!u}),c=(0,tr.Z)(f,2),y=c[0],d=c[1],A=(0,a.useRef)((0,wr.x)());(0,a.useEffect)(function(){xr+=0},[]);var O=Or({request:q,params:yr,proFieldKey:sr}),Q=(0,tr.Z)(O,1),L=Q[0],H=(0,a.useState)(function(){return u?cr(u,y,"get"):{}}),Er=(0,tr.Z)(H,2),Ur=Er[0],se=Er[1],gr=(0,a.useRef)({}),Fr=(0,a.useRef)({}),Zr=(0,a.useCallback)(function(W,b,T){return Wr((0,kr.ZP)(W,D,Fr.current,b,T),gr.current,b)},[D]);(0,a.useEffect)(function(){s||se({})},[s]),(0,a.useEffect)(function(){!u||d((0,n.Z)((0,n.Z)({},y),h))},[h,u]);var le=(0,a.useMemo)(function(){if(typeof window!="undefined"&&g&&["DrawerForm"].includes(g))return function(W){return W.parentNode||document.body}},[g]),fe=(0,Ir.J)((0,fr.Z)((0,X.Z)().mark(function W(){var b,T,N,rr,or,G;return(0,X.Z)().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(M.onFinish){j.next=2;break}return j.abrupt("return");case 2:if(!lr){j.next=4;break}return j.abrupt("return");case 4:return _(!0),j.prev=5,N=V==null||(b=V.current)===null||b===void 0||(T=b.getFieldsFormatValue)===null||T===void 0?void 0:T.call(b),j.next=9,M.onFinish(N);case 9:u&&(G=Object.keys(V==null||(rr=V.current)===null||rr===void 0||(or=rr.getFieldsFormatValue)===null||or===void 0?void 0:or.call(rr,void 0,!1)).reduce(function(er,pr){var hr;return(0,n.Z)((0,n.Z)({},er),{},(0,Pr.Z)({},pr,(hr=N[pr])!==null&&hr!==void 0?hr:void 0))},h),Object.keys(y).forEach(function(er){G[er]!==!1&&G[er]!==0&&!G[er]&&(G[er]=void 0)}),d(cr(u,G,"set"))),_(!1),j.next=16;break;case 13:j.prev=13,j.t0=j.catch(5),_(!1);case 16:case"end":return j.stop()}},W,null,[[5,13]])})));return(0,a.useImperativeHandle)(E,function(){return V.current},[!L]),!L&&r.request?(0,I.jsx)("div",{style:{paddingTop:50,paddingBottom:50,textAlign:"center"},children:(0,I.jsx)(Br.Z,{})}):(0,I.jsx)(ne.A.Provider,{value:{mode:r.readonly?"read":"edit"},children:(0,I.jsx)(Ar.oK,{children:(0,I.jsx)(te.Z.Provider,{value:{formRef:V,fieldProps:F,formItemProps:x,groupProps:l,formComponentType:g,getPopupContainer:le,formKey:A.current,setFieldValueType:function(b,T){var N=T.valueType,rr=N===void 0?"text":N,or=T.dateFormat,G=T.transform;!Array.isArray(b)||(gr.current=(0,Y.Z)(gr.current,b,G),Fr.current=(0,Y.Z)(Fr.current,b,{valueType:rr,dateFormat:or}))}},children:(0,I.jsx)(dr.Z,(0,n.Z)((0,n.Z)({onKeyPress:function(b){if(!!$&&b.key==="Enter"){var T;(T=V.current)===null||T===void 0||T.submit()}},autoComplete:"off",form:i},(0,mr.Z)(M,["autoFocusFirstInput"])),{},{initialValues:S?(0,n.Z)((0,n.Z)((0,n.Z)({},L),K),Ur):(0,n.Z)((0,n.Z)((0,n.Z)({},Ur),L),K),onValuesChange:function(b,T){var N;M==null||(N=M.onValuesChange)===null||N===void 0||N.call(M,Zr(b,!!k),Zr(T,!!k))},onFinish:fe,children:(0,I.jsx)(ie,(0,n.Z)((0,n.Z)({transformKey:Zr,autoComplete:"off",loading:lr,onUrlSearchChange:d},r),{},{formRef:V,initialValues:(0,n.Z)((0,n.Z)({},K),L)}))}))})})})}}}]);