@gopowerteam/form-render 0.0.35 → 0.0.37
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 +4 -3
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/form-render/index.d.ts +4 -3
- package/dist/es/index.mjs +306 -297
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
33
33
|
required: false;
|
|
34
34
|
default: string;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
id: {
|
|
37
37
|
type: StringConstructor;
|
|
38
38
|
required: false;
|
|
39
39
|
default: string;
|
|
@@ -311,6 +311,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
311
311
|
updateFormField: (key: string, value: any) => void;
|
|
312
312
|
updateFormSource: (value: import("../interfaces").DataRecord) => void;
|
|
313
313
|
reset: () => void;
|
|
314
|
+
validate: () => Promise<Record<string, import("@arco-design/web-vue").ValidatedError> | undefined> | undefined;
|
|
314
315
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "cancel" | "update:model-value")[], "submit" | "cancel" | "update:model-value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
315
316
|
form: {
|
|
316
317
|
type: PropType<FormItemsOptions<any>>;
|
|
@@ -343,7 +344,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
343
344
|
required: false;
|
|
344
345
|
default: string;
|
|
345
346
|
};
|
|
346
|
-
|
|
347
|
+
id: {
|
|
347
348
|
type: StringConstructor;
|
|
348
349
|
required: false;
|
|
349
350
|
default: string;
|
|
@@ -372,7 +373,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
372
373
|
name: string;
|
|
373
374
|
layout: "horizontal" | "vertical";
|
|
374
375
|
minWidth: number;
|
|
375
|
-
|
|
376
|
+
id: string;
|
|
376
377
|
submitable: boolean;
|
|
377
378
|
searchable: boolean;
|
|
378
379
|
}, {}>;
|
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"),f=require("@arco-design/web-vue"),V=require("dayjs"),j=require("./resolver.cjs");const D=Symbol("ArcoConfigProvider"),_="arco",p="$arco",N=e=>{var r,l,t;const n=a.getCurrentInstance(),i=a.inject(D,void 0),s=(t=(l=i==null?void 0:i.prefixCls)!=null?l:(r=n==null?void 0:n.appContext.config.globalProperties[p])==null?void 0:r.classPrefix)!=null?t:_;return e?`${s}-${e}`:s},M=Object.prototype.toString;function x(e){return M.call(e)==="[object Number]"&&e===e}var O=(e,r)=>{for(const[l,t]of r)e[l]=t;return e};const T=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=N("icon"),t=a.computed(()=>[l,`${l}-down`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=x(e.size)?`${e.size}px`:e.size),e.rotate&&(s.transform=`rotate(${e.rotate}deg)`),s});return{cls:t,innerStyle:n,onClick:s=>{r("click",s)}}}}),P=["stroke-width","stroke-linecap","stroke-linejoin"],R=a.createElementVNode("path",{d:"M39.6 17.443 24.043 33 8.487 17.443"},null,-1),z=[R];function L(e,r,l,t,n,i){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]=(...s)=>e.onClick&&e.onClick(...s))},z,14,P)}var g=O(T,[["render",L]]);const q=Object.assign(g,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+g.name,g)}}),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:r}){const l=N("icon"),t=a.computed(()=>[l,`${l}-up`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=x(e.size)?`${e.size}px`:e.size),e.rotate&&(s.transform=`rotate(${e.rotate}deg)`),s});return{cls:t,innerStyle:n,onClick:s=>{r("click",s)}}}}),E=["stroke-width","stroke-linecap","stroke-linejoin"],U=a.createElementVNode("path",{d:"M39.6 30.557 24.043 15 8.487 30.557"},null,-1),W=[U];function A(e,r,l,t,n,i){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]=(...s)=>e.onClick&&e.onClick(...s))},W,14,E)}var C=O(B,[["render",A]]);const Y=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)}}),F={id:Symbol("ID"),source:Symbol("Source")};function G(e,r){const l=a.ref({});return e==null||e.forEach(n=>{let i=null;n.default&&(i=(typeof n.default=="function"?n.default():n.default)||null),r&&r[n.key]!==void 0&&(i=r[n.key]),l.value[n.key]=i}),[l,n=>{l.value=n}]}function K(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(f.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(f.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(f.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(f.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(f.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 Q(e){return(r,l)=>{switch(e==null?void 0:e.type){case"number":return a.createVNode(f.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(f.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 $(e,r,l){const t=a.watch(e,(...n)=>(a.nextTick(()=>t()),r(...n)),l);return t}function X(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const k=new WeakMap;function H(){const e=a.ref(new Map);return[e,l=>e.value=l]}function J(e){let r,l=!1;const[t,n]=H(),i=()=>{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"))},s=(c,u)=>{const d=c();d instanceof Promise?d.then(u):u(d)},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),s(e.options,u=>{const d=k.get(e.options);k.set(e.options,u),d(u)})},y=()=>{s(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():y();break}case a.isRef(e.options):{$(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}return(c,u)=>{let d;return e.default&&!l&&(c[u.key]=e.default,l=!0),a.createVNode(f.Select,{ref:o=>r=o,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":o=>c[u.key]=o,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:i},X(d=Array.from(t.value.entries()).map(([o,h])=>a.createVNode(f.Option,{key:o,value:o,label:h},null)))?d:{default:()=>[d]})}}function Z(e){function r(){e!=null&&e.autoSumbit}return(l,t)=>(e!=null&&e.default&&(l[t.key]=e.default),a.createVNode(f.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 ee(e){return(r,l)=>{let t=[];function n(m){t=m}function i(m){if(m&&m.length===2){const[y,c]=m.sort(),u=V(y).startOf("days"),d=V(c).endOf("days");r[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(m){return e!=null&&e.disabledDate?e.disabledDate(t,m):!1}return a.createVNode("div",null,[a.createVNode(f.RangePicker,{"disabled-input":!0,style:{width:"300px"},modelValue:r[l.key],"onUpdate:modelValue":m=>r[l.key]=m,onSelect:n,onChange:i,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 te(e){return(r,l)=>a.createVNode(f.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 re(){const e=a.ref([]);return[e,l=>e.value=l]}function le(e){let r,l=!1;const[t,n]=re(),i=()=>{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"))},s=(u,d)=>{const o=u();o instanceof Promise?o.then(d):d(o)},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),s(e.options,d=>{const o=S.get(e.options);S.set(e.options,d),o(d)})},y=()=>{s(e.options,u=>{n(u)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():y();break}case a.isRef(e.options):{$(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}function c(u,d){var b;const o=((b=e.fieldNames)==null?void 0:b.title)||"title",h=d[o];return h?h.toLowerCase().includes(u.toLowerCase()):!1}return(u,d)=>(e.default&&!l&&(u[d.key]=e.default,l=!0),a.createVNode(f.TreeSelect,{ref:o=>r=o,multiple:e.multiple,modelValue:u[d.key],"onUpdate:modelValue":o=>u[d.key]=o,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:i,filterTreeNode:c,data:t.value,fieldNames:e.fieldNames,treeProps:{defaultExpandAll:e.defaultExpandAll}},null))}const v=new WeakMap;function ae(){const e=a.ref([]);return[e,l=>e.value=l]}function ne(e){let r,l=!1;const[t,n]=ae(),i=()=>{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"))},s=(c,u)=>{const d=c();d instanceof Promise?d.then(u):u(d)},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),s(e.options,u=>{const d=v.get(e.options);v.set(e.options,u),d(u)})},y=()=>{s(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?m():y();break}case a.isRef(e.options):{$(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(f.Cascader,{pathMode:e.pathMode,ref:d=>r=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:i,options:t.value},null))}function ue(e){return r=>e(r)}function ce(){return{input:Q,textarea:te,select:J,treeSelect:le,date:K,switch:Z,dateRange:ee,render:ue,cascader:ne}}function de(e,r){r.render||(r.render=t=>t.input());const l=r.render({...ce()});return{default:()=>l(e,r)}}function se(e,r){return a.h(f.FormItem,{field:r.key,label:r.title},de(e,r))}function w(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const I=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"},formId:{type:String,required:!1,default:Math.random().toString(32).slice(2).toUpperCase()},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=a.ref(),[l,t]=G(e.form,e.modelValue||e.value),n=a.ref(e.columns||0),i=a.ref(!0),s=()=>i.value=!i.value;a.provide(F.id,e.formId),a.provide(F.source,l);const m=a.computed(()=>{if(!n.value)return 1;const o=e.form.reduce((h,b)=>h+((b==null?void 0:b.span)||1),0);return n.value-o%n.value}),y=a.computed(()=>e.form.reduce((o,h)=>(h.rule&&(o[h.key]=h.rule),o),{}));function c(){var h;if(e.columns)return;const o=(h=r.value)==null?void 0:h.$el;o&&(n.value=Math.floor(o.offsetWidth/e.minWidth))}a.onMounted(()=>{c()});function u(o,h){l.value[o]=h,t({...l})}function d(){var o;(o=r.value)==null||o.resetFields()}return window.addEventListener("resize",c),{formSource:l,formInstance:r,formColumns:n,formRules:y,formCollspased:i,formActiosSpan:m,toggleFormCollapsed:s,updateFormField:u,updateFormSource:t,reset:d}},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(f.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("搜索")]})),t.push(a.createVNode(f.Button,{type:"secondary",onClick:()=>{var i;return(i=this.formInstance)==null?void 0:i.resetFields()}},{default:()=>[a.createTextVNode("重置")]}))),this.submitable&&(t.push(a.createVNode(f.Button,{type:"primary",htmlType:"submit"},{default:()=>[a.createTextVNode("提交")]})),t.push(a.createVNode(f.Button,{type:"secondary",onClick:()=>this.$emit("cancel")},{default:()=>[a.createTextVNode("取消")]}))),this.form.some(i=>!!i.collapsed)&&t.push(a.createVNode(f.Button,{onClick:this.toggleFormCollapsed},{default:()=>this.formCollspased?"展开":"收起",icon:()=>this.formCollspased?a.createVNode(q,null,null):a.createVNode(Y,null,null)})),this.$slots.actions&&t.push(...this.$slots.actions()),t.length)return a.createVNode(f.GridItem,n,{default:()=>[a.createVNode(f.FormItem,{hideLabel:!0,contentClass:this.footer?"form-footer":""},{default:()=>[a.createVNode(f.Space,null,w(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(f.Form,a.mergeProps({name:this.name,id:this.formId},{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(f.Grid,{cols:this.formColumns,"col-gap":24,"rol-gap":10},{default:()=>[l.filter(()=>this.formColumns!==0).map(t=>{let n;return a.createVNode(f.GridItem,{span:t.span},w(n=se(this.formSource,t))?n:{default:()=>[n]})}),r()]})]})])}});function oe(e){return e}function ie(e){const r=a.getCurrentInstance(),l=a.ref();function t(){var i,s;const n=(s=(i=r==null?void 0:r.proxy)==null?void 0:i.$refs)==null?void 0:s[e];n&&(l.value=n)}return a.onMounted(t),a.onUpdated(t),l}const fe={install(e,r){e.component("FormRender",I)}};exports.FormRenderResolver=j.FormRenderResolver;exports.FormRender=I;exports.default=fe;exports.defineForm=oe;exports.useForm=ie;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("@arco-design/web-vue"),w=require("dayjs"),_=require("./resolver.cjs");const M=Symbol("ArcoConfigProvider"),T="arco",P="$arco",O=e=>{var t,l,r;const n=a.getCurrentInstance(),o=a.inject(M,void 0),s=(r=(l=o==null?void 0:o.prefixCls)!=null?l:(t=n==null?void 0:n.appContext.config.globalProperties[P])==null?void 0:t.classPrefix)!=null?r:T;return e?`${s}-${e}`:s},R=Object.prototype.toString;function I(e){return R.call(e)==="[object Number]"&&e===e}var j=(e,t)=>{for(const[l,r]of t)e[l]=r;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:t}){const l=O("icon"),r=a.computed(()=>[l,`${l}-down`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=I(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)}}}}),z=["stroke-width","stroke-linecap","stroke-linejoin"],E=a.createElementVNode("path",{d:"M39.6 17.443 24.043 33 8.487 17.443"},null,-1),L=[E];function q(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))},L,14,z)}var C=j(p,[["render",q]]);const B=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)}}),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:t}){const l=O("icon"),r=a.computed(()=>[l,`${l}-up`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const s={};return e.size&&(s.fontSize=I(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)}}}}),W=["stroke-width","stroke-linecap","stroke-linejoin"],A=a.createElementVNode("path",{d:"M39.6 30.557 24.043 15 8.487 30.557"},null,-1),Y=[A];function G(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))},Y,14,W)}var V=j(U,[["render",G]]);const K=Object.assign(V,{install:(e,t)=>{var l;const r=(l=t==null?void 0:t.iconPrefix)!=null?l:"";e.component(r+V.name,V)}}),N={id:Symbol("ID"),source:Symbol("Source")};function Q(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 X(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 H(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 F(e,t,l){const r=a.watch(e,(...n)=>(a.nextTick(()=>r()),t(...n)),l);return r}function J(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const v=new WeakMap;function Z(){const e=a.ref(new Map);return[e,l=>e.value=l]}function ee(e){let t,l=!1;const[r,n]=Z(),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):{F(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:m=>t=m,multiple:e.multiple,modelValue:c[u.key],"onUpdate:modelValue":m=>c[u.key]=m,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:o},J(d=Array.from(r.value.entries()).map(([m,k])=>a.createVNode(i.Option,{key:m,value:m,label:k},null)))?d:{default:()=>[d]})}}function te(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 re(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=w(b).startOf("days"),d=w(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 le(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 ae(){const e=a.ref([]);return[e,l=>e.value=l]}function ne(e){let t,l=!1;const[r,n]=ae(),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 m=u();m instanceof Promise?m.then(d):d(m)},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 m=S.get(e.options);S.set(e.options,d),m(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):{F(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:r.value=e.options}function c(u,d){var f;const m=((f=e.fieldNames)==null?void 0:f.title)||"title",k=d[m];return k?k.toLowerCase().includes(u.toLowerCase()):!1}return(u,d)=>(e.default&&!l&&(u[d.key]=e.default,l=!0),a.createVNode(i.TreeSelect,{ref:m=>t=m,multiple:e.multiple,modelValue:u[d.key],"onUpdate:modelValue":m=>u[d.key]=m,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 g=new WeakMap;function ue(){const e=a.ref([]);return[e,l=>e.value=l]}function ce(e){let t,l=!1;const[r,n]=ue(),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=g.get(e.options);switch(typeof c){case"function":g.set(e.options,n);return;case"object":n(c);return}g.set(e.options,n),s(e.options,u=>{const d=g.get(e.options);g.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):{F(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 de(e){return t=>e(t)}function se(){return{input:H,textarea:le,select:ee,treeSelect:ne,date:X,switch:te,dateRange:re,render:de,cascader:ce}}function oe(e,t){t.render||(t.render=r=>r.input());const l=t.render({...se()});return{default:()=>l(e,t)}}function ie(e,t){return a.h(i.FormItem,{field:t.key,label:t.title},oe(e,t))}function x(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const D=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","validate"],setup(e){const t=a.ref(),[l,r]=Q(e.form,e.modelValue||e.value),n=a.ref(e.columns||0),o=a.ref(!0),s=()=>o.value=!o.value;a.provide(N.id,e.id),a.provide(N.source,l);const h=a.computed(()=>{if(!n.value)return 1;const f=e.form.reduce((y,$)=>y+(($==null?void 0:$.span)||1),0);return n.value-f%n.value}),b=a.computed(()=>e.form.reduce((f,y)=>(y.rule&&(f[y.key]=y.rule),f),{}));function c(){var y;if(e.columns)return;const f=(y=t.value)==null?void 0:y.$el;f&&(n.value=Math.floor(f.offsetWidth/e.minWidth))}function u(){var y;const f=(y=t.value)==null?void 0:y.$el;f&&(f.id=e.id)}a.onMounted(()=>{c(),u()});function d(f,y){l.value[f]=y,r({...l})}function m(){var f;(f=t.value)==null||f.resetFields()}function k(){var f;return(f=t.value)==null?void 0:f.validate()}return window.addEventListener("resize",c),{formSource:l,formInstance:t,formColumns:n,formRules:b,formCollspased:o,formActiosSpan:h,toggleFormCollapsed:s,updateFormField:d,updateFormSource:r,reset:m,validate:k}},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(B,null,null):a.createVNode(K,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,x(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},x(n=ie(this.formSource,r))?n:{default:()=>[n]})}),t()]})]})])}});function fe(e){return e}function me(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 he={install(e,t){e.component("FormRender",D)}};exports.FormRenderResolver=_.FormRenderResolver;exports.FormRender=D;exports.default=he;exports.defineForm=fe;exports.useForm=me;
|
|
@@ -33,7 +33,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
33
33
|
required: false;
|
|
34
34
|
default: string;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
id: {
|
|
37
37
|
type: StringConstructor;
|
|
38
38
|
required: false;
|
|
39
39
|
default: string;
|
|
@@ -311,6 +311,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
311
311
|
updateFormField: (key: string, value: any) => void;
|
|
312
312
|
updateFormSource: (value: import("../interfaces").DataRecord) => void;
|
|
313
313
|
reset: () => void;
|
|
314
|
+
validate: () => Promise<Record<string, import("@arco-design/web-vue").ValidatedError> | undefined> | undefined;
|
|
314
315
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("submit" | "cancel" | "update:model-value")[], "submit" | "cancel" | "update:model-value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
315
316
|
form: {
|
|
316
317
|
type: PropType<FormItemsOptions<any>>;
|
|
@@ -343,7 +344,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
343
344
|
required: false;
|
|
344
345
|
default: string;
|
|
345
346
|
};
|
|
346
|
-
|
|
347
|
+
id: {
|
|
347
348
|
type: StringConstructor;
|
|
348
349
|
required: false;
|
|
349
350
|
default: string;
|
|
@@ -372,7 +373,7 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
372
373
|
name: string;
|
|
373
374
|
layout: "horizontal" | "vertical";
|
|
374
375
|
minWidth: number;
|
|
375
|
-
|
|
376
|
+
id: string;
|
|
376
377
|
submitable: boolean;
|
|
377
378
|
searchable: boolean;
|
|
378
379
|
}, {}>;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { DatePicker as
|
|
3
|
-
import
|
|
4
|
-
import { FormRenderResolver as
|
|
5
|
-
const
|
|
6
|
-
var
|
|
7
|
-
const a =
|
|
1
|
+
import { getCurrentInstance as T, inject as G, defineComponent as V, computed as v, openBlock as L, createElementBlock as z, normalizeClass as R, normalizeStyle as p, createElementVNode as E, ref as k, createVNode as i, watch as K, nextTick as Q, isRef as I, isVNode as U, h as X, provide as j, onMounted as q, mergeProps as H, createTextVNode as w, onUpdated as J } from "vue";
|
|
2
|
+
import { DatePicker as Z, YearPicker as ee, QuarterPicker as te, MonthPicker as le, WeekPicker as re, Input as ae, InputNumber as ne, Select as ue, Option as ce, Switch as de, RangePicker as se, Textarea as ie, TreeSelect as fe, Cascader as oe, FormItem as W, Form as me, Grid as he, GridItem as _, Button as S, Space as ye } from "@arco-design/web-vue";
|
|
3
|
+
import N from "dayjs";
|
|
4
|
+
import { FormRenderResolver as at } from "./resolver.mjs";
|
|
5
|
+
const ke = Symbol("ArcoConfigProvider"), be = "arco", ve = "$arco", A = (e) => {
|
|
6
|
+
var t, r, l;
|
|
7
|
+
const a = T(), s = G(ke, void 0), d = (l = (r = s == null ? void 0 : s.prefixCls) != null ? r : (t = a == null ? void 0 : a.appContext.config.globalProperties[ve]) == null ? void 0 : t.classPrefix) != null ? l : be;
|
|
8
8
|
return e ? `${d}-${e}` : d;
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
return
|
|
9
|
+
}, Se = Object.prototype.toString;
|
|
10
|
+
function B(e) {
|
|
11
|
+
return Se.call(e) === "[object Number]" && e === e;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
for (const [r,
|
|
15
|
-
e[r] =
|
|
13
|
+
var Y = (e, t) => {
|
|
14
|
+
for (const [r, l] of t)
|
|
15
|
+
e[r] = l;
|
|
16
16
|
return e;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const $e = V({
|
|
19
19
|
name: "IconDown",
|
|
20
20
|
props: {
|
|
21
21
|
size: {
|
|
@@ -42,47 +42,47 @@ const Se = x({
|
|
|
42
42
|
click: (e) => !0
|
|
43
43
|
},
|
|
44
44
|
setup(e, {
|
|
45
|
-
emit:
|
|
45
|
+
emit: t
|
|
46
46
|
}) {
|
|
47
|
-
const r =
|
|
47
|
+
const r = A("icon"), l = v(() => [r, `${r}-down`, {
|
|
48
48
|
[`${r}-spin`]: e.spin
|
|
49
|
-
}]), a =
|
|
49
|
+
}]), a = v(() => {
|
|
50
50
|
const d = {};
|
|
51
|
-
return e.size && (d.fontSize =
|
|
51
|
+
return e.size && (d.fontSize = B(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
56
|
onClick: (d) => {
|
|
57
|
-
|
|
57
|
+
t("click", d);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
61
|
+
}), ge = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ce = /* @__PURE__ */ E("path", {
|
|
62
62
|
d: "M39.6 17.443 24.043 33 8.487 17.443"
|
|
63
|
-
}, null, -1),
|
|
64
|
-
function
|
|
65
|
-
return
|
|
63
|
+
}, null, -1), we = [Ce];
|
|
64
|
+
function Fe(e, t, r, l, a, s) {
|
|
65
|
+
return L(), z("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: R(e.cls),
|
|
71
|
+
style: p(e.innerStyle),
|
|
72
72
|
"stroke-width": e.strokeWidth,
|
|
73
73
|
"stroke-linecap": e.strokeLinecap,
|
|
74
74
|
"stroke-linejoin": e.strokeLinejoin,
|
|
75
|
-
onClick:
|
|
76
|
-
},
|
|
75
|
+
onClick: t[0] || (t[0] = (...d) => e.onClick && e.onClick(...d))
|
|
76
|
+
}, we, 14, ge);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
const
|
|
80
|
-
install: (e,
|
|
78
|
+
var x = /* @__PURE__ */ Y($e, [["render", Fe]]);
|
|
79
|
+
const xe = Object.assign(x, {
|
|
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 + x.name, x);
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
85
|
+
}), Oe = V({
|
|
86
86
|
name: "IconUp",
|
|
87
87
|
props: {
|
|
88
88
|
size: {
|
|
@@ -109,117 +109,117 @@ const we = Object.assign(w, {
|
|
|
109
109
|
click: (e) => !0
|
|
110
110
|
},
|
|
111
111
|
setup(e, {
|
|
112
|
-
emit:
|
|
112
|
+
emit: t
|
|
113
113
|
}) {
|
|
114
|
-
const r =
|
|
114
|
+
const r = A("icon"), l = v(() => [r, `${r}-up`, {
|
|
115
115
|
[`${r}-spin`]: e.spin
|
|
116
|
-
}]), a =
|
|
116
|
+
}]), a = v(() => {
|
|
117
117
|
const d = {};
|
|
118
|
-
return e.size && (d.fontSize =
|
|
118
|
+
return e.size && (d.fontSize = B(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
123
|
onClick: (d) => {
|
|
124
|
-
|
|
124
|
+
t("click", d);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
}),
|
|
128
|
+
}), Ve = ["stroke-width", "stroke-linecap", "stroke-linejoin"], Ie = /* @__PURE__ */ E("path", {
|
|
129
129
|
d: "M39.6 30.557 24.043 15 8.487 30.557"
|
|
130
|
-
}, null, -1),
|
|
131
|
-
function
|
|
132
|
-
return
|
|
130
|
+
}, null, -1), De = [Ie];
|
|
131
|
+
function je(e, t, r, l, a, s) {
|
|
132
|
+
return L(), z("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: R(e.cls),
|
|
138
|
+
style: p(e.innerStyle),
|
|
139
139
|
"stroke-width": e.strokeWidth,
|
|
140
140
|
"stroke-linecap": e.strokeLinecap,
|
|
141
141
|
"stroke-linejoin": e.strokeLinejoin,
|
|
142
|
-
onClick:
|
|
143
|
-
},
|
|
142
|
+
onClick: t[0] || (t[0] = (...d) => e.onClick && e.onClick(...d))
|
|
143
|
+
}, De, 14, Ve);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
const
|
|
147
|
-
install: (e,
|
|
145
|
+
var O = /* @__PURE__ */ Y(Oe, [["render", je]]);
|
|
146
|
+
const _e = Object.assign(O, {
|
|
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 + O.name, O);
|
|
151
151
|
}
|
|
152
|
-
}),
|
|
152
|
+
}), M = {
|
|
153
153
|
id: Symbol("ID"),
|
|
154
154
|
source: Symbol("Source")
|
|
155
155
|
};
|
|
156
|
-
function
|
|
157
|
-
const r =
|
|
156
|
+
function Ne(e, t) {
|
|
157
|
+
const r = k({});
|
|
158
158
|
return e == null || e.forEach((a) => {
|
|
159
|
-
let
|
|
160
|
-
a.default && (
|
|
159
|
+
let s = 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
|
-
function
|
|
166
|
-
function
|
|
167
|
-
return e != null && e.disabledDate ? e.disabledDate(r,
|
|
165
|
+
function Me(e) {
|
|
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
|
-
return
|
|
173
|
-
modelValue: r[
|
|
174
|
-
"onUpdate:modelValue": (a) => r[
|
|
175
|
-
"disabled-date":
|
|
172
|
+
return i(re, {
|
|
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
|
-
return
|
|
181
|
-
modelValue: r[
|
|
182
|
-
"onUpdate:modelValue": (a) => r[
|
|
183
|
-
"disabled-date":
|
|
180
|
+
return i(le, {
|
|
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
|
-
return
|
|
189
|
-
modelValue: r[
|
|
190
|
-
"onUpdate:modelValue": (a) => r[
|
|
191
|
-
"disabled-date":
|
|
188
|
+
return i(te, {
|
|
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
|
-
return
|
|
197
|
-
modelValue: r[
|
|
198
|
-
"onUpdate:modelValue": (a) => r[
|
|
199
|
-
"disabled-date":
|
|
196
|
+
return i(ee, {
|
|
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);
|
|
203
203
|
case "date":
|
|
204
204
|
default:
|
|
205
|
-
return
|
|
205
|
+
return i(Z, {
|
|
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);
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
return (
|
|
216
|
+
function Pe(e) {
|
|
217
|
+
return (t, r) => {
|
|
218
218
|
switch (e == null ? void 0 : e.type) {
|
|
219
219
|
case "number":
|
|
220
|
-
return
|
|
221
|
-
modelValue:
|
|
222
|
-
"onUpdate:modelValue": (
|
|
220
|
+
return i(ne, {
|
|
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,
|
|
@@ -227,9 +227,9 @@ function Ne(e) {
|
|
|
227
227
|
}, null);
|
|
228
228
|
case "string":
|
|
229
229
|
default:
|
|
230
|
-
return
|
|
231
|
-
modelValue:
|
|
232
|
-
"onUpdate:modelValue": (
|
|
230
|
+
return i(ae, {
|
|
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,56 +238,56 @@ function Ne(e) {
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
241
|
-
function
|
|
242
|
-
const
|
|
243
|
-
return
|
|
241
|
+
function D(e, t, r) {
|
|
242
|
+
const l = K(e, (...a) => (Q(() => l()), t(...a)), r);
|
|
243
|
+
return l;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
245
|
+
function Te(e) {
|
|
246
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
function
|
|
250
|
-
const e =
|
|
248
|
+
const $ = /* @__PURE__ */ new WeakMap();
|
|
249
|
+
function Le() {
|
|
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 ze(e) {
|
|
254
|
+
let t, r = !1;
|
|
255
|
+
const [l, a] = Le(), 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
262
|
}, d = (u, n) => {
|
|
263
263
|
const c = u();
|
|
264
264
|
c instanceof Promise ? c.then(n) : n(c);
|
|
265
|
-
},
|
|
266
|
-
const u =
|
|
265
|
+
}, m = async () => {
|
|
266
|
+
const u = $.get(e.options);
|
|
267
267
|
switch (typeof u) {
|
|
268
268
|
case "function":
|
|
269
|
-
|
|
269
|
+
$.set(e.options, a);
|
|
270
270
|
return;
|
|
271
271
|
case "object":
|
|
272
272
|
a(u);
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
const c =
|
|
277
|
-
|
|
275
|
+
$.set(e.options, a), d(e.options, (n) => {
|
|
276
|
+
const c = $.get(e.options);
|
|
277
|
+
$.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
|
-
case
|
|
290
|
-
|
|
289
|
+
case I(e.options): {
|
|
290
|
+
D(e.options, () => {
|
|
291
291
|
a(e.options.value);
|
|
292
292
|
}, {
|
|
293
293
|
immediate: !0
|
|
@@ -295,67 +295,67 @@ function pe(e) {
|
|
|
295
295
|
break;
|
|
296
296
|
}
|
|
297
297
|
default:
|
|
298
|
-
|
|
298
|
+
l.value = e.options;
|
|
299
299
|
}
|
|
300
300
|
return (u, n) => {
|
|
301
301
|
let c;
|
|
302
|
-
return e.default && !r && (u[n.key] = e.default, r = !0),
|
|
303
|
-
ref: (
|
|
302
|
+
return e.default && !r && (u[n.key] = e.default, r = !0), i(ue, {
|
|
303
|
+
ref: (o) => t = o,
|
|
304
304
|
multiple: e.multiple,
|
|
305
305
|
modelValue: u[n.key],
|
|
306
|
-
"onUpdate:modelValue": (
|
|
306
|
+
"onUpdate:modelValue": (o) => u[n.key] = o,
|
|
307
307
|
placeholder: e.placeholder,
|
|
308
308
|
allowClear: e.clearable,
|
|
309
309
|
allowSearch: e.searchable,
|
|
310
310
|
maxTagCount: e.maxTagCount ?? 2,
|
|
311
|
-
onChange:
|
|
312
|
-
},
|
|
313
|
-
key:
|
|
314
|
-
value:
|
|
315
|
-
label:
|
|
311
|
+
onChange: s
|
|
312
|
+
}, Te(c = Array.from(l.value.entries()).map(([o, b]) => i(ce, {
|
|
313
|
+
key: o,
|
|
314
|
+
value: o,
|
|
315
|
+
label: b
|
|
316
316
|
}, null))) ? c : {
|
|
317
317
|
default: () => [c]
|
|
318
318
|
});
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
function
|
|
321
|
+
function Re(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(de, {
|
|
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 pe(e) {
|
|
336
|
+
return (t, r) => {
|
|
337
|
+
let l = [];
|
|
338
|
+
function a(m) {
|
|
339
|
+
l = m;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
if (
|
|
343
|
-
const [
|
|
344
|
-
|
|
341
|
+
function s(m) {
|
|
342
|
+
if (m && m.length === 2) {
|
|
343
|
+
const [y, u] = m.sort(), n = N(y).startOf("days"), c = N(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 d(
|
|
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
|
-
return
|
|
350
|
+
return i("div", null, [i(se, {
|
|
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
|
-
onChange:
|
|
358
|
+
onChange: s,
|
|
359
359
|
mode: e == null ? void 0 : e.type,
|
|
360
360
|
allowClear: e == null ? void 0 : e.clearable,
|
|
361
361
|
"disabled-date": d,
|
|
@@ -364,33 +364,33 @@ function Le(e) {
|
|
|
364
364
|
}, null)]);
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
return (
|
|
369
|
-
modelValue:
|
|
370
|
-
"onUpdate:modelValue": (
|
|
367
|
+
function Ee(e) {
|
|
368
|
+
return (t, r) => i(ie, {
|
|
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
376
|
const g = /* @__PURE__ */ new WeakMap();
|
|
377
|
-
function
|
|
378
|
-
const e =
|
|
377
|
+
function Ue() {
|
|
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 qe(e) {
|
|
382
|
+
let t, r = !1;
|
|
383
|
+
const [l, a] = Ue(), 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
390
|
}, d = (n, c) => {
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
},
|
|
391
|
+
const o = n();
|
|
392
|
+
o instanceof Promise ? o.then(c) : c(o);
|
|
393
|
+
}, m = async () => {
|
|
394
394
|
const n = g.get(e.options);
|
|
395
395
|
switch (typeof n) {
|
|
396
396
|
case "function":
|
|
@@ -401,21 +401,21 @@ function Ue(e) {
|
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
403
|
g.set(e.options, a), d(e.options, (c) => {
|
|
404
|
-
const
|
|
405
|
-
g.set(e.options, c),
|
|
404
|
+
const o = g.get(e.options);
|
|
405
|
+
g.set(e.options, c), o(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
|
-
case
|
|
418
|
-
|
|
417
|
+
case I(e.options): {
|
|
418
|
+
D(e.options, () => {
|
|
419
419
|
a(e.options.value);
|
|
420
420
|
}, {
|
|
421
421
|
immediate: !0
|
|
@@ -423,74 +423,74 @@ function Ue(e) {
|
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
default:
|
|
426
|
-
|
|
426
|
+
l.value = e.options;
|
|
427
427
|
}
|
|
428
428
|
function u(n, c) {
|
|
429
|
-
var
|
|
430
|
-
const
|
|
431
|
-
return
|
|
429
|
+
var f;
|
|
430
|
+
const o = ((f = e.fieldNames) == null ? void 0 : f.title) || "title", b = c[o];
|
|
431
|
+
return b ? b.toLowerCase().includes(n.toLowerCase()) : !1;
|
|
432
432
|
}
|
|
433
|
-
return (n, c) => (e.default && !r && (n[c.key] = e.default, r = !0),
|
|
434
|
-
ref: (
|
|
433
|
+
return (n, c) => (e.default && !r && (n[c.key] = e.default, r = !0), i(fe, {
|
|
434
|
+
ref: (o) => t = o,
|
|
435
435
|
multiple: e.multiple,
|
|
436
436
|
modelValue: n[c.key],
|
|
437
|
-
"onUpdate:modelValue": (
|
|
437
|
+
"onUpdate:modelValue": (o) => n[c.key] = o,
|
|
438
438
|
placeholder: e.placeholder,
|
|
439
439
|
allowClear: e.clearable,
|
|
440
440
|
allowSearch: e.searchable,
|
|
441
441
|
maxTagCount: e.maxTagCount ?? 2,
|
|
442
|
-
onChange:
|
|
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
|
|
452
|
-
function
|
|
453
|
-
const e =
|
|
451
|
+
const C = /* @__PURE__ */ new WeakMap();
|
|
452
|
+
function We() {
|
|
453
|
+
const e = k([]);
|
|
454
454
|
return [e, (r) => e.value = r];
|
|
455
455
|
}
|
|
456
|
-
function
|
|
457
|
-
let
|
|
458
|
-
const [
|
|
459
|
-
if (!e.autoSumbit || !
|
|
456
|
+
function Ae(e) {
|
|
457
|
+
let t, r = !1;
|
|
458
|
+
const [l, a] = We(), 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
465
|
}, d = (u, n) => {
|
|
466
466
|
const c = u();
|
|
467
467
|
c instanceof Promise ? c.then(n) : n(c);
|
|
468
|
-
},
|
|
469
|
-
const u =
|
|
468
|
+
}, m = async () => {
|
|
469
|
+
const u = C.get(e.options);
|
|
470
470
|
switch (typeof u) {
|
|
471
471
|
case "function":
|
|
472
|
-
|
|
472
|
+
C.set(e.options, a);
|
|
473
473
|
return;
|
|
474
474
|
case "object":
|
|
475
475
|
a(u);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
const c =
|
|
480
|
-
|
|
478
|
+
C.set(e.options, a), d(e.options, (n) => {
|
|
479
|
+
const c = C.get(e.options);
|
|
480
|
+
C.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
|
-
case
|
|
493
|
-
|
|
492
|
+
case I(e.options): {
|
|
493
|
+
D(e.options, () => {
|
|
494
494
|
a(e.options.value);
|
|
495
495
|
}, {
|
|
496
496
|
immediate: !0
|
|
@@ -498,11 +498,11 @@ function qe(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),
|
|
503
|
+
return (u, n) => (e.default && !r && (u[n.key] = e.default, r = !0), i(oe, {
|
|
504
504
|
pathMode: e.pathMode,
|
|
505
|
-
ref: (c) =>
|
|
505
|
+
ref: (c) => t = c,
|
|
506
506
|
multiple: e.multiple,
|
|
507
507
|
modelValue: u[n.key],
|
|
508
508
|
"onUpdate:modelValue": (c) => u[n.key] = c,
|
|
@@ -510,45 +510,45 @@ function qe(e) {
|
|
|
510
510
|
allowClear: e.clearable,
|
|
511
511
|
allowSearch: e.searchable,
|
|
512
512
|
maxTagCount: e.maxTagCount ?? 2,
|
|
513
|
-
onChange:
|
|
514
|
-
options:
|
|
513
|
+
onChange: s,
|
|
514
|
+
options: l.value
|
|
515
515
|
}, null));
|
|
516
516
|
}
|
|
517
|
-
function
|
|
518
|
-
return (
|
|
517
|
+
function Be(e) {
|
|
518
|
+
return (t) => e(t);
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function Ye() {
|
|
521
521
|
return {
|
|
522
|
-
input:
|
|
523
|
-
textarea:
|
|
524
|
-
select:
|
|
525
|
-
treeSelect:
|
|
526
|
-
date:
|
|
527
|
-
switch:
|
|
528
|
-
dateRange:
|
|
529
|
-
render:
|
|
530
|
-
cascader:
|
|
522
|
+
input: Pe,
|
|
523
|
+
textarea: Ee,
|
|
524
|
+
select: ze,
|
|
525
|
+
treeSelect: qe,
|
|
526
|
+
date: Me,
|
|
527
|
+
switch: Re,
|
|
528
|
+
dateRange: pe,
|
|
529
|
+
render: Be,
|
|
530
|
+
cascader: Ae
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
|
|
535
|
-
const r =
|
|
536
|
-
...
|
|
533
|
+
function Ge(e, t) {
|
|
534
|
+
t.render || (t.render = (l) => l.input());
|
|
535
|
+
const r = t.render({
|
|
536
|
+
...Ye()
|
|
537
537
|
});
|
|
538
538
|
return {
|
|
539
|
-
default: () => r(e,
|
|
539
|
+
default: () => r(e, t)
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
544
|
-
field:
|
|
545
|
-
label:
|
|
546
|
-
},
|
|
542
|
+
function Ke(e, t) {
|
|
543
|
+
return X(W, {
|
|
544
|
+
field: t.key,
|
|
545
|
+
label: t.title
|
|
546
|
+
}, Ge(e, t));
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
548
|
+
function P(e) {
|
|
549
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
550
550
|
}
|
|
551
|
-
const
|
|
551
|
+
const Qe = /* @__PURE__ */ V({
|
|
552
552
|
props: {
|
|
553
553
|
form: {
|
|
554
554
|
type: Object,
|
|
@@ -579,12 +579,12 @@ const Ge = /* @__PURE__ */ x({
|
|
|
579
579
|
name: {
|
|
580
580
|
type: String,
|
|
581
581
|
required: !1,
|
|
582
|
-
default:
|
|
582
|
+
default: `form-${Math.random().toString(32).slice(2)}`
|
|
583
583
|
},
|
|
584
|
-
|
|
584
|
+
id: {
|
|
585
585
|
type: String,
|
|
586
586
|
required: !1,
|
|
587
|
-
default: Math.random().toString(32).slice(2)
|
|
587
|
+
default: `form-${Math.random().toString(32).slice(2)}`
|
|
588
588
|
},
|
|
589
589
|
submitable: {
|
|
590
590
|
type: Boolean,
|
|
@@ -603,158 +603,167 @@ const Ge = /* @__PURE__ */ x({
|
|
|
603
603
|
}
|
|
604
604
|
},
|
|
605
605
|
emits: ["submit", "cancel", "update:model-value"],
|
|
606
|
-
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
606
|
+
expose: ["formSource", "updateFormField", "updateFormSource", "reset", "validate"],
|
|
607
607
|
setup(e) {
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
const
|
|
608
|
+
const t = k(), [r, l] = Ne(e.form, e.modelValue || e.value), a = k(e.columns || 0), s = k(!0), d = () => s.value = !s.value;
|
|
609
|
+
j(M.id, e.id), j(M.source, r);
|
|
610
|
+
const m = v(() => {
|
|
611
611
|
if (!a.value)
|
|
612
612
|
return 1;
|
|
613
|
-
const
|
|
614
|
-
return a.value -
|
|
615
|
-
}),
|
|
613
|
+
const f = e.form.reduce((h, F) => h + ((F == null ? void 0 : F.span) || 1), 0);
|
|
614
|
+
return a.value - f % a.value;
|
|
615
|
+
}), y = v(() => e.form.reduce((f, h) => (h.rule && (f[h.key] = h.rule), f), {}));
|
|
616
616
|
function u() {
|
|
617
|
-
var
|
|
617
|
+
var h;
|
|
618
618
|
if (e.columns)
|
|
619
619
|
return;
|
|
620
|
-
const
|
|
621
|
-
|
|
620
|
+
const f = (h = t.value) == null ? void 0 : h.$el;
|
|
621
|
+
f && (a.value = Math.floor(f.offsetWidth / e.minWidth));
|
|
622
|
+
}
|
|
623
|
+
function n() {
|
|
624
|
+
var h;
|
|
625
|
+
const f = (h = t.value) == null ? void 0 : h.$el;
|
|
626
|
+
f && (f.id = e.id);
|
|
622
627
|
}
|
|
623
|
-
|
|
624
|
-
u();
|
|
628
|
+
q(() => {
|
|
629
|
+
u(), n();
|
|
625
630
|
});
|
|
626
|
-
function
|
|
627
|
-
r.value[
|
|
631
|
+
function c(f, h) {
|
|
632
|
+
r.value[f] = h, l({
|
|
628
633
|
...r
|
|
629
634
|
});
|
|
630
635
|
}
|
|
631
|
-
function
|
|
632
|
-
var
|
|
633
|
-
(
|
|
636
|
+
function o() {
|
|
637
|
+
var f;
|
|
638
|
+
(f = t.value) == null || f.resetFields();
|
|
639
|
+
}
|
|
640
|
+
function b() {
|
|
641
|
+
var f;
|
|
642
|
+
return (f = t.value) == null ? void 0 : f.validate();
|
|
634
643
|
}
|
|
635
644
|
return window.addEventListener("resize", u), {
|
|
636
645
|
formSource: r,
|
|
637
|
-
formInstance:
|
|
646
|
+
formInstance: t,
|
|
638
647
|
formColumns: a,
|
|
639
|
-
formRules:
|
|
640
|
-
formCollspased:
|
|
641
|
-
formActiosSpan:
|
|
648
|
+
formRules: y,
|
|
649
|
+
formCollspased: s,
|
|
650
|
+
formActiosSpan: m,
|
|
642
651
|
toggleFormCollapsed: d,
|
|
643
|
-
updateFormField:
|
|
644
|
-
updateFormSource:
|
|
645
|
-
reset:
|
|
652
|
+
updateFormField: c,
|
|
653
|
+
updateFormSource: l,
|
|
654
|
+
reset: o,
|
|
655
|
+
validate: b
|
|
646
656
|
};
|
|
647
657
|
},
|
|
648
658
|
render() {
|
|
649
659
|
const e = () => {
|
|
650
660
|
this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
|
|
651
|
-
},
|
|
652
|
-
const
|
|
661
|
+
}, t = () => {
|
|
662
|
+
const l = [], a = this.footer ? {
|
|
653
663
|
span: this.formColumns
|
|
654
664
|
} : {
|
|
655
665
|
span: this.formActiosSpan
|
|
656
666
|
};
|
|
657
|
-
if (this.searchable && (
|
|
667
|
+
if (this.searchable && (l.push(i(S, {
|
|
658
668
|
type: "primary",
|
|
659
669
|
htmlType: "submit"
|
|
660
670
|
}, {
|
|
661
|
-
default: () => [
|
|
662
|
-
})),
|
|
671
|
+
default: () => [w("搜索")]
|
|
672
|
+
})), l.push(i(S, {
|
|
663
673
|
type: "secondary",
|
|
664
674
|
onClick: () => {
|
|
665
|
-
var
|
|
666
|
-
return (
|
|
675
|
+
var s;
|
|
676
|
+
return (s = this.formInstance) == null ? void 0 : s.resetFields();
|
|
667
677
|
}
|
|
668
678
|
}, {
|
|
669
|
-
default: () => [
|
|
670
|
-
}))), this.submitable && (
|
|
679
|
+
default: () => [w("重置")]
|
|
680
|
+
}))), this.submitable && (l.push(i(S, {
|
|
671
681
|
type: "primary",
|
|
672
682
|
htmlType: "submit"
|
|
673
683
|
}, {
|
|
674
|
-
default: () => [
|
|
675
|
-
})),
|
|
684
|
+
default: () => [w("提交")]
|
|
685
|
+
})), l.push(i(S, {
|
|
676
686
|
type: "secondary",
|
|
677
687
|
onClick: () => this.$emit("cancel")
|
|
678
688
|
}, {
|
|
679
|
-
default: () => [
|
|
680
|
-
}))), this.form.some((
|
|
689
|
+
default: () => [w("取消")]
|
|
690
|
+
}))), this.form.some((s) => !!s.collapsed) && l.push(i(S, {
|
|
681
691
|
onClick: this.toggleFormCollapsed
|
|
682
692
|
}, {
|
|
683
693
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
684
|
-
icon: () => this.formCollspased ?
|
|
685
|
-
})), this.$slots.actions &&
|
|
686
|
-
return
|
|
687
|
-
default: () => [
|
|
694
|
+
icon: () => this.formCollspased ? i(xe, null, null) : i(_e, null, null)
|
|
695
|
+
})), this.$slots.actions && l.push(...this.$slots.actions()), l.length)
|
|
696
|
+
return i(_, a, {
|
|
697
|
+
default: () => [i(W, {
|
|
688
698
|
hideLabel: !0,
|
|
689
699
|
contentClass: this.footer ? "form-footer" : ""
|
|
690
700
|
}, {
|
|
691
|
-
default: () => [
|
|
692
|
-
default: () => [
|
|
701
|
+
default: () => [i(ye, null, P(l) ? l : {
|
|
702
|
+
default: () => [l]
|
|
693
703
|
})]
|
|
694
704
|
})]
|
|
695
705
|
});
|
|
696
|
-
}, r = this.form.filter((
|
|
706
|
+
}, r = this.form.filter((l) => this.formCollspased ? !l.collapsed : !0).filter((l) => {
|
|
697
707
|
switch (!0) {
|
|
698
|
-
case typeof
|
|
699
|
-
return
|
|
700
|
-
case typeof
|
|
701
|
-
return
|
|
708
|
+
case typeof l.visiable == "boolean":
|
|
709
|
+
return l.visiable;
|
|
710
|
+
case typeof l.visiable == "function":
|
|
711
|
+
return l.visiable(this.formSource);
|
|
702
712
|
default:
|
|
703
713
|
return !0;
|
|
704
714
|
}
|
|
705
715
|
});
|
|
706
|
-
return
|
|
716
|
+
return i("div", {
|
|
707
717
|
class: "form-render"
|
|
708
|
-
}, [
|
|
709
|
-
name: this.name
|
|
710
|
-
id: this.formId
|
|
718
|
+
}, [i(me, H({
|
|
719
|
+
name: this.name
|
|
711
720
|
}, {
|
|
712
721
|
labelAlign: "left",
|
|
713
722
|
layout: this.$props.layout,
|
|
714
723
|
rules: this.formRules,
|
|
715
724
|
onSubmitSuccess: e,
|
|
716
725
|
"auto-label-width": !0,
|
|
717
|
-
ref: (
|
|
726
|
+
ref: (l) => this.formInstance = l,
|
|
718
727
|
model: this.formSource
|
|
719
728
|
}), {
|
|
720
|
-
default: () => [
|
|
729
|
+
default: () => [i(he, {
|
|
721
730
|
cols: this.formColumns,
|
|
722
731
|
"col-gap": 24,
|
|
723
732
|
"rol-gap": 10
|
|
724
733
|
}, {
|
|
725
|
-
default: () => [r.filter(() => this.formColumns !== 0).map((
|
|
734
|
+
default: () => [r.filter(() => this.formColumns !== 0).map((l) => {
|
|
726
735
|
let a;
|
|
727
|
-
return
|
|
728
|
-
span:
|
|
729
|
-
},
|
|
736
|
+
return i(_, {
|
|
737
|
+
span: l.span
|
|
738
|
+
}, P(a = Ke(this.formSource, l)) ? a : {
|
|
730
739
|
default: () => [a]
|
|
731
740
|
});
|
|
732
|
-
}),
|
|
741
|
+
}), t()]
|
|
733
742
|
})]
|
|
734
743
|
})]);
|
|
735
744
|
}
|
|
736
745
|
});
|
|
737
|
-
function
|
|
746
|
+
function Ze(e) {
|
|
738
747
|
return e;
|
|
739
748
|
}
|
|
740
|
-
function
|
|
741
|
-
const
|
|
742
|
-
function
|
|
743
|
-
var
|
|
744
|
-
const a = (d = (
|
|
749
|
+
function et(e) {
|
|
750
|
+
const t = T(), r = k();
|
|
751
|
+
function l() {
|
|
752
|
+
var s, d;
|
|
753
|
+
const a = (d = (s = t == null ? void 0 : t.proxy) == null ? void 0 : s.$refs) == null ? void 0 : d[e];
|
|
745
754
|
a && (r.value = a);
|
|
746
755
|
}
|
|
747
|
-
return
|
|
756
|
+
return q(l), J(l), r;
|
|
748
757
|
}
|
|
749
|
-
const
|
|
750
|
-
install(e,
|
|
751
|
-
e.component("FormRender",
|
|
758
|
+
const tt = {
|
|
759
|
+
install(e, t) {
|
|
760
|
+
e.component("FormRender", Qe);
|
|
752
761
|
}
|
|
753
762
|
};
|
|
754
763
|
export {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
764
|
+
Qe as FormRender,
|
|
765
|
+
at as FormRenderResolver,
|
|
766
|
+
tt as default,
|
|
767
|
+
Ze as defineForm,
|
|
768
|
+
et as useForm
|
|
760
769
|
};
|