@volverjs/form-vue 1.0.0-beta.21 → 1.0.0-beta.23

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/index.es.js CHANGED
@@ -1,78 +1,345 @@
1
- import { defineComponent as M, inject as C, toRefs as j, computed as W, onMounted as F, watch as _, onBeforeUnmount as ue, unref as G, provide as P, readonly as U, resolveComponent as B, defineAsyncComponent as le, h as A, ref as R, toRaw as N, isProxy as se, withModifiers as Q, getCurrentInstance as ie } from "vue";
2
- import { watchIgnorable as fe, throttleFilter as oe } from "@vueuse/core";
3
- import { ZodObject as K, ZodDefault as de, ZodNullable as ve, ZodSchema as ce, ZodArray as me, ZodRecord as ye, ZodEffects as X, ZodOptional as Y, ZodError as he } from "zod";
4
- function q(e) {
1
+ import { ref as C, computed as O, readonly as K, defineComponent as M, toRaw as L, watch as U, isProxy as fe, onMounted as j, provide as Y, h as G, withModifiers as re, toRefs as F, inject as _, onBeforeUnmount as le, unref as Z, resolveComponent as N, defineAsyncComponent as ve, getCurrentInstance as de } from "vue";
2
+ import { watchIgnorable as ce, throttleFilter as ye } from "@vueuse/core";
3
+ import { ZodObject as H, ZodDefault as he, ZodNullable as me, ZodSchema as be, ZodArray as pe, ZodRecord as Ve, ZodEffects as te, ZodOptional as ae, ZodError as ge } from "zod";
4
+ var m = /* @__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))(m || {}), R = /* @__PURE__ */ ((e) => (e.invalid = "invalid", e.valid = "valid", e.submitting = "submitting", e.reset = "reset", e.updated = "updated", e.unknown = "unknown", e))(R || {});
5
+ function J(e, o = {}) {
6
+ const r = (d) => {
7
+ let l = d;
8
+ for (; l instanceof te; )
9
+ l = l.innerType();
10
+ return l instanceof ae && (l = l._def.innerType), l;
11
+ }, v = (d) => {
12
+ let l = d;
13
+ for (; l instanceof te; )
14
+ l = l.innerType();
15
+ return l instanceof ae;
16
+ }, t = r(e);
17
+ return {
18
+ ...(t instanceof H ? t._def.unknownKeys === "passthrough" : !1) ? o : {},
19
+ ...Object.fromEntries(
20
+ Object.entries(t.shape).map(
21
+ ([d, l]) => {
22
+ const f = o[d], p = v(l);
23
+ let u = r(l), y;
24
+ if (u instanceof he && (y = u._def.defaultValue(), u = u._def.innerType), f === null && u instanceof me)
25
+ return [d, f];
26
+ if (f == null && p)
27
+ return [d, y];
28
+ if (u instanceof be) {
29
+ const b = l.safeParse(f);
30
+ if (b.success)
31
+ return [d, b.data ?? y];
32
+ }
33
+ if (u instanceof pe && Array.isArray(f) && f.length) {
34
+ const b = r(u._def.type);
35
+ if (b instanceof H)
36
+ return [
37
+ d,
38
+ f.map(
39
+ (h) => J(
40
+ b,
41
+ h && typeof h == "object" ? h : void 0
42
+ )
43
+ )
44
+ ];
45
+ }
46
+ if (u instanceof Ve && f) {
47
+ const b = r(u._def.valueType);
48
+ if (b instanceof H)
49
+ return [d, Object.keys(f).reduce((h, n) => (h[n] = J(b, f[n]), h), {})];
50
+ }
51
+ return u instanceof H ? [
52
+ d,
53
+ J(
54
+ u,
55
+ f && typeof f == "object" ? f : y
56
+ )
57
+ ] : [d, y];
58
+ }
59
+ )
60
+ )
61
+ };
62
+ }
63
+ function Oe(e, o, r, v) {
64
+ const t = C(), a = C(), d = O(() => a.value === R.invalid), l = C(), f = C(!1);
65
+ let p;
66
+ const u = async (k = l.value, g) => {
67
+ if (p = g, f.value)
68
+ return !0;
69
+ const V = await e.safeParseAsync(k);
70
+ if (!V.success) {
71
+ if (a.value = R.invalid, !g)
72
+ return t.value = V.error.format(), !1;
73
+ const s = V.error.issues.filter((W) => g.has(W.path.join(".")));
74
+ return s.length ? (t.value = new ge(s).format(), !1) : (t.value = void 0, !0);
75
+ }
76
+ return t.value = void 0, a.value = R.valid, l.value = V.data, !0;
77
+ }, y = () => {
78
+ t.value = void 0, a.value = void 0, p = void 0;
79
+ }, b = () => {
80
+ l.value = J(e), y(), a.value = R.reset;
81
+ }, h = async () => f.value || !await u() ? !1 : (a.value = R.submitting, !0), { ignoreUpdates: n, stop: w } = ce(
82
+ l,
83
+ () => {
84
+ a.value = R.updated;
85
+ },
86
+ {
87
+ deep: !0,
88
+ eventFilter: ye((r == null ? void 0 : r.updateThrottle) ?? 500)
89
+ }
90
+ ), x = K(t), E = K(a), S = M({
91
+ name: "VvForm",
92
+ props: {
93
+ continuousValidation: {
94
+ type: Boolean,
95
+ default: !1
96
+ },
97
+ modelValue: {
98
+ type: Object,
99
+ default: () => ({})
100
+ },
101
+ readonly: {
102
+ type: Boolean,
103
+ default: (r == null ? void 0 : r.readonly) ?? !1
104
+ },
105
+ tag: {
106
+ type: String,
107
+ default: "form"
108
+ },
109
+ template: {
110
+ type: [Array, Function],
111
+ default: void 0
112
+ }
113
+ },
114
+ emits: [
115
+ "invalid",
116
+ "submit",
117
+ "update:modelValue",
118
+ "update:readonly",
119
+ "valid",
120
+ "reset"
121
+ ],
122
+ expose: [
123
+ "errors",
124
+ "invalid",
125
+ "readonly",
126
+ "status",
127
+ "submit",
128
+ "tag",
129
+ "template",
130
+ "valid",
131
+ "validate",
132
+ "clear",
133
+ "reset"
134
+ ],
135
+ slots: Object,
136
+ setup(k, { emit: g }) {
137
+ return l.value = J(
138
+ e,
139
+ L(k.modelValue)
140
+ ), U(
141
+ () => k.modelValue,
142
+ (V) => {
143
+ if (V) {
144
+ const s = fe(V) ? L(V) : V;
145
+ if (JSON.stringify(s) === JSON.stringify(L(l.value)))
146
+ return;
147
+ l.value = typeof (s == null ? void 0 : s.clone) == "function" ? s.clone() : JSON.parse(JSON.stringify(s));
148
+ }
149
+ },
150
+ { deep: !0 }
151
+ ), U(a, async (V) => {
152
+ var s, W, A, $, q, T;
153
+ if (V === R.invalid) {
154
+ const B = L(t.value);
155
+ g("invalid", B), (s = r == null ? void 0 : r.onInvalid) == null || s.call(
156
+ r,
157
+ B
158
+ );
159
+ return;
160
+ }
161
+ if (V === R.valid) {
162
+ const B = L(l.value);
163
+ g("valid", B), (W = r == null ? void 0 : r.onValid) == null || W.call(r, B), g("update:modelValue", B), (A = r == null ? void 0 : r.onUpdate) == null || A.call(r, B);
164
+ return;
165
+ }
166
+ if (V === R.submitting) {
167
+ const B = L(l.value);
168
+ g("submit", B), ($ = r == null ? void 0 : r.onSubmit) == null || $.call(r, B);
169
+ return;
170
+ }
171
+ if (V === R.reset) {
172
+ const B = L(l.value);
173
+ g("reset", B), (q = r == null ? void 0 : r.onReset) == null || q.call(r, B);
174
+ return;
175
+ }
176
+ if (V === R.updated) {
177
+ if ((t.value || r != null && r.continuousValidation || k.continuousValidation) && await u(void 0, p), !l.value || !k.modelValue || JSON.stringify(l.value) !== JSON.stringify(k.modelValue)) {
178
+ const B = L(l.value);
179
+ g("update:modelValue", B), (T = r == null ? void 0 : r.onUpdate) == null || T.call(r, B);
180
+ }
181
+ a.value === R.updated && (a.value = R.unknown);
182
+ }
183
+ }), j(() => {
184
+ f.value = k.readonly;
185
+ }), U(
186
+ () => k.readonly,
187
+ (V) => {
188
+ f.value = V;
189
+ }
190
+ ), U(f, (V) => {
191
+ V !== k.readonly && g("update:readonly", f.value);
192
+ }), Y(o, {
193
+ clear: y,
194
+ errors: x,
195
+ formData: l,
196
+ ignoreUpdates: n,
197
+ invalid: d,
198
+ readonly: f,
199
+ reset: b,
200
+ status: E,
201
+ stopUpdatesWatch: w,
202
+ submit: h,
203
+ validate: u
204
+ }), {
205
+ clear: y,
206
+ errors: x,
207
+ formData: l,
208
+ ignoreUpdates: n,
209
+ invalid: d,
210
+ isReadonly: f,
211
+ reset: b,
212
+ status: E,
213
+ stopUpdatesWatch: w,
214
+ submit: h,
215
+ validate: u
216
+ };
217
+ },
218
+ render() {
219
+ const k = () => {
220
+ var g, V;
221
+ return ((V = (g = this.$slots) == null ? void 0 : g.default) == null ? void 0 : V.call(g, {
222
+ clear: y,
223
+ errors: x,
224
+ formData: l,
225
+ ignoreUpdates: n,
226
+ invalid: d,
227
+ readonly: f,
228
+ reset: b,
229
+ status: E,
230
+ stopUpdatesWatch: w,
231
+ submit: h,
232
+ validate: u
233
+ })) ?? this.$slots.default;
234
+ };
235
+ return G(
236
+ this.tag,
237
+ {
238
+ onSubmit: re(this.submit, ["prevent"]),
239
+ onReset: re(this.reset, ["prevent"])
240
+ },
241
+ (this.template ?? (r == null ? void 0 : r.template)) && v ? [
242
+ G(
243
+ v,
244
+ {
245
+ schema: this.template ?? (r == null ? void 0 : r.template)
246
+ },
247
+ {
248
+ default: k
249
+ }
250
+ )
251
+ ] : {
252
+ default: k
253
+ }
254
+ );
255
+ }
256
+ });
257
+ return {
258
+ clear: y,
259
+ errors: t,
260
+ formData: l,
261
+ ignoreUpdates: n,
262
+ invalid: d,
263
+ readonly: f,
264
+ reset: b,
265
+ status: a,
266
+ stopUpdatesWatch: w,
267
+ submit: h,
268
+ validate: u,
269
+ VvForm: S
270
+ };
271
+ }
272
+ function D(e) {
5
273
  return Array.isArray(e);
6
274
  }
7
- function be(e) {
275
+ function we(e) {
8
276
  return typeof e < "u";
9
277
  }
10
- function D(e) {
278
+ function ue(e) {
11
279
  return e === null;
12
280
  }
13
- function ee(e) {
281
+ function ne(e) {
14
282
  return typeof e == "object";
15
283
  }
16
- function re(e) {
284
+ function se(e) {
17
285
  return typeof e == "string";
18
286
  }
19
- function Z(e) {
287
+ function Q(e) {
20
288
  return typeof e > "u";
21
289
  }
22
- const Ve = /^[0-9]+$/, ge = ["__proto__", "prototype", "constructor"];
23
- function z(e, l, r) {
24
- const f = be(r) ? r : void 0;
25
- if (!ee(e) || !re(l))
26
- return f;
27
- const a = ae(l);
28
- if (a.length !== 0) {
29
- for (const n of a) {
30
- if (n === "*")
290
+ const xe = /^[0-9]+$/, ke = ["__proto__", "prototype", "constructor"];
291
+ function z(e, o, r) {
292
+ const v = we(r) ? r : void 0;
293
+ if (!ne(e) || !se(o))
294
+ return v;
295
+ const t = ie(o);
296
+ if (t.length !== 0) {
297
+ for (const a of t) {
298
+ if (a === "*")
31
299
  continue;
32
- const i = function(u) {
33
- return u.map((t) => Z(t) || D(t) ? t : q(t) ? i(t) : t[n]);
300
+ const d = function(l) {
301
+ return l.map((f) => Q(f) || ue(f) ? f : D(f) ? d(f) : f[a]);
34
302
  };
35
- if (q(e) && !Ve.test(n) ? e = i(e) : e = e[n], Z(e) || D(e))
303
+ if (D(e) && !xe.test(a) ? e = d(e) : e = e[a], Q(e) || ue(e))
36
304
  break;
37
305
  }
38
- return Z(e) ? f : e;
306
+ return Q(e) ? v : e;
39
307
  }
40
308
  }
41
- function te(e, l, r) {
42
- if (!ee(e) || !re(l))
309
+ function ee(e, o, r) {
310
+ if (!ne(e) || !se(o))
43
311
  return;
44
- const f = ae(l);
45
- if (f.length === 0)
312
+ const v = ie(o);
313
+ if (v.length === 0)
46
314
  return;
47
- const a = f.length;
48
- for (let n = 0; n < a; n++) {
49
- const i = f[n];
50
- if (n === a - 1) {
51
- e[i] = r;
315
+ const t = v.length;
316
+ for (let a = 0; a < t; a++) {
317
+ const d = v[a];
318
+ if (a === t - 1) {
319
+ e[d] = r;
52
320
  return;
53
321
  }
54
- if (i === "*" && q(e)) {
55
- const u = f.slice(n + 1).join(".");
56
- for (const t of e)
57
- te(t, u, r);
322
+ if (d === "*" && D(e)) {
323
+ const l = v.slice(a + 1).join(".");
324
+ for (const f of e)
325
+ ee(f, l, r);
58
326
  return;
59
327
  }
60
- Z(e[i]) && (e[i] = {}), e = e[i];
328
+ Q(e[d]) && (e[d] = {}), e = e[d];
61
329
  }
62
330
  }
63
- function ae(e) {
64
- const l = e.split(/[.]|(?:\[(\d|\*)\])/).filter((r) => !!r);
65
- return l.some((r) => ge.indexOf(r) !== -1) ? [] : l;
331
+ function ie(e) {
332
+ const o = e.split(/[.]|(?:\[(\d|\*)\])/).filter((r) => !!r);
333
+ return o.some((r) => ke.indexOf(r) !== -1) ? [] : o;
66
334
  }
67
- var d = /* @__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))(d || {}), k = /* @__PURE__ */ ((e) => (e.invalid = "invalid", e.valid = "valid", e.submitting = "submitting", e.reset = "reset", e.updated = "updated", e.unknown = "unknown", e))(k || {});
68
- function xe(e, l, r, f) {
335
+ function Se(e, o, r, v) {
69
336
  return M({
70
337
  name: "VvFormField",
71
338
  props: {
72
339
  type: {
73
340
  type: String,
74
- validator: (a) => Object.values(d).includes(a),
75
- default: d.custom
341
+ validator: (t) => Object.values(m).includes(t),
342
+ default: m.custom
76
343
  },
77
344
  is: {
78
345
  type: [Object, String],
@@ -119,140 +386,142 @@ function xe(e, l, r, f) {
119
386
  "type"
120
387
  ],
121
388
  slots: Object,
122
- setup(a, { slots: n, emit: i }) {
123
- const u = C(l, void 0);
124
- u && u.fields.value.add(a.name);
125
- const t = C(e), { props: g, name: o } = j(a), v = W({
389
+ setup(t, { slots: a, emit: d }) {
390
+ const { props: l, name: f } = F(t), p = _(o, void 0);
391
+ p && p.fields.value.add(t.name);
392
+ const u = _(e), y = O({
126
393
  get() {
127
- if (t != null && t.formData)
394
+ if (u != null && u.formData)
128
395
  return z(
129
- new Object(t.formData.value),
130
- String(a.name)
396
+ new Object(u.formData.value),
397
+ String(t.name)
131
398
  );
132
399
  },
133
400
  set(s) {
134
- t != null && t.formData && (te(
135
- new Object(t.formData.value),
136
- String(a.name),
401
+ u != null && u.formData && (ee(
402
+ new Object(u.formData.value),
403
+ String(t.name),
137
404
  s
138
- ), i("update:modelValue", {
139
- newValue: v.value,
140
- formData: t == null ? void 0 : t.formData
405
+ ), d("update:modelValue", {
406
+ newValue: y.value,
407
+ formData: u == null ? void 0 : u.formData
141
408
  }));
142
409
  }
143
410
  });
144
- F(() => {
145
- v.value === void 0 && a.defaultValue !== void 0 && (v.value = a.defaultValue);
411
+ j(() => {
412
+ y.value === void 0 && t.defaultValue !== void 0 && (y.value = t.defaultValue);
146
413
  });
147
- const m = W(() => {
148
- if (t != null && t.errors.value)
149
- return z(t.errors.value, String(a.name));
150
- }), c = W(() => {
414
+ const b = O(() => {
415
+ if (u != null && u.errors.value)
416
+ return z(u.errors.value, String(t.name));
417
+ }), h = O(() => {
151
418
  var s;
152
- return (s = m.value) == null ? void 0 : s._errors;
153
- }), h = W(() => m.value !== void 0), S = _(h, () => {
154
- h.value ? (i("invalid", c.value), u && u.errors.value.set(
155
- a.name,
156
- {
157
- _errors: c.value
158
- }
159
- )) : (i("valid", v.value), u && u.errors.value.delete(
160
- a.name
161
- ));
162
- }), I = _(
163
- () => t == null ? void 0 : t.formData,
419
+ return (s = b.value) == null ? void 0 : s._errors;
420
+ }), n = O(() => b.value !== void 0), w = U(n, () => {
421
+ if (n.value) {
422
+ d("invalid", b.value), p && p.errors.value.set(
423
+ String(t.name),
424
+ b.value
425
+ );
426
+ return;
427
+ }
428
+ d("valid", y.value), p && p.errors.value.delete(
429
+ t.name
430
+ );
431
+ }), x = U(
432
+ () => u == null ? void 0 : u.formData,
164
433
  () => {
165
- i("update:formData", t == null ? void 0 : t.formData);
434
+ d("update:formData", u == null ? void 0 : u.formData);
166
435
  },
167
436
  { deep: !0 }
168
437
  );
169
- ue(() => {
170
- S(), I();
438
+ le(() => {
439
+ w(), x();
171
440
  });
172
- const O = (s) => {
173
- v.value = s;
174
- }, w = W(() => {
175
- let s = g.value;
176
- return typeof s == "function" && (s = s(t == null ? void 0 : t.formData)), Object.keys(s).reduce(
177
- (E, p) => (E[p] = G(s[p]), E),
441
+ const E = (s) => {
442
+ s instanceof InputEvent && (s = s.target.value), y.value = s;
443
+ }, S = O(() => {
444
+ let s = l.value;
445
+ return typeof s == "function" && (s = s(u == null ? void 0 : u.formData)), Object.keys(s).reduce(
446
+ (W, A) => (W[A] = Z(s[A]), W),
178
447
  {}
179
448
  );
180
- }), b = W(() => t != null && t.readonly.value ? !0 : w.value.readonly ?? a.readonly), V = W(() => ({
181
- ...w.value,
182
- name: w.value.name ?? a.name,
183
- invalid: h.value,
184
- valid: a.showValid ? !!(!h.value && v.value) : void 0,
449
+ }), k = O(() => u != null && u.readonly.value ? !0 : S.value.readonly ?? t.readonly), g = O(() => ({
450
+ ...S.value,
451
+ name: S.value.name ?? t.name,
452
+ invalid: n.value,
453
+ valid: t.showValid ? !!(!n.value && y.value) : void 0,
185
454
  type: ((s) => {
186
455
  if ([
187
- d.color,
188
- d.date,
189
- d.datetimeLocal,
190
- d.email,
191
- d.month,
192
- d.number,
193
- d.password,
194
- d.search,
195
- d.tel,
196
- d.text,
197
- d.time,
198
- d.url,
199
- d.week
456
+ m.color,
457
+ m.date,
458
+ m.datetimeLocal,
459
+ m.email,
460
+ m.month,
461
+ m.number,
462
+ m.password,
463
+ m.search,
464
+ m.tel,
465
+ m.text,
466
+ m.time,
467
+ m.url,
468
+ m.week
200
469
  ].includes(s))
201
470
  return s;
202
- })(a.type),
203
- invalidLabel: c.value,
204
- modelValue: v.value,
205
- readonly: b.value,
206
- "onUpdate:modelValue": O
471
+ })(t.type),
472
+ invalidLabel: h.value,
473
+ modelValue: y.value,
474
+ readonly: k.value,
475
+ "onUpdate:modelValue": E
207
476
  }));
208
- return P(r, {
209
- name: U(o),
210
- errors: U(m)
211
- }), { component: W(() => {
212
- if (a.type === d.custom)
477
+ return Y(r, {
478
+ name: K(f),
479
+ errors: K(b)
480
+ }), { component: O(() => {
481
+ if (t.type === m.custom)
213
482
  return {
214
483
  render() {
215
484
  var s;
216
- return ((s = n.default) == null ? void 0 : s.call(n, {
217
- errors: m.value,
218
- formData: t == null ? void 0 : t.formData.value,
219
- formErrors: t == null ? void 0 : t.errors.value,
220
- invalid: h.value,
221
- invalidLabel: c.value,
222
- modelValue: v.value,
223
- onUpdate: O,
224
- readonly: b.value,
225
- submit: t == null ? void 0 : t.submit,
226
- validate: t == null ? void 0 : t.validate
227
- })) ?? n.default;
485
+ return ((s = a.default) == null ? void 0 : s.call(a, {
486
+ errors: b.value,
487
+ formData: u == null ? void 0 : u.formData.value,
488
+ formErrors: u == null ? void 0 : u.errors.value,
489
+ invalid: n.value,
490
+ invalidLabel: h.value,
491
+ modelValue: y.value,
492
+ onUpdate: E,
493
+ readonly: k.value,
494
+ submit: u == null ? void 0 : u.submit,
495
+ validate: u == null ? void 0 : u.validate
496
+ })) ?? a.default;
228
497
  }
229
498
  };
230
- if (!((f == null ? void 0 : f.lazyLoad) ?? a.lazyLoad)) {
499
+ if (!((v == null ? void 0 : v.lazyLoad) ?? t.lazyLoad)) {
231
500
  let s;
232
- switch (a.type) {
233
- case d.select:
234
- s = B("VvSelect");
501
+ switch (t.type) {
502
+ case m.select:
503
+ s = N("VvSelect");
235
504
  break;
236
- case d.checkbox:
237
- s = B("VvCheckbox");
505
+ case m.checkbox:
506
+ s = N("VvCheckbox");
238
507
  break;
239
- case d.radio:
240
- s = B("VvRadio");
508
+ case m.radio:
509
+ s = N("VvRadio");
241
510
  break;
242
- case d.textarea:
243
- s = B("VvTextarea");
511
+ case m.textarea:
512
+ s = N("VvTextarea");
244
513
  break;
245
- case d.radioGroup:
246
- s = B("VvRadioGroup");
514
+ case m.radioGroup:
515
+ s = N("VvRadioGroup");
247
516
  break;
248
- case d.checkboxGroup:
249
- s = B("VvCheckboxGroup");
517
+ case m.checkboxGroup:
518
+ s = N("VvCheckboxGroup");
250
519
  break;
251
- case d.combobox:
252
- s = B("VvCombobox");
520
+ case m.combobox:
521
+ s = N("VvCombobox");
253
522
  break;
254
523
  default:
255
- s = B("VvInputText");
524
+ s = N("VvInputText");
256
525
  }
257
526
  if (typeof s != "string")
258
527
  return s;
@@ -260,300 +529,222 @@ function xe(e, l, r, f) {
260
529
  `[form-vue warn]: ${s} not found, the component will be loaded asynchronously. To avoid this warning, please set "lazyLoad" option.`
261
530
  );
262
531
  }
263
- return le(async () => {
264
- switch (f != null && f.sideEffects && await Promise.resolve(f.sideEffects(a.type)), a.type) {
265
- case d.textarea:
532
+ return ve(async () => {
533
+ switch (v != null && v.sideEffects && await Promise.resolve(v.sideEffects(t.type)), t.type) {
534
+ case m.textarea:
266
535
  return import("@volverjs/ui-vue/vv-textarea");
267
- case d.radio:
536
+ case m.radio:
268
537
  return import("@volverjs/ui-vue/vv-radio");
269
- case d.radioGroup:
538
+ case m.radioGroup:
270
539
  return import("@volverjs/ui-vue/vv-radio-group");
271
- case d.checkbox:
540
+ case m.checkbox:
272
541
  return import("@volverjs/ui-vue/vv-checkbox");
273
- case d.checkboxGroup:
542
+ case m.checkboxGroup:
274
543
  return import("@volverjs/ui-vue/vv-checkbox-group");
275
- case d.select:
544
+ case m.select:
276
545
  return import("@volverjs/ui-vue/vv-select");
277
- case d.combobox:
546
+ case m.combobox:
278
547
  return import("@volverjs/ui-vue/vv-combobox");
279
548
  }
280
549
  return import("@volverjs/ui-vue/vv-input-text");
281
550
  });
282
- }), hasProps: V, invalid: h };
551
+ }), hasProps: g, invalid: n };
283
552
  },
284
553
  render() {
285
- return this.is ? A(this.is, this.hasProps, this.$slots) : this.type === d.custom ? A(this.component, null, this.$slots) : A(this.component, this.hasProps, this.$slots);
554
+ return this.is ? G(this.is, this.hasProps, this.$slots) : this.type === m.custom ? G(this.component, null, this.$slots) : G(this.component, this.hasProps, this.$slots);
286
555
  }
287
556
  });
288
557
  }
289
- function L(e, l = {}) {
290
- const r = (i) => {
291
- let u = i;
292
- for (; u instanceof X; )
293
- u = u.innerType();
294
- return u instanceof Y && (u = u._def.innerType), u;
295
- }, f = (i) => {
296
- let u = i;
297
- for (; u instanceof X; )
298
- u = u.innerType();
299
- return u instanceof Y;
300
- }, a = r(e);
301
- return {
302
- ...(a instanceof K ? a._def.unknownKeys === "passthrough" : !1) ? l : {},
303
- ...Object.fromEntries(
304
- Object.entries(a.shape).map(
305
- ([i, u]) => {
306
- const t = l[i], g = f(u);
307
- let o = r(u), v;
308
- if (o instanceof de && (v = o._def.defaultValue(), o = o._def.innerType), t === null && o instanceof ve)
309
- return [i, t];
310
- if (t == null && g)
311
- return [i, v];
312
- if (o instanceof ce) {
313
- const m = u.safeParse(t);
314
- if (m.success)
315
- return [i, m.data ?? v];
316
- }
317
- if (o instanceof me && Array.isArray(t) && t.length) {
318
- const m = r(o._def.type);
319
- if (m instanceof K)
320
- return [
321
- i,
322
- t.map(
323
- (c) => L(
324
- m,
325
- c && typeof c == "object" ? c : void 0
326
- )
327
- )
328
- ];
329
- }
330
- if (o instanceof ye && t) {
331
- const m = r(o._def.valueType);
332
- if (m instanceof K)
333
- return [i, Object.keys(t).reduce((c, h) => (c[h] = L(m, t[h]), c), {})];
334
- }
335
- return o instanceof K ? [
336
- i,
337
- L(
338
- o,
339
- t && typeof t == "object" ? t : v
340
- )
341
- ] : [i, v];
342
- }
343
- )
344
- )
345
- };
346
- }
347
- function Oe(e, l, r, f) {
348
- const a = R(), n = R(), i = W(() => n.value === k.invalid), u = R(), t = R(!1);
349
- let g;
350
- const o = async (b = u.value, V) => {
351
- if (g = V, t.value)
352
- return !0;
353
- const y = await e.safeParseAsync(b);
354
- if (!y.success) {
355
- if (n.value = k.invalid, !V)
356
- return a.value = y.error.format(), !1;
357
- const s = y.error.issues.filter((E) => V.has(E.path.join(".")));
358
- return s.length ? (a.value = new he(s).format(), !1) : (a.value = void 0, !0);
359
- }
360
- return a.value = void 0, n.value = k.valid, u.value = y.data, !0;
361
- }, v = () => {
362
- a.value = void 0, n.value = void 0, g = void 0;
363
- }, m = () => {
364
- u.value = L(e), v(), n.value = k.reset;
365
- }, c = async () => t.value || !await o() ? !1 : (n.value = k.submitting, !0), { ignoreUpdates: h, stop: S } = fe(
366
- u,
367
- () => {
368
- n.value = k.updated;
369
- },
370
- {
371
- deep: !0,
372
- eventFilter: oe((r == null ? void 0 : r.updateThrottle) ?? 500)
373
- }
374
- ), I = U(a), O = U(n), w = M({
375
- name: "VvForm",
558
+ function Ie(e, o, r) {
559
+ return M({
560
+ name: "VvFormFieldsGroup",
376
561
  props: {
377
- continuousValidation: {
378
- type: Boolean,
379
- default: !1
562
+ is: {
563
+ type: [Object, String],
564
+ default: void 0
380
565
  },
381
- modelValue: {
382
- type: Object,
566
+ names: {
567
+ type: [Array],
568
+ required: !0
569
+ },
570
+ props: {
571
+ type: [Object, Function],
383
572
  default: () => ({})
384
573
  },
385
- readonly: {
574
+ showValid: {
386
575
  type: Boolean,
387
- default: (r == null ? void 0 : r.readonly) ?? !1
576
+ default: !1
388
577
  },
389
- tag: {
390
- type: String,
391
- default: "form"
578
+ defaultValues: {
579
+ type: [Object],
580
+ default: void 0
392
581
  },
393
- template: {
394
- type: [Array, Function],
582
+ readonly: {
583
+ type: Boolean,
395
584
  default: void 0
396
585
  }
397
586
  },
398
587
  emits: [
399
588
  "invalid",
400
- "submit",
589
+ "update:formData",
401
590
  "update:modelValue",
402
- "update:readonly",
403
- "valid",
404
- "reset"
591
+ "valid"
405
592
  ],
406
593
  expose: [
594
+ "component",
407
595
  "errors",
596
+ "hasProps",
408
597
  "invalid",
409
- "readonly",
410
- "status",
411
- "submit",
412
- "tag",
413
- "template",
414
- "valid",
415
- "validate",
416
- "clear",
417
- "reset"
598
+ "invalidLabels",
599
+ "is"
418
600
  ],
419
601
  slots: Object,
420
- setup(b, { emit: V }) {
421
- return u.value = L(
422
- e,
423
- N(b.modelValue)
424
- ), _(
425
- () => b.modelValue,
426
- (y) => {
427
- if (y) {
428
- const s = se(y) ? N(y) : y;
429
- if (JSON.stringify(s) === JSON.stringify(N(u.value)))
430
- return;
431
- u.value = typeof (s == null ? void 0 : s.clone) == "function" ? s.clone() : JSON.parse(JSON.stringify(s));
432
- }
602
+ setup(v, { slots: t, emit: a }) {
603
+ const { props: d, names: l, defaultValues: f } = F(v), p = O(() => Array.isArray(l.value) ? l.value : Object.values(l.value)), u = O(() => Array.isArray(l.value) ? l.value : Object.keys(l.value)), y = O(() => Array.isArray(l.value) ? l.value.reduce((i, c) => (i[String(c)] = c, i), {}) : l.value), b = O(() => Object.keys(y.value).reduce((i, c) => (i[String(y.value[c])] = c, i), {})), h = _(o, void 0);
604
+ h && p.value.forEach((i) => {
605
+ h.fields.value.add(i);
606
+ });
607
+ const n = _(e), w = O({
608
+ get() {
609
+ return n != null && n.formData ? u.value.reduce((i, c) => (i[c] = z(
610
+ new Object(n.formData.value),
611
+ y.value[c]
612
+ ), i), {}) : {};
433
613
  },
434
- { deep: !0 }
435
- ), _(n, async (y) => {
436
- var s, E, p, $, T, H;
437
- if (y === k.invalid) {
438
- const x = N(a.value);
439
- V("invalid", x), (s = r == null ? void 0 : r.onInvalid) == null || s.call(
440
- r,
441
- x
442
- );
443
- return;
614
+ set(i) {
615
+ n != null && n.formData && (u.value.forEach((c) => {
616
+ ee(
617
+ new Object(n.formData.value),
618
+ y.value[c],
619
+ i == null ? void 0 : i[c]
620
+ );
621
+ }), a("update:modelValue", {
622
+ newValue: w.value,
623
+ formData: n == null ? void 0 : n.formData
624
+ }));
444
625
  }
445
- if (y === k.valid) {
446
- const x = N(u.value);
447
- V("valid", x), (E = r == null ? void 0 : r.onValid) == null || E.call(r, x), V("update:modelValue", x), (p = r == null ? void 0 : r.onUpdate) == null || p.call(r, x);
626
+ });
627
+ j(() => {
628
+ f.value && p.value.forEach((i) => {
629
+ var c, I;
630
+ ((c = f.value) == null ? void 0 : c[i]) !== void 0 && w.value[i] === void 0 && (w.value = {
631
+ ...w.value,
632
+ [i]: (I = f.value) == null ? void 0 : I[i]
633
+ });
634
+ });
635
+ });
636
+ const x = O(() => {
637
+ if (!(n != null && n.errors.value))
448
638
  return;
449
- }
450
- if (y === k.submitting) {
451
- const x = N(u.value);
452
- V("submit", x), ($ = r == null ? void 0 : r.onSubmit) == null || $.call(r, x);
639
+ const i = p.value.reduce((c, I) => {
640
+ if (!n.errors.value)
641
+ return c;
642
+ const P = z(n.errors.value, String(I));
643
+ return P === void 0 || (c[String(I)] = P), c;
644
+ }, {});
645
+ if (Object.keys(i).length !== 0)
646
+ return i;
647
+ }), E = O(() => {
648
+ if (!x.value)
453
649
  return;
454
- }
455
- if (y === k.reset) {
456
- const x = N(u.value);
457
- V("reset", x), (T = r == null ? void 0 : r.onReset) == null || T.call(r, x);
650
+ const i = Object.keys(x.value).reduce((c, I) => {
651
+ var P;
652
+ return (P = x.value) != null && P[I] && (c[b.value[I]] = x.value[I]._errors), c;
653
+ }, {});
654
+ if (Object.keys(i).length !== 0)
655
+ return i;
656
+ }), S = O(() => x.value !== void 0), k = O(() => u.value.reduce((i, c) => {
657
+ var I;
658
+ return i[c] = !!((I = x.value) != null && I[b.value[c]]), i;
659
+ }, {})), g = U(S, () => {
660
+ if (S.value) {
661
+ a("invalid", x.value), h && p.value.forEach((i) => {
662
+ var c, I;
663
+ if (!((c = x.value) != null && c[i])) {
664
+ h.errors.value.delete(
665
+ i
666
+ );
667
+ return;
668
+ }
669
+ h.errors.value.set(
670
+ i,
671
+ (I = x.value) == null ? void 0 : I[i]
672
+ );
673
+ });
458
674
  return;
459
675
  }
460
- if (y === k.updated) {
461
- if ((a.value || r != null && r.continuousValidation || b.continuousValidation) && await o(void 0, g), !u.value || !b.modelValue || JSON.stringify(u.value) !== JSON.stringify(b.modelValue)) {
462
- const x = N(u.value);
463
- V("update:modelValue", x), (H = r == null ? void 0 : r.onUpdate) == null || H.call(r, x);
464
- }
465
- n.value === k.updated && (n.value = k.unknown);
466
- }
467
- }), F(() => {
468
- t.value = b.readonly;
469
- }), _(
470
- () => b.readonly,
471
- (y) => {
472
- t.value = y;
676
+ a("valid", w.value), h && p.value.forEach((i) => {
677
+ h.errors.value.delete(
678
+ i
679
+ );
680
+ });
681
+ }), V = U(
682
+ () => n == null ? void 0 : n.formData,
683
+ () => {
684
+ a("update:formData", n == null ? void 0 : n.formData);
685
+ },
686
+ { deep: !0 }
687
+ );
688
+ le(() => {
689
+ g(), V();
690
+ });
691
+ const s = (i) => {
692
+ w.value = i;
693
+ }, W = (i, c) => {
694
+ c instanceof InputEvent && (c = c.target.value), u.value.includes(i) && (w.value = {
695
+ ...w.value,
696
+ [i]: c
697
+ });
698
+ }, A = O(() => {
699
+ let i = d.value;
700
+ return typeof i == "function" && (i = i(n == null ? void 0 : n.formData)), Object.keys(i).reduce(
701
+ (c, I) => (c[I] = Z(i[I]), c),
702
+ {}
703
+ );
704
+ }), $ = O(() => n != null && n.readonly.value ? !0 : A.value.readonly ?? v.readonly), q = O(() => u.value.reduce((i, c) => (i[`onUpdate:${c}`] = (I) => {
705
+ W(c, I);
706
+ }, i), {
707
+ "onUpdate:modelValue": s
708
+ })), T = O(() => ({
709
+ ...q.value,
710
+ ...A.value,
711
+ names: A.value.name ?? p.value,
712
+ invalid: S.value,
713
+ invalids: k.value,
714
+ valid: v.showValid ? !!(!S.value && w.value) : void 0,
715
+ invalidLabels: E.value,
716
+ modelValue: w.value,
717
+ readonly: $.value
718
+ }));
719
+ return Y(r, {
720
+ names: K(l),
721
+ errors: K(x)
722
+ }), { component: O(() => ({
723
+ render() {
724
+ var i;
725
+ return ((i = t.default) == null ? void 0 : i.call(t, {
726
+ errors: x.value,
727
+ formData: n == null ? void 0 : n.formData.value,
728
+ formErrors: n == null ? void 0 : n.errors.value,
729
+ invalid: S.value,
730
+ invalids: k.value,
731
+ invalidLabels: E.value,
732
+ modelValue: w.value,
733
+ onUpdate: s,
734
+ onUpdateField: W,
735
+ readonly: $.value,
736
+ submit: n == null ? void 0 : n.submit,
737
+ validate: n == null ? void 0 : n.validate
738
+ })) ?? t.default;
473
739
  }
474
- ), _(t, (y) => {
475
- y !== b.readonly && V("update:readonly", t.value);
476
- }), P(l, {
477
- clear: v,
478
- errors: I,
479
- formData: u,
480
- ignoreUpdates: h,
481
- invalid: i,
482
- readonly: t,
483
- reset: m,
484
- status: O,
485
- stopUpdatesWatch: S,
486
- submit: c,
487
- validate: o
488
- }), {
489
- clear: v,
490
- errors: I,
491
- formData: u,
492
- ignoreUpdates: h,
493
- invalid: i,
494
- isReadonly: t,
495
- reset: m,
496
- status: O,
497
- stopUpdatesWatch: S,
498
- submit: c,
499
- validate: o
500
- };
740
+ })), hasProps: T, invalid: S };
501
741
  },
502
742
  render() {
503
- const b = () => {
504
- var V, y;
505
- return ((y = (V = this.$slots) == null ? void 0 : V.default) == null ? void 0 : y.call(V, {
506
- clear: v,
507
- errors: I,
508
- formData: u,
509
- ignoreUpdates: h,
510
- invalid: i,
511
- readonly: t,
512
- reset: m,
513
- status: O,
514
- stopUpdatesWatch: S,
515
- submit: c,
516
- validate: o
517
- })) ?? this.$slots.default;
518
- };
519
- return A(
520
- this.tag,
521
- {
522
- onSubmit: Q(this.submit, ["prevent"]),
523
- onReset: Q(this.reset, ["prevent"])
524
- },
525
- (this.template ?? (r == null ? void 0 : r.template)) && f ? [
526
- A(
527
- f,
528
- {
529
- schema: this.template ?? (r == null ? void 0 : r.template)
530
- },
531
- {
532
- default: b
533
- }
534
- )
535
- ] : {
536
- default: b
537
- }
538
- );
743
+ return this.is ? G(this.is, this.hasProps, this.$slots) : G(this.component, null, this.$slots);
539
744
  }
540
745
  });
541
- return {
542
- clear: v,
543
- errors: a,
544
- formData: u,
545
- ignoreUpdates: h,
546
- invalid: i,
547
- readonly: t,
548
- reset: m,
549
- status: n,
550
- stopUpdatesWatch: S,
551
- submit: c,
552
- validate: o,
553
- VvForm: w
554
- };
555
746
  }
556
- function we(e, l) {
747
+ function Ee(e, o) {
557
748
  return M({
558
749
  name: "VvFormWrapper",
559
750
  props: {
@@ -581,54 +772,54 @@ function we(e, l) {
581
772
  "validateWrapper"
582
773
  ],
583
774
  slots: Object,
584
- setup(r, { emit: f }) {
585
- const a = C(e), n = C(l, void 0), i = R(/* @__PURE__ */ new Set()), u = R(/* @__PURE__ */ new Map()), { name: t } = j(r);
586
- P(l, {
587
- name: U(t),
588
- errors: u,
589
- fields: i
590
- }), _(
591
- i,
592
- (v) => {
593
- n != null && n.fields && v.forEach((m) => {
594
- n == null || n.fields.value.add(m);
775
+ setup(r, { emit: v }) {
776
+ const t = _(e), a = _(o, void 0), d = C(/* @__PURE__ */ new Set()), l = C(/* @__PURE__ */ new Map()), { name: f } = F(r);
777
+ Y(o, {
778
+ name: K(f),
779
+ errors: l,
780
+ fields: d
781
+ }), U(
782
+ d,
783
+ (y) => {
784
+ a != null && a.fields && y.forEach((b) => {
785
+ a == null || a.fields.value.add(b);
595
786
  });
596
787
  },
597
788
  { deep: !0 }
598
- ), _(
599
- () => new Map(u.value),
600
- (v, m) => {
601
- n != null && n.errors && (Array.from(m.keys()).forEach((c) => {
602
- n.errors.value.delete(c);
603
- }), Array.from(v.keys()).forEach((c) => {
604
- const h = v.get(c);
605
- h && n.errors.value.set(c, h);
789
+ ), U(
790
+ () => new Map(l.value),
791
+ (y, b) => {
792
+ a != null && a.errors && (Array.from(b.keys()).forEach((h) => {
793
+ a.errors.value.delete(h);
794
+ }), Array.from(y.keys()).forEach((h) => {
795
+ const n = y.get(h);
796
+ n && a.errors.value.set(h, n);
606
797
  }));
607
798
  },
608
799
  { deep: !0 }
609
800
  );
610
- const g = W(() => a != null && a.invalid.value ? u.value.size > 0 : !1);
611
- _(g, () => {
612
- g.value ? f("invalid") : f("valid");
801
+ const p = O(() => t != null && t.invalid.value ? l.value.size > 0 : !1);
802
+ U(p, () => {
803
+ p.value ? v("invalid") : v("valid");
613
804
  });
614
- const o = () => (a == null ? void 0 : a.validate(void 0, i.value)) ?? Promise.resolve(!0);
805
+ const u = () => (t == null ? void 0 : t.validate(void 0, d.value)) ?? Promise.resolve(!0);
615
806
  return {
616
- clear: a == null ? void 0 : a.clear,
617
- errors: a == null ? void 0 : a.errors,
618
- fields: i,
619
- fieldsErrors: u,
620
- formData: a == null ? void 0 : a.formData,
621
- invalid: g,
622
- reset: a == null ? void 0 : a.reset,
623
- submit: a == null ? void 0 : a.submit,
624
- validate: a == null ? void 0 : a.validate,
625
- validateWrapper: o
807
+ clear: t == null ? void 0 : t.clear,
808
+ errors: t == null ? void 0 : t.errors,
809
+ fields: d,
810
+ fieldsErrors: l,
811
+ formData: t == null ? void 0 : t.formData,
812
+ invalid: p,
813
+ reset: t == null ? void 0 : t.reset,
814
+ submit: t == null ? void 0 : t.submit,
815
+ validate: t == null ? void 0 : t.validate,
816
+ validateWrapper: u
626
817
  };
627
818
  },
628
819
  render() {
629
820
  const r = () => {
630
- var f, a;
631
- return (a = (f = this.$slots).default) == null ? void 0 : a.call(f, {
821
+ var v, t;
822
+ return (t = (v = this.$slots).default) == null ? void 0 : t.call(v, {
632
823
  clear: this.clear,
633
824
  errors: this.errors,
634
825
  fieldsErrors: this.fieldsErrors,
@@ -640,13 +831,13 @@ function we(e, l) {
640
831
  validateWrapper: this.validateWrapper
641
832
  });
642
833
  };
643
- return this.tag ? A(this.tag, null, {
834
+ return this.tag ? G(this.tag, null, {
644
835
  default: r
645
836
  }) : r();
646
837
  }
647
838
  });
648
839
  }
649
- function pe(e, l) {
840
+ function Ae(e, o) {
650
841
  const r = M({
651
842
  name: "VvFormTemplate",
652
843
  props: {
@@ -660,161 +851,166 @@ function pe(e, l) {
660
851
  }
661
852
  },
662
853
  slots: Object,
663
- setup(f, { slots: a }) {
664
- const n = C(e);
665
- if (n != null && n.formData)
854
+ setup(v, { slots: t }) {
855
+ const a = _(e);
856
+ if (a != null && a.formData)
666
857
  return () => {
667
- var g;
668
- const i = typeof f.schema == "function" ? f.schema(
669
- n,
670
- f.scope
671
- ) : f.schema;
672
- let u;
673
- const t = i.reduce((o, v) => {
674
- const m = typeof v == "function" ? v(n, f.scope) : v, {
675
- vvIs: c,
676
- vvName: h,
677
- vvSlots: S,
678
- vvChildren: I,
679
- vvIf: O,
680
- vvElseIf: w,
681
- vvType: b,
682
- vvDefaultValue: V,
683
- vvShowValid: y,
858
+ var p;
859
+ const d = typeof v.schema == "function" ? v.schema(
860
+ a,
861
+ v.scope
862
+ ) : v.schema;
863
+ let l;
864
+ const f = d.reduce((u, y) => {
865
+ const b = typeof y == "function" ? y(a, v.scope) : y, {
866
+ vvIs: h,
867
+ vvName: n,
868
+ vvSlots: w,
869
+ vvChildren: x,
870
+ vvIf: E,
871
+ vvElseIf: S,
872
+ vvType: k,
873
+ vvDefaultValue: g,
874
+ vvShowValid: V,
684
875
  vvContent: s,
685
- ...E
686
- } = m;
687
- if (O !== void 0) {
688
- if (typeof O == "string" ? u = !!z(
689
- new Object(n.formData.value),
690
- O
691
- ) : typeof O == "function" ? u = G(O(n)) : u = G(O), !u)
692
- return o;
693
- } else if (w !== void 0 && u !== void 0) {
694
- if (u || (typeof w == "string" ? u = !!z(
695
- new Object(n.formData.value),
696
- w
697
- ) : typeof w == "function" ? u = G(w(n)) : u = G(w), !u))
698
- return o;
876
+ ...W
877
+ } = b;
878
+ if (E !== void 0) {
879
+ if (typeof E == "string" ? l = !!z(
880
+ new Object(a.formData.value),
881
+ E
882
+ ) : typeof E == "function" ? l = Z(E(a)) : l = Z(E), !l)
883
+ return u;
884
+ } else if (S !== void 0 && l !== void 0) {
885
+ if (l || (typeof S == "string" ? l = !!z(
886
+ new Object(a.formData.value),
887
+ S
888
+ ) : typeof S == "function" ? l = Z(S(a)) : l = Z(S), !l))
889
+ return u;
699
890
  } else
700
- u = void 0;
701
- let p;
702
- return I && (typeof c == "string" ? p = A(r, {
703
- schema: I
704
- }) : p = {
705
- default: ($) => A(r, {
706
- schema: I,
891
+ l = void 0;
892
+ let A;
893
+ return x && (typeof h == "string" ? A = G(r, {
894
+ schema: x
895
+ }) : A = {
896
+ default: ($) => G(r, {
897
+ schema: x,
707
898
  scope: $
708
899
  })
709
- }), h ? (o.push(
710
- A(
711
- l,
900
+ }), n ? (u.push(
901
+ G(
902
+ o,
712
903
  {
713
- name: h,
714
- is: c,
715
- type: b,
716
- defaultValue: V,
717
- showValid: y,
718
- props: E
904
+ name: n,
905
+ is: h,
906
+ type: k,
907
+ defaultValue: g,
908
+ showValid: V,
909
+ props: W
719
910
  },
720
- S ?? p ?? s
911
+ w ?? A ?? s
721
912
  )
722
- ), o) : c ? (o.push(
723
- A(
724
- c,
725
- E,
726
- S ?? p ?? s
913
+ ), u) : h ? (u.push(
914
+ G(
915
+ h,
916
+ W,
917
+ w ?? A ?? s
727
918
  )
728
- ), o) : (p && ("default" in p ? o.push(p.default(f.scope)) : o.push(p)), o);
919
+ ), u) : (A && ("default" in A ? u.push(A.default(v.scope)) : u.push(A)), u);
729
920
  }, []);
730
- return t.push(
731
- (g = a == null ? void 0 : a.default) == null ? void 0 : g.call(a, {
732
- errors: n == null ? void 0 : n.errors.value,
733
- formData: n == null ? void 0 : n.formData.value,
734
- invalid: n == null ? void 0 : n.invalid.value,
735
- status: n == null ? void 0 : n.status.value,
736
- submit: n == null ? void 0 : n.submit,
737
- validate: n == null ? void 0 : n.validate,
738
- clear: n == null ? void 0 : n.clear,
739
- reset: n == null ? void 0 : n.reset
921
+ return f.push(
922
+ (p = t == null ? void 0 : t.default) == null ? void 0 : p.call(t, {
923
+ errors: a == null ? void 0 : a.errors.value,
924
+ formData: a == null ? void 0 : a.formData.value,
925
+ invalid: a == null ? void 0 : a.invalid.value,
926
+ status: a == null ? void 0 : a.status.value,
927
+ submit: a == null ? void 0 : a.submit,
928
+ validate: a == null ? void 0 : a.validate,
929
+ clear: a == null ? void 0 : a.clear,
930
+ reset: a == null ? void 0 : a.reset
740
931
  })
741
- ), t;
932
+ ), f;
742
933
  };
743
934
  }
744
935
  });
745
936
  return r;
746
937
  }
747
- function J(e, l = {}) {
748
- const r = Symbol("formInjectionKey"), f = Symbol("formWrapperInjectionKey"), a = Symbol("formFieldInjectionKey"), n = we(
938
+ function X(e, o = {}) {
939
+ const r = Symbol("formInjectionKey"), v = Symbol("formWrapperInjectionKey"), t = Symbol("formFieldInjectionKey"), a = Symbol("formFieldsGroupInjectionKey"), d = Ee(
749
940
  r,
750
- f
751
- ), i = xe(
941
+ v
942
+ ), l = Se(
752
943
  r,
753
- f,
754
- a,
755
- l
756
- ), u = pe(r, i), {
757
- clear: t,
758
- errors: g,
759
- formData: o,
760
- ignoreUpdates: v,
761
- invalid: m,
762
- readonly: c,
763
- reset: h,
764
- status: S,
765
- stopUpdatesWatch: I,
766
- submit: O,
767
- validate: w,
768
- VvForm: b
769
- } = Oe(e, r, l, u);
944
+ v,
945
+ t,
946
+ o
947
+ ), f = Ie(
948
+ r,
949
+ v,
950
+ a
951
+ ), p = Ae(r, l), {
952
+ clear: u,
953
+ errors: y,
954
+ formData: b,
955
+ ignoreUpdates: h,
956
+ invalid: n,
957
+ readonly: w,
958
+ reset: x,
959
+ status: E,
960
+ stopUpdatesWatch: S,
961
+ submit: k,
962
+ validate: g,
963
+ VvForm: V
964
+ } = Oe(e, r, o, p);
770
965
  return {
771
- clear: t,
772
- errors: g,
773
- formData: o,
774
- formFieldInjectionKey: a,
966
+ clear: u,
967
+ errors: y,
968
+ formData: b,
969
+ formFieldInjectionKey: t,
775
970
  formInjectionKey: r,
776
- formWrapperInjectionKey: f,
777
- ignoreUpdates: v,
778
- invalid: m,
779
- readonly: c,
780
- reset: h,
781
- status: S,
782
- stopUpdatesWatch: I,
783
- submit: O,
784
- validate: w,
785
- VvForm: b,
786
- VvFormField: i,
787
- VvFormTemplate: u,
788
- VvFormWrapper: n
971
+ formWrapperInjectionKey: v,
972
+ ignoreUpdates: h,
973
+ invalid: n,
974
+ readonly: w,
975
+ reset: x,
976
+ status: E,
977
+ stopUpdatesWatch: S,
978
+ submit: k,
979
+ validate: g,
980
+ VvForm: V,
981
+ VvFormField: l,
982
+ VvFormFieldsGroup: f,
983
+ VvFormTemplate: p,
984
+ VvFormWrapper: d
789
985
  };
790
986
  }
791
- const ne = Symbol("pluginInjectionKey");
792
- function Ee(e) {
793
- let l = {};
794
- return e.schema && (l = J(e.schema, e)), {
795
- ...l,
796
- install(r, { global: f = !1 } = {}) {
797
- r.provide(ne, e), f && (r.config.globalProperties.$vvForm = e, l != null && l.VvForm && r.component("VvForm", l.VvForm), l != null && l.VvFormWrapper && r.component("VvFormWrapper", l.VvFormWrapper), l != null && l.VvFormField && r.component("VvFormField", l.VvFormField), l != null && l.VvFormTemplate && r.component("VvFormTemplate", l.VvFormTemplate));
987
+ const oe = Symbol("pluginInjectionKey");
988
+ function Ge(e) {
989
+ let o = {};
990
+ return e.schema && (o = X(e.schema, e)), {
991
+ ...o,
992
+ install(r, { global: v = !1 } = {}) {
993
+ r.provide(oe, e), v && (r.config.globalProperties.$vvForm = e, o != null && o.VvForm && r.component("VvForm", o.VvForm), o != null && o.VvFormWrapper && r.component("VvFormWrapper", o.VvFormWrapper), o != null && o.VvFormField && r.component("VvFormField", o.VvFormField), o != null && o.VvFormTemplate && r.component("VvFormTemplate", o.VvFormTemplate));
798
994
  }
799
995
  };
800
996
  }
801
- function We(e, l = {}) {
802
- return ie() ? J(
997
+ function Ue(e, o = {}) {
998
+ return de() ? X(
803
999
  e,
804
1000
  {
805
- ...C(ne, {}),
806
- ...l
1001
+ ..._(oe, {}),
1002
+ ...o
807
1003
  }
808
- ) : J(e, l);
1004
+ ) : X(e, o);
809
1005
  }
810
- function Ae(e, l = {}) {
811
- return J(e, l);
1006
+ function Le(e, o = {}) {
1007
+ return X(e, o);
812
1008
  }
813
1009
  export {
814
- d as FormFieldType,
815
- Ee as createForm,
816
- L as defaultObjectBySchema,
817
- Ae as formFactory,
818
- ne as pluginInjectionKey,
819
- We as useForm
1010
+ m as FormFieldType,
1011
+ Ge as createForm,
1012
+ J as defaultObjectBySchema,
1013
+ Le as formFactory,
1014
+ oe as pluginInjectionKey,
1015
+ Ue as useForm
820
1016
  };