@volverjs/form-vue 0.0.10-beta.6 → 0.0.10-beta.7

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,76 +1,76 @@
1
- import { defineComponent as N, computed as V, onMounted as Y, onBeforeUnmount as D, inject as O, toRefs as J, watch as w, provide as _, readonly as g, resolveComponent as b, defineAsyncComponent as R, h as y, ref as E, isProxy as T, toRaw as j, withModifiers as F, unref as $ } from "vue";
1
+ import { defineComponent as W, computed as V, onMounted as X, onBeforeUnmount as Y, inject as O, toRefs as Z, watch as w, provide as _, readonly as k, resolveComponent as g, defineAsyncComponent as R, h as x, ref as E, isProxy as T, toRaw as j, withModifiers as F, unref as $ } from "vue";
2
2
  import { watchThrottled as ee } from "@vueuse/core";
3
- import { ZodObject as K, ZodDefault as re, ZodNullable as te, ZodSchema as ne, ZodEffects as oe } from "zod";
3
+ import { ZodObject as z, ZodDefault as re, ZodNullable as te, ZodSchema as ne, ZodEffects as ae } from "zod";
4
4
  function L(e) {
5
5
  return Array.isArray(e);
6
6
  }
7
- function ae(e) {
7
+ function oe(e) {
8
8
  return typeof e < "u";
9
9
  }
10
10
  function M(e) {
11
11
  return e === null;
12
12
  }
13
- function U(e) {
13
+ function J(e) {
14
14
  return typeof e == "object";
15
15
  }
16
- function q(e) {
16
+ function U(e) {
17
17
  return typeof e == "string";
18
18
  }
19
19
  function C(e) {
20
20
  return typeof e > "u";
21
21
  }
22
22
  const se = /^[0-9]+$/, ue = ["__proto__", "prototype", "constructor"];
23
- function Z(e, o, i) {
24
- const l = ae(i) ? i : void 0;
25
- if (!U(e) || !q(o))
23
+ function G(e, o, i) {
24
+ const l = oe(i) ? i : void 0;
25
+ if (!J(e) || !U(o))
26
26
  return l;
27
- const n = P(o);
28
- if (n.length !== 0) {
29
- for (const r of n) {
27
+ const a = P(o);
28
+ if (a.length !== 0) {
29
+ for (const r of a) {
30
30
  if (r === "*")
31
31
  continue;
32
- const a = function(s) {
33
- return s.map((u) => C(u) || M(u) ? u : L(u) ? a(u) : u[r]);
32
+ const u = function(n) {
33
+ return n.map((s) => C(s) || M(s) ? s : L(s) ? u(s) : s[r]);
34
34
  };
35
- if (L(e) && !se.test(r) ? e = a(e) : e = e[r], C(e) || M(e))
35
+ if (L(e) && !se.test(r) ? e = u(e) : e = e[r], C(e) || M(e))
36
36
  break;
37
37
  }
38
38
  return C(e) ? l : e;
39
39
  }
40
40
  }
41
- function z(e, o, i) {
42
- if (!U(e) || !q(o))
41
+ function q(e, o, i) {
42
+ if (!J(e) || !U(o))
43
43
  return;
44
44
  const l = P(o);
45
45
  if (l.length === 0)
46
46
  return;
47
- const n = l.length;
48
- for (let r = 0; r < n; r++) {
49
- const a = l[r];
50
- if (r === n - 1) {
51
- e[a] = i;
47
+ const a = l.length;
48
+ for (let r = 0; r < a; r++) {
49
+ const u = l[r];
50
+ if (r === a - 1) {
51
+ e[u] = i;
52
52
  return;
53
53
  }
54
- if (a === "*" && L(e)) {
55
- const s = l.slice(r + 1).join(".");
56
- for (const u of e)
57
- z(u, s, i);
54
+ if (u === "*" && L(e)) {
55
+ const n = l.slice(r + 1).join(".");
56
+ for (const s of e)
57
+ q(s, n, i);
58
58
  return;
59
59
  }
60
- C(e[a]) && (e[a] = {}), e = e[a];
60
+ C(e[u]) && (e[u] = {}), e = e[u];
61
61
  }
62
62
  }
63
63
  function P(e) {
64
64
  const o = e.split(/[.]|(?:\[(\d|\*)\])/).filter((i) => !!i);
65
65
  return o.some((i) => ue.indexOf(i) !== -1) ? [] : o;
66
66
  }
67
- var f = /* @__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 = "datetimeLocal", 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))(f || {}), G = /* @__PURE__ */ ((e) => (e.invalid = "invalid", e.valid = "valid", e))(G || {});
68
- const ie = (e, o, i, l = {}) => N({
67
+ var f = /* @__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 = "datetimeLocal", 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))(f || {}), N = /* @__PURE__ */ ((e) => (e.invalid = "invalid", e.valid = "valid", e))(N || {});
68
+ const ie = (e, o, i, l = {}) => W({
69
69
  name: "FieldComponent",
70
70
  props: {
71
71
  type: {
72
72
  type: String,
73
- validator: (n) => Object.values(f).includes(n),
73
+ validator: (a) => Object.values(f).includes(a),
74
74
  default: f.custom
75
75
  },
76
76
  is: {
@@ -96,61 +96,61 @@ const ie = (e, o, i, l = {}) => N({
96
96
  },
97
97
  emits: ["invalid", "valid", "update:formData", "update:modelValue"],
98
98
  expose: ["invalid", "invalidLabel", "errors"],
99
- setup(n, { slots: r, emit: a }) {
100
- const s = V({
99
+ setup(a, { slots: r, emit: u }) {
100
+ const n = V({
101
101
  get() {
102
102
  if (t != null && t.formData)
103
- return Z(
103
+ return G(
104
104
  Object(t.formData.value),
105
- String(n.name)
105
+ String(a.name)
106
106
  );
107
107
  },
108
108
  set(c) {
109
- t != null && t.formData && (z(
109
+ t != null && t.formData && (q(
110
110
  Object(t.formData.value),
111
- String(n.name),
111
+ String(a.name),
112
112
  c
113
- ), a("update:modelValue", {
114
- newValue: s.value,
113
+ ), u("update:modelValue", {
114
+ newValue: n.value,
115
115
  formData: t == null ? void 0 : t.formData
116
116
  }));
117
117
  }
118
118
  });
119
- Y(() => {
120
- s.value === void 0 && n.defaultValue !== void 0 && (s.value = n.defaultValue);
121
- }), D(() => {
122
- S(), k();
119
+ X(() => {
120
+ n.value === void 0 && a.defaultValue !== void 0 && (n.value = a.defaultValue);
121
+ }), Y(() => {
122
+ S(), y();
123
123
  });
124
- const u = O(o, void 0);
125
- u && u.fields.value.add(n.name);
126
- const t = O(e), { props: m, name: p } = J(n), h = V(() => {
124
+ const s = O(o, void 0);
125
+ s && s.fields.value.add(a.name);
126
+ const t = O(e), { props: m, name: p } = Z(a), h = V(() => {
127
127
  if (t != null && t.errors.value)
128
- return Z(t.errors.value, String(n.name));
129
- }), v = V(() => {
128
+ return G(t.errors.value, String(a.name));
129
+ }), d = V(() => {
130
130
  var c;
131
131
  return (c = h.value) == null ? void 0 : c._errors;
132
- }), d = V(() => h.value !== void 0), S = w(d, () => {
133
- d.value ? (a("invalid", v.value), u && u.errors.value.set(
134
- n.name,
132
+ }), v = V(() => h.value !== void 0), S = w(v, () => {
133
+ v.value ? (u("invalid", d.value), s && s.errors.value.set(
134
+ a.name,
135
135
  {
136
- _errors: v.value
136
+ _errors: d.value
137
137
  }
138
- )) : (a("valid", s.value), u && u.errors.value.delete(
139
- n.name
138
+ )) : (u("valid", n.value), s && s.errors.value.delete(
139
+ a.name
140
140
  ));
141
- }), k = w(
141
+ }), y = w(
142
142
  () => t == null ? void 0 : t.formData,
143
143
  () => {
144
- a("update:formData", t == null ? void 0 : t.formData);
144
+ u("update:formData", t == null ? void 0 : t.formData);
145
145
  },
146
146
  { deep: !0 }
147
- ), x = (c) => {
148
- s.value = c;
149
- }, I = V(() => typeof m.value == "function" ? m.value(t == null ? void 0 : t.formData) : m.value), W = V(() => ({
147
+ ), b = (c) => {
148
+ n.value = c;
149
+ }, I = V(() => typeof m.value == "function" ? m.value(t == null ? void 0 : t.formData) : m.value), A = V(() => ({
150
150
  ...I.value,
151
- name: I.value.name ?? n.name,
152
- invalid: d.value,
153
- valid: n.showValid ? !!(!d.value && s.value) : void 0,
151
+ name: I.value.name ?? a.name,
152
+ invalid: v.value,
153
+ valid: a.showValid ? !!(!v.value && n.value) : void 0,
154
154
  type: ((c) => {
155
155
  if ([
156
156
  f.text,
@@ -168,25 +168,24 @@ const ie = (e, o, i, l = {}) => N({
168
168
  f.color
169
169
  ].includes(c))
170
170
  return c;
171
- })(n.type),
172
- invalidLabel: v.value,
173
- modelValue: s.value,
174
- errors: n.is ? h.value : void 0,
175
- "onUpdate:modelValue": x
171
+ })(a.type),
172
+ invalidLabel: d.value,
173
+ modelValue: n.value,
174
+ "onUpdate:modelValue": b
176
175
  }));
177
176
  return _(i, {
178
- name: g(p),
179
- errors: g(h)
177
+ name: k(p),
178
+ errors: k(h)
180
179
  }), { component: V(() => {
181
- if (n.type === f.custom)
180
+ if (a.type === f.custom)
182
181
  return {
183
182
  render() {
184
183
  var c;
185
184
  return ((c = r.default) == null ? void 0 : c.call(r, {
186
- modelValue: s.value,
187
- onUpdate: x,
188
- invalid: d.value,
189
- invalidLabel: v.value,
185
+ modelValue: n.value,
186
+ onUpdate: b,
187
+ invalid: v.value,
188
+ invalidLabel: d.value,
190
189
  formData: t == null ? void 0 : t.formData.value,
191
190
  formErrors: t == null ? void 0 : t.errors.value,
192
191
  errors: h.value
@@ -195,30 +194,30 @@ const ie = (e, o, i, l = {}) => N({
195
194
  };
196
195
  if (!l.lazyLoad) {
197
196
  let c;
198
- switch (n.type) {
197
+ switch (a.type) {
199
198
  case f.select:
200
- c = b("VvSelect");
199
+ c = g("VvSelect");
201
200
  break;
202
201
  case f.checkbox:
203
- c = b("VvCheckbox");
202
+ c = g("VvCheckbox");
204
203
  break;
205
204
  case f.radio:
206
- c = b("VvRadio");
205
+ c = g("VvRadio");
207
206
  break;
208
207
  case f.textarea:
209
- c = b("VvTextarea");
208
+ c = g("VvTextarea");
210
209
  break;
211
210
  case f.radioGroup:
212
- c = b("VvRadioGroup");
211
+ c = g("VvRadioGroup");
213
212
  break;
214
213
  case f.checkboxGroup:
215
- c = b("VvCheckboxGroup");
214
+ c = g("VvCheckboxGroup");
216
215
  break;
217
216
  case f.combobox:
218
- c = b("VvCombobox");
217
+ c = g("VvCombobox");
219
218
  break;
220
219
  default:
221
- c = b("VvInputText");
220
+ c = g("VvInputText");
222
221
  }
223
222
  if (typeof c != "string")
224
223
  return c;
@@ -227,7 +226,7 @@ const ie = (e, o, i, l = {}) => N({
227
226
  );
228
227
  }
229
228
  return R(async () => {
230
- switch (l.sideEffects && await Promise.resolve(l.sideEffects(n.type)), n.type) {
229
+ switch (l.sideEffects && await Promise.resolve(l.sideEffects(a.type)), a.type) {
231
230
  case f.textarea:
232
231
  return import("@volverjs/ui-vue/vv-textarea");
233
232
  case f.radio:
@@ -243,49 +242,53 @@ const ie = (e, o, i, l = {}) => N({
243
242
  }
244
243
  return import("@volverjs/ui-vue/vv-input-text");
245
244
  });
246
- }), hasProps: W, invalid: d };
245
+ }), hasProps: A, invalid: v };
247
246
  },
248
247
  render() {
249
- return this.is ? y(this.is, this.hasProps, this.$slots) : this.type === f.custom ? y(this.component, null, this.$slots) : y(this.component, this.hasProps, this.$slots);
248
+ return this.is ? x(this.is, this.hasProps, this.$slots) : this.type === f.custom ? x(this.component, null, this.$slots) : x(this.component, this.hasProps, this.$slots);
250
249
  }
251
- }), H = (e, o = {}) => {
250
+ }), D = (e, o = {}) => {
252
251
  const i = (r) => {
253
- let a = r;
254
- for (; a instanceof oe; )
255
- a = a.innerType();
256
- return a;
252
+ let u = r;
253
+ for (; u instanceof ae; )
254
+ u = u.innerType();
255
+ return u;
257
256
  }, l = i(e);
258
257
  return {
259
- ...(l instanceof K ? l._def.unknownKeys === "passthrough" : !1) ? o : {},
258
+ ...(l instanceof z ? l._def.unknownKeys === "passthrough" : !1) ? o : {},
260
259
  ...Object.fromEntries(
261
- Object.entries(l.shape).map(([r, a]) => {
262
- const s = o[r], u = i(a);
260
+ Object.entries(l.shape).map(([r, u]) => {
261
+ const n = o[r], s = i(u);
263
262
  let t;
264
- if (u instanceof re && (t = u._def.defaultValue()), s === null && u instanceof te)
265
- return [r, s];
266
- if (u instanceof ne) {
267
- const m = u.safeParse(o[r]);
263
+ if (s instanceof re && (t = s._def.defaultValue()), n === null && s instanceof te)
264
+ return [r, n];
265
+ if (s instanceof ne) {
266
+ const m = s.safeParse(o[r]);
268
267
  if (m.success)
269
268
  return [r, m.data ?? t];
270
269
  }
271
- return u instanceof K ? [
270
+ return s instanceof z ? [
272
271
  r,
273
- H(
274
- u,
275
- s && typeof s == "object" ? s : {}
272
+ D(
273
+ s,
274
+ n && typeof n == "object" ? n : {}
276
275
  )
277
276
  ] : [r, t];
278
277
  })
279
278
  )
280
279
  };
281
280
  }, le = (e, o, i) => {
282
- const l = E(), n = E(), r = E(), a = N({
281
+ const l = E(), a = E(), r = E(), u = W({
283
282
  name: "FormComponent",
284
283
  props: {
285
284
  modelValue: {
286
285
  type: Object,
287
286
  default: () => ({})
288
287
  },
288
+ updateThrottle: {
289
+ type: Number,
290
+ default: 500
291
+ },
289
292
  continuosValidation: {
290
293
  type: Boolean,
291
294
  default: !1
@@ -293,53 +296,56 @@ const ie = (e, o, i, l = {}) => N({
293
296
  },
294
297
  emits: ["invalid", "valid", "submit", "update:modelValue"],
295
298
  expose: ["submit", "errors", "status"],
296
- setup(s, { emit: u }) {
297
- r.value = H(e, s.modelValue);
298
- const t = (i == null ? void 0 : i.continuosValidation) || s.continuosValidation;
299
+ setup(n, { emit: s }) {
300
+ r.value = D(e, n.modelValue);
301
+ const t = (i == null ? void 0 : i.continuosValidation) ?? n.continuosValidation;
299
302
  w(
300
- () => s.modelValue,
301
- (v) => {
302
- if (v) {
303
- const d = T(v) ? j(v) : v;
304
- r.value = typeof (d == null ? void 0 : d.clone) == "function" ? d.clone() : JSON.parse(JSON.stringify(d));
303
+ () => n.modelValue,
304
+ (d) => {
305
+ if (d) {
306
+ const v = T(d) ? j(d) : d;
307
+ r.value = typeof (v == null ? void 0 : v.clone) == "function" ? v.clone() : JSON.parse(JSON.stringify(v));
305
308
  }
306
309
  },
307
310
  { deep: !0 }
308
311
  ), ee(
309
312
  r,
310
- (v) => {
311
- (l.value || t) && m(), (!v || !s.modelValue || JSON.stringify(v) !== JSON.stringify(s.modelValue)) && u("update:modelValue", v);
313
+ (d) => {
314
+ (l.value || t) && m(), (!d || !n.modelValue || JSON.stringify(d) !== JSON.stringify(n.modelValue)) && s("update:modelValue", d);
312
315
  },
313
- { deep: !0, throttle: (i == null ? void 0 : i.updateThrottle) ?? 500 }
316
+ {
317
+ deep: !0,
318
+ throttle: (i == null ? void 0 : i.updateThrottle) ?? n.updateThrottle
319
+ }
314
320
  );
315
- const m = (v = r.value) => {
316
- const d = e.safeParse(v);
317
- return d.success ? (l.value = void 0, n.value = G.valid, r.value = d.data, u("update:modelValue", r.value), u("valid", d.data), !0) : (l.value = d.error.format(), n.value = G.invalid, u("invalid", l.value), !1);
318
- }, p = () => m() ? (u("submit", r.value), !0) : !1, h = V(() => n.value === G.invalid);
321
+ const m = (d = r.value) => {
322
+ const v = e.safeParse(d);
323
+ return v.success ? (l.value = void 0, a.value = N.valid, r.value = v.data, s("update:modelValue", r.value), s("valid", v.data), !0) : (l.value = v.error.format(), a.value = N.invalid, s("invalid", l.value), !1);
324
+ }, p = () => m() ? (s("submit", r.value), !0) : !1, h = V(() => a.value === N.invalid);
319
325
  return _(o, {
320
326
  formData: r,
321
327
  submit: p,
322
- errors: g(l),
323
- status: g(n),
328
+ errors: k(l),
329
+ status: k(a),
324
330
  invalid: h
325
331
  }), {
326
332
  formData: r,
327
333
  submit: p,
328
- errors: g(l),
329
- status: g(n),
334
+ errors: k(l),
335
+ status: k(a),
330
336
  invalid: h
331
337
  };
332
338
  },
333
339
  render() {
334
- return y(
340
+ return x(
335
341
  "form",
336
342
  {
337
343
  onSubmit: F(this.submit, ["prevent"])
338
344
  },
339
345
  {
340
346
  default: () => {
341
- var s, u;
342
- return ((u = (s = this.$slots) == null ? void 0 : s.default) == null ? void 0 : u.call(s, {
347
+ var n, s;
348
+ return ((s = (n = this.$slots) == null ? void 0 : n.default) == null ? void 0 : s.call(n, {
343
349
  formData: this.formData,
344
350
  submit: this.submit,
345
351
  errors: this.errors,
@@ -353,14 +359,14 @@ const ie = (e, o, i, l = {}) => N({
353
359
  });
354
360
  return {
355
361
  errors: l,
356
- status: n,
362
+ status: a,
357
363
  formData: r,
358
364
  /**
359
365
  * An hack to add types to the default slot
360
366
  */
361
- VvForm: a
367
+ VvForm: u
362
368
  };
363
- }, fe = (e, o) => N({
369
+ }, fe = (e, o) => W({
364
370
  name: "WrapperComponent",
365
371
  props: {
366
372
  name: {
@@ -374,56 +380,56 @@ const ie = (e, o, i, l = {}) => N({
374
380
  },
375
381
  emits: ["invalid", "valid"],
376
382
  expose: ["fields", "invalid"],
377
- setup(l, { emit: n }) {
378
- const r = O(e), a = O(o, void 0), s = E(/* @__PURE__ */ new Set()), u = E(/* @__PURE__ */ new Map()), { name: t } = J(l);
383
+ setup(l, { emit: a }) {
384
+ const r = O(e), u = O(o, void 0), n = E(/* @__PURE__ */ new Set()), s = E(/* @__PURE__ */ new Map()), { name: t } = Z(l);
379
385
  _(o, {
380
- name: g(t),
381
- errors: u,
382
- fields: s
386
+ name: k(t),
387
+ errors: s,
388
+ fields: n
383
389
  }), w(
384
- s,
390
+ n,
385
391
  (p) => {
386
- a != null && a.fields && p.forEach((h) => {
387
- a == null || a.fields.value.add(h);
392
+ u != null && u.fields && p.forEach((h) => {
393
+ u == null || u.fields.value.add(h);
388
394
  });
389
395
  },
390
396
  { deep: !0 }
391
397
  ), w(
392
- () => new Map(u.value),
398
+ () => new Map(s.value),
393
399
  (p, h) => {
394
- a != null && a.errors && (Array.from(h.keys()).forEach((v) => {
395
- a.errors.value.delete(v);
396
- }), Array.from(p.keys()).forEach((v) => {
397
- const d = p.get(v);
398
- d && a.errors.value.set(v, d);
400
+ u != null && u.errors && (Array.from(h.keys()).forEach((d) => {
401
+ u.errors.value.delete(d);
402
+ }), Array.from(p.keys()).forEach((d) => {
403
+ const v = p.get(d);
404
+ v && u.errors.value.set(d, v);
399
405
  }));
400
406
  },
401
407
  { deep: !0 }
402
408
  );
403
- const m = V(() => r != null && r.invalid.value ? u.value.size > 0 : !1);
409
+ const m = V(() => r != null && r.invalid.value ? s.value.size > 0 : !1);
404
410
  return w(m, () => {
405
- m.value ? n("invalid") : n("valid");
411
+ m.value ? a("invalid") : a("valid");
406
412
  }), {
407
413
  formData: r == null ? void 0 : r.formData,
408
414
  errors: r == null ? void 0 : r.errors,
409
415
  invalid: m,
410
- fields: s,
411
- fieldsErrors: u
416
+ fields: n,
417
+ fieldsErrors: s
412
418
  };
413
419
  },
414
420
  render() {
415
- var l, n;
416
- return this.tag ? y(this.tag, null, {
421
+ var l, a;
422
+ return this.tag ? x(this.tag, null, {
417
423
  default: () => {
418
- var r, a;
419
- return ((a = (r = this.$slots).default) == null ? void 0 : a.call(r, {
424
+ var r, u;
425
+ return ((u = (r = this.$slots).default) == null ? void 0 : u.call(r, {
420
426
  invalid: this.invalid,
421
427
  formData: this.formData,
422
428
  errors: this.errors,
423
429
  fieldsErrors: this.fieldsErrors
424
430
  })) ?? this.$slots.defalut;
425
431
  }
426
- }) : ((n = (l = this.$slots).default) == null ? void 0 : n.call(l, {
432
+ }) : ((a = (l = this.$slots).default) == null ? void 0 : a.call(l, {
427
433
  invalid: this.invalid,
428
434
  formData: this.formData,
429
435
  errors: this.errors,
@@ -431,66 +437,75 @@ const ie = (e, o, i, l = {}) => N({
431
437
  })) ?? this.$slots.defalut;
432
438
  }
433
439
  }), ce = (e, o) => {
434
- const i = N({
440
+ const i = W({
435
441
  props: {
436
442
  schema: {
437
443
  type: [Array, Function],
438
444
  required: !0
439
445
  }
440
446
  },
441
- setup(l, { slots: n }) {
442
- const r = O(e), a = typeof l.schema == "function" ? l.schema(r) : l.schema;
443
- let s;
447
+ setup(l, { slots: a }) {
448
+ const r = O(e);
449
+ if (!(r != null && r.formData))
450
+ return;
451
+ const u = typeof l.schema == "function" ? l.schema(r) : l.schema;
452
+ let n;
444
453
  return () => {
445
- var u;
446
- return a == null ? void 0 : a.reduce(
454
+ var s;
455
+ return u.reduce(
447
456
  (t, m) => {
448
457
  const p = typeof m == "function" ? m(r) : m, {
449
458
  vvIs: h,
450
- vvName: v,
451
- vvSlots: d,
459
+ vvName: d,
460
+ vvSlots: v,
452
461
  vvChildren: S,
453
- vvIf: k,
454
- vvElseIf: x,
462
+ vvIf: y,
463
+ vvElseIf: b,
455
464
  vvType: I,
456
- vvDefaultValue: W,
457
- vvShowValid: B,
465
+ vvDefaultValue: A,
466
+ vvShowValid: K,
458
467
  ...c
459
468
  } = p;
460
- if (k !== void 0) {
461
- if (s = typeof k == "function" ? $(k(r)) : $(k), !s)
469
+ if (y !== void 0) {
470
+ if (typeof y == "string" ? n = !!G(
471
+ Object(r.formData.value),
472
+ y
473
+ ) : typeof y == "function" ? n = $(y(r)) : n = $(y), !n)
462
474
  return t;
463
- } else if (x !== void 0 && s !== void 0) {
464
- if (s || (s = typeof x == "function" ? $(x(r)) : $(x), !s))
475
+ } else if (b !== void 0 && n !== void 0) {
476
+ if (n || (typeof b == "string" ? n = !!G(
477
+ Object(r.formData.value),
478
+ b
479
+ ) : typeof b == "function" ? n = $(b(r)) : n = $(b), !n))
465
480
  return t;
466
481
  } else
467
- s = void 0;
468
- const A = S ? y(i, {
482
+ n = void 0;
483
+ const B = S ? x(i, {
469
484
  schema: S
470
485
  }) : void 0;
471
- return v ? (t.push(
472
- y(
486
+ return d ? (t.push(
487
+ x(
473
488
  o,
474
489
  {
475
- name: v,
490
+ name: d,
476
491
  is: h,
477
492
  type: I,
478
- defaultValue: W,
479
- showValid: B,
493
+ defaultValue: A,
494
+ showValid: K,
480
495
  props: c
481
496
  },
482
- d ?? A
497
+ v ?? B
483
498
  )
484
499
  ), t) : h ? (t.push(
485
- y(
500
+ x(
486
501
  h,
487
502
  c,
488
- d ?? A
503
+ v ?? B
489
504
  )
490
- ), t) : (S && t.push(A), t);
505
+ ), t) : (S && t.push(B), t);
491
506
  },
492
507
  [
493
- (u = n == null ? void 0 : n.default) == null ? void 0 : u.call(n, {
508
+ (s = a == null ? void 0 : a.default) == null ? void 0 : s.call(a, {
494
509
  formData: r == null ? void 0 : r.formData.value,
495
510
  submit: r == null ? void 0 : r.submit,
496
511
  errors: r == null ? void 0 : r.errors.value,
@@ -503,8 +518,8 @@ const ie = (e, o, i, l = {}) => N({
503
518
  }
504
519
  });
505
520
  return i;
506
- }, Q = (e, o = {}) => {
507
- const i = Symbol(), l = Symbol(), n = Symbol(), { VvForm: r, errors: a, status: s, formData: u } = le(
521
+ }, H = (e, o = {}) => {
522
+ const i = Symbol(), l = Symbol(), a = Symbol(), { VvForm: r, errors: u, status: n, formData: s } = le(
508
523
  e,
509
524
  i,
510
525
  o
@@ -514,7 +529,7 @@ const ie = (e, o, i, l = {}) => N({
514
529
  ), m = ie(
515
530
  i,
516
531
  l,
517
- n,
532
+ a,
518
533
  o
519
534
  ), p = ce(i, m);
520
535
  return {
@@ -524,28 +539,28 @@ const ie = (e, o, i, l = {}) => N({
524
539
  VvFormTemplate: p,
525
540
  formInjectionKey: i,
526
541
  formWrapperInjectionKey: l,
527
- formFieldInjectionKey: n,
528
- errors: a,
529
- status: s,
530
- formData: u
542
+ formFieldInjectionKey: a,
543
+ errors: u,
544
+ status: n,
545
+ formData: s
531
546
  };
532
- }, X = Symbol(), he = (e) => {
547
+ }, Q = Symbol(), he = (e) => {
533
548
  let o = {};
534
- return e.schema && (o = Q(e.schema, e)), {
549
+ return e.schema && (o = H(e.schema, e)), {
535
550
  ...o,
536
551
  install(i, { global: l = !1 } = {}) {
537
- i.provide(X, e), l && (i.config.globalProperties.$vvForm = e, o != null && o.VvForm && i.component("VvForm", o.VvForm), o != null && o.VvFormWrapper && i.component("VvFormWrapper", o.VvFormWrapper), o != null && o.VvFormField && i.component("VvFormField", o.VvFormField), o != null && o.VvFormTemplate && i.component("VvFormTemplate", o.VvFormTemplate));
552
+ i.provide(Q, e), l && (i.config.globalProperties.$vvForm = e, o != null && o.VvForm && i.component("VvForm", o.VvForm), o != null && o.VvFormWrapper && i.component("VvFormWrapper", o.VvFormWrapper), o != null && o.VvFormField && i.component("VvFormField", o.VvFormField), o != null && o.VvFormTemplate && i.component("VvFormTemplate", o.VvFormTemplate));
538
553
  }
539
554
  };
540
555
  }, pe = (e, o = {}) => {
541
- const i = { ...O(X, {}), ...o };
542
- return Q(e, i);
556
+ const i = { ...O(Q, {}), ...o };
557
+ return H(e, i);
543
558
  };
544
559
  export {
545
560
  f as FormFieldType,
546
561
  he as createForm,
547
- H as defaultObjectBySchema,
548
- Q as formFactory,
549
- X as pluginInjectionKey,
562
+ D as defaultObjectBySchema,
563
+ H as formFactory,
564
+ Q as pluginInjectionKey,
550
565
  pe as useForm
551
566
  };