@jiess/plus
Version:
基于Jiess核心库的强化与拓展,为Jiess应用的完整形态
1 lines • 71.7 kB
JavaScript
var e={d:(t,s)=>{for(var i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{BM:()=>as,C$:()=>os,c8:()=>ts,hz:()=>ds,ft:()=>ss,b8:()=>Ps,AA:()=>$s,bn:()=>Rs,G4:()=>gs,dw:()=>ps,Id:()=>Cs,cX:()=>is,t:()=>ls,kx:()=>fs,Bf:()=>Ds,xD:()=>Zt,lG:()=>zt,YG:()=>xt,rN:()=>Is,g4:()=>us,Y4:()=>xs,ON:()=>vs,dC:()=>_s,ZL:()=>As,ry:()=>cs,zA:()=>Ks,H8:()=>Ts,P:()=>Ms,dN:()=>ns,CA:()=>rs,Kd:()=>Bs,Jj:()=>bs,qB:()=>Es,v:()=>Ns,D3:()=>Fs,eO:()=>Js,Hv:()=>hs,QL:()=>ys,b2:()=>Ss,s_:()=>ms,lz:()=>Yt,ae:()=>js,bk:()=>ks,i:()=>C,pU:()=>T,jt:()=>_,qq:()=>D,Vy:()=>Se,sb:()=>b,Gx:()=>Ve,iq:()=>Oe,wS:()=>g,U7:()=>w,j8:()=>S,cu:()=>R,_O:()=>Os,Aj:()=>h,z1:()=>Ee,U2:()=>Qt,I1:()=>f,$$:()=>d,l3:()=>P,gK:()=>v,Bb:()=>y,El:()=>I,qb:()=>Xt,og:()=>x,Gu:()=>_e,ZN:()=>$,Zd:()=>p,qE:()=>V,QR:()=>De,GU:()=>Ae,xQ:()=>Be,Zb:()=>j,$L:()=>Vs,sm:()=>A,l5:()=>O,EF:()=>m,RZ:()=>k,rR:()=>Ie,y1:()=>Te,fe:()=>Re});const s="JIESS_CONSTRUCTOR",i="isJiess",n="THIS_IS_JIESS",r="JIESS_INIT_VALUE",a="_isJiessRef",o="_isJiessComputed",l="_initialParent",c=[s,"_isVue","_uid","_Ctor","__v_isRef","__v_isReactive","$$typeof","_store",{field:"install",type:"function"}],u=["is","component","$exclude"],h=(e,t,s=!0)=>{if(Object.is(e,t))return!0;const i=Object.prototype.toString.call(e);if(i!==Object.prototype.toString.call(t))return!1;if("[object Date]"===i)return e.getTime()===t.getTime();if("[object Promise]"===i)return!1;if("function"==typeof e)return String(e)===String(t);if(e&&"object"==typeof e){const i=Object.keys(e),n=Object.keys(t);if(i.length===n.length){let i=e,n=t;if(s){const s=[],r=[];if(i=b(e,(e=>(s.push(e),s.length))),n=b(t,(e=>(r.push(e),r.length))),s.length!==r.length)return!1;if(!s.every(((e,t)=>Object.is(e,r[t]))))return!1}return function(e,t){const s=Object.keys(e),i=Object.keys(t);for(let n of s){if(!i.includes(n))return!1;if(!h(e[n],t[n],!1))return!1}return!0}(i,n)}}return!1};function d(e){return e.slice(0,1).toUpperCase()+e.slice(1)}function f(e){return e.slice(0,1).toLowerCase()+e.slice(1)}const p=(...e)=>{},m=(e=p,t=0)=>{let s=setTimeout((()=>{null!==s&&clearTimeout(s),e()}),t)},y=function(e,t,s=!0){if("exp"===t&&(t="RegExp"),Array.isArray(t))return t.some((t=>y(e,t)));if(s&&!y(t,"string",!1))throw new Error(`${t} Error:须提供字符串`);return t=d(t),Object.prototype.toString.call(e)===`[object ${t}]`};function g(e,t){for(let s in t){let i=t[s];Array.isArray(i)?(e[s]=[],g(e[s],i)):y(i,"object")?(e[s]={},g(e[s],i)):e[s]=i}}const b=(e,t,s=new WeakSet)=>{if(y(e,["array","object"])){if(s.has(e))return t?.(e,"loop");if(s.add(e),Array.isArray(e))return e.map((e=>b(e,t,s)));if(N(e))return t?.(e,"filter")||e;{const i={};for(const n in e)if(u.includes(n))i[n]=e[n];else if(Reflect.has(e,n)){const r=e[n];i[n]=b(r,t,s)}return i}}return e},$=(e,t)=>!(!t||""!==e)||[null,void 0,NaN].some((t=>Object.is(t,e))),x=(e,t)=>!$(e,t),v=function(e=6){e=parseInt(e.toString(),10),e=isNaN(e)?6:e;for(var t="";e--;)t+="0123456789abcdefghijklmnopqrstubwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ"[Math.round(61*Math.random())];return t},w=function(e,t){let s=new Date(e),i={"M+":s.getMonth()+1,"d+":s.getDate(),"h+":s.getHours(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};const n=(/(y+)/.exec(t)||[])[1];n&&(t=t.replace(n,s.getFullYear()+""));for(let e in i){const s=i[e]+"",n=(new RegExp("("+e+")").exec(t)||[])[1];n&&(t=t.replace(n,`00${s}`.slice(-n.length)))}return t},k=e=>{let t=0,s={},i=(e,n)=>{if(Array.isArray(n))return n.map((t=>i(e,t)));if("function"==typeof n){let i=`__${t++}__`;return s[i]=n.toString(),s[i].startsWith(e)&&(s[i]=s[i].replace(e,"function")),i}if(y(n,"object")){if(n&&"object"==typeof n&&!Array.isArray(n)){const{$model:e,$done:i,...r}=n;if("template"===e){let e=`__${t++}__`;return s[e]=i(r),e}return r}return n}return n},n=JSON.stringify(e,((e,t)=>e?i(e,t):t),2);for(let e in s)n=n.replace(new RegExp(`"${e}"`),s[e]);return n},P=function(e){let t=new RegExp("(^| )"+e+"=([^;]*)(;|$)"),s=document.cookie.match(t);return s?decodeURIComponent(s[2]):null},j=function(e,t,s=30){let i=new Date;i.setTime(i.getTime()+24*s*60*60*1e3),t=encodeURIComponent(t),document.cookie=`${e}=${t};expires=${i.toUTCString()};path=/`},C=(e=!1)=>{let t;return function(s,i=100){x(t,!0)?clearTimeout(t):e&&s(),t=setTimeout(s,i)}},S=C(),T=()=>{let e=0;return function(t,s=100){let i=(new Date).getTime();i-e>s&&t(),e=i}},R=T(),_=()=>{let e=!0;return function(t,s=100){e&&(e=!1,setTimeout((()=>{e=!0,t()}),s))}},A=_(),D=()=>{let e=0;return function(t,s=100){let i=(new Date).getTime();i-e>s&&(e=i,t())}},O=D(),V={initVal:e=>["string","number"].includes(typeof e)?e.toString():"",stringify(e){let t=[];for(let s in e){const i=e[s];Array.isArray(i)?i.forEach(((e,i)=>t.push(`${s}[${i}]=${this.initVal(e)}`))):t.push(`${s}=${this.initVal(i)}`)}return t.join("&")},parse(e){const t={};e.split("&").forEach((e=>{let[s,...i]=e.split("=");const n=s.match(/^(.+)\[(\d+)\]$/);if(n){s=n[1];const e=parseInt(n[2],10);for(t[s]=t[s]||[];t[s].length<=e;)t[s].push(null);t[s][e]=i.join("=")}else t[s]=t[s]||[],t[s].push(i.join("="))}));const s={};for(let e in t)1===t[e].length?s[e]=t[e][0]:s[e]=t[e].filter((e=>null!==e));return s}},I=function(e,...t){return(s,i=[],n)=>{if("function"==typeof s){let r=null;return r=e?s.call(e,...t,...i):s(...t,...i),void 0===r?n:r}return void 0===n?s:n}},B=(e,t)=>{throw new Error(`${e} Error:${t}`)},E=(e,t,i=s)=>!!y(e,"object")&&Object.is(e[i],t),N=e=>c.some((t=>{if("string"==typeof t)return Reflect.has(e,t);{const{field:s,type:i}=t;if(Reflect.has(e,s))return y(e[s],i)}}));function F(e,t,s=p,i="数据类型"){if(y(e,t))return s();B(i,`须提供 ${t} 类型`)}const J=e=>{const t={...e},s=t.default;return delete t.default,Object.assign(t,s)};function M(e={},t="toString"){if("function"==typeof e[t]){if("string"==typeof t){const s=new RegExp(t,"g");return(e[t]+"").replace(s,"")}return e[t]+""}}const K=(()=>{const e=M();return(t,s)=>M(t,s)===e})(),q=(e,t)=>Array.isArray(e)?[...e]:y(e,"object")?{...e}:t?void B("shallowCopy","须提供对象或数组"):e,z=(e,t,s={})=>{if(e.has(t)){const i=s;s=e.get(t),"function"==typeof i&&i(s)}return s};function U(e){return E(e,"JsRender")}function L(e,t){U(e)?t(e):Array.isArray(e)&&e.forEach((e=>{U(e)&&t(e)}))}function H(e){L(e,(e=>{e.destory()}))}const G=new WeakMap;function W(e){return!(!e||"object"!=typeof e||!e[n])}const Z=e=>!!y(e,"object")&&Reflect.has(e,"$proxy"),Q=e=>{const{$proxy:t,field:s,done:i}=e;return i?i(t):s?t[s]:t},X=e=>{if(Z(e)){const{$proxy:t,field:s="value"}=e;return t[s]}return e},Y=(e,t)=>Array.isArray(e)?function(e){let t=null;return e.filter((e=>{if(!U(e))return!0;{const s=e,{_resConfig:i,_resData:n}=s;if(void 0!==i.$show){const e=n.style={...n.style};if(G.has(s)||G.set(s,e.display),i.$show){if("none"===e.display){const t=G.get(s);t?e.display=t:delete e.display}}else e.display="none"}let{$if:r=!0,$elseIf:a}=i;if(r=X(r),a=X(a),!x(a,!0))return i.hasOwnProperty("$if")?(t=!!r,r):(t=null,r);if("boolean"==typeof t){const e=a&&!t;return e&&(t=!0),e}B("$elseIf","须配合$if")}}))}(e).map(Y):U(e)?e.getNative(t):x(e)?e:void 0;class ee{static uid=1;constructor(e,t={}){this[s]=e,this.J_uid=ee.uid++,"function"==typeof t&&(t=t(this)),Object.assign(this,t),this.bindCxt()}bindCxt(){for(const e of Reflect.ownKeys(this.__proto__))"constructor"!==e&&"string"==typeof e&&("function"==typeof this[e]&&(this[e]=this[e].bind(this)),this.freezeField(e))}resetField(e,t){Object.prototype.hasOwnProperty.call(this,e)&&Object.defineProperty(this,e,{value:t})}freezeField(e){Object.prototype.hasOwnProperty.call(this,e)&&Object.defineProperty(this,e,{writable:!1,enumerable:!0,configurable:!0})}}const te=class extends ee{watcher;fn;flush;constructor(e,t,s="async"){super("Composite"),this.watcher=e,this.fn=t,this.flush=s,this.effecting="doned",this.debounce1=C()}initComputed(e,t){this.computer=!0,this.target=e,this.proxy=t}init(e,t,s,i){return this.watcher.effecter.addCurrent(this),this.done(e,t,s,i),this.watcher.effecter.removeCurrent(),this.value}done(e,t,s,i){return this.effecting="start",this.value=this.fn(e,t,s,i),this.effecting="computed",this.computer&&(this.proxy.value=this.value),this.effecting="doned",this.value}check(e){this.computer?"start"===this.effecting?B("Computed","计算中禁止赋值"):"function"==typeof e&&e((e=>{this.target.value=e,this.watcher.effecter.trigger(this.target,"value",e,this.proxy)})):"function"==typeof e&&e()}trigger(e,t,s,i){this.check(((n=p)=>{"sync"===this.flush?n(this.init(e,t,s,i)):this.debounce1((()=>n(this.init())),0)}))}},se=[Symbol.iterator,"constructor","__proto__","prototype",NaN,null,void 0,1/0],ie=class extends ee{watcher;current;execStack=[];mapStore;constructor(e){super("Effecter"),this.watcher=e,this.mapStore=new WeakMap}addCurrent(e){this.current&&this.execStack.push(this.current),this.current=e}removeCurrent(){this.current=this.execStack.pop()}collect(e,t){if("start"!==this.current?.effecting)return;if(se.includes(t))return;if(K(e,t))return;const s=z(this.mapStore,e),i=t;s[i]=s[i]||new Set,s[i].add(this.current),this.mapStore.set(e,s)}trigger(e,t,s,i){if(se.includes(t))return;if(K(e,t))return;this.current?.check();const n=z(this.mapStore,e);n.hasOwnProperty(t)&&n[t].forEach((n=>n.trigger(e,t,s,i))),this.watcher.update(i,t,s)}},ne=(e,t)=>void 0===e?t:e;class re extends ee{proxy;field;config;reuse=!1;constructor(e,t,s={}){super("Observe"),this.proxy=e,this.field=t,this.config=s,this.cbs=new Set,this.debounce1=C();const{hasKey:i,defaultValue:n,observe:r,...a}=s;this.observe(r),this.other=a,this.value=i?e[t]:q(e);const o=this.value=ne(this.value,n);this.getValue(((e,t)=>{this.result=e,t&&this.dispatch(e,{value:o,...a})}))}getValue(e){const{value:t,config:s,result:i}=this,{defaultValue:n,done:r}=s;"function"==typeof r?y(r,"AsyncFunction")?(r(t,this).then((t=>e(t,!0))),e(ne(i,n))):e(r(t,this)):e(t)}observe(e){return"function"==typeof e&&this.cbs.add(e),this}resolve(e){const t=this.value,s={value:e,oldValue:t,...this.other};let{isSync:i,hasKey:n,sameState:r=!1}=this.config;if(n){try{r=h(t,e)}catch(e){console.error(e)}if(r)return;this.value=e,this.oldValue=t,this.getValue((e=>this.dispatch(e,s)))}else{const t=()=>{this.value=q(e),this.getValue((e=>this.dispatch(e,s)))};i?t():this.debounce1((()=>t()),0)}}dispatch(e,t){t.oldResult=this.result,t.result=this.result=e,this.cbs.forEach((s=>s(e,t.oldResult,t)))}}const ae=class extends ee{watcher;constructor(e){super("Observer"),this.watcher=e}create(e,t){return N(e)&&"Target"!==e[s]?e:F(e,["array","object"],(()=>{const s=new Proxy(e,{get:(e,s,i)=>s===n||("_initialTarget"===s?e:s===l?t:s===Symbol.toStringTag?Array.isArray(e)?"Array":"Object":(this.watcher.effecter.collect(e,s),E(e,!0,o)&&"value"===s?e.getValue():Reflect.get(e,s,i))),set:(e,s,i,n)=>(s===l&&(t=i),!!Object.is(e[s],i)||(this.trigger(e,s,i,n),Reflect.set(e,s,i,n))),deleteProperty:(e,t)=>(t in e&&this.trigger(e,t,void 0,s),Reflect.deleteProperty(e,t))});for(const t in e)u.includes(t)||y(e[t],["array","object"])&&(e[t]=this.create(e[t],s));return s}),"创建响应式数据")}trigger(e,t,s,i){const{effecter:n}=this.watcher;E(e,!0,o)?e.setValue(s,t):n.trigger(e,t,s,i)}},oe=class extends ee{_setter;_composite;constructor(){super("Target"),this[n]=!0,this.value=r,this[o]=!0}initSetter(e){this._setter=e}initComposite(e){this._composite=e}getValue(){return this.value===r&&(this.value=this._composite?.init()),this.value}setValue(e,t){"value"!==t?B("Computed","仅允许对value赋值"):"function"==typeof this._setter?this._setter(e):"computed"===this._composite?.effecting||B("Computed","须提供setter")}},le=new WeakMap,ce=new WeakMap;class ue extends ee{static instance;effecter;observer;constructor(){return super("Watcher"),this.observer=new ae(this),this.effecter=new ie(this),ue.instance?ue.instance:ue.instance=this}createProxy(e){let t=!1;const s=b(e,((e,s)=>{"loop"===s&&(t=!0)}));return t?this.observer?.create(s):this.observer?.create(e)}createComputed(e,t){const s=new oe,i=this.createProxy(s);if(y(e,"object")){const{get:t,set:i}=e;"function"==typeof t&&(e=t),"function"==typeof i&&s.initSetter(i)}const n=new te(this,e,t);return s.initComposite(n),n.initComputed(s,i),i}watchEffect(e,t){new te(this,e,t).init()}observe(e={$proxy:{}}){const{$proxy:t,field:s,warn:i=!0,...r}=e,l=Reflect.has(t,o)||Reflect.has(t,a)?"value":s,c=r.hasKey=y(l,["number","string"]);if(t[n]){const e=new re(t,l,r);if(c){const s=z(le,t,[]),i=l;s[i]=s[i]||[],s[i].push(e),le.set(t,s)}else{const s=z(ce,t,[]);ce.set(t,s),s.push(e)}return e}if(!i)return Q(e);if("function"==typeof i){const e=r.done,s=i(t,l);return e?e(s):s}console.warn("$proxy:需要定义为响应式对象")}bind(e,t,s,{cb:i}){if(!y(s,["number","string"])){const n=s,r=this.createProxy(n);return r[l]=e,"function"==typeof i?i(r):t&&(e[t]=r),r}e[t]=s}update(e,t,s){z(le,e,(e=>{const i=e[t];Array.isArray(i)&&i.forEach((e=>e.resolve(s)))})),this.resolveParent(e)}resolveParent(e){z(ce,e,(t=>{Array.isArray(t)&&t.forEach((t=>t.resolve(e)))}));const t=e[l];t?.[n]&&this.resolveParent(t)}}let he=1,de="jiess";const fe=class extends ee{ctx;expose={};isDestory=!1;constructor(e,t){super("JsRender"),this.ctx=e,this._buildNode(t)}_buildNode({config:e,data:t}){t.is=Ie(t.is),this[i]=E(t.is,!0,i),this._resData=this._initParam(t),this._resConfig=this._initParam(e);const{$ref:s}=this._resConfig;"function"==typeof s?this.ctx.nextTick((()=>{m((()=>s(this.expose,this)))})):y(s,"object")&&s[a]&&(s.value=this.expose)}_initParam(e){const t={};for(const s in e){const i=e[s];y(i,["object","array"])?this._analyObserve(t,i,s):t[s]=i}return t}_analyObserve(e,t,s){const n=this.ctx._slotRender;if("$if"!==s&&"$elseIf"!==s&&this[i])e[s]=t;else if(Z(t))if(W(t.$proxy)){const i=(t=this.ctx._observe(t)).result;e[s]="children"===s?n.initNodes(i):i,t.observe(((t,i)=>{this.isDestory||("children"===s?(H(i),e[s]=n.initNodes(t)):e[s]=t,this.ctx.forceUpdate())}))}else e[s]=Q(t);else e[s]="children"===s?n.initNodes(t):t}_initKey(e,t){return y(e,"object")&&$(e.key)&&(e.key=x(t)?`${de}_${t}`:"auto_"+he++),e}_injectKey({J_uid:e}){let{key:t}=this._resData;if(t){if("string"==typeof t){if(t.startsWith("_static_"))return;if(Number(t.split("_")[1])===e)return}}else t=this.J_uid;this._resData.key=`${de}_${e}_${t}`}getNative(e){const{ctx:t,_resData:s}=this,{component:n,_slotRender:r}=t,{is:a,key:o,children:l,...c}=s;if(E(a,!0,i)){if(!this._vnode){const{jiessEnv:t}=n,{slot:s,...i}=c,r=this._initKey({is:a,key:o,slot:s},e);this._vnode=t.createVNode(r,(()=>(this.component=new ke(a,t),{NativeComponent:this.component.start(i,l,this),component:this.component})))}return this._vnode}return r.toRender(this,e)}destory(){this.isDestory||(this.isDestory=!0,this[i]?this.component&&H(this.ctx._nodes):H(this._resData.children))}},pe=[];class me extends ee{contextParam;static instance;$env="";$render;$moTag="div";JiessComponent;constructor(e={},t){super("Jiess"),this.contextParam=t,Object.assign(this,e),me.instance=this}static addCtx(e){pe.push(e)}static removeCtx(e){pe.splice(pe.indexOf(e),1)}static useCtx(){return pe[pe.length-1]}useInjects(e){if(this.contextParam){const{$page:t,...s}=this.contextParam;return"function"==typeof t&&(s.$page=t.call(e,this)),s}}}const ye=me,ge=class extends ee{ctx;constructor(e,t){super("Attrs"),this.ctx=e,this.config={},this.data={},this.init(this.initAttrs(t))}initAttrs({...e}={}){const t=e.class||e.className,{env:s}=this.ctx.component.jiessEnv;return t&&(delete e.class,delete e.className,e["vue3"===s?"class":"className"]=t),e}init(e){const{env:t}=this.ctx.component.jiessEnv,{children:s,...i}=function(e,t){const{$mergeAttrs:s,...i}=t;return Object.assign(i,s?.[e])}(t,e);var n,r,a;return n=["$if","$ref","$elseIf","$name","$show","$slots","$render","$observe","$slotData","$mergeAttrs"],r=i,a=this.config,n.forEach((e=>{r.hasOwnProperty(e)&&(a[e]=r[e],delete r[e])})),x(s)&&(i.children=s),this.data=i,this}},be=new WeakMap,$e=class extends ee{ctx;attrs;constructor(e,t){if(super("Done"),this.ctx=e,this.attrs=t,be.has(t))return be.get(t);be.set(t,this)}beginSetup(e){const{ctx:t}=this,s={},{setup:i,props:n,name:r}=e,o=new ge(t,this.attrs);s.$param=o.data,s.$props=function(e,t,s=""){if(t){let i="",n={};return s&&(i=`${s} 组件 `),F(t,"function",(()=>{let s=t();F(s,"object",(()=>{for(let t in s){const r=s[t];let o,l=!1,c=null,u=!1,h=!1;if("string"==typeof r)c=r;else if("object"==typeof r){const e=r;c=e.type,o=e.default,h=!!e.isRef,l=!!e.required,u=!!e.isResponsive}l&&!e.hasOwnProperty(t)&&B(`${i}${t}`,"必须");const d=e=>{if(void 0!==e)return"string"!=typeof c||y(e,c)||B(`${i}${t}`,`须提供 ${c} 类型`),e},f=e=>e&&"object"==typeof e&&e[a],p=e.hasOwnProperty(t)?e[t]:o;u&&!W(p)&&B(`${i}${t}`,"须提供 Jiess 响应式数据"),f(p)?(d(p.value),n[t]=p):void 0!==p&&h?B(`${i}${t}`,"须提供 JiessRef 响应式数据"):n[t]=d(p)}}),`${i}Props 返回`)}),`${i}Props 定义`),n}return{...e}}(o.data,n,r),t.expose(s),F(i,["function","asyncFunction"],(()=>{ye.addCtx(t),i.call(t,s.$props,s.$param),ye.removeCtx(t)}),"setup函数")}buildRender(e=this.attrs){return this.jsRender&&!this.jsRender.isDestory||(this.jsRender=new fe(this.ctx,new ge(this.ctx,e))),this.jsRender}},xe=class extends ee{ctx;children;constructor(e,t){super("SlotRender"),this.ctx=e,this.children=t}initNodes(e){return $(e)?e:[e].flat(1/0).filter((e=>x(e))).map((e=>{if("function"==typeof e)return e;if("object"!=typeof e)return e+"";if(!("$slot"in e))return U(e)?e:new $e(this.ctx,e).buildRender();{const{$slot:t="default",...s}=e,{slots:i,baseCnf:n}=this.initSlots(t,s);if(x(i))return this.initNodes(i);if(y(s,"object"))return this.initNodes(n)}}))}initSlots(e="default",{$slotData:t,...s}={}){const{$slots:i}=this.ctx.PJR?._resConfig||{};if(i&&"object"==typeof i){let n=i[e];return y(n,"function")&&(n=n.call(this.ctx,t)),"default"===e&&x(this.children)&&(n=x(n)?n:this.children),{baseCnf:s,slots:n}}return{baseCnf:s,slots:this.children}}toRender(e,t){const{$moTag:s,$env:i}=this.ctx.jiess,{is:n=s,children:r,...a}=e._resData;e._initKey(a,t);const o=this.getSlots(a,r,e);return"JiessFragment"===n?"vue3"===i?o.default.call(this):o:this.$h(n,a,o,e)}$h(e,t,s,i){const{jiessEnv:n}=this.ctx.component;return n.createElement(e,t,s,i)}getSlots(e,t,s){const{ctx:i}=this,{env:n}=i.component.jiessEnv,r=e=>{const t=this.initNodes(e);return L(t,(e=>e._injectKey(s))),Y(t)};let{$slots:a}=s._resConfig||{};if("react"!==n){e.scopedSlots=e.scopedSlots||{};const s=e.scopedSlots;a={...a};let o={};for(let e in a){let t=a[e];"vue2"===n?"function"==typeof t?s[e]=e=>r(t.call(i,e)):o[e]=r(t):o[e]=e=>r(y(t,"function")?t.call(i,e):t)}return o.hasOwnProperty("default")||("vue2"===n?s.hasOwnProperty("default")||x(t)&&(o.default=r(t)):x(t)&&(o.default=()=>r(t))),"vue2"===n?Object.values(o).flat(1/0):o}if(x(t)){let e=r(t);return e.length>1?e:e[0]}}};function ve(e,t=1/0,s){const{_provideData:i,PJR:n}=s?.ctx||{},r=i;return y(r,"object")&&r.hasOwnProperty(e)?r[e]:n&&t>0?ve(e,--t,n):null}const we=class extends ee{component;PJR;$obs={};_provideData={};_slotRender;_nodes=[];_lifts={beforeRender:[],beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[]};constructor(e,t,s,i){const{IS:n,jiessEnv:r}=e;super("Context",(e=>r.jiess.useInjects(e))),this.component=e,this.PJR=i,this.jiess=r.jiess,this._slotRender=new xe(this,s),new $e(this,t).beginSetup(n)}forceUpdate(){this.component.frame?.forceUpdate()}onBeforeRender(e){this._lifts.beforeRender.push({fn:e,once:!1})}onBeforeMount(e){this._lifts.beforeMount.push({fn:e,once:!1})}onMounted(e){this._lifts.mounted.push({fn:e,once:!1})}onBeforeUpdate(e,t=!1){this._lifts.beforeUpdate.push({fn:e,once:t})}onUpdated(e,t=!1){this._lifts.updated.push({fn:e,once:t})}onBeforeUnmount(e){this._lifts.beforeUnmount.push({fn:e,once:!1})}nextTick(e){switch(this.jiess.$env){case"vue3":this.jiess.nextTick(e);break;case"vue2":this.component.frame?.$nextTick(e);break;default:$(e)}}add(...e){return this._nodes=[...this._nodes,...this._slotRender.initNodes(e)],this}native(...e){return Y(this._slotRender.initNodes(e))}provide(e={}){Object.assign(this._provideData,e)}inject(e,t){return ve(e,t,this.PJR)}expose(e){this.PJR&&Object.assign(this.PJR.expose,e)}_buildVNodeTree(){let e=Y(this._nodes);return this._lifts.beforeRender.forEach((t=>{"function"==typeof t.fn&&(e=t.fn(e)||e,t.once&&delete t.fn)})),e}_observe({key:e,...t}){const{$proxy:s,field:i="value"}=t;let n=null;if(e&&"string"==typeof e){this.$obs[e]=this.$obs[e]||new WeakMap;const r=this.$obs[e].get(s)||{};Reflect.has(r,i)&&(t={defaultValue:r[i].result,...t}),n=r[i]=(new ue).observe(t),this.$obs[e].set(s,r)}else n=(new ue).observe(t);return n}},ke=class extends ee{IS;jiessEnv;cpn;ctx;frame;frameProps={};constructor(e,t){super("Component"),this.IS=e,this.jiessEnv=t,this[i]=!0}start(e={},t,s){return this.cpn=this.cpn||this.component(e,t,s)}component(e,t,s){return this.jiessEnv.component(this,(()=>{const i={...e};return this.ctx=new we(this,i,t,s),e=>{this.ctx._lifts[e].forEach((e=>{"function"==typeof e.fn&&(e.fn(),e.once&&delete e.fn)}))}}))}},Pe=new WeakMap,je=new WeakMap,Ce={},Se=E;function Te(e,t,s){const i={};t&&("object"==typeof t?Object.assign(i,t):i.field=t);const n=(new ue).observe({$proxy:e,...i});E(n,"Observe")&&n.observe(s)}const Re=(e,t="async")=>F(e,"function",(()=>(new ue).watchEffect(e,t))),_e=e=>W(e);function Ae(e){return De({value:e,[a]:!0})}function De(e){return F(e,["Object","Array"],(()=>{let t=null;return Pe.has(e)?t=Pe.get(e):(t=(new ue).createProxy(e),Pe.set(e,t)),t}))}function Oe(e,t="async"){return F(e,["Object","Function"],(()=>{let s=null;return je.has(e)?s=je.get(e):(s=(new ue).createComputed(e,t),je.set(e,s)),s}))}function Ve(e,t){F(e,"string"),Ce[e]=t}function Ie(e){return Ce[e]||e}function Be(e,t,s,i={}){return(new ue).bind(e,t,s,i)}function Ee(e,t,s){const n=new ye(J(t),s);return new e(n,(({is:e,setup:t,jiessEnv:s})=>{if(E(e,!0,i));else{if("function"!=typeof t)throw new Error("须提供(组件is)或(setup函数)");e={isJiess:!0,name:"JiessComponent",setup:t}}return new ke(e,s)})),n}const Ne=/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,Fe=/^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$/,Je={ruleData:{card:e=>({exp:[Ne,Fe],msg:"身份证号校验不通过"})}},Me={rowKey:"id",fieldPage:"page",fieldPageSize:"limit",fieldTotal:"total",fieldDatas:"list",defaultPage:1,defaultPageSize:10,defaultTotal:0,defaultDatas:[],boxParam:void 0,initLayout:void 0},Ke=void 0,qe={_ruleConfig:Je,_SuperTable:Me,_ProPager:Ke,_ProTable:void 0,_FilterLayout:{model:"divider"},_SwitchEnv:{envs:{local:{label:"本地环境",protocol:"http:",hostname:"127.0.0.1",port:"9007",pathname:"api"},development:{label:"研发环境",protocol:"http:",hostname:"121.37.217.25",port:"9007",pathname:"api"},test:{label:"测试环境",protocol:"http:",hostname:"121.37.195.250",port:"9007",pathname:"api"},preview:{label:"预览环境",protocol:"http:",hostname:"121.37.195.250",port:"9007",pathname:"api"},production:{label:"生产环境",protocol:"http:",hostname:"121.37.217.25",port:"9007",pathname:"api"}}}},ze=/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,Ue=/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;class Le{area;config;rules=[];ruleData;constructor(e,t={}){this.area=e,this.config=t,this.ruleData=this.getRuleData()}buildByFn(e,t){return{trigger:["blur","submit"],validator:async(s,i,n)=>{const r=await e(i,t);return this.area.hook.hookBuildRule(r,n)}}}getRuleData(){const{config:e}=this,t={},{ruleData:s}=Je;if(s)for(let e in s){const i=s[e];t[e]=e=>"function"==typeof i?this.buildByFn(i,e):i}return{required:t=>({required:!0,message:`${t} 必填`,...e}),range:(t,s,i)=>({min:s,max:i,message:`${t} 长度控制在${s}到${i}`,...e}),requireArr:e=>this.buildByFn((t=>{if(!Array.isArray(t)||!t?.length)return`${e} 需要非空数组`}),e),email:e=>this.buildByFn((t=>{if(!ze.test(t))return`${e} 邮箱格式有误`}),e),phone:e=>this.buildByFn((t=>{if(!Ue.test(t))return`${e} 手机格式有误`}),e),...t}}init(e,t=""){if(Array.isArray(e))return e.map((e=>"string"==typeof e?this.ruleData[e](t):Array.isArray(e)?this.ruleData.range(t,...e):"function"==typeof e?this.buildByFn(e,t):e))}}const He=class{area;config={};staticValues={};initialValues={};fieldsSet=new Set;fieldsMap=new Map;values={};constructor(e){this.area=e,this.area=e}init({initialValues:e,staticValues:t,...s}={initialValues:{},staticValues:{}}){this.config=s,this.area.nameManger=this,this.staticValues={...t},this.initialValues={...e},this.values=this.area.hook.hookInitValues(this)}getBaseValues(){return{...this.staticValues,...this.initialValues}}getInputValue(e){const t=e,s=this.getBaseValues();if(Reflect.has(s,t))return s[t]}input(e,{defaultValue:t}={}){const{fieldsMap:s,fieldsSet:i,area:n}=this;if(!e)return;if("object"==typeof e){if(s.has(e))return s.get(e)}else if(i.has(e))return e;let r,a;const o=this.getBaseValues();if(Array.isArray(e))r=e.join("__"),a=e.every((e=>Reflect.has(o,e)))?e.map((e=>this.getInputValue(e))):[],s.set(e,r);else if("object"==typeof e){const{config:t}=e;if(!t)throw new Error("name为配置对象时,需定义config属性");a=[];const i=e=>{const t=[];return(e=Array.isArray(e)?e:[e]).forEach((e=>{const{inputField:s,inputDone:i}=e;let n=this.getInputValue(s);"function"==typeof i&&(n=i(n,o)),t.push(s),a.push(n)})),t.join("__")};r=i(t),Array.isArray(t)||(a=a[0]),s.set(e,r)}else i.add(r=e),a=this.getInputValue(e);const{ctx:l,hook:c}=n,u=void 0===a?t:a;return c.hookNameMangerInput(this.values,r,u,l),r}async output({...e}=this.values){for(let[t,s]of this.fieldsMap){const i=e[s];if(delete e[s],Array.isArray(t))Array.isArray(i)&&t.forEach(((t,s)=>e[t]=i[s]));else{if(!t.config)throw new Error("name为配置对象时,需定义config属性");const s=async(t,s)=>{const{inputField:n,outputField:r,outputDone:a}=t;let o=i;Array.isArray(i)&&(o="number"==typeof s?i[s]:i),"function"==typeof a&&(o=await a(o,e)),e[r||n]=o};Array.isArray(t.config)?await Promise.all(t.config.map(s)):await s(t.config)}}return e}},Ge=e=>e&&"object"==typeof e,We=(e,t,i=s)=>Ge(e)&&e[i]===t,Ze=(e,t)=>{if(Z(e)){const{$proxy:s,done:i,field:n,...r}=e,a=s[n||"value"];return t&&Te(s,{done:i,field:n,...r},t),"function"==typeof i?i(a):a}return e};function Qe(e,t,s=[]){for(const i of e){const e=[...s,i.value];if(i.value===t)return e;if(Array.isArray(i.children)){const s=Qe(i.children,t,e);if(s)return s}}}const Xe=(e,t,s="label")=>{const i=[];if(!Array.isArray(t)){const i=Qe(e,t);return i&&Xe(e,i,s)}return t.forEach((t=>{const n=e.find((e=>e.value===t));n&&(i.push(n[s]),e=n.children)})),i},Ye=e=>{if(Ge(e)){const t=e;if(t._isJiessRef||t._isJiessComputed)return t.value}return e};function et(e,t){const s=e.indexOf(t),i=e.substring(0,s),n=e.slice(s+t.length);return s>-1?this.native({is:"b",children:[i,{is:"span",children:t,style:{color:"#FF6666"}},n]}):e}function tt(e,t,s){return e?.map((e=>{let i=!1,{children:n,...r}=e;if(Array.isArray(n)&&n.length){let e=tt.call(this,n,t,s).filter((e=>e));if(e.length&&(i=!0,r.children=e),r[s].includes(t)&&(i=!0,r[s+"_text"]=r[s],r[s]=et.call(this,r[s],t)),!i)return}else r[s].includes(t)&&(i=!0,r[s+"_text"]=r[s],r[s]=et.call(this,r[s],t));return i&&r}))}function st(e,t,s=1,i){const n={display:"-webkit-box",WebkitBoxOrient:"vertical",overflow:"hidden",WebkitLineClamp:s,textOverflow:"ellipsis",wordBreak:"break-all"};let r="onMouseenter";return"react"===this.jiess.$env&&(r="onMouseEnter"),{style:1===s?{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}:n,children:t,[r]:({target:t})=>{if(1===s){const{scrollWidth:s,clientWidth:i}=t;e.disabled=s<=i}else{const{scrollHeight:s,clientHeight:i}=t;e.disabled=s<=i}},...i}}const it=class{area;constructor(e){this.area=e}getFieldValue(e){return this.area.formOper?.getFieldValue(e)}getFieldsValue(){return this.area.formOper?.getFieldsValue()}setFieldValue(e,t){this.area.formOper?.setFieldValue(e,t)}setFieldsValue(e){this.area.formOper?.setFieldsValue(e)}validateField(e){return this.area.formOper?.validateField(e)}validateFields(){return this.area.formOper?.validateFields()}resetFields(){this.area.formOper?.resetFields()}scrollToField(){this.area.formOper?.scrollToField()}value(e=!0){return new Promise((async(t,s)=>{const{nameManger:i,formOper:n}=this.area;let r={};if("boolean"==typeof e)try{r=e?await(n?.validateFields()):await(n?.getFieldsValue())}catch(e){return void(e&&console.warn("【获取表单数据】",e))}else e&&"object"==typeof e?r=e:s("须提供数据对象才可解析");t(await i.output(r))}))}},nt=class{func;otherAttrs={};constructor(e){this.func=e}_buildLevel(e,t,s=0){const{$if:i,$show:n,$elseIf:r,...a}=e;if(t[s]){const{is:o,isEnd:l,fieldHas:c,fieldInject:u,fieldParam:h,fieldPicks:d,useOtherAttrs:f,...p}=t[s];if(l)return this.func(e,p);const m=(()=>{if(c){const e=a[c.field];return delete a[c.field],"boolean"==typeof e?e:c.default}return!0})(),y=(()=>{if(h){const e=a[h.field]||h.default;return delete a[h.field],{...e}}})();d?.forEach((e=>{e&&a.hasOwnProperty(e)&&(y[e]=a[e],delete a[e])}));const g=s+1;let b={$if:i,$show:n,$elseIf:r};if(t[g]||(this.otherAttrs=a),m){b={is:o,...b,...y};const e=this._buildLevel(a,t,g);return b.children?b.children=[b.children,e]:b.children=e,"function"==typeof u&&(b=u(this,b,a)||b),"function"==typeof f&&f(b,this.otherAttrs),b}return this._buildLevel({...b,...a},t,g)}return this.func(e)}},rt=class extends nt{hook;ctx;exec;[s]="AreaBuilder";formOper={};other={};nameManger;collect=[];param={};constructor(e,t,s){super((()=>this.collect.flat(1/0).map((e=>We(e,"ItemBuilder")?e.useArea(this):e)))),this.hook=e,this.ctx=t,this.nameManger=new He(this),this.exec=I(t),this.nameManger.init(s)}init(){const{spaceParam:e,ruleConfig:t={},hasRule:s=!0,gutter:i=8,span:n=8,...r}=this.nameManger.config;return r.spaceParam={span:n,gutter:i,...e},this.param=Object.assign({rule:new Le(this,t),childsProxy:De({}),hasRule:s},r),this.hook.hookNameManger(this),this}reload(e){this.nameManger.init(e),this.init(),this.ctx._nodes.length=0;const t=this.done();return this.ctx.forceUpdate(),t}render({is:e,...t}){return this.hook.itemBuilder({is:e},t)}add(...e){return this.collect.push(...e),this}done(e=!0){const{ctx:t,param:s}=this,i=this.hook.levelsArea(),n=new it(this),r=this._buildLevel({...s},i);return e?(t.add(r),n):{node:r,action:n}}},at=["Select","SelectGroup","CheckboxGroup","RadioGroup","RadioButtonGroup"],ot=class{itemBuilder;[s]="PreviewManger";className=[];constructor(e){this.itemBuilder=e}initClassName(e){this.className=e?[e].flat(1/0):[]}buildByName(e,t){let{className:s}=this;return t&&(s=[...s,t]),e.className=s,e}buildNode({name:e,children:t,className:s,$mode:i,$slots:n,$brother:r,$preview:a,...o}){const{hook:l,param:c,area:u,cpts:h={}}=this.itemBuilder,{mark:d,proxyChildren:f,optionBuilder:p,valueBuilder:m}=c;if(!u)return[];const{childsProxy:g}=u.param,b=(e,t)=>{const s=e.find((e=>e.value===t));return"antd"===l.uiName?s?s.children:"":s?s.label:""};if(this.initClassName(s),e&&f&&(g._initialTarget[e]=t,t={$proxy:g,field:e}),h.is?.isJiess&&(h.$area=u),"preview"===u?.param.mode)if(this.className.push("jiess-item_preview"),"edit"===i)o=this.buildByName({children:t,...h,...o},"jiess-item");else if(e){o.name=e;const s=l.hookProxyValue(u,o),i=e=>{const t=this.buildByName({is:l.$c.$TipText,text:e});return y(a,"object")&&Object.assign(t,a),t};if("function"==typeof a)o=a(s,t);else if("function"==typeof m)o=i(m.call(this,o,s));else if(at.includes(d)){const e=De({textValue:""}),n=(t,s)=>{"function"==typeof p&&(s=p.call(this,s)),Array.isArray(t)?e.textValue=t.map((e=>b(s,e))).filter((e=>!!e)).join():e.textValue=b(s,t)};let r=Ze(s,(e=>n(r=e,a))),a=Ze(t,(e=>n(r,a=e)));n(r,a),o=i({$proxy:e,field:"textValue"})}else o=i(s)}else o=this.buildByName({children:t,...o});else o=this.buildByName({children:t,...h,...o},"jiess-item");return n&&(o.$slots=n),r?[o,r]:o}};let lt=1;const ct=class extends nt{hook;info;J_uid=lt++;ctx;[s]="ItemBuilder";cpts={};setValue;param={};area;itemParam={};previewManger;constructor(e,t=[],s){super((e=>this.previewManger.buildNode(e))),this.hook=e,this.info=s,this.previewManger=new ot(this),Array.isArray(t)?(this.cpts=t[0],this.param=t[1]||{}):(this.cpts=t,this.param={})}call(e,t,s={}){const i=this;return this.ctx=e,{$itemBuilder:this,is:e.jiess.JiessComponent,setup(){const{name:e="value",...n}=s,{hook:r,previewManger:a}=i;e&&(i.info.$name=e,n.initialValues=n.initialValues||{},n.initialValues[e]=t,i.setValue=t=>{o.nameManger.values[e]=t});const o=i.area=this.area(n),l=r.hookItemCall(i);this.add(a.buildNode(l))}}}useArea(e){this.area=e,this.ctx=e.ctx;const t=this.hook.hookItemCall(this),s=this.hook.levelsItem();return this._buildLevel(t,s)}};const ut=class extends ee{instance;components;exec;constructor(e,t){super("BaseTan"),this.instance=e,this.components=t,this.exec=I(this)}static initInstance(e){return(t,...s)=>t?"string"==typeof t?e[t](...s):e.open(t,...s):e}onClick(e,t,s){return()=>"function"==typeof t?t.call(e,s):s()}},ht=class extends ee{ctx;hook;initNode;childs;constructor(e,t,s){super("Dialog"),this.ctx=e,this.hook=t,this.initNode=s,this.childs=De([])}open(e,...t){const{childs:s}=this,i=Ae(!0);return Te(i,"value",(e=>!e&&this.close())),s.push(this.initNode(i,e,...t)),i}close(e){"number"==typeof e?this.childs.splice(e,1):this.childs.pop()}closeAll(){this.childs.length=0}};let dt=null;const ft=(e,...t)=>{if("function"!=typeof e)return dt;dt?.open(e,...t)},pt=(e,t,s="id")=>{Array.isArray(e)&&t.splice(0,1/0,...e.flat(1/0).filter((e=>e)).map(((e,t)=>(Reflect.has(e,"key")||(e.key=e[s]||t),"function"==typeof s&&s(e,t),e))))},mt=class{midder;debounces;queue;listenerCache;doneCache;constructor(e){this.midder=e,this.debounces={},this.queue={},this.listenerCache={},this.doneCache={}}clean(e,t){if("string"==typeof e)if(t){const s=this.listenerCache[e];Array.isArray(s)&&s.splice(s.findIndex((e=>e.tag===t)),1)}else delete this.listenerCache[e];else this.listenerCache={}}addListener(e){const{tag:t,name:s}=e;this.debounces[s]=this.debounces[s]||C();const i=this.listenerCache[s]=this.listenerCache[s]||[];if("string"==typeof t){const s=i.findIndex((e=>e.tag===t));s>-1?i.splice(s,1,e):i.push(e)}else i.push(e)}addDones(e){const{midder:t,doneCache:s}=this,{name:i}=e;t.isDebounce&&this.debounces[i]?(s[i]||(s[i]=()=>{this.debounces[i]((()=>{delete s[i],this.done(e)}))}),s[i]()):this.done(e)}async done(e){let{name:t,defaultValue:s}=e,{queue:i,midder:n,listenerCache:r}=this,{$results:a}=n,o=null;if(Array.isArray(r[t]))try{for(let s of r[t])await s.done(e)}catch(e){o=e||"执行异常"}else a[t]=n.result=s;if(Array.isArray(i[t]))for(let e of i[t])o?e.reject(o):e.resolve(a[t]);delete i[t]}},yt=class{midder;tag;fn;name="useDefaultKey";constructor(e){this.midder=e}init(...e){const{model:t}=this.midder;let s;return"multiple"===t||"no-store"===t?(this.name=e[0],s=e[1]):s=e[0],y(s,"object")&&"function"==typeof s.listener?("string"==typeof s.tag&&(this.tag=s.tag),this.fn=s.listener):"function"==typeof s?this.fn=s:B("Midder","未提供监听器"),this}async done(e){let{fn:t,name:s,midder:i}=this;try{let{defaultValue:n,args:r}=e,a=await(t?.call(i,n,...r));return void 0===a&&(a=n),i.$results[s]=i.result=a,e.defaultValue=a}catch(e){return Promise.reject(e)}}},gt=class{midder;tag;name="useDefaultKey";defaultValue;args;constructor(e){this.midder=e,this.args=[]}init(...e){const{model:t}=this.midder;let s;return"multiple"===t||"no-store"===t?(this.name=e[0],s=e[1],this.args=e.slice(2)):(s=e[0],this.args=e.slice(1)),y(s,"object")&&s.hasOwnProperty("defaultValue")?("string"==typeof s.tag&&(this.tag=s.tag),this.defaultValue=s.defaultValue):this.defaultValue=s,this}start(){const{tag:e,name:t,midder:s}=this,{queue:i}=s.$listenerStore;return new Promise(((s,n)=>{const r=i[t]=i[t]||[];if("string"==typeof e){const t=r.find((t=>t.tag===e));t?(t.resolve=s,t.reject=n):r.push({resolve:s,reject:n,tag:e})}else r.push({resolve:s,reject:n})}))}},bt={},$t=new WeakMap,xt=class extends ee{reference;model;isDebounce;$jiess;$watchEffects;result;$results;$listenerStore;constructor(e,t,s,i=!0){if(super("JiessMidder"),this.reference=t,this.model=s,this.isDebounce=i,this.$jiess=e,this.$watchEffects={},this.result=null,this.$results={},this.$listenerStore=new mt(this),"no-store"!==s){if(y(t,["symbol","string","number"])){return bt[t]||(bt[t]=this)}return $t.get(t)||($t.set(t,this),this)}}watchEffect(e,t,s={}){this.$watchEffects[t]||(this.$watchEffects[t]=!0,this.$jiess.$watchEffect(e,s))}clean(e,t){this.$listenerStore.clean(e,t)}addListener(...e){const t=new yt(this).init(...e);this.$listenerStore.addListener(t)}dispatch(...e){const t=new gt(this).init(...e),s=t.start();return this.$listenerStore.addDones(t),s}};async function vt(e,t){const{fieldPage:s,fieldPageSize:i,fieldTotal:n,fieldDatas:r,defaultTotal:a}=t.JiessTableConfig,{pager:o,proxy:l,filter:c,table:u}=t;try{const{page:t,pageSize:h,...d}=o.values,f={...c.values,...u.values,...d};f[s]=t,f[i]=h;for(const e in f){const t=f[e];"string"==typeof t&&(f[e]=t.trim())}const p=await e(f);return l.datas=p?.[r],l.total=Number(p?.[n]||a),f}catch(e){console.error("列表数据异常:",e)}}async function wt(e,{filter:t,table:s,proxy:i}){try{const n={...t.values,...s.values};return i.datas=await e(n),n}catch(e){console.error("列表数据异常:",e)}}const kt={add:"新增",edit:"编辑"};function Pt(e){return(t,s,{type:i,title:n,param:r,...a}={})=>{const{record:o={},...l}=a;return new Promise((a=>{const c=i;i&&!e[c]&&(e[c]={}),this.$tan({title:n||kt[c],children:{is:t,type:i,midder:e,record:o,...l},onOk:async t=>{let{action:n,actions:r,httpParam:o}=e[c];n&&(r=[n]);let l={};r&&(l=await Promise.all(r.map((e=>e.value()))).then((e=>e.reduce(((e,t)=>Object.assign(t,e)),{}))));const u=`${i}TanHttpBefore`;l=await e.dispatch(u,{tag:u,defaultValue:l}),l=Object.assign(l,o),await s(l,t),e.table.reload(),a(),t()},...r})}))}}const jt=class{$m;$c;ui;jiess;uiName="未初始化";levelsArea=p;levelsItem=p;constructor(e,t){this.$m=e,this.$c=t}hookBuildRule(e,t){}hookFormParam(e,t){}hookItemCall(e){}hookFormItem(e,t){}hookInitValues(e){}hookProxyValue(e,t){}areaBuilder(e,t){return new rt(this,e,t).init()}itemBuilder(e,t={}){return new ct(this,e,t)}initValue(e){const{defaultValue:t,...s}=e.param;return"defaultValue"in e.param&&(s.defaultValue="function"==typeof t?t(e.info):t),s}initFormItem(e,t,...s){const i={};if(t){const s={key:t};s[e]=t,Object.assign(i,s)}return Object.assign(i,...s)}hookNameManger(e){}hookNameMangerInput(e,t,s,i){e[t]=s}},Ct=class extends jt{stack="react"},St=class extends Ct{stackVersion="16.8"};var Tt;!function(e){e.React="react",e.Vue2="vue2",e.Vue3="vue3"}(Tt||(Tt={}));const Rt="react";class _t{jiess;env=Rt;constructor(e,t){this.jiess=e,this.initRender(),this.env=e.$env=Rt,e.JiessComponent=e=>{const{is:s,setup:i,children:n,...r}=e,a={is:s,setup:i,jiessEnv:this};return this.createElement(t(a).start(r,n))}}initRender(){const{$render:e}=this.jiess;"function"==typeof e&&(this.jiess.createElement=(...t)=>{try{return e.call(this,...t)}catch(e){console.error("Error in custom createElement:",e)}})}createElement(e,t={},s){const{useRef:i,createElement:n}=this.jiess,{ref:r,...a}=t;return"function"==typeof r&&(a.ref=i(null),r(a.ref)),n(e,a,s)}createVNode({key:e},t){const{NativeComponent:s}=t(this);return this.createElement(s,{key:e})}component(e,t){let s=p;const{useRef:i,useEffect:n,useReducer:r,useTransition:a}=this.jiess;return o=>{let l=!0,c=!0;const u=i(!1),[h,d]=r((e=>u.current=!e)),[f,p]=a(),m=i({forceUpdate:d,startTransition:(()=>{let e=u.current;return t=>{u.current!==e&&(e=u.current,p(t))}})()});return m.current.isPending=f,e.frame=m.current,e.frameProps=o,(e=>{const t=i(!0);t.current&&(t.current=!1,e())})((()=>{s=t(),s("beforeMount")})),n((()=>(l=!1,s("mounted"),()=>{c=!1,s("beforeUnmount")})),[]),n((()=>(l&&s("updated"),()=>c&&s("beforeUpdate")))),e.ctx._buildVNodeTree()}}}function At(){return[{is:this.ui.Form,fieldHas:{field:"hasForm",default:!0},fieldParam:{field:"formParam",default:{}},fieldInject:(e,t)=>this.hookFormParam(e,t),fieldPicks:["size","disabled","class"]},{is:this.ui.Card,fieldHas:{field:"hasCard",default:!0},fieldParam:{field:"cardParam",default:{}},fieldPicks:["children","extra","title","className"],useOtherAttrs:(e,{rule:t,hasRule:s,childsProxy:i,...n})=>{Object.assign(e,n)}},{is:this.$c.$Space,fieldHas:{field:"hasSpace",default:!0},fieldParam:{field:"spaceParam",default:{}},fieldPicks:["span","gutter"]}]}function Dt(){return[{is:this.$c.$SpaceItem,fieldHas:{field:"$hasSpaceItem",default:!0},fieldParam:{field:"$spaceItemParam",default:{}},fieldPicks:["$span"]},{is:this.ui.Form.Item,fieldHas:{field:"$hasFormItem",default:!0},fieldParam:{field:"$formItemParam",default:{}},fieldPicks:["$label","$rules"],fieldInject:(e,{$label:t,$rules:s,...i},{name:n})=>{if(!e.area)return[];i.label=t,i=this.hookFormItem(n,i);const{rule:r,hasRule:a=!0}=e.area.param;return a?i.rules=r?.init(s,t):i.style={marginBottom:0},i}}]}const Ot=class{area;formRef;ctx;constructor(e,t){this.area=e,this.formRef=t,this.ctx=e.ctx}ref(e,...t){const s=this.formRef.current;return s?s[e](...t):Promise.reject("检测到表单已被移除")}initResultValues(e){const{staticValues:t}=this.area.nameManger;for(let s in t)Reflect.has(e,s)||(e[s]=t[s])}getFieldValue(e){return this.ref("getFieldValue",e)}getFieldsValue(){const e=this.ref("getFieldsValue");return this.initResultValues(e),e}setFieldsValue(e){return this.ref("setFieldsValue",e)}setFieldValue(e,t){return this.ref("setFieldValue",e,t)}async validateFields(){try{const e=await this.ref("validateFields");return this.initResultValues(e),e}catch(e){return Promise.reject(e)}}resetFields(){return this.ref("resetFields")}scrollToField(){return this.ref("scrollToField")}},Vt=class extends St{levelsArea=At;levelsItem=Dt;uiName="antd";hookBuildRule(e){return e?Promise.reject(e):null}hookFormParam(e,t){return{ref:t=>e.formOper=new Ot(e,t),initialValues:e.nameManger.values,...t}}hookInitValues(e){const{initialValues:t,staticValues:s}=e;return De({...s,...t})}hookItemCall(e){const{groupConfig:t,defaultValue:s}=this.initValue(e),{$name:i,...n}=e.info,{nameManger:r}=e.area||{};if(i&&(n.name=r?.input(i,{defaultValue:s})),t){const{method:s,groupManger:i}=t;return i[s](e,n)}return n}hookFormItem(e,...t){return this.initFormItem("name",e,...t)}hookProxyValue(e,{name:t}){const{values:s}=e.nameManger;return{$proxy:s,field:t}}hookDialog(e){return{open:!0,is:this.ui.Modal,onCancel:()=>e.value=!1}}};class It extends Vt{static instance;jiess={};ui={};globalConfig={};constructor({ui:e,globalConfig:t,...s}){if(It.instance)return It.instance;super(s,{$identify:y,$clone:b,$watch:Te,$computed:Oe,$reactive:De,$watchEffect:Re,$Space:ns,$SpaceItem:rs,$TipText:Yt}),this.ui=e,this.globalConfig={...qe,...t},It.instance=this}start(e){const t=this.ui.message;"function"==typeof e&&(e=e(this.ui,this.$m,this)),this.jiess=Ee(_t,this.$m,{area:ts,$tan:Vs,dialog:ft,$msg:(e,s="success")=>t[s](e),...e});const s=new xt(this.jiess,"GlobalMidder","no-store");return this.jiess.contextParam.$midder=s,this.jiess}}const Bt=It,Et=class{hook;selectedRowKeys;selectedRows;rowSelection;config;type;constructor(e,t={},s=[],i=[]){this.hook=e,this.selectedRowKeys=s,this.selectedRows=i,this.config="function"==typeof t?t(this)||{}:t,this.rowSelection=Ae({selectedRowKeys:s,type:"checkbox",...this.config,onChange:(e,t,s)=>{this.changeSelection(e,t,s)}})}async changeSelection(e,t,s){const{onChange:i}=this.config;try{await(i?.(e,t,s)),this.selectedRowKeys=e,this.selectedRows=t,this.type=s,this.setKeys()}catch(e){console.error(e)}}addKey(e){this.selectedRowKeys=[...this.selectedRowKeys,e],this.setKeys()}removeKey(e){this.selectedRowKeys=this.selectedRowKeys.filter((e=>!e)),this.setKeys()}addKeys(e){this.selectedRowKeys=[...this.selectedRowKeys,...e],this.setKeys()}removeKeys(e){this.selectedRowKeys=this.selectedRowKeys.filter((t=>!e.includes(t))),this.setKeys()}echoKeys(e=[]){this.selectedRowKeys=e,this.setKeys()}setKeys(){this.rowSelection.value={...this.rowSelection.value,selectedRowKeys:this.selectedRowKeys}}},Nt=({midder:e,hook:t})=>{const{proxy:s}=e,{useState:i,createElement:n}=t.$m,{columns:r=[]}=s;let a=[...r];const[o,l]=i(a);return n(t.ui.Tree,{defaultCheckedKeys:a.filter((e=>!e.hidden)).map((e=>e.key)),checkable:!0,draggable:!0,blockNode:!0,onDrop:e=>{const{dropPosition:t,dragNodesKeys:i}=e,n=a.findIndex((e=>e.key===i[0])),r=a.splice(n,1);-1===t?(console.log("拖拽到最顶部"),a=[...r,...a]):t>n?(console.log("从上往下拖拽"),a=[...a],a.splice(t-1,0,...r)):(console.log("从下往上拖拽"),a=[...a],a.splice(t,0,...r)),l(a),s.columns=a},treeData:o,onCheck:e=>{s.columns=a.map((t=>(t.hidden=!e.includes(t.key),t)))}})},Ft="36px",Jt={right:"30px",bottom:"30vh",color:"white",zIndex:1e4,width:Ft,height:Ft,lineHeight:Ft,fontSize:"18px",cursor:"pointer",position:"fixed",textAlign:"center",borderRadius:"50%",backgroundColor:"#FF6666",boxShadow:"1px 1px 6px #6666"};class Mt extends ut{open({title:e,children:t,onOk:s,onCancel:i,width:n=960,...r}){const{exec:a,instance:o,onClick:l}=this;return o().open((function(o){const c=()=>o.value=!1;return{width:n,title:e,destroyOnClose:!0,onOk:l(this,s,c),children:a(t,[c,o]),onCancel:l(this,i,c),...r}}))}alert({title:e,children:t,onClose:s,button:i={},...n}){const{exec:r,instance:a,onClick:o}=this;return a().open((function(a){const l=()=>a.value=!1,{type:c="primary",text:u="关闭",...h}=r(i,[l,a]);return{title:e,closable:!0,forceRender:!0,destroyOnClose:!0,onOk:o(this,s,l),onCancel:l,okText:u,okType:c,okButtonProps:h,cancelText:"取消",cancelButtonProps:{style:{display:"none"}},children:r(t,[l,a]),...n}}))}}const Kt={};class qt{tag;keys;fn;wait;cache;startTime;constructor(e,t,s=p,i=300){this.tag=e,this.keys=t,this.fn=s,this.wait=i,this.cache={},this.startTime=0,Kt[e]=this}add(e,t){this.checkKey(e,t,(s=>{this.cache[s]=[e,t],this.startTime=Date.now(),this.fn(!0)}))}remove(e,t){this.checkKey(e,t,(e=>{delete this.cache[e];let t=Date.now()-this.startTime;if(!Object.keys(this.cache).length){let e=this.wait-t;e>0?m((()=>this.fn(!1)),e):this.fn(!1)}}))}checkKey(e,t,s){const i=qt.getKey(e,t);this.keys.includes(i)&&s(i)}static getKey(e,t){return`${e}__${t.toLocaleUpperCase()}`}static request(e,t){Object.values(Kt).forEach((s=>s.add(e,t)))}static response(e,t){Object.values(Kt).forEach((s=>s.remove(e,t)))}}const zt=qt,Ut={},Lt=class{req;key;headers;cache;waitTime=0;constructor(e,t){this.req=e;const{waitTime:s=0}=t,{url:i,method:n}=e;this.body=e.body,this.waitTime=s,this.headers=e.headers,this.key=zt.getKey(i,n),this.cache=Ut[this.key]||[],Ut[this.key]=this.cache}add(e){this.cache.push(e)}remove(e){this.cache.splice(this.cache.indexOf(e),1)}start(){return new Promise(((e,t)=>{const{headers:s,body:i}=this;if(!Ut[this.key].some((n=>{if(n.body===i&&JSON.stringify(n.headers)===JSON.stringify(s)){switch(n.status){case 1e3:n.cbs.push({resolve:e,reject:t});break;case 2e3:e(n.value);break;case 3e3:t(n.value)}return!0}}))){const n={cbs:[{resolve:e,reject:t}],key:this.key,status:1e3,value:{},headers:s,body:i};this.add(n),this.req.request().then((e=>{n.value=e,n.status=2e3,n.cbs.forEach((({resolve:t})=>t(e)))})).catch((e=>{n.value=e,n.status=3e3,n.cbs.forEach((({reject:t})=>t(e)))})).finally((()=>{this.waitTime>0?m((()=>this.remove(n)),this.waitTime):this.remove(n)}))}}))}},Ht=class{param;config;url;method;headers;body;httpFetch;constructor(e,t={}){this.param=e,this.config=t;const{method:s="GET"}=e;this.method=s.toLocaleUpperCase(),this.url=this.initFullUrl(),this.headers=this.initHeaders(),this.body=this.initBody()}initFullUrl(){if(this.param.query){const e=this.param.url,t=V.stringify(this.param.query);if(t)return e.includes("?")?`${e}&${t}`:`${e}?${t}`}return this.param.url}initHeaders(){const{headers:e}=this.param,t={};if(e)for(const s in e)t[s.toLocaleLowerCase()]=e[s];return t}initBody(){let e=null;const{body:t,type:s="json"}=this.param,i=e=>{"content-type"in this.headers||(this.headers["content-type"]=e)};return"json"===s?(t&&(e=JSON.stringify(t)),i("application/json")):"form"===s?(t&&(e=V.stringify(t)),i("application/x-www-form-urlencoded")):"text"===s?i("text/plain"):"html"===s?i("text/html"):"string"==typeof s?(this.param.useCache=!1,i(s)):this.param.useCache=!1,!e&&t&&(e=t),e}async initResult(){const{httpBefore:e}=this.config,{method:t,headers:s,body:i}=this,n={method:t,headers:s,body:i};return"function"==typeof e?await e(n):n}async initXHR(e){const{onInitXHR:t}=this.config,{method:s,headers:i}=this,n=new XMLHttpRequest;n.open(s,this.url);for(let e in i)n.setRequestHeader(e,i[e]);return"function"==typeof t?await t(n,e):n}async send(){const{body:e,headers:t}=this,{useCache:s=!0,httpCacheParam:i}=this.param;if(s){const s={headers:t,body:e,...i};return new Lt(this,s).start()}return this.request()}async request(){const{config:e,param:t,url:s}=this,{responseType:i,useFetch:n=!0}=t,r=await this.initResult();return"function"==typeof e.customFetch?e.customFetch(s,r,t).then((e=>({config:t,...e}))):n&&"function"==typeof fetch?await fetch(s,r).then((async e=>{const s=i||"text";if(s in e&&"function"==typeof e[s]){const i=await e[s]();return{config:t,response:e,responseText:i}}return{config:t,response:e}})):new Promise((async(e,s)=>{const n=await this.initXHR(r);n.send(this.body),i?(n.responseType=i,n.onload=()=>{const{status:s,response:i}=n;200===s&&e({responseText:i,config:t,xhr:n})}):n.onreadystatechange=()=>{if(4===n.readyState){const i={responseText:n.responseText,config:t,xhr:n};200===n.status?e(i):s(i)}}}))}},Gt=class{config;method;requestData={url:"",mainURL:"",method:""};interceptors={};constructor(e,t,s){this.config=e,this.method=s,this.initRequestData(t,s)}initRequestData(e,t){const{baseURL:s="",headers:i={},...n}=this.config,{httpCacheParam:r,useFetch:a,useCache:o}=n;this.requestData={url:s+e,useFetch:a,useCache:o,method:t,headers:i,httpCacheParam:r,mainURL:e}}addHeaderData(e={}){return Object.assign(this.requestData.headers,e),this}addRequestData(e={}){return Object.assign(this.requestData,e),this}addInterceptors(e){return this.interceptors=e,this}async toRequest(){try{const e=await this.turnIntercept("request",this.requestData),t=new Ht(e,this.config),s=await Promise.race([this.timeout(),t.send()]);return this.turnIntercept("responseSuccess",s)}catch(e){return console.warn("toRequest捕获异常【@jiess/http】:",e),await this.turnIntercept("responseError",e)}}timeout(){return new Promise(((e,t)=>{m((()=>{t({config:this.requestData,responseText:"请求超时"})}),this.config.timeout)}))}async turnIntercept(e,t){let s=t,i=this.config.interceptors,n=this.in