@vunk/form 2.19.2 → 2.19.4
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/components/api-tables-select/src/ctx.d.ts +5 -2
- package/components/api-tables-select/src/index.vue.d.ts +11 -5
- package/components/button/src/ctx.d.ts +5 -2
- package/components/button/src/index.vue.d.ts +22 -10
- package/components/card-input-collection/src/core.vue.d.ts +11 -5
- package/components/card-input-collection/src/ctx.d.ts +5 -2
- package/components/card-input-collection/src/index.vue.d.ts +11 -5
- package/components/cascader/src/ctx.d.ts +6 -3
- package/components/cascader/src/index.vue.d.ts +11 -5
- package/components/checkbox/src/ctx.d.ts +6 -3
- package/components/checkbox/src/index.vue.d.ts +22 -10
- package/components/color-picker/src/ctx.d.ts +5 -2
- package/components/color-picker/src/index.vue.d.ts +11 -5
- package/components/date-picker/src/ctx.d.ts +6 -3
- package/components/date-picker/src/index.vue.d.ts +11 -5
- package/components/date-picker-range/src/ctx.d.ts +5 -2
- package/components/date-picker-range/src/index.vue.d.ts +22 -10
- package/components/dialog-input-collection/src/ctx.d.ts +5 -2
- package/components/dialog-input-collection/src/index.vue.d.ts +11 -5
- package/components/download-plus/src/ctx.d.ts +5 -2
- package/components/download-plus/src/index.vue.d.ts +22 -10
- package/components/editable-text/src/ctx.d.ts +5 -2
- package/components/editable-text/src/index.vue.d.ts +11 -5
- package/components/esri-input-geojson/src/ctx.d.ts +6 -3
- package/components/esri-input-geojson/src/index.vue.d.ts +35 -17
- package/components/fieldset/index.cjs +1 -1
- package/components/fieldset/index.mjs +9 -8
- package/components/fieldset/src/ctx.d.ts +1 -1
- package/components/fieldset/src/index.vue.d.ts +3 -3
- package/components/form/index.cjs +1 -1
- package/components/form/index.mjs +73 -67
- package/components/form/src/ctx.d.ts +5 -2
- package/components/form/src/index.vue.d.ts +13 -7
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +70 -61
- package/components/form-item/src/ctx.d.ts +6 -3
- package/components/form-item/src/index.vue.d.ts +11 -5
- package/components/information-collection/src/ctx.d.ts +5 -2
- package/components/information-collection/src/index.vue.d.ts +11 -5
- package/components/input/src/ctx.d.ts +6 -3
- package/components/input/src/index.vue.d.ts +22 -10
- package/components/input-array/src/ctx.d.ts +5 -2
- package/components/input-array/src/index.vue.d.ts +11 -5
- package/components/input-collection/src/core.vue.d.ts +11 -5
- package/components/input-collection/src/ctx.d.ts +5 -2
- package/components/input-collection/src/index.vue.d.ts +11 -5
- package/components/input-file/src/index.vue.d.ts +11 -5
- package/components/input-link/src/ctx.d.ts +5 -2
- package/components/input-link/src/index.vue.d.ts +33 -15
- package/components/input-number/src/ctx.d.ts +6 -3
- package/components/input-number/src/index.vue.d.ts +22 -10
- package/components/input-tag/src/ctx.d.ts +6 -3
- package/components/input-tag/src/index.vue.d.ts +22 -10
- package/components/monaco-editor/src/ctx.d.ts +5 -2
- package/components/monaco-editor/src/index.vue.d.ts +22 -10
- package/components/radio/src/ctx.d.ts +5 -2
- package/components/radio/src/index.vue.d.ts +22 -10
- package/components/radio/src/wraper.vue.d.ts +11 -5
- package/components/select/src/core.vue.d.ts +22 -10
- package/components/select/src/ctx.d.ts +6 -3
- package/components/select/src/index.vue.d.ts +11 -5
- package/components/slider/src/ctx.d.ts +5 -2
- package/components/slider/src/index.vue.d.ts +11 -5
- package/components/style.css +1 -1
- package/components/switch/src/ctx.d.ts +5 -2
- package/components/switch/src/index.vue.d.ts +11 -5
- package/components/tables-select/src/ctx.d.ts +6 -3
- package/components/tables-select/src/index.vue.d.ts +12 -6
- package/components/templates-default/src/index.vue.d.ts +219 -102
- package/components/templates-esri/src/index.vue.d.ts +35 -17
- package/components/templates-layout/src/index.vue.d.ts +3 -3
- package/components/templates-variant/src/index.vue.d.ts +22 -10
- package/components/time-picker/src/ctx.d.ts +6 -3
- package/components/time-picker/src/index.vue.d.ts +11 -5
- package/components/upload/src/ctx.d.ts +6 -3
- package/components/upload/src/index.vue.d.ts +22 -10
- package/components/upload/src/wraper.vue.d.ts +11 -5
- package/components/upload-plus/src/ctx.d.ts +5 -2
- package/components/upload-plus/src/index.vue.d.ts +11 -5
- package/components/van-cascader/src/ctx.d.ts +5 -2
- package/components/van-cascader/src/index.vue.d.ts +11 -5
- package/components/var-datetime-picker/src/ctx.d.ts +5 -2
- package/components/var-datetime-picker/src/index.vue.d.ts +22 -10
- package/components/vditor/src/ctx.d.ts +5 -2
- package/components/vditor/src/index.vue.d.ts +22 -10
- package/composables/index.cjs +1 -1
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +72 -60
- package/composables/useComputedLabelPosition.d.ts +15 -0
- package/index.css +1 -1
- package/package.json +1 -1
- package/shared/element-plus/ctx.d.ts +2 -2
|
@@ -6,7 +6,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
6
6
|
default: undefined;
|
|
7
7
|
};
|
|
8
8
|
labelPosition: {
|
|
9
|
-
type: import("vue").PropType<"left" | "right" | "top">;
|
|
9
|
+
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
10
10
|
default: undefined;
|
|
11
11
|
};
|
|
12
12
|
labelSuffix: {
|
|
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
19
19
|
default: undefined;
|
|
20
20
|
};
|
|
21
21
|
labelPosition: {
|
|
22
|
-
type: import("vue").PropType<"left" | "right" | "top">;
|
|
22
|
+
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
23
23
|
default: undefined;
|
|
24
24
|
};
|
|
25
25
|
labelSuffix: {
|
|
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
default: undefined;
|
|
28
28
|
};
|
|
29
29
|
}>> & Readonly<{}>, {
|
|
30
|
+
labelPosition: "left" | "right" | "top" | "start" | "end";
|
|
30
31
|
labelWidth: string | number;
|
|
31
|
-
labelPosition: "left" | "right" | "top";
|
|
32
32
|
labelSuffix: string;
|
|
33
33
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("element-plus"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("element-plus"),R=require("@vunk/core/shared/utils-vue"),v=require("@vunk/core/shared/utils-function"),t=require("vue"),E=require("@vunk/form/components/form-item-renderer"),F=require("@vunk/form/shared/element-plus"),P=require("@vunk/core/shared/helper"),w=require("@vunk/form/components/templates-default"),C=require("@vunk/form/components/templates-layout"),q=require("@vunk/core/shared/utils-object"),I=require("@vunk/form/shared/form"),O=require("@vunk/form/components/renderer-data"),T=require("@vunk/shared/object"),h=require("@vunk/form/components/forms-provider"),D=require("../_plugin-vue_export-helper-BHFhmbuH.js"),i={...p.formProps,labelPosition:{type:String,default:"end"},data:{type:Object,default:()=>({})},formItems:{type:Array,default:()=>[]},readonly:{type:Boolean},elRef:{type:Function,default:()=>v.NOOP},layout:{type:Boolean,default:!1},rowSource:{type:Object,default:()=>({})},colSource:{type:Object,default:()=>({})},segmentAttrs:{type:Object,default:()=>({})}},j=R.bindPropsFactory(i),d={...p.formEmits,setData:e=>e,validate:null,submit:null},L=R.onEmitsFactory(d),$=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:j,createOnEmits:L,emits:d,props:i},Symbol.toStringTag,{value:"Module"})),B=e=>24-e.templateSlots.reduce((r,n)=>{if(!n.span)throw new Error("ElColSource span is required");return r+n.span},0),N=(e,r={})=>{const n=e.span??r.span;if(n==null)throw new Error("genColItem ElColSource span is required");return{...r,templateType:"ElCol",span:n,templateSlots:[q.pickObject(e,{excludes:["span"]})]}},M=(e,r={})=>({...r,templateType:"ElRow",templateSlots:e?[e]:[]}),A=t.defineComponent({name:"VkfForm",components:{VkfRendererData:O.VkfRendererData,ElForm:p.ElForm,VkfFormItemRenderer:E.VkfFormItemRenderer,VkfTemplatesDefault:w.VkfTemplatesDefault,VkfTemplatesLayout:C.VkfTemplatesLayout,VkfFormsSegment:h.VkfFormsSegment},props:i,emits:d,setup(e,{emit:r}){const n=F.createFormBindProps(e,["model","labelPosition"]),y=t.computed(()=>e.labelPosition),V=F.createFormOnEmits(r),s=t.shallowRef(),m=t.getCurrentInstance();t.provide("vkfFormVm",m),t.provide("elFormRef",s);const u=o=>{s.value=o,e.elRef(o)},c=t.computed(()=>e.layout?e.formItems.reduce((o,l)=>{var k;const a=o.findLast(g=>g.templateType==="ElRow"),S=l.span??e.colSource.span;if(!S)return o.push(l),o;if(!((k=l.templateLayout)!=null&&k.allowEmpty)&&Reflect.has(l,"templateIf")&&!I.genTemplateIfFunc(l.templateIf)(e.data))return o;const b=N(l,T.pickObject({...e.colSource,...l.templateLayout},{excludes:["allowEmpty"]}));return!a||B(a)<S?o.push(M(b,e.rowSource)):a.templateSlots.push(b),o},[]):e.formItems),f=o=>{o.preventDefault(),r("submit",o)};return{formProps:n,formEmits:V,getValue:P.getValue,getRef:u,computed:t.computed,rendererSource:c,handleSubmit:f,labelPosition:y}}});function z(e,r,n,y,V,s){const m=t.resolveComponent("VkfFormsSegment"),u=t.resolveComponent("VkfTemplatesDefault"),c=t.resolveComponent("VkfTemplatesLayout"),f=t.resolveComponent("VkfFormItemRenderer"),o=t.resolveComponent("VkfRendererData"),l=t.resolveComponent("ElForm");return t.openBlock(),t.createBlock(l,t.mergeProps(e.formProps,{ref:e.getRef,class:{"is-readonly":e.readonly},model:e.model||e.data,"label-position":e.labelPosition},t.toHandlers(e.formEmits),{onSubmit:e.handleSubmit}),{default:t.withCtx(()=>[t.createVNode(o,{data:e.data,onSetData:r[0]||(r[0]=a=>e.$emit("setData",a))},{default:t.withCtx(()=>[t.createVNode(m,t.mergeProps({data:e.data},e.segmentAttrs),null,16,["data"]),t.createVNode(f,{source:e.rendererSource},{placeholder:t.withCtx(()=>[t.createVNode(u),t.createVNode(c)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"rendererTemplate")]),_:3},8,["source"]),t.renderSlot(e.$slots,"default")]),_:3},8,["data"])]),_:3},16,["class","model","label-position","onSubmit"])}const _=D._export_sfc(A,[["render",z]]),H=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfForm=_;exports._VkfFormCtx=$;exports.__VkfForm=H;exports.default=_;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { formProps as
|
|
1
|
+
import { formProps as O, formEmits as P, ElForm as I } from "element-plus";
|
|
2
2
|
import { bindPropsFactory as T, onEmitsFactory as h } from "@vunk/core/shared/utils-vue";
|
|
3
3
|
import { NOOP as j } from "@vunk/core/shared/utils-function";
|
|
4
|
-
import { defineComponent as v, shallowRef as C, getCurrentInstance as D, provide as
|
|
5
|
-
import { VkfFormItemRenderer as
|
|
6
|
-
import { createFormBindProps as
|
|
7
|
-
import { getValue as
|
|
8
|
-
import { VkfTemplatesDefault as
|
|
9
|
-
import { VkfTemplatesLayout as
|
|
10
|
-
import { pickObject as
|
|
11
|
-
import { genTemplateIfFunc as
|
|
12
|
-
import { VkfRendererData as
|
|
13
|
-
import { pickObject as
|
|
14
|
-
import { VkfFormsSegment as
|
|
15
|
-
import { _ as
|
|
4
|
+
import { defineComponent as v, computed as c, shallowRef as C, getCurrentInstance as D, provide as R, resolveComponent as a, openBlock as $, createBlock as B, mergeProps as _, toHandlers as L, withCtx as s, createVNode as m, renderSlot as w } from "vue";
|
|
5
|
+
import { VkfFormItemRenderer as A } from "@vunk/form/components/form-item-renderer";
|
|
6
|
+
import { createFormBindProps as q, createFormOnEmits as z } from "@vunk/form/shared/element-plus";
|
|
7
|
+
import { getValue as M } from "@vunk/core/shared/helper";
|
|
8
|
+
import { VkfTemplatesDefault as N } from "@vunk/form/components/templates-default";
|
|
9
|
+
import { VkfTemplatesLayout as H } from "@vunk/form/components/templates-layout";
|
|
10
|
+
import { pickObject as G } from "@vunk/core/shared/utils-object";
|
|
11
|
+
import { genTemplateIfFunc as J } from "@vunk/form/shared/form";
|
|
12
|
+
import { VkfRendererData as K } from "@vunk/form/components/renderer-data";
|
|
13
|
+
import { pickObject as Q } from "@vunk/shared/object";
|
|
14
|
+
import { VkfFormsSegment as U } from "@vunk/form/components/forms-provider";
|
|
15
|
+
import { _ as W } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
16
16
|
const d = {
|
|
17
|
-
...
|
|
17
|
+
...O,
|
|
18
|
+
labelPosition: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "end"
|
|
21
|
+
},
|
|
18
22
|
data: {
|
|
19
23
|
type: Object,
|
|
20
24
|
default: () => ({})
|
|
@@ -62,22 +66,22 @@ const d = {
|
|
|
62
66
|
type: Object,
|
|
63
67
|
default: () => ({})
|
|
64
68
|
}
|
|
65
|
-
},
|
|
66
|
-
...
|
|
69
|
+
}, X = T(d), y = {
|
|
70
|
+
...P,
|
|
67
71
|
setData: (e) => e,
|
|
68
72
|
validate: null,
|
|
69
73
|
submit: null
|
|
70
|
-
},
|
|
74
|
+
}, Y = h(y), Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
71
75
|
__proto__: null,
|
|
72
|
-
createBindProps:
|
|
73
|
-
createOnEmits:
|
|
74
|
-
emits:
|
|
76
|
+
createBindProps: X,
|
|
77
|
+
createOnEmits: Y,
|
|
78
|
+
emits: y,
|
|
75
79
|
props: d
|
|
76
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
80
|
+
}, Symbol.toStringTag, { value: "Module" })), Z = (e) => 24 - e.templateSlots.reduce((o, r) => {
|
|
77
81
|
if (!r.span)
|
|
78
82
|
throw new Error("ElColSource span is required");
|
|
79
83
|
return o + r.span;
|
|
80
|
-
}, 0),
|
|
84
|
+
}, 0), x = (e, o = {}) => {
|
|
81
85
|
const r = e.span ?? o.span;
|
|
82
86
|
if (r == null)
|
|
83
87
|
throw new Error("genColItem ElColSource span is required");
|
|
@@ -86,102 +90,104 @@ const d = {
|
|
|
86
90
|
templateType: "ElCol",
|
|
87
91
|
span: r,
|
|
88
92
|
templateSlots: [
|
|
89
|
-
|
|
93
|
+
G(e, {
|
|
90
94
|
excludes: ["span"]
|
|
91
95
|
})
|
|
92
96
|
]
|
|
93
97
|
};
|
|
94
|
-
},
|
|
98
|
+
}, ee = (e, o = {}) => ({
|
|
95
99
|
...o,
|
|
96
100
|
templateType: "ElRow",
|
|
97
101
|
templateSlots: e ? [
|
|
98
102
|
e
|
|
99
103
|
] : []
|
|
100
|
-
}),
|
|
104
|
+
}), te = v({
|
|
101
105
|
name: "VkfForm",
|
|
102
106
|
components: {
|
|
103
|
-
VkfRendererData:
|
|
107
|
+
VkfRendererData: K,
|
|
104
108
|
ElForm: I,
|
|
105
|
-
VkfFormItemRenderer:
|
|
106
|
-
VkfTemplatesDefault:
|
|
107
|
-
VkfTemplatesLayout:
|
|
108
|
-
VkfFormsSegment:
|
|
109
|
+
VkfFormItemRenderer: A,
|
|
110
|
+
VkfTemplatesDefault: N,
|
|
111
|
+
VkfTemplatesLayout: H,
|
|
112
|
+
VkfFormsSegment: U
|
|
109
113
|
},
|
|
110
114
|
props: d,
|
|
111
|
-
emits:
|
|
115
|
+
emits: y,
|
|
112
116
|
setup(e, { emit: o }) {
|
|
113
|
-
const r =
|
|
114
|
-
|
|
117
|
+
const r = q(e, ["model", "labelPosition"]), S = c(() => e.labelPosition), b = z(o), f = C(), p = D();
|
|
118
|
+
R("vkfFormVm", p), R("elFormRef", f);
|
|
115
119
|
const u = (t) => {
|
|
116
|
-
|
|
117
|
-
},
|
|
120
|
+
f.value = t, e.elRef(t);
|
|
121
|
+
}, i = c(() => e.layout ? e.formItems.reduce((t, n) => {
|
|
118
122
|
var V;
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
123
|
+
const l = t.findLast((E) => E.templateType === "ElRow"), F = n.span ?? e.colSource.span;
|
|
124
|
+
if (!F)
|
|
121
125
|
return t.push(n), t;
|
|
122
|
-
if (!((V = n.templateLayout) != null && V.allowEmpty) && Reflect.has(n, "templateIf") && !
|
|
126
|
+
if (!((V = n.templateLayout) != null && V.allowEmpty) && Reflect.has(n, "templateIf") && !J(n.templateIf)(e.data))
|
|
123
127
|
return t;
|
|
124
|
-
const
|
|
128
|
+
const g = x(n, Q({
|
|
125
129
|
...e.colSource,
|
|
126
130
|
...n.templateLayout
|
|
127
131
|
}, {
|
|
128
132
|
excludes: ["allowEmpty"]
|
|
129
133
|
}));
|
|
130
|
-
return !
|
|
134
|
+
return !l || Z(l) < F ? t.push(ee(g, e.rowSource)) : l.templateSlots.push(g), t;
|
|
131
135
|
}, []) : e.formItems);
|
|
132
136
|
return {
|
|
133
137
|
formProps: r,
|
|
134
|
-
formEmits:
|
|
135
|
-
getValue:
|
|
138
|
+
formEmits: b,
|
|
139
|
+
getValue: M,
|
|
136
140
|
getRef: u,
|
|
137
|
-
computed:
|
|
138
|
-
rendererSource:
|
|
141
|
+
computed: c,
|
|
142
|
+
rendererSource: i,
|
|
139
143
|
handleSubmit: (t) => {
|
|
140
144
|
t.preventDefault(), o("submit", t);
|
|
141
|
-
}
|
|
145
|
+
},
|
|
146
|
+
labelPosition: S
|
|
142
147
|
};
|
|
143
148
|
}
|
|
144
149
|
});
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
return
|
|
150
|
+
function oe(e, o, r, S, b, f) {
|
|
151
|
+
const p = a("VkfFormsSegment"), u = a("VkfTemplatesDefault"), i = a("VkfTemplatesLayout"), k = a("VkfFormItemRenderer"), t = a("VkfRendererData"), n = a("ElForm");
|
|
152
|
+
return $(), B(n, _(e.formProps, {
|
|
148
153
|
ref: e.getRef,
|
|
149
154
|
class: {
|
|
150
155
|
"is-readonly": e.readonly
|
|
151
156
|
},
|
|
152
|
-
model: e.model || e.data
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
model: e.model || e.data,
|
|
158
|
+
"label-position": e.labelPosition
|
|
159
|
+
}, L(e.formEmits), { onSubmit: e.handleSubmit }), {
|
|
160
|
+
default: s(() => [
|
|
161
|
+
m(t, {
|
|
156
162
|
data: e.data,
|
|
157
|
-
onSetData: o[0] || (o[0] = (
|
|
163
|
+
onSetData: o[0] || (o[0] = (l) => e.$emit("setData", l))
|
|
158
164
|
}, {
|
|
159
|
-
default:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
placeholder:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
default: s(() => [
|
|
166
|
+
m(p, _({ data: e.data }, e.segmentAttrs), null, 16, ["data"]),
|
|
167
|
+
m(k, { source: e.rendererSource }, {
|
|
168
|
+
placeholder: s(() => [
|
|
169
|
+
m(u),
|
|
170
|
+
m(i)
|
|
165
171
|
]),
|
|
166
|
-
default:
|
|
167
|
-
|
|
172
|
+
default: s(() => [
|
|
173
|
+
w(e.$slots, "rendererTemplate")
|
|
168
174
|
]),
|
|
169
175
|
_: 3
|
|
170
176
|
}, 8, ["source"]),
|
|
171
|
-
|
|
177
|
+
w(e.$slots, "default")
|
|
172
178
|
]),
|
|
173
179
|
_: 3
|
|
174
180
|
}, 8, ["data"])
|
|
175
181
|
]),
|
|
176
182
|
_: 3
|
|
177
|
-
}, 16, ["class", "model", "onSubmit"]);
|
|
183
|
+
}, 16, ["class", "model", "label-position", "onSubmit"]);
|
|
178
184
|
}
|
|
179
|
-
const
|
|
185
|
+
const ge = /* @__PURE__ */ W(te, [["render", oe]]), Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
180
186
|
__proto__: null
|
|
181
187
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
182
188
|
export {
|
|
183
|
-
|
|
189
|
+
ge as VkfForm,
|
|
184
190
|
Fe as _VkfFormCtx,
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
Ve as __VkfForm,
|
|
192
|
+
ge as default
|
|
187
193
|
};
|
|
@@ -3,6 +3,10 @@ import type { SetDataEvent } from '@vunk/core';
|
|
|
3
3
|
import { ColItem, RowItem } from './types';
|
|
4
4
|
import { AnyFunc } from '@vunk/shared';
|
|
5
5
|
export declare const props: {
|
|
6
|
+
labelPosition: {
|
|
7
|
+
type: PropType<"left" | "right" | "top" | "start" | "end">;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
6
10
|
data: {
|
|
7
11
|
type: PropType<Record<string, any>>;
|
|
8
12
|
default: () => {};
|
|
@@ -57,7 +61,6 @@ export declare const props: {
|
|
|
57
61
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
58
62
|
__epPropKey: true;
|
|
59
63
|
};
|
|
60
|
-
labelPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right" | "top", unknown, "right", boolean>;
|
|
61
64
|
requireAsteriskPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right", unknown, "left", boolean>;
|
|
62
65
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
63
66
|
labelSuffix: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
@@ -77,7 +80,7 @@ export declare const props: {
|
|
|
77
80
|
};
|
|
78
81
|
disabled: BooleanConstructor;
|
|
79
82
|
};
|
|
80
|
-
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"size", keyof T2> | Extract<"
|
|
83
|
+
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>)[]>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"data", keyof T2>, KE> | Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"requireAsteriskPosition", keyof T2>, KE> | Exclude<Extract<"labelSuffix", keyof T2>, KE> | Exclude<Extract<"statusIcon", keyof T2>, KE> | Exclude<Extract<"validateOnRuleChange", keyof T2>, KE> | Exclude<Extract<"hideRequiredAsterisk", keyof T2>, KE> | Exclude<Extract<"scrollToError", keyof T2>, KE> | Exclude<Extract<"scrollIntoViewOptions", keyof T2>, KE> | Exclude<Extract<"layout", keyof T2>, KE> | Exclude<Extract<"formItems", keyof T2>, KE> | Exclude<Extract<"rowSource", keyof T2>, KE> | Exclude<Extract<"colSource", keyof T2>, KE> | Exclude<Extract<"segmentAttrs", keyof T2>, KE> : Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: { [k in Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: T2[k]; }[P]; }>;
|
|
81
84
|
export declare const emits: {
|
|
82
85
|
setData: (e: SetDataEvent) => SetDataEvent;
|
|
83
86
|
validate: null;
|
|
@@ -2,6 +2,10 @@ import { RowItem } from './types';
|
|
|
2
2
|
declare const _default: typeof __VLS_export;
|
|
3
3
|
export default _default;
|
|
4
4
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
labelPosition: {
|
|
6
|
+
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
5
9
|
data: {
|
|
6
10
|
type: import("vue").PropType<Record<string, any>>;
|
|
7
11
|
default: () => {};
|
|
@@ -40,7 +44,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
40
44
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
41
45
|
__epPropKey: true;
|
|
42
46
|
};
|
|
43
|
-
labelPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right" | "top", unknown, "right", boolean>;
|
|
44
47
|
requireAsteriskPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right", unknown, "left", boolean>;
|
|
45
48
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
46
49
|
labelSuffix: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
@@ -64,7 +67,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
64
67
|
size: import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown> | undefined;
|
|
65
68
|
inline: boolean;
|
|
66
69
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
67
|
-
labelPosition: import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "left" | "right" | "top", unknown>;
|
|
68
70
|
rules: Partial<Record<string, Record<string, any> | import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>>> | undefined;
|
|
69
71
|
inlineMessage: boolean;
|
|
70
72
|
showMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
@@ -83,11 +85,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
83
85
|
computed: typeof import("@vue/reactivity").computed;
|
|
84
86
|
rendererSource: import("vue").ComputedRef<any>;
|
|
85
87
|
handleSubmit: (e: Event) => void;
|
|
88
|
+
labelPosition: import("vue").ComputedRef<never>;
|
|
86
89
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
87
90
|
setData: (e: import("@vunk/core").SetDataEvent) => import("@vunk/core").SetDataEvent;
|
|
88
91
|
validate: null;
|
|
89
92
|
submit: null;
|
|
90
93
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
94
|
+
labelPosition: {
|
|
95
|
+
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
91
98
|
data: {
|
|
92
99
|
type: import("vue").PropType<Record<string, any>>;
|
|
93
100
|
default: () => {};
|
|
@@ -126,7 +133,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
126
133
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
127
134
|
__epPropKey: true;
|
|
128
135
|
};
|
|
129
|
-
labelPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right" | "top", unknown, "right", boolean>;
|
|
130
136
|
requireAsteriskPosition: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, "left" | "right", unknown, "left", boolean>;
|
|
131
137
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
132
138
|
labelSuffix: import("element-plus/es/utils/index.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
@@ -150,11 +156,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
150
156
|
onValidate?: ((...args: any[]) => any) | undefined;
|
|
151
157
|
onSetData?: ((e: import("@vunk/core").SetDataEvent) => any) | undefined;
|
|
152
158
|
}>, {
|
|
159
|
+
labelPosition: "left" | "right" | "top" | "start" | "end";
|
|
153
160
|
elRef: import("@vunk/shared").AnyFunc;
|
|
154
161
|
inline: boolean;
|
|
155
162
|
readonly: boolean;
|
|
156
163
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
157
|
-
labelPosition: import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "left" | "right" | "top", unknown>;
|
|
158
164
|
inlineMessage: boolean;
|
|
159
165
|
showMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
160
166
|
disabled: boolean;
|
|
@@ -444,7 +450,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
444
450
|
}, {}, {
|
|
445
451
|
ElRow: import("element-plus/es/utils/index.mjs").SFCWithInstall<{
|
|
446
452
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("element-plus").RowProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
447
|
-
justify: "
|
|
453
|
+
justify: "start" | "end" | "center" | "space-around" | "space-between" | "space-evenly";
|
|
448
454
|
tag: string;
|
|
449
455
|
gutter: number;
|
|
450
456
|
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
@@ -455,7 +461,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
455
461
|
M: {};
|
|
456
462
|
Defaults: {};
|
|
457
463
|
}, Readonly<import("element-plus").RowProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
458
|
-
justify: "
|
|
464
|
+
justify: "start" | "end" | "center" | "space-around" | "space-between" | "space-evenly";
|
|
459
465
|
tag: string;
|
|
460
466
|
gutter: number;
|
|
461
467
|
}>;
|
|
@@ -463,7 +469,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
463
469
|
__isTeleport?: never;
|
|
464
470
|
__isSuspense?: never;
|
|
465
471
|
} & import("vue").ComponentOptionsBase<Readonly<import("element-plus").RowProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
466
|
-
justify: "
|
|
472
|
+
justify: "start" | "end" | "center" | "space-around" | "space-between" | "space-evenly";
|
|
467
473
|
tag: string;
|
|
468
474
|
gutter: number;
|
|
469
475
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("element-plus"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("element-plus"),h=require("@vunk/core/shared/utils-vue"),e=require("vue"),q=require("@vunk/form/shared/element-plus"),f=require("@vunk/form/composables"),B=require("@vunk/form/composables/element-plus"),v=require("@vunk/core/shared/utils-object"),V=require("@vunk/form/shared/rules"),_=require("../index-DSyxYMB0.js"),I={...a.formItemProps,labelPosition:{type:String,default:void 0},formItemSize:{type:String,default:void 0},formItemSlots:{type:Object,default:void 0},elRef:{type:Function,required:!1},inline:{type:Boolean,default:!1},readonly:{type:Boolean,default:void 0},formItemTip:{type:String,default:void 0},formItemTipClass:null,labelTip:{type:String,default:void 0},information:{type:Boolean,default:!1},prop:null,defaultModelValue:null};Reflect.deleteProperty(I,"size");const m=I,$=h.bindPropsFactory(m),R=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:$,props:m},Symbol.toStringTag,{value:"Module"})),E={key:0,class:"vkf-form-item-label__span"},O={key:2,class:"vkf-form-item-label__actions"},j=e.defineComponent({inheritAttrs:!1,__name:"core",props:{labelTip:{type:String,default:""},formItemTip:{type:String,default:""},formItemTipClass:null,elRef:null,label:null},setup(t){return(o,c)=>(e.openBlock(),e.createBlock(e.unref(a.ElFormItem),e.mergeProps(o.$attrs,{ref:t.elRef,class:["vkf-form-item",{"has-label-actions":o.$slots.labelActions}],label:t.label}),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"before"),e.renderSlot(o.$slots,"default"),e.renderSlot(o.$slots,"after"),t.formItemTip?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vkf-form-item__tip",t.formItemTipClass])},[e.createElementVNode("span",null,e.toDisplayString(t.formItemTip),1)],2)):e.createCommentVNode("",!0)]),label:e.withCtx(n=>[e.renderSlot(o.$slots,"label",e.normalizeProps(e.guardReactiveProps(n)),()=>[t.label?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),t.labelTip?(e.openBlock(),e.createBlock(e.unref(a.ElTooltip),{key:1,content:t.labelTip},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElButton),{text:"",class:"vkf-form-item-label-tip-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(_.warning_default))]),_:1})]),_:1})]),_:1},8,["content"])):e.createCommentVNode("",!0),o.$slots.labelActions?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(o.$slots,"labelActions")])):e.createCommentVNode("",!0)])]),error:e.withCtx(n=>[e.renderSlot(o.$slots,"error",e.normalizeProps(e.guardReactiveProps(n)))]),_:3},16,["class","label"]))}}),k=e.defineComponent({name:"VkfFormItem",props:m,setup(t,{slots:o}){const c=q.createFormItemBindProps(t,["rules"]),n=f.useComputedReadonly(t),{tr:i}=B.useLocale(),d=e.ref(),P=e.computed(()=>t.labelPosition),T=f.useComputedLabelPosition(d,P),b=()=>t.label||i("vkf.formItem.defaultField","该字段"),S=l=>{if(l.message)return;l.required&&(l.message=i("vkf.formItem.required","{label}不能为空",{label:b()}));const r=V.PATTERN_OPTIONS.find(y=>y.value===l.pattern);r&&(l.message=i("vkf.formItem.pattern","输入 {label} {pattern}",{label:b(),pattern:r.title}))},g=e.computed(()=>{let l=[];return!t.rules&&t.required&&l.push({required:!0}),v.isPlainObject(t.rules)&&(l=[t.rules]),Array.isArray(t.rules)&&(l=t.rules,t.required&&!t.rules.find(r=>r.required)&&l.push({required:!0})),l=l.filter(r=>{if(r&&v.isPlainObject(r))return Object.keys(r).filter(C=>!C.startsWith("data-")).length>0}),l.forEach(r=>{S(r)}),l}),{getDataValue:s,emitSetData:u}=f.useRendererData();setTimeout(()=>{t.defaultModelValue!==void 0&&t.prop&&(s==null?void 0:s(t.prop))===void 0&&(u==null||u({k:t.prop,v:t.defaultModelValue}))});const p=l=>{d.value=(l==null?void 0:l.$el)??l,typeof t.elRef=="function"&&t.elRef(l)};return()=>e.h(j,{...c.value,"label-position":T.value,elRef:p,class:{"is-readonly":n.value,"vkf-form-item--inline":t.inline,"is-empty-label":!t.label,"is-information":t.information},size:t.formItemSize,rules:g.value,formItemTip:t.formItemTip,formItemTipClass:t.formItemTipClass,labelTip:t.labelTip,label:t.label},{...o,...t.formItemSlots})}}),N=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfFormItem=k;exports._VkfFormItemCtx=R;exports.__VkfFormItem=N;exports.default=k;
|