@volverjs/form-vue 1.1.0-beta.4 → 1.1.0-beta.5

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