2 lines
9.0 KiB
JavaScript
2 lines
9.0 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8381],{35748:function(oe,L,n){var c=n(35361),p=n(56929),C=n(50959),h=n(50474),O=n(11527),r=["fieldProps","min","proFieldProps","max"],B=function(D,K){var W=D.fieldProps,M=D.min,m=D.proFieldProps,P=D.max,_=(0,p.Z)(D,r);return(0,O.jsx)(h.Z,(0,c.Z)({valueType:"digit",fieldProps:(0,c.Z)({min:M,max:P},W),ref:K,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:m},_))},y=C.forwardRef(B);L.Z=y},34927:function(oe,L,n){var c=n(35361),p=n(56929),C=n(89558),h=n(47186),O=n(50959),r=n(50756),B=n(50474),y=n(11527),V=["fieldProps","options","radioType","layout","proFieldProps","valueEnum"],D=O.forwardRef(function(m,P){var _=m.fieldProps,g=m.options,R=m.radioType,I=m.layout,v=m.proFieldProps,b=m.valueEnum,d=(0,p.Z)(m,V);return(0,y.jsx)(B.Z,(0,c.Z)((0,c.Z)({valueType:R==="button"?"radioButton":"radio",ref:P,valueEnum:(0,C.h)(b,void 0)},d),{},{fieldProps:(0,c.Z)({options:g,layout:I},_),proFieldProps:v,filedConfig:{customLightMode:!0}}))}),K=O.forwardRef(function(m,P){var _=m.fieldProps,g=m.children;return(0,y.jsx)(h.ZP,(0,c.Z)((0,c.Z)({},_),{},{ref:P,children:g}))}),W=(0,r.G)(K,{valuePropName:"checked",ignoreWidth:!0}),M=W;M.Group=D,M.Button=h.ZP.Button,M.displayName="ProFormComponent",L.Z=M},27610:function(oe,L,n){var c=n(35361),p=n(56929),C=n(89558),h=n(50959),O=n(71252),r=n(50474),B=n(11527),y=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],V=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],D=function(_,g){var R=_.fieldProps,I=_.children,v=_.params,b=_.proFieldProps,d=_.mode,J=_.valueEnum,H=_.request,$=_.showSearch,w=_.options,N=(0,p.Z)(_,y),ne=(0,h.useContext)(O.Z);return(0,B.jsx)(r.Z,(0,c.Z)((0,c.Z)({valueEnum:(0,C.h)(J),request:H,params:v,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,c.Z)({options:w,mode:d,showSearch:$,getPopupContainer:ne.getPopupContainer},R),ref:g,proFieldProps:b},N),{},{children:I}))},K=h.forwardRef(function(P,_){var g=P.fieldProps,R=P.children,I=P.params,v=P.proFieldProps,b=P.mode,d=P.valueEnum,J=P.request,H=P.options,$=(0,p.Z)(P,V),w=(0,c.Z)({options:H,mode:b||"multiple",labelInValue:!0,showSearch:!0,suffixIcon:null,autoClearSearchValue:!0,optionLabelProp:"label"},g),N=(0,h.useContext)(O.Z);return(0,B.jsx)(r.Z,(0,c.Z)((0,c.Z)({valueEnum:(0,C.h)(d),request:J,params:I,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,c.Z)({getPopupContainer:N.getPopupContainer},w),ref:_,proFieldProps:v},$),{},{children:R}))}),W=h.forwardRef(D),M=K,m=W;m.SearchSelect=M,m.displayName="ProFormComponent",L.Z=m},74728:function(oe,L,n){var c=n(88357),p=n(959),C=n(56929),h=n(11642),O=n(73356),r=n(35361),B=n(14790),y=n(67129),V=n(97128),D=n(38292),K=n(19348),W=n(14279),M=n(89558),m=n(37581),P=n(50159),_=n(50925),g=n(3691),R=n(75124),I=n(19134),v=n(50959),b=n(35384),d=n(11527),J=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],H=["record","position","creatorButtonText","newRecordType","parentKey","style"],$=v.createContext(void 0);function w(e){var Z=e.children,G=e.record,Y=e.position,z=e.newRecordType,F=e.parentKey,Q=(0,v.useContext)($);return v.cloneElement(Z,(0,r.Z)((0,r.Z)({},Z.props),{},{onClick:function(){var X=(0,O.Z)((0,h.Z)().mark(function ae(le){var re,te,A,U;return(0,h.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,(re=(te=Z.props).onClick)===null||re===void 0?void 0:re.call(te,le);case 2:if(U=E.sent,U!==!1){E.next=5;break}return E.abrupt("return");case 5:Q==null||(A=Q.current)===null||A===void 0||A.addEditRecord(G,{position:Y,newRecordType:z,parentKey:F});case 6:case"end":return E.stop()}},ae)}));function x(ae){return X.apply(this,arguments)}return x}()}))}function N(e){var Z,G,Y=(0,D.YB)(),z=e.onTableChange,F=e.maxLength,Q=e.formItemProps,X=e.recordCreatorProps,x=e.rowKey,ae=e.controlled,le=e.defaultValue,re=e.onChange,te=e.editableFormRef,A=(0,C.Z)(e,J),U=(0,v.useRef)(void 0),k=(0,v.useRef)(),E=(0,v.useRef)();(0,v.useImperativeHandle)(A.actionRef,function(){return k.current},[k.current]);var ve=(0,g.Z)(function(){return e.value||le||[]},{value:e.value,onChange:e.onChange}),se=(0,p.Z)(ve,2),i=se[0],ce=se[1],j=v.useMemo(function(){return typeof x=="function"?x:function(t,s){return t[x]||s}},[x]),ie=(0,K.J)(function(t){if(typeof t=="number"&&!e.name){if(t>=i.length)return t;var s=i&&i[t];return j==null?void 0:j(s,t)}if((typeof t=="string"||t>=i.length)&&e.name){var o=i.findIndex(function(a,l){var u;return(j==null||(u=j(a,l))===null||u===void 0?void 0:u.toString())===(t==null?void 0:t.toString())});if(o!==-1)return o}return t});(0,v.useImperativeHandle)(te,function(){var t=function(a){var l,u;if(a==null)throw new Error("rowIndex is required");var f=ie(a),T=[e.name,(l=f==null?void 0:f.toString())!==null&&l!==void 0?l:""].flat(1).filter(Boolean);return(u=E.current)===null||u===void 0?void 0:u.getFieldValue(T)},s=function(){var a,l=[e.name].flat(1).filter(Boolean);if(Array.isArray(l)&&l.length===0){var u,f=(u=E.current)===null||u===void 0?void 0:u.getFieldsValue();return Array.isArray(f)?f:Object.keys(f).map(function(T){return f[T]})}return(a=E.current)===null||a===void 0?void 0:a.getFieldValue(l)};return(0,r.Z)((0,r.Z)({},E.current),{},{getRowData:t,getRowsData:s,setRowData:function(a,l){var u,f;if(a==null)throw new Error("rowIndex is required");var T=ie(a),ee=[e.name,(u=T==null?void 0:T.toString())!==null&&u!==void 0?u:""].flat(1).filter(Boolean),Oe=Object.assign({},(0,r.Z)((0,r.Z)({},t(a)),l||{})),ge=(0,I.Z)({},ee,Oe);return(f=E.current)===null||f===void 0||f.setFieldsValue(ge),!0}})},[ie,e.name,E.current]),(0,v.useEffect)(function(){e.controlled&&(i||[]).forEach(function(t,s){var o;(o=E.current)===null||o===void 0||o.setFieldsValue((0,c.Z)({},"".concat(j(t,s)),t))},{})},[(0,W.ZP)(i),e.controlled]),(0,v.useEffect)(function(){if(e.name){var t;E.current=e==null||(t=e.editable)===null||t===void 0?void 0:t.form}},[(Z=e.editable)===null||Z===void 0?void 0:Z.form,e.name]);var S=X||{},me=S.record,de=S.position,Pe=S.creatorButtonText,Ee=S.newRecordType,fe=S.parentKey,he=S.style,De=(0,C.Z)(S,H),_e=de==="top",q=(0,v.useMemo)(function(){return typeof F=="number"&&F<=(i==null?void 0:i.length)?!1:X!==!1&&(0,d.jsx)(w,{record:(0,M.h)(me,i==null?void 0:i.length,i)||{},position:de,parentKey:(0,M.h)(fe,i==null?void 0:i.length,i),newRecordType:Ee,children:(0,d.jsx)(P.ZP,(0,r.Z)((0,r.Z)({type:"dashed",style:(0,r.Z)({display:"block",margin:"10px 0",width:"100%"},he),icon:(0,d.jsx)(B.Z,{})},De),{},{children:Pe||Y.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[X==!1,F,i==null?void 0:i.length]),Me=(0,v.useMemo)(function(){return q?_e?{components:{header:{wrapper:function(s){var o,a=s.className,l=s.children;return(0,d.jsxs)("thead",{className:a,children:[l,(0,d.jsxs)("tr",{style:{position:"relative"},children:[(0,d.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:q}),(0,d.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(o=A.columns)===null||o===void 0?void 0:o.length,children:q})]})]})}}}}:{tableViewRender:function(s,o){var a,l;return(0,d.jsxs)(d.Fragment,{children:[(a=(l=e.tableViewRender)===null||l===void 0?void 0:l.call(e,s,o))!==null&&a!==void 0?a:o,q]})}}:{}},[_e,q]),ue=(0,r.Z)({},e.editable),Ce=(0,K.J)(function(t,s){var o,a,l;if((o=e.editable)===null||o===void 0||(a=o.onValuesChange)===null||a===void 0||a.call(o,t,s),(l=e.onValuesChange)===null||l===void 0||l.call(e,s,t),e.controlled){var u;e==null||(u=e.onChange)===null||u===void 0||u.call(e,s)}});return(e!=null&&e.onValuesChange||(G=e.editable)!==null&&G!==void 0&&G.onValuesChange||e.controlled&&e!==null&&e!==void 0&&e.onChange)&&(ue.onValuesChange=Ce),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)($.Provider,{value:k,children:(0,d.jsx)(b.Z,(0,r.Z)((0,r.Z)((0,r.Z)({search:!1,options:!1,pagination:!1,rowKey:x,revalidateOnFocus:!1},A),Me),{},{tableLayout:"fixed",actionRef:k,onChange:z,editable:(0,r.Z)((0,r.Z)({},ue),{},{formProps:(0,r.Z)({formRef:E},ue.formProps)}),dataSource:i,onDataSourceChange:function(s){if(ce(s),e.name&&de==="top"){var o,a=(0,I.Z)({},[e.name].flat(1).filter(Boolean),s);(o=E.current)===null||o===void 0||o.setFieldsValue(a)}}}))}),e.name?(0,d.jsx)(y.Z,{name:[e.name],children:function(s){var o,a;if(!U.current)return U.current=i,null;var l=(0,R.Z)(s,[e.name].flat(1)),u=l==null?void 0:l.find(function(f,T){var ee;return!(0,m.A)(f,(ee=U.current)===null||ee===void 0?void 0:ee[T])});return U.current=i,u&&(e==null||(o=e.editable)===null||o===void 0||(a=o.onValuesChange)===null||a===void 0||a.call(o,u,l)),null}}):null]})}function ne(e){var Z=V.ZP.useFormInstance();return e.name?(0,d.jsx)(_.Z.Item,(0,r.Z)((0,r.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,shouldUpdate:function(Y,z){var F=[e.name].flat(1);try{return JSON.stringify((0,R.Z)(Y,F))!==JSON.stringify((0,R.Z)(z,F))}catch(Q){return!0}},children:(0,d.jsx)(N,(0,r.Z)((0,r.Z)({},e),{},{editable:(0,r.Z)((0,r.Z)({},e.editable),{},{form:Z})}))})):(0,d.jsx)(N,(0,r.Z)({},e))}ne.RecordCreator=w,L.Z=ne}}]);
|