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