"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[6388],{50727:function(ye,oe,r){var b=r(4942),ie=r(97685),W=r(91),Q=r(55850),Y=r(15861),f=r(1413),ce=r(24969),se=r(97462),k=r(952),q=r(6376),ee=r(48171),de=r(53914),ne=r(22270),F=r(60249),ue=r(83622),p=r(77569),z=r(21770),U=r(88306),te=r(8880),y=r(67294),ve=r(54048),h=r(85893),fe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],ge=["record","position","creatorButtonText","newRecordType","parentKey","style"],re=y.createContext(void 0);function A(n){var x=n.children,j=n.record,e=n.position,o=n.newRecordType,s=n.parentKey,t=(0,y.useContext)(re);return y.cloneElement(x,(0,f.Z)((0,f.Z)({},x.props),{},{onClick:function(){var a=(0,Y.Z)((0,Q.Z)().mark(function O(Z){var _,D,I,T;return(0,Q.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,(_=(D=x.props).onClick)===null||_===void 0?void 0:_.call(D,Z);case 2:if(T=m.sent,T!==!1){m.next=5;break}return m.abrupt("return");case 5:t==null||(I=t.current)===null||I===void 0||I.addEditRecord(j,{position:e,newRecordType:o,parentKey:s});case 6:case"end":return m.stop()}},O)}));function C(O){return a.apply(this,arguments)}return C}()}))}function le(n){var x,j,e=(0,q.YB)(),o=n.onTableChange,s=n.maxLength,t=n.formItemProps,a=n.recordCreatorProps,C=n.rowKey,O=n.controlled,Z=n.defaultValue,_=n.onChange,D=n.editableFormRef,I=(0,W.Z)(n,fe),T=(0,y.useRef)(void 0),E=(0,y.useRef)(),m=(0,y.useRef)();(0,y.useImperativeHandle)(I.actionRef,function(){return E.current},[E.current]);var K=(0,z.Z)(function(){return n.value||Z||[]},{value:n.value,onChange:n.onChange}),M=(0,ie.Z)(K,2),u=M[0],N=M[1],S=y.useMemo(function(){return typeof C=="function"?C:function(i,v){return i[C]||v}},[C]),L=(0,ee.J)(function(i){if(typeof i=="number"&&!n.name){if(i>=u.length)return i;var v=u&&u[i];return S==null?void 0:S(v,i)}if((typeof i=="string"||i>=u.length)&&n.name){var c=u.findIndex(function(l,d){var g;return(S==null||(g=S(l,d))===null||g===void 0?void 0:g.toString())===(i==null?void 0:i.toString())});if(c!==-1)return c}return i});(0,y.useImperativeHandle)(D,function(){var i=function(l){var d,g;if(l==null)throw new Error("rowIndex is required");var P=L(l),B=[n.name,(d=P==null?void 0:P.toString())!==null&&d!==void 0?d:""].flat(1).filter(Boolean);return(g=m.current)===null||g===void 0?void 0:g.getFieldValue(B)},v=function(){var l,d=[n.name].flat(1).filter(Boolean);if(Array.isArray(d)&&d.length===0){var g,P=(g=m.current)===null||g===void 0?void 0:g.getFieldsValue();return Array.isArray(P)?P:Object.keys(P).map(function(B){return P[B]})}return(l=m.current)===null||l===void 0?void 0:l.getFieldValue(d)};return(0,f.Z)((0,f.Z)({},m.current),{},{getRowData:i,getRowsData:v,setRowData:function(l,d){var g,P;if(l==null)throw new Error("rowIndex is required");var B=L(l),G=[n.name,(g=B==null?void 0:B.toString())!==null&&g!==void 0?g:""].flat(1).filter(Boolean),Oe=Object.assign({},(0,f.Z)((0,f.Z)({},i(l)),d||{})),Pe=(0,te.Z)({},G,Oe);return(P=m.current)===null||P===void 0||P.setFieldsValue(Pe),!0}})},[L,n.name,m.current]),(0,y.useEffect)(function(){n.controlled&&(u||[]).forEach(function(i,v){var c;(c=m.current)===null||c===void 0||c.setFieldsValue((0,b.Z)({},"".concat(S(i,v)),i))},{})},[(0,de.ZP)(u),n.controlled]),(0,y.useEffect)(function(){if(n.name){var i;m.current=n==null||(i=n.editable)===null||i===void 0?void 0:i.form}},[(x=n.editable)===null||x===void 0?void 0:x.form,n.name]);var $=a||{},H=$.record,J=$.position,R=$.creatorButtonText,me=$.newRecordType,he=$.parentKey,Ce=$.style,be=(0,W.Z)($,ge),X=J==="top",V=(0,y.useMemo)(function(){return typeof s=="number"&&s<=(u==null?void 0:u.length)?!1:a!==!1&&(0,h.jsx)(A,{record:(0,ne.h)(H,u==null?void 0:u.length,u)||{},position:J,parentKey:(0,ne.h)(he,u==null?void 0:u.length,u),newRecordType:me,children:(0,h.jsx)(ue.ZP,(0,f.Z)((0,f.Z)({type:"dashed",style:(0,f.Z)({display:"block",margin:"10px 0",width:"100%"},Ce),icon:(0,h.jsx)(ce.Z,{})},be),{},{children:R||e.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[a,s,u==null?void 0:u.length]),_e=(0,y.useMemo)(function(){return V?X?{components:{header:{wrapper:function(v){var c,l=v.className,d=v.children;return(0,h.jsxs)("thead",{className:l,children:[d,(0,h.jsxs)("tr",{style:{position:"relative"},children:[(0,h.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:V}),(0,h.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(c=I.columns)===null||c===void 0?void 0:c.length,children:V})]})]})}}}}:{tableViewRender:function(v,c){var l,d;return(0,h.jsxs)(h.Fragment,{children:[(l=(d=n.tableViewRender)===null||d===void 0?void 0:d.call(n,v,c))!==null&&l!==void 0?l:c,V]})}}:{}},[X,V]),w=(0,f.Z)({},n.editable),Ee=(0,ee.J)(function(i,v){var c,l,d;if((c=n.editable)===null||c===void 0||(l=c.onValuesChange)===null||l===void 0||l.call(c,i,v),(d=n.onValuesChange)===null||d===void 0||d.call(n,v,i),n.controlled){var g;n==null||(g=n.onChange)===null||g===void 0||g.call(n,v)}});return(n!=null&&n.onValuesChange||(j=n.editable)!==null&&j!==void 0&&j.onValuesChange||n.controlled&&n!==null&&n!==void 0&&n.onChange)&&(w.onValuesChange=Ee),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(re.Provider,{value:E,children:(0,h.jsx)(ve.Z,(0,f.Z)((0,f.Z)((0,f.Z)({search:!1,options:!1,pagination:!1,rowKey:C,revalidateOnFocus:!1},I),_e),{},{tableLayout:"fixed",actionRef:E,onChange:o,editable:(0,f.Z)((0,f.Z)({},w),{},{formProps:(0,f.Z)({formRef:m},w.formProps)}),dataSource:u,onDataSourceChange:function(v){if(N(v),n.name&&J==="top"){var c,l=(0,te.Z)({},[n.name].flat(1).filter(Boolean),v);(c=m.current)===null||c===void 0||c.setFieldsValue(l)}}}))}),n.name?(0,h.jsx)(se.Z,{name:[n.name],children:function(v){var c,l;if(!T.current)return T.current=u,null;var d=(0,U.Z)(v,[n.name].flat(1)),g=d==null?void 0:d.find(function(P,B){var G;return!(0,F.A)(P,(G=T.current)===null||G===void 0?void 0:G[B])});return T.current=u,g&&(n==null||(c=n.editable)===null||c===void 0||(l=c.onValuesChange)===null||l===void 0||l.call(c,g,d)),null}}):null]})}function ae(n){var x=k.ZP.useFormInstance();return n.name?(0,h.jsx)(p.Z.Item,(0,f.Z)((0,f.Z)({style:{maxWidth:"100%"},shouldUpdate:function(e,o){var s=[n.name].flat(1);try{return JSON.stringify((0,U.Z)(e,s))!==JSON.stringify((0,U.Z)(o,s))}catch(t){return!0}}},n==null?void 0:n.formItemProps),{},{name:n.name,children:(0,h.jsx)(le,(0,f.Z)((0,f.Z)({tableLayout:"fixed",scroll:{x:"max-content"}},n),{},{editable:(0,f.Z)((0,f.Z)({},n.editable),{},{form:x})}))})):(0,h.jsx)(le,(0,f.Z)({tableLayout:"fixed",scroll:{x:"max-content"}},n))}ae.RecordCreator=A,oe.Z=ae},66309:function(ye,oe,r){r.d(oe,{Z:function(){return j}});var b=r(67294),ie=r(93967),W=r.n(ie),Q=r(98423),Y=r(98787),f=r(69760),ce=r(96159),se=r(45353),k=r(53124),q=r(11568),ee=r(15063),de=r(14747),ne=r(83262),F=r(83559);const ue=e=>{const{paddingXXS:o,lineWidth:s,tagPaddingHorizontal:t,componentCls:a,calc:C}=e,O=C(t).sub(s).equal(),Z=C(o).sub(s).equal();return{[a]:Object.assign(Object.assign({},(0,de.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:O,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${(0,q.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${a}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${a}-close-icon`]:{marginInlineStart:Z,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${a}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${a}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:O}}),[`${a}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},p=e=>{const{lineWidth:o,fontSizeIcon:s,calc:t}=e,a=e.fontSizeSM;return(0,ne.IX)(e,{tagFontSize:a,tagLineHeight:(0,q.bf)(t(e.lineHeightSM).mul(a).equal()),tagIconSize:t(s).sub(t(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},z=e=>({defaultBg:new ee.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var U=(0,F.I$)("Tag",e=>{const o=p(e);return ue(o)},z),te=function(e,o){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a{const{prefixCls:s,style:t,className:a,checked:C,children:O,icon:Z,onChange:_,onClick:D}=e,I=te(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:T,tag:E}=b.useContext(k.E_),m=L=>{_==null||_(!C),D==null||D(L)},K=T("tag",s),[M,u,N]=U(K),S=W()(K,`${K}-checkable`,{[`${K}-checkable-checked`]:C},E==null?void 0:E.className,a,u,N);return M(b.createElement("span",Object.assign({},I,{ref:o,style:Object.assign(Object.assign({},t),E==null?void 0:E.style),className:S,onClick:m}),Z,b.createElement("span",null,O)))}),h=r(98719);const fe=e=>(0,h.Z)(e,(o,{textColor:s,lightBorderColor:t,lightColor:a,darkColor:C})=>({[`${e.componentCls}${e.componentCls}-${o}`]:{color:s,background:a,borderColor:t,"&-inverse":{color:e.colorTextLightSolid,background:C,borderColor:C},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}));var ge=(0,F.bk)(["Tag","preset"],e=>{const o=p(e);return fe(o)},z);function re(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const A=(e,o,s)=>{const t=re(s);return{[`${e.componentCls}${e.componentCls}-${o}`]:{color:e[`color${s}`],background:e[`color${t}Bg`],borderColor:e[`color${t}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}};var le=(0,F.bk)(["Tag","status"],e=>{const o=p(e);return[A(o,"success","Success"),A(o,"processing","Info"),A(o,"error","Error"),A(o,"warning","Warning")]},z),ae=function(e,o){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a{const{prefixCls:s,className:t,rootClassName:a,style:C,children:O,icon:Z,color:_,onClose:D,bordered:I=!0,visible:T}=e,E=ae(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:m,direction:K,tag:M}=b.useContext(k.E_),[u,N]=b.useState(!0),S=(0,Q.Z)(E,["closeIcon","closable"]);b.useEffect(()=>{T!==void 0&&N(T)},[T]);const L=(0,Y.o2)(_),$=(0,Y.yT)(_),H=L||$,J=Object.assign(Object.assign({backgroundColor:_&&!H?_:void 0},M==null?void 0:M.style),C),R=m("tag",s),[me,he,Ce]=U(R),be=W()(R,M==null?void 0:M.className,{[`${R}-${_}`]:H,[`${R}-has-color`]:_&&!H,[`${R}-hidden`]:!u,[`${R}-rtl`]:K==="rtl",[`${R}-borderless`]:!I},t,a,he,Ce),X=v=>{v.stopPropagation(),D==null||D(v),!v.defaultPrevented&&N(!1)},[,V]=(0,f.Z)((0,f.w)(e),(0,f.w)(M),{closable:!1,closeIconRender:v=>{const c=b.createElement("span",{className:`${R}-close-icon`,onClick:X},v);return(0,ce.wm)(v,c,l=>({onClick:d=>{var g;(g=l==null?void 0:l.onClick)===null||g===void 0||g.call(l,d),X(d)},className:W()(l==null?void 0:l.className,`${R}-close-icon`)}))}}),_e=typeof E.onClick=="function"||O&&O.type==="a",w=Z||null,Ee=w?b.createElement(b.Fragment,null,w,O&&b.createElement("span",null,O)):O,i=b.createElement("span",Object.assign({},S,{ref:o,className:be,style:J}),Ee,V,L&&b.createElement(ge,{key:"preset",prefixCls:R}),$&&b.createElement(le,{key:"status",prefixCls:R}));return me(_e?b.createElement(se.Z,{component:"Tag"},i):i)});x.CheckableTag=ve;var j=x}}]);