UNPKG

@jiess/plus

Version:

基于Jiess核心库的强化与拓展,为Jiess应用的完整形态

1 lines 70.8 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JiessPlus=t():e.JiessPlus=t()}(globalThis,(()=>(()=>{"use strict";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),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$ActionButton:()=>rs,$ActionButtons:()=>ns,$Area:()=>Zt,$Autocomplete:()=>us,$Between:()=>es,$Cascader:()=>ws,$Checkbox:()=>gs,$CheckboxGroup:()=>Cs,$ColorPicker:()=>ms,$DatePicker:()=>ds,$DateRange:()=>Ps,$Dynamic:()=>ts,$Input:()=>os,$InputNumber:()=>hs,$JiessDialog:()=>_s,$JiessHttp:()=>Wt,$JiessLoading:()=>Kt,$JiessMidder:()=>bt,$JiessTable:()=>As,$Password:()=>ls,$Radio:()=>bs,$RadioButton:()=>$s,$RadioGroup:()=>Ts,$Scrollbar:()=>Rs,$Search:()=>as,$SearchTree:()=>Js,$Select:()=>Ss,$SlotTree:()=>Es,$Space:()=>ss,$SpaceItem:()=>is,$SuperTable:()=>Ds,$Switch:()=>ys,$SwitchEnv:()=>Vs,$TableFilter:()=>Os,$TableTabs:()=>Bs,$TableTools:()=>Is,$TextArea:()=>cs,$TimePicker:()=>ps,$TimeRange:()=>js,$TimeSelect:()=>fs,$TipText:()=>Qt,$Transfer:()=>ks,$TreeSelect:()=>vs,$baseDebounce1:()=>S,$baseDebounce2:()=>T,$baseThrottle1:()=>_,$baseThrottle2:()=>D,$check:()=>Ce,$clone:()=>b,$component:()=>Be,$computed:()=>Oe,$copy:()=>g,$dateFormat:()=>w,$debounce1:()=>C,$debounce2:()=>R,$diff:()=>h,$entry:()=>Je,$env:()=>Gt,$firstLowerCase:()=>f,$firstUpperCase:()=>d,$getCookie:()=>P,$getUUID:()=>v,$identify:()=>y,$initExecute:()=>B,$initHook:()=>Xt,$isDef:()=>x,$isReactive:()=>_e,$isUndef:()=>$,$nfn:()=>p,$querystring:()=>O,$reactive:()=>Ve,$ref:()=>De,$set:()=>Ee,$setCookie:()=>j,$throttle1:()=>A,$throttle2:()=>V,$timer:()=>m,$toString:()=>k,$useComponent:()=>Ie,$watch:()=>Te,$watchEffect:()=>Re});const s="JIESS_CONSTRUCTOR",i="isJiess",r="THIS_IS_JIESS",n="JIESS_INIT_VALUE",o="_isJiessRef",a="_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),r=Object.keys(t);if(i.length===r.length){let i=e,r=t;if(s){const s=[],n=[];if(i=b(e,(e=>(s.push(e),s.length))),r=b(t,(e=>(n.push(e),n.length))),s.length!==n.length)return!1;if(!s.every(((e,t)=>Object.is(e,n[t]))))return!1}return function(e,t){const s=Object.keys(e),i=Object.keys(t);for(let r of s){if(!i.includes(r))return!1;if(!h(e[r],t[r],!1))return!1}return!0}(i,r)}}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(J(e))return t?.(e,"filter")||e;{const i={};for(const r in e)if(u.includes(r))i[r]=e[r];else if(Reflect.has(e,r)){const n=e[r];i[r]=b(n,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 r=(/(y+)/.exec(t)||[])[1];r&&(t=t.replace(r,s.getFullYear()+""));for(let e in i){const s=i[e]+"",r=(new RegExp("("+e+")").exec(t)||[])[1];r&&(t=t.replace(r,`00${s}`.slice(-r.length)))}return t},k=e=>{let t=0,s={},i=(e,r)=>{if(Array.isArray(r))return r.map((t=>i(e,t)));if("function"==typeof r){let i=`__${t++}__`;return s[i]=r.toString(),s[i].startsWith(e)&&(s[i]=s[i].replace(e,"function")),i}if(y(r,"object")){if(r&&"object"==typeof r&&!Array.isArray(r)){const{$model:e,$done:i,...n}=r;if("template"===e){let e=`__${t++}__`;return s[e]=i(n),e}return n}return r}return r},r=JSON.stringify(e,((e,t)=>e?i(e,t):t),2);for(let e in s)r=r.replace(new RegExp(`"${e}"`),s[e]);return r},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=/`},S=(e=!1)=>{let t;return function(s,i=100){x(t,!0)?clearTimeout(t):e&&s(),t=setTimeout(s,i)}},C=S(),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())}},V=D(),O={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=>t.push(`${s}=${this.initVal(e)}`))):t.push(`${s}=${this.initVal(i)}`)}return t.join("&")},parse(e){const t={};return e.split("&").forEach((e=>{const[s,...i]=e.split("="),r=i.join("=");s in t?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(r)):t[s]=r})),t}},B=function(e,...t){return(s,i=[],r)=>{if("function"==typeof s){let n=null;return n=e?s.call(e,...t,...i):s(...t,...i),void 0===n?r:n}return void 0===r?s:r}},I=(e,t)=>{throw new Error(`${e} Error:${t}`)},E=(e,t,i=s)=>!!y(e,"object")&&Object.is(e[i],t),J=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();I(i,`须提供 ${t} 类型`)}const N=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 I("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 W=new WeakMap;function G(e){return!(!e||"object"!=typeof e||!e[r])}const X=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},Y=e=>{if(X(e)){const{$proxy:t,field:s="value"}=e;return t[s]}return e},Z=(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:r}=s;if(void 0!==i.$show){const e=r.style={...r.style};if(W.has(s)||W.set(s,e.display),i.$show){if("none"===e.display){const t=W.get(s);t?e.display=t:delete e.display}}else e.display="none"}let{$if:n=!0,$elseIf:o}=i;if(n=Y(n),o=Y(o),!x(o,!0))return i.hasOwnProperty("$if")?(t=!!n,n):(t=null,n);if("boolean"==typeof t){const e=o&&!t;return e&&(t=!0),e}I("$elseIf","须配合$if")}}))}(e).map(Z):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=S()}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?I("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(((r=p)=>{"sync"===this.flush?r(this.init(e,t,s,i)):this.debounce1((()=>r(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 r=z(this.mapStore,e);r.hasOwnProperty(t)&&r[t].forEach((r=>r.trigger(e,t,s,i))),this.watcher.update(i,t,s)}},re=(e,t)=>void 0===e?t:e;class ne 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=S();const{hasKey:i,defaultValue:r,observe:n,...o}=s;this.observe(n),this.other=o,this.value=i?e[t]:q(e);const a=this.value=re(this.value,r);this.getValue(((e,t)=>{this.result=e,t&&this.dispatch(e,{value:a,...o})}))}getValue(e){const{value:t,config:s,result:i}=this,{defaultValue:r,done:n}=s;"function"==typeof n?y(n,"AsyncFunction")?(n(t,this).then((t=>e(t,!0))),e(re(i,r))):e(n(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:r,sameState:n=!1}=this.config;if(r){try{n=h(t,e)}catch(e){console.error(e)}if(n)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 oe=class extends ee{watcher;constructor(e){super("Observer"),this.watcher=e}create(e,t){return J(e)&&"Target"!==e[s]?e:F(e,["array","object"],(()=>{const s=new Proxy(e,{get:(e,s,i)=>s===r||("_initialTarget"===s?e:s===l?t:s===Symbol.toStringTag?Array.isArray(e)?"Array":"Object":(this.watcher.effecter.collect(e,s),E(e,!0,a)&&"value"===s?e.getValue():Reflect.get(e,s,i))),set:(e,s,i,r)=>(s===l&&(t=i),!!Object.is(e[s],i)||(this.trigger(e,s,i,r),Reflect.set(e,s,i,r))),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:r}=this.watcher;E(e,!0,a)?e.setValue(s,t):r.trigger(e,t,s,i)}},ae=class extends ee{_setter;_composite;constructor(){super("Target"),this[r]=!0,this.value=n,this[a]=!0}initSetter(e){this._setter=e}initComposite(e){this._composite=e}getValue(){return this.value===n&&(this.value=this._composite?.init()),this.value}setValue(e,t){"value"!==t?I("Computed","仅允许对value赋值"):"function"==typeof this._setter?this._setter(e):"computed"===this._composite?.effecting||I("Computed","须提供setter")}},le=new WeakMap,ce=new WeakMap;class ue extends ee{static instance;effecter;observer;constructor(){return super("Watcher"),this.observer=new oe(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 ae,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 r=new te(this,e,t);return s.initComposite(r),r.initComputed(s,i),i}watchEffect(e,t){new te(this,e,t).init()}observe(e={$proxy:{}}){const{$proxy:t,field:s,warn:i=!0,...n}=e,l=Reflect.has(t,a)||Reflect.has(t,o)?"value":s,c=n.hasKey=y(l,["number","string"]);if(t[r]){const e=new ne(t,l,n);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=n.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 r=s,n=this.createProxy(r);return n[l]=e,"function"==typeof i?i(n):t&&(e[t]=n),n}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?.[r]&&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[o]&&(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 r=this.ctx._slotRender;if("$if"!==s&&"$elseIf"!==s&&this[i])e[s]=t;else if(X(t))if(G(t.$proxy)){const i=(t=this.ctx._observe(t)).result;e[s]="children"===s?r.initNodes(i):i,t.observe(((t,i)=>{this.isDestory||("children"===s?(H(i),e[s]=r.initNodes(t)):e[s]=t,this.ctx.forceUpdate())}))}else e[s]=Q(t);else e[s]="children"===s?r.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:r,_slotRender:n}=t,{is:o,key:a,children:l,...c}=s;if(E(o,!0,i)){if(!this._vnode){const{jiessEnv:t}=r,{slot:s,...i}=c,n=this._initKey({is:o,key:a,slot:s},e);this._vnode=t.createVNode(n,(()=>(this.component=new ke(o,t),{NativeComponent:this.component.start(i,l,this),component:this.component})))}return this._vnode}return n.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 delete e.class,delete e.className,t&&(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 r,n,o;return r=["$if","$ref","$elseIf","$name","$show","$slots","$render","$observe","$slotData","$mergeAttrs"],n=i,o=this.config,r.forEach((e=>{n.hasOwnProperty(e)&&(o[e]=n[e],delete n[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:r,name:n}=e,a=new ge(t,this.attrs);s.$param=a.data,s.$props=function(e,t,s=""){if(t){let i="",r={};return s&&(i=`${s} 组件 `),F(t,"function",(()=>{let s=t();F(s,"object",(()=>{for(let t in s){const n=s[t];let a,l=!1,c=null,u=!1,h=!1;if("string"==typeof n)c=n;else if("object"==typeof n){const e=n;c=e.type,a=e.default,h=!!e.isRef,l=!!e.required,u=!!e.isResponsive}l&&!e.hasOwnProperty(t)&&I(`${i}${t}`,"必须");const d=e=>{if(void 0!==e)return"string"!=typeof c||y(e,c)||I(`${i}${t}`,`须提供 ${c} 类型`),e},f=e=>e&&"object"==typeof e&&e[o],p=e.hasOwnProperty(t)?e[t]:a;u&&!G(p)&&I(`${i}${t}`,"须提供 Jiess 响应式数据"),f(p)?(d(p.value),r[t]=p):void 0!==p&&h?I(`${i}${t}`,"须提供 JiessRef 响应式数据"):r[t]=d(p)}}),`${i}Props 返回`)}),`${i}Props 定义`),r}return{...e}}(a.data,r,n),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:r}=this.initSlots(t,s);if(x(i))return this.initNodes(i);if(y(s,"object"))return this.initNodes(r)}}))}initSlots(e="default",{$slotData:t,...s}={}){const{$slots:i}=this.ctx.PJR?._resConfig||{};if(i&&"object"==typeof i){let r=i[e];return y(r,"function")&&(r=r.call(this.ctx,t)),"default"===e&&x(this.children)&&(r=x(r)?r:this.children),{baseCnf:s,slots:r}}return{baseCnf:s,slots:this.children}}toRender(e,t){const{$moTag:s,$env:i}=this.ctx.jiess,{is:r=s,children:n,...o}=e._resData;e._initKey(o,t);const a=this.getSlots(o,n,e);return"JiessFragment"===r?"vue3"===i?a.default.call(this):a:this.$h(r,o,a,e)}$h(e,t,s,i){const{jiessEnv:r}=this.ctx.component;return r.createElement(e,t,s,i)}getSlots(e,t,s){const{ctx:i}=this,{env:r}=i.component.jiessEnv,n=e=>{const t=this.initNodes(e);return L(t,(e=>e._injectKey(s))),Z(t)};let{$slots:o}=s._resConfig||{};if("react"!==r){e.scopedSlots=e.scopedSlots||{};const s=e.scopedSlots;o={...o};let a={};for(let e in o){let t=o[e];"vue2"===r?"function"==typeof t?s[e]=e=>n(t.call(i,e)):a[e]=n(t):a[e]=e=>n(y(t,"function")?t.call(i,e):t)}return a.hasOwnProperty("default")||("vue2"===r?s.hasOwnProperty("default")||x(t)&&(a.default=n(t)):x(t)&&(a.default=()=>n(t))),"vue2"===r?Object.values(a).flat(1/0):a}if(x(t)){let e=n(t);return e.length>1?e:e[0]}}};function ve(e,t=1/0,s){const{_provideData:i,PJR:r}=s?.ctx||{},n=i;return y(n,"object")&&n.hasOwnProperty(e)?n[e]:r&&t>0?ve(e,--t,r):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:r,jiessEnv:n}=e;super("Context",(e=>n.jiess.useInjects(e))),this.component=e,this.PJR=i,this.jiess=n.jiess,this._slotRender=new xe(this,s),new $e(this,t).beginSetup(r)}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 Z(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=Z(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 r=null;if(e&&"string"==typeof e){this.$obs[e]=this.$obs[e]||new WeakMap;const n=this.$obs[e].get(s)||{};Reflect.has(n,i)&&(t={defaultValue:n[i].result,...t}),r=n[i]=(new ue).observe(t),this.$obs[e].set(s,n)}else r=(new ue).observe(t);return r}},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,Se={},Ce=E;function Te(e,t,s){const i={};t&&("object"==typeof t?Object.assign(i,t):i.field=t);const r=(new ue).observe({$proxy:e,...i});E(r,"Observe")&&r.observe(s)}const Re=(e,t="async")=>F(e,"function",(()=>(new ue).watchEffect(e,t))),_e=e=>G(e);let Ae=1;function De(e){return Ve({value:e,[o]:!0,__uid:Ae++})}function Ve(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 Be(e,t){F(e,"string"),Se[e]=t}function Ie(e){return Se[e]||e}function Ee(e,t,s,i={}){return(new ue).bind(e,t,s,i)}function Je(e,t,s){const r=new ye(N(t),s);return new e(r,(({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)})),r}const Fe=/^[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]$/,Ne=/^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$/,Me={ruleData:{card:e=>({exp:[Fe,Ne],msg:"身份证号校验不通过"})}},Ke={rowKey:"id",fieldPage:"page",fieldPageSize:"limit",fieldTotal:"total",fieldDatas:"list",defaultPage:1,defaultPageSize:10,defaultTotal:0,defaultDatas:[],boxParam:void 0,initLayout:void 0},qe=void 0,ze={_ruleConfig:Me,_SuperTable:Ke,_ProPager:qe,_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"}}}},Ue=/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,Le=/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;class He{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,r)=>{const n=await e(i,t);return this.area.hook.hookBuildRule(n,r)}}}getRuleData(){const{config:e}=this,t={},{ruleData:s}=Me;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(!Ue.test(t))return`${e} 邮箱格式有误`}),e),phone:e=>this.buildByFn((t=>{if(!Le.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 We=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:r}=this;if(!e)return;if("object"==typeof e){if(s.has(e))return s.get(e)}else if(i.has(e))return e;let n,o;const a=this.getBaseValues();if(Array.isArray(e))n=e.join("__"),o=e.every((e=>Reflect.has(a,e)))?e.map((e=>this.getInputValue(e))):[],s.set(e,n);else if("object"==typeof e){const{config:t}=e;if(!t)throw new Error("name为配置对象时,需定义config属性");o=[];const i=e=>{const t=[];return(e=Array.isArray(e)?e:[e]).forEach((e=>{const{inputField:s,inputDone:i}=e;let r=this.getInputValue(s);"function"==typeof i&&(r=i(r,a)),t.push(s),o.push(r)})),t.join("__")};n=i(t),Array.isArray(t)||(o=o[0]),s.set(e,n)}else i.add(n=e),o=this.getInputValue(e);const{ctx:l,hook:c}=r,u=void 0===o?t:o;return c.hookNameMangerInput(this.values,n,u,l),n}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:r,outputField:n,outputDone:o}=t;let a=i;Array.isArray(i)&&(a="number"==typeof s?i[s]:i),"function"==typeof o&&(a=await o(a,e)),e[n||r]=a};Array.isArray(t.config)?await Promise.all(t.config.map(s)):await s(t.config)}}return e}},Ge=e=>e&&"object"==typeof e,Xe=(e,t,i=s)=>Ge(e)&&e[i]===t,Qe=(e,t)=>{if(X(e)){const{$proxy:s,done:i,field:r,...n}=e,o=s[r||"value"];return t&&Te(s,{done:i,field:r,...n},t),"function"==typeof i?i(o):o}return e};function Ye(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=Ye(i.children,t,e);if(s)return s}}}const Ze=(e,t,s="label")=>{const i=[];if(!Array.isArray(t)){const i=Ye(e,t);return i&&Ze(e,i,s)}return t.forEach((t=>{const r=e.find((e=>e.value===t));r&&(i.push(r[s]),e=r.children)})),i};function et(e,t,s){let i=null;return y(e,"AsyncFunction")?e().then(t):y(e,"Function")?e((e=>{i=t(e)??e})):X(e)&&(i=Qe(e,t)),"function"==typeof s?s(i??e):i??e}const tt=e=>{if(Ge(e)){const t=e;if(t._isJiessRef||t._isJiessComputed)return t.value}return e};function st(e,t){const s=e.indexOf(t),i=e.substring(0,s),r=e.slice(s+t.length);return s>-1?this.native({is:"b",children:[i,{is:"span",children:t,style:{color:"#FF6666"}},r]}):e}function it(e,t,s){return e?.map((e=>{let i=!1,{children:r,...n}=e;if(Array.isArray(r)&&r.length){let e=it.call(this,r,t,s).filter(Boolean);if(e.length&&(i=!0,n.children=e),n[s].includes(t)&&(i=!0,n[s+"_text"]=n[s],n[s]=st.call(this,n[s],t)),!i)return}else n[s].includes(t)&&(i=!0,n[s+"_text"]=n[s],n[s]=st.call(this,n[s],t));return i&&n}))}function rt(e,t,s=1,i){const r={display:"-webkit-box",WebkitBoxOrient:"vertical",overflow:"hidden",WebkitLineClamp:s,textOverflow:"ellipsis",wordBreak:"break-all"};let n="onMouseenter";return"react"===this.jiess.$env&&(n="onMouseEnter"),{style:1===s?{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}:r,children:t,[n]:({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 nt=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:r}=this.area;let n={};if("boolean"==typeof e)try{n=e?await(r?.validateFields()):await(r?.getFieldsValue())}catch(e){return void(e&&console.warn("【获取表单数据】",e))}else e&&"object"==typeof e?n=e:s("须提供数据对象才可解析");t(await i.output(n))}))}},ot=class{func;otherAttrs={};constructor(e){this.func=e}_buildLevel(e,t,s=0){const{$if:i,$show:r,$elseIf:n,...o}=e;if(t[s]){const{is:a,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=o[c.field];return delete o[c.field],"boolean"==typeof e?e:c.default}return!0})(),y=(()=>{if(h){const e=o[h.field]||h.default;return delete o[h.field],{...e}}})();d?.forEach((e=>{e&&o.hasOwnProperty(e)&&(y[e]=o[e],delete o[e])}));const g=s+1;let b={$if:i,$show:r,$elseIf:n};if(t[g]||(this.otherAttrs=o),m){b={is:a,...b,...y};const e=this._buildLevel(o,t,g);return b.children?b.children=[b.children,e]:b.children=e,"function"==typeof u&&(b=u(this,b,o)||b),"function"==typeof f&&f(b,this.otherAttrs),b}return this._buildLevel({...b,...o},t,g)}return this.func(e)}},at=class extends ot{hook;ctx;exec;[s]="AreaBuilder";formOper={};other={};nameManger;collect=[];param={};constructor(e,t,s){super((()=>this.collect.flat(1/0).map((e=>Xe(e,"ItemBuilder")?e.useArea(this):e)))),this.hook=e,this.ctx=t,this.nameManger=new We(this),this.exec=B(t),this.nameManger.init(s)}init(){const{spaceParam:e,ruleConfig:t={},hasRule:s=!0,gutter:i=8,span:r=8,...n}=this.nameManger.config;return n.spaceParam={span:r,gutter:i,...e},this.param=Object.assign({rule:new He(this,t),childsProxy:Ve({}),hasRule:s},n),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(),r=new nt(this),n=this._buildLevel({...s},i);return e?(t.add(n),r):{node:n,action:r}}},lt=["Select","SelectGroup","CheckboxGroup","RadioGroup","RadioButtonGroup"],ct=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:r,$brother:n,$preview:o,...a}){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)a=this.buildByName({children:t,...h,...a},"jiess-item");else if(e){a.name=e;const s=l.hookProxyValue(u,a),i=e=>{const t=this.buildByName({is:l.$c.$TipText,text:e});return y(o,"object")&&Object.assign(t,o),t};if("function"==typeof o)a=o(s,t);else if("function"==typeof m)a=i(m.call(this,a,s));else if(lt.includes(d)){const e=Ve({textValue:""}),r=(t,s)=>{"function"==typeof p&&(s=p.call(this,s)),Array.isArray(t)?e.textValue=t.map((e=>b(s,e))).filter(Boolean).join():e.textValue=b(s,t)};let n=Qe(s,(e=>r(n=e,o))),o=Qe(t,(e=>r(n,o=e)));r(n,o),a=i({$proxy:e,field:"textValue"})}else a=i(s)}else a=this.buildByName({children:t,...a});else a=this.buildByName({children:t,...h,...a},"jiess-item");return r&&(a.$slots=r),n?[a,n]:a}};let ut=1;const ht=class extends ot{hook;info;J_uid=ut++;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 ct(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",...r}=s,{hook:n,previewManger:o}=i;e&&(i.info.$name=e,r.initialValues=r.initialValues||{},r.initialValues[e]=t,i.setValue=t=>{a.nameManger.values[e]=t});const a=i.area=this.area(r),l=n.hookItemCall(i);this.add(o.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 dt=(e,t,s="id")=>{Array.isArray(e)&&t.splice(0,1/0,...e.flat(1/0).filter(Boolean).map(((e,t)=>(Reflect.has(e,"key")||(e.key=e[s]||t),"function"==typeof s&&s(e,t),e))))},ft=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]||S();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:r,listenerCache:n}=this,{$results:o}=r,a=null;if(Array.isArray(n[t]))try{for(let s of n[t])await s.done(e)}catch(e){a=e||"执行异常"}else o[t]=r.result=s;if(Array.isArray(i[t]))for(let e of i[t])a?e.reject(a):e.resolve(o[t]);delete i[t]}},pt=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:I("Midder","未提供监听器"),this}async done(e){let{fn:t,name:s,midder:i}=this;try{let{defaultValue:r,args:n}=e,o=await(t?.call(i,r,...n));return void 0===o&&(o=r),i.$results[s]=i.result=o,e.defaultValue=o}catch(e){return Promise.reject(e)}}},mt=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,r)=>{const n=i[t]=i[t]||[];if("string"==typeof e){const t=n.find((t=>t.tag===e));t?(t.resolve=s,t.reject=r):n.push({resolve:s,reject:r,tag:e})}else n.push({resolve:s,reject:r})}))}},yt={},gt=new WeakMap,bt=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 ft(this),"no-store"!==s){if(y(t,["symbol","string","number"])){return yt[t]||(yt[t]=this)}return gt.get(t)||(gt.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 pt(this).init(...e);this.$listenerStore.addListener(t)}dispatch(...e){const t=new mt(this).init(...e),s=t.start();return this.$listenerStore.addDones(t),s}};async function $t({api:e,midder:t,requestData:s}){let i=null;const{customRequest:r,customReload:n}=t.table;if(i="function"==typeof r?await r(e,s,t):await e(s),"function"==typeof n){const e=await n(i,s,t);e&&(i=e)}return i}async function xt(e,t){const{pager:s,proxy:i,filter:r,table:n,JiessTableConfig:o}=t,{fieldPage:a,fieldPageSize:l,fieldTotal:c,fieldDatas:u,defaultTotal:h}=o;try{const{page:o,pageSize:d,...f}=s.values,p={...r.values,...n.values,...f};p[a]=o,p[l]=d;for(const e in p){const t=p[e];"string"==typeof t&&(p[e]=t.trim())}const m=await $t({api:e,requestData:p,midder:t});return i.datas=m?.[u],i.total=Number(m?.[c]||h),p}catch(e){console.error("列表数据异常:",e)}}async function vt(e,t){const{filter:s,table:i,proxy:r}=t;try{const n={...s.values,...i.values};return r.datas=await $t({api:e,requestData:n,midder:t}),n}catch(e){console.error("列表数据异常:",e)}}const wt={add:"新增",edit:"编辑"};function kt(e){return(t,s,{type:i,title:r,param:n,...o}={})=>{const{record:a={},...l}=o;return new Promise((o=>{const c=i;i&&!e[c]&&(e[c]={}),this.$tan({title:r||wt[c],children:{is:t,type:i,midder:e,record:a,...l},onOk:async t=>{let{action:r,actions:n,httpParam:a}=e[c];r&&(n=[r]);let l={};n&&(l=await Promise.all(n.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,a),await s(l,t),e.table.reload(),o(),t()},...n})}))}}const Pt=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 at(this,e,t).init()}itemBuilder(e,t={}){return new ht(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}},jt=class extends Pt{stack="react"},St=class extends jt{stackVersion="16.8"};var Ct;!function(e){e.React="react",e.Vue2="vue2",e.Vue3="vue3"}(Ct||(Ct={}));const Tt="react";class Rt{jiess;env=Tt;constructor(e,t){this.jiess=e,this.initRender(),this.env=e.$env=Tt,e.JiessComponent=e=>{const{is:s,setup:i,children:r,...n}=e,o={is:s,setup:i,jiessEnv:this};return this.createElement(t(o).start(n,r))}}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:r}=this.jiess,{ref:n,...o}=t;return"function"==typeof n&&(o.ref=i(null),n(o.ref)),r(e,o,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:r,useReducer:n}=this.jiess;return o=>{let a=!0,l=!0;const c=i(!1),[u,h]=n((e=>c.current=!e)),d=i({forceUpdate:h});return e.frame=d.current,e.frameProps=o,(e=>{const t=i(!0);t.current&&(t.current=!1,e())})((()=>{s=t(),s("beforeMount")})),(e.ctx.useCustomHook||p)(o),e.frame&&(e.frame.props=o),r((()=>(a=!1,s("mounted"),()=>{l=!1,s("beforeUnmount")})),[]),r((()=>(a&&s("updated"),()=>l&&s("beforeUpdate")))),e.ctx._buildVNodeTree()}}}function _t(){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,...r})=>{Object.assign(e,r)}},{is:this.$c.$Space,fieldHas:{field:"hasSpace",default:!0},fieldParam:{field:"spaceParam",default:{}},fieldPicks:["span","gutter"]}]}function At(){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:r})=>{if(!e.area)return[];i.label=t,i=this.hookFormItem(r,i);const{rule:n,hasRule:o=!0}=e.area.param;return o?i.rules=n?.init(s,t):i.style={marginBottom:0},i}}]}const Dt=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=_t;levelsItem=At;uiName="antd";hookBuildRule(e){return e?Promise.reject(e):null}hookFormParam(e,t){return{ref:t=>e.formOper=new Dt(e,t),initialValues:e.nameManger.values,...t}}hookInitValues(e){const{initialValues:t,staticValues:s}=e;return Ve({...s,...t})}hookItemCall(e){const{groupConfig:t,defaultValue:s}=this.initValue(e),{$name:i,...r}=e.info,{nameManger:n}=e.area||{};if(i&&(r.name=n?.input(i,{defaultValue:s})),t){const{method:s,groupManger:i}=t;return i[s](e,r)}return r}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,t,s){const i=De(!0);return{open:{$proxy:i},is:this.ui.Modal,onCancel:e,show:i,...s}}};class Ot extends Vt{static instance;jiess={};ui={};globalConfig={};constructor({ui:e,globalConfig:t,...s}){if(Ot.instance)return Ot.instance;super(s,{$identify:y,$clone:b,$watch:Te,$computed:Oe,$reactive:Ve,$watchEffect:Re,$Space:ss,$SpaceItem:is,$TipText:Qt}),this.ui=e,this.globalConfig={...ze,...t},Ot.instance=this}start(e){const t=this.ui.message;"function"==typeof e&&(e=e(this.ui,this.$m,this)),this.jiess=Je(Rt,this.$m,{$msg:(e,s="success")=>t[s](e),area:Zt,...e});const s=new bt(this.jiess,"GlobalMidder","no-store");return this.jiess.contextParam.$midder=s,this.jiess}}const Bt=Ot,It=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=De({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}}},Et=({midder:e,hook:t})=>{const{proxy:s}=e,{useState:i,createElement:r}=t.$m,{columns:n=[]}=s;let o=[...n];const[a,l]=i(o);return r(t.ui.Tree,{defaultCheckedKeys:o.filter((e=>!e.hidden)).map((e=>e.key)),checkable:!0,draggable:!0,blockNode:!0,onDrop:e=>{const{dropPosition:t,dragNodesKeys:i}=e,r=o.findIndex((e=>e.key===i[0])),n=o.splice(r,1);-1===t?(console.log("拖拽到最顶部"),o=[...n,...o]):t>r?(console.log("从上往下拖拽"),o=[...o],o.splice(t-1,0,...n)):(console.log("从下往上拖拽"),o=[...o],o.splice(t,0,...n)),l(o),s.columns=o},treeData:a,onCheck:e=>{s.columns=o.map((t=>(t.hidden=!e.includes(t.key),t)))}})},Jt="36px",Ft={right:"30px",bottom:"30vh",color:"white",zIndex:1e4,width:Jt,height:Jt,lineHeight:Jt,fontSize:"18px",cursor:"pointer",position:"fixed",textAlign:"center",borderRadius:"50%",backgroundColor:"#FF6666",boxShadow:"1px 1px 6px #6666"},Nt={};class Mt{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,Nt[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=Mt.getKey(e,t);this.keys.includes(i)&&s(i)}static getKey(e,t){return`${e}__${t.toLocaleUpperCase()}`}static request(e,t){Object.values(Nt).forEach((s=>s.add(e,t)))}static response(e,t){Object.values(Nt).forEach((s=>s.remove(e,t)))}}const Kt=Mt,qt={},zt=class{req;key;headers;cache;waitTime=0;constructor(e,t){this.req=e;const{waitTime:s=0}=t,{url:i,method:r}=e;this.body=e.body,this.waitTime=s,this.headers=e.headers,this.key=Kt.getKey(i,r),this.cache=qt[this.key]||[],qt[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(!qt[this.key].some((r=>{if(r.body===i&&JSON.stringify(r.headers)===JSON.stringify(s)){switch(r.status){case 1e3:r.cbs.push({resolve:e,reject:t});break;case 2e3:e(r.value);break;case 3e3:t(r.value)}return!0}}))){const r={cbs:[{resolve:e,reject:t}],key:this.key,status:1e3,value:{},headers:s,body:i};this.add(r),this.req.request().then((e=>{r.value=e,r.status=2e3,r.cbs.forEach((({resolve:t})=>t(e)))})).catch((e=>{r.value=e,r.status=3e3,r.cbs.forEach((({reject:t})=>t(e)))})).finally((()=>{this.waitTime>0?m((()=>this.remove(r)),this.waitTime):this.remove(r)}))}}))}},Ut=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=O.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=O.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,r={method:t,headers:s,body:i};return"function"==typeof e?await e(r):r}async initXHR(e){const{onInitXHR:t}=this.config,{method:s,headers:i}=this,r=new XMLHttpRequest;r.open(s,this.url);for(let e in i)r.setRequestHeader(e,i[e]);return"function"==typeof t?await t(r,e):r}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 zt(this,s).start()}return this.request()}async request(){const{config:e,param:t,url:s}=this,{responseType:i,useFetch:r=!0}=t,n=await this.initResult();return"function"==typeof e.customFetch?e.customFetch(s,n,t).then((e=>({config:t,...e}))):r&&"function"==typeof fetch?await fetch(s,n).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}})).catch((e=>Promise.reject({config:t,error:e}))):new Promise((async(e,s)=>{const r=await this.initXHR(n);r.send(this.body),i?(r.responseType=i,r.onload=()=>{const{status:s,response:i}=r;200===s&&e({responseText:i,config:t,xhr:r})}):r.onreadystatechange=()=>{if(4===r.readyState){const i={responseText:r.responseText,config:t,xhr:r};200===r.status?e(i):s(i)}}}))}},Lt=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={},...r}=this.config,{httpCacheParam:n,useFetch:o,useCache:a}=r;this.requestData={url:s+e,useFetch:o,useCache:a,method:t,headers:i,httpCacheParam:n,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 Ut(e,this.config),s=await Promise.race([this.timeout(),t.send()]);return await 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,r=this.interceptors;return"function"==typeof i?.[e]&&(s=await i[e](t)),"function"==typeof r?.[e]&&(s=await r[e](t,s)),s}},Ht=async(e,t,s,i)=>{const r=e.split("?");let n