@gopowerteam/form-render 0.0.27 → 0.0.29
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-items/select/index.d.ts +2 -1
- package/dist/cjs/form-items/tree-select/index.d.ts +3 -1
- package/dist/cjs/form-render/index.d.ts +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/form-items/select/index.d.ts +2 -1
- package/dist/es/form-items/tree-select/index.d.ts +3 -1
- package/dist/es/form-render/index.d.ts +1 -1
- package/dist/es/index.mjs +328 -280
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
1
2
|
import type { DataRecord, FormItemOptions } from '../../interfaces';
|
|
2
3
|
export declare function renderSelectItem<T = DataRecord>(options: RenderSelectItemOptions): (data: T, form: FormItemOptions<T>) => import("vue/jsx-runtime").JSX.Element;
|
|
3
4
|
export type SelectOptions = Map<string | number, string>;
|
|
@@ -5,7 +6,7 @@ export interface RenderSelectItemOptions {
|
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
clearable?: boolean;
|
|
7
8
|
searchable?: boolean;
|
|
8
|
-
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>)
|
|
9
|
+
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>) | Ref<SelectOptions>;
|
|
9
10
|
multiple?: boolean;
|
|
10
11
|
maxTagCount?: number;
|
|
11
12
|
default?: string | number | boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type TreeFieldNames, type TreeNodeData } from '@arco-design/web-vue';
|
|
2
|
+
import { type Ref } from 'vue';
|
|
2
3
|
import type { DataRecord, FormItemOptions } from '../../interfaces';
|
|
3
4
|
export declare function renderTreeSelectItem<T = DataRecord>(options: RenderTreeSelectItemOptions): (data: T, form: FormItemOptions<T>) => import("vue/jsx-runtime").JSX.Element;
|
|
5
|
+
export type SelectOptions = TreeNodeData[];
|
|
4
6
|
export interface RenderTreeSelectItemOptions {
|
|
5
7
|
placeholder?: string;
|
|
6
8
|
clearable?: boolean;
|
|
7
9
|
searchable?: boolean;
|
|
8
10
|
fieldNames?: TreeFieldNames;
|
|
9
|
-
options:
|
|
11
|
+
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>) | Ref<SelectOptions>;
|
|
10
12
|
multiple?: boolean;
|
|
11
13
|
maxTagCount?: number;
|
|
12
14
|
default?: string | number | boolean;
|
|
@@ -359,8 +359,8 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
359
359
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
360
360
|
"onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
|
|
361
361
|
}, {
|
|
362
|
-
name: string;
|
|
363
362
|
footer: boolean;
|
|
363
|
+
name: string;
|
|
364
364
|
layout: "horizontal" | "vertical";
|
|
365
365
|
minWidth: number;
|
|
366
366
|
submitable: boolean;
|
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"),g=require("dayjs"),_=require("./resolver.cjs");const j=Symbol("ArcoConfigProvider"),D="arco",O="$arco",N=e=>{var r,l,t;const u=a.getCurrentInstance(),d=a.inject(j,void 0),c=(t=(l=d==null?void 0:d.prefixCls)!=null?l:(r=u==null?void 0:u.appContext.config.globalProperties[O])==null?void 0:r.classPrefix)!=null?t:D;return e?`${c}-${e}`:c},M=Object.prototype.toString;function w(e){return M.call(e)==="[object Number]"&&e===e}var x=(e,r)=>{for(const[l,t]of r)e[l]=t;return e};const z=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}]),u=a.computed(()=>{const c={};return e.size&&(c.fontSize=w(e.size)?`${e.size}px`:e.size),e.rotate&&(c.transform=`rotate(${e.rotate}deg)`),c});return{cls:t,innerStyle:u,onClick:c=>{r("click",c)}}}}),T=["stroke-width","stroke-linecap","stroke-linejoin"],L=a.createElementVNode("path",{d:"M39.6 17.443 24.043 33 8.487 17.443"},null,-1),P=[L];function R(e,r,l,t,u,d){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]=(...c)=>e.onClick&&e.onClick(...c))},P,14,T)}var S=x(z,[["render",R]]);const U=Object.assign(S,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+S.name,S)}}),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}]),u=a.computed(()=>{const c={};return e.size&&(c.fontSize=w(e.size)?`${e.size}px`:e.size),e.rotate&&(c.transform=`rotate(${e.rotate}deg)`),c});return{cls:t,innerStyle:u,onClick:c=>{r("click",c)}}}}),q=["stroke-width","stroke-linecap","stroke-linejoin"],E=a.createElementVNode("path",{d:"M39.6 30.557 24.043 15 8.487 30.557"},null,-1),A=[E];function W(e,r,l,t,u,d){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]=(...c)=>e.onClick&&e.onClick(...c))},A,14,q)}var V=x(B,[["render",W]]);const Y=Object.assign(V,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+V.name,V)}}),$={id:Symbol("ID"),source:Symbol("Source")};function G(e,r){const l=a.ref({});return e==null||e.forEach(u=>{let d=null;u.default&&(d=(typeof u.default=="function"?u.default():u.default)||null),r&&r[u.key]!==void 0&&(d=r[u.key]),l.value[u.key]=d}),[l,u=>{l.value=u}]}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":u=>l[t.key]=u,"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":u=>l[t.key]=u,"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":u=>l[t.key]=u,"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":u=>l[t.key]=u,"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,{modelValue:l[t.key],"onUpdate:modelValue":u=>l[t.key]=u,"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)}}}function X(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const k=new WeakMap;function H(e){let r,l=!1;const t=a.ref(new Map),u=n=>t.value=n,d=()=>{if(!e.autoSumbit||!r)return;let n=r;for(;n&&n.$el.tagName!=="FORM";)n=n.$parent;n&&n.$el&&n.$el.dispatchEvent(new Event("submit"))},c=async()=>{const n=await e.options();if(e.cache===!1&&(t.value=n),e.cache!==!1&&k.has(e.options)){const s=k.get(e.options);typeof s=="function"&&s(n),k.set(e.options,n)}else t.value=n};switch(!0){case e.options instanceof Function:{const n=k.get(e.options);if(e.cache!==!1&&typeof n=="function")break;if(e.cache!==!1&&n instanceof Map){u(n);break}c(),e.cache!==!1&&k.set(e.options,s=>{t.value=s});break}default:t.value=e.options}return(n,s)=>{let o;return e.default&&!l&&(n[s.key]=e.default,l=!0),a.createVNode(f.Select,{ref:i=>r=i,multiple:e.multiple,modelValue:n[s.key],"onUpdate:modelValue":i=>n[s.key]=i,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:d},X(o=Array.from(t.value.entries()).map(([i,y])=>a.createVNode(f.Option,{key:i,value:i,label:y},null)))?o:{default:()=>[o]})}}function J(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":u=>l[t.key]=u,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 Z(e){return(r,l)=>{let t=[];function u(n){t=n}function d(n){if(n&&n.length===2){const[s,o]=n.sort(),i=g(s).startOf("days"),y=g(o).endOf("days");r[l.key]=[i.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD"),y.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD")]}}function c(n){return e!=null&&e.disabledDate?e.disabledDate(t,n):!1}return a.createVNode("div",null,[a.createVNode(f.RangePicker,{style:{width:"300px"},modelValue:r[l.key],"onUpdate:modelValue":n=>r[l.key]=n,onSelect:u,onChange:d,mode:e==null?void 0:e.type,allowClear:e==null?void 0:e.clearable,"disabled-date":c,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)])}}function p(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 b=new Map;function ee(e){let r,l=!1;const t=a.ref([]),u=()=>{if(!e.autoSumbit||!r)return;let n=r;for(;n&&n.$el.tagName!=="FORM";)n=n.$parent;n&&n.$el&&n.$el.dispatchEvent(new Event("submit"))},d=async()=>{const n=await e.options();if(e.cache!==!1&&b.has(e.options)){const s=b.get(e.options);typeof s=="function"&&s(n),b.delete(e.options)}else t.value=n};switch(!0){case e.options instanceof Function:{if(e.cache!==!1&&b.has(e.options))break;d(),e.cache!==!1&&b.set(e.options,n=>{t.value=n});break}default:t.value=e.options}function c(n,s){var y;const o=((y=e.fieldNames)==null?void 0:y.title)||"title",i=s[o];return i?i.toLowerCase().includes(n.toLowerCase()):!1}return(n,s)=>(e.default&&!l&&(n[s.key]=e.default,l=!0),a.createVNode(f.TreeSelect,{ref:o=>r=o,multiple:e.multiple,modelValue:n[s.key],"onUpdate:modelValue":o=>n[s.key]=o,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:u,filterTreeNode:c,data:t.value,fieldNames:e.fieldNames},null))}function te(e){return r=>e(r)}function re(){return{input:Q,textarea:p,select:H,treeSelect:ee,date:K,switch:J,dateRange:Z,render:te}}function le(e,r){r.render||(r.render=t=>t.input());const l=r.render({...re()});return{default:()=>l(e,r)}}function ae(e,r){return a.h(f.FormItem,{field:r.key,label:r.title},le(e,r))}function C(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const F=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:320},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,u]=G(e.form,e.modelValue||e.value),d=a.ref(e.columns||0),c=a.ref(!0),n=()=>c.value=!c.value;a.provide($.id,r),a.provide($.source,t);const s=a.computed(()=>{if(!d.value)return 1;const m=e.form.reduce((h,v)=>h+((v==null?void 0:v.span)||1),0);return d.value-m%d.value}),o=a.computed(()=>e.form.reduce((m,h)=>(h.rule&&(m[h.key]=h.rule),m),{}));function i(){var h;if(e.columns)return;const m=(h=l.value)==null?void 0:h.$el;m&&(d.value=Math.floor(m.offsetWidth/e.minWidth))}a.onMounted(()=>{i()});function y(m,h){t.value[m]=h,u({...t})}function I(){var m;(m=l.value)==null||m.resetFields()}return window.addEventListener("resize",i),{formId:r,formSource:t,formInstance:l,formColumns:d,formRules:o,formCollspased:c,formActiosSpan:s,toggleFormCollapsed:n,updateFormField:y,updateFormSource:u,reset:I}},render(){const e=()=>{this.$emit("submit",this.formSource),this.$emit("update:model-value",this.formSource)},r=()=>{const t=[],u=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 d;return(d=this.formInstance)==null?void 0:d.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(d=>!!d.collapsed)&&t.push(a.createVNode(f.Button,{onClick:this.toggleFormCollapsed},{default:()=>this.formCollspased?"展开":"收起",icon:()=>this.formCollspased?a.createVNode(U,null,null):a.createVNode(Y,null,null)})),this.$slots.actions&&t.push(...this.$slots.actions()),t.length)return a.createVNode(f.GridItem,u,{default:()=>[a.createVNode(f.FormItem,{hideLabel:!0,contentClass:this.footer?"form-footer":""},{default:()=>[a.createVNode(f.Space,null,C(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({layout:this.$props.layout,rules:this.formRules,onSubmitSuccess:e},{name:this.name},{"auto-label-width":!0,ref:t=>this.formInstance=t,model:this.formSource}),{default:()=>[a.createVNode(f.Grid,{cols:this.formColumns,"col-gap":10,"rol-gap":10},{default:()=>[l.filter(()=>this.formColumns!==0).map(t=>{let u;return a.createVNode(f.GridItem,{span:t.span},C(u=ae(this.formSource,t))?u:{default:()=>[u]})}),r()]})]})])}});function ne(e){return e}function ue(e){const r=a.getCurrentInstance(),l=a.ref();function t(){var d,c;const u=(c=(d=r==null?void 0:r.proxy)==null?void 0:d.$refs)==null?void 0:c[e];u&&(l.value=u)}return a.onMounted(t),a.onUpdated(t),l}const ce={install(e,r){e.component("FormRender",F)}};exports.FormRenderResolver=_.FormRenderResolver;exports.FormRender=F;exports.default=ce;exports.defineForm=ne;exports.useForm=ue;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("@arco-design/web-vue"),C=require("dayjs"),_=require("./resolver.cjs");const j=Symbol("ArcoConfigProvider"),D="arco",T="$arco",N=e=>{var r,l,t;const n=a.getCurrentInstance(),d=a.inject(j,void 0),u=(t=(l=d==null?void 0:d.prefixCls)!=null?l:(r=n==null?void 0:n.appContext.config.globalProperties[T])==null?void 0:r.classPrefix)!=null?t:D;return e?`${u}-${e}`:u},M=Object.prototype.toString;function w(e){return M.call(e)==="[object Number]"&&e===e}var x=(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=N("icon"),t=a.computed(()=>[l,`${l}-down`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const u={};return e.size&&(u.fontSize=w(e.size)?`${e.size}px`:e.size),e.rotate&&(u.transform=`rotate(${e.rotate}deg)`),u});return{cls:t,innerStyle:n,onClick:u=>{r("click",u)}}}}),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,d){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]=(...u)=>e.onClick&&e.onClick(...u))},L,14,R)}var g=x(P,[["render",B]]);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)}}),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=N("icon"),t=a.computed(()=>[l,`${l}-up`,{[`${l}-spin`]:e.spin}]),n=a.computed(()=>{const u={};return e.size&&(u.fontSize=w(e.size)?`${e.size}px`:e.size),e.rotate&&(u.transform=`rotate(${e.rotate}deg)`),u});return{cls:t,innerStyle:n,onClick:u=>{r("click",u)}}}}),E=["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,d){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]=(...u)=>e.onClick&&e.onClick(...u))},A,14,E)}var V=x(U,[["render",Y]]);const G=Object.assign(V,{install:(e,r)=>{var l;const t=(l=r==null?void 0:r.iconPrefix)!=null?l:"";e.component(t+V.name,V)}}),$={id:Symbol("ID"),source:Symbol("Source")};function p(e,r){const l=a.ref({});return e==null||e.forEach(n=>{let d=null;n.default&&(d=(typeof n.default=="function"?n.default():n.default)||null),r&&r[n.key]!==void 0&&(d=r[n.key]),l.value[n.key]=d}),[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(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 Q(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 O(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 b=new WeakMap;function H(){const e=a.ref(new Map);return[e,l=>e.value=l]}function J(e){console.log("开始渲染Select:");let r,l=!1;const[t,n]=H(),d=()=>{if(!e.autoSumbit||!r)return;let s=r;for(;s&&s.$el.tagName!=="FORM";)s=s.$parent;s&&s.$el&&s.$el.dispatchEvent(new Event("submit"))},u=(s,c)=>{const o=s();o instanceof Promise?o.then(c):c(o)},h=async()=>{const s=b.get(e.options);switch(console.log("当前缓存值:",s),typeof s){case"function":console.log("检测到缓存正在请求中"),console.log("更新缓存"),b.set(e.options,n);return;case"object":console.log("检测到缓存数据完成"),n(s);return}console.log("未检测到缓存开始进行请求"),b.set(e.options,n),u(e.options,c=>{const o=b.get(e.options);b.set(e.options,c),o(c)})},k=()=>{u(e.options,s=>{n(s)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?(console.log("缓存开启"),h()):(console.log("缓存关闭"),k());break}case a.isRef(e.options):{O(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}return(s,c)=>{let o;return e.default&&!l&&(s[c.key]=e.default,l=!0),a.createVNode(i.Select,{ref:f=>r=f,multiple:e.multiple,modelValue:s[c.key],"onUpdate:modelValue":f=>s[c.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:d},X(o=Array.from(t.value.entries()).map(([f,m])=>a.createVNode(i.Option,{key:f,value:f,label:m},null)))?o:{default:()=>[o]})}}function Z(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 ee(e){return(r,l)=>{let t=[];function n(h){t=h}function d(h){if(h&&h.length===2){const[k,s]=h.sort(),c=C(k).startOf("days"),o=C(s).endOf("days");r[l.key]=[c.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD"),o.format((e==null?void 0:e.valueFormat)||"YYYY-MM-DD")]}}function u(h){return e!=null&&e.disabledDate?e.disabledDate(t,h):!1}return a.createVNode("div",null,[a.createVNode(i.RangePicker,{"disabled-input":!0,style:{width:"300px"},modelValue:r[l.key],"onUpdate:modelValue":h=>r[l.key]=h,onSelect:n,onChange:d,mode:e==null?void 0:e.type,allowClear:e==null?void 0:e.clearable,"disabled-date":u,format:e==null?void 0:e.labelFormat,"value-format":e==null?void 0:e.valueFormat},null)])}}function te(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 v=new WeakMap;function re(){const e=a.ref([]);return[e,l=>e.value=l]}function le(e){console.log("开始渲染SelectTree:");let r,l=!1;const[t,n]=re(),d=()=>{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"))},u=(c,o)=>{const f=c();f instanceof Promise?f.then(o):o(f)},h=async()=>{const c=v.get(e.options);switch(console.log("当前缓存值:",c),typeof c){case"function":console.log("检测到缓存正在请求中"),console.log("更新缓存"),v.set(e.options,n);return;case"object":console.log("检测到缓存数据完成"),n(c);return}console.log("未检测到缓存开始进行请求"),v.set(e.options,n),u(e.options,o=>{const f=v.get(e.options);v.set(e.options,o),f(o)})},k=()=>{u(e.options,c=>{n(c)})};switch(!0){case e.options instanceof Function:{e.cache!==!1?(console.log("缓存开启"),h()):(console.log("缓存关闭"),k());break}case a.isRef(e.options):{O(e.options,()=>{n(e.options.value)},{immediate:!0});break}default:t.value=e.options}function s(c,o){var y;const f=((y=e.fieldNames)==null?void 0:y.title)||"title",m=o[f];return m?m.toLowerCase().includes(c.toLowerCase()):!1}return(c,o)=>(e.default&&!l&&(c[o.key]=e.default,l=!0),a.createVNode(i.TreeSelect,{ref:f=>r=f,multiple:e.multiple,modelValue:c[o.key],"onUpdate:modelValue":f=>c[o.key]=f,placeholder:e.placeholder,allowClear:e.clearable,allowSearch:e.searchable,maxTagCount:e.maxTagCount??2,onChange:d,filterTreeNode:s,data:t.value,fieldNames:e.fieldNames},null))}function ae(e){return r=>e(r)}function ne(){return{input:Q,textarea:te,select:J,treeSelect:le,date:K,switch:Z,dateRange:ee,render:ae}}function ce(e,r){r.render||(r.render=t=>t.input());const l=r.render({...ne()});return{default:()=>l(e,r)}}function ue(e,r){return a.h(i.FormItem,{field:r.key,label:r.title},ce(e,r))}function F(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:320},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]=p(e.form,e.modelValue||e.value),d=a.ref(e.columns||0),u=a.ref(!0),h=()=>u.value=!u.value;a.provide($.id,r),a.provide($.source,t);const k=a.computed(()=>{if(!d.value)return 1;const m=e.form.reduce((y,S)=>y+((S==null?void 0:S.span)||1),0);return d.value-m%d.value}),s=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=l.value)==null?void 0:y.$el;m&&(d.value=Math.floor(m.offsetWidth/e.minWidth))}a.onMounted(()=>{c()});function o(m,y){t.value[m]=y,n({...t})}function f(){var m;(m=l.value)==null||m.resetFields()}return window.addEventListener("resize",c),{formId:r,formSource:t,formInstance:l,formColumns:d,formRules:s,formCollspased:u,formActiosSpan:k,toggleFormCollapsed:h,updateFormField:o,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 d;return(d=this.formInstance)==null?void 0:d.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(d=>!!d.collapsed)&&t.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&&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,F(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({layout:this.$props.layout,rules:this.formRules,onSubmitSuccess:e},{name:this.name},{"auto-label-width":!0,ref:t=>this.formInstance=t,model:this.formSource}),{default:()=>[a.createVNode(i.Grid,{cols:this.formColumns,"col-gap":10,"rol-gap":10},{default:()=>[l.filter(()=>this.formColumns!==0).map(t=>{let n;return a.createVNode(i.GridItem,{span:t.span},F(n=ue(this.formSource,t))?n:{default:()=>[n]})}),r()]})]})])}});function de(e){return e}function oe(e){const r=a.getCurrentInstance(),l=a.ref();function t(){var d,u;const n=(u=(d=r==null?void 0:r.proxy)==null?void 0:d.$refs)==null?void 0:u[e];n&&(l.value=n)}return a.onMounted(t),a.onUpdated(t),l}const se={install(e,r){e.component("FormRender",I)}};exports.FormRenderResolver=_.FormRenderResolver;exports.FormRender=I;exports.default=se;exports.defineForm=de;exports.useForm=oe;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
1
2
|
import type { DataRecord, FormItemOptions } from '../../interfaces';
|
|
2
3
|
export declare function renderSelectItem<T = DataRecord>(options: RenderSelectItemOptions): (data: T, form: FormItemOptions<T>) => import("vue/jsx-runtime").JSX.Element;
|
|
3
4
|
export type SelectOptions = Map<string | number, string>;
|
|
@@ -5,7 +6,7 @@ export interface RenderSelectItemOptions {
|
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
clearable?: boolean;
|
|
7
8
|
searchable?: boolean;
|
|
8
|
-
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>)
|
|
9
|
+
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>) | Ref<SelectOptions>;
|
|
9
10
|
multiple?: boolean;
|
|
10
11
|
maxTagCount?: number;
|
|
11
12
|
default?: string | number | boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type TreeFieldNames, type TreeNodeData } from '@arco-design/web-vue';
|
|
2
|
+
import { type Ref } from 'vue';
|
|
2
3
|
import type { DataRecord, FormItemOptions } from '../../interfaces';
|
|
3
4
|
export declare function renderTreeSelectItem<T = DataRecord>(options: RenderTreeSelectItemOptions): (data: T, form: FormItemOptions<T>) => import("vue/jsx-runtime").JSX.Element;
|
|
5
|
+
export type SelectOptions = TreeNodeData[];
|
|
4
6
|
export interface RenderTreeSelectItemOptions {
|
|
5
7
|
placeholder?: string;
|
|
6
8
|
clearable?: boolean;
|
|
7
9
|
searchable?: boolean;
|
|
8
10
|
fieldNames?: TreeFieldNames;
|
|
9
|
-
options:
|
|
11
|
+
options: SelectOptions | (() => SelectOptions) | (() => Promise<SelectOptions>) | Ref<SelectOptions>;
|
|
10
12
|
multiple?: boolean;
|
|
11
13
|
maxTagCount?: number;
|
|
12
14
|
default?: string | number | boolean;
|
|
@@ -359,8 +359,8 @@ export declare const FormRender: import("vue").DefineComponent<{
|
|
|
359
359
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
360
360
|
"onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
|
|
361
361
|
}, {
|
|
362
|
-
name: string;
|
|
363
362
|
footer: boolean;
|
|
363
|
+
name: string;
|
|
364
364
|
layout: "horizontal" | "vertical";
|
|
365
365
|
minWidth: number;
|
|
366
366
|
submitable: boolean;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { DatePicker as
|
|
1
|
+
import { getCurrentInstance as _, inject as Y, defineComponent as x, computed as b, openBlock as N, createElementBlock as P, normalizeClass as L, normalizeStyle as T, createElementVNode as z, ref as k, createVNode as d, watch as G, nextTick as K, isRef as M, isVNode as R, h as Q, provide as O, onMounted as U, mergeProps as X, createTextVNode as $, onUpdated as H } from "vue";
|
|
2
|
+
import { DatePicker as J, YearPicker as Z, QuarterPicker as p, MonthPicker as ee, WeekPicker as te, Input as le, InputNumber as re, Select as ae, Option as ne, Switch as ue, RangePicker as ce, Textarea as de, TreeSelect as se, FormItem as q, Form as oe, Grid as ie, GridItem as V, Button as S, Space as fe } from "@arco-design/web-vue";
|
|
3
3
|
import I from "dayjs";
|
|
4
|
-
import { FormRenderResolver as
|
|
5
|
-
const
|
|
6
|
-
var
|
|
7
|
-
const
|
|
4
|
+
import { FormRenderResolver as pe } from "./resolver.mjs";
|
|
5
|
+
const me = Symbol("ArcoConfigProvider"), he = "arco", ye = "$arco", B = (e) => {
|
|
6
|
+
var l, r, t;
|
|
7
|
+
const a = _(), c = Y(me, void 0), u = (t = (r = c == null ? void 0 : c.prefixCls) != null ? r : (l = a == null ? void 0 : a.appContext.config.globalProperties[ye]) == null ? void 0 : l.classPrefix) != null ? t : he;
|
|
8
8
|
return e ? `${u}-${e}` : u;
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
return
|
|
9
|
+
}, ke = Object.prototype.toString;
|
|
10
|
+
function E(e) {
|
|
11
|
+
return ke.call(e) === "[object Number]" && e === e;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
for (const [r,
|
|
15
|
-
e[r] =
|
|
13
|
+
var W = (e, l) => {
|
|
14
|
+
for (const [r, t] of l)
|
|
15
|
+
e[r] = t;
|
|
16
16
|
return e;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const be = x({
|
|
19
19
|
name: "IconDown",
|
|
20
20
|
props: {
|
|
21
21
|
size: {
|
|
@@ -42,47 +42,47 @@ const oe = x({
|
|
|
42
42
|
click: (e) => !0
|
|
43
43
|
},
|
|
44
44
|
setup(e, {
|
|
45
|
-
emit:
|
|
45
|
+
emit: l
|
|
46
46
|
}) {
|
|
47
|
-
const r =
|
|
47
|
+
const r = B("icon"), t = b(() => [r, `${r}-down`, {
|
|
48
48
|
[`${r}-spin`]: e.spin
|
|
49
|
-
}]),
|
|
49
|
+
}]), a = b(() => {
|
|
50
50
|
const u = {};
|
|
51
|
-
return e.size && (u.fontSize =
|
|
51
|
+
return e.size && (u.fontSize = E(e.size) ? `${e.size}px` : e.size), e.rotate && (u.transform = `rotate(${e.rotate}deg)`), u;
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
|
-
cls:
|
|
55
|
-
innerStyle:
|
|
54
|
+
cls: t,
|
|
55
|
+
innerStyle: a,
|
|
56
56
|
onClick: (u) => {
|
|
57
|
-
|
|
57
|
+
l("click", u);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
61
|
+
}), Se = ["stroke-width", "stroke-linecap", "stroke-linejoin"], ge = /* @__PURE__ */ z("path", {
|
|
62
62
|
d: "M39.6 17.443 24.043 33 8.487 17.443"
|
|
63
|
-
}, null, -1),
|
|
64
|
-
function
|
|
65
|
-
return N(),
|
|
63
|
+
}, null, -1), ve = [ge];
|
|
64
|
+
function $e(e, l, r, t, a, c) {
|
|
65
|
+
return N(), P("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
70
|
class: L(e.cls),
|
|
71
|
-
style:
|
|
71
|
+
style: T(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: l[0] || (l[0] = (...u) => e.onClick && e.onClick(...u))
|
|
76
|
+
}, ve, 14, Se);
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
const
|
|
80
|
-
install: (e,
|
|
78
|
+
var w = /* @__PURE__ */ W(be, [["render", $e]]);
|
|
79
|
+
const Ce = Object.assign(w, {
|
|
80
|
+
install: (e, l) => {
|
|
81
81
|
var r;
|
|
82
|
-
const
|
|
83
|
-
e.component(
|
|
82
|
+
const t = (r = l == null ? void 0 : l.iconPrefix) != null ? r : "";
|
|
83
|
+
e.component(t + w.name, w);
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
85
|
+
}), we = x({
|
|
86
86
|
name: "IconUp",
|
|
87
87
|
props: {
|
|
88
88
|
size: {
|
|
@@ -109,116 +109,117 @@ const ve = Object.assign(C, {
|
|
|
109
109
|
click: (e) => !0
|
|
110
110
|
},
|
|
111
111
|
setup(e, {
|
|
112
|
-
emit:
|
|
112
|
+
emit: l
|
|
113
113
|
}) {
|
|
114
|
-
const r =
|
|
114
|
+
const r = B("icon"), t = b(() => [r, `${r}-up`, {
|
|
115
115
|
[`${r}-spin`]: e.spin
|
|
116
|
-
}]),
|
|
116
|
+
}]), a = b(() => {
|
|
117
117
|
const u = {};
|
|
118
|
-
return e.size && (u.fontSize =
|
|
118
|
+
return e.size && (u.fontSize = E(e.size) ? `${e.size}px` : e.size), e.rotate && (u.transform = `rotate(${e.rotate}deg)`), u;
|
|
119
119
|
});
|
|
120
120
|
return {
|
|
121
|
-
cls:
|
|
122
|
-
innerStyle:
|
|
121
|
+
cls: t,
|
|
122
|
+
innerStyle: a,
|
|
123
123
|
onClick: (u) => {
|
|
124
|
-
|
|
124
|
+
l("click", u);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
}),
|
|
128
|
+
}), Fe = ["stroke-width", "stroke-linecap", "stroke-linejoin"], xe = /* @__PURE__ */ z("path", {
|
|
129
129
|
d: "M39.6 30.557 24.043 15 8.487 30.557"
|
|
130
|
-
}, null, -1),
|
|
131
|
-
function
|
|
132
|
-
return N(),
|
|
130
|
+
}, null, -1), Oe = [xe];
|
|
131
|
+
function Ve(e, l, r, t, a, c) {
|
|
132
|
+
return N(), P("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
137
|
class: L(e.cls),
|
|
138
|
-
style:
|
|
138
|
+
style: T(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: l[0] || (l[0] = (...u) => e.onClick && e.onClick(...u))
|
|
143
|
+
}, Oe, 14, Fe);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
const
|
|
147
|
-
install: (e,
|
|
145
|
+
var F = /* @__PURE__ */ W(we, [["render", Ve]]);
|
|
146
|
+
const Ie = Object.assign(F, {
|
|
147
|
+
install: (e, l) => {
|
|
148
148
|
var r;
|
|
149
|
-
const
|
|
150
|
-
e.component(
|
|
149
|
+
const t = (r = l == null ? void 0 : l.iconPrefix) != null ? r : "";
|
|
150
|
+
e.component(t + F.name, F);
|
|
151
151
|
}
|
|
152
|
-
}),
|
|
152
|
+
}), D = {
|
|
153
153
|
id: Symbol("ID"),
|
|
154
154
|
source: Symbol("Source")
|
|
155
155
|
};
|
|
156
|
-
function
|
|
157
|
-
const r =
|
|
158
|
-
return e == null || e.forEach((
|
|
156
|
+
function De(e, l) {
|
|
157
|
+
const r = k({});
|
|
158
|
+
return e == null || e.forEach((a) => {
|
|
159
159
|
let c = null;
|
|
160
|
-
|
|
161
|
-
}), [r, (
|
|
162
|
-
r.value =
|
|
160
|
+
a.default && (c = (typeof a.default == "function" ? a.default() : a.default) || null), l && l[a.key] !== void 0 && (c = l[a.key]), r.value[a.key] = c;
|
|
161
|
+
}), [r, (a) => {
|
|
162
|
+
r.value = a;
|
|
163
163
|
}];
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
function
|
|
167
|
-
return e != null && e.disabledDate ? e.disabledDate(r,
|
|
165
|
+
function je(e) {
|
|
166
|
+
function l(r, t) {
|
|
167
|
+
return e != null && e.disabledDate ? e.disabledDate(r, t) : !1;
|
|
168
168
|
}
|
|
169
|
-
return (r,
|
|
169
|
+
return (r, t) => {
|
|
170
170
|
switch (e == null ? void 0 : e.type) {
|
|
171
171
|
case "week":
|
|
172
|
-
return d(
|
|
173
|
-
modelValue: r[
|
|
174
|
-
"onUpdate:modelValue": (
|
|
175
|
-
"disabled-date":
|
|
172
|
+
return d(te, {
|
|
173
|
+
modelValue: r[t.key],
|
|
174
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
175
|
+
"disabled-date": l,
|
|
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 d(
|
|
181
|
-
modelValue: r[
|
|
182
|
-
"onUpdate:modelValue": (
|
|
183
|
-
"disabled-date":
|
|
180
|
+
return d(ee, {
|
|
181
|
+
modelValue: r[t.key],
|
|
182
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
183
|
+
"disabled-date": l,
|
|
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 d(
|
|
189
|
-
modelValue: r[
|
|
190
|
-
"onUpdate:modelValue": (
|
|
191
|
-
"disabled-date":
|
|
188
|
+
return d(p, {
|
|
189
|
+
modelValue: r[t.key],
|
|
190
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
191
|
+
"disabled-date": l,
|
|
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 d(
|
|
197
|
-
modelValue: r[
|
|
198
|
-
"onUpdate:modelValue": (
|
|
199
|
-
"disabled-date":
|
|
196
|
+
return d(Z, {
|
|
197
|
+
modelValue: r[t.key],
|
|
198
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
199
|
+
"disabled-date": l,
|
|
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 d(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
"
|
|
205
|
+
return d(J, {
|
|
206
|
+
"disabled-input": !0,
|
|
207
|
+
modelValue: r[t.key],
|
|
208
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
209
|
+
"disabled-date": l,
|
|
209
210
|
format: e == null ? void 0 : e.labelFormat,
|
|
210
211
|
"value-format": e == null ? void 0 : e.valueFormat
|
|
211
212
|
}, null);
|
|
212
213
|
}
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
|
-
function
|
|
216
|
-
return (
|
|
216
|
+
function _e(e) {
|
|
217
|
+
return (l, r) => {
|
|
217
218
|
switch (e == null ? void 0 : e.type) {
|
|
218
219
|
case "number":
|
|
219
|
-
return d(
|
|
220
|
-
modelValue:
|
|
221
|
-
"onUpdate:modelValue": (
|
|
220
|
+
return d(re, {
|
|
221
|
+
modelValue: l[r.key],
|
|
222
|
+
"onUpdate:modelValue": (t) => l[r.key] = t,
|
|
222
223
|
hideButton: !0,
|
|
223
224
|
"read-only": e == null ? void 0 : e.readonly,
|
|
224
225
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
@@ -226,9 +227,9 @@ function Ie(e) {
|
|
|
226
227
|
}, null);
|
|
227
228
|
case "string":
|
|
228
229
|
default:
|
|
229
|
-
return d(
|
|
230
|
-
modelValue:
|
|
231
|
-
"onUpdate:modelValue": (
|
|
230
|
+
return d(le, {
|
|
231
|
+
modelValue: l[r.key],
|
|
232
|
+
"onUpdate:modelValue": (t) => l[r.key] = t,
|
|
232
233
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
233
234
|
readonly: e == null ? void 0 : e.readonly,
|
|
234
235
|
allowClear: e == null ? void 0 : e.clearable
|
|
@@ -236,101 +237,125 @@ function Ie(e) {
|
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
241
|
+
function A(e, l, r) {
|
|
242
|
+
const t = G(e, (...a) => (K(() => t()), l(...a)), r);
|
|
243
|
+
return t;
|
|
241
244
|
}
|
|
242
|
-
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
function Ne(e) {
|
|
246
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
|
|
247
|
+
}
|
|
248
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
249
|
+
function Pe() {
|
|
250
|
+
const e = k(/* @__PURE__ */ new Map());
|
|
251
|
+
return [e, (r) => e.value = r];
|
|
252
|
+
}
|
|
253
|
+
function Le(e) {
|
|
254
|
+
console.log("开始渲染Select:");
|
|
255
|
+
let l, r = !1;
|
|
256
|
+
const [t, a] = Pe(), c = () => {
|
|
257
|
+
if (!e.autoSumbit || !l)
|
|
247
258
|
return;
|
|
248
|
-
let
|
|
249
|
-
for (;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}, u =
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
let o = l;
|
|
260
|
+
for (; o && o.$el.tagName !== "FORM"; )
|
|
261
|
+
o = o.$parent;
|
|
262
|
+
o && o.$el && o.$el.dispatchEvent(new Event("submit"));
|
|
263
|
+
}, u = (o, n) => {
|
|
264
|
+
const s = o();
|
|
265
|
+
s instanceof Promise ? s.then(n) : n(s);
|
|
266
|
+
}, m = async () => {
|
|
267
|
+
const o = g.get(e.options);
|
|
268
|
+
switch (console.log("当前缓存值:", o), typeof o) {
|
|
269
|
+
case "function":
|
|
270
|
+
console.log("检测到缓存正在请求中"), console.log("更新缓存"), g.set(e.options, a);
|
|
271
|
+
return;
|
|
272
|
+
case "object":
|
|
273
|
+
console.log("检测到缓存数据完成"), a(o);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
console.log("未检测到缓存开始进行请求"), g.set(e.options, a), u(e.options, (n) => {
|
|
277
|
+
const s = g.get(e.options);
|
|
278
|
+
g.set(e.options, n), s(n);
|
|
279
|
+
});
|
|
280
|
+
}, y = () => {
|
|
281
|
+
u(e.options, (o) => {
|
|
282
|
+
a(o);
|
|
283
|
+
});
|
|
259
284
|
};
|
|
260
285
|
switch (!0) {
|
|
261
286
|
case e.options instanceof Function: {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
l.value = f;
|
|
287
|
+
e.cache !== !1 ? (console.log("缓存开启"), m()) : (console.log("缓存关闭"), y());
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case M(e.options): {
|
|
291
|
+
A(e.options, () => {
|
|
292
|
+
a(e.options.value);
|
|
293
|
+
}, {
|
|
294
|
+
immediate: !0
|
|
271
295
|
});
|
|
272
296
|
break;
|
|
273
297
|
}
|
|
274
298
|
default:
|
|
275
|
-
|
|
299
|
+
t.value = e.options;
|
|
276
300
|
}
|
|
277
|
-
return (
|
|
278
|
-
let
|
|
279
|
-
return e.default && !r && (
|
|
280
|
-
ref: (
|
|
301
|
+
return (o, n) => {
|
|
302
|
+
let s;
|
|
303
|
+
return e.default && !r && (o[n.key] = e.default, r = !0), d(ae, {
|
|
304
|
+
ref: (i) => l = i,
|
|
281
305
|
multiple: e.multiple,
|
|
282
|
-
modelValue:
|
|
283
|
-
"onUpdate:modelValue": (
|
|
306
|
+
modelValue: o[n.key],
|
|
307
|
+
"onUpdate:modelValue": (i) => o[n.key] = i,
|
|
284
308
|
placeholder: e.placeholder,
|
|
285
309
|
allowClear: e.clearable,
|
|
286
310
|
allowSearch: e.searchable,
|
|
287
311
|
maxTagCount: e.maxTagCount ?? 2,
|
|
288
312
|
onChange: c
|
|
289
|
-
},
|
|
290
|
-
key:
|
|
291
|
-
value:
|
|
292
|
-
label:
|
|
293
|
-
}, null))) ?
|
|
294
|
-
default: () => [
|
|
313
|
+
}, Ne(s = Array.from(t.value.entries()).map(([i, f]) => d(ne, {
|
|
314
|
+
key: i,
|
|
315
|
+
value: i,
|
|
316
|
+
label: f
|
|
317
|
+
}, null))) ? s : {
|
|
318
|
+
default: () => [s]
|
|
295
319
|
});
|
|
296
320
|
};
|
|
297
321
|
}
|
|
298
|
-
function
|
|
299
|
-
function
|
|
322
|
+
function Te(e) {
|
|
323
|
+
function l() {
|
|
300
324
|
e != null && e.autoSumbit;
|
|
301
325
|
}
|
|
302
|
-
return (r,
|
|
303
|
-
modelValue: r[
|
|
304
|
-
"onUpdate:modelValue": (
|
|
326
|
+
return (r, t) => (e != null && e.default && (r[t.key] = e.default), d(ue, {
|
|
327
|
+
modelValue: r[t.key],
|
|
328
|
+
"onUpdate:modelValue": (a) => r[t.key] = a,
|
|
305
329
|
checkedText: (e == null ? void 0 : e.openLabel) ?? "是",
|
|
306
330
|
uncheckedText: (e == null ? void 0 : e.closeLabel) ?? "否",
|
|
307
331
|
checkedValue: (e == null ? void 0 : e.openValue) ?? !0,
|
|
308
332
|
uncheckedValue: (e == null ? void 0 : e.closeValue) ?? !1,
|
|
309
|
-
onChange:
|
|
333
|
+
onChange: l
|
|
310
334
|
}, null));
|
|
311
335
|
}
|
|
312
|
-
function
|
|
313
|
-
return (
|
|
314
|
-
let
|
|
315
|
-
function
|
|
316
|
-
|
|
336
|
+
function ze(e) {
|
|
337
|
+
return (l, r) => {
|
|
338
|
+
let t = [];
|
|
339
|
+
function a(m) {
|
|
340
|
+
t = m;
|
|
317
341
|
}
|
|
318
|
-
function c(
|
|
319
|
-
if (
|
|
320
|
-
const [
|
|
321
|
-
|
|
342
|
+
function c(m) {
|
|
343
|
+
if (m && m.length === 2) {
|
|
344
|
+
const [y, o] = m.sort(), n = I(y).startOf("days"), s = I(o).endOf("days");
|
|
345
|
+
l[r.key] = [n.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD"), s.format((e == null ? void 0 : e.valueFormat) || "YYYY-MM-DD")];
|
|
322
346
|
}
|
|
323
347
|
}
|
|
324
|
-
function u(
|
|
325
|
-
return e != null && e.disabledDate ? e.disabledDate(
|
|
348
|
+
function u(m) {
|
|
349
|
+
return e != null && e.disabledDate ? e.disabledDate(t, m) : !1;
|
|
326
350
|
}
|
|
327
|
-
return d("div", null, [d(
|
|
351
|
+
return d("div", null, [d(ce, {
|
|
352
|
+
"disabled-input": !0,
|
|
328
353
|
style: {
|
|
329
354
|
width: "300px"
|
|
330
355
|
},
|
|
331
|
-
modelValue:
|
|
332
|
-
"onUpdate:modelValue": (
|
|
333
|
-
onSelect:
|
|
356
|
+
modelValue: l[r.key],
|
|
357
|
+
"onUpdate:modelValue": (m) => l[r.key] = m,
|
|
358
|
+
onSelect: a,
|
|
334
359
|
onChange: c,
|
|
335
360
|
mode: e == null ? void 0 : e.type,
|
|
336
361
|
allowClear: e == null ? void 0 : e.clearable,
|
|
@@ -340,99 +365,122 @@ function Ne(e) {
|
|
|
340
365
|
}, null)]);
|
|
341
366
|
};
|
|
342
367
|
}
|
|
343
|
-
function
|
|
344
|
-
return (
|
|
345
|
-
modelValue:
|
|
346
|
-
"onUpdate:modelValue": (
|
|
368
|
+
function Me(e) {
|
|
369
|
+
return (l, r) => d(de, {
|
|
370
|
+
modelValue: l[r.key],
|
|
371
|
+
"onUpdate:modelValue": (t) => l[r.key] = t,
|
|
347
372
|
placeholder: e == null ? void 0 : e.placeholder,
|
|
348
373
|
autoSize: e == null ? void 0 : e.autosize,
|
|
349
374
|
maxLength: e == null ? void 0 : e.maxLength
|
|
350
375
|
}, null);
|
|
351
376
|
}
|
|
352
|
-
const
|
|
353
|
-
function
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
377
|
+
const v = /* @__PURE__ */ new WeakMap();
|
|
378
|
+
function Re() {
|
|
379
|
+
const e = k([]);
|
|
380
|
+
return [e, (r) => e.value = r];
|
|
381
|
+
}
|
|
382
|
+
function Ue(e) {
|
|
383
|
+
console.log("开始渲染SelectTree:");
|
|
384
|
+
let l, r = !1;
|
|
385
|
+
const [t, a] = Re(), c = () => {
|
|
386
|
+
if (!e.autoSumbit || !l)
|
|
357
387
|
return;
|
|
358
|
-
let
|
|
359
|
-
for (;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
},
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
388
|
+
let n = l;
|
|
389
|
+
for (; n && n.$el.tagName !== "FORM"; )
|
|
390
|
+
n = n.$parent;
|
|
391
|
+
n && n.$el && n.$el.dispatchEvent(new Event("submit"));
|
|
392
|
+
}, u = (n, s) => {
|
|
393
|
+
const i = n();
|
|
394
|
+
i instanceof Promise ? i.then(s) : s(i);
|
|
395
|
+
}, m = async () => {
|
|
396
|
+
const n = v.get(e.options);
|
|
397
|
+
switch (console.log("当前缓存值:", n), typeof n) {
|
|
398
|
+
case "function":
|
|
399
|
+
console.log("检测到缓存正在请求中"), console.log("更新缓存"), v.set(e.options, a);
|
|
400
|
+
return;
|
|
401
|
+
case "object":
|
|
402
|
+
console.log("检测到缓存数据完成"), a(n);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
console.log("未检测到缓存开始进行请求"), v.set(e.options, a), u(e.options, (s) => {
|
|
406
|
+
const i = v.get(e.options);
|
|
407
|
+
v.set(e.options, s), i(s);
|
|
408
|
+
});
|
|
409
|
+
}, y = () => {
|
|
410
|
+
u(e.options, (n) => {
|
|
411
|
+
a(n);
|
|
412
|
+
});
|
|
369
413
|
};
|
|
370
414
|
switch (!0) {
|
|
371
415
|
case e.options instanceof Function: {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
416
|
+
e.cache !== !1 ? (console.log("缓存开启"), m()) : (console.log("缓存关闭"), y());
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
case M(e.options): {
|
|
420
|
+
A(e.options, () => {
|
|
421
|
+
a(e.options.value);
|
|
422
|
+
}, {
|
|
423
|
+
immediate: !0
|
|
376
424
|
});
|
|
377
425
|
break;
|
|
378
426
|
}
|
|
379
427
|
default:
|
|
380
|
-
|
|
428
|
+
t.value = e.options;
|
|
381
429
|
}
|
|
382
|
-
function
|
|
430
|
+
function o(n, s) {
|
|
383
431
|
var h;
|
|
384
|
-
const i = ((h = e.fieldNames) == null ? void 0 : h.title) || "title",
|
|
385
|
-
return
|
|
432
|
+
const i = ((h = e.fieldNames) == null ? void 0 : h.title) || "title", f = s[i];
|
|
433
|
+
return f ? f.toLowerCase().includes(n.toLowerCase()) : !1;
|
|
386
434
|
}
|
|
387
|
-
return (
|
|
388
|
-
ref: (i) =>
|
|
435
|
+
return (n, s) => (e.default && !r && (n[s.key] = e.default, r = !0), d(se, {
|
|
436
|
+
ref: (i) => l = i,
|
|
389
437
|
multiple: e.multiple,
|
|
390
|
-
modelValue:
|
|
391
|
-
"onUpdate:modelValue": (i) =>
|
|
438
|
+
modelValue: n[s.key],
|
|
439
|
+
"onUpdate:modelValue": (i) => n[s.key] = i,
|
|
392
440
|
placeholder: e.placeholder,
|
|
393
441
|
allowClear: e.clearable,
|
|
394
442
|
allowSearch: e.searchable,
|
|
395
443
|
maxTagCount: e.maxTagCount ?? 2,
|
|
396
|
-
onChange:
|
|
397
|
-
filterTreeNode:
|
|
398
|
-
data:
|
|
444
|
+
onChange: c,
|
|
445
|
+
filterTreeNode: o,
|
|
446
|
+
data: t.value,
|
|
399
447
|
fieldNames: e.fieldNames
|
|
400
448
|
}, null));
|
|
401
449
|
}
|
|
402
|
-
function
|
|
403
|
-
return (
|
|
450
|
+
function qe(e) {
|
|
451
|
+
return (l) => e(l);
|
|
404
452
|
}
|
|
405
|
-
function
|
|
453
|
+
function Be() {
|
|
406
454
|
return {
|
|
407
|
-
input:
|
|
408
|
-
textarea:
|
|
409
|
-
select:
|
|
410
|
-
treeSelect:
|
|
411
|
-
date:
|
|
412
|
-
switch:
|
|
413
|
-
dateRange:
|
|
414
|
-
render:
|
|
455
|
+
input: _e,
|
|
456
|
+
textarea: Me,
|
|
457
|
+
select: Le,
|
|
458
|
+
treeSelect: Ue,
|
|
459
|
+
date: je,
|
|
460
|
+
switch: Te,
|
|
461
|
+
dateRange: ze,
|
|
462
|
+
render: qe
|
|
415
463
|
};
|
|
416
464
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
419
|
-
const r =
|
|
420
|
-
...
|
|
465
|
+
function Ee(e, l) {
|
|
466
|
+
l.render || (l.render = (t) => t.input());
|
|
467
|
+
const r = l.render({
|
|
468
|
+
...Be()
|
|
421
469
|
});
|
|
422
470
|
return {
|
|
423
|
-
default: () => r(e,
|
|
471
|
+
default: () => r(e, l)
|
|
424
472
|
};
|
|
425
473
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
428
|
-
field:
|
|
429
|
-
label:
|
|
430
|
-
},
|
|
474
|
+
function We(e, l) {
|
|
475
|
+
return Q(q, {
|
|
476
|
+
field: l.key,
|
|
477
|
+
label: l.title
|
|
478
|
+
}, Ee(e, l));
|
|
431
479
|
}
|
|
432
|
-
function
|
|
433
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
480
|
+
function j(e) {
|
|
481
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
|
|
434
482
|
}
|
|
435
|
-
const
|
|
483
|
+
const Ae = /* @__PURE__ */ x({
|
|
436
484
|
props: {
|
|
437
485
|
form: {
|
|
438
486
|
type: Object,
|
|
@@ -484,62 +532,62 @@ const Re = /* @__PURE__ */ x({
|
|
|
484
532
|
emits: ["submit", "cancel", "update:model-value"],
|
|
485
533
|
expose: ["formSource", "updateFormField", "updateFormSource", "reset"],
|
|
486
534
|
setup(e) {
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
const
|
|
535
|
+
const l = Math.random().toString(32).slice(2).toUpperCase(), r = k(), [t, a] = De(e.form, e.modelValue || e.value), c = k(e.columns || 0), u = k(!0), m = () => u.value = !u.value;
|
|
536
|
+
O(D.id, l), O(D.source, t);
|
|
537
|
+
const y = b(() => {
|
|
490
538
|
if (!c.value)
|
|
491
539
|
return 1;
|
|
492
|
-
const
|
|
493
|
-
return c.value -
|
|
494
|
-
}),
|
|
495
|
-
function
|
|
496
|
-
var
|
|
540
|
+
const f = e.form.reduce((h, C) => h + ((C == null ? void 0 : C.span) || 1), 0);
|
|
541
|
+
return c.value - f % c.value;
|
|
542
|
+
}), o = b(() => e.form.reduce((f, h) => (h.rule && (f[h.key] = h.rule), f), {}));
|
|
543
|
+
function n() {
|
|
544
|
+
var h;
|
|
497
545
|
if (e.columns)
|
|
498
546
|
return;
|
|
499
|
-
const
|
|
500
|
-
|
|
547
|
+
const f = (h = r.value) == null ? void 0 : h.$el;
|
|
548
|
+
f && (c.value = Math.floor(f.offsetWidth / e.minWidth));
|
|
501
549
|
}
|
|
502
|
-
|
|
503
|
-
|
|
550
|
+
U(() => {
|
|
551
|
+
n();
|
|
504
552
|
});
|
|
505
|
-
function
|
|
506
|
-
|
|
507
|
-
...
|
|
553
|
+
function s(f, h) {
|
|
554
|
+
t.value[f] = h, a({
|
|
555
|
+
...t
|
|
508
556
|
});
|
|
509
557
|
}
|
|
510
|
-
function
|
|
511
|
-
var
|
|
512
|
-
(
|
|
558
|
+
function i() {
|
|
559
|
+
var f;
|
|
560
|
+
(f = r.value) == null || f.resetFields();
|
|
513
561
|
}
|
|
514
|
-
return window.addEventListener("resize",
|
|
515
|
-
formId:
|
|
516
|
-
formSource:
|
|
562
|
+
return window.addEventListener("resize", n), {
|
|
563
|
+
formId: l,
|
|
564
|
+
formSource: t,
|
|
517
565
|
formInstance: r,
|
|
518
566
|
formColumns: c,
|
|
519
|
-
formRules:
|
|
567
|
+
formRules: o,
|
|
520
568
|
formCollspased: u,
|
|
521
|
-
formActiosSpan:
|
|
522
|
-
toggleFormCollapsed:
|
|
523
|
-
updateFormField:
|
|
524
|
-
updateFormSource:
|
|
525
|
-
reset:
|
|
569
|
+
formActiosSpan: y,
|
|
570
|
+
toggleFormCollapsed: m,
|
|
571
|
+
updateFormField: s,
|
|
572
|
+
updateFormSource: a,
|
|
573
|
+
reset: i
|
|
526
574
|
};
|
|
527
575
|
},
|
|
528
576
|
render() {
|
|
529
577
|
const e = () => {
|
|
530
578
|
this.$emit("submit", this.formSource), this.$emit("update:model-value", this.formSource);
|
|
531
|
-
},
|
|
532
|
-
const
|
|
579
|
+
}, l = () => {
|
|
580
|
+
const t = [], a = this.footer ? {
|
|
533
581
|
span: this.formColumns
|
|
534
582
|
} : {
|
|
535
583
|
span: this.formActiosSpan
|
|
536
584
|
};
|
|
537
|
-
if (this.searchable && (
|
|
585
|
+
if (this.searchable && (t.push(d(S, {
|
|
538
586
|
type: "primary",
|
|
539
587
|
htmlType: "submit"
|
|
540
588
|
}, {
|
|
541
589
|
default: () => [$("搜索")]
|
|
542
|
-
})),
|
|
590
|
+
})), t.push(d(S, {
|
|
543
591
|
type: "secondary",
|
|
544
592
|
onClick: () => {
|
|
545
593
|
var c;
|
|
@@ -547,45 +595,45 @@ const Re = /* @__PURE__ */ x({
|
|
|
547
595
|
}
|
|
548
596
|
}, {
|
|
549
597
|
default: () => [$("重置")]
|
|
550
|
-
}))), this.submitable && (
|
|
598
|
+
}))), this.submitable && (t.push(d(S, {
|
|
551
599
|
type: "primary",
|
|
552
600
|
htmlType: "submit"
|
|
553
601
|
}, {
|
|
554
602
|
default: () => [$("提交")]
|
|
555
|
-
})),
|
|
603
|
+
})), t.push(d(S, {
|
|
556
604
|
type: "secondary",
|
|
557
605
|
onClick: () => this.$emit("cancel")
|
|
558
606
|
}, {
|
|
559
607
|
default: () => [$("取消")]
|
|
560
|
-
}))), this.form.some((c) => !!c.collapsed) &&
|
|
608
|
+
}))), this.form.some((c) => !!c.collapsed) && t.push(d(S, {
|
|
561
609
|
onClick: this.toggleFormCollapsed
|
|
562
610
|
}, {
|
|
563
611
|
default: () => this.formCollspased ? "展开" : "收起",
|
|
564
|
-
icon: () => this.formCollspased ? d(
|
|
565
|
-
})), this.$slots.actions &&
|
|
566
|
-
return d(V,
|
|
567
|
-
default: () => [d(
|
|
612
|
+
icon: () => this.formCollspased ? d(Ce, null, null) : d(Ie, null, null)
|
|
613
|
+
})), this.$slots.actions && t.push(...this.$slots.actions()), t.length)
|
|
614
|
+
return d(V, a, {
|
|
615
|
+
default: () => [d(q, {
|
|
568
616
|
hideLabel: !0,
|
|
569
617
|
contentClass: this.footer ? "form-footer" : ""
|
|
570
618
|
}, {
|
|
571
|
-
default: () => [d(
|
|
572
|
-
default: () => [
|
|
619
|
+
default: () => [d(fe, null, j(t) ? t : {
|
|
620
|
+
default: () => [t]
|
|
573
621
|
})]
|
|
574
622
|
})]
|
|
575
623
|
});
|
|
576
|
-
}, r = this.form.filter((
|
|
624
|
+
}, r = this.form.filter((t) => this.formCollspased ? !t.collapsed : !0).filter((t) => {
|
|
577
625
|
switch (!0) {
|
|
578
|
-
case typeof
|
|
579
|
-
return
|
|
580
|
-
case typeof
|
|
581
|
-
return
|
|
626
|
+
case typeof t.visiable == "boolean":
|
|
627
|
+
return t.visiable;
|
|
628
|
+
case typeof t.visiable == "function":
|
|
629
|
+
return t.visiable(this.formSource);
|
|
582
630
|
default:
|
|
583
631
|
return !0;
|
|
584
632
|
}
|
|
585
633
|
});
|
|
586
634
|
return d("div", {
|
|
587
635
|
class: "form-render"
|
|
588
|
-
}, [d(
|
|
636
|
+
}, [d(oe, X({
|
|
589
637
|
layout: this.$props.layout,
|
|
590
638
|
rules: this.formRules,
|
|
591
639
|
onSubmitSuccess: e
|
|
@@ -593,47 +641,47 @@ const Re = /* @__PURE__ */ x({
|
|
|
593
641
|
name: this.name
|
|
594
642
|
}, {
|
|
595
643
|
"auto-label-width": !0,
|
|
596
|
-
ref: (
|
|
644
|
+
ref: (t) => this.formInstance = t,
|
|
597
645
|
model: this.formSource
|
|
598
646
|
}), {
|
|
599
|
-
default: () => [d(
|
|
647
|
+
default: () => [d(ie, {
|
|
600
648
|
cols: this.formColumns,
|
|
601
649
|
"col-gap": 10,
|
|
602
650
|
"rol-gap": 10
|
|
603
651
|
}, {
|
|
604
|
-
default: () => [r.filter(() => this.formColumns !== 0).map((
|
|
605
|
-
let
|
|
652
|
+
default: () => [r.filter(() => this.formColumns !== 0).map((t) => {
|
|
653
|
+
let a;
|
|
606
654
|
return d(V, {
|
|
607
|
-
span:
|
|
608
|
-
},
|
|
609
|
-
default: () => [
|
|
655
|
+
span: t.span
|
|
656
|
+
}, j(a = We(this.formSource, t)) ? a : {
|
|
657
|
+
default: () => [a]
|
|
610
658
|
});
|
|
611
|
-
}),
|
|
659
|
+
}), l()]
|
|
612
660
|
})]
|
|
613
661
|
})]);
|
|
614
662
|
}
|
|
615
663
|
});
|
|
616
|
-
function
|
|
664
|
+
function Qe(e) {
|
|
617
665
|
return e;
|
|
618
666
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
function
|
|
667
|
+
function Xe(e) {
|
|
668
|
+
const l = _(), r = k();
|
|
669
|
+
function t() {
|
|
622
670
|
var c, u;
|
|
623
|
-
const
|
|
624
|
-
|
|
671
|
+
const a = (u = (c = l == null ? void 0 : l.proxy) == null ? void 0 : c.$refs) == null ? void 0 : u[e];
|
|
672
|
+
a && (r.value = a);
|
|
625
673
|
}
|
|
626
|
-
return
|
|
674
|
+
return U(t), H(t), r;
|
|
627
675
|
}
|
|
628
|
-
const
|
|
629
|
-
install(e,
|
|
630
|
-
e.component("FormRender",
|
|
676
|
+
const He = {
|
|
677
|
+
install(e, l) {
|
|
678
|
+
e.component("FormRender", Ae);
|
|
631
679
|
}
|
|
632
680
|
};
|
|
633
681
|
export {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
682
|
+
Ae as FormRender,
|
|
683
|
+
pe as FormRenderResolver,
|
|
684
|
+
He as default,
|
|
685
|
+
Qe as defineForm,
|
|
686
|
+
Xe as useForm
|
|
639
687
|
};
|