lu-lowcode-package-form 0.8.7 → 0.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -380,4 +380,4 @@ __p += '`),rn&&(We+=`' +
380
380
  function print() { __p += __j.call(arguments, '') }
381
381
  `:`;
382
382
  `)+We+`return __p
383
- }`;var Yt=ah(function(){return cn(q,Et+"return "+We).apply(n,ne)});if(Yt.source=We,Id(Yt))throw Yt;return Yt}function f_(o){return pn(o).toLowerCase()}function v_(o){return pn(o).toUpperCase()}function g_(o,c,p){if(o=pn(o),o&&(p||c===n))return vp(o);if(!o||!(c=Fr(c)))return o;var E=ia(o),A=ia(c),q=gp(E,A),ne=pp(E,A)+1;return io(E,q,ne).join("")}function p_(o,c,p){if(o=pn(o),o&&(p||c===n))return o.slice(0,hp(o)+1);if(!o||!(c=Fr(c)))return o;var E=ia(o),A=pp(E,ia(c))+1;return io(E,0,A).join("")}function m_(o,c,p){if(o=pn(o),o&&(p||c===n))return o.replace(nt,"");if(!o||!(c=Fr(c)))return o;var E=ia(o),A=gp(E,ia(c));return io(E,A).join("")}function h_(o,c){var p=M,E=k;if(kn(c)){var A="separator"in c?c.separator:A;p="length"in c?Gt(c.length):p,E="omission"in c?Fr(c.omission):E}o=pn(o);var q=o.length;if(li(o)){var ne=ia(o);q=ne.length}if(p>=q)return o;var se=p-si(E);if(se<1)return E;var ve=ne?io(ne,0,se).join(""):o.slice(0,se);if(A===n)return ve+E;if(ne&&(se+=ve.length-se),_d(A)){if(o.slice(se).search(A)){var ke,Le=ve;for(A.global||(A=Wu(A.source,pn(bt.exec(A))+"g")),A.lastIndex=0;ke=A.exec(Le);)var We=ke.index;ve=ve.slice(0,We===n?se:We)}}else if(o.indexOf(Fr(A),se)!=se){var st=ve.lastIndexOf(A);st>-1&&(ve=ve.slice(0,st))}return ve+E}function b_(o){return o=pn(o),o&&Tt.test(o)?o.replace(ft,qx):o}var y_=pi(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Nd=om("toUpperCase");function rh(o,c,p){return o=pn(o),c=p?n:c,c===n?zx(o)?Xx(o):Dx(o):o.match(c)||[]}var ah=Zt(function(o,c){try{return Dr(o,n,c)}catch(p){return Id(p)?p:new Bt(p)}}),C_=Ta(function(o,c){return Ur(c,function(p){p=xa(p),Ma(o,p,$d(o[p],o))}),o});function S_(o){var c=o==null?0:o.length,p=Dt();return o=c?Tn(o,function(E){if(typeof E[1]!="function")throw new qr(s);return[p(E[0]),E[1]]}):[],Zt(function(E){for(var A=-1;++A<c;){var q=o[A];if(Dr(q[0],this,E))return Dr(q[1],this,E)}})}function w_(o){return qE(Yr(o,g))}function Md(o){return function(){return o}}function x_(o,c){return o==null||o!==o?c:o}var E_=lm(),$_=lm(!0);function Pr(o){return o}function Dd(o){return kp(typeof o=="function"?o:Yr(o,g))}function O_(o){return Vp(Yr(o,g))}function I_(o,c){return jp(o,Yr(c,g))}var __=Zt(function(o,c){return function(p){return cl(p,o,c)}}),R_=Zt(function(o,c){return function(p){return cl(o,p,c)}});function Td(o,c,p){var E=ar(c),A=Ts(c,E);p==null&&!(kn(c)&&(A.length||!E.length))&&(p=c,c=o,o=this,A=Ts(c,ar(c)));var q=!(kn(p)&&"chain"in p)||!!p.chain,ne=Aa(o);return Ur(A,function(se){var ve=c[se];o[se]=ve,ne&&(o.prototype[se]=function(){var ke=this.__chain__;if(q||ke){var Le=o(this.__wrapped__),We=Le.__actions__=Ir(this.__actions__);return We.push({func:ve,args:arguments,thisArg:o}),Le.__chain__=ke,Le}return ve.apply(o,eo([this.value()],arguments))})}),o}function P_(){return lr._===this&&(lr._=nE),this}function Fd(){}function N_(o){return o=Gt(o),Zt(function(c){return Hp(c,o)})}var M_=fd(Tn),D_=fd(sp),T_=fd(ku);function oh(o){return yd(o)?Lu(xa(o)):u$(o)}function F_(o){return function(c){return o==null?n:No(o,c)}}var A_=cm(),k_=cm(!0);function Ad(){return[]}function kd(){return!1}function L_(){return{}}function V_(){return""}function j_(){return!0}function H_(o,c){if(o=Gt(o),o<1||o>F)return[];var p=V,E=gr(o,V);c=Dt(c),o-=V;for(var A=Hu(E,c);++p<o;)c(p);return A}function z_(o){return qt(o)?Tn(o,xa):Ar(o)?[o]:Ir($m(pn(o)))}function B_(o){var c=++eE;return pn(o)+c}var W_=js(function(o,c){return o+c},0),K_=vd("ceil"),U_=js(function(o,c){return o/c},1),q_=vd("floor");function G_(o){return o&&o.length?Ds(o,Pr,Qu):n}function Y_(o,c){return o&&o.length?Ds(o,Dt(c,2),Qu):n}function X_(o){return dp(o,Pr)}function Z_(o,c){return dp(o,Dt(c,2))}function Q_(o){return o&&o.length?Ds(o,Pr,nd):n}function J_(o,c){return o&&o.length?Ds(o,Dt(c,2),nd):n}var eR=js(function(o,c){return o*c},1),tR=vd("round"),nR=js(function(o,c){return o-c},0);function rR(o){return o&&o.length?ju(o,Pr):0}function aR(o,c){return o&&o.length?ju(o,Dt(c,2)):0}return W.after=OI,W.ary=Am,W.assign=v2,W.assignIn=Xm,W.assignInWith=Js,W.assignWith=g2,W.at=p2,W.before=km,W.bind=$d,W.bindAll=C_,W.bindKey=Lm,W.castArray=LI,W.chain=Dm,W.chunk=q$,W.compact=G$,W.concat=Y$,W.cond=S_,W.conforms=w_,W.constant=Md,W.countBy=rI,W.create=m2,W.curry=Vm,W.curryRight=jm,W.debounce=Hm,W.defaults=h2,W.defaultsDeep=b2,W.defer=II,W.delay=_I,W.difference=X$,W.differenceBy=Z$,W.differenceWith=Q$,W.drop=J$,W.dropRight=eO,W.dropRightWhile=tO,W.dropWhile=nO,W.fill=rO,W.filter=oI,W.flatMap=sI,W.flatMapDeep=cI,W.flatMapDepth=uI,W.flatten=Rm,W.flattenDeep=aO,W.flattenDepth=oO,W.flip=RI,W.flow=E_,W.flowRight=$_,W.fromPairs=iO,W.functions=$2,W.functionsIn=O2,W.groupBy=dI,W.initial=sO,W.intersection=cO,W.intersectionBy=uO,W.intersectionWith=dO,W.invert=_2,W.invertBy=R2,W.invokeMap=vI,W.iteratee=Dd,W.keyBy=gI,W.keys=ar,W.keysIn=Rr,W.map=qs,W.mapKeys=N2,W.mapValues=M2,W.matches=O_,W.matchesProperty=I_,W.memoize=Ys,W.merge=D2,W.mergeWith=Zm,W.method=__,W.methodOf=R_,W.mixin=Td,W.negate=Xs,W.nthArg=N_,W.omit=T2,W.omitBy=F2,W.once=PI,W.orderBy=pI,W.over=M_,W.overArgs=NI,W.overEvery=D_,W.overSome=T_,W.partial=Od,W.partialRight=zm,W.partition=mI,W.pick=A2,W.pickBy=Qm,W.property=oh,W.propertyOf=F_,W.pull=pO,W.pullAll=Nm,W.pullAllBy=mO,W.pullAllWith=hO,W.pullAt=bO,W.range=A_,W.rangeRight=k_,W.rearg=MI,W.reject=yI,W.remove=yO,W.rest=DI,W.reverse=xd,W.sampleSize=SI,W.set=L2,W.setWith=V2,W.shuffle=wI,W.slice=CO,W.sortBy=$I,W.sortedUniq=IO,W.sortedUniqBy=_O,W.split=s_,W.spread=TI,W.tail=RO,W.take=PO,W.takeRight=NO,W.takeRightWhile=MO,W.takeWhile=DO,W.tap=GO,W.throttle=FI,W.thru=Us,W.toArray=qm,W.toPairs=Jm,W.toPairsIn=eh,W.toPath=z_,W.toPlainObject=Ym,W.transform=j2,W.unary=AI,W.union=TO,W.unionBy=FO,W.unionWith=AO,W.uniq=kO,W.uniqBy=LO,W.uniqWith=VO,W.unset=H2,W.unzip=Ed,W.unzipWith=Mm,W.update=z2,W.updateWith=B2,W.values=bi,W.valuesIn=W2,W.without=jO,W.words=rh,W.wrap=kI,W.xor=HO,W.xorBy=zO,W.xorWith=BO,W.zip=WO,W.zipObject=KO,W.zipObjectDeep=UO,W.zipWith=qO,W.entries=Jm,W.entriesIn=eh,W.extend=Xm,W.extendWith=Js,Td(W,W),W.add=W_,W.attempt=ah,W.camelCase=G2,W.capitalize=th,W.ceil=K_,W.clamp=K2,W.clone=VI,W.cloneDeep=HI,W.cloneDeepWith=zI,W.cloneWith=jI,W.conformsTo=BI,W.deburr=nh,W.defaultTo=x_,W.divide=U_,W.endsWith=Y2,W.eq=sa,W.escape=X2,W.escapeRegExp=Z2,W.every=aI,W.find=iI,W.findIndex=Im,W.findKey=y2,W.findLast=lI,W.findLastIndex=_m,W.findLastKey=C2,W.floor=q_,W.forEach=Tm,W.forEachRight=Fm,W.forIn=S2,W.forInRight=w2,W.forOwn=x2,W.forOwnRight=E2,W.get=Rd,W.gt=WI,W.gte=KI,W.has=I2,W.hasIn=Pd,W.head=Pm,W.identity=Pr,W.includes=fI,W.indexOf=lO,W.inRange=U2,W.invoke=P2,W.isArguments=To,W.isArray=qt,W.isArrayBuffer=UI,W.isArrayLike=_r,W.isArrayLikeObject=Wn,W.isBoolean=qI,W.isBuffer=lo,W.isDate=GI,W.isElement=YI,W.isEmpty=XI,W.isEqual=ZI,W.isEqualWith=QI,W.isError=Id,W.isFinite=JI,W.isFunction=Aa,W.isInteger=Bm,W.isLength=Zs,W.isMap=Wm,W.isMatch=e2,W.isMatchWith=t2,W.isNaN=n2,W.isNative=r2,W.isNil=o2,W.isNull=a2,W.isNumber=Km,W.isObject=kn,W.isObjectLike=jn,W.isPlainObject=pl,W.isRegExp=_d,W.isSafeInteger=i2,W.isSet=Um,W.isString=Qs,W.isSymbol=Ar,W.isTypedArray=hi,W.isUndefined=l2,W.isWeakMap=s2,W.isWeakSet=c2,W.join=fO,W.kebabCase=Q2,W.last=Zr,W.lastIndexOf=vO,W.lowerCase=J2,W.lowerFirst=e_,W.lt=u2,W.lte=d2,W.max=G_,W.maxBy=Y_,W.mean=X_,W.meanBy=Z_,W.min=Q_,W.minBy=J_,W.stubArray=Ad,W.stubFalse=kd,W.stubObject=L_,W.stubString=V_,W.stubTrue=j_,W.multiply=eR,W.nth=gO,W.noConflict=P_,W.noop=Fd,W.now=Gs,W.pad=t_,W.padEnd=n_,W.padStart=r_,W.parseInt=a_,W.random=q2,W.reduce=hI,W.reduceRight=bI,W.repeat=o_,W.replace=i_,W.result=k2,W.round=tR,W.runInContext=de,W.sample=CI,W.size=xI,W.snakeCase=l_,W.some=EI,W.sortedIndex=SO,W.sortedIndexBy=wO,W.sortedIndexOf=xO,W.sortedLastIndex=EO,W.sortedLastIndexBy=$O,W.sortedLastIndexOf=OO,W.startCase=c_,W.startsWith=u_,W.subtract=nR,W.sum=rR,W.sumBy=aR,W.template=d_,W.times=H_,W.toFinite=ka,W.toInteger=Gt,W.toLength=Gm,W.toLower=f_,W.toNumber=Qr,W.toSafeInteger=f2,W.toString=pn,W.toUpper=v_,W.trim=g_,W.trimEnd=p_,W.trimStart=m_,W.truncate=h_,W.unescape=b_,W.uniqueId=B_,W.upperCase=y_,W.upperFirst=Nd,W.each=Tm,W.eachRight=Fm,W.first=Pm,Td(W,function(){var o={};return Sa(W,function(c,p){yn.call(W.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),W.VERSION=r,Ur(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){W[o].placeholder=W}),Ur(["drop","take"],function(o,c){en.prototype[o]=function(p){p=p===n?1:Jn(Gt(p),0);var E=this.__filtered__&&!c?new en(this):this.clone();return E.__filtered__?E.__takeCount__=gr(p,E.__takeCount__):E.__views__.push({size:gr(p,V),type:o+(E.__dir__<0?"Right":"")}),E},en.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),Ur(["filter","map","takeWhile"],function(o,c){var p=c+1,E=p==D||p==T;en.prototype[o]=function(A){var q=this.clone();return q.__iteratees__.push({iteratee:Dt(A,3),type:p}),q.__filtered__=q.__filtered__||E,q}}),Ur(["head","last"],function(o,c){var p="take"+(c?"Right":"");en.prototype[o]=function(){return this[p](1).value()[0]}}),Ur(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");en.prototype[o]=function(){return this.__filtered__?new en(this):this[p](1)}}),en.prototype.compact=function(){return this.filter(Pr)},en.prototype.find=function(o){return this.filter(o).head()},en.prototype.findLast=function(o){return this.reverse().find(o)},en.prototype.invokeMap=Zt(function(o,c){return typeof o=="function"?new en(this):this.map(function(p){return cl(p,o,c)})}),en.prototype.reject=function(o){return this.filter(Xs(Dt(o)))},en.prototype.slice=function(o,c){o=Gt(o);var p=this;return p.__filtered__&&(o>0||c<0)?new en(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==n&&(c=Gt(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},en.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},en.prototype.toArray=function(){return this.take(V)},Sa(en.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),E=/^(?:head|last)$/.test(c),A=W[E?"take"+(c=="last"?"Right":""):c],q=E||/^find/.test(c);A&&(W.prototype[c]=function(){var ne=this.__wrapped__,se=E?[1]:arguments,ve=ne instanceof en,ke=se[0],Le=ve||qt(ne),We=function(Qt){var rn=A.apply(W,eo([Qt],se));return E&&st?rn[0]:rn};Le&&p&&typeof ke=="function"&&ke.length!=1&&(ve=Le=!1);var st=this.__chain__,Et=!!this.__actions__.length,Ft=q&&!st,Yt=ve&&!Et;if(!q&&Le){ne=Yt?ne:new en(this);var At=o.apply(ne,se);return At.__actions__.push({func:Us,args:[We],thisArg:n}),new Gr(At,st)}return Ft&&Yt?o.apply(this,se):(At=this.thru(We),Ft?E?At.value()[0]:At.value():At)})}),Ur(["pop","push","shift","sort","splice","unshift"],function(o){var c=bs[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",E=/^(?:pop|shift)$/.test(o);W.prototype[o]=function(){var A=arguments;if(E&&!this.__chain__){var q=this.value();return c.apply(qt(q)?q:[],A)}return this[p](function(ne){return c.apply(qt(ne)?ne:[],A)})}}),Sa(en.prototype,function(o,c){var p=W[c];if(p){var E=p.name+"";yn.call(fi,E)||(fi[E]=[]),fi[E].push({name:c,func:p})}}),fi[Vs(n,S).name]=[{name:"wrapper",func:n}],en.prototype.clone=bE,en.prototype.reverse=yE,en.prototype.value=CE,W.prototype.at=YO,W.prototype.chain=XO,W.prototype.commit=ZO,W.prototype.next=QO,W.prototype.plant=eI,W.prototype.reverse=tI,W.prototype.toJSON=W.prototype.valueOf=W.prototype.value=nI,W.prototype.first=W.prototype.head,nl&&(W.prototype[nl]=JO),W},ci=Zx();Oo?((Oo.exports=ci)._=ci,Du._=ci):lr._=ci}).call(cr)})(au,au.exports);var Pz=au.exports;const Nz=e=>{let{request:t,title:n,disabledValue:r,callError:a,...i}=e;const[s,l]=Y.useState(!1),[u,f]=Y.useState([]);Y.useEffect(()=>{v()},[]);const v=async()=>{if(t&&typeof t=="function"){var g;const h=await t();if(h.code>0){a&&typeof a=="function"&&a(h.message);return}let b=Cx(((g=h.data)===null||g===void 0?void 0:g.list)||h.data||[],"id",n||"title",i.parentId||"parentId","children",0,r);b=[{value:0,title:"根节点",children:b}],i.treeData=b,f(b)}i.treeData&&f(i.treeData),l(!0)};return wt.jsx(yr,{...i,children:s&&wt.jsx(Eo,{...i,treeData:u,treeDefaultExpandAll:!0,style:{width:"100%"}})})},vs=e=>{let{request:t,option_label:n="label",option_value:r="id",disabledValue:a,callError:i,options:s,...l}=e;const[u,f]=Y.useState([]);Y.useEffect(()=>{v()},[]);const v=async()=>{if(t&&typeof t=="function"){var g;const h=await t();if(h.code>0){i&&typeof i=="function"&&i(h.message);return}let b=((g=h.data)===null||g===void 0?void 0:g.list)||h.data;Array.isArray(b)&&b.length>0&&f(b.map(C=>({label:C[n],value:C[r]})))}s&&s.length>0&&f(s)};return wt.jsx(yr,{...l,children:wt.jsx(ei,{...l,options:u,style:{width:"100%"}})})},Mz=e=>{let{...t}=e;return wt.jsx(vs,{...t,mode:"single"})},Dz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState([]);return Y.useEffect(()=>{if(typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}i(n)},[n]),wt.jsx(vs,{...r,onChange:t,mode:"multiple",value:a})},Tz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState("");Y.useEffect(()=>{if(n&&typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}n&&i(n)},[n]);const s=(l,u)=>{t&&typeof t=="function"&&t(u),i(u.label)};return wt.jsx(vs,{...r,onChange:s,value:a,mode:"single"})},Fz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState([]);Y.useEffect(()=>{if(n&&typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}Array.isArray(n)&&i(n)},[n]);const s=(l,u)=>{t&&typeof t=="function"&&t(u),u.map(f=>f.label),i(u)};return wt.jsx(vs,{...r,onChange:s,value:a,mode:"multiple"})},Az=Y.forwardRef((e,t)=>{let{value:n,onChange:r,...a}=e;const i=Y.useRef(0),s=()=>{i.current++,r(i.current)};return wt.jsxs(yr,{...a,children:[wt.jsxs("div",{ref:t,children:["form-set-value:",n]}),wt.jsx(Co,{onClick:s,children:"test"})]})}),kz=e=>{let{children:t,layout:n}=e;n=n||"1";const r=s=>{const l=s.split(",").map(Number),u=24;return l.map(f=>f/l.reduce((v,g)=>v+g)*u)},a=Y.useMemo(()=>r(n),[n]);console.log("colSpans",a);const i=Y.useMemo(()=>Y.Children.toArray(t).map((s,l)=>{const u=s.props,f=(u==null?void 0:u.componentId)||(u==null?void 0:u.__id);return f?(a==null?void 0:a[l])&&wt.jsx(Vi,{span:a[l],children:wt.jsx(na.Item,{style:{marginBottom:0},label:"",name:f,rules:[{required:u.isRequired,message:"".concat(u.title,"不能为空!")}],children:s},"".concat(f,"-form-item"))},l):(a==null?void 0:a[l])&&wt.jsx(Vi,{span:a[l],children:s},l)}),[t,a]);return wt.jsx(Iu,{gutter:24,children:i})},Lz=e=>{let{title:t}=e;return t?wt.jsx("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium fmb-5 ",children:wt.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:t})}):null};function Vz(e,t){const n=[];let r=[];const a=(i,s)=>{const l=i-s.length;s.push(...new Array(l).fill(Y.createElement("div")))};for(const i of e){const{_componentName:s}=(i==null?void 0:i.props)||{};s&&s.startsWith("Layout")?(r.length>0&&(a(t,r),n.push(r),r=[]),n.push([i])):(r.push(i),r.length===t&&(n.push(r),r=[]))}return r.length>0&&(a(t,r),n.push(r)),n}const Jg=Y.forwardRef((e,t)=>{let{cols:n=1,children:r}=e;const[a]=na.useForm(),[i,s]=Y.useState(null),l=Y.useRef(null);Y.useImperativeHandle(t,()=>({formRef:a,initializeFieldVisibility:f}),[]),Y.useEffect(()=>{u(),s(h())},[r,n]);const u=()=>{l.current=new Map;const b=Y.Children.toArray(r);b.forEach(C=>{const{componentId:y,__id:m,...S}=C.props,w=y||m;l.current.set(w,{children:b.filter(x=>{var $;return x.props.__withId===w||(($=x.props.__withIds)===null||$===void 0?void 0:$.includes(w))}),show:!0})}),f()},f=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const C=a.getFieldsValue();for(let y of l.current.keys())v(y,C);b&&s(h())},v=(b,C)=>{let y=!1;return l.current.has(b)&&l.current.get(b).children.forEach(S=>{if(S.props.__withFunc&&typeof S.props.__withFunc=="function"){const w=S.props.__withFunc(C),x=S.props.componentId||S.props.__id;if(l.current.has(x)){const $=l.current.get(x);$.show!==w&&($.show=w,l.current.set(x,$),y=!0)}}}),y},g=Pz.debounce((b,C)=>{const y=a.getFieldsValue();let m=!1;b.forEach(S=>{S.name&&S.name.length>0&&(m=v(S.name[0],y))}),m&&s(h())},100),h=()=>{const b=Y.Children.toArray(r);return Vz(b.filter(y=>{const m=y.props.componentId||y.props.__id;return l.current.has(m)&&l.current.get(m).show}),n).map((y,m)=>wt.jsx(Iu,{gutter:[24,24],children:y.map((S,w)=>{const{componentId:x,__id:$,_componentName:I,...O}=S.props,_=x||$,R=I&&I.startsWith("Layout");return wt.jsx(Vi,{span:R?24:24/y.length,style:{marginBottom:0},children:R?S:wt.jsx(na.Item,{style:{marginBottom:0},label:"",name:_,rules:[{required:O.isRequired,message:"".concat(O.title,"不能为空!")}],children:S})},_||"col-".concat(w))})},"row-".concat(m)))};return wt.jsx(na,{form:a,className:"form-container fp-6 fw-full fh-full box-border overflow-auto",onFieldsChange:g,children:i})});function jz(e){return Y.forwardRef((t,n)=>wt.jsx(e,{...t,ref:n,forwardedRef:n}))}class tB extends Y.PureComponent{render(){const{forwardedRef:t,...n}=this.props;return wt.jsx(Jg,{...n,ref:t})}}const Hz=jz(e=>{let{forwardedRef:t,...n}=e;return wt.jsx(Jg,{...n,ref:t})}),zz=e=>{let{request:t,value:n,onChange:r,callError:a,disabledValue:i,addRoot:s=!0,title:l,...u}=e;const[f,v]=Y.useState(!1),[g,h]=Y.useState([]);Y.useEffect(()=>{b()},[]),Y.useEffect(()=>{if(console.log("CheckboxTree value ",n),typeof n=="string")try{n=JSON.parse(n),r(n)}catch{}Array.isArray(n)&&S(n)},[n]);const b=async()=>{if(t&&typeof t=="function"){var P;const M=await t();if(M.code>0){a&&typeof a=="function"&&a(M.message);return}let k=Cx(((P=M.data)===null||P===void 0?void 0:P.list)||M.data||[],"id",l||"title",(u==null?void 0:u.parentId)||"parentId","children",0,i);s&&(k=[{value:0,title:"根节点",children:k}]),u.treeData=k,console.log("treeData",k),h(k)}u.treeData&&h(u.treeData),v(!0)},[C,y]=Y.useState([]),[m,S]=Y.useState([]),[w,x]=Y.useState([]),[$,I]=Y.useState(!0),O=P=>{console.log("onExpand",P),y(P),I(!1)},_=P=>{console.log("onCheck",P),S(P),r(P)},R=(P,M)=>{console.log("onSelect",M),x(P)};return wt.jsx(yr,{...u,children:wt.jsx(qg,{checkable:!0,onExpand:O,onCheck:_,onSelect:R,expandedKeys:C,autoExpandParent:$,checkedKeys:m,selectedKeys:w,treeData:g})})},Bz=e=>wt.jsx(yr,{...e,children:wt.jsx(cs,{...e})}),Wz=e=>{let{value:t,onChange:n,...r}=e;const[a,i]=Y.useState([]);return Y.useEffect(()=>{if(typeof t=="string")try{t=JSON.parse(t),n(t)}catch{}i(t)},[t]),wt.jsx(yr,{...r,children:wt.jsx(cs.Group,{...r,value:a})})},Kz=e=>wt.jsx(yr,{...e,children:wt.jsx(Ou.Group,{...e})}),Uz=e=>{let{value:t,maxCount:n,onChange:r,...a}=e;Y.useEffect(()=>{t&&s(t)},[t]),n=n||9;const[i,s]=Y.useState([]),l=u=>{let{fileList:f}=u;f=f.map(v=>(v.status=="done"&&v.response&&(v.url=v.response),v)),r(f.map(v=>({uid:v.uid,name:v.name,status:v.status,url:v.url||v.response||""}))),s(f)};return wt.jsx(yr,{...a,children:wt.jsx(Nu,{...a,listType:"text",maxCount:n,onChange:l,defaultFileList:i,children:wt.jsxs("div",{className:" fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center ",children:[wt.jsx(yx,{}),"点击上传文件"]})})})},qz=e=>{let{maxCount:t,value:n,onChange:r,...a}=e;Y.useEffect(()=>{n&&s(n)},[n]),t=t||9;const[i,s]=Y.useState([]),[l,u]=Y.useState(""),[f,v]=Y.useState(!1),g=async C=>{!C.url&&!C.preview&&(C.preview=await getBase64(C.originFileObj)),u(C.url||C.preview),v(!0)},h=wt.jsxs("button",{style:{border:0,background:"none"},type:"button",children:[wt.jsx(bx,{}),wt.jsx("div",{style:{marginTop:8},children:"点击上传"})]}),b=C=>{let{fileList:y}=C;y=y.map(m=>(m.status=="done"&&m.response&&(m.url=m.response),m)),r(y.map(m=>({uid:m.uid,name:m.name,status:m.status,url:m.url||m.response||""}))),s(y)};return wt.jsxs(yr,{...a,children:[wt.jsx(Nu,{...a,maxCount:t,listType:"picture-card",fileList:i,onPreview:g,onChange:b,children:i.length>=t?null:h}),l&&wt.jsx(Image,{wrapperStyle:{display:"none"},preview:{visible:f,onVisibleChange:C=>v(C),afterOpenChange:C=>!C&&u("")},src:l})]})},Gz=e=>{let{value:t,...n}=e;const[r,a]=Y.useState(!1);return Y.useEffect(()=>{let i=!1;typeof t=="boolean"?i=t:typeof t=="string"?i=t=="1"||t=="true":typeof t=="number"&&(i=t==1),a(i),n==null||n.onChange(i)},[t]),wt.jsx(yr,{...n,children:wt.jsx(Hg,{...n,value:r})})};var Yz={exports:{}};(function(e,t){(function(n,r){e.exports=r(FS)})(cr,function(n){function r(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var a=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(s,l){return l==="W"?s+"周":s+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(s,l){var u=100*s+l;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return a.default.locale(i,null,!0),i})})(Yz);mr.locale("zh-cn");const Xz=e=>{let{datetype:t,value:n,onChange:r,...a}=e;t=t||"date";const[i,s]=Y.useState(a==null?void 0:a.picker),[l,u]=Y.useState(a==null?void 0:a.format),[f,v]=Y.useState(null),[g,h]=Y.useState(!1),[b,C]=Y.useState(!1);Y.useEffect(()=>{if(n){const m=mr(n);v(m)}},[n,l,i]);const y=(m,S)=>{r(S)};return Y.useEffect(()=>{switch(s("date"),h(!1),t){case"date":s("date"),u("YYYY-MM-DD"),C(!1);break;case"datetime":h(!0),s("datetime"),u("YYYY-MM-DD HH:mm:ss"),C(!0);break;case"month":s("month"),C(!1);break;case"year":s("year"),C(!1);break}},[t]),wt.jsx(yr,{...a,children:wt.jsx(Yi,{...a,picker:i,format:l,style:{width:"100%"},onChange:y,value:f,showTime:g,needConfirm:b})})},Zz=e=>wt.jsx("div",{children:"sdfsdfsdf"}),Qz={Input:pj,TextArea:hj,Password:bj,Search:yj,TreeSelect:Nz,Select:vs,WithSingleSelect:Tz,WithMultipleSelect:Fz,SingleSelect:Mz,MultipleSelect:Dz,CodeMachine:mj,Checkbox:Bz,CheckboxTree:zz,CheckboxGroup:Wz,RadioGroup:Kz,UploadFile:Uz,UploadImage:qz,Switch:Gz,DatePicker:Xz,Custom:Az},Jz={FormRow:kz,FormGroupTitle:Lz},eB={OptionSetter:Zz};exports.Field=Qz;exports.FormContainer=Jg;exports.FormContainerWrapper=Hz;exports.Layout=Jz;exports.Setter=eB;
383
+ }`;var Yt=ah(function(){return cn(q,Et+"return "+We).apply(n,ne)});if(Yt.source=We,Id(Yt))throw Yt;return Yt}function f_(o){return pn(o).toLowerCase()}function v_(o){return pn(o).toUpperCase()}function g_(o,c,p){if(o=pn(o),o&&(p||c===n))return vp(o);if(!o||!(c=Fr(c)))return o;var E=ia(o),A=ia(c),q=gp(E,A),ne=pp(E,A)+1;return io(E,q,ne).join("")}function p_(o,c,p){if(o=pn(o),o&&(p||c===n))return o.slice(0,hp(o)+1);if(!o||!(c=Fr(c)))return o;var E=ia(o),A=pp(E,ia(c))+1;return io(E,0,A).join("")}function m_(o,c,p){if(o=pn(o),o&&(p||c===n))return o.replace(nt,"");if(!o||!(c=Fr(c)))return o;var E=ia(o),A=gp(E,ia(c));return io(E,A).join("")}function h_(o,c){var p=M,E=k;if(kn(c)){var A="separator"in c?c.separator:A;p="length"in c?Gt(c.length):p,E="omission"in c?Fr(c.omission):E}o=pn(o);var q=o.length;if(li(o)){var ne=ia(o);q=ne.length}if(p>=q)return o;var se=p-si(E);if(se<1)return E;var ve=ne?io(ne,0,se).join(""):o.slice(0,se);if(A===n)return ve+E;if(ne&&(se+=ve.length-se),_d(A)){if(o.slice(se).search(A)){var ke,Le=ve;for(A.global||(A=Wu(A.source,pn(bt.exec(A))+"g")),A.lastIndex=0;ke=A.exec(Le);)var We=ke.index;ve=ve.slice(0,We===n?se:We)}}else if(o.indexOf(Fr(A),se)!=se){var st=ve.lastIndexOf(A);st>-1&&(ve=ve.slice(0,st))}return ve+E}function b_(o){return o=pn(o),o&&Tt.test(o)?o.replace(ft,qx):o}var y_=pi(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Nd=om("toUpperCase");function rh(o,c,p){return o=pn(o),c=p?n:c,c===n?zx(o)?Xx(o):Dx(o):o.match(c)||[]}var ah=Zt(function(o,c){try{return Dr(o,n,c)}catch(p){return Id(p)?p:new Bt(p)}}),C_=Ta(function(o,c){return Ur(c,function(p){p=xa(p),Ma(o,p,$d(o[p],o))}),o});function S_(o){var c=o==null?0:o.length,p=Dt();return o=c?Tn(o,function(E){if(typeof E[1]!="function")throw new qr(s);return[p(E[0]),E[1]]}):[],Zt(function(E){for(var A=-1;++A<c;){var q=o[A];if(Dr(q[0],this,E))return Dr(q[1],this,E)}})}function w_(o){return qE(Yr(o,g))}function Md(o){return function(){return o}}function x_(o,c){return o==null||o!==o?c:o}var E_=lm(),$_=lm(!0);function Pr(o){return o}function Dd(o){return kp(typeof o=="function"?o:Yr(o,g))}function O_(o){return Vp(Yr(o,g))}function I_(o,c){return jp(o,Yr(c,g))}var __=Zt(function(o,c){return function(p){return cl(p,o,c)}}),R_=Zt(function(o,c){return function(p){return cl(o,p,c)}});function Td(o,c,p){var E=ar(c),A=Ts(c,E);p==null&&!(kn(c)&&(A.length||!E.length))&&(p=c,c=o,o=this,A=Ts(c,ar(c)));var q=!(kn(p)&&"chain"in p)||!!p.chain,ne=Aa(o);return Ur(A,function(se){var ve=c[se];o[se]=ve,ne&&(o.prototype[se]=function(){var ke=this.__chain__;if(q||ke){var Le=o(this.__wrapped__),We=Le.__actions__=Ir(this.__actions__);return We.push({func:ve,args:arguments,thisArg:o}),Le.__chain__=ke,Le}return ve.apply(o,eo([this.value()],arguments))})}),o}function P_(){return lr._===this&&(lr._=nE),this}function Fd(){}function N_(o){return o=Gt(o),Zt(function(c){return Hp(c,o)})}var M_=fd(Tn),D_=fd(sp),T_=fd(ku);function oh(o){return yd(o)?Lu(xa(o)):u$(o)}function F_(o){return function(c){return o==null?n:No(o,c)}}var A_=cm(),k_=cm(!0);function Ad(){return[]}function kd(){return!1}function L_(){return{}}function V_(){return""}function j_(){return!0}function H_(o,c){if(o=Gt(o),o<1||o>F)return[];var p=V,E=gr(o,V);c=Dt(c),o-=V;for(var A=Hu(E,c);++p<o;)c(p);return A}function z_(o){return qt(o)?Tn(o,xa):Ar(o)?[o]:Ir($m(pn(o)))}function B_(o){var c=++eE;return pn(o)+c}var W_=js(function(o,c){return o+c},0),K_=vd("ceil"),U_=js(function(o,c){return o/c},1),q_=vd("floor");function G_(o){return o&&o.length?Ds(o,Pr,Qu):n}function Y_(o,c){return o&&o.length?Ds(o,Dt(c,2),Qu):n}function X_(o){return dp(o,Pr)}function Z_(o,c){return dp(o,Dt(c,2))}function Q_(o){return o&&o.length?Ds(o,Pr,nd):n}function J_(o,c){return o&&o.length?Ds(o,Dt(c,2),nd):n}var eR=js(function(o,c){return o*c},1),tR=vd("round"),nR=js(function(o,c){return o-c},0);function rR(o){return o&&o.length?ju(o,Pr):0}function aR(o,c){return o&&o.length?ju(o,Dt(c,2)):0}return W.after=OI,W.ary=Am,W.assign=v2,W.assignIn=Xm,W.assignInWith=Js,W.assignWith=g2,W.at=p2,W.before=km,W.bind=$d,W.bindAll=C_,W.bindKey=Lm,W.castArray=LI,W.chain=Dm,W.chunk=q$,W.compact=G$,W.concat=Y$,W.cond=S_,W.conforms=w_,W.constant=Md,W.countBy=rI,W.create=m2,W.curry=Vm,W.curryRight=jm,W.debounce=Hm,W.defaults=h2,W.defaultsDeep=b2,W.defer=II,W.delay=_I,W.difference=X$,W.differenceBy=Z$,W.differenceWith=Q$,W.drop=J$,W.dropRight=eO,W.dropRightWhile=tO,W.dropWhile=nO,W.fill=rO,W.filter=oI,W.flatMap=sI,W.flatMapDeep=cI,W.flatMapDepth=uI,W.flatten=Rm,W.flattenDeep=aO,W.flattenDepth=oO,W.flip=RI,W.flow=E_,W.flowRight=$_,W.fromPairs=iO,W.functions=$2,W.functionsIn=O2,W.groupBy=dI,W.initial=sO,W.intersection=cO,W.intersectionBy=uO,W.intersectionWith=dO,W.invert=_2,W.invertBy=R2,W.invokeMap=vI,W.iteratee=Dd,W.keyBy=gI,W.keys=ar,W.keysIn=Rr,W.map=qs,W.mapKeys=N2,W.mapValues=M2,W.matches=O_,W.matchesProperty=I_,W.memoize=Ys,W.merge=D2,W.mergeWith=Zm,W.method=__,W.methodOf=R_,W.mixin=Td,W.negate=Xs,W.nthArg=N_,W.omit=T2,W.omitBy=F2,W.once=PI,W.orderBy=pI,W.over=M_,W.overArgs=NI,W.overEvery=D_,W.overSome=T_,W.partial=Od,W.partialRight=zm,W.partition=mI,W.pick=A2,W.pickBy=Qm,W.property=oh,W.propertyOf=F_,W.pull=pO,W.pullAll=Nm,W.pullAllBy=mO,W.pullAllWith=hO,W.pullAt=bO,W.range=A_,W.rangeRight=k_,W.rearg=MI,W.reject=yI,W.remove=yO,W.rest=DI,W.reverse=xd,W.sampleSize=SI,W.set=L2,W.setWith=V2,W.shuffle=wI,W.slice=CO,W.sortBy=$I,W.sortedUniq=IO,W.sortedUniqBy=_O,W.split=s_,W.spread=TI,W.tail=RO,W.take=PO,W.takeRight=NO,W.takeRightWhile=MO,W.takeWhile=DO,W.tap=GO,W.throttle=FI,W.thru=Us,W.toArray=qm,W.toPairs=Jm,W.toPairsIn=eh,W.toPath=z_,W.toPlainObject=Ym,W.transform=j2,W.unary=AI,W.union=TO,W.unionBy=FO,W.unionWith=AO,W.uniq=kO,W.uniqBy=LO,W.uniqWith=VO,W.unset=H2,W.unzip=Ed,W.unzipWith=Mm,W.update=z2,W.updateWith=B2,W.values=bi,W.valuesIn=W2,W.without=jO,W.words=rh,W.wrap=kI,W.xor=HO,W.xorBy=zO,W.xorWith=BO,W.zip=WO,W.zipObject=KO,W.zipObjectDeep=UO,W.zipWith=qO,W.entries=Jm,W.entriesIn=eh,W.extend=Xm,W.extendWith=Js,Td(W,W),W.add=W_,W.attempt=ah,W.camelCase=G2,W.capitalize=th,W.ceil=K_,W.clamp=K2,W.clone=VI,W.cloneDeep=HI,W.cloneDeepWith=zI,W.cloneWith=jI,W.conformsTo=BI,W.deburr=nh,W.defaultTo=x_,W.divide=U_,W.endsWith=Y2,W.eq=sa,W.escape=X2,W.escapeRegExp=Z2,W.every=aI,W.find=iI,W.findIndex=Im,W.findKey=y2,W.findLast=lI,W.findLastIndex=_m,W.findLastKey=C2,W.floor=q_,W.forEach=Tm,W.forEachRight=Fm,W.forIn=S2,W.forInRight=w2,W.forOwn=x2,W.forOwnRight=E2,W.get=Rd,W.gt=WI,W.gte=KI,W.has=I2,W.hasIn=Pd,W.head=Pm,W.identity=Pr,W.includes=fI,W.indexOf=lO,W.inRange=U2,W.invoke=P2,W.isArguments=To,W.isArray=qt,W.isArrayBuffer=UI,W.isArrayLike=_r,W.isArrayLikeObject=Wn,W.isBoolean=qI,W.isBuffer=lo,W.isDate=GI,W.isElement=YI,W.isEmpty=XI,W.isEqual=ZI,W.isEqualWith=QI,W.isError=Id,W.isFinite=JI,W.isFunction=Aa,W.isInteger=Bm,W.isLength=Zs,W.isMap=Wm,W.isMatch=e2,W.isMatchWith=t2,W.isNaN=n2,W.isNative=r2,W.isNil=o2,W.isNull=a2,W.isNumber=Km,W.isObject=kn,W.isObjectLike=jn,W.isPlainObject=pl,W.isRegExp=_d,W.isSafeInteger=i2,W.isSet=Um,W.isString=Qs,W.isSymbol=Ar,W.isTypedArray=hi,W.isUndefined=l2,W.isWeakMap=s2,W.isWeakSet=c2,W.join=fO,W.kebabCase=Q2,W.last=Zr,W.lastIndexOf=vO,W.lowerCase=J2,W.lowerFirst=e_,W.lt=u2,W.lte=d2,W.max=G_,W.maxBy=Y_,W.mean=X_,W.meanBy=Z_,W.min=Q_,W.minBy=J_,W.stubArray=Ad,W.stubFalse=kd,W.stubObject=L_,W.stubString=V_,W.stubTrue=j_,W.multiply=eR,W.nth=gO,W.noConflict=P_,W.noop=Fd,W.now=Gs,W.pad=t_,W.padEnd=n_,W.padStart=r_,W.parseInt=a_,W.random=q2,W.reduce=hI,W.reduceRight=bI,W.repeat=o_,W.replace=i_,W.result=k2,W.round=tR,W.runInContext=de,W.sample=CI,W.size=xI,W.snakeCase=l_,W.some=EI,W.sortedIndex=SO,W.sortedIndexBy=wO,W.sortedIndexOf=xO,W.sortedLastIndex=EO,W.sortedLastIndexBy=$O,W.sortedLastIndexOf=OO,W.startCase=c_,W.startsWith=u_,W.subtract=nR,W.sum=rR,W.sumBy=aR,W.template=d_,W.times=H_,W.toFinite=ka,W.toInteger=Gt,W.toLength=Gm,W.toLower=f_,W.toNumber=Qr,W.toSafeInteger=f2,W.toString=pn,W.toUpper=v_,W.trim=g_,W.trimEnd=p_,W.trimStart=m_,W.truncate=h_,W.unescape=b_,W.uniqueId=B_,W.upperCase=y_,W.upperFirst=Nd,W.each=Tm,W.eachRight=Fm,W.first=Pm,Td(W,function(){var o={};return Sa(W,function(c,p){yn.call(W.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),W.VERSION=r,Ur(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){W[o].placeholder=W}),Ur(["drop","take"],function(o,c){en.prototype[o]=function(p){p=p===n?1:Jn(Gt(p),0);var E=this.__filtered__&&!c?new en(this):this.clone();return E.__filtered__?E.__takeCount__=gr(p,E.__takeCount__):E.__views__.push({size:gr(p,V),type:o+(E.__dir__<0?"Right":"")}),E},en.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),Ur(["filter","map","takeWhile"],function(o,c){var p=c+1,E=p==D||p==T;en.prototype[o]=function(A){var q=this.clone();return q.__iteratees__.push({iteratee:Dt(A,3),type:p}),q.__filtered__=q.__filtered__||E,q}}),Ur(["head","last"],function(o,c){var p="take"+(c?"Right":"");en.prototype[o]=function(){return this[p](1).value()[0]}}),Ur(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");en.prototype[o]=function(){return this.__filtered__?new en(this):this[p](1)}}),en.prototype.compact=function(){return this.filter(Pr)},en.prototype.find=function(o){return this.filter(o).head()},en.prototype.findLast=function(o){return this.reverse().find(o)},en.prototype.invokeMap=Zt(function(o,c){return typeof o=="function"?new en(this):this.map(function(p){return cl(p,o,c)})}),en.prototype.reject=function(o){return this.filter(Xs(Dt(o)))},en.prototype.slice=function(o,c){o=Gt(o);var p=this;return p.__filtered__&&(o>0||c<0)?new en(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==n&&(c=Gt(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},en.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},en.prototype.toArray=function(){return this.take(V)},Sa(en.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),E=/^(?:head|last)$/.test(c),A=W[E?"take"+(c=="last"?"Right":""):c],q=E||/^find/.test(c);A&&(W.prototype[c]=function(){var ne=this.__wrapped__,se=E?[1]:arguments,ve=ne instanceof en,ke=se[0],Le=ve||qt(ne),We=function(Qt){var rn=A.apply(W,eo([Qt],se));return E&&st?rn[0]:rn};Le&&p&&typeof ke=="function"&&ke.length!=1&&(ve=Le=!1);var st=this.__chain__,Et=!!this.__actions__.length,Ft=q&&!st,Yt=ve&&!Et;if(!q&&Le){ne=Yt?ne:new en(this);var At=o.apply(ne,se);return At.__actions__.push({func:Us,args:[We],thisArg:n}),new Gr(At,st)}return Ft&&Yt?o.apply(this,se):(At=this.thru(We),Ft?E?At.value()[0]:At.value():At)})}),Ur(["pop","push","shift","sort","splice","unshift"],function(o){var c=bs[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",E=/^(?:pop|shift)$/.test(o);W.prototype[o]=function(){var A=arguments;if(E&&!this.__chain__){var q=this.value();return c.apply(qt(q)?q:[],A)}return this[p](function(ne){return c.apply(qt(ne)?ne:[],A)})}}),Sa(en.prototype,function(o,c){var p=W[c];if(p){var E=p.name+"";yn.call(fi,E)||(fi[E]=[]),fi[E].push({name:c,func:p})}}),fi[Vs(n,S).name]=[{name:"wrapper",func:n}],en.prototype.clone=bE,en.prototype.reverse=yE,en.prototype.value=CE,W.prototype.at=YO,W.prototype.chain=XO,W.prototype.commit=ZO,W.prototype.next=QO,W.prototype.plant=eI,W.prototype.reverse=tI,W.prototype.toJSON=W.prototype.valueOf=W.prototype.value=nI,W.prototype.first=W.prototype.head,nl&&(W.prototype[nl]=JO),W},ci=Zx();Oo?((Oo.exports=ci)._=ci,Du._=ci):lr._=ci}).call(cr)})(au,au.exports);var Pz=au.exports;const Nz=e=>{let{request:t,title:n,disabledValue:r,callError:a,...i}=e;const[s,l]=Y.useState(!1),[u,f]=Y.useState([]);Y.useEffect(()=>{v()},[]);const v=async()=>{if(t&&typeof t=="function"){var g;const h=await t();if(h.code>0){a&&typeof a=="function"&&a(h.message);return}let b=Cx(((g=h.data)===null||g===void 0?void 0:g.list)||h.data||[],"id",n||"title",i.parentId||"parentId","children",0,r);b=[{value:0,title:"根节点",children:b}],i.treeData=b,f(b)}i.treeData&&f(i.treeData),l(!0)};return wt.jsx(yr,{...i,children:s&&wt.jsx(Eo,{...i,treeData:u,treeDefaultExpandAll:!0,style:{width:"100%"}})})},vs=e=>{let{request:t,option_label:n="label",option_value:r="id",disabledValue:a,callError:i,options:s,...l}=e;const[u,f]=Y.useState([]);Y.useEffect(()=>{v()},[]);const v=async()=>{if(t&&typeof t=="function"){var g;const h=await t();if(h.code>0){i&&typeof i=="function"&&i(h.message);return}let b=((g=h.data)===null||g===void 0?void 0:g.list)||h.data;Array.isArray(b)&&b.length>0&&f(b.map(C=>({label:C[n],value:C[r]})))}s&&s.length>0&&f(s)};return wt.jsx(yr,{...l,children:wt.jsx(ei,{...l,options:u,style:{width:"100%"}})})},Mz=e=>{let{...t}=e;return wt.jsx(vs,{...t,mode:"single"})},Dz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState([]);return Y.useEffect(()=>{if(typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}i(n)},[n]),wt.jsx(vs,{...r,onChange:t,mode:"multiple",value:a})},Tz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState("");Y.useEffect(()=>{if(n&&typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}n&&i(n)},[n]);const s=(l,u)=>{t&&typeof t=="function"&&t(u),i(u.label)};return wt.jsx(vs,{...r,onChange:s,value:a,mode:"single"})},Fz=e=>{let{onChange:t,value:n,...r}=e;const[a,i]=Y.useState([]);Y.useEffect(()=>{if(n&&typeof n=="string")try{n=JSON.parse(n),t(n)}catch{}Array.isArray(n)&&i(n)},[n]);const s=(l,u)=>{t&&typeof t=="function"&&t(u),u.map(f=>f.label),i(u)};return wt.jsx(vs,{...r,onChange:s,value:a,mode:"multiple"})},Az=Y.forwardRef((e,t)=>{let{value:n,onChange:r,...a}=e;const i=Y.useRef(0),s=()=>{i.current++,r(i.current)};return wt.jsxs(yr,{...a,children:[wt.jsxs("div",{ref:t,children:["form-set-value:",n]}),wt.jsx(Co,{onClick:s,children:"test"})]})}),kz=e=>{let{children:t,layout:n}=e;n=n||"1";const r=s=>{const l=s.split(",").map(Number),u=24;return l.map(f=>f/l.reduce((v,g)=>v+g)*u)},a=Y.useMemo(()=>r(n),[n]);console.log("colSpans",a);const i=Y.useMemo(()=>Y.Children.toArray(t).map((s,l)=>{const u=s.props,f=(u==null?void 0:u.componentId)||(u==null?void 0:u.__id);return f?(a==null?void 0:a[l])&&wt.jsx(Vi,{span:a[l],children:wt.jsx(na.Item,{style:{marginBottom:0},label:"",name:f,rules:[{required:u.isRequired,message:"".concat(u.title,"不能为空!")}],children:s},"".concat(f,"-form-item"))},l):(a==null?void 0:a[l])&&wt.jsx(Vi,{span:a[l],children:s},l)}),[t,a]);return wt.jsx(Iu,{gutter:24,children:i})},Lz=e=>{let{title:t}=e;return t?wt.jsx("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium fmb-5 ",children:wt.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:t})}):null};function Vz(e,t){const n=[];let r=[];const a=(i,s)=>{const l=i-s.length;s.push(...new Array(l).fill(Y.createElement("div")))};for(const i of e){const{_componentName:s}=(i==null?void 0:i.props)||{};s&&s.startsWith("Layout")?(r.length>0&&(a(t,r),n.push(r),r=[]),n.push([i])):(r.push(i),r.length===t&&(n.push(r),r=[]))}return r.length>0&&(a(t,r),n.push(r)),n}const Jg=Y.forwardRef((e,t)=>{let{cols:n=1,children:r}=e;const[a]=na.useForm(),[i,s]=Y.useState(null),l=Y.useRef(null);Y.useImperativeHandle(t,()=>({formRef:a,initializeFieldVisibility:f}),[]),Y.useEffect(()=>{u(),s(h())},[r,n]);const u=()=>{l.current=new Map;const b=Y.Children.toArray(r);b.forEach(C=>{const{componentId:y,__id:m,...S}=C.props,w=y||m;l.current.set(w,{children:b.filter(x=>{var $;return x.props.__withId===w||(($=x.props.__withIds)===null||$===void 0?void 0:$.includes(w))}),show:!0})}),f()},f=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const C=a.getFieldsValue();for(let y of l.current.keys())v(y,C);b&&s(h())},v=(b,C)=>{let y=!1;return l.current.has(b)&&l.current.get(b).children.forEach(S=>{if(S.props.__withFunc&&typeof S.props.__withFunc=="function"){const w=S.props.__withFunc(C),x=S.props.componentId||S.props.__id;if(l.current.has(x)){const $=l.current.get(x);$.show!==w&&($.show=w,l.current.set(x,$),y=!0)}}}),y},g=Pz.debounce((b,C)=>{const y=a.getFieldsValue();let m=!1;b.forEach(S=>{S.name&&S.name.length>0&&(m=v(S.name[0],y))}),m&&s(h())},100),h=()=>{const b=Y.Children.toArray(r);return Vz(b.filter(y=>{const m=y.props.componentId||y.props.__id;return l.current.has(m)&&l.current.get(m).show}),n).map((y,m)=>wt.jsx(Iu,{gutter:[24,24],children:y.map((S,w)=>{const{componentId:x,__id:$,_componentName:I,...O}=S.props,_=x||$,R=I&&I.startsWith("Layout");return wt.jsx(Vi,{span:R?24:24/y.length,style:{marginBottom:0},children:R?S:wt.jsx(na.Item,{style:{marginBottom:0},label:"",name:_,rules:[{required:O.isRequired,message:"".concat(O.title,"不能为空!")}],children:S})},_||"col-".concat(w))})},"row-".concat(m)))};return wt.jsx(na,{form:a,className:"form-container fp-6 fw-full fh-full box-border overflow-auto",onFieldsChange:g,children:i})});function jz(e){return Y.forwardRef((t,n)=>wt.jsx(e,{...t,ref:n,forwardedRef:n}))}class tB extends Y.PureComponent{render(){const{forwardedRef:t,...n}=this.props;return wt.jsx(Jg,{...n,ref:t})}}const Hz=jz(e=>{let{forwardedRef:t,...n}=e;return wt.jsx(Jg,{...n,ref:t})}),zz=e=>{let{request:t,value:n,onChange:r,callError:a,disabledValue:i,addRoot:s=!0,title:l,...u}=e;const[f,v]=Y.useState(!1),[g,h]=Y.useState([]);Y.useEffect(()=>{b()},[]),Y.useEffect(()=>{if(console.log("CheckboxTree value ",n),typeof n=="string")try{n=JSON.parse(n),r(n)}catch{}Array.isArray(n)&&S(n)},[n]);const b=async()=>{if(t&&typeof t=="function"){var P;const M=await t();if(M.code>0){a&&typeof a=="function"&&a(M.message);return}let k=Cx(((P=M.data)===null||P===void 0?void 0:P.list)||M.data||[],"id",l||"title",(u==null?void 0:u.parentId)||"parentId","children",0,i);s&&(k=[{value:0,title:"根节点",children:k}]),u.treeData=k,console.log("treeData",k),h(k)}u.treeData&&h(u.treeData),v(!0)},[C,y]=Y.useState([]),[m,S]=Y.useState([]),[w,x]=Y.useState([]),[$,I]=Y.useState(!0),O=P=>{console.log("onExpand",P),y(P),I(!1)},_=P=>{console.log("onCheck",P),S(P),r(P)},R=(P,M)=>{console.log("onSelect",M),x(P)};return wt.jsx(yr,{...u,children:wt.jsx(qg,{checkable:!0,onExpand:O,onCheck:_,onSelect:R,expandedKeys:C,autoExpandParent:$,checkedKeys:m,selectedKeys:w,treeData:g})})},Bz=e=>wt.jsx(yr,{...e,children:wt.jsx(cs,{...e})}),Wz=e=>{let{value:t,onChange:n,...r}=e;const[a,i]=Y.useState([]);return Y.useEffect(()=>{if(typeof t=="string")try{t=JSON.parse(t),n(t)}catch{}i(t)},[t]),wt.jsx(yr,{...r,children:wt.jsx(cs.Group,{...r,value:a})})},Kz=e=>wt.jsx(yr,{...e,children:wt.jsx(Ou.Group,{...e})}),Uz=e=>{let{value:t,maxCount:n,onChange:r,...a}=e;Y.useEffect(()=>{if(t){if(typeof t=="string")try{t=JSON.parse(t),r(t)}catch{}console.log("value",t),Array.isArray(t)&&s(t)}},[t]),n=n||9;const[i,s]=Y.useState([]),l=u=>{let{fileList:f}=u;f=f.map(v=>(v.status=="done"&&v.response&&(v.url=v.response),v)),r(f.map(v=>({uid:v.uid,name:v.name,status:v.status,url:v.url||v.response||""}))),s(f)};return wt.jsx(yr,{...a,children:wt.jsx(Nu,{...a,listType:"text",maxCount:n,onChange:l,fileList:i,children:wt.jsxs("div",{className:" fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center ",children:[wt.jsx(yx,{}),"点击上传文件"]})})})},qz=e=>{let{maxCount:t,value:n,onChange:r,...a}=e;Y.useEffect(()=>{if(n){if(console.log("value",n),typeof n=="string")try{n=JSON.parse(n),r(n)}catch{}Array.isArray(n)&&s(n)}},[n]),t=t||9;const[i,s]=Y.useState([]),[l,u]=Y.useState(""),[f,v]=Y.useState(!1),g=async C=>{!C.url&&!C.preview&&(C.preview=await getBase64(C.originFileObj)),u(C.url||C.preview),v(!0)},h=wt.jsxs("button",{style:{border:0,background:"none"},type:"button",children:[wt.jsx(bx,{}),wt.jsx("div",{style:{marginTop:8},children:"点击上传"})]}),b=C=>{let{fileList:y}=C;y=y.map(m=>(m.status=="done"&&m.response&&(m.url=m.response),m)),r(y.map(m=>({uid:m.uid,name:m.name,status:m.status,url:m.url||m.response||""}))),s(y)};return wt.jsxs(yr,{...a,children:[wt.jsx(Nu,{...a,maxCount:t,listType:"picture-card",fileList:i,onPreview:g,onChange:b,children:i.length>=t?null:h}),l&&wt.jsx(Image,{wrapperStyle:{display:"none"},preview:{visible:f,onVisibleChange:C=>v(C),afterOpenChange:C=>!C&&u("")},src:l})]})},Gz=e=>{let{value:t,...n}=e;const[r,a]=Y.useState(!1);return Y.useEffect(()=>{let i=!1;typeof t=="boolean"?i=t:typeof t=="string"?i=t=="1"||t=="true":typeof t=="number"&&(i=t==1),a(i),n==null||n.onChange(i)},[t]),wt.jsx(yr,{...n,children:wt.jsx(Hg,{...n,value:r})})};var Yz={exports:{}};(function(e,t){(function(n,r){e.exports=r(FS)})(cr,function(n){function r(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var a=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(s,l){return l==="W"?s+"周":s+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(s,l){var u=100*s+l;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return a.default.locale(i,null,!0),i})})(Yz);mr.locale("zh-cn");const Xz=e=>{let{datetype:t,value:n,onChange:r,...a}=e;t=t||"date";const[i,s]=Y.useState(a==null?void 0:a.picker),[l,u]=Y.useState(a==null?void 0:a.format),[f,v]=Y.useState(null),[g,h]=Y.useState(!1),[b,C]=Y.useState(!1);Y.useEffect(()=>{if(n){const m=mr(n);v(m)}},[n,l,i]);const y=(m,S)=>{r(S)};return Y.useEffect(()=>{switch(s("date"),h(!1),t){case"date":s("date"),u("YYYY-MM-DD"),C(!1);break;case"datetime":h(!0),s("datetime"),u("YYYY-MM-DD HH:mm:ss"),C(!0);break;case"month":s("month"),C(!1);break;case"year":s("year"),C(!1);break}},[t]),wt.jsx(yr,{...a,children:wt.jsx(Yi,{...a,picker:i,format:l,style:{width:"100%"},onChange:y,value:f,showTime:g,needConfirm:b})})},Zz=e=>wt.jsx("div",{children:"sdfsdfsdf"}),Qz={Input:pj,TextArea:hj,Password:bj,Search:yj,TreeSelect:Nz,Select:vs,WithSingleSelect:Tz,WithMultipleSelect:Fz,SingleSelect:Mz,MultipleSelect:Dz,CodeMachine:mj,Checkbox:Bz,CheckboxTree:zz,CheckboxGroup:Wz,RadioGroup:Kz,UploadFile:Uz,UploadImage:qz,Switch:Gz,DatePicker:Xz,Custom:Az},Jz={FormRow:kz,FormGroupTitle:Lz},eB={OptionSetter:Zz};exports.Field=Qz;exports.FormContainer=Jg;exports.FormContainerWrapper=Hz;exports.Layout=Jz;exports.Setter=eB;
package/dist/index.es.js CHANGED
@@ -36046,7 +36046,14 @@ const bB = aB((e) => {
36046
36046
  ...a
36047
36047
  } = e;
36048
36048
  dn(() => {
36049
- t && s(t);
36049
+ if (t) {
36050
+ if (typeof t == "string")
36051
+ try {
36052
+ t = JSON.parse(t), r(t);
36053
+ } catch {
36054
+ }
36055
+ console.log("value", t), Array.isArray(t) && s(t);
36056
+ }
36050
36057
  }, [t]), n = n || 9;
36051
36058
  const [i, s] = Re.useState([]), l = (u) => {
36052
36059
  let {
@@ -36066,7 +36073,7 @@ const bB = aB((e) => {
36066
36073
  listType: "text",
36067
36074
  maxCount: n,
36068
36075
  onChange: l,
36069
- defaultFileList: i,
36076
+ fileList: i,
36070
36077
  children: /* @__PURE__ */ wt.jsxs("div", {
36071
36078
  className: " fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center ",
36072
36079
  children: [/* @__PURE__ */ wt.jsx(_x, {}), "点击上传文件"]
@@ -36081,7 +36088,14 @@ const bB = aB((e) => {
36081
36088
  ...a
36082
36089
  } = e;
36083
36090
  dn(() => {
36084
- n && s(n);
36091
+ if (n) {
36092
+ if (console.log("value", n), typeof n == "string")
36093
+ try {
36094
+ n = JSON.parse(n), r(n);
36095
+ } catch {
36096
+ }
36097
+ Array.isArray(n) && s(n);
36098
+ }
36085
36099
  }, [n]), t = t || 9;
36086
36100
  const [i, s] = Re.useState([]), [l, u] = Pn(""), [f, v] = Pn(!1), g = async (C) => {
36087
36101
  !C.url && !C.preview && (C.preview = await getBase64(C.originFileObj)), u(C.url || C.preview), v(!0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@testing-library/jest-dom": "^5.17.0",
package/src/App.jsx CHANGED
@@ -31,6 +31,8 @@ function App() {
31
31
  const setFormFields = () => {
32
32
  formRef?.current?.formRef?.setFieldsValue({
33
33
  CheckboxGroup:"[\"1\",\"2\"]",
34
+ UploadFile:"[{\"uid\":\"rc-upload-1718779211228-3\",\"url\":\"/files/20240619/ZmUznJfquBeSmOUC_pdf/17204092_43b027e81a384b0590f0f453288544dd-040624-1533-978.pdf\",\"name\":\"17204092_43b027e81a384b0590f0f453288544dd-040624-1533-978.pdf\",\"status\":\"done\"}]",
35
+ UploadImage:"[{\"uid\":\"rc-upload-1718779211228-5\",\"url\":\"/files/20240619/chwbgVsNfgSzCXyn_png/nouser.png\",\"name\":\"nouser.png\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-7\",\"url\":\"/files/20240619/bRbnpmseaGyCxpWZ_jpg/1717032062027(1).jpg\",\"name\":\"1717032062027(1).jpg\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-9\",\"url\":\"/files/20240619/TlomGohpkBxXyRqN_png/logo-adg.png\",\"name\":\"logo-adg.png\",\"status\":\"done\"}]",
34
36
  select1:"1",
35
37
  select2:"[\"1\",\"2\"]",
36
38
  switch:"1",
@@ -6,7 +6,20 @@ import React, { useEffect, useState } from "react";
6
6
 
7
7
  const UploadFile = ({ value, maxCount, onChange, ...props }) => {
8
8
  useEffect(() => {
9
- if (value) setFileList(value)
9
+ if (value) {
10
+ if (typeof value == 'string') {
11
+ try {
12
+ value = JSON.parse(value)
13
+ onChange(value)
14
+ } catch (error) {
15
+
16
+ }
17
+ }
18
+
19
+ console.log("value", value)
20
+ if (Array.isArray(value))
21
+ setFileList(value)
22
+ }
10
23
  }, [value]);
11
24
  maxCount = maxCount || 9;
12
25
  const [fileList, setFileList] = React.useState([]);
@@ -33,9 +46,9 @@ const UploadFile = ({ value, maxCount, onChange, ...props }) => {
33
46
  listType="text"
34
47
  maxCount={maxCount}
35
48
  onChange={handleChange}
36
- defaultFileList={fileList}>
37
- <div className=" fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center "><UploadOutlined />点击上传文件</div>
38
-
49
+ fileList={fileList}>
50
+ <div className=" fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center "><UploadOutlined />点击上传文件</div>
51
+
39
52
  </OriginalUpload>
40
53
  </BaseWrapper>
41
54
  );
@@ -6,7 +6,20 @@ import React,{ useEffect, useState} from "react";
6
6
 
7
7
  const UploadImage = ({ maxCount, value, onChange, ...props }) => {
8
8
  useEffect(() => {
9
- if (value) setFileList(value)
9
+ if (value){
10
+ console.log("value" ,value)
11
+ if ( typeof value == 'string') {
12
+ try {
13
+ value = JSON.parse(value)
14
+ onChange(value)
15
+ } catch (error) {
16
+
17
+ }
18
+ }
19
+
20
+ if(Array.isArray(value))
21
+ setFileList(value)
22
+ }
10
23
  }, [value]);
11
24
  maxCount = maxCount || 9;
12
25
  const [fileList, setFileList] = React.useState([]);