@vunk/form 2.19.12 → 2.19.15
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 +14 -10
- package/components/api-tables-select/src/index.vue.d.ts +30 -21
- package/components/button/src/ctx.d.ts +4 -0
- package/components/button/src/index.vue.d.ts +18 -0
- package/components/card-input-collection/src/core.vue.d.ts +9 -0
- package/components/card-input-collection/src/ctx.d.ts +4 -0
- package/components/card-input-collection/src/index.vue.d.ts +9 -0
- package/components/cascader/src/ctx.d.ts +5 -1
- package/components/cascader/src/index.vue.d.ts +12 -3
- package/components/checkbox/src/ctx.d.ts +5 -1
- package/components/checkbox/src/index.vue.d.ts +19 -1
- package/components/collapse/index.cjs +1 -0
- package/components/collapse/index.d.ts +4 -0
- package/components/collapse/index.mjs +45 -0
- package/components/collapse/src/index.vue.d.ts +15 -0
- package/components/collapse/src/set-attrs.vue.d.ts +23 -0
- package/components/collapse-item/index.cjs +1 -0
- package/components/collapse-item/index.d.ts +6 -0
- package/components/collapse-item/index.mjs +63 -0
- package/components/collapse-item/src/ctx.d.ts +7 -0
- package/components/collapse-item/src/index.vue.d.ts +36 -0
- package/components/collapse-item/src/types.d.ts +1 -0
- package/components/collapse-item/src/use.d.ts +13 -0
- package/components/color-picker/src/ctx.d.ts +4 -0
- package/components/color-picker/src/index.vue.d.ts +10 -1
- package/components/date-picker/src/ctx.d.ts +5 -1
- package/components/date-picker/src/index.vue.d.ts +13 -4
- package/components/date-picker-range/src/ctx.d.ts +90 -86
- package/components/date-picker-range/src/index.vue.d.ts +198 -180
- package/components/dialog/src/ctx.d.ts +1 -1
- package/components/dialog-input-collection/src/ctx.d.ts +4 -0
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -1
- package/components/dialog-input-collection/src/index.vue.d.ts +9 -0
- package/components/download-plus/src/ctx.d.ts +4 -0
- package/components/download-plus/src/index.vue.d.ts +18 -0
- package/components/editable-text/src/ctx.d.ts +4 -0
- package/components/editable-text/src/index.vue.d.ts +9 -0
- package/components/el-slider/src/slider-core.vue.d.ts +2 -2
- package/components/esri-input-geojson/src/ctx.d.ts +5 -1
- package/components/esri-input-geojson/src/index.vue.d.ts +34 -6
- package/components/form/index.cjs +1 -1
- package/components/form/index.d.ts +1 -0
- package/components/form/index.mjs +115 -80
- package/components/form/src/index.vue.d.ts +1 -1
- package/components/form/src/types.d.ts +2 -1
- package/components/form/src/use.d.ts +206 -0
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +103 -80
- package/components/form-item/src/core.vue.d.ts +4 -0
- package/components/form-item/src/ctx.d.ts +6 -1
- package/components/form-item/src/index.vue.d.ts +9 -0
- package/components/information-collection/src/ctx.d.ts +4 -0
- package/components/information-collection/src/index.vue.d.ts +9 -0
- package/components/information-tag/src/index.vue.d.ts +2 -2
- package/components/input/src/ctx.d.ts +5 -1
- package/components/input/src/index.vue.d.ts +21 -3
- package/components/input-array/src/ctx.d.ts +4 -0
- package/components/input-array/src/index.vue.d.ts +9 -0
- package/components/input-collection/src/core.vue.d.ts +9 -0
- package/components/input-collection/src/ctx.d.ts +4 -0
- package/components/input-collection/src/index.vue.d.ts +9 -0
- package/components/input-file/src/index.vue.d.ts +9 -0
- package/components/input-link/src/ctx.d.ts +4 -0
- package/components/input-link/src/index.vue.d.ts +31 -4
- package/components/input-number/src/ctx.d.ts +5 -1
- package/components/input-number/src/index.vue.d.ts +21 -3
- package/components/input-tag/src/ctx.d.ts +5 -1
- package/components/input-tag/src/index.vue.d.ts +25 -7
- package/components/monaco-editor/src/ctx.d.ts +4 -0
- package/components/monaco-editor/src/index.vue.d.ts +18 -0
- package/components/radio/src/ctx.d.ts +4 -0
- package/components/radio/src/index.vue.d.ts +21 -3
- package/components/radio/src/wraper.vue.d.ts +10 -1
- package/components/select/src/core.vue.d.ts +33 -15
- package/components/select/src/ctx.d.ts +5 -1
- package/components/select/src/index.vue.d.ts +15 -6
- package/components/slider/src/ctx.d.ts +4 -0
- package/components/slider/src/index.vue.d.ts +11 -2
- package/components/switch/src/ctx.d.ts +4 -0
- package/components/switch/src/index.vue.d.ts +9 -0
- package/components/tables-select/src/ctx.d.ts +5 -1
- package/components/tables-select/src/index.vue.d.ts +10 -1
- package/components/templates-default/src/index.vue.d.ts +218 -38
- package/components/templates-esri/src/index.vue.d.ts +34 -6
- package/components/templates-variant/src/index.vue.d.ts +198 -180
- package/components/time-picker/src/ctx.d.ts +5 -1
- package/components/time-picker/src/index.vue.d.ts +13 -4
- package/components/upload/src/ctx.d.ts +5 -1
- package/components/upload/src/index.vue.d.ts +18 -0
- package/components/upload/src/wraper.vue.d.ts +9 -0
- package/components/upload-plus/src/ctx.d.ts +4 -0
- package/components/upload-plus/src/index.vue.d.ts +9 -0
- package/components/van-cascader/src/ctx.d.ts +4 -0
- package/components/van-cascader/src/index.vue.d.ts +12 -3
- package/components/var-datetime-picker/src/ctx.d.ts +4 -0
- package/components/var-datetime-picker/src/index.vue.d.ts +18 -0
- package/components/vditor/src/ctx.d.ts +4 -0
- package/components/vditor/src/index.vue.d.ts +18 -0
- package/composables/form-mitt/index.cjs +1 -0
- package/composables/form-mitt/index.d.ts +37 -0
- package/composables/form-mitt/index.mjs +41 -0
- package/composables/index.cjs +1 -1
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +16 -14
- package/package.json +19 -1
- package/shared/element-plus/ctx.d.ts +14 -13
- package/shared/element-plus/index.cjs +1 -1
- package/shared/element-plus/index.mjs +57 -56
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { formProps as
|
|
2
|
-
import { bindPropsFactory as
|
|
3
|
-
import { NOOP as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { VkfFormItemRenderer as
|
|
1
|
+
import { formProps as v, formEmits as h, formContextKey as E, ElForm as O } from "element-plus";
|
|
2
|
+
import { bindPropsFactory as I, onEmitsFactory as C } from "@vunk/core/shared/utils-vue";
|
|
3
|
+
import { NOOP as T } from "@vunk/core/shared/utils-function";
|
|
4
|
+
import { defineComponent as w, inject as j, computed as F, provide as V, reactive as D, toRefs as L, renderSlot as b, shallowRef as $, getCurrentInstance as A, resolveComponent as i, openBlock as B, createBlock as M, mergeProps as k, toHandlers as q, withCtx as c, createVNode as p } from "vue";
|
|
5
|
+
import { VkfFormItemRenderer as z } from "@vunk/form/components/form-item-renderer";
|
|
6
6
|
import { createFormBindProps as N, createFormOnEmits as H } from "@vunk/form/shared/element-plus";
|
|
7
7
|
import { getValue as K } from "@vunk/core/shared/helper";
|
|
8
8
|
import { VkfTemplatesDefault as G } from "@vunk/form/components/templates-default";
|
|
@@ -13,9 +13,11 @@ import { VkfRendererData as W } from "@vunk/form/components/renderer-data";
|
|
|
13
13
|
import { pickObject as X } from "@vunk/shared/object";
|
|
14
14
|
import { VkfFormsSegment as Y } from "@vunk/form/components/forms-provider";
|
|
15
15
|
import { noop as Z } from "@vunk/shared/function";
|
|
16
|
-
import {
|
|
16
|
+
import { initFormMitt as x } from "@vunk/form/composables/form-mitt";
|
|
17
|
+
import { useFormMitt as je } from "@vunk/form/composables/form-mitt";
|
|
18
|
+
import { _ as ee } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
17
19
|
const _ = {
|
|
18
|
-
...
|
|
20
|
+
...v,
|
|
19
21
|
labelPosition: {
|
|
20
22
|
type: String,
|
|
21
23
|
default: void 0
|
|
@@ -33,7 +35,7 @@ const _ = {
|
|
|
33
35
|
},
|
|
34
36
|
elRef: {
|
|
35
37
|
type: Function,
|
|
36
|
-
default: () =>
|
|
38
|
+
default: () => T
|
|
37
39
|
},
|
|
38
40
|
/**
|
|
39
41
|
* 是否开启布局模式
|
|
@@ -67,133 +69,165 @@ const _ = {
|
|
|
67
69
|
type: Object,
|
|
68
70
|
default: () => ({})
|
|
69
71
|
}
|
|
70
|
-
},
|
|
71
|
-
...
|
|
72
|
+
}, te = I(_), P = {
|
|
73
|
+
...h,
|
|
72
74
|
setData: (e) => e,
|
|
73
75
|
validate: null,
|
|
74
76
|
submit: null
|
|
75
|
-
},
|
|
77
|
+
}, oe = C(P), he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76
78
|
__proto__: null,
|
|
77
|
-
createBindProps:
|
|
78
|
-
createOnEmits:
|
|
79
|
-
emits:
|
|
79
|
+
createBindProps: te,
|
|
80
|
+
createOnEmits: oe,
|
|
81
|
+
emits: P,
|
|
80
82
|
props: _
|
|
81
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
82
|
-
if (!
|
|
83
|
+
}, Symbol.toStringTag, { value: "Module" })), re = (e) => 24 - e.templateSlots.reduce((t, o) => {
|
|
84
|
+
if (!o.span)
|
|
83
85
|
throw new Error("ElColSource span is required");
|
|
84
|
-
return t +
|
|
85
|
-
}, 0),
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
86
|
+
return t + o.span;
|
|
87
|
+
}, 0), ne = (e, t = {}) => {
|
|
88
|
+
const o = e.span ?? t.span;
|
|
89
|
+
if (o == null)
|
|
88
90
|
throw new Error("genColItem ElColSource span is required");
|
|
89
91
|
return {
|
|
90
92
|
...t,
|
|
91
93
|
templateType: "ElCol",
|
|
92
|
-
span:
|
|
94
|
+
span: o,
|
|
93
95
|
templateSlots: [
|
|
94
96
|
Q(e, {
|
|
95
97
|
excludes: ["span"]
|
|
96
98
|
})
|
|
97
99
|
]
|
|
98
100
|
};
|
|
99
|
-
},
|
|
101
|
+
}, ae = (e, t = {}) => ({
|
|
100
102
|
...t,
|
|
101
103
|
templateType: "ElRow",
|
|
102
104
|
templateSlots: e ? [
|
|
103
105
|
e
|
|
104
106
|
] : []
|
|
105
|
-
}),
|
|
107
|
+
}), me = /* @__PURE__ */ w({
|
|
106
108
|
__name: "provide-label-postion",
|
|
107
109
|
props: {
|
|
108
110
|
labelPosition: null
|
|
109
111
|
},
|
|
110
112
|
setup(e) {
|
|
111
|
-
const t = e,
|
|
113
|
+
const t = e, o = {
|
|
112
114
|
addField: Z
|
|
113
|
-
},
|
|
114
|
-
return
|
|
115
|
-
|
|
115
|
+
}, r = j(E, o), u = F(() => t.labelPosition ?? r.labelPosition);
|
|
116
|
+
return V(
|
|
117
|
+
E,
|
|
116
118
|
D({
|
|
117
|
-
...
|
|
118
|
-
labelPosition:
|
|
119
|
+
...r === o ? o : L(r),
|
|
120
|
+
labelPosition: u
|
|
119
121
|
})
|
|
120
|
-
), (
|
|
122
|
+
), (a, l) => b(a.$slots, "default");
|
|
121
123
|
}
|
|
122
|
-
})
|
|
124
|
+
});
|
|
125
|
+
function le(e) {
|
|
126
|
+
const t = $(), o = (r) => {
|
|
127
|
+
if (r) {
|
|
128
|
+
const u = r.validate;
|
|
129
|
+
r.validate = (a) => {
|
|
130
|
+
const l = u.call(r);
|
|
131
|
+
return l && typeof l.then == "function" ? l.then(
|
|
132
|
+
(s) => {
|
|
133
|
+
var f;
|
|
134
|
+
return (f = e.onAfterValidate) == null || f.call(e, !0), a == null || a(!0), s;
|
|
135
|
+
},
|
|
136
|
+
(s) => {
|
|
137
|
+
var f;
|
|
138
|
+
throw (f = e.onAfterValidate) == null || f.call(e, !1, s), a == null || a(!1, s), s;
|
|
139
|
+
}
|
|
140
|
+
) : l;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
t.value = r, e.elRef(r);
|
|
144
|
+
};
|
|
145
|
+
return V("elFormRef", t), {
|
|
146
|
+
setFormRef: o,
|
|
147
|
+
formRef: t
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const se = w({
|
|
123
151
|
name: "VkfForm",
|
|
124
152
|
components: {
|
|
125
153
|
VkfRendererData: W,
|
|
126
|
-
ElForm:
|
|
127
|
-
VkfFormItemRenderer:
|
|
154
|
+
ElForm: O,
|
|
155
|
+
VkfFormItemRenderer: z,
|
|
128
156
|
VkfTemplatesDefault: G,
|
|
129
157
|
VkfTemplatesLayout: J,
|
|
130
158
|
VkfFormsSegment: Y,
|
|
131
|
-
ProvideLabelPostion:
|
|
159
|
+
ProvideLabelPostion: me
|
|
132
160
|
},
|
|
133
161
|
props: _,
|
|
134
|
-
emits:
|
|
162
|
+
emits: P,
|
|
135
163
|
setup(e, { emit: t }) {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
164
|
+
const o = N(e, ["model", "labelPosition"]), r = H(t), u = x(), { setFormRef: a } = le({
|
|
165
|
+
elRef: e.elRef,
|
|
166
|
+
onAfterValidate: (n, m) => {
|
|
167
|
+
u.emit("afterValidate", {
|
|
168
|
+
isValid: n,
|
|
169
|
+
invalidFields: m
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}), l = A();
|
|
173
|
+
V("vkfFormVm", l);
|
|
174
|
+
const s = F(() => e.layout ? e.formItems.reduce((n, m) => {
|
|
175
|
+
var R;
|
|
176
|
+
const d = n.findLast((g) => g.templateType === "ElRow"), y = m.span ?? e.colSource.span;
|
|
177
|
+
if (!y)
|
|
178
|
+
return n.push(m), n;
|
|
179
|
+
if (!((R = m.templateLayout) != null && R.allowEmpty) && Reflect.has(m, "templateIf") && !U(m.templateIf)(e.data))
|
|
180
|
+
return n;
|
|
181
|
+
const S = ne(m, X({
|
|
148
182
|
...e.colSource,
|
|
149
|
-
...
|
|
183
|
+
...m.templateLayout
|
|
150
184
|
}, {
|
|
151
185
|
excludes: ["allowEmpty"]
|
|
152
186
|
}));
|
|
153
|
-
return !
|
|
187
|
+
return !d || re(d) < y ? n.push(ae(S, e.rowSource)) : d.templateSlots.push(S), n;
|
|
154
188
|
}, []) : e.formItems);
|
|
155
189
|
return {
|
|
156
|
-
formProps:
|
|
157
|
-
formEmits:
|
|
190
|
+
formProps: o,
|
|
191
|
+
formEmits: r,
|
|
158
192
|
getValue: K,
|
|
159
|
-
|
|
160
|
-
computed:
|
|
161
|
-
rendererSource:
|
|
162
|
-
handleSubmit: (
|
|
163
|
-
|
|
193
|
+
setFormRef: a,
|
|
194
|
+
computed: F,
|
|
195
|
+
rendererSource: s,
|
|
196
|
+
handleSubmit: (n) => {
|
|
197
|
+
n.preventDefault(), t("submit", n);
|
|
164
198
|
}
|
|
165
199
|
};
|
|
166
200
|
}
|
|
167
201
|
});
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
return
|
|
171
|
-
ref: e.
|
|
202
|
+
function fe(e, t, o, r, u, a) {
|
|
203
|
+
const l = i("VkfFormsSegment"), s = i("VkfTemplatesDefault"), f = i("VkfTemplatesLayout"), n = i("VkfFormItemRenderer"), m = i("VkfRendererData"), d = i("ProvideLabelPostion"), y = i("ElForm");
|
|
204
|
+
return B(), M(y, k(e.formProps, {
|
|
205
|
+
ref: e.setFormRef,
|
|
172
206
|
class: {
|
|
173
207
|
"is-readonly": e.readonly
|
|
174
208
|
},
|
|
175
209
|
model: e.model || e.data
|
|
176
|
-
},
|
|
177
|
-
default:
|
|
178
|
-
|
|
179
|
-
default:
|
|
180
|
-
|
|
210
|
+
}, q(e.formEmits), { onSubmit: e.handleSubmit }), {
|
|
211
|
+
default: c(() => [
|
|
212
|
+
p(d, { "label-position": e.labelPosition }, {
|
|
213
|
+
default: c(() => [
|
|
214
|
+
p(m, {
|
|
181
215
|
data: e.data,
|
|
182
|
-
onSetData: t[0] || (t[0] = (
|
|
216
|
+
onSetData: t[0] || (t[0] = (S) => e.$emit("setData", S))
|
|
183
217
|
}, {
|
|
184
|
-
default:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
placeholder:
|
|
188
|
-
s
|
|
189
|
-
|
|
218
|
+
default: c(() => [
|
|
219
|
+
p(l, k({ data: e.data }, e.segmentAttrs), null, 16, ["data"]),
|
|
220
|
+
p(n, { source: e.rendererSource }, {
|
|
221
|
+
placeholder: c(() => [
|
|
222
|
+
p(s),
|
|
223
|
+
p(f)
|
|
190
224
|
]),
|
|
191
|
-
default:
|
|
192
|
-
|
|
225
|
+
default: c(() => [
|
|
226
|
+
b(e.$slots, "rendererTemplate")
|
|
193
227
|
]),
|
|
194
228
|
_: 3
|
|
195
229
|
}, 8, ["source"]),
|
|
196
|
-
|
|
230
|
+
b(e.$slots, "default")
|
|
197
231
|
]),
|
|
198
232
|
_: 3
|
|
199
233
|
}, 8, ["data"])
|
|
@@ -204,12 +238,13 @@ function se(e, t, r, l, m, i) {
|
|
|
204
238
|
_: 3
|
|
205
239
|
}, 16, ["class", "model", "onSubmit"]);
|
|
206
240
|
}
|
|
207
|
-
const
|
|
241
|
+
const Oe = /* @__PURE__ */ ee(se, [["render", fe]]), Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
208
242
|
__proto__: null
|
|
209
243
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
210
244
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
245
|
+
Oe as VkfForm,
|
|
246
|
+
he as _VkfFormCtx,
|
|
247
|
+
Ie as __VkfForm,
|
|
248
|
+
Oe as default,
|
|
249
|
+
je as useFormMitt
|
|
215
250
|
};
|
|
@@ -81,7 +81,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
}>;
|
|
82
82
|
formEmits: {};
|
|
83
83
|
getValue: (obj: any, k: any, intoUndefined?: import("@vunk/core").IntoUndefined, safe?: boolean) => any;
|
|
84
|
-
|
|
84
|
+
setFormRef: (e: any) => void;
|
|
85
85
|
computed: typeof import("@vue/reactivity").computed;
|
|
86
86
|
rendererSource: import("vue").ComputedRef<any>;
|
|
87
87
|
handleSubmit: (e: Event) => void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __VkfTemplatesDefault } from '@vunk/form/components/templates-default';
|
|
2
2
|
import { __VkfTemplatesLayout } from '@vunk/form/components/templates-layout';
|
|
3
3
|
import { VueComponentPropsType } from '@vunk/shared';
|
|
4
|
-
import { ElCol } from 'element-plus';
|
|
4
|
+
import { ElCol, FormItemProp } from 'element-plus';
|
|
5
|
+
export type OnValidate = (prop: FormItemProp, isValid: boolean, message: string) => any;
|
|
5
6
|
export type LayoutProps = {
|
|
6
7
|
/**
|
|
7
8
|
* 如果开启 props.layout,那么
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { AnyFunc } from '@vunk/shared';
|
|
2
|
+
import { FormValidateCallback, FormValidationResult } from 'element-plus';
|
|
3
|
+
export { initFormMitt, type FormEmitter, useFormMitt } from '@vunk/form/composables/form-mitt';
|
|
4
|
+
export declare function initFormRef(props: {
|
|
5
|
+
elRef: AnyFunc;
|
|
6
|
+
onAfterValidate?: FormValidateCallback;
|
|
7
|
+
}): {
|
|
8
|
+
setFormRef: (e: any) => void;
|
|
9
|
+
formRef: import("vue").ShallowRef<({
|
|
10
|
+
$: import("vue").ComponentInternalInstance;
|
|
11
|
+
$data: {};
|
|
12
|
+
$props: {
|
|
13
|
+
readonly model?: Record<string, any> | undefined;
|
|
14
|
+
readonly rules?: import("element-plus").FormRules | undefined;
|
|
15
|
+
readonly labelPosition?: "left" | "right" | "top" | undefined;
|
|
16
|
+
readonly requireAsteriskPosition?: "left" | "right" | undefined;
|
|
17
|
+
readonly labelWidth?: string | number | undefined;
|
|
18
|
+
readonly labelSuffix?: string | undefined;
|
|
19
|
+
readonly inline?: boolean | undefined;
|
|
20
|
+
readonly inlineMessage?: boolean | undefined;
|
|
21
|
+
readonly statusIcon?: boolean | undefined;
|
|
22
|
+
readonly showMessage?: boolean | undefined;
|
|
23
|
+
readonly validateOnRuleChange?: boolean | undefined;
|
|
24
|
+
readonly hideRequiredAsterisk?: boolean | undefined;
|
|
25
|
+
readonly scrollToError?: boolean | undefined;
|
|
26
|
+
readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
|
|
27
|
+
readonly size?: import("element-plus").ComponentSize | undefined;
|
|
28
|
+
readonly disabled?: boolean | undefined;
|
|
29
|
+
readonly onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
|
|
30
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
31
|
+
$attrs: import("vue").Attrs;
|
|
32
|
+
$refs: {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
$slots: Readonly<{
|
|
36
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
39
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
40
|
+
$host: Element | null;
|
|
41
|
+
$emit: (event: "validate", prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
42
|
+
$el: any;
|
|
43
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
44
|
+
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
47
|
+
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
48
|
+
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
49
|
+
clearValidate: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
50
|
+
scrollToField: (prop: import("element-plus").FormItemProp) => void;
|
|
51
|
+
getField: (prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined;
|
|
52
|
+
fields: import("vue").Reactive<import("element-plus").FormItemContext[]>;
|
|
53
|
+
setInitialValues: (initModel: Record<string, any>) => void;
|
|
54
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
55
|
+
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
56
|
+
}, string, {
|
|
57
|
+
labelWidth: string | number;
|
|
58
|
+
labelPosition: "left" | "right" | "top";
|
|
59
|
+
requireAsteriskPosition: "left" | "right";
|
|
60
|
+
labelSuffix: string;
|
|
61
|
+
showMessage: boolean;
|
|
62
|
+
validateOnRuleChange: boolean;
|
|
63
|
+
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
64
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
65
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
66
|
+
created?: (() => void) | (() => void)[];
|
|
67
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
68
|
+
mounted?: (() => void) | (() => void)[];
|
|
69
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
70
|
+
updated?: (() => void) | (() => void)[];
|
|
71
|
+
activated?: (() => void) | (() => void)[];
|
|
72
|
+
deactivated?: (() => void) | (() => void)[];
|
|
73
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
74
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
75
|
+
destroyed?: (() => void) | (() => void)[];
|
|
76
|
+
unmounted?: (() => void) | (() => void)[];
|
|
77
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
78
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
79
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
80
|
+
};
|
|
81
|
+
$forceUpdate: () => void;
|
|
82
|
+
$nextTick: typeof import("vue").nextTick;
|
|
83
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
84
|
+
} & Readonly<{
|
|
85
|
+
labelWidth: string | number;
|
|
86
|
+
labelPosition: "left" | "right" | "top";
|
|
87
|
+
requireAsteriskPosition: "left" | "right";
|
|
88
|
+
labelSuffix: string;
|
|
89
|
+
showMessage: boolean;
|
|
90
|
+
validateOnRuleChange: boolean;
|
|
91
|
+
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
92
|
+
}> & Omit<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
93
|
+
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
94
|
+
}>, "labelPosition" | "labelWidth" | "showMessage" | "validate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & {
|
|
95
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
96
|
+
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
97
|
+
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
98
|
+
clearValidate: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
99
|
+
scrollToField: (prop: import("element-plus").FormItemProp) => void;
|
|
100
|
+
getField: (prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined;
|
|
101
|
+
fields: import("vue").Reactive<import("element-plus").FormItemContext[]>;
|
|
102
|
+
setInitialValues: (initModel: Record<string, any>) => void;
|
|
103
|
+
} & {} & import("vue").ComponentCustomProperties & {} & {
|
|
104
|
+
$slots: {
|
|
105
|
+
default?: (props: {}) => any;
|
|
106
|
+
};
|
|
107
|
+
}) | undefined, ({
|
|
108
|
+
$: import("vue").ComponentInternalInstance;
|
|
109
|
+
$data: {};
|
|
110
|
+
$props: {
|
|
111
|
+
readonly model?: Record<string, any> | undefined;
|
|
112
|
+
readonly rules?: import("element-plus").FormRules | undefined;
|
|
113
|
+
readonly labelPosition?: "left" | "right" | "top" | undefined;
|
|
114
|
+
readonly requireAsteriskPosition?: "left" | "right" | undefined;
|
|
115
|
+
readonly labelWidth?: string | number | undefined;
|
|
116
|
+
readonly labelSuffix?: string | undefined;
|
|
117
|
+
readonly inline?: boolean | undefined;
|
|
118
|
+
readonly inlineMessage?: boolean | undefined;
|
|
119
|
+
readonly statusIcon?: boolean | undefined;
|
|
120
|
+
readonly showMessage?: boolean | undefined;
|
|
121
|
+
readonly validateOnRuleChange?: boolean | undefined;
|
|
122
|
+
readonly hideRequiredAsterisk?: boolean | undefined;
|
|
123
|
+
readonly scrollToError?: boolean | undefined;
|
|
124
|
+
readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
|
|
125
|
+
readonly size?: import("element-plus").ComponentSize | undefined;
|
|
126
|
+
readonly disabled?: boolean | undefined;
|
|
127
|
+
readonly onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
|
|
128
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
129
|
+
$attrs: import("vue").Attrs;
|
|
130
|
+
$refs: {
|
|
131
|
+
[x: string]: unknown;
|
|
132
|
+
};
|
|
133
|
+
$slots: Readonly<{
|
|
134
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
137
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
138
|
+
$host: Element | null;
|
|
139
|
+
$emit: (event: "validate", prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
140
|
+
$el: any;
|
|
141
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
142
|
+
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
143
|
+
}>, {
|
|
144
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
145
|
+
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
146
|
+
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
147
|
+
clearValidate: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
148
|
+
scrollToField: (prop: import("element-plus").FormItemProp) => void;
|
|
149
|
+
getField: (prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined;
|
|
150
|
+
fields: import("vue").Reactive<import("element-plus").FormItemContext[]>;
|
|
151
|
+
setInitialValues: (initModel: Record<string, any>) => void;
|
|
152
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
153
|
+
validate: (prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => void;
|
|
154
|
+
}, string, {
|
|
155
|
+
labelWidth: string | number;
|
|
156
|
+
labelPosition: "left" | "right" | "top";
|
|
157
|
+
requireAsteriskPosition: "left" | "right";
|
|
158
|
+
labelSuffix: string;
|
|
159
|
+
showMessage: boolean;
|
|
160
|
+
validateOnRuleChange: boolean;
|
|
161
|
+
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
162
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
163
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
164
|
+
created?: (() => void) | (() => void)[];
|
|
165
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
166
|
+
mounted?: (() => void) | (() => void)[];
|
|
167
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
168
|
+
updated?: (() => void) | (() => void)[];
|
|
169
|
+
activated?: (() => void) | (() => void)[];
|
|
170
|
+
deactivated?: (() => void) | (() => void)[];
|
|
171
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
172
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
173
|
+
destroyed?: (() => void) | (() => void)[];
|
|
174
|
+
unmounted?: (() => void) | (() => void)[];
|
|
175
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
176
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
177
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
178
|
+
};
|
|
179
|
+
$forceUpdate: () => void;
|
|
180
|
+
$nextTick: typeof import("vue").nextTick;
|
|
181
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
182
|
+
} & Readonly<{
|
|
183
|
+
labelWidth: string | number;
|
|
184
|
+
labelPosition: "left" | "right" | "top";
|
|
185
|
+
requireAsteriskPosition: "left" | "right";
|
|
186
|
+
labelSuffix: string;
|
|
187
|
+
showMessage: boolean;
|
|
188
|
+
validateOnRuleChange: boolean;
|
|
189
|
+
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
190
|
+
}> & Omit<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
191
|
+
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
192
|
+
}>, "labelPosition" | "labelWidth" | "showMessage" | "validate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & {
|
|
193
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
194
|
+
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
195
|
+
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
196
|
+
clearValidate: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
197
|
+
scrollToField: (prop: import("element-plus").FormItemProp) => void;
|
|
198
|
+
getField: (prop: import("element-plus").FormItemProp) => import("element-plus").FormItemContext | undefined;
|
|
199
|
+
fields: import("vue").Reactive<import("element-plus").FormItemContext[]>;
|
|
200
|
+
setInitialValues: (initModel: Record<string, any>) => void;
|
|
201
|
+
} & {} & import("vue").ComponentCustomProperties & {} & {
|
|
202
|
+
$slots: {
|
|
203
|
+
default?: (props: {}) => any;
|
|
204
|
+
};
|
|
205
|
+
}) | undefined>;
|
|
206
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("element-plus"),h=require("@vunk/core/shared/utils-vue"),e=require("vue"),q=require("@vunk/form/shared/element-plus"),u=require("@vunk/form/composables"),B=require("@vunk/form/composables/element-plus"),v=require("@vunk/core/shared/utils-object"),V=require("@vunk/form/shared/rules"),O=require("../index-DSyxYMB0.js"),$=require("@vunk/form/components/collapse-item"),k={...s.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,labelTipProps:{type:Object,default:()=>({})}};Reflect.deleteProperty(k,"size");const b=k,j=h.bindPropsFactory(b),E=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:j,props:b},Symbol.toStringTag,{value:"Module"})),N={key:0,class:"vkf-form-item-label__span"},R={key:2,class:"vkf-form-item-label__actions"},_=e.defineComponent({inheritAttrs:!1,__name:"core",props:{labelTip:{type:String,default:""},formItemTip:{type:String,default:""},formItemTipClass:null,elRef:null,label:null,prop:null,labelTipProps:null},setup(t){const i=t,{mittOn:f}=u.useFormMitt(),m=$.useCollapseItemContext();return f("afterValidate",({invalidFields:o})=>{if(!o||i.prop==null||!(i.prop in o))return;const r=m;if(!r)return;const n=r.name;if(r.accordion){if(Object.keys(o)[0]===i.prop){if(r.activeNames.includes(n))return;r.handleItemClick(n)}}else{if(r.activeNames.includes(n))return;r.handleItemClick(n)}}),(o,r)=>(e.openBlock(),e.createBlock(e.unref(s.ElFormItem),e.mergeProps(o.$attrs,{prop:t.prop,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",N,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),t.labelTip?(e.openBlock(),e.createBlock(e.unref(s.ElTooltip),e.mergeProps({key:1,content:t.labelTip},t.labelTipProps),{default:e.withCtx(()=>[e.createVNode(e.unref(s.ElButton),{text:"",class:"vkf-form-item-label-tip-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.warning_default))]),_:1})]),_:1})]),_:1},16,["content"])):e.createCommentVNode("",!0),o.$slots.labelActions?(e.openBlock(),e.createElementBlock("div",R,[e.renderSlot(o.$slots,"labelActions")])):e.createCommentVNode("",!0)])]),error:e.withCtx(n=>[e.renderSlot(o.$slots,"error",e.normalizeProps(e.guardReactiveProps(n)))]),_:3},16,["prop","class","label"]))}}),P=e.defineComponent({name:"VkfFormItem",props:b,setup(t,{slots:i}){const f=q.createFormItemBindProps(t,["rules"]),m=u.useComputedReadonly(t),{tr:o}=B.useLocale(),r=e.ref(),n=e.computed(()=>t.labelPosition),p=u.useComputedLabelPosition(r,n),y=()=>t.label||o("vkf.formItem.defaultField","该字段"),T=l=>{if(l.message)return;l.required&&(l.message=o("vkf.formItem.required","{label}不能为空",{label:y()}));const a=V.PATTERN_OPTIONS.find(I=>I.value===l.pattern);a&&(l.message=o("vkf.formItem.pattern","输入 {label} {pattern}",{label:y(),pattern:a.title}))},C=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(a=>a.required)&&l.push({required:!0})),l=l.filter(a=>{if(a&&v.isPlainObject(a))return Object.keys(a).filter(S=>!S.startsWith("data-")).length>0}),l.forEach(a=>{T(a)}),l}),{getDataValue:c,emitSetData:d}=u.useRendererData();setTimeout(()=>{t.defaultModelValue!==void 0&&t.prop&&(c==null?void 0:c(t.prop))===void 0&&(d==null||d({k:t.prop,v:t.defaultModelValue}))});const g=l=>{r.value=(l==null?void 0:l.$el)??l,typeof t.elRef=="function"&&t.elRef(l)};return()=>e.h(_,{...f.value,"label-position":p.value,elRef:g,class:{"is-readonly":m.value,"vkf-form-item--inline":t.inline,"is-empty-label":!t.label,"is-information":t.information},size:t.formItemSize,rules:C.value,formItemTip:t.formItemTip,formItemTipClass:t.formItemTipClass,labelTip:t.labelTip,label:t.label,labelTipProps:t.labelTipProps},{...i,...t.formItemSlots})}}),z=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfFormItem=P;exports._VkfFormItemCtx=E;exports.__VkfFormItem=z;exports.default=P;
|