sun-form-v3 1.0.22 → 1.0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -6395,11 +6395,11 @@ const KC = /* @__PURE__ */ Object.assign({ name: "sunForm" }, {
6395
6395
  }
6396
6396
  },
6397
6397
  setup(e) {
6398
- let r = e;
6399
- return qo(new VC({
6398
+ let r = e, t = qo(new VC({
6400
6399
  widgetConfig: r.widgetConfig,
6401
6400
  showMode: !0
6402
- })), (t, n) => " sunForm ";
6401
+ }));
6402
+ return console.log(t), (n, a) => " sunForm ";
6403
6403
  }
6404
6404
  }), JC = (e) => {
6405
6405
  e.component("testBtn", nc), e.component("sunForm", KC);
@@ -11,4 +11,4 @@
11
11
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
12
  * @license MIT
13
13
  **/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const L2=Object.prototype.hasOwnProperty,qu=(e,r)=>L2.call(e,r),dt=e=>typeof e=="string",Vu=e=>e!==null&&typeof e=="object";var U2=typeof global=="object"&&global&&global.Object===Object&&global,k2=typeof self=="object"&&self&&self.Object===Object&&self,Wn=U2||k2||Function("return this")(),Xe=Wn.Symbol,Ku=Object.prototype,W2=Ku.hasOwnProperty,H2=Ku.toString,Tr=Xe?Xe.toStringTag:void 0;function z2(e){var r=W2.call(e,Tr),t=e[Tr];try{e[Tr]=void 0;var n=!0}catch{}var a=H2.call(e);return n&&(r?e[Tr]=t:delete e[Tr]),a}var G2=Object.prototype,q2=G2.toString;function V2(e){return q2.call(e)}var K2="[object Null]",J2="[object Undefined]",Ju=Xe?Xe.toStringTag:void 0;function Yu(e){return e==null?e===void 0?J2:K2:Ju&&Ju in Object(e)?z2(e):V2(e)}function Y2(e){return e!=null&&typeof e=="object"}var Q2="[object Symbol]";function Hn(e){return typeof e=="symbol"||Y2(e)&&Yu(e)==Q2}function Z2(e,r){for(var t=-1,n=e==null?0:e.length,a=Array(n);++t<n;)a[t]=r(e[t],t,e);return a}var zn=Array.isArray,X2=1/0,Qu=Xe?Xe.prototype:void 0,Zu=Qu?Qu.toString:void 0;function Xu(e){if(typeof e=="string")return e;if(zn(e))return Z2(e,Xu)+"";if(Hn(e))return Zu?Zu.call(e):"";var r=e+"";return r=="0"&&1/e==-X2?"-0":r}function ju(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}var j2="[object AsyncFunction]",eA="[object Function]",rA="[object GeneratorFunction]",tA="[object Proxy]";function nA(e){if(!ju(e))return!1;var r=Yu(e);return r==eA||r==rA||r==j2||r==tA}var Gn=Wn["__core-js_shared__"],el=function(){var e=/[^.]+$/.exec(Gn&&Gn.keys&&Gn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function aA(e){return!!el&&el in e}var iA=Function.prototype,oA=iA.toString;function sA(e){if(e!=null){try{return oA.call(e)}catch{}try{return e+""}catch{}}return""}var uA=/[\\^$.*+?()[\]{}|]/g,lA=/^\[object .+?Constructor\]$/,cA=Function.prototype,fA=Object.prototype,pA=cA.toString,dA=fA.hasOwnProperty,vA=RegExp("^"+pA.call(dA).replace(uA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hA(e){if(!ju(e)||aA(e))return!1;var r=nA(e)?vA:lA;return r.test(sA(e))}function yA(e,r){return e==null?void 0:e[r]}function rl(e,r){var t=yA(e,r);return hA(t)?t:void 0}function mA(e,r){return e===r||e!==e&&r!==r}var gA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$A=/^\w*$/;function SA(e,r){if(zn(e))return!1;var t=typeof e;return t=="number"||t=="symbol"||t=="boolean"||e==null||Hn(e)?!0:$A.test(e)||!gA.test(e)||r!=null&&e in Object(r)}var Dr=rl(Object,"create");function wA(){this.__data__=Dr?Dr(null):{},this.size=0}function _A(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var bA="__lodash_hash_undefined__",EA=Object.prototype,OA=EA.hasOwnProperty;function CA(e){var r=this.__data__;if(Dr){var t=r[e];return t===bA?void 0:t}return OA.call(r,e)?r[e]:void 0}var AA=Object.prototype,TA=AA.hasOwnProperty;function DA(e){var r=this.__data__;return Dr?r[e]!==void 0:TA.call(r,e)}var NA="__lodash_hash_undefined__";function PA(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=Dr&&r===void 0?NA:r,this}function Te(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}Te.prototype.clear=wA,Te.prototype.delete=_A,Te.prototype.get=CA,Te.prototype.has=DA,Te.prototype.set=PA;function IA(){this.__data__=[],this.size=0}function vt(e,r){for(var t=e.length;t--;)if(mA(e[t][0],r))return t;return-1}var FA=Array.prototype,RA=FA.splice;function xA(e){var r=this.__data__,t=vt(r,e);if(t<0)return!1;var n=r.length-1;return t==n?r.pop():RA.call(r,t,1),--this.size,!0}function MA(e){var r=this.__data__,t=vt(r,e);return t<0?void 0:r[t][1]}function BA(e){return vt(this.__data__,e)>-1}function LA(e,r){var t=this.__data__,n=vt(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}function je(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}je.prototype.clear=IA,je.prototype.delete=xA,je.prototype.get=MA,je.prototype.has=BA,je.prototype.set=LA;var UA=rl(Wn,"Map");function kA(){this.size=0,this.__data__={hash:new Te,map:new(UA||je),string:new Te}}function WA(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}function ht(e,r){var t=e.__data__;return WA(r)?t[typeof r=="string"?"string":"hash"]:t.map}function HA(e){var r=ht(this,e).delete(e);return this.size-=r?1:0,r}function zA(e){return ht(this,e).get(e)}function GA(e){return ht(this,e).has(e)}function qA(e,r){var t=ht(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}function De(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}De.prototype.clear=kA,De.prototype.delete=HA,De.prototype.get=zA,De.prototype.has=GA,De.prototype.set=qA;var VA="Expected a function";function qn(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new TypeError(VA);var t=function(){var n=arguments,a=r?r.apply(this,n):n[0],i=t.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return t.cache=i.set(a,o)||i,o};return t.cache=new(qn.Cache||De),t}qn.Cache=De;var KA=500;function JA(e){var r=qn(e,function(n){return t.size===KA&&t.clear(),n}),t=r.cache;return r}var YA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,QA=/\\(\\)?/g,ZA=JA(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(YA,function(t,n,a,i){r.push(a?i.replace(QA,"$1"):n||t)}),r});function XA(e){return e==null?"":Xu(e)}function jA(e,r){return zn(e)?e:SA(e,r)?[e]:ZA(XA(e))}var eT=1/0;function rT(e){if(typeof e=="string"||Hn(e))return e;var r=e+"";return r=="0"&&1/e==-eT?"-0":r}function tT(e,r){r=jA(r,e);for(var t=0,n=r.length;e!=null&&t<n;)e=e[rT(r[t++])];return t&&t==n?e:void 0}function nT(e,r,t){var n=e==null?void 0:tT(e,r);return n===void 0?t:n}function aT(e){for(var r=-1,t=e==null?0:e.length,n={};++r<t;){var a=e[r];n[a[0]]=a[1]}return n}const iT=e=>e===void 0,tl=e=>typeof e=="number",nl=e=>typeof Element>"u"?!1:e instanceof Element,oT=e=>dt(e)?!Number.isNaN(Number(e)):!1,al=e=>Object.keys(e);class sT extends Error{constructor(r){super(r),this.name="ElementPlusError"}}function yt(e,r){if(process.env.NODE_ENV!=="production"){const t=dt(e)?new sT(`[${e}] ${r}`):e;console.warn(t)}}const uT="utils/dom/style";function lT(e,r="px"){if(!e)return"";if(tl(e)||oT(e))return`${e}${r}`;if(dt(e))return e;yt(uT,"binding value must be a string or number")}/*! Element Plus Icons Vue v2.3.1 */var cT=f.defineComponent({name:"CircleCloseFilled",__name:"circle-close-filled",setup(e){return(r,t)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}}),fT=cT,pT=f.defineComponent({name:"Close",__name:"close",setup(e){return(r,t)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),dT=pT,vT=f.defineComponent({name:"InfoFilled",__name:"info-filled",setup(e){return(r,t)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),hT=vT,yT=f.defineComponent({name:"SuccessFilled",__name:"success-filled",setup(e){return(r,t)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}}),mT=yT,gT=f.defineComponent({name:"WarningFilled",__name:"warning-filled",setup(e){return(r,t)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),$T=gT;const il="__epPropKey",Nr=e=>e,ST=e=>Vu(e)&&!!e[il],ol=(e,r)=>{if(!Vu(e)||ST(e))return e;const{values:t,required:n,default:a,type:i,validator:o}=e,u={type:i,required:!!n,validator:t||o?c=>{let l=!1,p=[];if(t&&(p=Array.from(t),qu(e,"default")&&p.push(a),l||(l=p.includes(c))),o&&(l||(l=o(c))),!l&&p.length>0){const d=[...new Set(p)].map(g=>JSON.stringify(g)).join(", ");f.warn(`Invalid prop: validation failed${r?` for prop "${r}"`:""}. Expected one of [${d}], got value ${JSON.stringify(c)}.`)}return l}:void 0,[il]:!0};return qu(e,"default")&&(u.default=a),u},sl=e=>aT(Object.entries(e).map(([r,t])=>[r,ol(t,r)])),wT=Nr([String,Object,Function]),_T={Close:dT},ul={success:mT,warning:$T,error:fT,info:hT},bT=(e,r)=>(e.install=t=>{for(const n of[e,...Object.values({})])t.component(n.name,n)},e),ET=(e,r)=>(e.install=t=>{e._context=t._context,t.config.globalProperties[r]=e},e),Vn={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},OT=["","default","small","large"];var CT={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tour:{next:"Next",previous:"Previous",finish:"Finish"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const AT=e=>(r,t)=>TT(r,t,f.unref(e)),TT=(e,r,t)=>nT(t,e,e).replace(/\{(\w+)\}/g,(n,a)=>{var i;return`${(i=r==null?void 0:r[a])!=null?i:`{${a}}`}`}),DT=e=>{const r=f.computed(()=>f.unref(e).name),t=f.isRef(e)?e:f.ref(e);return{lang:r,locale:t,t:AT(e)}},ll=Symbol("localeContextKey"),NT=e=>{const r=e||f.inject(ll,f.ref());return DT(f.computed(()=>r.value||CT))},mt="el",PT="is-",Ne=(e,r,t,n,a)=>{let i=`${e}-${r}`;return t&&(i+=`-${t}`),n&&(i+=`__${n}`),a&&(i+=`--${a}`),i},cl=Symbol("namespaceContextKey"),IT=e=>{const r=e||(f.getCurrentInstance()?f.inject(cl,f.ref(mt)):f.ref(mt));return f.computed(()=>f.unref(r)||mt)},fl=(e,r)=>{const t=IT(r);return{namespace:t,b:(y="")=>Ne(t.value,e,y,"",""),e:y=>y?Ne(t.value,e,"",y,""):"",m:y=>y?Ne(t.value,e,"","",y):"",be:(y,$)=>y&&$?Ne(t.value,e,y,$,""):"",em:(y,$)=>y&&$?Ne(t.value,e,"",y,$):"",bm:(y,$)=>y&&$?Ne(t.value,e,y,"",$):"",bem:(y,$,S)=>y&&$&&S?Ne(t.value,e,y,$,S):"",is:(y,...$)=>{const S=$.length>=1?$[0]:!0;return y&&S?`${PT}${y}`:""},cssVar:y=>{const $={};for(const S in y)y[S]&&($[`--${t.value}-${S}`]=y[S]);return $},cssVarName:y=>`--${t.value}-${y}`,cssVarBlock:y=>{const $={};for(const S in y)y[S]&&($[`--${t.value}-${e}-${S}`]=y[S]);return $},cssVarBlockName:y=>`--${t.value}-${e}-${y}`}},pl={current:0},dl=f.ref(0),vl=2e3,hl=Symbol("elZIndexContextKey"),yl=Symbol("zIndexContextKey"),FT=e=>{const r=f.getCurrentInstance()?f.inject(hl,pl):pl,t=e||(f.getCurrentInstance()?f.inject(yl,void 0):void 0),n=f.computed(()=>{const o=f.unref(t);return tl(o)?o:vl}),a=f.computed(()=>n.value+dl.value),i=()=>(r.current++,dl.value=r.current,a.value);return!Ar&&!f.inject(hl)&&yt("ZIndexInjection",`Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
14
- usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:n,currentZIndex:a,nextZIndex:i}};ol({type:String,values:OT,required:!1});const RT=Symbol("size"),ml=Symbol(),gt=f.ref();function gl(e,r=void 0){return f.getCurrentInstance()?f.inject(ml,gt):gt}function xT(e,r){const t=gl(),n=fl(e,f.computed(()=>{var s;return((s=t.value)==null?void 0:s.namespace)||mt})),a=NT(f.computed(()=>{var s;return(s=t.value)==null?void 0:s.locale})),i=FT(f.computed(()=>{var s;return((s=t.value)==null?void 0:s.zIndex)||vl})),o=f.computed(()=>{var s;return f.unref(r)||((s=t.value)==null?void 0:s.size)||""});return MT(f.computed(()=>f.unref(t)||{})),{ns:n,locale:a,zIndex:i,size:o}}const MT=(e,r,t=!1)=>{var n;const a=!!f.getCurrentInstance(),i=a?gl():void 0,o=(n=void 0)!=null?n:a?f.provide:void 0;if(!o){yt("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const s=f.computed(()=>{const u=f.unref(e);return i!=null&&i.value?BT(i.value,u):u});return o(ml,s),o(ll,f.computed(()=>s.value.locale)),o(cl,f.computed(()=>s.value.namespace)),o(yl,f.computed(()=>s.value.zIndex)),o(RT,{size:f.computed(()=>s.value.size||"")}),(t||!gt.value)&&(gt.value=s.value),s},BT=(e,r)=>{const t=[...new Set([...al(e),...al(r)])],n={};for(const a of t)n[a]=r[a]!==void 0?r[a]:e[a];return n};var $l=(e,r)=>{const t=e.__vccOpts||e;for(const[n,a]of r)t[n]=a;return t};const LT=sl({size:{type:Nr([Number,String])},color:{type:String}}),UT=f.defineComponent({name:"ElIcon",inheritAttrs:!1}),kT=f.defineComponent({...UT,props:LT,setup(e){const r=e,t=fl("icon"),n=f.computed(()=>{const{size:a,color:i}=r;return!a&&!i?{}:{fontSize:iT(a)?void 0:lT(a),"--color":i}});return(a,i)=>(f.openBlock(),f.createElementBlock("i",f.mergeProps({class:f.unref(t).b(),style:f.unref(n)},a.$attrs),[f.renderSlot(a.$slots,"default")],16))}});var WT=$l(kT,[["__file","icon.vue"]]);const Sl=bT(WT),wl=["success","info","warning","error"],HT=sl({customClass:{type:String,default:""},dangerouslyUseHTMLString:{type:Boolean,default:!1},duration:{type:Number,default:4500},icon:{type:wT},id:{type:String,default:""},message:{type:Nr([String,Object]),default:""},offset:{type:Number,default:0},onClick:{type:Nr(Function),default:()=>{}},onClose:{type:Nr(Function),required:!0},position:{type:String,values:["top-right","top-left","bottom-right","bottom-left"],default:"top-right"},showClose:{type:Boolean,default:!0},title:{type:String,default:""},type:{type:String,values:[...wl,""],default:""},zIndex:Number}),zT={destroy:()=>!0},GT=["id"],qT=["textContent"],VT={key:0},KT=["innerHTML"],JT=f.defineComponent({name:"ElNotification"}),YT=f.defineComponent({...JT,props:HT,emits:zT,setup(e,{expose:r}){const t=e,{ns:n,zIndex:a}=xT("notification"),{nextZIndex:i,currentZIndex:o}=a,{Close:s}=_T,u=f.ref(!1);let c;const l=f.computed(()=>{const h=t.type;return h&&ul[t.type]?n.m(h):""}),p=f.computed(()=>t.type&&ul[t.type]||t.icon),d=f.computed(()=>t.position.endsWith("right")?"right":"left"),g=f.computed(()=>t.position.startsWith("top")?"top":"bottom"),m=f.computed(()=>{var h;return{[g.value]:`${t.offset}px`,zIndex:(h=t.zIndex)!=null?h:o.value}});function y(){t.duration>0&&({stop:c}=N2(()=>{u.value&&S()},t.duration))}function $(){c==null||c()}function S(){u.value=!1}function O({code:h}){h===Vn.delete||h===Vn.backspace?$():h===Vn.esc?u.value&&S():y()}return f.onMounted(()=>{y(),i(),u.value=!0}),F2(document,"keydown",O),r({visible:u,close:S}),(h,w)=>(f.openBlock(),f.createBlock(f.Transition,{name:f.unref(n).b("fade"),onBeforeLeave:h.onClose,onAfterLeave:w[1]||(w[1]=I=>h.$emit("destroy")),persisted:""},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",{id:h.id,class:f.normalizeClass([f.unref(n).b(),h.customClass,f.unref(d)]),style:f.normalizeStyle(f.unref(m)),role:"alert",onMouseenter:$,onMouseleave:y,onClick:w[0]||(w[0]=(...I)=>h.onClick&&h.onClick(...I))},[f.unref(p)?(f.openBlock(),f.createBlock(f.unref(Sl),{key:0,class:f.normalizeClass([f.unref(n).e("icon"),f.unref(l)])},{default:f.withCtx(()=>[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(f.unref(p))))]),_:1},8,["class"])):f.createCommentVNode("v-if",!0),f.createElementVNode("div",{class:f.normalizeClass(f.unref(n).e("group"))},[f.createElementVNode("h2",{class:f.normalizeClass(f.unref(n).e("title")),textContent:f.toDisplayString(h.title)},null,10,qT),f.withDirectives(f.createElementVNode("div",{class:f.normalizeClass(f.unref(n).e("content")),style:f.normalizeStyle(h.title?void 0:{margin:0})},[f.renderSlot(h.$slots,"default",{},()=>[h.dangerouslyUseHTMLString?(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[f.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),f.createElementVNode("p",{innerHTML:h.message},null,8,KT)],2112)):(f.openBlock(),f.createElementBlock("p",VT,f.toDisplayString(h.message),1))])],6),[[f.vShow,h.message]]),h.showClose?(f.openBlock(),f.createBlock(f.unref(Sl),{key:0,class:f.normalizeClass(f.unref(n).e("closeBtn")),onClick:f.withModifiers(S,["stop"])},{default:f.withCtx(()=>[f.createVNode(f.unref(s))]),_:1},8,["class","onClick"])):f.createCommentVNode("v-if",!0)],2)],46,GT),[[f.vShow,u.value]])]),_:3},8,["name","onBeforeLeave"]))}});var QT=$l(YT,[["__file","notification.vue"]]);const $t={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]},Kn=16;let ZT=1;const er=function(e={},r=null){if(!Ar)return{close:()=>{}};(typeof e=="string"||f.isVNode(e))&&(e={message:e});const t=e.position||"top-right";let n=e.offset||0;$t[t].forEach(({vm:l})=>{var p;n+=(((p=l.el)==null?void 0:p.offsetHeight)||0)+Kn}),n+=Kn;const a=`notification_${ZT++}`,i=e.onClose,o={...e,offset:n,id:a,onClose:()=>{XT(a,t,i)}};let s=document.body;nl(e.appendTo)?s=e.appendTo:dt(e.appendTo)&&(s=document.querySelector(e.appendTo)),nl(s)||(yt("ElNotification","the appendTo option is not an HTMLElement. Falling back to document.body."),s=document.body);const u=document.createElement("div"),c=f.createVNode(QT,o,f.isVNode(o.message)?{default:()=>o.message}:null);return c.appContext=r??er._context,c.props.onDestroy=()=>{f.render(null,u)},f.render(c,u),$t[t].push({vm:c}),s.appendChild(u.firstElementChild),{close:()=>{c.component.exposed.visible.value=!1}}};wl.forEach(e=>{er[e]=(r={})=>((typeof r=="string"||f.isVNode(r))&&(r={message:r}),er({...r,type:e}))});function XT(e,r,t){const n=$t[r],a=n.findIndex(({vm:c})=>{var l;return((l=c.component)==null?void 0:l.props.id)===e});if(a===-1)return;const{vm:i}=n[a];if(!i)return;t==null||t(i);const o=i.el.offsetHeight,s=r.split("-")[0];n.splice(a,1);const u=n.length;if(!(u<1))for(let c=a;c<u;c++){const{el:l,component:p}=n[c].vm,d=Number.parseInt(l.style[s],10)-o-Kn;p.props.offset=d}}function jT(){for(const e of Object.values($t))e.forEach(({vm:r})=>{r.component.exposed.visible.value=!1})}er.closeAll=jT,er._context=null;const Jn=ET(er,"$notify");class eD{constructor({baseUrl:r="",headers:t={},timeout:n=1e6,httpSuccessHandle:a=null,httpErrorHandle:i=null,httpBeforeSendHandle:o=null}){this.options={baseUrl:r,headers:t,timeout:n,httpSuccessHandle:a,httpErrorHandle:i,httpBeforeSendHandle:o},this.formDataHeader={"Content-Type":"application/x-www-form-urlencoded"},this.formFileHeader={"Content-Type":"multipart/form-data"},this.jsonHeader={"Content-Type":"application/json"}}paramHandle(r){return r instanceof Array||typeof r!="object"?r:r?Object.assign({},this.httpBeforeSendHandle?this.httpBeforeSendHandle()||{}:{},r):this.httpBeforeSendHandle()}send(r){const t=A.create({baseURL:this.options.baseUrl,timeout:this.options.timeout,responseType:"json"});return t.interceptors.request.use(n=>{if(this.options.headers)for(var a in this.options.headers)n.headers[a]=headers[a];return n}),t.interceptors.response.use(n=>(this.options.httpSuccessHandle&&this.options.httpSuccessHandle(n.data),Promise.resolve(n.data)),n=>(this.options.httpErrorHandle&&this.options.httpErrorHandle(n),Jn({title:"消息",message:"数据请求失败",type:"error"}),Promise.reject(n))),t(r)}get(r,t,n){return this.send({url:r,method:"get",params:this.paramHandle(t),headers:n})}getBlob(r,t,n){return this.send({url:r,method:"get",responseType:"blob",params:this.paramHandle(t),headers:n})}post(r,t,n={}){return this.send({url:r,method:"post",data:this.paramHandle(t),headers:{...n,...this.jsonHeader}})}put(r,t,n){return this.send({url:r,method:"put",data:this.paramHandle(t),headers:n})}patch(r,t,n){return this.send({url:r,method:"patch",data:this.paramHandle(t),headers:n})}delete(r,t,n){return this.send({url:r,method:"delete",params:this.paramHandle(t),headers:n})}postFormData(r,t,n){return this.send({url:r,method:"post",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}postFile(r,t,n){return this.send({url:r,method:"post",data:t,headers:{...this.formDataHeader,...n}})}putFormData(r,t,n){return this.send({url:r,method:"put",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}patchFormData(r,t,n){return this.send({url:r,method:"patch",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}}class rD{constructor({widgetConfig:r,showMode:t=!1}){this.showMode=f.ref(t),this.widgetConfig=f.reactive(r),this.$utils=Gb,this.widgetMap=new Map,this.vueInstanceMap=new Map,this.widgetIds=[],this.chosenWidget=f.ref(null),this.historyList=[],this.historyIndex=f.ref(0),this.isHistory=!1,this.$http=new eD({baseUrl:"/api"}),this.buildWidgetMap(this.widgetConfig),f.watch(()=>this.widgetConfig,n=>{this.rebuildWidgetMap(),this.chosenWidget.value=this.getWidgetById(this.widgetConfig.chosenId)},{deep:!0,immediate:!0}),f.watch(()=>this.widgetConfig.widgetList,n=>{this.isHistory?this.isHistory=!1:(this.historyList.push({widgetConfig:this.$utils.clone(this.widgetConfig,!0),time:this.$utils.toDateString(new Date,"HH:mm:ss"),index:this.historyList.length}),this.historyIndex.value=this.historyList.length-1)},{deep:!0,immediate:!0})}eventHandle({value:r=null,eventType:t,widget:n,tableItemData:a}){if(this.showMode&&n.props[t]){let i=n.props[t];new Function("value","widget","self","app",i)(r,n,this.getVueInstance(n.id),this)}}setVueIncetance(r,t){this.vueInstanceMap.set(r,t)}getVueInstance(r){return this.vueInstanceMap.get(r)}setChosenWidget(r){this.chosenWidget.value=r}requestByApisetConfig(r){let t=r.props.apiSet;if(!t||!t.apiurl)return;let n={},a={},i=t.method;if(t.contentType=="FormData"&&(i=="post"||i=="put"||i=="patch")&&(i+="FormData"),t.params.length&&t.params.forEach(s=>{n[s.label]=s.value}),t.headers.length&&t.headers.forEach(s=>{a[s.label]=s.value}),t.paramsFormat){let s=new Function("params","widget","app",t.paramsFormat),u=this.$utils.clone(n,!0);var o=s(u,r,this);o&&typeof this.$utils.isPlainObject(o)&&(n=o)}if(t.headersFormat){let s=new Function("headers","widget","app",t.headersFormat),u=this.$utils.clone(a,!0);var o=s(u,r,this);o&&typeof this.$utils.isPlainObject(o)&&(a=o)}this.$http[i](t.apiurl,n,a).then(s=>{t.successFormat&&new Function("res","widget","app",t.successFormat)(s,r,this)}).catch(s=>{t.errorFormat&&new Function("error","widget","app",t.errorFormat)(s,r,this)})}getWidgetById(r){return this.widgetMap.get(r)}updateByHistory(r){this.isHistory=!0,this.$utils.destructuring(this.widgetConfig,r)}updateWidget(r,t,n){const a=this.getWidgetById(r);if(a){if(console.log("widget",a),console.log("updates",t),a.id!==t.id&&this.widgetIds.includes(t.id)&&!n){Jn.warning("已经存在相同的id的组件,组件id不允许重复");return}r==="homepage"&&(t.id!==r&&Jn.warning("主页面的id不允许修改"),t.id=t.type="homepage"),this.$utils.destructuring(a,t)}else console.warn(`Widget with id ${r} not found.`)}rebuildWidgetMap(){this.widgetMap.clear(),this.widgetIds=[],this.buildWidgetMap(this.widgetConfig)}buildWidgetMap(r){this.widgetMap.set(r.id,r),this.widgetIds.push(r.id),r.widgetList&&r.widgetList.length&&r.widgetList.forEach(t=>{this.buildWidgetMap(t)})}setChosenId(r){this.widgetConfig.chosenId=r}getChosenId(){return this.widgetConfig.chosenId}getChosenInitData(r){r=this.$utils.clone(r,!0),r.id=this.getUniqueId(r.type),this.setChosenId(r.id);let t=["isForm","canAddDataTableQuery","canAddDataTableList","addToPanel","active"],n=a=>{delete r[a]};return t.forEach(a=>{n(a)}),r}getUniqueId(r){return r+"_"+Math.floor(new Date().getTime()%1e5)+this.$utils.uniqueId()}getWidgetList(){return this.widgetConfig.widgetList}getWidgetConfig(){return this.widgetConfig}updateWidgetConfig(r){this.widgetConfig=r}getParentWidgetById(r){function t(n){for(const a of n){if(a.id===r){let i=n.findIndex(o=>o.id===r);return{widgetList:n,index:i}}if(a.widgetList&&a.widgetList.length>0){const i=t(a.widgetList);if(i)return i}}return null}return t(this.widgetConfig.widgetList)}}const tD=Object.assign({name:"sunForm"},{__name:"show",props:{widgetConfig:{type:Object,default:{}}},setup(e){let r=e;return f.reactive(new rD({widgetConfig:r.widgetConfig,showMode:!0})),(t,n)=>" sunForm "}});return{install:e=>{e.component("testBtn",tr),e.component("sunForm",tD)}}});
14
+ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:n,currentZIndex:a,nextZIndex:i}};ol({type:String,values:OT,required:!1});const RT=Symbol("size"),ml=Symbol(),gt=f.ref();function gl(e,r=void 0){return f.getCurrentInstance()?f.inject(ml,gt):gt}function xT(e,r){const t=gl(),n=fl(e,f.computed(()=>{var s;return((s=t.value)==null?void 0:s.namespace)||mt})),a=NT(f.computed(()=>{var s;return(s=t.value)==null?void 0:s.locale})),i=FT(f.computed(()=>{var s;return((s=t.value)==null?void 0:s.zIndex)||vl})),o=f.computed(()=>{var s;return f.unref(r)||((s=t.value)==null?void 0:s.size)||""});return MT(f.computed(()=>f.unref(t)||{})),{ns:n,locale:a,zIndex:i,size:o}}const MT=(e,r,t=!1)=>{var n;const a=!!f.getCurrentInstance(),i=a?gl():void 0,o=(n=void 0)!=null?n:a?f.provide:void 0;if(!o){yt("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const s=f.computed(()=>{const u=f.unref(e);return i!=null&&i.value?BT(i.value,u):u});return o(ml,s),o(ll,f.computed(()=>s.value.locale)),o(cl,f.computed(()=>s.value.namespace)),o(yl,f.computed(()=>s.value.zIndex)),o(RT,{size:f.computed(()=>s.value.size||"")}),(t||!gt.value)&&(gt.value=s.value),s},BT=(e,r)=>{const t=[...new Set([...al(e),...al(r)])],n={};for(const a of t)n[a]=r[a]!==void 0?r[a]:e[a];return n};var $l=(e,r)=>{const t=e.__vccOpts||e;for(const[n,a]of r)t[n]=a;return t};const LT=sl({size:{type:Nr([Number,String])},color:{type:String}}),UT=f.defineComponent({name:"ElIcon",inheritAttrs:!1}),kT=f.defineComponent({...UT,props:LT,setup(e){const r=e,t=fl("icon"),n=f.computed(()=>{const{size:a,color:i}=r;return!a&&!i?{}:{fontSize:iT(a)?void 0:lT(a),"--color":i}});return(a,i)=>(f.openBlock(),f.createElementBlock("i",f.mergeProps({class:f.unref(t).b(),style:f.unref(n)},a.$attrs),[f.renderSlot(a.$slots,"default")],16))}});var WT=$l(kT,[["__file","icon.vue"]]);const Sl=bT(WT),wl=["success","info","warning","error"],HT=sl({customClass:{type:String,default:""},dangerouslyUseHTMLString:{type:Boolean,default:!1},duration:{type:Number,default:4500},icon:{type:wT},id:{type:String,default:""},message:{type:Nr([String,Object]),default:""},offset:{type:Number,default:0},onClick:{type:Nr(Function),default:()=>{}},onClose:{type:Nr(Function),required:!0},position:{type:String,values:["top-right","top-left","bottom-right","bottom-left"],default:"top-right"},showClose:{type:Boolean,default:!0},title:{type:String,default:""},type:{type:String,values:[...wl,""],default:""},zIndex:Number}),zT={destroy:()=>!0},GT=["id"],qT=["textContent"],VT={key:0},KT=["innerHTML"],JT=f.defineComponent({name:"ElNotification"}),YT=f.defineComponent({...JT,props:HT,emits:zT,setup(e,{expose:r}){const t=e,{ns:n,zIndex:a}=xT("notification"),{nextZIndex:i,currentZIndex:o}=a,{Close:s}=_T,u=f.ref(!1);let c;const l=f.computed(()=>{const h=t.type;return h&&ul[t.type]?n.m(h):""}),p=f.computed(()=>t.type&&ul[t.type]||t.icon),d=f.computed(()=>t.position.endsWith("right")?"right":"left"),g=f.computed(()=>t.position.startsWith("top")?"top":"bottom"),m=f.computed(()=>{var h;return{[g.value]:`${t.offset}px`,zIndex:(h=t.zIndex)!=null?h:o.value}});function y(){t.duration>0&&({stop:c}=N2(()=>{u.value&&S()},t.duration))}function $(){c==null||c()}function S(){u.value=!1}function O({code:h}){h===Vn.delete||h===Vn.backspace?$():h===Vn.esc?u.value&&S():y()}return f.onMounted(()=>{y(),i(),u.value=!0}),F2(document,"keydown",O),r({visible:u,close:S}),(h,w)=>(f.openBlock(),f.createBlock(f.Transition,{name:f.unref(n).b("fade"),onBeforeLeave:h.onClose,onAfterLeave:w[1]||(w[1]=I=>h.$emit("destroy")),persisted:""},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",{id:h.id,class:f.normalizeClass([f.unref(n).b(),h.customClass,f.unref(d)]),style:f.normalizeStyle(f.unref(m)),role:"alert",onMouseenter:$,onMouseleave:y,onClick:w[0]||(w[0]=(...I)=>h.onClick&&h.onClick(...I))},[f.unref(p)?(f.openBlock(),f.createBlock(f.unref(Sl),{key:0,class:f.normalizeClass([f.unref(n).e("icon"),f.unref(l)])},{default:f.withCtx(()=>[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(f.unref(p))))]),_:1},8,["class"])):f.createCommentVNode("v-if",!0),f.createElementVNode("div",{class:f.normalizeClass(f.unref(n).e("group"))},[f.createElementVNode("h2",{class:f.normalizeClass(f.unref(n).e("title")),textContent:f.toDisplayString(h.title)},null,10,qT),f.withDirectives(f.createElementVNode("div",{class:f.normalizeClass(f.unref(n).e("content")),style:f.normalizeStyle(h.title?void 0:{margin:0})},[f.renderSlot(h.$slots,"default",{},()=>[h.dangerouslyUseHTMLString?(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[f.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),f.createElementVNode("p",{innerHTML:h.message},null,8,KT)],2112)):(f.openBlock(),f.createElementBlock("p",VT,f.toDisplayString(h.message),1))])],6),[[f.vShow,h.message]]),h.showClose?(f.openBlock(),f.createBlock(f.unref(Sl),{key:0,class:f.normalizeClass(f.unref(n).e("closeBtn")),onClick:f.withModifiers(S,["stop"])},{default:f.withCtx(()=>[f.createVNode(f.unref(s))]),_:1},8,["class","onClick"])):f.createCommentVNode("v-if",!0)],2)],46,GT),[[f.vShow,u.value]])]),_:3},8,["name","onBeforeLeave"]))}});var QT=$l(YT,[["__file","notification.vue"]]);const $t={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]},Kn=16;let ZT=1;const er=function(e={},r=null){if(!Ar)return{close:()=>{}};(typeof e=="string"||f.isVNode(e))&&(e={message:e});const t=e.position||"top-right";let n=e.offset||0;$t[t].forEach(({vm:l})=>{var p;n+=(((p=l.el)==null?void 0:p.offsetHeight)||0)+Kn}),n+=Kn;const a=`notification_${ZT++}`,i=e.onClose,o={...e,offset:n,id:a,onClose:()=>{XT(a,t,i)}};let s=document.body;nl(e.appendTo)?s=e.appendTo:dt(e.appendTo)&&(s=document.querySelector(e.appendTo)),nl(s)||(yt("ElNotification","the appendTo option is not an HTMLElement. Falling back to document.body."),s=document.body);const u=document.createElement("div"),c=f.createVNode(QT,o,f.isVNode(o.message)?{default:()=>o.message}:null);return c.appContext=r??er._context,c.props.onDestroy=()=>{f.render(null,u)},f.render(c,u),$t[t].push({vm:c}),s.appendChild(u.firstElementChild),{close:()=>{c.component.exposed.visible.value=!1}}};wl.forEach(e=>{er[e]=(r={})=>((typeof r=="string"||f.isVNode(r))&&(r={message:r}),er({...r,type:e}))});function XT(e,r,t){const n=$t[r],a=n.findIndex(({vm:c})=>{var l;return((l=c.component)==null?void 0:l.props.id)===e});if(a===-1)return;const{vm:i}=n[a];if(!i)return;t==null||t(i);const o=i.el.offsetHeight,s=r.split("-")[0];n.splice(a,1);const u=n.length;if(!(u<1))for(let c=a;c<u;c++){const{el:l,component:p}=n[c].vm,d=Number.parseInt(l.style[s],10)-o-Kn;p.props.offset=d}}function jT(){for(const e of Object.values($t))e.forEach(({vm:r})=>{r.component.exposed.visible.value=!1})}er.closeAll=jT,er._context=null;const Jn=ET(er,"$notify");class eD{constructor({baseUrl:r="",headers:t={},timeout:n=1e6,httpSuccessHandle:a=null,httpErrorHandle:i=null,httpBeforeSendHandle:o=null}){this.options={baseUrl:r,headers:t,timeout:n,httpSuccessHandle:a,httpErrorHandle:i,httpBeforeSendHandle:o},this.formDataHeader={"Content-Type":"application/x-www-form-urlencoded"},this.formFileHeader={"Content-Type":"multipart/form-data"},this.jsonHeader={"Content-Type":"application/json"}}paramHandle(r){return r instanceof Array||typeof r!="object"?r:r?Object.assign({},this.httpBeforeSendHandle?this.httpBeforeSendHandle()||{}:{},r):this.httpBeforeSendHandle()}send(r){const t=A.create({baseURL:this.options.baseUrl,timeout:this.options.timeout,responseType:"json"});return t.interceptors.request.use(n=>{if(this.options.headers)for(var a in this.options.headers)n.headers[a]=headers[a];return n}),t.interceptors.response.use(n=>(this.options.httpSuccessHandle&&this.options.httpSuccessHandle(n.data),Promise.resolve(n.data)),n=>(this.options.httpErrorHandle&&this.options.httpErrorHandle(n),Jn({title:"消息",message:"数据请求失败",type:"error"}),Promise.reject(n))),t(r)}get(r,t,n){return this.send({url:r,method:"get",params:this.paramHandle(t),headers:n})}getBlob(r,t,n){return this.send({url:r,method:"get",responseType:"blob",params:this.paramHandle(t),headers:n})}post(r,t,n={}){return this.send({url:r,method:"post",data:this.paramHandle(t),headers:{...n,...this.jsonHeader}})}put(r,t,n){return this.send({url:r,method:"put",data:this.paramHandle(t),headers:n})}patch(r,t,n){return this.send({url:r,method:"patch",data:this.paramHandle(t),headers:n})}delete(r,t,n){return this.send({url:r,method:"delete",params:this.paramHandle(t),headers:n})}postFormData(r,t,n){return this.send({url:r,method:"post",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}postFile(r,t,n){return this.send({url:r,method:"post",data:t,headers:{...this.formDataHeader,...n}})}putFormData(r,t,n){return this.send({url:r,method:"put",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}patchFormData(r,t,n){return this.send({url:r,method:"patch",data:Un.stringify(this.paramHandle(t)),headers:{...this.formDataHeader,...n}})}}class rD{constructor({widgetConfig:r,showMode:t=!1}){this.showMode=f.ref(t),this.widgetConfig=f.reactive(r),this.$utils=Gb,this.widgetMap=new Map,this.vueInstanceMap=new Map,this.widgetIds=[],this.chosenWidget=f.ref(null),this.historyList=[],this.historyIndex=f.ref(0),this.isHistory=!1,this.$http=new eD({baseUrl:"/api"}),this.buildWidgetMap(this.widgetConfig),f.watch(()=>this.widgetConfig,n=>{this.rebuildWidgetMap(),this.chosenWidget.value=this.getWidgetById(this.widgetConfig.chosenId)},{deep:!0,immediate:!0}),f.watch(()=>this.widgetConfig.widgetList,n=>{this.isHistory?this.isHistory=!1:(this.historyList.push({widgetConfig:this.$utils.clone(this.widgetConfig,!0),time:this.$utils.toDateString(new Date,"HH:mm:ss"),index:this.historyList.length}),this.historyIndex.value=this.historyList.length-1)},{deep:!0,immediate:!0})}eventHandle({value:r=null,eventType:t,widget:n,tableItemData:a}){if(this.showMode&&n.props[t]){let i=n.props[t];new Function("value","widget","self","app",i)(r,n,this.getVueInstance(n.id),this)}}setVueIncetance(r,t){this.vueInstanceMap.set(r,t)}getVueInstance(r){return this.vueInstanceMap.get(r)}setChosenWidget(r){this.chosenWidget.value=r}requestByApisetConfig(r){let t=r.props.apiSet;if(!t||!t.apiurl)return;let n={},a={},i=t.method;if(t.contentType=="FormData"&&(i=="post"||i=="put"||i=="patch")&&(i+="FormData"),t.params.length&&t.params.forEach(s=>{n[s.label]=s.value}),t.headers.length&&t.headers.forEach(s=>{a[s.label]=s.value}),t.paramsFormat){let s=new Function("params","widget","app",t.paramsFormat),u=this.$utils.clone(n,!0);var o=s(u,r,this);o&&typeof this.$utils.isPlainObject(o)&&(n=o)}if(t.headersFormat){let s=new Function("headers","widget","app",t.headersFormat),u=this.$utils.clone(a,!0);var o=s(u,r,this);o&&typeof this.$utils.isPlainObject(o)&&(a=o)}this.$http[i](t.apiurl,n,a).then(s=>{t.successFormat&&new Function("res","widget","app",t.successFormat)(s,r,this)}).catch(s=>{t.errorFormat&&new Function("error","widget","app",t.errorFormat)(s,r,this)})}getWidgetById(r){return this.widgetMap.get(r)}updateByHistory(r){this.isHistory=!0,this.$utils.destructuring(this.widgetConfig,r)}updateWidget(r,t,n){const a=this.getWidgetById(r);if(a){if(console.log("widget",a),console.log("updates",t),a.id!==t.id&&this.widgetIds.includes(t.id)&&!n){Jn.warning("已经存在相同的id的组件,组件id不允许重复");return}r==="homepage"&&(t.id!==r&&Jn.warning("主页面的id不允许修改"),t.id=t.type="homepage"),this.$utils.destructuring(a,t)}else console.warn(`Widget with id ${r} not found.`)}rebuildWidgetMap(){this.widgetMap.clear(),this.widgetIds=[],this.buildWidgetMap(this.widgetConfig)}buildWidgetMap(r){this.widgetMap.set(r.id,r),this.widgetIds.push(r.id),r.widgetList&&r.widgetList.length&&r.widgetList.forEach(t=>{this.buildWidgetMap(t)})}setChosenId(r){this.widgetConfig.chosenId=r}getChosenId(){return this.widgetConfig.chosenId}getChosenInitData(r){r=this.$utils.clone(r,!0),r.id=this.getUniqueId(r.type),this.setChosenId(r.id);let t=["isForm","canAddDataTableQuery","canAddDataTableList","addToPanel","active"],n=a=>{delete r[a]};return t.forEach(a=>{n(a)}),r}getUniqueId(r){return r+"_"+Math.floor(new Date().getTime()%1e5)+this.$utils.uniqueId()}getWidgetList(){return this.widgetConfig.widgetList}getWidgetConfig(){return this.widgetConfig}updateWidgetConfig(r){this.widgetConfig=r}getParentWidgetById(r){function t(n){for(const a of n){if(a.id===r){let i=n.findIndex(o=>o.id===r);return{widgetList:n,index:i}}if(a.widgetList&&a.widgetList.length>0){const i=t(a.widgetList);if(i)return i}}return null}return t(this.widgetConfig.widgetList)}}const tD=Object.assign({name:"sunForm"},{__name:"show",props:{widgetConfig:{type:Object,default:{}}},setup(e){let r=e,t=f.reactive(new rD({widgetConfig:r.widgetConfig,showMode:!0}));return console.log(t),(n,a)=>" sunForm "}});return{install:e=>{e.component("testBtn",tr),e.component("sunForm",tD)}}});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sun-form-v3",
3
3
  "private": false,
4
- "version": "1.0.22",
4
+ "version": "1.0.23",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"