lu-lowcode-package-form 0.11.91 → 0.11.94

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
@@ -427,7 +427,7 @@ Consider to rely on 'then' or 'done' mode instead.`);w&&(delete c[h],f[h]=S,u.em
427
427
  const __result = `.concat(e.join(""),`;
428
428
  return __result;
429
429
  })()
430
- `),t=new Function("Decimal",n)(ZN),typeof t=="object"&&t!==null||(t=t.toString())}catch(r){console.error("formula (".concat(n,") error"),r)}return t},{primitive:!0,max:1e3,maxAge:1e3*60*1}),Z_t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Dl=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=Z_t[n[e]&63];return t};var bJe={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function i(l,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new o(c,f||l,d),g=n?n+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],h]:l._events[g].push(h):(l._events[g]=h,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)t.call(c,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=n?n+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,h=f.length,g=new Array(h);d<h;d++)g[d]=f[d].fn;return g},s.prototype.listenerCount=function(u){var c=n?n+u:u,f=this._events[c];return f?f.fn?1:f.length:0},s.prototype.emit=function(u,c,f,d,h,g){var m=n?n+u:u;if(!this._events[m])return!1;var p=this._events[m],y=arguments.length,v,b;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,f),!0;case 4:return p.fn.call(p.context,c,f,d),!0;case 5:return p.fn.call(p.context,c,f,d,h),!0;case 6:return p.fn.call(p.context,c,f,d,h,g),!0}for(b=1,v=new Array(y-1);b<y;b++)v[b-1]=arguments[b];p.fn.apply(p.context,v)}else{var E=p.length,S;for(b=0;b<E;b++)switch(p[b].once&&this.removeListener(u,p[b].fn,void 0,!0),y){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,f);break;case 4:p[b].fn.call(p[b].context,c,f,d);break;default:if(!v)for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];p[b].fn.apply(p[b].context,v)}}return!0},s.prototype.on=function(u,c,f){return i(this,u,c,f,!1)},s.prototype.once=function(u,c,f){return i(this,u,c,f,!0)},s.prototype.removeListener=function(u,c,f,d){var h=n?n+u:u;if(!this._events[h])return this;if(!c)return a(this,h),this;var g=this._events[h];if(g.fn)g.fn===c&&(!d||g.once)&&(!f||g.context===f)&&a(this,h);else{for(var m=0,p=[],y=g.length;m<y;m++)(g[m].fn!==c||d&&!g[m].once||f&&g[m].context!==f)&&p.push(g[m]);p.length?this._events[h]=p.length===1?p[0]:p:a(this,h)}return this},s.prototype.removeAllListeners=function(u){var c;return u?(c=n?n+u:u,this._events[c]&&a(this,c)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(bJe);var J_t=bJe.exports;const EJe=Ws(J_t),o3=new EJe,eHt=e=>{let{children:t,layout:n,onTableAddRow:r,onTableRemoveRow:o,form:i,initializeFormRender:a,recordFieldsChange:s,mode:l,getTableWithIds:u,removeLastFieldsValues:c,getDependencyMapItem:f,renderKey:d}=e;n=n||"1";const h=v=>{const b=v.split(",").map(Number),E=24;return b.map(S=>S/b.reduce((w,C)=>w+C)*E)},g=Z.useMemo(()=>h(n),[n]),m=v=>{if(typeof f=="function"){const b=f(v);if(b)return b==null?void 0:b.show}return!0},p=Z.useRef({}),y=Z.useMemo(()=>Z.Children.toArray(t).map((v,b)=>{var E,S;const w=v.props,C=(w==null?void 0:w.componentId)||(w==null?void 0:w.__id),x=C;var D=((E=v.type)===null||E===void 0?void 0:E.displayName)||((S=v.props)===null||S===void 0?void 0:S._componentName);x in p.current||(p.current[x]=Dl());const T=((w==null?void 0:w.calcHidden)||!m(x))&&l!="desgin",O=[];if(w!=null&&w.isRequired&&O.push({required:!0,message:"".concat(w.label,"必须填写")}),w!=null&&w.rules)if(Array.isArray(w.rules)){const R=w.rules.join("|");O.push({pattern:new RegExp(R),message:w.rulesFailMessage?w.rulesFailMessage:"".concat(w.label,"格式错误")})}else O.push({pattern:new RegExp(w.rules),message:w.rulesFailMessage?w.rulesFailMessage:"".concat(w.label,"格式错误")});const N=R=>{i.setFieldValue(x,R)};let M=null;return D=="Field.Table"?M=Z.cloneElement(v,{onTableAddRow:r,onTableRemoveRow:o,form:i,fieldName:C,initializeFormRender:a,mode:l,recordFieldsChange:s,getTableWithIds:u,removeLastFieldsValues:c,getDependencyMapItem:f,renderKey:d}):D==="Field.WithSingleSelect"||D==="Field.WithMultipleSelect"||D==="Show.WithTable"?M=He.jsx(bi.Item,{hidden:T,style:{margin:0},shouldUpdate:(R,F)=>{let B=!1;if(Array.isArray(w.filterRules)&&w.filterRules.length>0)for(let k of w.filterRules){if(k.valueType!="variable")continue;let z,V;if(z=R==null?void 0:R[k.value.field_key],V=F==null?void 0:F[k.value.field_key],z!==V){B=!0;break}}return B&&(p.current[x]=Dl()),B},children:R=>{let{getFieldsValue:F}=R;const B=F();let k=Z.cloneElement(v,{onTableAddRow:r,onTableRemoveRow:o,form:i,fieldName:x,onCustomChange:N,fieldsValue:B,initializeFormRender:a,recordFieldsChange:s,getTableWithIds:u,removeLastFieldsValues:c,shouldUpdateKey:p.current[x]});return D==="Show.WithTable"?He.jsx(He.Fragment,{children:k}):He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:x,rules:O,children:k})}}):Z.isValidElement(v)?M=He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:C,rules:O,hidden:T,children:Z.cloneElement(v,{form:i,fieldName:C,initializeFormRender:a,recordFieldsChange:s})},"".concat(C,"-form-item")):M=v,(g==null?void 0:g[b])&&He.jsx(nA,{span:g[b],children:M},b)}),[t,g,d]);return He.jsx(KN,{gutter:24,children:y})},tHt=e=>{let{title:t}=e;return t?He.jsx("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium ",children:He.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:t})}):null};function nHt(e,t,n){const r=[];let o=[];const i=(s,l)=>{const u=s-l.length;u>0&&l.push(...new Array(u).fill(Z.createElement("div")))};for(const s of e){var a;const{_componentName:l}=(s==null?void 0:s.props)||{},u=((a=s.type)===null||a===void 0?void 0:a.displayName)||l;u&&u.startsWith("Layout.")?(o.length>0&&(i(t,o),r.push(o),o=[]),r.push([s])):(o.push(s),o.filter(f=>{var d,h,g,m;const p=((d=f.props)===null||d===void 0?void 0:d.componentId)||((h=f.props)===null||h===void 0?void 0:h.__id);return(!n.has(p)||((g=n.get(p))===null||g===void 0?void 0:g.show))&&!(f!=null&&(m=f.props)!==null&&m!==void 0&&m.calcHidden)}).length===t&&(r.push(o),o=[]))}return o.length>0&&(i(t,o),r.push(o)),r}const vpe=Z.forwardRef((e,t)=>{let{cols:n=1,children:r,mode:o="view"}=e;const[i]=bi.useForm(),a=Z.useRef(null),[s,l]=Z.useState(null),u=Z.useRef(null),c=()=>{const H=W();sh.isEqual(a.current,H)||(a.current=H,l(H))},f=Z.useRef(0),d=Z.useRef({currentCycleId:0,updatePath:[],MAX_DEPTH:30,startNewCycle:function(){return this.currentCycleId++,this.updatePath=[],this.currentCycleId},addToPath:function(H){if(this.updatePath.length>=this.MAX_DEPTH){console.warn("依赖路径深度超过限制(".concat(this.MAX_DEPTH,"),可能存在过深嵌套"));return}H&&this.updatePath.push(H)},hasCircularDependency:function(H){return H?this.updatePath.includes(H):!1},getCurrentPath:function(){return[...this.updatePath]},finishField:function(){this.updatePath.length>0&&this.updatePath.pop()}});Z.useImperativeHandle(t,()=>({formRef:i,setFieldsValue:H=>{f.current=1;let K={...H,__id:H==null?void 0:H.id};for(let q in H)if(R.current[q]={name:q,value:H[q]},u.current.has(q)&&u.current.get(q).componentName=="Field.Table"&&Array.isArray(H[q]))for(let Q=0;Q<H[q].length;Q++){const X=H[q][Q];for(let Y in X)R.current[[q,Q,Y]]={name:[q,Q,Y],value:X[Y]}}i.setFieldsValue(K),B()},initializeFieldVisibility:H=>{E(H)}}),[]);const h=Z.useCallback(sh.throttle(async()=>{await v(),console.log("initializeDependencyMap"),requestAnimationFrame(()=>{c()})},300),[r,n]);Z.useEffect(()=>(console.log("UseEffect throttledInitializeFormRender"),h(),()=>{h.cancel()}),[r,n]);const g=()=>{h()},m=Z.useRef(null),p=H=>Array.isArray(H)?H.map(K=>typeof K=="string"?K:K.toString()).join("."):H,y=H=>{var K;return(K=m.current)===null||K===void 0?void 0:K[p(H)]},v=async()=>{const H=[];function K(Q){var X,Y;let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;var re=((X=Q.type)===null||X===void 0?void 0:X.displayName)||((Y=Q.props)===null||Y===void 0?void 0:Y._componentName);const{props:J}=Q;if(re&&(re.startsWith("Field.")||re.startsWith("Layout."))){let be=(J==null?void 0:J.componentId)||(J==null?void 0:J.__id),ie=[];if(ne&&ne!==null&&ne!==void 0&&ne.props){var se,ve;be="".concat((ne==null||(se=ne.props)===null||se===void 0?void 0:se.componentId)||(ne==null||(ve=ne.props)===null||ve===void 0?void 0:ve.__id),".").concat(be)}J!=null&&J.withId&&ie.push(J==null?void 0:J.withId),J!=null&&J.withIds&&(ie=[...ie,...J==null?void 0:J.withIds]),H.push({identifier:be,withIds:ie,component:Q,componentName:re,fillRules:J==null?void 0:J.fillRules})}J!=null&&J.children&&Z.Children.toArray(J==null?void 0:J.children).forEach(ie=>K(ie,re&&re.startsWith("Field.")?Q:null))}u.current=new Map,console.log(" fields",H);const q=Z.Children.toArray(r);for(let Q=0;Q<q.length;Q++){const X=q[Q];K(X)}H.forEach(Q=>{const{identifier:X}=Q;u.current.set(X,{children:H.filter(Y=>Y.withIds.some(ne=>ne==X)),show:!0,...Q})}),await b()},b=async function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;console.log("initializeFieldVisibility *************************************");const K=i.getFieldsValue();await Promise.all(Array.from(u.current.keys()).map(async q=>{await S(q,K,!0)})),H&&c()},E=sh.debounce(async function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;await b(H)},100),S=async function(H,K){let q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,X=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;if(o=="desgin")return console.log("设计模式下不进行字段级联计算"),!1;console.log("handleFieldsWith identifier",H);let Y=!1,ne=[];Array.isArray(H)&&(ne=[...H.slice(0,-1)],H=H.filter(J=>typeof J=="string").join("."));const re=Q||H;if(d.current.hasCircularDependency(re)){const J=d.current.getCurrentPath();return console.log("检测到循环依赖链路: ".concat([...J,re].join(" -> "))),!1}d.current.addToPath(re);try{if(console.log("dependencyMap.current",u.current),console.log("dependencyMap.current identifier",H),u.current.has(H)){const J=u.current.get(H),se=J.children;!q&&J!==null&&J!==void 0&&J.fillRules&&Array.isArray(J==null?void 0:J.fillRules)&&(J==null?void 0:J.fillRules.length)>0&&!(typeof X=="number"&&X>=0)&&D(H,ne,K,J==null?void 0:J.fillRules);for(let ve=0;ve<se.length;ve++){const be=se[ve];if(!(typeof X=="number"&&X>=0)){if(be.component.props.withVisibleFunc&&typeof be.component.props.withVisibleFunc=="function"){let ie=T(K,be,ne);Y=Y||ie}if(be.component.props.withVisible){let ie=await O(K,be,ne,J==null?void 0:J.componentName);Y=Y||ie}}!q&&be.component.props.withFill&&await N(K,be,ne,J==null?void 0:J.componentName,re,X)}}}finally{d.current.finishField()}return Y},w=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(m.current)if(K){const q=Object.keys(m.current);for(let Q=0;Q<q.length;Q++){const X=q[Q];X.includes("".concat(H,","))&&delete m.current[p(X)]}}else delete m.current[p(H)]},C=(H,K)=>{R.current||(R.current={}),R.current[H]=K},x=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;console.log("recordFieldsChange",H,K);var q=Object.keys(H);q.length>0&&(q.forEach(Q=>{C(Q,H[Q])}),K&&B())},D=(H,K,q,Q)=>{let X=M("fieldsValue",H,q,null),Y={};Array.isArray(H)&&H.filter(be=>typeof be=="string").join(".");let ne=[];for(let be=0;be<Q.length;be++){const ie=Q[be];let{source:de,target:pe}=ie,fe=X==null?void 0:X[de],we=fe;if(Array.isArray(H)&&H.filter(Pe=>typeof Pe=="string").join("."),Array.isArray(pe)&&pe.filter(Pe=>typeof Pe=="string").join("."),(ie==null?void 0:ie.type)==1){if(u.current.has(pe)){var re,J,se;let Se=(re=u.current.get(pe))===null||re===void 0||(J=re.component)===null||J===void 0||(se=J.props)===null||se===void 0?void 0:se.children;Array.isArray(Se)&&Se.length>0&&ne.push(Se.map(Ie=>{var Ge,qe;return"".concat(de,".").concat((Ie==null||(Ge=Ie.props)===null||Ge===void 0?void 0:Ge.componentId)||(Ie==null||(qe=Ie.props)===null||qe===void 0?void 0:qe.__id))}))}if(fe&&typeof fe=="string")try{fe=JSON.parse(fe)}catch(Se){console.error("error end",Se)}if(!Array.isArray(fe))return;we=fe.map((Se,Ie)=>{let Ge={};if(ie!=null&&ie.subRules&&Array.isArray(ie==null?void 0:ie.subRules)&&(ie==null?void 0:ie.subRules.length)>0)for(let qe=0;qe<(ie==null?void 0:ie.subRules.length);qe++){const{source:_e,target:nt}=ie==null?void 0:ie.subRules[qe];Ge[nt]=Se==null?void 0:Se[_e];let ze={name:[pe,Ie,nt],value:Se==null?void 0:Se[_e]};Y[ze.name]=ze}return Ge}),w(pe,!0),o3.emit("reloadTable",pe)}else{let Pe=0;if(K&&Array.isArray(K)&&K.length>1&&(K.filter(Se=>typeof Se=="string").join("."),Pe=K[K.length-1],pe=[...K,pe],Array.isArray(X)&&X.length>Pe)){var ve;we=(ve=X[Pe])===null||ve===void 0?void 0:ve[de]}Y[pe]={name:Array.isArray(pe)?pe:[pe],value:we}}(ie==null?void 0:ie.type)==1&&(console.log("rule?.type == 1",pe),console.log("rule?.type == 1",we),console.log("rule?.type == 1 current_identifier",H),i.setFieldValue(pe,void 0)),console.log("form.setFieldValue(target, setValue) "+pe,we),i.setFieldValue(pe,we)}setTimeout(()=>{x(Y,!0),ne.length>0&&ne.forEach(be=>{Array.isArray(be)&&be.length>0&&_(be)})},0)},T=(H,K,q)=>{var Q,X;let Y=!1;const ne=K==null||(Q=K.component)===null||Q===void 0||(X=Q.props)===null||X===void 0?void 0:X.withVisibleFunc(H),re=K==null?void 0:K.identifier;if(u.current.has(re)){const J=u.current.get(re);J.show!==ne&&(J.show=ne,u.current.set(re,J),Y=!0)}return Y},O=async(H,K,q,Q)=>{var X,Y;let ne=!1;const re=K==null||(X=K.component)===null||X===void 0?void 0:X.props.withVisible,J=K==null||(Y=K.component)===null||Y===void 0?void 0:Y.props.withDataFetch;let se=0,ve=K.identifier,be=[];if(re!=null&&re.withData&&(re==null?void 0:re.withData.length)>0&&J&&typeof J=="function")for(let pe=0;pe<(re==null?void 0:re.withData.length);pe++){const fe=re==null?void 0:re.withData[pe];let we={};we.tableName=fe.withTable.table_name,we.filter={};for(let Se=0;Se<fe.withCondition.length;Se++){var ie;const{value:Ie,column:Ge}=fe.withCondition[Se];let qe=M(Ie.group_key,Ie.field_key,H,be);Array.isArray(qe)&&Array.isArray(ve)&&qe.length>se&&(qe=qe[se]),Q=="Field.WithSingleSelect"&&qe&&(ie=qe)!==null&&ie!==void 0&&ie.value&&(qe=qe.value),we.filter[Ge.column_name]=qe}const Pe=await J(we);Pe.code===0&&Pe.data.list&&be.push({id:fe.id,data:Pe.data.list})}let de;if(re.value&&re.value.length>0&&(de=re.value.map(pe=>{let fe="";const{insert:we,attributes:Pe}=pe;return typeof we!="string"?we!=null&&we.span&&Pe&&Pe.tagKey&&Pe.id&&(fe=M(Pe.tagKey,Pe.id,H,be),Array.isArray(fe)?(Array.isArray(ve)&&fe.length>se&&(fe=fe[se]),typeof fe=="object"&&fe!==null&&(fe=JSON.stringify(fe))):typeof fe=="object"&&fe!==null?fe=JSON.stringify(fe):fe.length>0&&(fe='"'.concat(fe,'"'))):fe=we,fe})),u.current.has(ve)){const pe=u.current.get(ve);if(de&&de.length>0){const fe=Vre(de)=="true";pe.show!=fe&&(pe.show=fe,u.current.set(ve,pe),ne=!0)}}return ne},N=async function(H,K,q,Q,X){var Y,ne;let re=arguments.length>5&&arguments[5]!==void 0?arguments[5]:-1;console.log("handleFieldsWithFill componentName",Q);const J=K==null||(Y=K.component)===null||Y===void 0?void 0:Y.props.withFill,se=K==null||(ne=K.component)===null||ne===void 0?void 0:ne.props.withDataFetch;let ve=0,be="",ie=K.identifier;if(q&&Array.isArray(q)&&q.length>1)be=q.filter(fe=>typeof fe=="string").join("."),ve=q[q.length-1],ie.startsWith("".concat(be,"."))&&(ie=[...q,ie.replace("".concat(be,"."),"")]);else if(ie.indexOf(".")>=0){ie=ie.split(".");let fe=M("fieldsValue",ie[0],H,[]);Array.isArray(fe)&&fe.length>0&&typeof re=="number"&&re>=0&&re<fe.length&&await N(H,K,[ie[0],re],Q,X);for(let we=0;we<fe.length;we++)await N(H,K,[ie[0],we],Q,X);return}const de=Array.isArray(ie)?ie.join("."):ie;if(d.current.hasCircularDependency(de)){const fe=d.current.getCurrentPath();console.log("检测到公式计算中的循环依赖链路: ".concat([...fe,de].join(" -> ")));return}try{let fe=[];if(J!=null&&J.withData&&(J==null?void 0:J.withData.length)>0&&se&&typeof se=="function")for(let Pe=0;Pe<(J==null?void 0:J.withData.length);Pe++){const Se=J==null?void 0:J.withData[Pe];let Ie={};Ie.tableName=Se.withTable.table_name,Ie.filter={};for(let qe=0;qe<Se.withCondition.length;qe++){var pe;const{value:_e,column:nt}=Se.withCondition[qe];let ze=M(_e.group_key,_e.field_key,H,fe);if(Array.isArray(ze)&&Array.isArray(ie)&&ze.length>ve&&(ze=ze[ve]),ze&&typeof ze=="string")try{ze=JSON.parse(ze)}catch{}(pe=ze)!==null&&pe!==void 0&&pe.value&&(ze=ze.value),Ie.filter[nt.column_name]=ze}const Ge=await se(Ie);Ge.code===0&&Ge.data.list&&fe.push({id:Se.id,data:Ge.data.list})}let we;if(J.value&&J.value.length>0&&(we=J.value.map(Pe=>{let Se="";const{insert:Ie,attributes:Ge}=Pe;return typeof Ie!="string"?Ie!=null&&Ie.span&&Ge&&Ge.tagKey&&Ge.id&&(Se=M(Ge.tagKey,Ge.id,H,fe),Array.isArray(Se)?(Array.isArray(ie)&&Se.length>ve&&(Se=Se[ve]),typeof Se=="object"&&Se!==null&&(Se=JSON.stringify(Se))):typeof Se=="object"&&Se!==null?Se=JSON.stringify(Se):Se.length>0&&(Se='"'.concat(Se,'"'))):Se=Ie,Se})),we&&we.length>0){const Pe=Vre(we);console.log("".concat(ie," 计算公式:"),we),console.log("".concat(ie," 计算结果:"),Pe),i.setFieldValue(ie,Pe),await S(ie,i.getFieldsValue(),!1,de)}}finally{}},M=(H,K,q,Q)=>{let X="";if(H=="fieldsValue"){var Y;if(K.indexOf(".")>=0){var ne;const[se,ve]=K.split("."),be=(q==null?void 0:q[se])||[];Array.isArray(be)?X=be.map(ie=>{var de;return(de=ie==null?void 0:ie[ve])!==null&&de!==void 0?de:""}):X=(ne=be==null?void 0:be[ve])!==null&&ne!==void 0?ne:""}else X=(Y=q==null?void 0:q[K])!==null&&Y!==void 0?Y:""}else{let se=Q.find(ve=>ve.id===H);if(se&&se.data&&se.data.length>0){var re,J;X=(re=(J=se.data[0])===null||J===void 0?void 0:J[K])!==null&&re!==void 0?re:""}}return X},R=Z.useRef({});Z.useRef({});const F=Z.useRef(null),B=Z.useCallback(()=>{F.current&&clearTimeout(F.current);const H=f.current===1?500:100;F.current=setTimeout(async()=>{d.current.startNewCycle();const K={...R.current};R.current={};const q=i.getFieldsValue(),Q=f.current;f.current=0;let X=!1;m.current||(m.current={});const Y=new Set;for(let ne in K)try{let re=K[ne];if(!sh.isEqual(re.value||"",y(re.name)||"")){if(Q!=1){const J=Array.isArray(re.name)?re.name.map(ve=>typeof ve=="string"?ve:ve.toString()).join("."):re.name;if(Y.has(J)){console.log("跳过已处理的字段 processedFields",J);continue}Y.add(J);let se=await S(re.name,q,!1,J);X=X||se}m.current[p(re.name)]=re.value}}catch(re){console.log("debounceHandleFieldsChange error",re)}X&&(console.log("needRefresh",X),c())},H)},[]),k=Z.useCallback(H=>{},[]),z=Z.useCallback((H,K)=>{console.log("handleValuesChange changedValues",JSON.stringify(H));const q=function(X){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const ne=[];for(let re in X){const J=X[re],se=[...Y,re];Array.isArray(J)?J.forEach((ve,be)=>{if(typeof ve=="object"&&ve!==null){const ie=q(ve,[...se,be]);ne.push(...ie)}else ne.push({touched:!0,validating:!1,errors:[],warnings:[],name:[...se,be],validated:!1,value:ve})}):ne.push({touched:!0,validating:!1,errors:[],warnings:[],name:se,validated:!1,value:J})}return ne},Q=q(H);console.log("handleValuesChange converted to fields format",JSON.stringify(Q)),Q.length>0&&(Q.forEach(X=>{X.name&&X.name.length>0&&(R.current[X.name]=X)}),console.log("handleValuesChange changedFieldsState",JSON.parse(JSON.stringify(R.current))),B())},[]),V=H=>{let K=[];return H.forEach(q=>{if(!u.current.has(q))return;let Q=u.current.get(q);Q.withIds.length<=0||K.push(...Q.withIds.filter(X=>!K.includes(X)))}),K=K.filter(q=>{var Q=i.getFieldValue(q);return!(typeof Q!="number"&&!Q)}),K},_=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,q=V(H);const Q=i.getFieldsValue();setTimeout(async()=>{for(let X=0;X<q.length;X++){const Y=q[X];await S(Y,Q,!1,null,K)}},0)},P=async H=>{const K=i.getFieldsValue();setTimeout(async()=>{for(let q=0;q<H.length;q++){const Q=H[q];await S(Q,K)}},0)},L=Z.useRef({}),j=H=>u.current&&u.current.has(H)?u.current.get(H):null,W=()=>(console.log("memoizedRenderChildren",u.current),u.current?G():null),G=()=>{console.log("renderChildren");const H=Dl(),K=Z.Children.toArray(r);return console.log("childrenArray",K),nHt(K,n,u.current).map((Q,X)=>He.jsx(KN,{gutter:[24,24],children:Q.map((Y,ne)=>{var re,J;const{componentId:se,__id:ve,_componentName:be,...ie}=Y.props,de=((re=Y.type)===null||re===void 0?void 0:re.displayName)||be,pe=se||ve;pe in L.current||(L.current[pe]=Dl());const fe=de&&de.startsWith("Layout."),we=de&&de=="Field.Table",Pe=!u.current.has(pe)||((J=u.current.get(pe))===null||J===void 0?void 0:J.show),Se=(ie.calcHidden||!Pe)&&o!="desgin",Ie=[];if(ie.isRequired&&Ie.push({required:!0,message:"".concat(ie.label,"必须填写")}),ie.rules)if(Array.isArray(ie.rules)){const _e=ie.rules.join("|");Ie.push({pattern:new RegExp(_e),message:ie.rulesFailMessage?ie.rulesFailMessage:"".concat(ie.label,"格式错误")})}else Ie.push({pattern:new RegExp(ie.rules),message:ie.rulesFailMessage?ie.rulesFailMessage:"".concat(ie.label,"格式错误")});const Ge=_e=>{i.setFieldValue(pe,_e)};let qe;return we||fe?qe=Z.cloneElement(Y,{onTableAddRow:_,getTableWithIds:V,onTableRemoveRow:P,removeLastFieldsValues:w,form:i,fieldName:pe,onCustomChange:Ge,initializeFormRender:g,mode:o,recordFieldsChange:x,getDependencyMapItem:j,renderKey:H}):de==="Field.WithSingleSelect"||de==="Field.WithMultipleSelect"||de==="Show.WithTable"?qe=He.jsx(bi.Item,{hidden:Se,style:{margin:0},shouldUpdate:(_e,nt)=>{let ze=!1;if(Array.isArray(ie.filterRules)&&ie.filterRules.length>0)for(let ft of ie.filterRules){if(ft.valueType!="variable")continue;let Ue,Le;if(Ue=_e==null?void 0:_e[ft.value.field_key],Le=nt==null?void 0:nt[ft.value.field_key],Ue!==Le){ze=!0;break}}return ze&&(L.current[pe]=Dl(),console.log(pe,Dl())),ze},children:_e=>{let{getFieldsValue:nt}=_e;const ze=nt();let ft=Z.cloneElement(Y,{onTableAddRow:_,onTableRemoveRow:P,removeLastFieldsValues:w,form:i,fieldName:pe,onCustomChange:Ge,fieldsValue:ze,initializeFormRender:g,recordFieldsChange:x,shouldUpdateKey:L.current[pe]});return de==="show.WithTable"?He.jsx(He.Fragment,{children:ft}):He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:pe,rules:Pe?Ie:[],children:ft})}}):qe=He.jsx(bi.Item,{hidden:Se,style:{marginBottom:0},label:"",name:pe,rules:Pe?Ie:[],children:Z.cloneElement(Y,{form:i,fieldName:pe,onCustomChange:Ge,initializeFormRender:g,recordFieldsChange:x,removeLastFieldsValues:w})}),He.jsx(nA,{span:Se?0:fe?24:24/n,style:{marginBottom:0},children:qe},pe||"col-".concat(ne))})},"row-".concat(X)))};return He.jsx(Ad,{theme:{components:{Table:{rowHoverBg:"#ebebeb"}},token:{colorBgContainerDisabled:"rgba(0, 0, 0, 0.02)",colorTextDisabled:"#333"}},children:He.jsxs(bi,{form:i,className:"form-container fp-0 fw-full fh-full box-border fflex fflex-col "+(o=="desgin"?" fp-6":""),onFieldsChange:k,onValuesChange:z,children:[He.jsx(bi.Item,{name:"__id",hidden:!0,children:He.jsx("input",{type:"hidden"})}),s]})})});function rHt(e){return Z.forwardRef((t,n)=>He.jsx(e,{...t,ref:n,forwardedRef:n}))}class Clr extends Z.PureComponent{render(){const{forwardedRef:t,...n}=this.props;return He.jsx(vpe,{...n,ref:t})}}const oHt=rHt(e=>{let{forwardedRef:t,...n}=e;return He.jsx(vpe,{...n,ref:t})});function iHt(e,t,n){const r=[];let o=[];const i=(a,s)=>{for(;s.length<a;)s.push(He.jsx("div",{},Dl()))};return e.forEach(a=>{var s,l;const u=((s=a.type)===null||s===void 0?void 0:s.displayName)||((l=a.props)===null||l===void 0?void 0:l._componentName);u&&u.startsWith("Layout.")?(o.length>0&&(i(t,o),r.push(o),o=[]),r.push([a])):(o.push(a),o.filter(f=>{var d,h,g,m;const p=((d=f.props)===null||d===void 0?void 0:d.componentId)||((h=f.props)===null||h===void 0?void 0:h.__id);return(!(n!=null&&n.has(p))||((g=n.get(p))===null||g===void 0?void 0:g.show))&&!((m=f.props)!==null&&m!==void 0&&m.calcHidden)}).length===t&&(r.push(o),o=[]))}),o.length>0&&(i(t,o),r.push(o)),r}const aHt=e=>{const t=new Map,n=[],r=function(o){var i,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const l=((i=o.type)===null||i===void 0?void 0:i.displayName)||((a=o.props)===null||a===void 0?void 0:a._componentName),{props:u}=o;if(l&&(l.startsWith("Field.")||l.startsWith("Layout."))){let c=(u==null?void 0:u.componentId)||(u==null?void 0:u.__id);s&&(c="".concat(s,".").concat(c));const f=u.withId?[u.withId]:u.withIds?[...u.withIds]:[];n.push({identifier:c,withIds:f,compName:l,fillRules:u==null?void 0:u.fillRules,visibleFunc:u==null?void 0:u.withVisibleFunc})}u!=null&&u.children&&Z.Children.forEach(u.children,c=>{r(c,l&&l.startsWith("Field.")?(u==null?void 0:u.componentId)||(u==null?void 0:u.__id):"")})};return Z.Children.forEach(e,o=>r(o)),n.forEach(o=>{t.set(o.identifier,{...o,show:!0,children:n.filter(i=>i.withIds.includes(o.identifier))})}),t},sHt=function(e,t,n){if(!t.has(e))return!1;const r=t.get(e);if(r.visibleFunc&&typeof r.visibleFunc=="function"){const o=r.visibleFunc(n);if(r.show!==o)return r.show=o,!0}if(r.fillRules&&Array.isArray(r.fillRules)&&r.fillRules.length>0){const o=r.fillRules.map(a=>typeof a=="string"?a:""),i=Vre(o)==="true";if(r.show!==i)return r.show=i,!0}return!1},lHt=Z.forwardRef((e,t)=>{let{cols:n=1,children:r,mode:o="view"}=e;const[i]=bi.useForm(),[a,s]=Z.useState(null),l=Z.useRef(new Map),u=Z.useRef({}),c=Z.useRef({}),f=Z.useCallback(()=>{l.current=aHt(r)},[r]),d=Z.useCallback(()=>{const p=i.getFieldsValue();let y=!1;l.current.forEach((v,b)=>{const E=sHt(b,l.current,p);y=y||E}),y&&s(m())},[i]),h=Z.useCallback(sh.debounce(()=>{const p=i.getFieldsValue();Object.keys(c.current).forEach(y=>{c.current[y]!==p[y]&&(u.current[y]=p[y])}),c.current={},d()},200),[i,d]),g=function(){for(var p=arguments.length,y=new Array(p),v=0;v<p;v++)y[v]=arguments[v];let[,b]=y;Object.assign(c.current,b),h()},m=Z.useCallback(()=>{const p=Z.Children.toArray(r);return iHt(p,n,l.current).map((v,b)=>He.jsx(KN,{gutter:[24,24],children:v.map((E,S)=>{var w,C;const{componentId:x,__id:D,_componentName:T,calcHidden:O,...N}=E.props,M=((w=E.type)===null||w===void 0?void 0:w.displayName)||T,R=x||D,F=Dl(),B=M&&M.startsWith("Layout."),k=!l.current.has(R)||((C=l.current.get(R))===null||C===void 0?void 0:C.show),z=(O||!k)&&o!=="desgin",V=[];if(N.isRequired&&V.push({required:!0,message:"".concat(N.label,"必须填写")}),N.rules){const P=Array.isArray(N.rules)&&N.rules.length>0?N.rules.join("|"):N.rules;V.push({pattern:new RegExp(P),message:N.rulesFailMessage||"".concat(N.label,"格式错误")})}let _=null;return B?_=Z.cloneElement(E,{form:i,fieldName:R,updateKey:F}):_=He.jsx(bi.Item,{hidden:z,label:N.label||"",name:R,rules:k?V:[],children:Z.cloneElement(E,{form:i,fieldName:R,updateKey:F})}),He.jsx(nA,{span:z?0:B?24:24/n,children:_},R||"col-".concat(S))})},"row-".concat(b)))},[r,n,i,o]);return Z.useEffect(()=>{f(),s(m())},[f,m]),Z.useImperativeHandle(t,()=>({formRef:i,setFieldsValue:p=>{i.setFieldsValue(p),h()},refreshDependencies:()=>{f(),d()}})),He.jsxs(bi,{form:i,className:"form-container fp-0 fw-full fh-full box-border fflex fflex-col fgap-y-2".concat(o==="desgin"?" fp-6":""),onValuesChange:g,children:[He.jsx(bi.Item,{name:"__id",hidden:!0,children:He.jsx("input",{type:"hidden"})}),a]})}),uHt=e=>{let{request:t,value:n,onChange:r,callError:o,disabledValue:i,addRoot:a=!0,title:s,...l}=e;const[u,c]=Z.useState(!1),[f,d]=Z.useState([]);Z.useEffect(()=>{h()},[]),Z.useEffect(()=>{if(typeof n=="string")try{n=JSON.parse(n),r(n)}catch{}Array.isArray(n)&&y(n)},[n]);const h=async()=>{if(t&&typeof t=="function"){var D;const T=await t();if(T.code>0){o&&typeof o=="function"&&o(T.message);return}let O=jZe(((D=T.data)===null||D===void 0?void 0:D.list)||T.data||[],"id",s||"title",(l==null?void 0:l.parentId)||"parentId","children",0,i);a&&(O=[{value:0,title:"根节点",children:O}]),l.treeData=O,console.log("treeData",O),d(O)}l.treeData&&d(l.treeData),c(!0)},[g,m]=Z.useState([]),[p,y]=Z.useState([]),[v,b]=Z.useState([]),[E,S]=Z.useState(!0),w=D=>{console.log("onExpand",D),m(D),S(!1)},C=D=>{console.log("onCheck",D),y(D),r(D)},x=(D,T)=>{console.log("onSelect",T),b(D)};return He.jsx(Bi,{...l,children:He.jsx(npe,{checkable:!0,onExpand:w,onCheck:C,onSelect:x,expandedKeys:g,autoExpandParent:E,checkedKeys:p,selectedKeys:v,treeData:f})})},cHt=e=>He.jsx(Bi,{...e,children:He.jsx(WN,{...e})}),fHt=e=>He.jsx(Bi,{...e,children:He.jsx(WN.Group,{...e})}),dHt=e=>He.jsx(Bi,{...e,children:He.jsx(p_.Group,{...e})}),SJe=e=>{let{value:t,maxCount:n,multiple:r,onChange:o,...i}=e;Z.useEffect(()=>{if(t){if(typeof t=="string")try{t=JSON.parse(t),o(t)}catch{}console.log("value",t),Array.isArray(t)&&s(t)}},[t]),n=n||99,r=r||!0;const[a,s]=Z.useState([]),l=u=>{let{fileList:c}=u;console.log("newFileList",c),c=c.map(f=>(f.status=="done"&&f.response&&(f.url=f.response),f)),o(c.map(f=>({uid:f.uid,name:f.name,status:f.status,url:f.url||f.response||"",error:f.error}))),s(c)};return He.jsx(O_,{...i,listType:"text",multiple:r,onChange:l,maxCount:n,fileList:a,children:!(i!=null&&i.disabled)&&!(i!=null&&i.readonly)&&a.length<n&&He.jsx(fu,{type:(i==null?void 0:i.type)||"default",icon:(i==null?void 0:i.icon)||He.jsx(kZe,{}),children:"点击上传文件"})})};SJe.displayName="UploadFile";const hHt=e=>He.jsx(Bi,{...e,children:He.jsx(SJe,{...e})}),wJe=e=>{let{maxCount:t,value:n,multiple:r,onChange:o,...i}=e;Z.useEffect(()=>{if(n){if(console.log("value",n),typeof n=="string")try{n=JSON.parse(n),o(n)}catch{}let S=[];if(Array.isArray(n))for(let w=0;w<n.length;w++){let C=n[w];var E=g.current.find(x=>x.uid===C.uid);!E||(E.version||0)<(C.version||0)?S.push(C):S.push(E)}s(S)}},[n]),t=t||99,r=r||!0;const[a,s]=Z.useState([]),[l,u]=Z.useState(""),[c,f]=Z.useState(0),[d,h]=Z.useState(!1),g=Z.useRef([]),m=E=>new Promise((S,w)=>{const C=new FileReader;C.readAsDataURL(E),C.onload=()=>S(C.result),C.onerror=x=>w(x)}),p=async(E,S)=>{!E.url&&!E.preview&&(E.preview=await m(E.originFileObj)),u(E.url||E.preview),f(S),h(!0)},y=async(E,S)=>{i!=null&&i.disabled||s(a.filter((w,C)=>C!==S))},v=He.jsx(He.Fragment,{children:He.jsxs("div",{className:"fw-full fh-full fflex fflex-col fitems-center fjustify-center fborder fborder-dashed fcursor-pointer frounded",children:[He.jsx(BZe,{}),He.jsx("div",{className:"fmt-2",children:"点击上传"})]})}),b=E=>{let{fileList:S}=E,w=[];for(let D=0;D<S.length;D++){var C=S[D];C.version=new Date().getTime();var x=g.current.find(T=>T.uid===C.uid);console.log("oldfile",JSON.parse(JSON.stringify(x||{}))),x&&x.status!="uploading"?w.push(x):(C.status=="done"&&C.response&&(C.url=C.response),w.push(C))}g.current=w,s(w),o(w.map(D=>({uid:D.uid,name:D.name,status:D.status,url:D.url||D.response||"",error:D.error,version:D.version||0})))};return He.jsxs(He.Fragment,{children:[He.jsx("div",{className:"fflex fgap-3 fflex-wrap",children:He.jsx(O_,{...i,itemRender:(E,S,w)=>{console.log("file",S);let C=w.findIndex(x=>x.uid===S.uid);return He.jsx(He.Fragment,{children:He.jsxs("div",{className:"fgroup fw-full fh-full fbg-transparent fborder frounded fflex fitems-center fjustify-center foverflow-hidden fcursor-pointer frelative"+(S.status=="error"?" fborder-red-500":""),children:[He.jsxs("div",{className:" fhidden fabsolute fw-full fh-full fbg-gray-900 fbg-opacity-50 fitems-center fjustify-center fz-10 group-hover:fflex ftext-white ftext-lg fgap-2",children:[S.status=="done"&&He.jsx(LZe,{onClick:()=>{p(S,C)},className:"hover:ftext-gray-200"}),!(i!=null&&i.disabled)&&!(i!=null&&i.readonly)&&He.jsx(lpe,{onClick:()=>{y(S,C)},className:"hover:ftext-gray-200"})]}),S.status=="uploading"&&He.jsx("div",{className:" fw-full fh-full fflex fitems-center fjustify-center fabsolute ftop-0 fleft-0 ",children:He.jsx(xT,{})}),He.jsx("img",{src:S.url||S.thumbUrl,alt:"Example Image",className:"fmax-w-full fmax-h-full fobject-contain "})]},"file-".concat(S.uid))})},listType:"picture-card",fileList:a,multiple:r,onPreview:p,onChange:b,maxCount:t,children:a.length>=t||i!=null&&i.disabled||i!=null&&i.readonly?null:v})}),l&&He.jsx(K9.PreviewGroup,{preview:{visible:d,current:c,onVisibleChange:E=>h(E),onChange:E=>{f(E)}},children:a.map((E,S)=>He.jsx(He.Fragment,{children:He.jsx(K9,{wrapperStyle:{display:"none"},src:E.url})}))})]})};wJe.displayName="UploadImage";const pHt=e=>He.jsx(Bi,{...e,children:He.jsx(wJe,{...e})}),vHt=e=>{let{value:t,onChange:n,form:r,fieldName:o,...i}=e,a=!1;return typeof t=="boolean"?a=t:typeof t=="string"?a=t=="1"||t=="true":typeof t=="number"&&(a=t==1),t!==a&&(r==null||r.setFieldValue(o,a)),He.jsx(Bi,{...i,children:He.jsx(Xhe,{...i,onChange:n,value:t})})};var gHt={exports:{}};(function(e,t){(function(n,r){e.exports=r(wYe)})(Er,function(n){function r(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var o=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(a,s){return s==="W"?a+"周":a+"日"},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(a,s){var l=100*a+s;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return o.default.locale(i,null,!0),i})})(gHt);var mHt={locale:"zh_CN",yearFormat:"YYYY年",cellDateFormat:"D",cellMeridiemFormat:"A",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"};const yHt={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},CJe={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},mHt),timePickerLocale:Object.assign({},yHt)};CJe.lang.ok="确定";var xJe={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Er,function(){return function(n,r,o){o.updateLocale=function(i,a){var s=o.Ls[i];if(s)return(a?Object.keys(a):[]).forEach(function(l){s[l]=a[l]}),s}}})})(xJe);var bHt=xJe.exports;const EHt=Ws(bHt);Ra.extend(EHt);Ra.extend(TYe);Ra.updateLocale("zh-cn",{weekStart:0});const SHt=e=>{let{datetype:t,value:n,defaultNow:r,onChange:o,...i}=e;t=t||"date";const[a,s]=Z.useState(i==null?void 0:i.picker),[l,u]=Z.useState(i==null?void 0:i.format),[c,f]=Z.useState(!1),[d,h]=Z.useState(!1),g=Z.useRef(!1);Z.useEffect(()=>{if(r&&!n){const p=Ra().format("YYYY-MM-DD HH:mm:ss");typeof o=="function"&&o(p);return}},[]);const m=(p,y)=>{g.current=!0,o(y)};return Z.useEffect(()=>{switch(s("date"),f(!1),t){case"date":s("date"),u("YYYY-MM-DD"),h(!1);break;case"datetime":f(!0),s("datetime"),u("YYYY-MM-DD HH:mm:ss"),h(!0);break;case"month":s("month"),h(!1);break;case"year":s("year"),h(!1);break}},[t]),He.jsx(Bi,{...i,children:He.jsx(rA,{locale:CJe,...i,picker:a,format:l,style:{width:"100%"},onChange:m,value:n&&Ra(n).isValid()?Ra(n):void 0,showTime:c,needConfirm:d})})};var gpe={exports:{}},JN={},F_={exports:{}},AJe={},Ure={exports:{}},sP={exports:{}},Io={};/** @license React v16.13.1
430
+ `),t=new Function("Decimal",n)(ZN),typeof t=="object"&&t!==null||(t=t.toString())}catch(r){console.error("formula (".concat(n,") error"),r)}return t},{primitive:!0,max:1e3,maxAge:1e3*60*1}),Z_t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Dl=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=Z_t[n[e]&63];return t};var bJe={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function i(l,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new o(c,f||l,d),g=n?n+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],h]:l._events[g].push(h):(l._events[g]=h,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)t.call(c,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=n?n+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,h=f.length,g=new Array(h);d<h;d++)g[d]=f[d].fn;return g},s.prototype.listenerCount=function(u){var c=n?n+u:u,f=this._events[c];return f?f.fn?1:f.length:0},s.prototype.emit=function(u,c,f,d,h,g){var m=n?n+u:u;if(!this._events[m])return!1;var p=this._events[m],y=arguments.length,v,b;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,f),!0;case 4:return p.fn.call(p.context,c,f,d),!0;case 5:return p.fn.call(p.context,c,f,d,h),!0;case 6:return p.fn.call(p.context,c,f,d,h,g),!0}for(b=1,v=new Array(y-1);b<y;b++)v[b-1]=arguments[b];p.fn.apply(p.context,v)}else{var E=p.length,S;for(b=0;b<E;b++)switch(p[b].once&&this.removeListener(u,p[b].fn,void 0,!0),y){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,f);break;case 4:p[b].fn.call(p[b].context,c,f,d);break;default:if(!v)for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];p[b].fn.apply(p[b].context,v)}}return!0},s.prototype.on=function(u,c,f){return i(this,u,c,f,!1)},s.prototype.once=function(u,c,f){return i(this,u,c,f,!0)},s.prototype.removeListener=function(u,c,f,d){var h=n?n+u:u;if(!this._events[h])return this;if(!c)return a(this,h),this;var g=this._events[h];if(g.fn)g.fn===c&&(!d||g.once)&&(!f||g.context===f)&&a(this,h);else{for(var m=0,p=[],y=g.length;m<y;m++)(g[m].fn!==c||d&&!g[m].once||f&&g[m].context!==f)&&p.push(g[m]);p.length?this._events[h]=p.length===1?p[0]:p:a(this,h)}return this},s.prototype.removeAllListeners=function(u){var c;return u?(c=n?n+u:u,this._events[c]&&a(this,c)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})(bJe);var J_t=bJe.exports;const EJe=Ws(J_t),o3=new EJe,eHt=e=>{let{children:t,layout:n,onTableAddRow:r,onTableRemoveRow:o,form:i,initializeFormRender:a,recordFieldsChange:s,mode:l,getTableWithIds:u,removeLastFieldsValues:c,getDependencyMapItem:f,renderKey:d}=e;n=n||"1";const h=v=>{const b=v.split(",").map(Number),E=24;return b.map(S=>S/b.reduce((w,C)=>w+C)*E)},g=Z.useMemo(()=>h(n),[n]),m=v=>{if(typeof f=="function"){const b=f(v);if(b)return b==null?void 0:b.show}return!0},p=Z.useRef({}),y=Z.useMemo(()=>Z.Children.toArray(t).map((v,b)=>{var E,S;const w=v.props,C=(w==null?void 0:w.componentId)||(w==null?void 0:w.__id),x=C;var D=((E=v.type)===null||E===void 0?void 0:E.displayName)||((S=v.props)===null||S===void 0?void 0:S._componentName);x in p.current||(p.current[x]=Dl());const T=((w==null?void 0:w.calcHidden)||!m(x))&&l!="desgin",O=[];if(w!=null&&w.isRequired&&O.push({required:!0,message:"".concat(w.label,"必须填写")}),w!=null&&w.rules)if(Array.isArray(w.rules)){const R=w.rules.join("|");O.push({pattern:new RegExp(R),message:w.rulesFailMessage?w.rulesFailMessage:"".concat(w.label,"格式错误")})}else O.push({pattern:new RegExp(w.rules),message:w.rulesFailMessage?w.rulesFailMessage:"".concat(w.label,"格式错误")});const N=R=>{i.setFieldValue(x,R)};let M=null;return D=="Field.Table"?M=Z.cloneElement(v,{onTableAddRow:r,onTableRemoveRow:o,form:i,fieldName:C,initializeFormRender:a,mode:l,recordFieldsChange:s,getTableWithIds:u,removeLastFieldsValues:c,getDependencyMapItem:f,renderKey:d}):D==="Field.WithSingleSelect"||D==="Field.WithMultipleSelect"||D==="Show.WithTable"?M=He.jsx(bi.Item,{hidden:T,style:{margin:0},shouldUpdate:(R,F)=>{let B=!1;if(Array.isArray(w.filterRules)&&w.filterRules.length>0)for(let k of w.filterRules){if(k.valueType!="variable")continue;let z,V;if(z=R==null?void 0:R[k.value.field_key],V=F==null?void 0:F[k.value.field_key],z!==V){B=!0;break}}return B&&(p.current[x]=Dl()),B},children:R=>{let{getFieldsValue:F}=R;const B=F();let k=Z.cloneElement(v,{onTableAddRow:r,onTableRemoveRow:o,form:i,fieldName:x,onCustomChange:N,fieldsValue:B,initializeFormRender:a,recordFieldsChange:s,getTableWithIds:u,removeLastFieldsValues:c,shouldUpdateKey:p.current[x]});return D==="Show.WithTable"?He.jsx(He.Fragment,{children:k}):He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:x,rules:O,children:k})}}):Z.isValidElement(v)?M=He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:C,rules:O,hidden:T,children:Z.cloneElement(v,{form:i,fieldName:C,initializeFormRender:a,recordFieldsChange:s})},"".concat(C,"-form-item")):M=v,(g==null?void 0:g[b])&&He.jsx(nA,{span:g[b],children:M},b)}),[t,g,d]);return He.jsx(KN,{gutter:24,children:y})},tHt=e=>{let{title:t}=e;return t?He.jsx("div",{className:"fh-11 fflex fitems-center ftext-lg ffont-medium ",children:He.jsx("span",{className:"fborder-l-4 fborder-slate-300 fpl-2 ",children:t})}):null};function nHt(e,t,n){const r=[];let o=[];const i=(s,l)=>{const u=s-l.length;u>0&&l.push(...new Array(u).fill(Z.createElement("div")))};for(const s of e){var a;const{_componentName:l}=(s==null?void 0:s.props)||{},u=((a=s.type)===null||a===void 0?void 0:a.displayName)||l;u&&u.startsWith("Layout.")?(o.length>0&&(i(t,o),r.push(o),o=[]),r.push([s])):(o.push(s),o.filter(f=>{var d,h,g,m;const p=((d=f.props)===null||d===void 0?void 0:d.componentId)||((h=f.props)===null||h===void 0?void 0:h.__id);return(!n.has(p)||((g=n.get(p))===null||g===void 0?void 0:g.show))&&!(f!=null&&(m=f.props)!==null&&m!==void 0&&m.calcHidden)}).length===t&&(r.push(o),o=[]))}return o.length>0&&(i(t,o),r.push(o)),r}const vpe=Z.forwardRef((e,t)=>{let{cols:n=1,children:r,mode:o="view"}=e;const[i]=bi.useForm(),a=Z.useRef(null),[s,l]=Z.useState(null),u=Z.useRef(null),c=()=>{const H=W();sh.isEqual(a.current,H)||(a.current=H,l(H))},f=Z.useRef(0),d=Z.useRef({currentCycleId:0,updatePath:[],MAX_DEPTH:30,startNewCycle:function(){return this.currentCycleId++,this.updatePath=[],this.currentCycleId},addToPath:function(H){if(this.updatePath.length>=this.MAX_DEPTH){console.warn("依赖路径深度超过限制(".concat(this.MAX_DEPTH,"),可能存在过深嵌套"));return}H&&this.updatePath.push(H)},hasCircularDependency:function(H){return H?this.updatePath.includes(H):!1},getCurrentPath:function(){return[...this.updatePath]},finishField:function(){this.updatePath.length>0&&this.updatePath.pop()}});Z.useImperativeHandle(t,()=>({formRef:i,setFieldsValue:H=>{f.current=1;let K={...H,__id:H==null?void 0:H.id};for(let q in H)if(R.current[q]={name:q,value:H[q]},u.current.has(q)&&u.current.get(q).componentName=="Field.Table"&&Array.isArray(H[q]))for(let Q=0;Q<H[q].length;Q++){const X=H[q][Q];for(let Y in X)R.current[[q,Q,Y]]={name:[q,Q,Y],value:X[Y]}}i.setFieldsValue(K),B()},initializeFieldVisibility:H=>{E(H)}}),[]);const h=Z.useCallback(sh.throttle(async()=>{await v(),console.log("initializeDependencyMap"),requestAnimationFrame(()=>{c()})},300),[r,n]);Z.useEffect(()=>(console.log("UseEffect throttledInitializeFormRender"),h(),()=>{h.cancel()}),[r,n]);const g=()=>{h()},m=Z.useRef(null),p=H=>Array.isArray(H)?H.map(K=>typeof K=="string"?K:K.toString()).join("."):H,y=H=>{var K;return(K=m.current)===null||K===void 0?void 0:K[p(H)]},v=async()=>{const H=[];function K(Q){var X,Y;let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;var re=((X=Q.type)===null||X===void 0?void 0:X.displayName)||((Y=Q.props)===null||Y===void 0?void 0:Y._componentName);const{props:J}=Q;if(re&&(re.startsWith("Field.")||re.startsWith("Layout."))){let be=(J==null?void 0:J.componentId)||(J==null?void 0:J.__id),ie=[];if(ne&&ne!==null&&ne!==void 0&&ne.props){var se,ve;be="".concat((ne==null||(se=ne.props)===null||se===void 0?void 0:se.componentId)||(ne==null||(ve=ne.props)===null||ve===void 0?void 0:ve.__id),".").concat(be)}J!=null&&J.withId&&ie.push(J==null?void 0:J.withId),J!=null&&J.withIds&&(ie=[...ie,...J==null?void 0:J.withIds]),H.push({identifier:be,withIds:ie,component:Q,componentName:re,fillRules:J==null?void 0:J.fillRules})}J!=null&&J.children&&Z.Children.toArray(J==null?void 0:J.children).forEach(ie=>K(ie,re&&re.startsWith("Field.")?Q:null))}u.current=new Map,console.log(" fields",H);const q=Z.Children.toArray(r);for(let Q=0;Q<q.length;Q++){const X=q[Q];K(X)}H.forEach(Q=>{const{identifier:X}=Q;u.current.set(X,{children:H.filter(Y=>Y.withIds.some(ne=>ne==X)),show:!0,...Q})}),await b()},b=async function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;console.log("initializeFieldVisibility *************************************");const K=i.getFieldsValue();await Promise.all(Array.from(u.current.keys()).map(async q=>{await S(q,K,!0)})),H&&c()},E=sh.debounce(async function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;await b(H)},100),S=async function(H,K){let q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,X=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;if(o=="desgin")return console.log("设计模式下不进行字段级联计算"),!1;console.log("handleFieldsWith identifier",H);let Y=!1,ne=[];Array.isArray(H)&&(ne=[...H.slice(0,-1)],H=H.filter(J=>typeof J=="string").join("."));const re=Q||H;if(d.current.hasCircularDependency(re)){const J=d.current.getCurrentPath();return console.log("检测到循环依赖链路: ".concat([...J,re].join(" -> "))),!1}d.current.addToPath(re);try{if(console.log("dependencyMap.current",u.current),console.log("dependencyMap.current identifier",H),console.log("dependencyMap.current targetRowIndex",X),u.current.has(H)){const J=u.current.get(H),se=J.children;!q&&J!==null&&J!==void 0&&J.fillRules&&Array.isArray(J==null?void 0:J.fillRules)&&(J==null?void 0:J.fillRules.length)>0&&D(H,ne,K,J==null?void 0:J.fillRules);for(let ve=0;ve<se.length;ve++){const be=se[ve];if(be.component.props.withVisibleFunc&&typeof be.component.props.withVisibleFunc=="function"){let ie=T(K,be,ne);Y=Y||ie}if(be.component.props.withVisible){let ie=await O(K,be,ne,J==null?void 0:J.componentName);Y=Y||ie}!q&&be.component.props.withFill&&await N(K,be,ne,J==null?void 0:J.componentName,re,X)}}}finally{d.current.finishField()}return Y},w=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(m.current)if(K){const q=Object.keys(m.current);for(let Q=0;Q<q.length;Q++){const X=q[Q];X.includes("".concat(H,","))&&delete m.current[p(X)]}}else delete m.current[p(H)]},C=(H,K)=>{R.current||(R.current={}),R.current[H]=K},x=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;console.log("recordFieldsChange",H,K);var q=Object.keys(H);q.length>0&&(q.forEach(Q=>{C(Q,H[Q])}),K&&B())},D=(H,K,q,Q)=>{let X=M("fieldsValue",H,q,null),Y={};Array.isArray(H)&&H.filter(be=>typeof be=="string").join(".");let ne=[];for(let be=0;be<Q.length;be++){const ie=Q[be];let{source:de,target:pe}=ie,fe=X==null?void 0:X[de],we=fe;if(Array.isArray(H)&&H.filter(Pe=>typeof Pe=="string").join("."),Array.isArray(pe)&&pe.filter(Pe=>typeof Pe=="string").join("."),(ie==null?void 0:ie.type)==1){if(u.current.has(pe)){var re,J,se;let Se=(re=u.current.get(pe))===null||re===void 0||(J=re.component)===null||J===void 0||(se=J.props)===null||se===void 0?void 0:se.children;Array.isArray(Se)&&Se.length>0&&ne.push(Se.map(Ie=>{var Ge,qe;return"".concat(de,".").concat((Ie==null||(Ge=Ie.props)===null||Ge===void 0?void 0:Ge.componentId)||(Ie==null||(qe=Ie.props)===null||qe===void 0?void 0:qe.__id))}))}if(fe&&typeof fe=="string")try{fe=JSON.parse(fe)}catch(Se){console.error("error end",Se)}if(!Array.isArray(fe))return;we=fe.map((Se,Ie)=>{let Ge={};if(ie!=null&&ie.subRules&&Array.isArray(ie==null?void 0:ie.subRules)&&(ie==null?void 0:ie.subRules.length)>0)for(let qe=0;qe<(ie==null?void 0:ie.subRules.length);qe++){const{source:_e,target:nt}=ie==null?void 0:ie.subRules[qe];Ge[nt]=Se==null?void 0:Se[_e];let ze={name:[pe,Ie,nt],value:Se==null?void 0:Se[_e]};Y[ze.name]=ze}return Ge}),w(pe,!0),o3.emit("reloadTable",pe)}else{let Pe=0;if(K&&Array.isArray(K)&&K.length>1&&(K.filter(Se=>typeof Se=="string").join("."),Pe=K[K.length-1],pe=[...K,pe],Array.isArray(X)&&X.length>Pe)){var ve;we=(ve=X[Pe])===null||ve===void 0?void 0:ve[de]}Y[pe]={name:Array.isArray(pe)?pe:[pe],value:we}}(ie==null?void 0:ie.type)==1&&(console.log("rule?.type == 1",pe),console.log("rule?.type == 1",we),console.log("rule?.type == 1 current_identifier",H),i.setFieldValue(pe,void 0)),console.log("form.setFieldValue(target, setValue) "+pe,we),i.setFieldValue(pe,we)}setTimeout(()=>{x(Y,!0),ne.length>0&&ne.forEach(be=>{Array.isArray(be)&&be.length>0&&_(be)})},0)},T=(H,K,q)=>{var Q,X;let Y=!1;const ne=K==null||(Q=K.component)===null||Q===void 0||(X=Q.props)===null||X===void 0?void 0:X.withVisibleFunc(H),re=K==null?void 0:K.identifier;if(u.current.has(re)){const J=u.current.get(re);J.show!==ne&&(J.show=ne,u.current.set(re,J),Y=!0)}return Y},O=async(H,K,q,Q)=>{var X,Y;let ne=!1;const re=K==null||(X=K.component)===null||X===void 0?void 0:X.props.withVisible,J=K==null||(Y=K.component)===null||Y===void 0?void 0:Y.props.withDataFetch;let se=0,ve=K.identifier,be=[];if(re!=null&&re.withData&&(re==null?void 0:re.withData.length)>0&&J&&typeof J=="function")for(let pe=0;pe<(re==null?void 0:re.withData.length);pe++){const fe=re==null?void 0:re.withData[pe];let we={};we.tableName=fe.withTable.table_name,we.filter={};for(let Se=0;Se<fe.withCondition.length;Se++){var ie;const{value:Ie,column:Ge}=fe.withCondition[Se];let qe=M(Ie.group_key,Ie.field_key,H,be);Array.isArray(qe)&&Array.isArray(ve)&&qe.length>se&&(qe=qe[se]),Q=="Field.WithSingleSelect"&&qe&&(ie=qe)!==null&&ie!==void 0&&ie.value&&(qe=qe.value),we.filter[Ge.column_name]=qe}const Pe=await J(we);Pe.code===0&&Pe.data.list&&be.push({id:fe.id,data:Pe.data.list})}let de;if(re.value&&re.value.length>0&&(de=re.value.map(pe=>{let fe="";const{insert:we,attributes:Pe}=pe;return typeof we!="string"?we!=null&&we.span&&Pe&&Pe.tagKey&&Pe.id&&(fe=M(Pe.tagKey,Pe.id,H,be),Array.isArray(fe)?(Array.isArray(ve)&&fe.length>se&&(fe=fe[se]),typeof fe=="object"&&fe!==null&&(fe=JSON.stringify(fe))):typeof fe=="object"&&fe!==null?fe=JSON.stringify(fe):fe.length>0&&(fe='"'.concat(fe,'"'))):fe=we,fe})),u.current.has(ve)){const pe=u.current.get(ve);if(de&&de.length>0){const fe=Vre(de)=="true";pe.show!=fe&&(pe.show=fe,u.current.set(ve,pe),ne=!0)}}return ne},N=async function(H,K,q,Q,X){var Y,ne;let re=arguments.length>5&&arguments[5]!==void 0?arguments[5]:-1;console.log("handleFieldsWithFill componentName",Q);const J=K==null||(Y=K.component)===null||Y===void 0?void 0:Y.props.withFill,se=K==null||(ne=K.component)===null||ne===void 0?void 0:ne.props.withDataFetch;let ve=0,be="",ie=K.identifier;if(q&&Array.isArray(q)&&q.length>1)be=q.filter(fe=>typeof fe=="string").join("."),ve=q[q.length-1],ie.startsWith("".concat(be,"."))&&(ie=[...q,ie.replace("".concat(be,"."),"")]);else if(ie.indexOf(".")>=0){ie=ie.split(".");let fe=M("fieldsValue",ie[0],H,[]);if(Array.isArray(fe)&&fe.length>0)if(typeof re=="number"&&re>=0)re<fe.length&&await N(H,K,[ie[0],re],Q,X);else for(let we=0;we<fe.length;we++)await N(H,K,[ie[0],we],Q,X);return}const de=Array.isArray(ie)?ie.join("."):ie;if(d.current.hasCircularDependency(de)){const fe=d.current.getCurrentPath();console.log("检测到公式计算中的循环依赖链路: ".concat([...fe,de].join(" -> ")));return}try{let fe=[];if(J!=null&&J.withData&&(J==null?void 0:J.withData.length)>0&&se&&typeof se=="function")for(let Pe=0;Pe<(J==null?void 0:J.withData.length);Pe++){const Se=J==null?void 0:J.withData[Pe];let Ie={};Ie.tableName=Se.withTable.table_name,Ie.filter={};for(let qe=0;qe<Se.withCondition.length;qe++){var pe;const{value:_e,column:nt}=Se.withCondition[qe];let ze=M(_e.group_key,_e.field_key,H,fe);if(Array.isArray(ze)&&Array.isArray(ie)&&ze.length>ve&&(ze=ze[ve]),ze&&typeof ze=="string")try{ze=JSON.parse(ze)}catch{}(pe=ze)!==null&&pe!==void 0&&pe.value&&(ze=ze.value),Ie.filter[nt.column_name]=ze}const Ge=await se(Ie);Ge.code===0&&Ge.data.list&&fe.push({id:Se.id,data:Ge.data.list})}let we;if(J.value&&J.value.length>0&&(we=J.value.map(Pe=>{let Se="";const{insert:Ie,attributes:Ge}=Pe;return typeof Ie!="string"?Ie!=null&&Ie.span&&Ge&&Ge.tagKey&&Ge.id&&(Se=M(Ge.tagKey,Ge.id,H,fe),Array.isArray(Se)?(Array.isArray(ie)&&Se.length>ve&&(Se=Se[ve]),typeof Se=="object"&&Se!==null&&(Se=JSON.stringify(Se))):typeof Se=="object"&&Se!==null?Se=JSON.stringify(Se):Se.length>0&&(Se='"'.concat(Se,'"'))):Se=Ie,Se})),we&&we.length>0){const Pe=Vre(we);console.log("".concat(ie," 计算公式:"),we),console.log("".concat(ie," 计算结果:"),Pe),i.setFieldValue(ie,Pe),await S(ie,i.getFieldsValue(),!1,de)}}finally{}},M=(H,K,q,Q)=>{let X="";if(H=="fieldsValue"){var Y;if(K.indexOf(".")>=0){var ne;const[se,ve]=K.split("."),be=(q==null?void 0:q[se])||[];Array.isArray(be)?X=be.map(ie=>{var de;return(de=ie==null?void 0:ie[ve])!==null&&de!==void 0?de:""}):X=(ne=be==null?void 0:be[ve])!==null&&ne!==void 0?ne:""}else X=(Y=q==null?void 0:q[K])!==null&&Y!==void 0?Y:""}else{let se=Q.find(ve=>ve.id===H);if(se&&se.data&&se.data.length>0){var re,J;X=(re=(J=se.data[0])===null||J===void 0?void 0:J[K])!==null&&re!==void 0?re:""}}return X},R=Z.useRef({});Z.useRef({});const F=Z.useRef(null),B=Z.useCallback(()=>{F.current&&clearTimeout(F.current);const H=f.current===1?500:100;F.current=setTimeout(async()=>{d.current.startNewCycle();const K={...R.current};R.current={};const q=i.getFieldsValue(),Q=f.current;f.current=0;let X=!1;m.current||(m.current={});const Y=new Set;for(let ne in K)try{let re=K[ne];if(!sh.isEqual(re.value||"",y(re.name)||"")){if(Q!=1){const J=Array.isArray(re.name)?re.name.map(ve=>typeof ve=="string"?ve:ve.toString()).join("."):re.name;if(Y.has(J)){console.log("跳过已处理的字段 processedFields",J);continue}Y.add(J);let se=await S(re.name,q,!1,J);X=X||se}m.current[p(re.name)]=re.value}}catch(re){console.log("debounceHandleFieldsChange error",re)}X&&(console.log("needRefresh",X),c())},H)},[]),k=Z.useCallback(H=>{},[]),z=Z.useCallback((H,K)=>{console.log("handleValuesChange changedValues",JSON.stringify(H));const q=function(X){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const ne=[];for(let re in X){const J=X[re],se=[...Y,re];Array.isArray(J)?J.forEach((ve,be)=>{if(typeof ve=="object"&&ve!==null){const ie=q(ve,[...se,be]);ne.push(...ie)}else ne.push({touched:!0,validating:!1,errors:[],warnings:[],name:[...se,be],validated:!1,value:ve})}):ne.push({touched:!0,validating:!1,errors:[],warnings:[],name:se,validated:!1,value:J})}return ne},Q=q(H);console.log("handleValuesChange converted to fields format",JSON.stringify(Q)),Q.length>0&&(Q.forEach(X=>{X.name&&X.name.length>0&&(R.current[X.name]=X)}),console.log("handleValuesChange changedFieldsState",JSON.parse(JSON.stringify(R.current))),B())},[]),V=H=>{let K=[];return H.forEach(q=>{if(!u.current.has(q))return;let Q=u.current.get(q);Q.withIds.length<=0||K.push(...Q.withIds.filter(X=>!K.includes(X)))}),K=K.filter(q=>{var Q=i.getFieldValue(q);return!(typeof Q!="number"&&!Q)}),K},_=function(H){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,q=V(H);const Q=i.getFieldsValue();setTimeout(async()=>{for(let X=0;X<q.length;X++){const Y=q[X];await S(Y,Q,!1,null,K)}},0)},P=async H=>{const K=i.getFieldsValue();setTimeout(async()=>{for(let q=0;q<H.length;q++){const Q=H[q];await S(Q,K)}},0)},L=Z.useRef({}),j=H=>u.current&&u.current.has(H)?u.current.get(H):null,W=()=>(console.log("memoizedRenderChildren",u.current),u.current?G():null),G=()=>{console.log("renderChildren");const H=Dl(),K=Z.Children.toArray(r);return console.log("childrenArray",K),nHt(K,n,u.current).map((Q,X)=>He.jsx(KN,{gutter:[24,24],children:Q.map((Y,ne)=>{var re,J;const{componentId:se,__id:ve,_componentName:be,...ie}=Y.props,de=((re=Y.type)===null||re===void 0?void 0:re.displayName)||be,pe=se||ve;pe in L.current||(L.current[pe]=Dl());const fe=de&&de.startsWith("Layout."),we=de&&de=="Field.Table",Pe=!u.current.has(pe)||((J=u.current.get(pe))===null||J===void 0?void 0:J.show),Se=(ie.calcHidden||!Pe)&&o!="desgin",Ie=[];if(ie.isRequired&&Ie.push({required:!0,message:"".concat(ie.label,"必须填写")}),ie.rules)if(Array.isArray(ie.rules)){const _e=ie.rules.join("|");Ie.push({pattern:new RegExp(_e),message:ie.rulesFailMessage?ie.rulesFailMessage:"".concat(ie.label,"格式错误")})}else Ie.push({pattern:new RegExp(ie.rules),message:ie.rulesFailMessage?ie.rulesFailMessage:"".concat(ie.label,"格式错误")});const Ge=_e=>{i.setFieldValue(pe,_e)};let qe;return we||fe?qe=Z.cloneElement(Y,{onTableAddRow:_,getTableWithIds:V,onTableRemoveRow:P,removeLastFieldsValues:w,form:i,fieldName:pe,onCustomChange:Ge,initializeFormRender:g,mode:o,recordFieldsChange:x,getDependencyMapItem:j,renderKey:H}):de==="Field.WithSingleSelect"||de==="Field.WithMultipleSelect"||de==="Show.WithTable"?qe=He.jsx(bi.Item,{hidden:Se,style:{margin:0},shouldUpdate:(_e,nt)=>{let ze=!1;if(Array.isArray(ie.filterRules)&&ie.filterRules.length>0)for(let ft of ie.filterRules){if(ft.valueType!="variable")continue;let Ue,Le;if(Ue=_e==null?void 0:_e[ft.value.field_key],Le=nt==null?void 0:nt[ft.value.field_key],Ue!==Le){ze=!0;break}}return ze&&(L.current[pe]=Dl(),console.log(pe,Dl())),ze},children:_e=>{let{getFieldsValue:nt}=_e;const ze=nt();let ft=Z.cloneElement(Y,{onTableAddRow:_,onTableRemoveRow:P,removeLastFieldsValues:w,form:i,fieldName:pe,onCustomChange:Ge,fieldsValue:ze,initializeFormRender:g,recordFieldsChange:x,shouldUpdateKey:L.current[pe]});return de==="show.WithTable"?He.jsx(He.Fragment,{children:ft}):He.jsx(bi.Item,{style:{marginBottom:0},label:"",name:pe,rules:Pe?Ie:[],children:ft})}}):qe=He.jsx(bi.Item,{hidden:Se,style:{marginBottom:0},label:"",name:pe,rules:Pe?Ie:[],children:Z.cloneElement(Y,{form:i,fieldName:pe,onCustomChange:Ge,initializeFormRender:g,recordFieldsChange:x,removeLastFieldsValues:w})}),He.jsx(nA,{span:Se?0:fe?24:24/n,style:{marginBottom:0},children:qe},pe||"col-".concat(ne))})},"row-".concat(X)))};return He.jsx(Ad,{theme:{components:{Table:{rowHoverBg:"#ebebeb"}},token:{colorBgContainerDisabled:"rgba(0, 0, 0, 0.02)",colorTextDisabled:"#333"}},children:He.jsxs(bi,{form:i,className:"form-container fp-0 fw-full fh-full box-border fflex fflex-col "+(o=="desgin"?" fp-6":""),onFieldsChange:k,onValuesChange:z,children:[He.jsx(bi.Item,{name:"__id",hidden:!0,children:He.jsx("input",{type:"hidden"})}),s]})})});function rHt(e){return Z.forwardRef((t,n)=>He.jsx(e,{...t,ref:n,forwardedRef:n}))}class Clr extends Z.PureComponent{render(){const{forwardedRef:t,...n}=this.props;return He.jsx(vpe,{...n,ref:t})}}const oHt=rHt(e=>{let{forwardedRef:t,...n}=e;return He.jsx(vpe,{...n,ref:t})});function iHt(e,t,n){const r=[];let o=[];const i=(a,s)=>{for(;s.length<a;)s.push(He.jsx("div",{},Dl()))};return e.forEach(a=>{var s,l;const u=((s=a.type)===null||s===void 0?void 0:s.displayName)||((l=a.props)===null||l===void 0?void 0:l._componentName);u&&u.startsWith("Layout.")?(o.length>0&&(i(t,o),r.push(o),o=[]),r.push([a])):(o.push(a),o.filter(f=>{var d,h,g,m;const p=((d=f.props)===null||d===void 0?void 0:d.componentId)||((h=f.props)===null||h===void 0?void 0:h.__id);return(!(n!=null&&n.has(p))||((g=n.get(p))===null||g===void 0?void 0:g.show))&&!((m=f.props)!==null&&m!==void 0&&m.calcHidden)}).length===t&&(r.push(o),o=[]))}),o.length>0&&(i(t,o),r.push(o)),r}const aHt=e=>{const t=new Map,n=[],r=function(o){var i,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const l=((i=o.type)===null||i===void 0?void 0:i.displayName)||((a=o.props)===null||a===void 0?void 0:a._componentName),{props:u}=o;if(l&&(l.startsWith("Field.")||l.startsWith("Layout."))){let c=(u==null?void 0:u.componentId)||(u==null?void 0:u.__id);s&&(c="".concat(s,".").concat(c));const f=u.withId?[u.withId]:u.withIds?[...u.withIds]:[];n.push({identifier:c,withIds:f,compName:l,fillRules:u==null?void 0:u.fillRules,visibleFunc:u==null?void 0:u.withVisibleFunc})}u!=null&&u.children&&Z.Children.forEach(u.children,c=>{r(c,l&&l.startsWith("Field.")?(u==null?void 0:u.componentId)||(u==null?void 0:u.__id):"")})};return Z.Children.forEach(e,o=>r(o)),n.forEach(o=>{t.set(o.identifier,{...o,show:!0,children:n.filter(i=>i.withIds.includes(o.identifier))})}),t},sHt=function(e,t,n){if(!t.has(e))return!1;const r=t.get(e);if(r.visibleFunc&&typeof r.visibleFunc=="function"){const o=r.visibleFunc(n);if(r.show!==o)return r.show=o,!0}if(r.fillRules&&Array.isArray(r.fillRules)&&r.fillRules.length>0){const o=r.fillRules.map(a=>typeof a=="string"?a:""),i=Vre(o)==="true";if(r.show!==i)return r.show=i,!0}return!1},lHt=Z.forwardRef((e,t)=>{let{cols:n=1,children:r,mode:o="view"}=e;const[i]=bi.useForm(),[a,s]=Z.useState(null),l=Z.useRef(new Map),u=Z.useRef({}),c=Z.useRef({}),f=Z.useCallback(()=>{l.current=aHt(r)},[r]),d=Z.useCallback(()=>{const p=i.getFieldsValue();let y=!1;l.current.forEach((v,b)=>{const E=sHt(b,l.current,p);y=y||E}),y&&s(m())},[i]),h=Z.useCallback(sh.debounce(()=>{const p=i.getFieldsValue();Object.keys(c.current).forEach(y=>{c.current[y]!==p[y]&&(u.current[y]=p[y])}),c.current={},d()},200),[i,d]),g=function(){for(var p=arguments.length,y=new Array(p),v=0;v<p;v++)y[v]=arguments[v];let[,b]=y;Object.assign(c.current,b),h()},m=Z.useCallback(()=>{const p=Z.Children.toArray(r);return iHt(p,n,l.current).map((v,b)=>He.jsx(KN,{gutter:[24,24],children:v.map((E,S)=>{var w,C;const{componentId:x,__id:D,_componentName:T,calcHidden:O,...N}=E.props,M=((w=E.type)===null||w===void 0?void 0:w.displayName)||T,R=x||D,F=Dl(),B=M&&M.startsWith("Layout."),k=!l.current.has(R)||((C=l.current.get(R))===null||C===void 0?void 0:C.show),z=(O||!k)&&o!=="desgin",V=[];if(N.isRequired&&V.push({required:!0,message:"".concat(N.label,"必须填写")}),N.rules){const P=Array.isArray(N.rules)&&N.rules.length>0?N.rules.join("|"):N.rules;V.push({pattern:new RegExp(P),message:N.rulesFailMessage||"".concat(N.label,"格式错误")})}let _=null;return B?_=Z.cloneElement(E,{form:i,fieldName:R,updateKey:F}):_=He.jsx(bi.Item,{hidden:z,label:N.label||"",name:R,rules:k?V:[],children:Z.cloneElement(E,{form:i,fieldName:R,updateKey:F})}),He.jsx(nA,{span:z?0:B?24:24/n,children:_},R||"col-".concat(S))})},"row-".concat(b)))},[r,n,i,o]);return Z.useEffect(()=>{f(),s(m())},[f,m]),Z.useImperativeHandle(t,()=>({formRef:i,setFieldsValue:p=>{i.setFieldsValue(p),h()},refreshDependencies:()=>{f(),d()}})),He.jsxs(bi,{form:i,className:"form-container fp-0 fw-full fh-full box-border fflex fflex-col fgap-y-2".concat(o==="desgin"?" fp-6":""),onValuesChange:g,children:[He.jsx(bi.Item,{name:"__id",hidden:!0,children:He.jsx("input",{type:"hidden"})}),a]})}),uHt=e=>{let{request:t,value:n,onChange:r,callError:o,disabledValue:i,addRoot:a=!0,title:s,...l}=e;const[u,c]=Z.useState(!1),[f,d]=Z.useState([]);Z.useEffect(()=>{h()},[]),Z.useEffect(()=>{if(typeof n=="string")try{n=JSON.parse(n),r(n)}catch{}Array.isArray(n)&&y(n)},[n]);const h=async()=>{if(t&&typeof t=="function"){var D;const T=await t();if(T.code>0){o&&typeof o=="function"&&o(T.message);return}let O=jZe(((D=T.data)===null||D===void 0?void 0:D.list)||T.data||[],"id",s||"title",(l==null?void 0:l.parentId)||"parentId","children",0,i);a&&(O=[{value:0,title:"根节点",children:O}]),l.treeData=O,console.log("treeData",O),d(O)}l.treeData&&d(l.treeData),c(!0)},[g,m]=Z.useState([]),[p,y]=Z.useState([]),[v,b]=Z.useState([]),[E,S]=Z.useState(!0),w=D=>{console.log("onExpand",D),m(D),S(!1)},C=D=>{console.log("onCheck",D),y(D),r(D)},x=(D,T)=>{console.log("onSelect",T),b(D)};return He.jsx(Bi,{...l,children:He.jsx(npe,{checkable:!0,onExpand:w,onCheck:C,onSelect:x,expandedKeys:g,autoExpandParent:E,checkedKeys:p,selectedKeys:v,treeData:f})})},cHt=e=>He.jsx(Bi,{...e,children:He.jsx(WN,{...e})}),fHt=e=>He.jsx(Bi,{...e,children:He.jsx(WN.Group,{...e})}),dHt=e=>He.jsx(Bi,{...e,children:He.jsx(p_.Group,{...e})}),SJe=e=>{let{value:t,maxCount:n,multiple:r,onChange:o,...i}=e;Z.useEffect(()=>{if(t){if(typeof t=="string")try{t=JSON.parse(t),o(t)}catch{}console.log("value",t),Array.isArray(t)&&s(t)}},[t]),n=n||99,r=r||!0;const[a,s]=Z.useState([]),l=u=>{let{fileList:c}=u;console.log("newFileList",c),c=c.map(f=>(f.status=="done"&&f.response&&(f.url=f.response),f)),o(c.map(f=>({uid:f.uid,name:f.name,status:f.status,url:f.url||f.response||"",error:f.error}))),s(c)};return He.jsx(O_,{...i,listType:"text",multiple:r,onChange:l,maxCount:n,fileList:a,children:!(i!=null&&i.disabled)&&!(i!=null&&i.readonly)&&a.length<n&&He.jsx(fu,{type:(i==null?void 0:i.type)||"default",icon:(i==null?void 0:i.icon)||He.jsx(kZe,{}),children:"点击上传文件"})})};SJe.displayName="UploadFile";const hHt=e=>He.jsx(Bi,{...e,children:He.jsx(SJe,{...e})}),wJe=e=>{let{maxCount:t,value:n,multiple:r,onChange:o,...i}=e;Z.useEffect(()=>{if(n){if(console.log("value",n),typeof n=="string")try{n=JSON.parse(n),o(n)}catch{}let S=[];if(Array.isArray(n))for(let w=0;w<n.length;w++){let C=n[w];var E=g.current.find(x=>x.uid===C.uid);!E||(E.version||0)<(C.version||0)?S.push(C):S.push(E)}s(S)}},[n]),t=t||99,r=r||!0;const[a,s]=Z.useState([]),[l,u]=Z.useState(""),[c,f]=Z.useState(0),[d,h]=Z.useState(!1),g=Z.useRef([]),m=E=>new Promise((S,w)=>{const C=new FileReader;C.readAsDataURL(E),C.onload=()=>S(C.result),C.onerror=x=>w(x)}),p=async(E,S)=>{!E.url&&!E.preview&&(E.preview=await m(E.originFileObj)),u(E.url||E.preview),f(S),h(!0)},y=async(E,S)=>{i!=null&&i.disabled||s(a.filter((w,C)=>C!==S))},v=He.jsx(He.Fragment,{children:He.jsxs("div",{className:"fw-full fh-full fflex fflex-col fitems-center fjustify-center fborder fborder-dashed fcursor-pointer frounded",children:[He.jsx(BZe,{}),He.jsx("div",{className:"fmt-2",children:"点击上传"})]})}),b=E=>{let{fileList:S}=E,w=[];for(let D=0;D<S.length;D++){var C=S[D];C.version=new Date().getTime();var x=g.current.find(T=>T.uid===C.uid);console.log("oldfile",JSON.parse(JSON.stringify(x||{}))),x&&x.status!="uploading"?w.push(x):(C.status=="done"&&C.response&&(C.url=C.response),w.push(C))}g.current=w,s(w),o(w.map(D=>({uid:D.uid,name:D.name,status:D.status,url:D.url||D.response||"",error:D.error,version:D.version||0})))};return He.jsxs(He.Fragment,{children:[He.jsx("div",{className:"fflex fgap-3 fflex-wrap",children:He.jsx(O_,{...i,itemRender:(E,S,w)=>{console.log("file",S);let C=w.findIndex(x=>x.uid===S.uid);return He.jsx(He.Fragment,{children:He.jsxs("div",{className:"fgroup fw-full fh-full fbg-transparent fborder frounded fflex fitems-center fjustify-center foverflow-hidden fcursor-pointer frelative"+(S.status=="error"?" fborder-red-500":""),children:[He.jsxs("div",{className:" fhidden fabsolute fw-full fh-full fbg-gray-900 fbg-opacity-50 fitems-center fjustify-center fz-10 group-hover:fflex ftext-white ftext-lg fgap-2",children:[S.status=="done"&&He.jsx(LZe,{onClick:()=>{p(S,C)},className:"hover:ftext-gray-200"}),!(i!=null&&i.disabled)&&!(i!=null&&i.readonly)&&He.jsx(lpe,{onClick:()=>{y(S,C)},className:"hover:ftext-gray-200"})]}),S.status=="uploading"&&He.jsx("div",{className:" fw-full fh-full fflex fitems-center fjustify-center fabsolute ftop-0 fleft-0 ",children:He.jsx(xT,{})}),He.jsx("img",{src:S.url||S.thumbUrl,alt:"Example Image",className:"fmax-w-full fmax-h-full fobject-contain "})]},"file-".concat(S.uid))})},listType:"picture-card",fileList:a,multiple:r,onPreview:p,onChange:b,maxCount:t,children:a.length>=t||i!=null&&i.disabled||i!=null&&i.readonly?null:v})}),l&&He.jsx(K9.PreviewGroup,{preview:{visible:d,current:c,onVisibleChange:E=>h(E),onChange:E=>{f(E)}},children:a.map((E,S)=>He.jsx(He.Fragment,{children:He.jsx(K9,{wrapperStyle:{display:"none"},src:E.url})}))})]})};wJe.displayName="UploadImage";const pHt=e=>He.jsx(Bi,{...e,children:He.jsx(wJe,{...e})}),vHt=e=>{let{value:t,onChange:n,form:r,fieldName:o,...i}=e,a=!1;return typeof t=="boolean"?a=t:typeof t=="string"?a=t=="1"||t=="true":typeof t=="number"&&(a=t==1),t!==a&&(r==null||r.setFieldValue(o,a)),He.jsx(Bi,{...i,children:He.jsx(Xhe,{...i,onChange:n,value:t})})};var gHt={exports:{}};(function(e,t){(function(n,r){e.exports=r(wYe)})(Er,function(n){function r(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var o=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(a,s){return s==="W"?a+"周":a+"日"},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(a,s){var l=100*a+s;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return o.default.locale(i,null,!0),i})})(gHt);var mHt={locale:"zh_CN",yearFormat:"YYYY年",cellDateFormat:"D",cellMeridiemFormat:"A",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"};const yHt={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},CJe={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},mHt),timePickerLocale:Object.assign({},yHt)};CJe.lang.ok="确定";var xJe={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Er,function(){return function(n,r,o){o.updateLocale=function(i,a){var s=o.Ls[i];if(s)return(a?Object.keys(a):[]).forEach(function(l){s[l]=a[l]}),s}}})})(xJe);var bHt=xJe.exports;const EHt=Ws(bHt);Ra.extend(EHt);Ra.extend(TYe);Ra.updateLocale("zh-cn",{weekStart:0});const SHt=e=>{let{datetype:t,value:n,defaultNow:r,onChange:o,...i}=e;t=t||"date";const[a,s]=Z.useState(i==null?void 0:i.picker),[l,u]=Z.useState(i==null?void 0:i.format),[c,f]=Z.useState(!1),[d,h]=Z.useState(!1),g=Z.useRef(!1);Z.useEffect(()=>{if(r&&!n){const p=Ra().format("YYYY-MM-DD HH:mm:ss");typeof o=="function"&&o(p);return}},[]);const m=(p,y)=>{g.current=!0,o(y)};return Z.useEffect(()=>{switch(s("date"),f(!1),t){case"date":s("date"),u("YYYY-MM-DD"),h(!1);break;case"datetime":f(!0),s("datetime"),u("YYYY-MM-DD HH:mm:ss"),h(!0);break;case"month":s("month"),h(!1);break;case"year":s("year"),h(!1);break}},[t]),He.jsx(Bi,{...i,children:He.jsx(rA,{locale:CJe,...i,picker:a,format:l,style:{width:"100%"},onChange:m,value:n&&Ra(n).isValid()?Ra(n):void 0,showTime:c,needConfirm:d})})};var gpe={exports:{}},JN={},F_={exports:{}},AJe={},Ure={exports:{}},sP={exports:{}},Io={};/** @license React v16.13.1
431
431
  * react-is.production.min.js
432
432
  *
433
433
  * Copyright (c) Facebook, Inc. and its affiliates.
package/dist/index.es.js CHANGED
@@ -47530,20 +47530,18 @@ const RJe = /* @__PURE__ */ Xs((e, t) => {
47530
47530
  }
47531
47531
  d.current.addToPath(ne);
47532
47532
  try {
47533
- if (console.log("dependencyMap.current", u.current), console.log("dependencyMap.current identifier", H), u.current.has(H)) {
47533
+ if (console.log("dependencyMap.current", u.current), console.log("dependencyMap.current identifier", H), console.log("dependencyMap.current targetRowIndex", X), u.current.has(H)) {
47534
47534
  const Z = u.current.get(H), ae = Z.children;
47535
- !q && Z !== null && Z !== void 0 && Z.fillRules && Array.isArray(Z == null ? void 0 : Z.fillRules) && (Z == null ? void 0 : Z.fillRules.length) > 0 && !(typeof X == "number" && X >= 0) && D(H, te, K, Z == null ? void 0 : Z.fillRules);
47535
+ !q && Z !== null && Z !== void 0 && Z.fillRules && Array.isArray(Z == null ? void 0 : Z.fillRules) && (Z == null ? void 0 : Z.fillRules.length) > 0 && D(H, te, K, Z == null ? void 0 : Z.fillRules);
47536
47536
  for (let pe = 0; pe < ae.length; pe++) {
47537
47537
  const ye = ae[pe];
47538
- if (!(typeof X == "number" && X >= 0)) {
47539
- if (ye.component.props.withVisibleFunc && typeof ye.component.props.withVisibleFunc == "function") {
47540
- let oe = T(K, ye, te);
47541
- Y = Y || oe;
47542
- }
47543
- if (ye.component.props.withVisible) {
47544
- let oe = await O(K, ye, te, Z == null ? void 0 : Z.componentName);
47545
- Y = Y || oe;
47546
- }
47538
+ if (ye.component.props.withVisibleFunc && typeof ye.component.props.withVisibleFunc == "function") {
47539
+ let oe = T(K, ye, te);
47540
+ Y = Y || oe;
47541
+ }
47542
+ if (ye.component.props.withVisible) {
47543
+ let oe = await O(K, ye, te, Z == null ? void 0 : Z.componentName);
47544
+ Y = Y || oe;
47547
47545
  }
47548
47546
  !q && ye.component.props.withFill && await N(K, ye, te, Z == null ? void 0 : Z.componentName, ne, X);
47549
47547
  }
@@ -47692,9 +47690,11 @@ const RJe = /* @__PURE__ */ Xs((e, t) => {
47692
47690
  else if (oe.indexOf(".") >= 0) {
47693
47691
  oe = oe.split(".");
47694
47692
  let ce = M("fieldsValue", oe[0], H, []);
47695
- Array.isArray(ce) && ce.length > 0 && typeof ne == "number" && ne >= 0 && ne < ce.length && await N(H, K, [oe[0], ne], Q, X);
47696
- for (let we = 0; we < ce.length; we++)
47697
- await N(H, K, [oe[0], we], Q, X);
47693
+ if (Array.isArray(ce) && ce.length > 0) if (typeof ne == "number" && ne >= 0)
47694
+ ne < ce.length && await N(H, K, [oe[0], ne], Q, X);
47695
+ else
47696
+ for (let we = 0; we < ce.length; we++)
47697
+ await N(H, K, [oe[0], we], Q, X);
47698
47698
  return;
47699
47699
  }
47700
47700
  const fe = Array.isArray(oe) ? oe.join(".") : oe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.11.91",
3
+ "version": "0.11.94",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -277,28 +277,29 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
277
277
  try {
278
278
  console.log("dependencyMap.current", dependencyMap.current)
279
279
  console.log("dependencyMap.current identifier", identifier)
280
+ console.log("dependencyMap.current targetRowIndex", targetRowIndex)
280
281
  if (dependencyMap.current.has(identifier)) {
281
282
  const dependent = dependencyMap.current.get(identifier)
282
283
  const dependentChildren = dependent.children;
283
284
 
284
285
 
285
- if (!init && dependent?.fillRules && Array.isArray(dependent?.fillRules) && dependent?.fillRules.length > 0 && (!(typeof targetRowIndex === 'number' && targetRowIndex >= 0))) {
286
+ if (!init && dependent?.fillRules && Array.isArray(dependent?.fillRules) && dependent?.fillRules.length > 0 ) {
286
287
  handleFillRules(identifier, parentIdentifier, fieldValues, dependent?.fillRules)
287
288
  }
288
289
  for (let index = 0; index < dependentChildren.length; index++) {
289
290
  const child = dependentChildren[index];
290
- if (!(typeof targetRowIndex === 'number' && targetRowIndex >= 0)) {
291
- if (child.component.props.withVisibleFunc && typeof child.component.props.withVisibleFunc === 'function') {
292
- let needRefresh_ = handleFieldsVisibleFunc(fieldValues, child, parentIdentifier)
293
- needRefresh = needRefresh || needRefresh_
294
- }
295
291
 
296
- if (child.component.props.withVisible) {
297
- let needRefresh_ = await handleFieldsVisible(fieldValues, child, parentIdentifier, dependent?.componentName)
298
- needRefresh = needRefresh || needRefresh_
299
- }
292
+ if (child.component.props.withVisibleFunc && typeof child.component.props.withVisibleFunc === 'function') {
293
+ let needRefresh_ = handleFieldsVisibleFunc(fieldValues, child, parentIdentifier)
294
+ needRefresh = needRefresh || needRefresh_
300
295
  }
301
296
 
297
+ if (child.component.props.withVisible) {
298
+ let needRefresh_ = await handleFieldsVisible(fieldValues, child, parentIdentifier, dependent?.componentName)
299
+ needRefresh = needRefresh || needRefresh_
300
+ }
301
+
302
+
302
303
  if (!init && child.component.props.withFill)
303
304
  await handleFieldsWithFill(fieldValues, child, parentIdentifier, dependent?.componentName, currentFieldId, targetRowIndex)
304
305
 
@@ -444,10 +445,10 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
444
445
  setTimeout(() => {
445
446
  recordFieldsChange(changedFields, true)
446
447
  // console.log("idGroups", idGroups)
447
- if (idGroups.length > 0) idGroups.forEach(ids => {
448
- if (Array.isArray(ids) && ids.length > 0)
449
- handleTableAddRow(ids)
450
- })
448
+ if (idGroups.length > 0) idGroups.forEach(ids => {
449
+ if (Array.isArray(ids) && ids.length > 0)
450
+ handleTableAddRow(ids)
451
+ })
451
452
  }, 0)
452
453
  }
453
454
  // 处理级联显示隐藏 @return {boolean} 是否需要重新渲染表单的字段
@@ -592,9 +593,11 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
592
593
  await handleFieldsWithFill(fieldValues, child, [childIdentifier[0], targetRowIndex], componentName, sourceFieldId)
593
594
  }
594
595
  }
595
- for (let index = 0; index < table_values.length; index++) {
596
- await handleFieldsWithFill(fieldValues, child, [childIdentifier[0], index], componentName, sourceFieldId)
597
- }
596
+ else {
597
+ for (let index = 0; index < table_values.length; index++) {
598
+ await handleFieldsWithFill(fieldValues, child, [childIdentifier[0], index], componentName, sourceFieldId)
599
+ }
600
+ }
598
601
 
599
602
  return
600
603
  }
@@ -878,13 +881,13 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
878
881
  })
879
882
  return withAllIds
880
883
  }
881
- const handleTableAddRow = (ids,targetRowIndex = -1) => {
884
+ const handleTableAddRow = (ids, targetRowIndex = -1) => {
882
885
  let withAllIds = getTableWithIds(ids)
883
886
  const fieldValues = form.getFieldsValue();
884
887
  setTimeout(async () => {
885
888
  for (let index = 0; index < withAllIds.length; index++) {
886
889
  const withid = withAllIds[index];
887
- await handleFieldsWith(withid, fieldValues,false,null,targetRowIndex);
890
+ await handleFieldsWith(withid, fieldValues, false, null, targetRowIndex);
888
891
  }
889
892
  }, 0);
890
893
  }