@volverjs/form-vue 1.1.0-beta.5 → 1.1.0
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/VvForm.d.ts +1 -1
- package/dist/VvFormWrapper.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.es.js +290 -285
- package/dist/index.umd.js +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +12 -12
- package/src/VvFormField.ts +7 -7
- package/src/VvFormTemplate.ts +117 -117
- package/src/utils.ts +36 -30
package/dist/index.es.js
CHANGED
|
@@ -1,102 +1,107 @@
|
|
|
1
|
-
import { ref as B, computed as
|
|
2
|
-
import { watchIgnorable as
|
|
3
|
-
import { ZodError as
|
|
4
|
-
import { safeParse as
|
|
5
|
-
import { set as oe, get as
|
|
1
|
+
import { ref as B, computed as D, readonly as F, defineComponent as U, h as E, withModifiers as re, toRaw as N, watch as z, isProxy as ce, onMounted as H, provide as Q, toRefs as Y, useId as ae, inject as G, onBeforeUnmount as L, unref as P, resolveComponent as $, defineAsyncComponent as me, getCurrentInstance as pe } from "vue";
|
|
2
|
+
import { watchIgnorable as ye, throttleFilter as he } from "@vueuse/core";
|
|
3
|
+
import { ZodError as be } from "zod/v3";
|
|
4
|
+
import { safeParse as je, safeParseAsync as Ve, formatError as ne, $ZodError as ge } from "zod/v4/core";
|
|
5
|
+
import { set as oe, get as W } from "ts-dot-prop";
|
|
6
6
|
var V = /* @__PURE__ */ ((e) => (e.text = "text", e.number = "number", e.email = "email", e.password = "password", e.tel = "tel", e.url = "url", e.search = "search", e.date = "date", e.time = "time", e.datetimeLocal = "datetime-local", e.month = "month", e.week = "week", e.color = "color", e.select = "select", e.checkbox = "checkbox", e.radio = "radio", e.textarea = "textarea", e.radioGroup = "radioGroup", e.checkboxGroup = "checkboxGroup", e.combobox = "combobox", e.custom = "custom", e))(V || {}), S = /* @__PURE__ */ ((e) => (e.invalid = "invalid", e.valid = "valid", e.submitting = "submitting", e.reset = "reset", e.updated = "updated", e.unknown = "unknown", e))(S || {});
|
|
7
|
-
const K = (e) => e._def.typeName === "ZodObject",
|
|
7
|
+
const K = (e) => e._def.typeName === "ZodObject", C = (e) => e._zod.def.type === "object", Oe = (e) => e._def.typeName === "ZodDefault", we = (e) => e._zod.def.type === "default", De = (e) => e._def.typeName === "ZodNullable", _e = (e) => e._zod.def.type === "nullable", Re = (e) => e._def.typeName === "ZodRecord", Se = (e) => e._zod.def.type === "record", Ie = (e) => e._def.typeName === "ZodArray", Ee = (e) => e._zod.def.type === "array", Ze = (e) => e._def.typeName === "ZodEffects", ue = (e) => e._def.typeName === "ZodOptional", le = (e) => e._zod.def.type === "optional", xe = (e) => e._zod.def.type === "pipe", ze = (e) => e._zod.def.type === "transform";
|
|
8
|
+
function se(e) {
|
|
8
9
|
let t = e;
|
|
9
|
-
for (;
|
|
10
|
+
for (; Ze(t); )
|
|
10
11
|
t = t.innerType();
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function ie(e) {
|
|
15
|
+
let t = e;
|
|
16
|
+
for (; xe(t); )
|
|
17
|
+
ze(t._zod.def.out) ? t = t._zod.def.in : t = t._zod.def.out;
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
const T = (e) => {
|
|
21
|
+
let t = se(e);
|
|
11
22
|
return ue(t) && (t = t._def.innerType), t;
|
|
12
23
|
}, M = (e) => {
|
|
13
|
-
let t = e;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, xe = (e) => {
|
|
18
|
-
let t = e;
|
|
19
|
-
for (; le(t); )
|
|
20
|
-
t = t.innerType();
|
|
24
|
+
let t = ie(e);
|
|
25
|
+
return le(t) && (t = t._zod.def.innerType), t;
|
|
26
|
+
}, Fe = (e) => {
|
|
27
|
+
const t = se(e);
|
|
21
28
|
return !!ue(t);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
de(t._zod.def.out) ? t = t._zod.def.in : t = t._zod.def.out;
|
|
26
|
-
return !!ie(t);
|
|
29
|
+
}, Ae = (e) => {
|
|
30
|
+
const t = ie(e);
|
|
31
|
+
return !!le(t);
|
|
27
32
|
}, X = (e) => "_zod" in e;
|
|
28
33
|
function k(e, t = {}) {
|
|
29
34
|
if (X(e)) {
|
|
30
35
|
const a = M(e);
|
|
31
|
-
return
|
|
32
|
-
|
|
36
|
+
return C(a) ? {
|
|
37
|
+
...a._zod.def.catchall && a._zod.def.catchall._zod.def.type !== "never" ? t : {},
|
|
33
38
|
...Object.fromEntries(
|
|
34
39
|
("shape" in a._zod.def ? Object.entries(a._zod.def.shape) : []).map(
|
|
35
|
-
([
|
|
36
|
-
const r = t[
|
|
40
|
+
([u, f]) => {
|
|
41
|
+
const r = t[u], v = Ae(f);
|
|
37
42
|
let o = M(f), d;
|
|
38
|
-
if (
|
|
39
|
-
return [
|
|
43
|
+
if (we(o) && (d = o._zod.def.defaultValue, o = o._zod.def.innerType), r === null && _e(o))
|
|
44
|
+
return [u, r];
|
|
40
45
|
if (r == null && v)
|
|
41
|
-
return [
|
|
46
|
+
return [u, d];
|
|
42
47
|
if (o) {
|
|
43
|
-
const c =
|
|
48
|
+
const c = je(f, r);
|
|
44
49
|
if (c.success)
|
|
45
|
-
return [
|
|
50
|
+
return [u, c.data ?? d];
|
|
46
51
|
}
|
|
47
52
|
if (Ee(o) && Array.isArray(r) && r.length) {
|
|
48
53
|
const c = M(o._zod.def.element);
|
|
49
|
-
if (
|
|
54
|
+
if (C(c))
|
|
50
55
|
return [
|
|
51
|
-
|
|
56
|
+
u,
|
|
52
57
|
r.map(
|
|
53
|
-
(
|
|
58
|
+
(w) => k(
|
|
54
59
|
c,
|
|
55
|
-
|
|
60
|
+
w && typeof w == "object" ? w : void 0
|
|
56
61
|
)
|
|
57
62
|
)
|
|
58
63
|
];
|
|
59
64
|
}
|
|
60
|
-
if (
|
|
65
|
+
if (Se(o) && r) {
|
|
61
66
|
const c = M(o._zod.def.valueType);
|
|
62
|
-
if (
|
|
63
|
-
return [
|
|
67
|
+
if (C(c))
|
|
68
|
+
return [u, Object.keys(r).reduce((w, p) => (w[p] = k(c, r[p]), w), {})];
|
|
64
69
|
}
|
|
65
|
-
return
|
|
66
|
-
|
|
70
|
+
return C(o) ? [
|
|
71
|
+
u,
|
|
67
72
|
k(
|
|
68
73
|
o,
|
|
69
74
|
r && typeof r == "object" ? r : d
|
|
70
75
|
)
|
|
71
|
-
] : [
|
|
76
|
+
] : [u, d];
|
|
72
77
|
}
|
|
73
78
|
)
|
|
74
79
|
)
|
|
75
80
|
} : t;
|
|
76
81
|
}
|
|
77
|
-
const
|
|
78
|
-
return K(
|
|
79
|
-
...
|
|
82
|
+
const l = T(e);
|
|
83
|
+
return K(l) ? {
|
|
84
|
+
...l._def.unknownKeys === "passthrough" ? t : {},
|
|
80
85
|
...Object.fromEntries(
|
|
81
|
-
("shape" in
|
|
82
|
-
([a,
|
|
83
|
-
const
|
|
84
|
-
let r =
|
|
85
|
-
if (
|
|
86
|
-
return [a,
|
|
87
|
-
if (
|
|
86
|
+
("shape" in l ? Object.entries(l.shape) : []).map(
|
|
87
|
+
([a, i]) => {
|
|
88
|
+
const u = t[a], f = Fe(i);
|
|
89
|
+
let r = T(i), v;
|
|
90
|
+
if (Oe(r) && (v = r._def.defaultValue(), r = r._def.innerType), u === null && De(r))
|
|
91
|
+
return [a, u];
|
|
92
|
+
if (u == null && f)
|
|
88
93
|
return [a, v];
|
|
89
94
|
if (r) {
|
|
90
|
-
const o =
|
|
95
|
+
const o = i.safeParse(u);
|
|
91
96
|
if (o.success)
|
|
92
97
|
return [a, o.data ?? v];
|
|
93
98
|
}
|
|
94
|
-
if (
|
|
95
|
-
const o =
|
|
99
|
+
if (Ie(r) && Array.isArray(u) && u.length) {
|
|
100
|
+
const o = T(r._def.type);
|
|
96
101
|
if (K(o))
|
|
97
102
|
return [
|
|
98
103
|
a,
|
|
99
|
-
|
|
104
|
+
u.map(
|
|
100
105
|
(d) => k(
|
|
101
106
|
o,
|
|
102
107
|
d && typeof d == "object" ? d : void 0
|
|
@@ -104,16 +109,16 @@ function k(e, t = {}) {
|
|
|
104
109
|
)
|
|
105
110
|
];
|
|
106
111
|
}
|
|
107
|
-
if (
|
|
108
|
-
const o =
|
|
112
|
+
if (Re(r) && u) {
|
|
113
|
+
const o = T(r._def.valueType);
|
|
109
114
|
if (K(o))
|
|
110
|
-
return [a, Object.keys(
|
|
115
|
+
return [a, Object.keys(u).reduce((d, c) => (d[c] = k(o, u[c]), d), {})];
|
|
111
116
|
}
|
|
112
117
|
return K(r) ? [
|
|
113
118
|
a,
|
|
114
119
|
k(
|
|
115
120
|
r,
|
|
116
|
-
|
|
121
|
+
u && typeof u == "object" ? u : v
|
|
117
122
|
)
|
|
118
123
|
] : [a, v];
|
|
119
124
|
}
|
|
@@ -121,44 +126,44 @@ function k(e, t = {}) {
|
|
|
121
126
|
)
|
|
122
127
|
} : t;
|
|
123
128
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
126
|
-
const
|
|
129
|
+
const Ne = (e, t) => X(e) ? Ve(e, t) : e.safeParseAsync(t), $e = (e, t) => X(e) ? ne(t) : t.format(), Ge = (e, t) => X(e) ? ne(new ge(t)) : new be(t).format();
|
|
130
|
+
function ke(e, t, l, g, a) {
|
|
131
|
+
const i = B(), u = B(), f = D(() => u.value === S.invalid), r = B(), v = B(!1);
|
|
127
132
|
let o;
|
|
128
|
-
const d = (
|
|
129
|
-
const _ = k(e,
|
|
130
|
-
if (
|
|
131
|
-
const n =
|
|
133
|
+
const d = (O) => {
|
|
134
|
+
const _ = k(e, O);
|
|
135
|
+
if (l?.class) {
|
|
136
|
+
const n = l.class;
|
|
132
137
|
return new n(_);
|
|
133
138
|
}
|
|
134
139
|
return _;
|
|
135
|
-
}, c = async (
|
|
140
|
+
}, c = async (O = r.value, _) => {
|
|
136
141
|
if (o = _?.fields, v.value)
|
|
137
142
|
return !0;
|
|
138
|
-
const n = await
|
|
143
|
+
const n = await Ne(e, O);
|
|
139
144
|
if (!n.success) {
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
145
|
+
if (u.value = S.invalid, !o?.size)
|
|
146
|
+
return i.value = $e(e, n.error), !1;
|
|
142
147
|
const j = n.error.issues.filter(
|
|
143
148
|
(A) => o?.has(A.path.join("."))
|
|
144
149
|
);
|
|
145
|
-
return j.length ? (
|
|
150
|
+
return j.length ? (i.value = Ge(e, j), !1) : (i.value = void 0, !0);
|
|
146
151
|
}
|
|
147
|
-
return
|
|
148
|
-
},
|
|
149
|
-
|
|
152
|
+
return i.value = void 0, u.value = S.valid, r.value = d(n.data), !0;
|
|
153
|
+
}, w = () => {
|
|
154
|
+
i.value = void 0, u.value = void 0, o = void 0;
|
|
150
155
|
}, p = () => {
|
|
151
|
-
r.value = d(),
|
|
152
|
-
}, m = async (
|
|
156
|
+
r.value = d(), w(), u.value = S.reset;
|
|
157
|
+
}, m = async (O) => v.value || !await c(void 0, O) ? !1 : (u.value = S.submitting, !0), { ignoreUpdates: y, stop: b } = ye(
|
|
153
158
|
r,
|
|
154
159
|
() => {
|
|
155
|
-
|
|
160
|
+
u.value = S.updated;
|
|
156
161
|
},
|
|
157
162
|
{
|
|
158
163
|
deep: !0,
|
|
159
|
-
eventFilter:
|
|
164
|
+
eventFilter: he(l?.updateThrottle ?? 500)
|
|
160
165
|
}
|
|
161
|
-
), I = F(
|
|
166
|
+
), I = F(i), R = F(u), Z = U({
|
|
162
167
|
name: "VvForm",
|
|
163
168
|
props: {
|
|
164
169
|
continuousValidation: {
|
|
@@ -171,7 +176,7 @@ function $e(e, t, u, g, a) {
|
|
|
171
176
|
},
|
|
172
177
|
readonly: {
|
|
173
178
|
type: Boolean,
|
|
174
|
-
default:
|
|
179
|
+
default: l?.readonly
|
|
175
180
|
},
|
|
176
181
|
tag: {
|
|
177
182
|
type: String,
|
|
@@ -212,62 +217,62 @@ function $e(e, t, u, g, a) {
|
|
|
212
217
|
"reset"
|
|
213
218
|
],
|
|
214
219
|
slots: Object,
|
|
215
|
-
setup(
|
|
216
|
-
return r.value = d(N(
|
|
217
|
-
() =>
|
|
220
|
+
setup(O, { emit: _ }) {
|
|
221
|
+
return r.value = d(N(O.modelValue)), z(
|
|
222
|
+
() => O.modelValue,
|
|
218
223
|
(n) => {
|
|
219
224
|
if (n) {
|
|
220
|
-
const j =
|
|
225
|
+
const j = ce(n) ? N(n) : n;
|
|
221
226
|
if (JSON.stringify(j) === JSON.stringify(N(r.value)))
|
|
222
227
|
return;
|
|
223
228
|
r.value = typeof j?.clone == "function" ? j.clone() : JSON.parse(JSON.stringify(j));
|
|
224
229
|
}
|
|
225
230
|
},
|
|
226
231
|
{ deep: !0 }
|
|
227
|
-
),
|
|
232
|
+
), z(u, async (n) => {
|
|
228
233
|
if (n === S.invalid) {
|
|
229
|
-
const j = N(
|
|
230
|
-
_("invalid", j),
|
|
234
|
+
const j = N(i.value);
|
|
235
|
+
_("invalid", j), l?.onInvalid?.(
|
|
231
236
|
j
|
|
232
237
|
);
|
|
233
238
|
return;
|
|
234
239
|
}
|
|
235
240
|
if (n === S.valid) {
|
|
236
241
|
const j = N(r.value);
|
|
237
|
-
_("valid", j),
|
|
242
|
+
_("valid", j), l?.onValid?.(j), _("update:modelValue", j), l?.onUpdate?.(j);
|
|
238
243
|
return;
|
|
239
244
|
}
|
|
240
245
|
if (n === S.submitting) {
|
|
241
246
|
const j = N(r.value);
|
|
242
|
-
_("submit", j),
|
|
247
|
+
_("submit", j), l?.onSubmit?.(j);
|
|
243
248
|
return;
|
|
244
249
|
}
|
|
245
250
|
if (n === S.reset) {
|
|
246
251
|
const j = N(r.value);
|
|
247
|
-
_("reset", j),
|
|
252
|
+
_("reset", j), l?.onReset?.(j);
|
|
248
253
|
return;
|
|
249
254
|
}
|
|
250
255
|
if (n === S.updated) {
|
|
251
|
-
if ((
|
|
252
|
-
superRefine:
|
|
253
|
-
fields: o ?? new Set(
|
|
254
|
-
}), !r.value || !
|
|
256
|
+
if ((i.value || l?.continuousValidation || O.continuousValidation) && await c(void 0, {
|
|
257
|
+
superRefine: O.superRefine,
|
|
258
|
+
fields: o ?? new Set(O.validateFields)
|
|
259
|
+
}), !r.value || !O.modelValue || JSON.stringify(r.value) !== JSON.stringify(O.modelValue)) {
|
|
255
260
|
const j = N(r.value);
|
|
256
|
-
_("update:modelValue", j),
|
|
261
|
+
_("update:modelValue", j), l?.onUpdate?.(j);
|
|
257
262
|
}
|
|
258
|
-
|
|
263
|
+
u.value === S.updated && (u.value = S.unknown);
|
|
259
264
|
}
|
|
260
265
|
}), H(() => {
|
|
261
|
-
|
|
262
|
-
}),
|
|
263
|
-
() =>
|
|
266
|
+
O.readonly !== void 0 && (v.value = O.readonly);
|
|
267
|
+
}), z(
|
|
268
|
+
() => O.readonly,
|
|
264
269
|
(n) => {
|
|
265
270
|
v.value = n;
|
|
266
271
|
}
|
|
267
|
-
),
|
|
268
|
-
n !==
|
|
272
|
+
), z(v, (n) => {
|
|
273
|
+
n !== O.readonly && _("update:readonly", v.value);
|
|
269
274
|
}), Q(t, {
|
|
270
|
-
clear:
|
|
275
|
+
clear: w,
|
|
271
276
|
errors: I,
|
|
272
277
|
formData: r,
|
|
273
278
|
ignoreUpdates: y,
|
|
@@ -280,7 +285,7 @@ function $e(e, t, u, g, a) {
|
|
|
280
285
|
validate: c,
|
|
281
286
|
wrappers: a
|
|
282
287
|
}), {
|
|
283
|
-
clear:
|
|
288
|
+
clear: w,
|
|
284
289
|
errors: I,
|
|
285
290
|
formData: r,
|
|
286
291
|
ignoreUpdates: y,
|
|
@@ -290,67 +295,67 @@ function $e(e, t, u, g, a) {
|
|
|
290
295
|
status: R,
|
|
291
296
|
stopUpdatesWatch: b,
|
|
292
297
|
submit: () => m({
|
|
293
|
-
superRefine:
|
|
294
|
-
fields: new Set(
|
|
298
|
+
superRefine: O.superRefine,
|
|
299
|
+
fields: new Set(O.validateFields)
|
|
295
300
|
}),
|
|
296
301
|
validate: c,
|
|
297
302
|
wrappers: a
|
|
298
303
|
};
|
|
299
304
|
},
|
|
300
305
|
render() {
|
|
301
|
-
const
|
|
306
|
+
const O = () => this.$slots?.default?.({
|
|
302
307
|
errors: I.value,
|
|
303
308
|
formData: r.value,
|
|
304
309
|
invalid: f.value,
|
|
305
310
|
readonly: v.value,
|
|
306
311
|
status: R.value,
|
|
307
312
|
wrappers: a,
|
|
308
|
-
clear:
|
|
313
|
+
clear: w,
|
|
309
314
|
ignoreUpdates: y,
|
|
310
315
|
reset: p,
|
|
311
316
|
stopUpdatesWatch: b,
|
|
312
317
|
submit: m,
|
|
313
318
|
validate: c
|
|
314
319
|
}) ?? this.$slots.default;
|
|
315
|
-
return
|
|
320
|
+
return E(
|
|
316
321
|
this.tag,
|
|
317
322
|
{
|
|
318
323
|
onSubmit: re(this.submit, ["prevent"]),
|
|
319
324
|
onReset: re(this.reset, ["prevent"])
|
|
320
325
|
},
|
|
321
|
-
(this.template ??
|
|
322
|
-
|
|
326
|
+
(this.template ?? l?.template) && g ? [
|
|
327
|
+
E(
|
|
323
328
|
g,
|
|
324
329
|
{
|
|
325
|
-
schema: this.template ??
|
|
330
|
+
schema: this.template ?? l?.template
|
|
326
331
|
},
|
|
327
332
|
{
|
|
328
|
-
default:
|
|
333
|
+
default: O
|
|
329
334
|
}
|
|
330
335
|
)
|
|
331
336
|
] : {
|
|
332
|
-
default:
|
|
337
|
+
default: O
|
|
333
338
|
}
|
|
334
339
|
);
|
|
335
340
|
}
|
|
336
341
|
});
|
|
337
342
|
return {
|
|
338
|
-
clear:
|
|
339
|
-
errors:
|
|
343
|
+
clear: w,
|
|
344
|
+
errors: i,
|
|
340
345
|
formData: r,
|
|
341
346
|
ignoreUpdates: y,
|
|
342
347
|
invalid: f,
|
|
343
348
|
readonly: v,
|
|
344
349
|
reset: p,
|
|
345
|
-
status:
|
|
350
|
+
status: u,
|
|
346
351
|
wrappers: a,
|
|
347
352
|
stopUpdatesWatch: b,
|
|
348
353
|
submit: m,
|
|
349
354
|
validate: c,
|
|
350
|
-
VvForm:
|
|
355
|
+
VvForm: Z
|
|
351
356
|
};
|
|
352
357
|
}
|
|
353
|
-
function
|
|
358
|
+
function Be(e, t, l, g) {
|
|
354
359
|
return U({
|
|
355
360
|
name: "VvFormField",
|
|
356
361
|
props: {
|
|
@@ -404,13 +409,13 @@ function Ge(e, t, u, g) {
|
|
|
404
409
|
"type"
|
|
405
410
|
],
|
|
406
411
|
slots: Object,
|
|
407
|
-
setup(a, { slots:
|
|
412
|
+
setup(a, { slots: i, emit: u }) {
|
|
408
413
|
const { props: f, name: r } = Y(a), v = ae(), o = G(t, void 0);
|
|
409
414
|
o && o.fields.value.set(v, a.name);
|
|
410
|
-
const d = G(e), c =
|
|
415
|
+
const d = G(e), c = D({
|
|
411
416
|
get() {
|
|
412
417
|
if (d?.formData)
|
|
413
|
-
return
|
|
418
|
+
return W(
|
|
414
419
|
new Object(d.formData.value),
|
|
415
420
|
String(a.name)
|
|
416
421
|
);
|
|
@@ -420,7 +425,7 @@ function Ge(e, t, u, g) {
|
|
|
420
425
|
new Object(d.formData.value),
|
|
421
426
|
String(a.name),
|
|
422
427
|
n
|
|
423
|
-
),
|
|
428
|
+
), u("update:modelValue", {
|
|
424
429
|
newValue: c.value,
|
|
425
430
|
formData: d?.formData
|
|
426
431
|
}));
|
|
@@ -431,24 +436,24 @@ function Ge(e, t, u, g) {
|
|
|
431
436
|
}), L(() => {
|
|
432
437
|
o && o.fields.value.delete(v);
|
|
433
438
|
});
|
|
434
|
-
const
|
|
439
|
+
const w = D(() => {
|
|
435
440
|
if (d?.errors.value)
|
|
436
|
-
return
|
|
437
|
-
}), p =
|
|
441
|
+
return W(d.errors.value, String(a.name));
|
|
442
|
+
}), p = D(() => w.value?._errors), m = D(() => w.value !== void 0), y = z(m, (n) => {
|
|
438
443
|
if (n) {
|
|
439
|
-
|
|
444
|
+
u("invalid", w.value), o && o.errors.value.set(
|
|
440
445
|
String(a.name),
|
|
441
|
-
|
|
446
|
+
w.value
|
|
442
447
|
);
|
|
443
448
|
return;
|
|
444
449
|
}
|
|
445
|
-
|
|
450
|
+
u("valid", c.value), o && o.errors.value.delete(
|
|
446
451
|
a.name
|
|
447
452
|
);
|
|
448
|
-
}), b =
|
|
453
|
+
}), b = z(
|
|
449
454
|
() => d?.formData,
|
|
450
455
|
() => {
|
|
451
|
-
|
|
456
|
+
u("update:formData", d?.formData);
|
|
452
457
|
},
|
|
453
458
|
{ deep: !0 }
|
|
454
459
|
);
|
|
@@ -457,13 +462,13 @@ function Ge(e, t, u, g) {
|
|
|
457
462
|
});
|
|
458
463
|
const I = (n) => {
|
|
459
464
|
n instanceof InputEvent && (n = n.target.value), c.value = n;
|
|
460
|
-
}, R =
|
|
465
|
+
}, R = D(() => {
|
|
461
466
|
let n = f.value;
|
|
462
467
|
return typeof n == "function" && (n = n(d?.formData)), Object.keys(n).reduce(
|
|
463
|
-
(j, A) => (j[A] =
|
|
468
|
+
(j, A) => (j[A] = P(n[A]), j),
|
|
464
469
|
{}
|
|
465
470
|
);
|
|
466
|
-
}),
|
|
471
|
+
}), Z = D(() => d?.readonly.value || o?.readonly.value ? !0 : R.value.readonly ?? a.readonly), O = D(() => ({
|
|
467
472
|
...R.value,
|
|
468
473
|
name: R.value.name ?? a.name,
|
|
469
474
|
invalid: m.value,
|
|
@@ -488,28 +493,28 @@ function Ge(e, t, u, g) {
|
|
|
488
493
|
})(a.type),
|
|
489
494
|
invalidLabel: p.value,
|
|
490
495
|
modelValue: c.value,
|
|
491
|
-
readonly:
|
|
496
|
+
readonly: Z.value,
|
|
492
497
|
"onUpdate:modelValue": I
|
|
493
498
|
}));
|
|
494
|
-
return Q(
|
|
499
|
+
return Q(l, {
|
|
495
500
|
name: F(r),
|
|
496
|
-
errors: F(
|
|
497
|
-
}), { component:
|
|
501
|
+
errors: F(w)
|
|
502
|
+
}), { component: D(() => {
|
|
498
503
|
if (a.type === V.custom)
|
|
499
504
|
return {
|
|
500
505
|
render() {
|
|
501
|
-
return
|
|
502
|
-
errors:
|
|
506
|
+
return i.default?.({
|
|
507
|
+
errors: w.value,
|
|
503
508
|
formData: d?.formData.value,
|
|
504
509
|
formErrors: d?.errors.value,
|
|
505
510
|
invalid: m.value,
|
|
506
511
|
invalidLabel: p.value,
|
|
507
512
|
modelValue: c.value,
|
|
508
|
-
readonly:
|
|
513
|
+
readonly: Z.value,
|
|
509
514
|
onUpdate: I,
|
|
510
515
|
submit: d?.submit,
|
|
511
516
|
validate: d?.validate
|
|
512
|
-
}) ??
|
|
517
|
+
}) ?? i.default;
|
|
513
518
|
}
|
|
514
519
|
};
|
|
515
520
|
if (!(g?.lazyLoad ?? a.lazyLoad)) {
|
|
@@ -545,7 +550,7 @@ function Ge(e, t, u, g) {
|
|
|
545
550
|
`[@volverjs/form-vue]: ${n} not found, the component will be loaded asynchronously. To avoid this warning, please set "lazyLoad" option.`
|
|
546
551
|
);
|
|
547
552
|
}
|
|
548
|
-
return
|
|
553
|
+
return me(async () => {
|
|
549
554
|
switch (g?.sideEffects && await Promise.resolve(g.sideEffects(a.type)), a.type) {
|
|
550
555
|
case V.textarea:
|
|
551
556
|
return import("@volverjs/ui-vue/vv-textarea");
|
|
@@ -564,14 +569,14 @@ function Ge(e, t, u, g) {
|
|
|
564
569
|
}
|
|
565
570
|
return import("@volverjs/ui-vue/vv-input-text");
|
|
566
571
|
});
|
|
567
|
-
}), hasProps:
|
|
572
|
+
}), hasProps: O, invalid: m };
|
|
568
573
|
},
|
|
569
574
|
render() {
|
|
570
|
-
return this.is ?
|
|
575
|
+
return this.is ? E(this.is, this.hasProps, this.$slots) : this.type === V.custom ? E(this.component, null, this.$slots) : E(this.component, this.hasProps, this.$slots);
|
|
571
576
|
}
|
|
572
577
|
});
|
|
573
578
|
}
|
|
574
|
-
function
|
|
579
|
+
function Pe(e, t, l) {
|
|
575
580
|
return U({
|
|
576
581
|
name: "VvFormFieldsGroup",
|
|
577
582
|
props: {
|
|
@@ -615,133 +620,133 @@ function ke(e, t, u) {
|
|
|
615
620
|
"is"
|
|
616
621
|
],
|
|
617
622
|
slots: Object,
|
|
618
|
-
setup(g, { slots: a, emit:
|
|
619
|
-
const { props:
|
|
620
|
-
p && o.value.forEach((
|
|
621
|
-
p.fields.value.set(`${v}-${
|
|
623
|
+
setup(g, { slots: a, emit: i }) {
|
|
624
|
+
const { props: u, names: f, defaultValues: r } = Y(g), v = ae(), o = D(() => Array.isArray(f.value) ? f.value : Object.values(f.value)), d = D(() => Array.isArray(f.value) ? f.value : Object.keys(f.value)), c = D(() => Array.isArray(f.value) ? f.value.reduce((s, h) => (s[String(h)] = h, s), {}) : f.value), w = D(() => Object.keys(c.value).reduce((s, h) => (s[String(c.value[h])] = h, s), {})), p = G(t, void 0);
|
|
625
|
+
p && o.value.forEach((s) => {
|
|
626
|
+
p.fields.value.set(`${v}-${s}`, s);
|
|
622
627
|
});
|
|
623
|
-
const m = G(e), y =
|
|
628
|
+
const m = G(e), y = D({
|
|
624
629
|
get() {
|
|
625
|
-
return m?.formData ? d.value.reduce((
|
|
630
|
+
return m?.formData ? d.value.reduce((s, h) => (s[h] = W(
|
|
626
631
|
new Object(m.formData.value),
|
|
627
632
|
c.value[h]
|
|
628
|
-
),
|
|
633
|
+
), s), {}) : {};
|
|
629
634
|
},
|
|
630
|
-
set(
|
|
635
|
+
set(s) {
|
|
631
636
|
m?.formData && (d.value.forEach((h) => {
|
|
632
637
|
oe(
|
|
633
638
|
new Object(m.formData.value),
|
|
634
639
|
c.value[h],
|
|
635
|
-
|
|
640
|
+
s?.[h]
|
|
636
641
|
);
|
|
637
|
-
}),
|
|
642
|
+
}), i("update:modelValue", {
|
|
638
643
|
newValue: y.value,
|
|
639
644
|
formData: m?.formData
|
|
640
645
|
}));
|
|
641
646
|
}
|
|
642
647
|
});
|
|
643
648
|
H(() => {
|
|
644
|
-
r.value && o.value.forEach((
|
|
645
|
-
r.value?.[
|
|
649
|
+
r.value && o.value.forEach((s) => {
|
|
650
|
+
r.value?.[s] !== void 0 && y.value[s] === void 0 && (y.value = {
|
|
646
651
|
...y.value,
|
|
647
|
-
[
|
|
652
|
+
[s]: r.value?.[s]
|
|
648
653
|
});
|
|
649
654
|
});
|
|
650
655
|
}), L(() => {
|
|
651
|
-
p && o.value.forEach((
|
|
656
|
+
p && o.value.forEach((s) => {
|
|
652
657
|
p.fields.value.delete(
|
|
653
|
-
`${v}-${
|
|
658
|
+
`${v}-${s}`
|
|
654
659
|
);
|
|
655
660
|
});
|
|
656
661
|
});
|
|
657
|
-
const b =
|
|
662
|
+
const b = D(() => {
|
|
658
663
|
if (!m?.errors.value)
|
|
659
664
|
return;
|
|
660
|
-
const
|
|
665
|
+
const s = o.value.reduce((h, x) => {
|
|
661
666
|
if (!m.errors.value)
|
|
662
667
|
return h;
|
|
663
|
-
const te =
|
|
668
|
+
const te = W(m.errors.value, String(x));
|
|
664
669
|
return te === void 0 || (h[String(x)] = te), h;
|
|
665
670
|
}, {});
|
|
666
|
-
if (Object.keys(
|
|
667
|
-
return
|
|
668
|
-
}), I =
|
|
671
|
+
if (Object.keys(s).length !== 0)
|
|
672
|
+
return s;
|
|
673
|
+
}), I = D(() => {
|
|
669
674
|
if (!b.value)
|
|
670
675
|
return;
|
|
671
|
-
const
|
|
672
|
-
if (Object.keys(
|
|
673
|
-
return
|
|
674
|
-
}), R =
|
|
676
|
+
const s = Object.keys(b.value).reduce((h, x) => (b.value?.[x] && (h[w.value[x]] = b.value[x]._errors), h), {});
|
|
677
|
+
if (Object.keys(s).length !== 0)
|
|
678
|
+
return s;
|
|
679
|
+
}), R = D(() => b.value !== void 0), Z = D(() => d.value.reduce((s, h) => (s[h] = !!b.value?.[w.value[h]], s), {})), O = z(R, () => {
|
|
675
680
|
if (R.value) {
|
|
676
|
-
|
|
677
|
-
if (!b.value?.[
|
|
681
|
+
i("invalid", b.value), p && o.value.forEach((s) => {
|
|
682
|
+
if (!b.value?.[s]) {
|
|
678
683
|
p.errors.value.delete(
|
|
679
|
-
|
|
684
|
+
s
|
|
680
685
|
);
|
|
681
686
|
return;
|
|
682
687
|
}
|
|
683
688
|
p.errors.value.set(
|
|
684
|
-
|
|
685
|
-
b.value?.[
|
|
689
|
+
s,
|
|
690
|
+
b.value?.[s]
|
|
686
691
|
);
|
|
687
692
|
});
|
|
688
693
|
return;
|
|
689
694
|
}
|
|
690
|
-
|
|
695
|
+
i("valid", y.value), p && o.value.forEach((s) => {
|
|
691
696
|
p.errors.value.delete(
|
|
692
|
-
|
|
697
|
+
s
|
|
693
698
|
);
|
|
694
699
|
});
|
|
695
|
-
}), _ =
|
|
700
|
+
}), _ = z(
|
|
696
701
|
() => m?.formData,
|
|
697
702
|
() => {
|
|
698
|
-
|
|
703
|
+
i("update:formData", m?.formData);
|
|
699
704
|
},
|
|
700
705
|
{ deep: !0 }
|
|
701
706
|
);
|
|
702
707
|
L(() => {
|
|
703
|
-
|
|
708
|
+
O(), _();
|
|
704
709
|
});
|
|
705
|
-
const n = (
|
|
706
|
-
y.value =
|
|
707
|
-
}, j = (
|
|
708
|
-
h instanceof InputEvent && (h = h.target.value), d.value.includes(
|
|
710
|
+
const n = (s) => {
|
|
711
|
+
y.value = s;
|
|
712
|
+
}, j = (s, h) => {
|
|
713
|
+
h instanceof InputEvent && (h = h.target.value), d.value.includes(s) && (y.value = {
|
|
709
714
|
...y.value,
|
|
710
|
-
[
|
|
715
|
+
[s]: h
|
|
711
716
|
});
|
|
712
|
-
}, A =
|
|
713
|
-
let
|
|
714
|
-
return typeof
|
|
715
|
-
(h, x) => (h[x] =
|
|
717
|
+
}, A = D(() => {
|
|
718
|
+
let s = u.value;
|
|
719
|
+
return typeof s == "function" && (s = s(m?.formData)), Object.keys(s).reduce(
|
|
720
|
+
(h, x) => (h[x] = P(s[x]), h),
|
|
716
721
|
{}
|
|
717
722
|
);
|
|
718
|
-
}), ee =
|
|
723
|
+
}), ee = D(() => m?.readonly.value ? !0 : A.value.readonly ?? g.readonly), fe = D(() => d.value.reduce((s, h) => (s[`onUpdate:${h}`] = (x) => {
|
|
719
724
|
j(h, x);
|
|
720
|
-
},
|
|
725
|
+
}, s), {
|
|
721
726
|
"onUpdate:modelValue": n
|
|
722
|
-
})),
|
|
723
|
-
...
|
|
727
|
+
})), ve = D(() => ({
|
|
728
|
+
...fe.value,
|
|
724
729
|
...A.value,
|
|
725
730
|
...y.value,
|
|
726
731
|
modelValue: y.value,
|
|
727
732
|
names: A.value.name ?? o.value,
|
|
728
733
|
invalid: R.value,
|
|
729
|
-
invalids:
|
|
734
|
+
invalids: Z.value,
|
|
730
735
|
valid: g.showValid ? !!(!R.value && y.value) : void 0,
|
|
731
736
|
invalidLabels: I.value,
|
|
732
737
|
readonly: ee.value
|
|
733
738
|
}));
|
|
734
|
-
return Q(
|
|
739
|
+
return Q(l, {
|
|
735
740
|
names: F(f),
|
|
736
741
|
errors: F(b)
|
|
737
|
-
}), { component:
|
|
742
|
+
}), { component: D(() => ({
|
|
738
743
|
render() {
|
|
739
744
|
return a.default?.({
|
|
740
745
|
errors: b.value,
|
|
741
746
|
formData: m?.formData.value,
|
|
742
747
|
formErrors: m?.errors.value,
|
|
743
748
|
invalid: R.value,
|
|
744
|
-
invalids:
|
|
749
|
+
invalids: Z.value,
|
|
745
750
|
invalidLabels: I.value,
|
|
746
751
|
modelValue: y.value,
|
|
747
752
|
onUpdate: n,
|
|
@@ -751,14 +756,14 @@ function ke(e, t, u) {
|
|
|
751
756
|
validate: m?.validate
|
|
752
757
|
}) ?? a.default;
|
|
753
758
|
}
|
|
754
|
-
})), hasProps:
|
|
759
|
+
})), hasProps: ve, invalid: R };
|
|
755
760
|
},
|
|
756
761
|
render() {
|
|
757
|
-
return this.is ?
|
|
762
|
+
return this.is ? E(this.is, this.hasProps, this.$slots) : E(this.component, null, this.$slots);
|
|
758
763
|
}
|
|
759
764
|
});
|
|
760
765
|
}
|
|
761
|
-
function
|
|
766
|
+
function We(e, t) {
|
|
762
767
|
return U({
|
|
763
768
|
name: "VvFormWrapper",
|
|
764
769
|
props: {
|
|
@@ -791,41 +796,41 @@ function Be(e, t) {
|
|
|
791
796
|
"validateWrapper"
|
|
792
797
|
],
|
|
793
798
|
slots: Object,
|
|
794
|
-
setup(
|
|
795
|
-
const a = G(e),
|
|
796
|
-
|
|
799
|
+
setup(l, { emit: g }) {
|
|
800
|
+
const a = G(e), i = G(t, void 0), u = B(/* @__PURE__ */ new Map()), f = B(/* @__PURE__ */ new Map()), { name: r } = Y(l), v = D(() => a?.invalid.value ? f.value.size > 0 : !1);
|
|
801
|
+
z(v, (p) => {
|
|
797
802
|
if (p) {
|
|
798
803
|
g("invalid");
|
|
799
804
|
return;
|
|
800
805
|
}
|
|
801
806
|
g("valid");
|
|
802
807
|
});
|
|
803
|
-
const o =
|
|
808
|
+
const o = D(() => a?.readonly.value || l.readonly), d = {
|
|
804
809
|
name: F(r),
|
|
805
810
|
errors: f,
|
|
806
811
|
invalid: F(v),
|
|
807
812
|
readonly: F(o),
|
|
808
|
-
fields:
|
|
813
|
+
fields: u
|
|
809
814
|
};
|
|
810
815
|
Q(t, d);
|
|
811
|
-
const c =
|
|
812
|
-
|
|
816
|
+
const c = D(() => new Map(u.value));
|
|
817
|
+
z(
|
|
813
818
|
c,
|
|
814
819
|
(p, m) => {
|
|
815
|
-
|
|
816
|
-
p.has(b) ||
|
|
820
|
+
i?.fields && (m.forEach((y, b) => {
|
|
821
|
+
p.has(b) || i?.fields.value.delete(b);
|
|
817
822
|
}), p.forEach((y, b) => {
|
|
818
|
-
|
|
823
|
+
i?.fields.value.has(b) || i?.fields.value.set(b, y);
|
|
819
824
|
}));
|
|
820
825
|
},
|
|
821
826
|
{ deep: !0 }
|
|
822
|
-
),
|
|
827
|
+
), z(
|
|
823
828
|
f,
|
|
824
829
|
(p) => {
|
|
825
|
-
|
|
826
|
-
if (p.has(m) ||
|
|
830
|
+
i?.errors && u.value.forEach((m) => {
|
|
831
|
+
if (p.has(m) || i.errors.value.delete(m), p.has(m)) {
|
|
827
832
|
const y = p.get(m);
|
|
828
|
-
y &&
|
|
833
|
+
y && i.errors.value.set(m, y);
|
|
829
834
|
}
|
|
830
835
|
});
|
|
831
836
|
},
|
|
@@ -843,10 +848,10 @@ function Be(e, t) {
|
|
|
843
848
|
}), L(() => {
|
|
844
849
|
a?.wrappers && r.value && a.wrappers.delete(r.value);
|
|
845
850
|
});
|
|
846
|
-
const
|
|
851
|
+
const w = () => a?.validate(void 0, { fields: new Set(u.value.values()) }) ?? Promise.resolve(!0);
|
|
847
852
|
return {
|
|
848
853
|
errors: a?.errors,
|
|
849
|
-
fields:
|
|
854
|
+
fields: u,
|
|
850
855
|
fieldsErrors: f,
|
|
851
856
|
formData: a?.formData,
|
|
852
857
|
invalid: v,
|
|
@@ -855,11 +860,11 @@ function Be(e, t) {
|
|
|
855
860
|
reset: a?.reset,
|
|
856
861
|
submit: a?.submit,
|
|
857
862
|
validate: a?.validate,
|
|
858
|
-
validateWrapper:
|
|
863
|
+
validateWrapper: w
|
|
859
864
|
};
|
|
860
865
|
},
|
|
861
866
|
render() {
|
|
862
|
-
const
|
|
867
|
+
const l = () => this.$slots.default?.({
|
|
863
868
|
errors: this.errors,
|
|
864
869
|
fieldsErrors: this.fieldsErrors,
|
|
865
870
|
formData: this.formData,
|
|
@@ -871,14 +876,14 @@ function Be(e, t) {
|
|
|
871
876
|
validate: this.validate,
|
|
872
877
|
validateWrapper: this.validateWrapper
|
|
873
878
|
});
|
|
874
|
-
return this.tag ?
|
|
875
|
-
default:
|
|
876
|
-
}) :
|
|
879
|
+
return this.tag ? E(this.tag, null, {
|
|
880
|
+
default: l
|
|
881
|
+
}) : l();
|
|
877
882
|
}
|
|
878
883
|
});
|
|
879
884
|
}
|
|
880
|
-
function
|
|
881
|
-
const
|
|
885
|
+
function Le(e, t) {
|
|
886
|
+
const l = U({
|
|
882
887
|
name: "VvFormTemplate",
|
|
883
888
|
props: {
|
|
884
889
|
schema: {
|
|
@@ -892,121 +897,121 @@ function We(e, t) {
|
|
|
892
897
|
},
|
|
893
898
|
slots: Object,
|
|
894
899
|
setup(g, { slots: a }) {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
900
|
+
const i = G(e);
|
|
901
|
+
if (i?.formData)
|
|
897
902
|
return () => {
|
|
898
|
-
const
|
|
899
|
-
|
|
903
|
+
const u = typeof g.schema == "function" ? g.schema(
|
|
904
|
+
i,
|
|
900
905
|
g.scope
|
|
901
906
|
) : g.schema;
|
|
902
907
|
let f;
|
|
903
|
-
const r =
|
|
904
|
-
const d = typeof o == "function" ? o(
|
|
908
|
+
const r = u.reduce((v, o) => {
|
|
909
|
+
const d = typeof o == "function" ? o(i, g.scope) : o, {
|
|
905
910
|
vvIs: c,
|
|
906
|
-
vvName:
|
|
911
|
+
vvName: w,
|
|
907
912
|
vvSlots: p,
|
|
908
913
|
vvChildren: m,
|
|
909
914
|
vvIf: y,
|
|
910
915
|
vvElseIf: b,
|
|
911
916
|
vvType: I,
|
|
912
917
|
vvDefaultValue: R,
|
|
913
|
-
vvShowValid:
|
|
914
|
-
vvContent:
|
|
918
|
+
vvShowValid: Z,
|
|
919
|
+
vvContent: O,
|
|
915
920
|
..._
|
|
916
921
|
} = d;
|
|
917
922
|
if (y !== void 0) {
|
|
918
|
-
if (typeof y == "string" ? f = !!
|
|
919
|
-
new Object(
|
|
923
|
+
if (typeof y == "string" ? f = !!W(
|
|
924
|
+
new Object(i.formData.value),
|
|
920
925
|
y
|
|
921
|
-
) : typeof y == "function" ? f =
|
|
926
|
+
) : typeof y == "function" ? f = P(y(i)) : f = P(y), !f)
|
|
922
927
|
return v;
|
|
923
928
|
} else if (b !== void 0 && f !== void 0) {
|
|
924
|
-
if (f || (typeof b == "string" ? f = !!
|
|
925
|
-
new Object(
|
|
929
|
+
if (f || (typeof b == "string" ? f = !!W(
|
|
930
|
+
new Object(i.formData.value),
|
|
926
931
|
b
|
|
927
|
-
) : typeof b == "function" ? f =
|
|
932
|
+
) : typeof b == "function" ? f = P(b(i)) : f = P(b), !f))
|
|
928
933
|
return v;
|
|
929
934
|
} else
|
|
930
935
|
f = void 0;
|
|
931
936
|
let n;
|
|
932
|
-
return m && (typeof c == "string" ? n =
|
|
937
|
+
return m && (typeof c == "string" ? n = E(l, {
|
|
933
938
|
schema: m
|
|
934
939
|
}) : n = {
|
|
935
|
-
default: (j) =>
|
|
940
|
+
default: (j) => E(l, {
|
|
936
941
|
schema: m,
|
|
937
942
|
scope: j
|
|
938
943
|
})
|
|
939
|
-
}),
|
|
940
|
-
|
|
944
|
+
}), w ? (v.push(
|
|
945
|
+
E(
|
|
941
946
|
t,
|
|
942
947
|
{
|
|
943
|
-
name:
|
|
948
|
+
name: w,
|
|
944
949
|
is: c,
|
|
945
950
|
type: I,
|
|
946
951
|
defaultValue: R,
|
|
947
|
-
showValid:
|
|
952
|
+
showValid: Z,
|
|
948
953
|
props: _
|
|
949
954
|
},
|
|
950
|
-
p ?? n ??
|
|
955
|
+
p ?? n ?? O
|
|
951
956
|
)
|
|
952
957
|
), v) : c ? (v.push(
|
|
953
|
-
|
|
958
|
+
E(
|
|
954
959
|
c,
|
|
955
960
|
_,
|
|
956
|
-
p ?? n ??
|
|
961
|
+
p ?? n ?? O
|
|
957
962
|
)
|
|
958
963
|
), v) : (n && ("default" in n ? v.push(n.default(g.scope)) : v.push(n)), v);
|
|
959
964
|
}, []);
|
|
960
965
|
return r.push(
|
|
961
966
|
a?.default?.({
|
|
962
|
-
errors:
|
|
963
|
-
formData:
|
|
964
|
-
invalid:
|
|
965
|
-
status:
|
|
966
|
-
submit:
|
|
967
|
-
validate:
|
|
968
|
-
clear:
|
|
969
|
-
reset:
|
|
967
|
+
errors: i?.errors.value,
|
|
968
|
+
formData: i?.formData.value,
|
|
969
|
+
invalid: i?.invalid.value,
|
|
970
|
+
status: i?.status.value,
|
|
971
|
+
submit: i?.submit,
|
|
972
|
+
validate: i?.validate,
|
|
973
|
+
clear: i?.clear,
|
|
974
|
+
reset: i?.reset
|
|
970
975
|
})
|
|
971
976
|
), r;
|
|
972
977
|
};
|
|
973
978
|
}
|
|
974
979
|
});
|
|
975
|
-
return
|
|
980
|
+
return l;
|
|
976
981
|
}
|
|
977
982
|
function q(e, t = {}) {
|
|
978
|
-
const
|
|
979
|
-
|
|
983
|
+
const l = Symbol("formInjectionKey"), g = Symbol("formWrapperInjectionKey"), a = Symbol("formFieldInjectionKey"), i = Symbol("formFieldsGroupInjectionKey"), u = We(
|
|
984
|
+
l,
|
|
980
985
|
g
|
|
981
|
-
), f =
|
|
982
|
-
|
|
986
|
+
), f = Be(
|
|
987
|
+
l,
|
|
983
988
|
g,
|
|
984
989
|
a,
|
|
985
990
|
t
|
|
986
|
-
), r =
|
|
987
|
-
|
|
991
|
+
), r = Pe(
|
|
992
|
+
l,
|
|
988
993
|
g,
|
|
989
|
-
|
|
990
|
-
), v =
|
|
994
|
+
i
|
|
995
|
+
), v = Le(l, f), o = /* @__PURE__ */ new Map(), {
|
|
991
996
|
clear: d,
|
|
992
997
|
errors: c,
|
|
993
|
-
formData:
|
|
998
|
+
formData: w,
|
|
994
999
|
ignoreUpdates: p,
|
|
995
1000
|
invalid: m,
|
|
996
1001
|
readonly: y,
|
|
997
1002
|
reset: b,
|
|
998
1003
|
status: I,
|
|
999
1004
|
stopUpdatesWatch: R,
|
|
1000
|
-
submit:
|
|
1001
|
-
validate:
|
|
1005
|
+
submit: Z,
|
|
1006
|
+
validate: O,
|
|
1002
1007
|
VvForm: _
|
|
1003
|
-
} =
|
|
1008
|
+
} = ke(e, l, t, v, o);
|
|
1004
1009
|
return {
|
|
1005
1010
|
clear: d,
|
|
1006
1011
|
errors: c,
|
|
1007
|
-
formData:
|
|
1012
|
+
formData: w,
|
|
1008
1013
|
formFieldInjectionKey: a,
|
|
1009
|
-
formInjectionKey:
|
|
1014
|
+
formInjectionKey: l,
|
|
1010
1015
|
formWrapperInjectionKey: g,
|
|
1011
1016
|
ignoreUpdates: p,
|
|
1012
1017
|
invalid: m,
|
|
@@ -1014,51 +1019,51 @@ function q(e, t = {}) {
|
|
|
1014
1019
|
reset: b,
|
|
1015
1020
|
status: I,
|
|
1016
1021
|
stopUpdatesWatch: R,
|
|
1017
|
-
submit:
|
|
1018
|
-
validate:
|
|
1022
|
+
submit: Z,
|
|
1023
|
+
validate: O,
|
|
1019
1024
|
wrappers: o,
|
|
1020
1025
|
VvForm: _,
|
|
1021
1026
|
VvFormField: f,
|
|
1022
1027
|
VvFormFieldsGroup: r,
|
|
1023
1028
|
VvFormTemplate: v,
|
|
1024
|
-
VvFormWrapper:
|
|
1029
|
+
VvFormWrapper: u
|
|
1025
1030
|
};
|
|
1026
1031
|
}
|
|
1027
|
-
const
|
|
1028
|
-
function
|
|
1032
|
+
const de = Symbol("pluginInjectionKey");
|
|
1033
|
+
function qe(e) {
|
|
1029
1034
|
let t = {};
|
|
1030
1035
|
return e.schema && (t = q(e.schema, e)), {
|
|
1031
1036
|
...t,
|
|
1032
|
-
install(
|
|
1033
|
-
|
|
1037
|
+
install(l, { global: g = !1 } = {}) {
|
|
1038
|
+
l.provide(de, e), g && (l.config.globalProperties.$vvForm = e, t?.VvForm && l.component("VvForm", t.VvForm), t?.VvFormWrapper && l.component("VvFormWrapper", t.VvFormWrapper), t?.VvFormField && l.component("VvFormField", t.VvFormField), t?.VvFormFieldsGroup && l.component("VvFormFieldsGroup", t.VvFormFieldsGroup), t?.VvFormTemplate && l.component("VvFormTemplate", t.VvFormTemplate));
|
|
1034
1039
|
}
|
|
1035
1040
|
};
|
|
1036
1041
|
}
|
|
1037
1042
|
const J = /* @__PURE__ */ new Map();
|
|
1038
|
-
function
|
|
1043
|
+
function He(e, t = {}) {
|
|
1039
1044
|
if (t.scope && J.has(t.scope))
|
|
1040
1045
|
return J.get(t.scope);
|
|
1041
|
-
if (!
|
|
1046
|
+
if (!pe()) {
|
|
1042
1047
|
const g = q(e, t);
|
|
1043
1048
|
return t.scope && J.set(t.scope, g), g;
|
|
1044
1049
|
}
|
|
1045
|
-
const
|
|
1050
|
+
const l = q(
|
|
1046
1051
|
e,
|
|
1047
1052
|
{
|
|
1048
|
-
...G(
|
|
1053
|
+
...G(de, {}),
|
|
1049
1054
|
...t
|
|
1050
1055
|
}
|
|
1051
1056
|
);
|
|
1052
|
-
return t.scope && J.set(t.scope,
|
|
1057
|
+
return t.scope && J.set(t.scope, l), l;
|
|
1053
1058
|
}
|
|
1054
|
-
function
|
|
1059
|
+
function Qe(e, t = {}) {
|
|
1055
1060
|
return q(e, t);
|
|
1056
1061
|
}
|
|
1057
1062
|
export {
|
|
1058
1063
|
V as FormFieldType,
|
|
1059
|
-
|
|
1064
|
+
qe as createForm,
|
|
1060
1065
|
k as defaultObjectBySchema,
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1066
|
+
Qe as formType,
|
|
1067
|
+
de as pluginInjectionKey,
|
|
1068
|
+
He as useForm
|
|
1064
1069
|
};
|