@volverjs/form-vue 1.0.0 → 1.0.2

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