@gopowerteam/form-render 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/form-render/index.d.ts +11 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/form-render/index.d.ts +11 -1
- package/dist/es/index.mjs +250 -241
- package/package.json +1 -1
|
@@ -33,6 +33,11 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
33
33
|
required: false;
|
|
34
34
|
default: string;
|
|
35
35
|
};
|
|
36
|
+
id: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
required: false;
|
|
39
|
+
default: string;
|
|
40
|
+
};
|
|
36
41
|
submitable: {
|
|
37
42
|
type: BooleanConstructor;
|
|
38
43
|
required: false;
|
|
@@ -49,7 +54,6 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
49
54
|
default: boolean;
|
|
50
55
|
};
|
|
51
56
|
}, {
|
|
52
|
-
formId: string;
|
|
53
57
|
formSource: import("vue").Ref<import("../interfaces").DataRecord>;
|
|
54
58
|
formInstance: import("vue").Ref<({
|
|
55
59
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -339,6 +343,11 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
339
343
|
required: false;
|
|
340
344
|
default: string;
|
|
341
345
|
};
|
|
346
|
+
id: {
|
|
347
|
+
type: StringConstructor;
|
|
348
|
+
required: false;
|
|
349
|
+
default: string;
|
|
350
|
+
};
|
|
342
351
|
submitable: {
|
|
343
352
|
type: BooleanConstructor;
|
|
344
353
|
required: false;
|
|
@@ -363,6 +372,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
363
372
|
name: string;
|
|
364
373
|
layout: "horizontal" | "vertical";
|
|
365
374
|
minWidth: number;
|
|
375
|
+
id: string;
|
|
366
376
|
submitable: boolean;
|
|
367
377
|
searchable: boolean;
|
|
368
378
|
}, {}>;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("@arco-design/web-vue"),F=require("dayjs"),D=require("./resolver.cjs");const _=Symbol("ArcoConfigProvider"),p="arco",M="$arco",x=e=>{var r,l,t;const n=a.getCurrentInstance(),o=a.inject(_,void 0),d=(t=(l=o==null?void 0:o.prefixCls)!=null?l:(r=n==null?void 0:n.appContext.config.globalProperties[M])==null?void 0:r.classPrefix)!=null?t:p;return e?`${d}-${e}`:d},T=Object.prototype.toString;function O(e){return T.call(e)==="[object Number]"&&e===e}var I=(e,r)=>{for(const[l,t]of r)e[l]=t;return e};const P=a.defineComponent({name:"IconDown",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:r}){const l=x("icon"),t=a.computed(()=>[l,`${l}-down`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const d={};return e.size&&(d.fontSize=O(e.size)?`${e.size}px`:e.size),e.rotate&&(d.transform=`rotate(${e.rotate}deg)`),d});return{cls:t,innerStyle:n,onClick:d=>{r("click",d)}}}}),R=["stroke-width","stroke-linecap","stroke-linejoin"],z=a.createElementVNode("path",{d:"M39.6 17.443 24.043 33 8.487 17.443"},null,-1),L=[z];function B(e,r,l,t,n,o){return a.openBlock(),a.createElementBlock("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:a.normalizeClass(e.cls),style:a.normalizeStyle(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:r[0]||(r[0]=(...d)=>e.onClick&&e.onClick(...d))},L,14,R)}var C=I(P,[["render",B]]);const E=Object.assign(C,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+C.name,C)}}),U=a.defineComponent({name:"IconUp",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:r}){const l=x("icon"),t=a.computed(()=>[l,`${l}-up`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const d={};return e.size&&(d.fontSize=O(e.size)?`${e.size}px`:e.size),e.rotate&&(d.transform=`rotate(${e.rotate}deg)`),d});return{cls:t,innerStyle:n,onClick:d=>{r("click",d)}}}}),q=["stroke-width","stroke-linecap","stroke-linejoin"],W=a.createElementVNode("path",{d:"M39.6 30.557 24.043 15 8.487 30.557"},null,-1),A=[W];function Y(e,r,l,t,n,o){return a.openBlock(),a.createElementBlock("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:a.normalizeClass(e.cls),style:a.normalizeStyle(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:r[0]||(r[0]=(...d)=>e.onClick&&e.onClick(...d))},A,14,q)}var $=I(U,[["render",Y]]);const G=Object.assign($,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+$.name,$)}}),w={id:Symbol("ID"),source:Symbol("Source")};function K(e,r){const l=a.ref({});return e==null||e.forEach(n=>{let o=null;n.default&&(o=(typeof n.default=="function"?n.default():n.default)||null),r&&r[n.key]!==void 0&&(o=r[n.key]),l.value[n.key]=o}),[l,n=>{l.value=n}]}function Q(e){function r(l,t){return e!=null&&e.disabledDate?e.disabledDate(l,t):!1}return(l,t)=>{switch(e==null?void 0:e.type){case"week":return a.createVNode(i.WeekPicker,{modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,"disabled-date":r,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"month":return a.createVNode(i.MonthPicker,{modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,"disabled-date":r,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"quarter":return a.createVNode(i.QuarterPicker,{modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,"disabled-date":r,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"year":return a.createVNode(i.YearPicker,{modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,"disabled-date":r,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"date":default:return a.createVNode(i.DatePicker,{"disabled-input":!0,modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,"disabled-date":r,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)}}}function X(e){return(r,l)=>{switch(e==null?void 0:e.type){case"number":return a.createVNode(i.InputNumber,{modelValue:r[l.key],"onUpdate:modelValue":t=>r[l.key]=t,hideButton:!0,"read-only":e==null?void 0:e.readonly,placeholder:e==null?void 0:e.placeholder,allowClear:e==null?void 0:e.clearable},null);case"string":default:return a.createVNode(i.Input,{modelValue:r[l.key],"onUpdate:modelValue":t=>r[l.key]=t,placeholder:e==null?void 0:e.placeholder,readonly:e==null?void 0:e.readonly,allowClear:e==null?void 0:e.clearable},null)}}}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function V(e,r,l){const t=a.watch(e,(...n)=>(a.nextTick(()=>t()),r(...n)),l);return t}function H(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const k=new WeakMap;function J(){const e=a.ref(new Map);return[e,l=>e.value=l]}function Z(e){let r,l=!1;const[t,n]=J(),o=()=>{if(!e.autoSumbit||!r)return;let c=r;for(;c&&c.$el.tagName!=="FORM";)c=c.$parent;c&&c.$el&&c.$el.dispatchEvent(new Event("submit"))},d=(c,u)=>{const s=c();s instanceof Promise?s.then(u):u(s)},m=async()=>{const c=k.get(e.options);switch(typeof c){case"function":k.set(e.options,n);return;case"object":n(c);return}k.set(e.options,n),d(e.options,u=>{const s=k.get(e.options);k.set(e.options,u),s(u)})},b=()=>{d(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}return(c,u)=>{let s;return e.default&&!l&&(c[u.key]=e.default,l=!0),a.createVNode(i.Select,{ref:f=>r=f,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":f=>c[u.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o},H(s=Array.from(t.value.entries()).map(([f,h])=>a.createVNode(i.Option,{key:f,value:f,label:h},null)))?s:{default:()=>[s]})}}function ee(e){function r(){e!=null&&e.autoSumbit}return(l,t)=>(e!=null&&e.default&&(l[t.key]=e.default),a.createVNode(i.Switch,{modelValue:l[t.key],"onUpdate:modelValue":n=>l[t.key]=n,checkedText:(e==null?void 0:e.openLabel)??"是",uncheckedText:(e==null?void 0:e.closeLabel)??"否",checkedValue:(e==null?void 0:e.openValue)??!0,uncheckedValue:(e==null?void 0:e.closeValue)??!1,onChange:r},null))}function te(e){return(r,l)=>{let t=[];function n(m){t=m}function o(m){if(m&&m.length===2){const[b,c]=m.sort(),u=F(b).startOf("days"),s=F(c).endOf("days");r[l.key]=[u.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD"),s.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD")]}}function d(m){return e!=null&&e.disabledDate?e.disabledDate(t,m):!1}return a.createVNode("div",null,[a.createVNode(i.RangePicker,{"disabled-input":!0,style:{width:"300px"},modelValue:r[l.key],"onUpdate:modelValue":m=>r[l.key]=m,onSelect:n,onChange:o,mode:e==null?void 0:e.type,allowClear:e==null?void 0:e.clearable,"disabled-date":d,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)])}}function re(e){return(r,l)=>a.createVNode(i.Textarea,{modelValue:r[l.key],"onUpdate:modelValue":t=>r[l.key]=t,placeholder:e==null?void 0:e.placeholder,autoSize:e==null?void 0:e.autosize,maxLength:e==null?void 0:e.maxLength},null)}const S=new WeakMap;function le(){const e=a.ref([]);return[e,l=>e.value=l]}function ae(e){let r,l=!1;const[t,n]=le(),o=()=>{if(!e.autoSumbit||!r)return;let u=r;for(;u&&u.$el.tagName!=="FORM";)u=u.$parent;u&&u.$el&&u.$el.dispatchEvent(new Event("submit"))},d=(u,s)=>{const f=u();f instanceof Promise?f.then(s):s(f)},m=async()=>{const u=S.get(e.options);switch(typeof u){case"function":S.set(e.options,n);return;case"object":n(u);return}S.set(e.options,n),d(e.options,s=>{const f=S.get(e.options);S.set(e.options,s),f(s)})},b=()=>{d(e.options,u=>{n(u)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}function c(u,s){var y;const f=((y=e.fieldNames)==null?void 0:y.title)||"title",h=s[f];return h?h.toLowerCase().includes(u.toLowerCase()):!1}return(u,s)=>(e.default&&!l&&(u[s.key]=e.default,l=!0),a.createVNode(i.TreeSelect,{ref:f=>r=f,multiple:e.multiple,modelValue:u[s.key],"onUpdate:modelValue":f=>u[s.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o,filterTreeNode:c,data:t.value,fieldNames:e.fieldNames,treeProps:{defaultExpandAll:e.defaultExpandAll}},null))}const v=new WeakMap;function ne(){const e=a.ref([]);return[e,l=>e.value=l]}function ue(e){let r,l=!1;const[t,n]=ne(),o=()=>{if(!e.autoSumbit||!r)return;let c=r;for(;c&&c.$el.tagName!=="FORM";)c=c.$parent;c&&c.$el&&c.$el.dispatchEvent(new Event("submit"))},d=(c,u)=>{const s=c();s instanceof Promise?s.then(u):u(s)},m=async()=>{const c=v.get(e.options);switch(typeof c){case"function":v.set(e.options,n);return;case"object":n(c);return}v.set(e.options,n),d(e.options,u=>{const s=v.get(e.options);v.set(e.options,u),s(u)})},b=()=>{d(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}return(c,u)=>(e.default&&!l&&(c[u.key]=e.default,l=!0),a.createVNode(i.Cascader,{pathMode:e.pathMode,ref:s=>r=s,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":s=>c[u.key]=s,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o,options:t.value},null))}function ce(e){return r=>e(r)}function de(){return{input:X,textarea:re,select:Z,treeSelect:ae,date:Q,switch:ee,dateRange:te,render:ce,cascader:ue}}function se(e,r){r.render||(r.render=t=>t.input());const l=r.render({...de()});return{default:()=>l(e,r)}}function oe(e,r){return a.h(i.FormItem,{field:r.key,label:r.title},se(e,r))}function N(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const j=a.defineComponent({props:{form:{type:Object,required:!0},value:{type:Object,required:!1},layout:{type:String,required:!1,default:"horizontal"},columns:{type:Number,required:!1},modelValue:{type:Object,required:!1},minWidth:{type:Number,required:!1,default:400},name:{type:String,required:!1,default:"form"},submitable:{type:Boolean,required:!1,default:!1},searchable:{type:Boolean,required:!1,default:!1},footer:{type:Boolean,required:!1,default:!1}},emits:["submit","cancel","update:model-value"],expose:["formSource","updateFormField","updateFormSource","reset"],setup(e){const r=Math.random().toString(32).slice(2).toUpperCase(),l=a.ref(),[t,n]=K(e.form,e.modelValue||e.value),o=a.ref(e.columns||0),d=a.ref(!0),m=()=>d.value=!d.value;a.provide(w.id,r),a.provide(w.source,t);const b=a.computed(()=>{if(!o.value)return 1;const h=e.form.reduce((y,g)=>y+((g==null?void 0:g.span)||1),0);return o.value-h%o.value}),c=a.computed(()=>e.form.reduce((h,y)=>(y.rule&&(h[y.key]=y.rule),h),{}));function u(){var y;if(e.columns)return;const h=(y=l.value)==null?void 0:y.$el;h&&(o.value=Math.floor(h.offsetWidth/e.minWidth))}a.onMounted(()=>{u()});function s(h,y){t.value[h]=y,n({...t})}function f(){var h;(h=l.value)==null||h.resetFields()}return window.addEventListener("resize",u),{formId:r,formSource:t,formInstance:l,formColumns:o,formRules:c,formCollspased:d,formActiosSpan:b,toggleFormCollapsed:m,updateFormField:s,updateFormSource:n,reset:f}},render(){const e=()=>{this.$emit("submit",this.formSource),this.$emit("update:model-value",this.formSource)},r=()=>{const t=[],n=this.footer?{span:this.formColumns}:{span:this.formActiosSpan};if(this.searchable&&(t.push(a.createVNode(i.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("搜索")]})),t.push(a.createVNode(i.Button,{type:"secondary",onClick:()=>{var o;return(o=this.formInstance)==null?void 0:o.resetFields()}},{default:()=>[a.createTextVNode("重置")]}))),this.submitable&&(t.push(a.createVNode(i.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("提交")]})),t.push(a.createVNode(i.Button,{type:"secondary",onClick:()=>this.$emit("cancel")},{default:()=>[a.createTextVNode("取消")]}))),this.form.some(o=>!!o.collapsed)&&t.push(a.createVNode(i.Button,{onClick:this.toggleFormCollapsed},{default:()=>this.formCollspased?"展开":"收起",icon:()=>this.formCollspased?a.createVNode(E,null,null):a.createVNode(G,null,null)})),this.$slots.actions&&t.push(...this.$slots.actions()),t.length)return a.createVNode(i.GridItem,n,{default:()=>[a.createVNode(i.FormItem,{hideLabel:!0,contentClass:this.footer?"form-footer":""},{default:()=>[a.createVNode(i.Space,null,N(t)?t:{default:()=>[t]})]})]})},l=this.form.filter(t=>this.formCollspased?!t.collapsed:!0).filter(t=>{switch(!0){case typeof t.visiable=="boolean":return t.visiable;case typeof t.visiable=="function":return t.visiable(this.formSource);default:return!0}});return a.createVNode("div",{class:"form-render"},[a.createVNode(i.Form,a.mergeProps({name:this.name},{labelAlign:"left",layout:this.$props.layout,rules:this.formRules,onSubmitSuccess:e,"auto-label-width":!0,ref:t=>this.formInstance=t,model:this.formSource}),{default:()=>[a.createVNode(i.Grid,{cols:this.formColumns,"col-gap":24,"rol-gap":10},{default:()=>[l.filter(()=>this.formColumns!==0).map(t=>{let n;return a.createVNode(i.GridItem,{span:t.span},N(n=oe(this.formSource,t))?n:{default:()=>[n]})}),r()]})]})])}});function ie(e){return e}function fe(e){const r=a.getCurrentInstance(),l=a.ref();function t(){var o,d;const n=(d=(o=r==null?void 0:r.proxy)==null?void 0:o.$refs)==null?void 0:d[e];n&&(l.value=n)}return a.onMounted(t),a.onUpdated(t),l}const me={install(e,r){e.component("FormRender",j)}};exports.FormRenderResolver=D.FormRenderResolver;exports.FormRender=j;exports.default=me;exports.defineForm=ie;exports.useForm=fe;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("@arco-design/web-vue"),F=require("dayjs"),D=require("./resolver.cjs");const _=Symbol("ArcoConfigProvider"),M="arco",T="$arco",x=e=>{var t,l,r;const n=a.getCurrentInstance(),o=a.inject(_,void 0),s=(r=(l=o==null?void 0:o.prefixCls)!=null?l:(t=n==null?void 0:n.appContext.config.globalProperties[T])==null?void 0:t.classPrefix)!=null?r:M;return e?`${s}-${e}`:s},P=Object.prototype.toString;function O(e){return P.call(e)==="[object Number]"&&e===e}var I=(e,t)=>{for(const[l,r]of t)e[l]=r;return e};const R=a.defineComponent({name:"IconDown",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const l=x("icon"),r=a.computed(()=>[l,`${l}-down`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=O(e.size)?`${e.size}px`:e.size),e.rotate&&(s.transform=`rotate(${e.rotate}deg)`),s});return{cls:r,innerStyle:n,onClick:s=>{t("click",s)}}}}),p=["stroke-width","stroke-linecap","stroke-linejoin"],z=a.createElementVNode("path",{d:"M39.6 17.443 24.043 33 8.487 17.443"},null,-1),E=[z];function L(e,t,l,r,n,o){return a.openBlock(),a.createElementBlock("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:a.normalizeClass(e.cls),style:a.normalizeStyle(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>e.onClick&&e.onClick(...s))},E,14,p)}var $=I(R,[["render",L]]);const q=Object.assign($,{install:(e,t)=>{var l;const r=(l=t==null?void 0:t.iconPrefix)!=null?l:"";e.component(r+$.name,$)}}),B=a.defineComponent({name:"IconUp",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const l=x("icon"),r=a.computed(()=>[l,`${l}-up`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=O(e.size)?`${e.size}px`:e.size),e.rotate&&(s.transform=`rotate(${e.rotate}deg)`),s});return{cls:r,innerStyle:n,onClick:s=>{t("click",s)}}}}),U=["stroke-width","stroke-linecap","stroke-linejoin"],W=a.createElementVNode("path",{d:"M39.6 30.557 24.043 15 8.487 30.557"},null,-1),A=[W];function Y(e,t,l,r,n,o){return a.openBlock(),a.createElementBlock("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:a.normalizeClass(e.cls),style:a.normalizeStyle(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>e.onClick&&e.onClick(...s))},A,14,U)}var C=I(B,[["render",Y]]);const G=Object.assign(C,{install:(e,t)=>{var l;const r=(l=t==null?void 0:t.iconPrefix)!=null?l:"";e.component(r+C.name,C)}}),w={id:Symbol("ID"),source:Symbol("Source")};function K(e,t){const l=a.ref({});return e==null||e.forEach(n=>{let o=null;n.default&&(o=(typeof n.default=="function"?n.default():n.default)||null),t&&t[n.key]!==void 0&&(o=t[n.key]),l.value[n.key]=o}),[l,n=>{l.value=n}]}function Q(e){function t(l,r){return e!=null&&e.disabledDate?e.disabledDate(l,r):!1}return(l,r)=>{switch(e==null?void 0:e.type){case"week":return a.createVNode(i.WeekPicker,{modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,"disabled-date":t,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"month":return a.createVNode(i.MonthPicker,{modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,"disabled-date":t,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"quarter":return a.createVNode(i.QuarterPicker,{modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,"disabled-date":t,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"year":return a.createVNode(i.YearPicker,{modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,"disabled-date":t,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null);case"date":default:return a.createVNode(i.DatePicker,{"disabled-input":!0,modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,"disabled-date":t,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)}}}function X(e){return(t,l)=>{switch(e==null?void 0:e.type){case"number":return a.createVNode(i.InputNumber,{modelValue:t[l.key],"onUpdate:modelValue":r=>t[l.key]=r,hideButton:!0,"read-only":e==null?void 0:e.readonly,placeholder:e==null?void 0:e.placeholder,allowClear:e==null?void 0:e.clearable},null);case"string":default:return a.createVNode(i.Input,{modelValue:t[l.key],"onUpdate:modelValue":r=>t[l.key]=r,placeholder:e==null?void 0:e.placeholder,readonly:e==null?void 0:e.readonly,allowClear:e==null?void 0:e.clearable},null)}}}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function V(e,t,l){const r=a.watch(e,(...n)=>(a.nextTick(()=>r()),t(...n)),l);return r}function H(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const k=new WeakMap;function J(){const e=a.ref(new Map);return[e,l=>e.value=l]}function Z(e){let t,l=!1;const[r,n]=J(),o=()=>{if(!e.autoSumbit||!t)return;let c=t;for(;c&&c.$el.tagName!=="FORM";)c=c.$parent;c&&c.$el&&c.$el.dispatchEvent(new Event("submit"))},s=(c,u)=>{const d=c();d instanceof Promise?d.then(u):u(d)},h=async()=>{const c=k.get(e.options);switch(typeof c){case"function":k.set(e.options,n);return;case"object":n(c);return}k.set(e.options,n),s(e.options,u=>{const d=k.get(e.options);k.set(e.options,u),d(u)})},b=()=>{s(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?h():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:r.value=e.options}return(c,u)=>{let d;return e.default&&!l&&(c[u.key]=e.default,l=!0),a.createVNode(i.Select,{ref:f=>t=f,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":f=>c[u.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o},H(d=Array.from(r.value.entries()).map(([f,m])=>a.createVNode(i.Option,{key:f,value:f,label:m},null)))?d:{default:()=>[d]})}}function ee(e){function t(){e!=null&&e.autoSumbit}return(l,r)=>(e!=null&&e.default&&(l[r.key]=e.default),a.createVNode(i.Switch,{modelValue:l[r.key],"onUpdate:modelValue":n=>l[r.key]=n,checkedText:(e==null?void 0:e.openLabel)??"是",uncheckedText:(e==null?void 0:e.closeLabel)??"否",checkedValue:(e==null?void 0:e.openValue)??!0,uncheckedValue:(e==null?void 0:e.closeValue)??!1,onChange:t},null))}function te(e){return(t,l)=>{let r=[];function n(h){r=h}function o(h){if(h&&h.length===2){const[b,c]=h.sort(),u=F(b).startOf("days"),d=F(c).endOf("days");t[l.key]=[u.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD"),d.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD")]}}function s(h){return e!=null&&e.disabledDate?e.disabledDate(r,h):!1}return a.createVNode("div",null,[a.createVNode(i.RangePicker,{"disabled-input":!0,style:{width:"300px"},modelValue:t[l.key],"onUpdate:modelValue":h=>t[l.key]=h,onSelect:n,onChange:o,mode:e==null?void 0:e.type,allowClear:e==null?void 0:e.clearable,"disabled-date":s,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)])}}function re(e){return(t,l)=>a.createVNode(i.Textarea,{modelValue:t[l.key],"onUpdate:modelValue":r=>t[l.key]=r,placeholder:e==null?void 0:e.placeholder,autoSize:e==null?void 0:e.autosize,maxLength:e==null?void 0:e.maxLength},null)}const S=new WeakMap;function le(){const e=a.ref([]);return[e,l=>e.value=l]}function ae(e){let t,l=!1;const[r,n]=le(),o=()=>{if(!e.autoSumbit||!t)return;let u=t;for(;u&&u.$el.tagName!=="FORM";)u=u.$parent;u&&u.$el&&u.$el.dispatchEvent(new Event("submit"))},s=(u,d)=>{const f=u();f instanceof Promise?f.then(d):d(f)},h=async()=>{const u=S.get(e.options);switch(typeof u){case"function":S.set(e.options,n);return;case"object":n(u);return}S.set(e.options,n),s(e.options,d=>{const f=S.get(e.options);S.set(e.options,d),f(d)})},b=()=>{s(e.options,u=>{n(u)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?h():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:r.value=e.options}function c(u,d){var y;const f=((y=e.fieldNames)==null?void 0:y.title)||"title",m=d[f];return m?m.toLowerCase().includes(u.toLowerCase()):!1}return(u,d)=>(e.default&&!l&&(u[d.key]=e.default,l=!0),a.createVNode(i.TreeSelect,{ref:f=>t=f,multiple:e.multiple,modelValue:u[d.key],"onUpdate:modelValue":f=>u[d.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o,filterTreeNode:c,data:r.value,fieldNames:e.fieldNames,treeProps:{defaultExpandAll:e.defaultExpandAll}},null))}const v=new WeakMap;function ne(){const e=a.ref([]);return[e,l=>e.value=l]}function ue(e){let t,l=!1;const[r,n]=ne(),o=()=>{if(!e.autoSumbit||!t)return;let c=t;for(;c&&c.$el.tagName!=="FORM";)c=c.$parent;c&&c.$el&&c.$el.dispatchEvent(new Event("submit"))},s=(c,u)=>{const d=c();d instanceof Promise?d.then(u):u(d)},h=async()=>{const c=v.get(e.options);switch(typeof c){case"function":v.set(e.options,n);return;case"object":n(c);return}v.set(e.options,n),s(e.options,u=>{const d=v.get(e.options);v.set(e.options,u),d(u)})},b=()=>{s(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?h():b();break}case a.isRef(e.options):{V(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:r.value=e.options}return(c,u)=>(e.default&&!l&&(c[u.key]=e.default,l=!0),a.createVNode(i.Cascader,{pathMode:e.pathMode,ref:d=>t=d,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":d=>c[u.key]=d,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o,options:r.value},null))}function ce(e){return t=>e(t)}function de(){return{input:X,textarea:re,select:Z,treeSelect:ae,date:Q,switch:ee,dateRange:te,render:ce,cascader:ue}}function se(e,t){t.render||(t.render=r=>r.input());const l=t.render({...de()});return{default:()=>l(e,t)}}function oe(e,t){return a.h(i.FormItem,{field:t.key,label:t.title},se(e,t))}function N(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const j=a.defineComponent({props:{form:{type:Object,required:!0},value:{type:Object,required:!1},layout:{type:String,required:!1,default:"horizontal"},columns:{type:Number,required:!1},modelValue:{type:Object,required:!1},minWidth:{type:Number,required:!1,default:400},name:{type:String,required:!1,default:`form-${Math.random().toString(32).slice(2)}`},id:{type:String,required:!1,default:`form-${Math.random().toString(32).slice(2)}`},submitable:{type:Boolean,required:!1,default:!1},searchable:{type:Boolean,required:!1,default:!1},footer:{type:Boolean,required:!1,default:!1}},emits:["submit","cancel","update:model-value"],expose:["formSource","updateFormField","updateFormSource","reset"],setup(e){const t=a.ref(),[l,r]=K(e.form,e.modelValue||e.value),n=a.ref(e.columns||0),o=a.ref(!0),s=()=>o.value=!o.value;a.provide(w.id,e.id),a.provide(w.source,l);const h=a.computed(()=>{if(!n.value)return 1;const m=e.form.reduce((y,g)=>y+((g==null?void 0:g.span)||1),0);return n.value-m%n.value}),b=a.computed(()=>e.form.reduce((m,y)=>(y.rule&&(m[y.key]=y.rule),m),{}));function c(){var y;if(e.columns)return;const m=(y=t.value)==null?void 0:y.$el;m&&(n.value=Math.floor(m.offsetWidth/e.minWidth))}function u(){var y;const m=(y=t.value)==null?void 0:y.$el;m&&(m.id=e.id)}a.onMounted(()=>{c(),u()});function d(m,y){l.value[m]=y,r({...l})}function f(){var m;(m=t.value)==null||m.resetFields()}return window.addEventListener("resize",c),{formSource:l,formInstance:t,formColumns:n,formRules:b,formCollspased:o,formActiosSpan:h,toggleFormCollapsed:s,updateFormField:d,updateFormSource:r,reset:f}},render(){const e=()=>{this.$emit("submit",this.formSource),this.$emit("update:model-value",this.formSource)},t=()=>{const r=[],n=this.footer?{span:this.formColumns}:{span:this.formActiosSpan};if(this.searchable&&(r.push(a.createVNode(i.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("搜索")]})),r.push(a.createVNode(i.Button,{type:"secondary",onClick:()=>{var o;return(o=this.formInstance)==null?void 0:o.resetFields()}},{default:()=>[a.createTextVNode("重置")]}))),this.submitable&&(r.push(a.createVNode(i.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("提交")]})),r.push(a.createVNode(i.Button,{type:"secondary",onClick:()=>this.$emit("cancel")},{default:()=>[a.createTextVNode("取消")]}))),this.form.some(o=>!!o.collapsed)&&r.push(a.createVNode(i.Button,{onClick:this.toggleFormCollapsed},{default:()=>this.formCollspased?"展开":"收起",icon:()=>this.formCollspased?a.createVNode(q,null,null):a.createVNode(G,null,null)})),this.$slots.actions&&r.push(...this.$slots.actions()),r.length)return a.createVNode(i.GridItem,n,{default:()=>[a.createVNode(i.FormItem,{hideLabel:!0,contentClass:this.footer?"form-footer":""},{default:()=>[a.createVNode(i.Space,null,N(r)?r:{default:()=>[r]})]})]})},l=this.form.filter(r=>this.formCollspased?!r.collapsed:!0).filter(r=>{switch(!0){case typeof r.visiable=="boolean":return r.visiable;case typeof r.visiable=="function":return r.visiable(this.formSource);default:return!0}});return a.createVNode("div",{class:"form-render"},[a.createVNode(i.Form,a.mergeProps({name:this.name},{labelAlign:"left",layout:this.$props.layout,rules:this.formRules,onSubmitSuccess:e,"auto-label-width":!0,ref:r=>this.formInstance=r,model:this.formSource}),{default:()=>[a.createVNode(i.Grid,{cols:this.formColumns,"col-gap":24,"rol-gap":10},{default:()=>[l.filter(()=>this.formColumns!==0).map(r=>{let n;return a.createVNode(i.GridItem,{span:r.span},N(n=oe(this.formSource,r))?n:{default:()=>[n]})}),t()]})]})])}});function ie(e){return e}function fe(e){const t=a.getCurrentInstance(),l=a.ref();function r(){var o,s;const n=(s=(o=t==null?void 0:t.proxy)==null?void 0:o.$refs)==null?void 0:s[e];n&&(l.value=n)}return a.onMounted(r),a.onUpdated(r),l}const me={install(e,t){e.component("FormRender",j)}};exports.FormRenderResolver=D.FormRenderResolver;exports.FormRender=j;exports.default=me;exports.defineForm=ie;exports.useForm=fe;
|
|
@@ -33,6 +33,11 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
33
33
|
required: false;
|
|
34
34
|
default: string;
|
|
35
35
|
};
|
|
36
|
+
id: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
required: false;
|
|
39
|
+
default: string;
|
|
40
|
+
};
|
|
36
41
|
submitable: {
|
|
37
42
|
type: BooleanConstructor;
|
|
38
43
|
required: false;
|
|
@@ -49,7 +54,6 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
49
54
|
default: boolean;
|
|
50
55
|
};
|
|
51
56
|
}, {
|
|
52
|
-
formId: string;
|
|
53
57
|
formSource: import("vue").Ref<import("../interfaces").DataRecord>;
|
|
54
58
|
formInstance: import("vue").Ref<({
|
|
55
59
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -339,6 +343,11 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
339
343
|
required: false;
|
|
340
344
|
default: string;
|
|
341
345
|
};
|
|
346
|
+
id: {
|
|
347
|
+
type: StringConstructor;
|
|
348
|
+
required: false;
|
|
349
|
+
default: string;
|
|
350
|
+
};
|
|
342
351
|
submitable: {
|
|
343
352
|
type: BooleanConstructor;
|
|
344
353
|
required: false;
|
|
@@ -363,6 +372,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
363
372
|
name: string;
|
|
364
373
|
layout: "horizontal" | "vertical";
|
|
365
374
|
minWidth: number;
|
|
375
|
+
id: string;
|
|
366
376
|
submitable: boolean;
|
|
367
377
|
searchable: boolean;
|
|
368
378
|
}, {}>;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getCurrentInstance as P, inject as Y, defineComponent as O, computed as b, openBlock as
|
|
2
|
-
import { DatePicker as J, YearPicker as Z, QuarterPicker as ee, MonthPicker as te, WeekPicker as le, Input as re, InputNumber as ae, Select as ne, Option as ue, Switch as ce, RangePicker as de, Textarea as se, TreeSelect as ie, Cascader as
|
|
1
|
+
import { getCurrentInstance as P, inject as Y, defineComponent as O, computed as b, openBlock as T, createElementBlock as L, normalizeClass as z, normalizeStyle as R, createElementVNode as p, ref as k, createVNode as i, watch as G, nextTick as K, isRef as V, isVNode as E, h as Q, provide as D, onMounted as U, mergeProps as X, createTextVNode as C, onUpdated as H } from "vue";
|
|
2
|
+
import { DatePicker as J, YearPicker as Z, QuarterPicker as ee, MonthPicker as te, WeekPicker as le, Input as re, InputNumber as ae, Select as ne, Option as ue, Switch as ce, RangePicker as de, Textarea as se, TreeSelect as ie, Cascader as fe, FormItem as q, Form as oe, Grid as me, GridItem as j, Button as S, Space as he } from "@arco-design/web-vue";
|
|
3
3
|
import _ from "dayjs";
|
|
4
4
|
import { FormRenderResolver as rt } from "./resolver.mjs";
|
|
5
5
|
const ye = Symbol("ArcoConfigProvider"), ke = "arco", be = "$arco", W = (e) => {
|
|
6
|
-
var
|
|
7
|
-
const a = P(), s = Y(ye, void 0),
|
|
8
|
-
return e ? `${
|
|
6
|
+
var t, r, l;
|
|
7
|
+
const a = P(), s = Y(ye, void 0), d = (l = (r = s == null ? void 0 : s.prefixCls) != null ? r : (t = a == null ? void 0 : a.appContext.config.globalProperties[be]) == null ? void 0 : t.classPrefix) != null ? l : ke;
|
|
8
|
+
return e ? `${d}-${e}` : d;
|
|
9
9
|
}, Se = Object.prototype.toString;
|
|
10
10
|
function A(e) {
|
|
11
11
|
return Se.call(e) === "[object Number]" && e === e;
|
|
12
12
|
}
|
|
13
|
-
var B = (e,
|
|
14
|
-
for (const [r,
|
|
15
|
-
e[r] =
|
|
13
|
+
var B = (e, t) => {
|
|
14
|
+
for (const [r, l] of t)
|
|
15
|
+
e[r] = l;
|
|
16
16
|
return e;
|
|
17
17
|
};
|
|
18
18
|
const ve = O({
|
|
@@ -42,45 +42,45 @@ const ve = O({
|
|
|
42
42
|
click: (e) => !0
|
|
43
43
|
},
|
|
44
44
|
setup(e, {
|
|
45
|
-
emit:
|
|
45
|
+
emit: t
|
|
46
46
|
}) {
|
|
47
|
-
const r = W("icon"),
|
|
47
|
+
const r = W("icon"), l = b(() => [r, `${r}-down`, {
|
|
48
48
|
[`${r}-spin`]: e.spin
|
|
49
49
|
}]), a = b(() => {
|
|
50
|
-
const
|
|
51
|
-
return e.size && (
|
|
50
|
+
const d = {};
|
|
51
|
+
return e.size && (d.fontSize = A(e.size) ? `${e.size}px` : e.size), e.rotate && (d.transform = `rotate(${e.rotate}deg)`), d;
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
|
-
cls:
|
|
54
|
+
cls: l,
|
|
55
55
|
innerStyle: a,
|
|
56
|
-
onClick: (
|
|
57
|
-
|
|
56
|
+
onClick: (d) => {
|
|
57
|
+
t("click", d);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
61
|
+
}), $e = ["stroke-width", "stroke-linecap", "stroke-linejoin"], ge = /* @__PURE__ */ p("path", {
|
|
62
62
|
d: "M39.6 17.443 24.043 33 8.487 17.443"
|
|
63
|
-
}, null, -1), Ce = [
|
|
64
|
-
function we(e,
|
|
65
|
-
return
|
|
63
|
+
}, null, -1), Ce = [ge];
|
|
64
|
+
function we(e, t, r, l, a, s) {
|
|
65
|
+
return T(), L("svg", {
|
|
66
66
|
viewBox: "0 0 48 48",
|
|
67
67
|
fill: "none",
|
|
68
68
|
xmlns: "http://www.w3.org/2000/svg",
|
|
69
69
|
stroke: "currentColor",
|
|
70
|
-
class:
|
|
71
|
-
style:
|
|
70
|
+
class: z(e.cls),
|
|
71
|
+
style: R(e.innerStyle),
|
|
72
72
|
"stroke-width": e.strokeWidth,
|
|
73
73
|
"stroke-linecap": e.strokeLinecap,
|
|
74
74
|
"stroke-linejoin": e.strokeLinejoin,
|
|
75
|
-
onClick:
|
|
76
|
-
}, Ce, 14,
|
|
75
|
+
onClick: t[0] || (t[0] = (...d) => e.onClick && e.onClick(...d))
|
|
76
|
+
}, Ce, 14, $e);
|
|
77
77
|
}
|
|
78
78
|
var F = /* @__PURE__ */ B(ve, [["render", we]]);
|
|
79
79
|
const Fe = Object.assign(F, {
|
|
80
|
-
install: (e,
|
|
80
|
+
install: (e, t) => {
|
|
81
81
|
var r;
|
|
82
|
-
const
|
|
83
|
-
e.component(
|
|
82
|
+
const l = (r = t == null ? void 0 : t.iconPrefix) != null ? r : "";
|
|
83
|
+
e.component(l + F.name, F);
|
|
84
84
|
}
|
|
85
85
|
}), xe = O({
|
|
86
86
|
name: "IconUp",
|
|
@@ -109,94 +109,94 @@ const Fe = Object.assign(F, {
|
|
|
109
109
|
click: (e) => !0
|
|
110
110
|
},
|
|
111
111
|
setup(e, {
|
|
112
|
-
emit:
|
|
112
|
+
emit: t
|
|
113
113
|
}) {
|
|
114
|
-
const r = W("icon"),
|
|
114
|
+
const r = W("icon"), l = b(() => [r, `${r}-up`, {
|
|
115
115
|
[`${r}-spin`]: e.spin
|
|
116
116
|
}]), a = b(() => {
|
|
117
|
-
const
|
|
118
|
-
return e.size && (
|
|
117
|
+
const d = {};
|
|
118
|
+
return e.size && (d.fontSize = A(e.size) ? `${e.size}px` : e.size), e.rotate && (d.transform = `rotate(${e.rotate}deg)`), d;
|
|
119
119
|
});
|
|
120
120
|
return {
|
|
121
|
-
cls:
|
|
121
|
+
cls: l,
|
|
122
122
|
innerStyle: a,
|
|
123
|
-
onClick: (
|
|
124
|
-
|
|
123
|
+
onClick: (d) => {
|
|
124
|
+
t("click", d);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
}), Oe = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ve = /* @__PURE__ */
|
|
128
|
+
}), Oe = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ve = /* @__PURE__ */ p("path", {
|
|
129
129
|
d: "M39.6 30.557 24.043 15 8.487 30.557"
|
|
130
130
|
}, null, -1), Ie = [Ve];
|
|
131
|
-
function De(e,
|
|
132
|
-
return
|
|
131
|
+
function De(e, t, r, l, a, s) {
|
|
132
|
+
return T(), L("svg", {
|
|
133
133
|
viewBox: "0 0 48 48",
|
|
134
134
|
fill: "none",
|
|
135
135
|
xmlns: "http://www.w3.org/2000/svg",
|
|
136
136
|
stroke: "currentColor",
|
|
137
|
-
class:
|
|
138
|
-
style:
|
|
137
|
+
class: z(e.cls),
|
|
138
|
+
style: R(e.innerStyle),
|
|
139
139
|
"stroke-width": e.strokeWidth,
|
|
140
140
|
"stroke-linecap": e.strokeLinecap,
|
|
141
141
|
"stroke-linejoin": e.strokeLinejoin,
|
|
142
|
-
onClick:
|
|
142
|
+
onClick: t[0] || (t[0] = (...d) => e.onClick && e.onClick(...d))
|
|
143
143
|
}, Ie, 14, Oe);
|
|
144
144
|
}
|
|
145
145
|
var x = /* @__PURE__ */ B(xe, [["render", De]]);
|
|
146
146
|
const je = Object.assign(x, {
|
|
147
|
-
install: (e,
|
|
147
|
+
install: (e, t) => {
|
|
148
148
|
var r;
|
|
149
|
-
const
|
|
150
|
-
e.component(
|
|
149
|
+
const l = (r = t == null ? void 0 : t.iconPrefix) != null ? r : "";
|
|
150
|
+
e.component(l + x.name, x);
|
|
151
151
|
}
|
|
152
152
|
}), N = {
|
|
153
153
|
id: Symbol("ID"),
|
|
154
154
|
source: Symbol("Source")
|
|
155
155
|
};
|
|
156
|
-
function _e(e,
|
|
156
|
+
function _e(e, t) {
|
|
157
157
|
const r = k({});
|
|
158
158
|
return e == null || e.forEach((a) => {
|
|
159
159
|
let s = null;
|
|
160
|
-
a.default && (s = (typeof a.default == "function" ? a.default() : a.default) || null),
|
|
160
|
+
a.default && (s = (typeof a.default == "function" ? a.default() : a.default) || null), t && t[a.key] !== void 0 && (s = t[a.key]), r.value[a.key] = s;
|
|
161
161
|
}), [r, (a) => {
|
|
162
162
|
r.value = a;
|
|
163
163
|
}];
|
|
164
164
|
}
|
|
165
165
|
function Ne(e) {
|
|
166
|
-
function
|
|
167
|
-
return e != null && e.disabledDate ? e.disabledDate(r,
|
|
166
|
+
function t(r, l) {
|
|
167
|
+
return e != null && e.disabledDate ? e.disabledDate(r, l) : !1;
|
|
168
168
|
}
|
|
169
|
-
return (r,
|
|
169
|
+
return (r, l) => {
|
|
170
170
|
switch (e == null ? void 0 : e.type) {
|
|
171
171
|
case "week":
|
|
172
172
|
return i(le, {
|
|
173
|
-
modelValue: r[
|
|
174
|
-
"onUpdate:modelValue": (a) => r[
|
|
175
|
-
"disabled-date":
|
|
173
|
+
modelValue: r[l.key],
|
|
174
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
175
|
+
"disabled-date": t,
|
|
176
176
|
format: e == null ? void 0 : e.labelFormat,
|
|
177
177
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
178
178
|
}, null);
|
|
179
179
|
case "month":
|
|
180
180
|
return i(te, {
|
|
181
|
-
modelValue: r[
|
|
182
|
-
"onUpdate:modelValue": (a) => r[
|
|
183
|
-
"disabled-date":
|
|
181
|
+
modelValue: r[l.key],
|
|
182
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
183
|
+
"disabled-date": t,
|
|
184
184
|
format: e == null ? void 0 : e.labelFormat,
|
|
185
185
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
186
186
|
}, null);
|
|
187
187
|
case "quarter":
|
|
188
188
|
return i(ee, {
|
|
189
|
-
modelValue: r[
|
|
190
|
-
"onUpdate:modelValue": (a) => r[
|
|
191
|
-
"disabled-date":
|
|
189
|
+
modelValue: r[l.key],
|
|
190
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
191
|
+
"disabled-date": t,
|
|
192
192
|
format: e == null ? void 0 : e.labelFormat,
|
|
193
193
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
194
194
|
}, null);
|
|
195
195
|
case "year":
|
|
196
196
|
return i(Z, {
|
|
197
|
-
modelValue: r[
|
|
198
|
-
"onUpdate:modelValue": (a) => r[
|
|
199
|
-
"disabled-date":
|
|
197
|
+
modelValue: r[l.key],
|
|
198
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
199
|
+
"disabled-date": t,
|
|
200
200
|
format: e == null ? void 0 : e.labelFormat,
|
|
201
201
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
202
202
|
}, null);
|
|
@@ -204,9 +204,9 @@ function Ne(e) {
|
|
|
204
204
|
default:
|
|
205
205
|
return i(J, {
|
|
206
206
|
"disabled-input": !0,
|
|
207
|
-
modelValue: r[
|
|
208
|
-
"onUpdate:modelValue": (a) => r[
|
|
209
|
-
"disabled-date":
|
|
207
|
+
modelValue: r[l.key],
|
|
208
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
209
|
+
"disabled-date": t,
|
|
210
210
|
format: e == null ? void 0 : e.labelFormat,
|
|
211
211
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
212
212
|
}, null);
|
|
@@ -214,12 +214,12 @@ function Ne(e) {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
function Me(e) {
|
|
217
|
-
return (
|
|
217
|
+
return (t, r) => {
|
|
218
218
|
switch (e == null ? void 0 : e.type) {
|
|
219
219
|
case "number":
|
|
220
220
|
return i(ae, {
|
|
221
|
-
modelValue:
|
|
222
|
-
"onUpdate:modelValue": (
|
|
221
|
+
modelValue: t[r.key],
|
|
222
|
+
"onUpdate:modelValue": (l) => t[r.key] = l,
|
|
223
223
|
hideButton: !0,
|
|
224
224
|
"read-only": e == null ? void 0 : e.readonly,
|
|
225
225
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
@@ -228,8 +228,8 @@ function Me(e) {
|
|
|
228
228
|
case "string":
|
|
229
229
|
default:
|
|
230
230
|
return i(re, {
|
|
231
|
-
modelValue:
|
|
232
|
-
"onUpdate:modelValue": (
|
|
231
|
+
modelValue: t[r.key],
|
|
232
|
+
"onUpdate:modelValue": (l) => t[r.key] = l,
|
|
233
233
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
234
234
|
readonly: e == null ? void 0 : e.readonly,
|
|
235
235
|
allowClear: e == null ? void 0 : e.clearable
|
|
@@ -238,31 +238,31 @@ function Me(e) {
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
241
|
-
function I(e,
|
|
242
|
-
const
|
|
243
|
-
return
|
|
241
|
+
function I(e, t, r) {
|
|
242
|
+
const l = G(e, (...a) => (K(() => l()), t(...a)), r);
|
|
243
|
+
return l;
|
|
244
244
|
}
|
|
245
245
|
function Pe(e) {
|
|
246
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
246
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !E(e);
|
|
247
247
|
}
|
|
248
248
|
const v = /* @__PURE__ */ new WeakMap();
|
|
249
|
-
function
|
|
249
|
+
function Te() {
|
|
250
250
|
const e = k(/* @__PURE__ */ new Map());
|
|
251
251
|
return [e, (r) => e.value = r];
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
let
|
|
255
|
-
const [
|
|
256
|
-
if (!e.autoSumbit || !
|
|
253
|
+
function Le(e) {
|
|
254
|
+
let t, r = !1;
|
|
255
|
+
const [l, a] = Te(), s = () => {
|
|
256
|
+
if (!e.autoSumbit || !t)
|
|
257
257
|
return;
|
|
258
|
-
let u =
|
|
258
|
+
let u = t;
|
|
259
259
|
for (; u && u.$el.tagName !== "FORM"; )
|
|
260
260
|
u = u.$parent;
|
|
261
261
|
u && u.$el && u.$el.dispatchEvent(new Event("submit"));
|
|
262
|
-
},
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
},
|
|
262
|
+
}, d = (u, n) => {
|
|
263
|
+
const c = u();
|
|
264
|
+
c instanceof Promise ? c.then(n) : n(c);
|
|
265
|
+
}, m = async () => {
|
|
266
266
|
const u = v.get(e.options);
|
|
267
267
|
switch (typeof u) {
|
|
268
268
|
case "function":
|
|
@@ -272,18 +272,18 @@ function Te(e) {
|
|
|
272
272
|
a(u);
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
v.set(e.options, a),
|
|
276
|
-
const
|
|
277
|
-
v.set(e.options, n),
|
|
275
|
+
v.set(e.options, a), d(e.options, (n) => {
|
|
276
|
+
const c = v.get(e.options);
|
|
277
|
+
v.set(e.options, n), c(n);
|
|
278
278
|
});
|
|
279
279
|
}, y = () => {
|
|
280
|
-
|
|
280
|
+
d(e.options, (u) => {
|
|
281
281
|
a(u);
|
|
282
282
|
});
|
|
283
283
|
};
|
|
284
284
|
switch (!0) {
|
|
285
285
|
case e.options instanceof Function: {
|
|
286
|
-
e.cache !== !1 ?
|
|
286
|
+
e.cache !== !1 ? m() : y();
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
case V(e.options): {
|
|
@@ -295,123 +295,123 @@ function Te(e) {
|
|
|
295
295
|
break;
|
|
296
296
|
}
|
|
297
297
|
default:
|
|
298
|
-
|
|
298
|
+
l.value = e.options;
|
|
299
299
|
}
|
|
300
300
|
return (u, n) => {
|
|
301
|
-
let
|
|
301
|
+
let c;
|
|
302
302
|
return e.default && !r && (u[n.key] = e.default, r = !0), i(ne, {
|
|
303
|
-
ref: (
|
|
303
|
+
ref: (f) => t = f,
|
|
304
304
|
multiple: e.multiple,
|
|
305
305
|
modelValue: u[n.key],
|
|
306
|
-
"onUpdate:modelValue": (
|
|
306
|
+
"onUpdate:modelValue": (f) => u[n.key] = f,
|
|
307
307
|
placeholder: e.placeholder,
|
|
308
308
|
allowClear: e.clearable,
|
|
309
309
|
allowSearch: e.searchable,
|
|
310
310
|
maxTagCount: e.maxTagCount ?? 2,
|
|
311
311
|
onChange: s
|
|
312
|
-
}, Pe(
|
|
313
|
-
key:
|
|
314
|
-
value:
|
|
315
|
-
label:
|
|
316
|
-
}, null))) ?
|
|
317
|
-
default: () => [
|
|
312
|
+
}, Pe(c = Array.from(l.value.entries()).map(([f, o]) => i(ue, {
|
|
313
|
+
key: f,
|
|
314
|
+
value: f,
|
|
315
|
+
label: o
|
|
316
|
+
}, null))) ? c : {
|
|
317
|
+
default: () => [c]
|
|
318
318
|
});
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
function
|
|
321
|
+
function ze(e) {
|
|
322
|
+
function t() {
|
|
323
323
|
e != null && e.autoSumbit;
|
|
324
324
|
}
|
|
325
|
-
return (r,
|
|
326
|
-
modelValue: r[
|
|
327
|
-
"onUpdate:modelValue": (a) => r[
|
|
325
|
+
return (r, l) => (e != null && e.default && (r[l.key] = e.default), i(ce, {
|
|
326
|
+
modelValue: r[l.key],
|
|
327
|
+
"onUpdate:modelValue": (a) => r[l.key] = a,
|
|
328
328
|
checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
|
|
329
329
|
uncheckedText: (e == null ? void 0 : e.closeLabel) ?? "否",
|
|
330
330
|
checkedValue: (e == null ? void 0 : e.openValue) ?? !0,
|
|
331
331
|
uncheckedValue: (e == null ? void 0 : e.closeValue) ?? !1,
|
|
332
|
-
onChange:
|
|
332
|
+
onChange: t
|
|
333
333
|
}, null));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
return (
|
|
337
|
-
let
|
|
338
|
-
function a(
|
|
339
|
-
|
|
335
|
+
function Re(e) {
|
|
336
|
+
return (t, r) => {
|
|
337
|
+
let l = [];
|
|
338
|
+
function a(m) {
|
|
339
|
+
l = m;
|
|
340
340
|
}
|
|
341
|
-
function s(
|
|
342
|
-
if (
|
|
343
|
-
const [y, u] =
|
|
344
|
-
|
|
341
|
+
function s(m) {
|
|
342
|
+
if (m && m.length === 2) {
|
|
343
|
+
const [y, u] = m.sort(), n = _(y).startOf("days"), c = _(u).endOf("days");
|
|
344
|
+
t[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), c.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
return e != null && e.disabledDate ? e.disabledDate(
|
|
347
|
+
function d(m) {
|
|
348
|
+
return e != null && e.disabledDate ? e.disabledDate(l, m) : !1;
|
|
349
349
|
}
|
|
350
350
|
return i("div", null, [i(de, {
|
|
351
351
|
"disabled-input": !0,
|
|
352
352
|
style: {
|
|
353
353
|
width: "300px"
|
|
354
354
|
},
|
|
355
|
-
modelValue:
|
|
356
|
-
"onUpdate:modelValue": (
|
|
355
|
+
modelValue: t[r.key],
|
|
356
|
+
"onUpdate:modelValue": (m) => t[r.key] = m,
|
|
357
357
|
onSelect: a,
|
|
358
358
|
onChange: s,
|
|
359
359
|
mode: e == null ? void 0 : e.type,
|
|
360
360
|
allowClear: e == null ? void 0 : e.clearable,
|
|
361
|
-
"disabled-date":
|
|
361
|
+
"disabled-date": d,
|
|
362
362
|
format: e == null ? void 0 : e.labelFormat,
|
|
363
363
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
364
364
|
}, null)]);
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
return (
|
|
369
|
-
modelValue:
|
|
370
|
-
"onUpdate:modelValue": (
|
|
367
|
+
function pe(e) {
|
|
368
|
+
return (t, r) => i(se, {
|
|
369
|
+
modelValue: t[r.key],
|
|
370
|
+
"onUpdate:modelValue": (l) => t[r.key] = l,
|
|
371
371
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
372
372
|
autoSize: e == null ? void 0 : e.autosize,
|
|
373
373
|
maxLength: e == null ? void 0 : e.maxLength
|
|
374
374
|
}, null);
|
|
375
375
|
}
|
|
376
|
-
const
|
|
377
|
-
function
|
|
376
|
+
const $ = /* @__PURE__ */ new WeakMap();
|
|
377
|
+
function Ee() {
|
|
378
378
|
const e = k([]);
|
|
379
379
|
return [e, (r) => e.value = r];
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
let
|
|
383
|
-
const [
|
|
384
|
-
if (!e.autoSumbit || !
|
|
381
|
+
function Ue(e) {
|
|
382
|
+
let t, r = !1;
|
|
383
|
+
const [l, a] = Ee(), s = () => {
|
|
384
|
+
if (!e.autoSumbit || !t)
|
|
385
385
|
return;
|
|
386
|
-
let n =
|
|
386
|
+
let n = t;
|
|
387
387
|
for (; n && n.$el.tagName !== "FORM"; )
|
|
388
388
|
n = n.$parent;
|
|
389
389
|
n && n.$el && n.$el.dispatchEvent(new Event("submit"));
|
|
390
|
-
},
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
},
|
|
394
|
-
const n =
|
|
390
|
+
}, d = (n, c) => {
|
|
391
|
+
const f = n();
|
|
392
|
+
f instanceof Promise ? f.then(c) : c(f);
|
|
393
|
+
}, m = async () => {
|
|
394
|
+
const n = $.get(e.options);
|
|
395
395
|
switch (typeof n) {
|
|
396
396
|
case "function":
|
|
397
|
-
|
|
397
|
+
$.set(e.options, a);
|
|
398
398
|
return;
|
|
399
399
|
case "object":
|
|
400
400
|
a(n);
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
|
|
403
|
+
$.set(e.options, a), d(e.options, (c) => {
|
|
404
|
+
const f = $.get(e.options);
|
|
405
|
+
$.set(e.options, c), f(c);
|
|
406
406
|
});
|
|
407
407
|
}, y = () => {
|
|
408
|
-
|
|
408
|
+
d(e.options, (n) => {
|
|
409
409
|
a(n);
|
|
410
410
|
});
|
|
411
411
|
};
|
|
412
412
|
switch (!0) {
|
|
413
413
|
case e.options instanceof Function: {
|
|
414
|
-
e.cache !== !1 ?
|
|
414
|
+
e.cache !== !1 ? m() : y();
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
417
|
case V(e.options): {
|
|
@@ -423,70 +423,70 @@ function Ee(e) {
|
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
default:
|
|
426
|
-
|
|
426
|
+
l.value = e.options;
|
|
427
427
|
}
|
|
428
|
-
function u(n,
|
|
428
|
+
function u(n, c) {
|
|
429
429
|
var h;
|
|
430
|
-
const
|
|
431
|
-
return
|
|
430
|
+
const f = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", o = c[f];
|
|
431
|
+
return o ? o.toLowerCase().includes(n.toLowerCase()) : !1;
|
|
432
432
|
}
|
|
433
|
-
return (n,
|
|
434
|
-
ref: (
|
|
433
|
+
return (n, c) => (e.default && !r && (n[c.key] = e.default, r = !0), i(ie, {
|
|
434
|
+
ref: (f) => t = f,
|
|
435
435
|
multiple: e.multiple,
|
|
436
|
-
modelValue: n[
|
|
437
|
-
"onUpdate:modelValue": (
|
|
436
|
+
modelValue: n[c.key],
|
|
437
|
+
"onUpdate:modelValue": (f) => n[c.key] = f,
|
|
438
438
|
placeholder: e.placeholder,
|
|
439
439
|
allowClear: e.clearable,
|
|
440
440
|
allowSearch: e.searchable,
|
|
441
441
|
maxTagCount: e.maxTagCount ?? 2,
|
|
442
442
|
onChange: s,
|
|
443
443
|
filterTreeNode: u,
|
|
444
|
-
data:
|
|
444
|
+
data: l.value,
|
|
445
445
|
fieldNames: e.fieldNames,
|
|
446
446
|
treeProps: {
|
|
447
447
|
defaultExpandAll: e.defaultExpandAll
|
|
448
448
|
}
|
|
449
449
|
}, null));
|
|
450
450
|
}
|
|
451
|
-
const
|
|
451
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
452
452
|
function qe() {
|
|
453
453
|
const e = k([]);
|
|
454
454
|
return [e, (r) => e.value = r];
|
|
455
455
|
}
|
|
456
456
|
function We(e) {
|
|
457
|
-
let
|
|
458
|
-
const [
|
|
459
|
-
if (!e.autoSumbit || !
|
|
457
|
+
let t, r = !1;
|
|
458
|
+
const [l, a] = qe(), s = () => {
|
|
459
|
+
if (!e.autoSumbit || !t)
|
|
460
460
|
return;
|
|
461
|
-
let u =
|
|
461
|
+
let u = t;
|
|
462
462
|
for (; u && u.$el.tagName !== "FORM"; )
|
|
463
463
|
u = u.$parent;
|
|
464
464
|
u && u.$el && u.$el.dispatchEvent(new Event("submit"));
|
|
465
|
-
},
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
},
|
|
469
|
-
const u =
|
|
465
|
+
}, d = (u, n) => {
|
|
466
|
+
const c = u();
|
|
467
|
+
c instanceof Promise ? c.then(n) : n(c);
|
|
468
|
+
}, m = async () => {
|
|
469
|
+
const u = g.get(e.options);
|
|
470
470
|
switch (typeof u) {
|
|
471
471
|
case "function":
|
|
472
|
-
|
|
472
|
+
g.set(e.options, a);
|
|
473
473
|
return;
|
|
474
474
|
case "object":
|
|
475
475
|
a(u);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
478
|
+
g.set(e.options, a), d(e.options, (n) => {
|
|
479
|
+
const c = g.get(e.options);
|
|
480
|
+
g.set(e.options, n), c(n);
|
|
481
481
|
});
|
|
482
482
|
}, y = () => {
|
|
483
|
-
|
|
483
|
+
d(e.options, (u) => {
|
|
484
484
|
a(u);
|
|
485
485
|
});
|
|
486
486
|
};
|
|
487
487
|
switch (!0) {
|
|
488
488
|
case e.options instanceof Function: {
|
|
489
|
-
e.cache !== !1 ?
|
|
489
|
+
e.cache !== !1 ? m() : y();
|
|
490
490
|
break;
|
|
491
491
|
}
|
|
492
492
|
case V(e.options): {
|
|
@@ -498,55 +498,55 @@ function We(e) {
|
|
|
498
498
|
break;
|
|
499
499
|
}
|
|
500
500
|
default:
|
|
501
|
-
|
|
501
|
+
l.value = e.options;
|
|
502
502
|
}
|
|
503
|
-
return (u, n) => (e.default && !r && (u[n.key] = e.default, r = !0), i(
|
|
503
|
+
return (u, n) => (e.default && !r && (u[n.key] = e.default, r = !0), i(fe, {
|
|
504
504
|
pathMode: e.pathMode,
|
|
505
|
-
ref: (
|
|
505
|
+
ref: (c) => t = c,
|
|
506
506
|
multiple: e.multiple,
|
|
507
507
|
modelValue: u[n.key],
|
|
508
|
-
"onUpdate:modelValue": (
|
|
508
|
+
"onUpdate:modelValue": (c) => u[n.key] = c,
|
|
509
509
|
placeholder: e.placeholder,
|
|
510
510
|
allowClear: e.clearable,
|
|
511
511
|
allowSearch: e.searchable,
|
|
512
512
|
maxTagCount: e.maxTagCount ?? 2,
|
|
513
513
|
onChange: s,
|
|
514
|
-
options:
|
|
514
|
+
options: l.value
|
|
515
515
|
}, null));
|
|
516
516
|
}
|
|
517
517
|
function Ae(e) {
|
|
518
|
-
return (
|
|
518
|
+
return (t) => e(t);
|
|
519
519
|
}
|
|
520
520
|
function Be() {
|
|
521
521
|
return {
|
|
522
522
|
input: Me,
|
|
523
|
-
textarea:
|
|
524
|
-
select:
|
|
525
|
-
treeSelect:
|
|
523
|
+
textarea: pe,
|
|
524
|
+
select: Le,
|
|
525
|
+
treeSelect: Ue,
|
|
526
526
|
date: Ne,
|
|
527
|
-
switch:
|
|
528
|
-
dateRange:
|
|
527
|
+
switch: ze,
|
|
528
|
+
dateRange: Re,
|
|
529
529
|
render: Ae,
|
|
530
530
|
cascader: We
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
function Ye(e,
|
|
534
|
-
|
|
535
|
-
const r =
|
|
533
|
+
function Ye(e, t) {
|
|
534
|
+
t.render || (t.render = (l) => l.input());
|
|
535
|
+
const r = t.render({
|
|
536
536
|
...Be()
|
|
537
537
|
});
|
|
538
538
|
return {
|
|
539
|
-
default: () => r(e,
|
|
539
|
+
default: () => r(e, t)
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
function Ge(e,
|
|
542
|
+
function Ge(e, t) {
|
|
543
543
|
return Q(q, {
|
|
544
|
-
field:
|
|
545
|
-
label:
|
|
546
|
-
}, Ye(e,
|
|
544
|
+
field: t.key,
|
|
545
|
+
label: t.title
|
|
546
|
+
}, Ye(e, t));
|
|
547
547
|
}
|
|
548
548
|
function M(e) {
|
|
549
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
549
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !E(e);
|
|
550
550
|
}
|
|
551
551
|
const Ke = /* @__PURE__ */ O({
|
|
552
552
|
props: {
|
|
@@ -579,7 +579,12 @@ const Ke = /* @__PURE__ */ O({
|
|
|
579
579
|
name: {
|
|
580
580
|
type: String,
|
|
581
581
|
required: !1,
|
|
582
|
-
default:
|
|
582
|
+
default: `form-${Math.random().toString(32).slice(2)}`
|
|
583
|
+
},
|
|
584
|
+
id: {
|
|
585
|
+
type: String,
|
|
586
|
+
required: !1,
|
|
587
|
+
default: `form-${Math.random().toString(32).slice(2)}`
|
|
583
588
|
},
|
|
584
589
|
submitable: {
|
|
585
590
|
type: Boolean,
|
|
@@ -600,62 +605,66 @@ const Ke = /* @__PURE__ */ O({
|
|
|
600
605
|
emits: ["submit", "cancel", "update:model-value"],
|
|
601
606
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
602
607
|
setup(e) {
|
|
603
|
-
const
|
|
604
|
-
D(N.id,
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
608
|
+
const t = k(), [r, l] = _e(e.form, e.modelValue || e.value), a = k(e.columns || 0), s = k(!0), d = () => s.value = !s.value;
|
|
609
|
+
D(N.id, e.id), D(N.source, r);
|
|
610
|
+
const m = b(() => {
|
|
611
|
+
if (!a.value)
|
|
607
612
|
return 1;
|
|
608
|
-
const
|
|
609
|
-
return
|
|
610
|
-
}),
|
|
611
|
-
function
|
|
613
|
+
const o = e.form.reduce((h, w) => h + ((w == null ? void 0 : w.span) || 1), 0);
|
|
614
|
+
return a.value - o % a.value;
|
|
615
|
+
}), y = b(() => e.form.reduce((o, h) => (h.rule && (o[h.key] = h.rule), o), {}));
|
|
616
|
+
function u() {
|
|
612
617
|
var h;
|
|
613
618
|
if (e.columns)
|
|
614
619
|
return;
|
|
615
|
-
const
|
|
616
|
-
|
|
620
|
+
const o = (h = t.value) == null ? void 0 : h.$el;
|
|
621
|
+
o && (a.value = Math.floor(o.offsetWidth / e.minWidth));
|
|
622
|
+
}
|
|
623
|
+
function n() {
|
|
624
|
+
var h;
|
|
625
|
+
const o = (h = t.value) == null ? void 0 : h.$el;
|
|
626
|
+
o && (o.id = e.id);
|
|
617
627
|
}
|
|
618
|
-
|
|
619
|
-
n();
|
|
628
|
+
U(() => {
|
|
629
|
+
u(), n();
|
|
620
630
|
});
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
...
|
|
631
|
+
function c(o, h) {
|
|
632
|
+
r.value[o] = h, l({
|
|
633
|
+
...r
|
|
624
634
|
});
|
|
625
635
|
}
|
|
626
|
-
function
|
|
627
|
-
var
|
|
628
|
-
(
|
|
636
|
+
function f() {
|
|
637
|
+
var o;
|
|
638
|
+
(o = t.value) == null || o.resetFields();
|
|
629
639
|
}
|
|
630
|
-
return window.addEventListener("resize",
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
reset: o
|
|
640
|
+
return window.addEventListener("resize", u), {
|
|
641
|
+
formSource: r,
|
|
642
|
+
formInstance: t,
|
|
643
|
+
formColumns: a,
|
|
644
|
+
formRules: y,
|
|
645
|
+
formCollspased: s,
|
|
646
|
+
formActiosSpan: m,
|
|
647
|
+
toggleFormCollapsed: d,
|
|
648
|
+
updateFormField: c,
|
|
649
|
+
updateFormSource: l,
|
|
650
|
+
reset: f
|
|
642
651
|
};
|
|
643
652
|
},
|
|
644
653
|
render() {
|
|
645
654
|
const e = () => {
|
|
646
655
|
this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
|
|
647
|
-
},
|
|
648
|
-
const
|
|
656
|
+
}, t = () => {
|
|
657
|
+
const l = [], a = this.footer ? {
|
|
649
658
|
span: this.formColumns
|
|
650
659
|
} : {
|
|
651
660
|
span: this.formActiosSpan
|
|
652
661
|
};
|
|
653
|
-
if (this.searchable && (
|
|
662
|
+
if (this.searchable && (l.push(i(S, {
|
|
654
663
|
type: "primary",
|
|
655
664
|
htmlType: "submit"
|
|
656
665
|
}, {
|
|
657
666
|
default: () => [C("搜索")]
|
|
658
|
-
})),
|
|
667
|
+
})), l.push(i(S, {
|
|
659
668
|
type: "secondary",
|
|
660
669
|
onClick: () => {
|
|
661
670
|
var s;
|
|
@@ -663,45 +672,45 @@ const Ke = /* @__PURE__ */ O({
|
|
|
663
672
|
}
|
|
664
673
|
}, {
|
|
665
674
|
default: () => [C("重置")]
|
|
666
|
-
}))), this.submitable && (
|
|
675
|
+
}))), this.submitable && (l.push(i(S, {
|
|
667
676
|
type: "primary",
|
|
668
677
|
htmlType: "submit"
|
|
669
678
|
}, {
|
|
670
679
|
default: () => [C("提交")]
|
|
671
|
-
})),
|
|
680
|
+
})), l.push(i(S, {
|
|
672
681
|
type: "secondary",
|
|
673
682
|
onClick: () => this.$emit("cancel")
|
|
674
683
|
}, {
|
|
675
684
|
default: () => [C("取消")]
|
|
676
|
-
}))), this.form.some((s) => !!s.collapsed) &&
|
|
685
|
+
}))), this.form.some((s) => !!s.collapsed) && l.push(i(S, {
|
|
677
686
|
onClick: this.toggleFormCollapsed
|
|
678
687
|
}, {
|
|
679
688
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
680
689
|
icon: () => this.formCollspased ? i(Fe, null, null) : i(je, null, null)
|
|
681
|
-
})), this.$slots.actions &&
|
|
690
|
+
})), this.$slots.actions && l.push(...this.$slots.actions()), l.length)
|
|
682
691
|
return i(j, a, {
|
|
683
692
|
default: () => [i(q, {
|
|
684
693
|
hideLabel: !0,
|
|
685
694
|
contentClass: this.footer ? "form-footer" : ""
|
|
686
695
|
}, {
|
|
687
|
-
default: () => [i(he, null, M(
|
|
688
|
-
default: () => [
|
|
696
|
+
default: () => [i(he, null, M(l) ? l : {
|
|
697
|
+
default: () => [l]
|
|
689
698
|
})]
|
|
690
699
|
})]
|
|
691
700
|
});
|
|
692
|
-
}, r = this.form.filter((
|
|
701
|
+
}, r = this.form.filter((l) => this.formCollspased ? !l.collapsed : !0).filter((l) => {
|
|
693
702
|
switch (!0) {
|
|
694
|
-
case typeof
|
|
695
|
-
return
|
|
696
|
-
case typeof
|
|
697
|
-
return
|
|
703
|
+
case typeof l.visiable == "boolean":
|
|
704
|
+
return l.visiable;
|
|
705
|
+
case typeof l.visiable == "function":
|
|
706
|
+
return l.visiable(this.formSource);
|
|
698
707
|
default:
|
|
699
708
|
return !0;
|
|
700
709
|
}
|
|
701
710
|
});
|
|
702
711
|
return i("div", {
|
|
703
712
|
class: "form-render"
|
|
704
|
-
}, [i(
|
|
713
|
+
}, [i(oe, X({
|
|
705
714
|
name: this.name
|
|
706
715
|
}, {
|
|
707
716
|
labelAlign: "left",
|
|
@@ -709,7 +718,7 @@ const Ke = /* @__PURE__ */ O({
|
|
|
709
718
|
rules: this.formRules,
|
|
710
719
|
onSubmitSuccess: e,
|
|
711
720
|
"auto-label-width": !0,
|
|
712
|
-
ref: (
|
|
721
|
+
ref: (l) => this.formInstance = l,
|
|
713
722
|
model: this.formSource
|
|
714
723
|
}), {
|
|
715
724
|
default: () => [i(me, {
|
|
@@ -717,14 +726,14 @@ const Ke = /* @__PURE__ */ O({
|
|
|
717
726
|
"col-gap": 24,
|
|
718
727
|
"rol-gap": 10
|
|
719
728
|
}, {
|
|
720
|
-
default: () => [r.filter(() => this.formColumns !== 0).map((
|
|
729
|
+
default: () => [r.filter(() => this.formColumns !== 0).map((l) => {
|
|
721
730
|
let a;
|
|
722
731
|
return i(j, {
|
|
723
|
-
span:
|
|
724
|
-
}, M(a = Ge(this.formSource,
|
|
732
|
+
span: l.span
|
|
733
|
+
}, M(a = Ge(this.formSource, l)) ? a : {
|
|
725
734
|
default: () => [a]
|
|
726
735
|
});
|
|
727
|
-
}),
|
|
736
|
+
}), t()]
|
|
728
737
|
})]
|
|
729
738
|
})]);
|
|
730
739
|
}
|
|
@@ -733,16 +742,16 @@ function Je(e) {
|
|
|
733
742
|
return e;
|
|
734
743
|
}
|
|
735
744
|
function Ze(e) {
|
|
736
|
-
const
|
|
737
|
-
function
|
|
738
|
-
var s,
|
|
739
|
-
const a = (
|
|
745
|
+
const t = P(), r = k();
|
|
746
|
+
function l() {
|
|
747
|
+
var s, d;
|
|
748
|
+
const a = (d = (s = t == null ? void 0 : t.proxy) == null ? void 0 : s.$refs) == null ? void 0 : d[e];
|
|
740
749
|
a && (r.value = a);
|
|
741
750
|
}
|
|
742
|
-
return
|
|
751
|
+
return U(l), H(l), r;
|
|
743
752
|
}
|
|
744
753
|
const et = {
|
|
745
|
-
install(e,
|
|
754
|
+
install(e, t) {
|
|
746
755
|
e.component("FormRender", Ke);
|
|
747
756
|
}
|
|
748
757
|
};
|