@soft-stech/bootsman-ui-shadcn 1.1.26 → 1.1.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/BuiAccordionTrigger.vue_vue_type_script_setup_true_lang-Brr7tYY4.js +47 -0
- package/dist/{BuiFormControl.vue_vue_type_script_setup_true_lang-C7GX_3fQ.js → BuiFormControl.vue_vue_type_script_setup_true_lang-DBf2R0rh.js} +4 -4
- package/dist/{BuiFormDescription.vue_vue_type_script_setup_true_lang-BtjoOGcc.js → BuiFormDescription.vue_vue_type_script_setup_true_lang-DESVSeBk.js} +4 -4
- package/dist/{BuiFormItem.vue_vue_type_script_setup_true_lang-06zxWttI.js → BuiFormItem.vue_vue_type_script_setup_true_lang-DQtpoiOP.js} +1 -1
- package/dist/{BuiFormLabel.vue_vue_type_script_setup_true_lang-B8gqkOHv.js → BuiFormLabel.vue_vue_type_script_setup_true_lang-CdTsKLdJ.js} +1 -1
- package/dist/{BuiFormMessage.vue_vue_type_script_setup_true_lang-CfJtHa1g.js → BuiFormMessage.vue_vue_type_script_setup_true_lang-BtxFDcdt.js} +2 -2
- package/dist/assets/main.css +1 -1
- package/dist/components/ui/accordion/BuiAccordionTrigger.js +1 -1
- package/dist/components/ui/accordion/index.js +1 -1
- package/dist/components/ui/form/BuiFormControl.js +1 -1
- package/dist/components/ui/form/BuiFormDescription.js +1 -1
- package/dist/components/ui/form/BuiFormItem.js +2 -2
- package/dist/components/ui/form/BuiFormLabel.js +1 -1
- package/dist/components/ui/form/BuiFormMessage.js +1 -1
- package/dist/components/ui/form/index.d.ts +1 -1
- package/dist/components/ui/form/index.js +14 -13
- package/dist/components/ui/form/useFormField.js +2 -2
- package/dist/index.js +174 -173
- package/dist/useFormField-_ngdGlTO.js +2309 -0
- package/package.json +3 -3
- package/src/components/stories/BuiForm.story.vue +5 -0
- package/src/components/stories/components/SubForm.vue +22 -0
- package/src/components/stories/components/UseBuiField.vue +85 -0
- package/src/components/ui/accordion/BuiAccordionTrigger.vue +1 -1
- package/src/components/ui/form/BuiFormItem.vue +1 -1
- package/src/components/ui/form/index.ts +2 -1
- package/dist/BuiAccordionTrigger.vue_vue_type_script_setup_true_lang-BsG3KIIF.js +0 -44
- package/dist/useFormField-JfQGp33E.js +0 -2290
@@ -1,2290 +0,0 @@
|
|
1
|
-
import { ref as se, reactive as We, computed as k, unref as T, nextTick as he, warn as Rt, onMounted as Ut, isRef as qe, watch as fe, provide as Dt, toValue as S, readonly as dn, watchEffect as cn, getCurrentInstance as Ee, onUnmounted as Lt, defineComponent as Je, toRef as _e, resolveDynamicComponent as mt, h as Ge, shallowRef as fn, inject as Ce, onBeforeUnmount as $t } from "vue";
|
2
|
-
import { F as vn } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-06zxWttI.js";
|
3
|
-
function hn() {
|
4
|
-
return xt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
5
|
-
}
|
6
|
-
function xt() {
|
7
|
-
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
8
|
-
}
|
9
|
-
const mn = typeof Proxy == "function", gn = "devtools-plugin:setup", pn = "plugin:settings:set";
|
10
|
-
let Fe, dt;
|
11
|
-
function yn() {
|
12
|
-
var e;
|
13
|
-
return Fe !== void 0 || (typeof window < "u" && window.performance ? (Fe = !0, dt = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (Fe = !0, dt = globalThis.perf_hooks.performance) : Fe = !1), Fe;
|
14
|
-
}
|
15
|
-
function bn() {
|
16
|
-
return yn() ? dt.now() : Date.now();
|
17
|
-
}
|
18
|
-
class Vn {
|
19
|
-
constructor(t, n) {
|
20
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
21
|
-
const r = {};
|
22
|
-
if (t.settings)
|
23
|
-
for (const o in t.settings) {
|
24
|
-
const d = t.settings[o];
|
25
|
-
r[o] = d.defaultValue;
|
26
|
-
}
|
27
|
-
const i = `__vue-devtools-plugin-settings__${t.id}`;
|
28
|
-
let u = Object.assign({}, r);
|
29
|
-
try {
|
30
|
-
const o = localStorage.getItem(i), d = JSON.parse(o);
|
31
|
-
Object.assign(u, d);
|
32
|
-
} catch {
|
33
|
-
}
|
34
|
-
this.fallbacks = {
|
35
|
-
getSettings() {
|
36
|
-
return u;
|
37
|
-
},
|
38
|
-
setSettings(o) {
|
39
|
-
try {
|
40
|
-
localStorage.setItem(i, JSON.stringify(o));
|
41
|
-
} catch {
|
42
|
-
}
|
43
|
-
u = o;
|
44
|
-
},
|
45
|
-
now() {
|
46
|
-
return bn();
|
47
|
-
}
|
48
|
-
}, n && n.on(pn, (o, d) => {
|
49
|
-
o === this.plugin.id && this.fallbacks.setSettings(d);
|
50
|
-
}), this.proxiedOn = new Proxy({}, {
|
51
|
-
get: (o, d) => this.target ? this.target.on[d] : (...c) => {
|
52
|
-
this.onQueue.push({
|
53
|
-
method: d,
|
54
|
-
args: c
|
55
|
-
});
|
56
|
-
}
|
57
|
-
}), this.proxiedTarget = new Proxy({}, {
|
58
|
-
get: (o, d) => this.target ? this.target[d] : d === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(d) ? (...c) => (this.targetQueue.push({
|
59
|
-
method: d,
|
60
|
-
args: c,
|
61
|
-
resolve: () => {
|
62
|
-
}
|
63
|
-
}), this.fallbacks[d](...c)) : (...c) => new Promise((f) => {
|
64
|
-
this.targetQueue.push({
|
65
|
-
method: d,
|
66
|
-
args: c,
|
67
|
-
resolve: f
|
68
|
-
});
|
69
|
-
})
|
70
|
-
});
|
71
|
-
}
|
72
|
-
async setRealTarget(t) {
|
73
|
-
this.target = t;
|
74
|
-
for (const n of this.onQueue)
|
75
|
-
this.target.on[n.method](...n.args);
|
76
|
-
for (const n of this.targetQueue)
|
77
|
-
n.resolve(await this.target[n.method](...n.args));
|
78
|
-
}
|
79
|
-
}
|
80
|
-
function On(e, t) {
|
81
|
-
const n = e, r = xt(), i = hn(), u = mn && n.enableEarlyProxy;
|
82
|
-
if (i && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !u))
|
83
|
-
i.emit(gn, e, t);
|
84
|
-
else {
|
85
|
-
const o = u ? new Vn(n, i) : null;
|
86
|
-
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
87
|
-
pluginDescriptor: n,
|
88
|
-
setupFn: t,
|
89
|
-
proxy: o
|
90
|
-
}), o && t(o.proxiedTarget);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
/**
|
94
|
-
* vee-validate v4.12.6
|
95
|
-
* (c) 2024 Abdelrahman Awad
|
96
|
-
* @license MIT
|
97
|
-
*/
|
98
|
-
function ee(e) {
|
99
|
-
return typeof e == "function";
|
100
|
-
}
|
101
|
-
function we(e) {
|
102
|
-
return e == null;
|
103
|
-
}
|
104
|
-
const Ve = (e) => e !== null && !!e && typeof e == "object" && !Array.isArray(e);
|
105
|
-
function gt(e) {
|
106
|
-
return Number(e) >= 0;
|
107
|
-
}
|
108
|
-
function _n(e) {
|
109
|
-
const t = parseFloat(e);
|
110
|
-
return isNaN(t) ? e : t;
|
111
|
-
}
|
112
|
-
function Sn(e) {
|
113
|
-
return typeof e == "object" && e !== null;
|
114
|
-
}
|
115
|
-
function En(e) {
|
116
|
-
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
117
|
-
}
|
118
|
-
function It(e) {
|
119
|
-
if (!Sn(e) || En(e) !== "[object Object]")
|
120
|
-
return !1;
|
121
|
-
if (Object.getPrototypeOf(e) === null)
|
122
|
-
return !0;
|
123
|
-
let t = e;
|
124
|
-
for (; Object.getPrototypeOf(t) !== null; )
|
125
|
-
t = Object.getPrototypeOf(t);
|
126
|
-
return Object.getPrototypeOf(e) === t;
|
127
|
-
}
|
128
|
-
function Re(e, t) {
|
129
|
-
return Object.keys(t).forEach((n) => {
|
130
|
-
if (It(t[n]) && It(e[n])) {
|
131
|
-
e[n] || (e[n] = {}), Re(e[n], t[n]);
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
e[n] = t[n];
|
135
|
-
}), e;
|
136
|
-
}
|
137
|
-
function Pe(e) {
|
138
|
-
const t = e.split(".");
|
139
|
-
if (!t.length)
|
140
|
-
return "";
|
141
|
-
let n = String(t[0]);
|
142
|
-
for (let r = 1; r < t.length; r++) {
|
143
|
-
if (gt(t[r])) {
|
144
|
-
n += `[${t[r]}]`;
|
145
|
-
continue;
|
146
|
-
}
|
147
|
-
n += `.${t[r]}`;
|
148
|
-
}
|
149
|
-
return n;
|
150
|
-
}
|
151
|
-
const An = {};
|
152
|
-
function In(e) {
|
153
|
-
return An[e];
|
154
|
-
}
|
155
|
-
function Ft(e, t, n) {
|
156
|
-
typeof n.value == "object" && (n.value = N(n.value)), !n.enumerable || n.get || n.set || !n.configurable || !n.writable || t === "__proto__" ? Object.defineProperty(e, t, n) : e[t] = n.value;
|
157
|
-
}
|
158
|
-
function N(e) {
|
159
|
-
if (typeof e != "object")
|
160
|
-
return e;
|
161
|
-
var t = 0, n, r, i, u = Object.prototype.toString.call(e);
|
162
|
-
if (u === "[object Object]" ? i = Object.create(e.__proto__ || null) : u === "[object Array]" ? i = Array(e.length) : u === "[object Set]" ? (i = /* @__PURE__ */ new Set(), e.forEach(function(o) {
|
163
|
-
i.add(N(o));
|
164
|
-
})) : u === "[object Map]" ? (i = /* @__PURE__ */ new Map(), e.forEach(function(o, d) {
|
165
|
-
i.set(N(d), N(o));
|
166
|
-
})) : u === "[object Date]" ? i = /* @__PURE__ */ new Date(+e) : u === "[object RegExp]" ? i = new RegExp(e.source, e.flags) : u === "[object DataView]" ? i = new e.constructor(N(e.buffer)) : u === "[object ArrayBuffer]" ? i = e.slice(0) : u.slice(-6) === "Array]" && (i = new e.constructor(e)), i) {
|
167
|
-
for (r = Object.getOwnPropertySymbols(e); t < r.length; t++)
|
168
|
-
Ft(i, r[t], Object.getOwnPropertyDescriptor(e, r[t]));
|
169
|
-
for (t = 0, r = Object.getOwnPropertyNames(e); t < r.length; t++)
|
170
|
-
Object.hasOwnProperty.call(i, n = r[t]) && i[n] === e[n] || Ft(i, n, Object.getOwnPropertyDescriptor(e, n));
|
171
|
-
}
|
172
|
-
return i || e;
|
173
|
-
}
|
174
|
-
const Ae = Symbol("vee-validate-form"), Ye = Symbol("vee-validate-field-instance"), He = Symbol("Default empty value"), Fn = typeof window < "u";
|
175
|
-
function ct(e) {
|
176
|
-
return ee(e) && !!e.__locatorRef;
|
177
|
-
}
|
178
|
-
function me(e) {
|
179
|
-
return !!e && ee(e.parse) && e.__type === "VVTypedSchema";
|
180
|
-
}
|
181
|
-
function Ke(e) {
|
182
|
-
return !!e && ee(e.validate);
|
183
|
-
}
|
184
|
-
function Ue(e) {
|
185
|
-
return e === "checkbox" || e === "radio";
|
186
|
-
}
|
187
|
-
function wn(e) {
|
188
|
-
return Ve(e) || Array.isArray(e);
|
189
|
-
}
|
190
|
-
function jn(e) {
|
191
|
-
return Array.isArray(e) ? e.length === 0 : Ve(e) && Object.keys(e).length === 0;
|
192
|
-
}
|
193
|
-
function Xe(e) {
|
194
|
-
return /^\[.+\]$/i.test(e);
|
195
|
-
}
|
196
|
-
function Cn(e) {
|
197
|
-
return zt(e) && e.multiple;
|
198
|
-
}
|
199
|
-
function zt(e) {
|
200
|
-
return e.tagName === "SELECT";
|
201
|
-
}
|
202
|
-
function kn(e, t) {
|
203
|
-
const n = ![!1, null, void 0, 0].includes(t.multiple) && !Number.isNaN(t.multiple);
|
204
|
-
return e === "select" && "multiple" in t && n;
|
205
|
-
}
|
206
|
-
function Nn(e, t) {
|
207
|
-
return !kn(e, t) && t.type !== "file" && !Ue(t.type);
|
208
|
-
}
|
209
|
-
function Wt(e) {
|
210
|
-
return pt(e) && e.target && "submit" in e.target;
|
211
|
-
}
|
212
|
-
function pt(e) {
|
213
|
-
return e ? !!(typeof Event < "u" && ee(Event) && e instanceof Event || e && e.srcElement) : !1;
|
214
|
-
}
|
215
|
-
function wt(e, t) {
|
216
|
-
return t in e && e[t] !== He;
|
217
|
-
}
|
218
|
-
function G(e, t) {
|
219
|
-
if (e === t)
|
220
|
-
return !0;
|
221
|
-
if (e && t && typeof e == "object" && typeof t == "object") {
|
222
|
-
if (e.constructor !== t.constructor)
|
223
|
-
return !1;
|
224
|
-
var n, r, i;
|
225
|
-
if (Array.isArray(e)) {
|
226
|
-
if (n = e.length, n != t.length)
|
227
|
-
return !1;
|
228
|
-
for (r = n; r-- !== 0; )
|
229
|
-
if (!G(e[r], t[r]))
|
230
|
-
return !1;
|
231
|
-
return !0;
|
232
|
-
}
|
233
|
-
if (e instanceof Map && t instanceof Map) {
|
234
|
-
if (e.size !== t.size)
|
235
|
-
return !1;
|
236
|
-
for (r of e.entries())
|
237
|
-
if (!t.has(r[0]))
|
238
|
-
return !1;
|
239
|
-
for (r of e.entries())
|
240
|
-
if (!G(r[1], t.get(r[0])))
|
241
|
-
return !1;
|
242
|
-
return !0;
|
243
|
-
}
|
244
|
-
if (jt(e) && jt(t))
|
245
|
-
return !(e.size !== t.size || e.name !== t.name || e.lastModified !== t.lastModified || e.type !== t.type);
|
246
|
-
if (e instanceof Set && t instanceof Set) {
|
247
|
-
if (e.size !== t.size)
|
248
|
-
return !1;
|
249
|
-
for (r of e.entries())
|
250
|
-
if (!t.has(r[0]))
|
251
|
-
return !1;
|
252
|
-
return !0;
|
253
|
-
}
|
254
|
-
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
255
|
-
if (n = e.length, n != t.length)
|
256
|
-
return !1;
|
257
|
-
for (r = n; r-- !== 0; )
|
258
|
-
if (e[r] !== t[r])
|
259
|
-
return !1;
|
260
|
-
return !0;
|
261
|
-
}
|
262
|
-
if (e.constructor === RegExp)
|
263
|
-
return e.source === t.source && e.flags === t.flags;
|
264
|
-
if (e.valueOf !== Object.prototype.valueOf)
|
265
|
-
return e.valueOf() === t.valueOf();
|
266
|
-
if (e.toString !== Object.prototype.toString)
|
267
|
-
return e.toString() === t.toString();
|
268
|
-
for (i = Object.keys(e), n = i.length, r = n; r-- !== 0; ) {
|
269
|
-
var u = i[r];
|
270
|
-
if (!G(e[u], t[u]))
|
271
|
-
return !1;
|
272
|
-
}
|
273
|
-
return !0;
|
274
|
-
}
|
275
|
-
return e !== e && t !== t;
|
276
|
-
}
|
277
|
-
function jt(e) {
|
278
|
-
return Fn ? e instanceof File : !1;
|
279
|
-
}
|
280
|
-
function yt(e) {
|
281
|
-
return Xe(e) ? e.replace(/\[|\]/gi, "") : e;
|
282
|
-
}
|
283
|
-
function L(e, t, n) {
|
284
|
-
return e ? Xe(t) ? e[yt(t)] : (t || "").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i, u) => wn(i) && u in i ? i[u] : n, e) : n;
|
285
|
-
}
|
286
|
-
function Y(e, t, n) {
|
287
|
-
if (Xe(t)) {
|
288
|
-
e[yt(t)] = n;
|
289
|
-
return;
|
290
|
-
}
|
291
|
-
const r = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
292
|
-
let i = e;
|
293
|
-
for (let u = 0; u < r.length; u++) {
|
294
|
-
if (u === r.length - 1) {
|
295
|
-
i[r[u]] = n;
|
296
|
-
return;
|
297
|
-
}
|
298
|
-
(!(r[u] in i) || we(i[r[u]])) && (i[r[u]] = gt(r[u + 1]) ? [] : {}), i = i[r[u]];
|
299
|
-
}
|
300
|
-
}
|
301
|
-
function ot(e, t) {
|
302
|
-
if (Array.isArray(e) && gt(t)) {
|
303
|
-
e.splice(Number(t), 1);
|
304
|
-
return;
|
305
|
-
}
|
306
|
-
Ve(e) && delete e[t];
|
307
|
-
}
|
308
|
-
function Ct(e, t) {
|
309
|
-
if (Xe(t)) {
|
310
|
-
delete e[yt(t)];
|
311
|
-
return;
|
312
|
-
}
|
313
|
-
const n = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
314
|
-
let r = e;
|
315
|
-
for (let u = 0; u < n.length; u++) {
|
316
|
-
if (u === n.length - 1) {
|
317
|
-
ot(r, n[u]);
|
318
|
-
break;
|
319
|
-
}
|
320
|
-
if (!(n[u] in r) || we(r[n[u]]))
|
321
|
-
break;
|
322
|
-
r = r[n[u]];
|
323
|
-
}
|
324
|
-
const i = n.map((u, o) => L(e, n.slice(0, o).join(".")));
|
325
|
-
for (let u = i.length - 1; u >= 0; u--)
|
326
|
-
if (jn(i[u])) {
|
327
|
-
if (u === 0) {
|
328
|
-
ot(e, n[0]);
|
329
|
-
continue;
|
330
|
-
}
|
331
|
-
ot(i[u - 1], n[u - 1]);
|
332
|
-
}
|
333
|
-
}
|
334
|
-
function le(e) {
|
335
|
-
return Object.keys(e);
|
336
|
-
}
|
337
|
-
function De(e, t = void 0) {
|
338
|
-
const n = Ee();
|
339
|
-
return n?.provides[e] || Ce(e, t);
|
340
|
-
}
|
341
|
-
function ze(e) {
|
342
|
-
Rt(`[vee-validate]: ${e}`);
|
343
|
-
}
|
344
|
-
function kt(e, t, n) {
|
345
|
-
if (Array.isArray(e)) {
|
346
|
-
const r = [...e], i = r.findIndex((u) => G(u, t));
|
347
|
-
return i >= 0 ? r.splice(i, 1) : r.push(t), r;
|
348
|
-
}
|
349
|
-
return G(e, t) ? n : t;
|
350
|
-
}
|
351
|
-
function Tn(e, t) {
|
352
|
-
let n, r;
|
353
|
-
return function(...i) {
|
354
|
-
const u = this;
|
355
|
-
return n || (n = !0, setTimeout(() => n = !1, t), r = e.apply(u, i)), r;
|
356
|
-
};
|
357
|
-
}
|
358
|
-
function Nt(e, t = 0) {
|
359
|
-
let n = null, r = [];
|
360
|
-
return function(...i) {
|
361
|
-
return n && clearTimeout(n), n = setTimeout(() => {
|
362
|
-
const u = e(...i);
|
363
|
-
r.forEach((o) => o(u)), r = [];
|
364
|
-
}, t), new Promise((u) => r.push(u));
|
365
|
-
};
|
366
|
-
}
|
367
|
-
function Pn(e, t) {
|
368
|
-
return Ve(t) && t.number ? _n(e) : e;
|
369
|
-
}
|
370
|
-
function ft(e, t) {
|
371
|
-
let n;
|
372
|
-
return async function(...i) {
|
373
|
-
const u = e(...i);
|
374
|
-
n = u;
|
375
|
-
const o = await u;
|
376
|
-
return u !== n ? o : (n = void 0, t(o, i));
|
377
|
-
};
|
378
|
-
}
|
379
|
-
function Mn({ get: e, set: t }) {
|
380
|
-
const n = se(N(e()));
|
381
|
-
return fe(e, (r) => {
|
382
|
-
G(r, n.value) || (n.value = N(r));
|
383
|
-
}, {
|
384
|
-
deep: !0
|
385
|
-
}), fe(n, (r) => {
|
386
|
-
G(r, e()) || t(N(r));
|
387
|
-
}, {
|
388
|
-
deep: !0
|
389
|
-
}), n;
|
390
|
-
}
|
391
|
-
function vt(e) {
|
392
|
-
return Array.isArray(e) ? e : e ? [e] : [];
|
393
|
-
}
|
394
|
-
function bt(e) {
|
395
|
-
const t = De(Ae), n = e ? k(() => t?.getPathState(S(e))) : void 0, r = e ? void 0 : Ce(Ye);
|
396
|
-
return !r && !n?.value && process.env.NODE_ENV !== "production" && ze(`field with name ${S(e)} was not found`), n || r;
|
397
|
-
}
|
398
|
-
function $e(e, t) {
|
399
|
-
const n = {};
|
400
|
-
for (const r in e)
|
401
|
-
t.includes(r) || (n[r] = e[r]);
|
402
|
-
return n;
|
403
|
-
}
|
404
|
-
function Bn(e) {
|
405
|
-
let t = null, n = [];
|
406
|
-
return function(...r) {
|
407
|
-
const i = he(() => {
|
408
|
-
if (t !== i)
|
409
|
-
return;
|
410
|
-
const u = e(...r);
|
411
|
-
n.forEach((o) => o(u)), n = [], t = null;
|
412
|
-
});
|
413
|
-
return t = i, new Promise((u) => n.push(u));
|
414
|
-
};
|
415
|
-
}
|
416
|
-
function Ze(e, t, n) {
|
417
|
-
return t.slots.default ? typeof e == "string" || !e ? t.slots.default(n()) : {
|
418
|
-
default: () => {
|
419
|
-
var r, i;
|
420
|
-
return (i = (r = t.slots).default) === null || i === void 0 ? void 0 : i.call(r, n());
|
421
|
-
}
|
422
|
-
} : t.slots.default;
|
423
|
-
}
|
424
|
-
function st(e) {
|
425
|
-
if (qt(e))
|
426
|
-
return e._value;
|
427
|
-
}
|
428
|
-
function qt(e) {
|
429
|
-
return "_value" in e;
|
430
|
-
}
|
431
|
-
function Rn(e) {
|
432
|
-
return e.type === "number" || e.type === "range" ? Number.isNaN(e.valueAsNumber) ? e.value : e.valueAsNumber : e.value;
|
433
|
-
}
|
434
|
-
function Qe(e) {
|
435
|
-
if (!pt(e))
|
436
|
-
return e;
|
437
|
-
const t = e.target;
|
438
|
-
if (Ue(t.type) && qt(t))
|
439
|
-
return st(t);
|
440
|
-
if (t.type === "file" && t.files) {
|
441
|
-
const n = Array.from(t.files);
|
442
|
-
return t.multiple ? n : n[0];
|
443
|
-
}
|
444
|
-
if (Cn(t))
|
445
|
-
return Array.from(t.options).filter((n) => n.selected && !n.disabled).map(st);
|
446
|
-
if (zt(t)) {
|
447
|
-
const n = Array.from(t.options).find((r) => r.selected);
|
448
|
-
return n ? st(n) : t.value;
|
449
|
-
}
|
450
|
-
return Rn(t);
|
451
|
-
}
|
452
|
-
function Gt(e) {
|
453
|
-
const t = {};
|
454
|
-
return Object.defineProperty(t, "_$$isNormalized", {
|
455
|
-
value: !0,
|
456
|
-
writable: !1,
|
457
|
-
enumerable: !1,
|
458
|
-
configurable: !1
|
459
|
-
}), e ? Ve(e) && e._$$isNormalized ? e : Ve(e) ? Object.keys(e).reduce((n, r) => {
|
460
|
-
const i = Un(e[r]);
|
461
|
-
return e[r] !== !1 && (n[r] = Tt(i)), n;
|
462
|
-
}, t) : typeof e != "string" ? t : e.split("|").reduce((n, r) => {
|
463
|
-
const i = Dn(r);
|
464
|
-
return i.name && (n[i.name] = Tt(i.params)), n;
|
465
|
-
}, t) : t;
|
466
|
-
}
|
467
|
-
function Un(e) {
|
468
|
-
return e === !0 ? [] : Array.isArray(e) || Ve(e) ? e : [e];
|
469
|
-
}
|
470
|
-
function Tt(e) {
|
471
|
-
const t = (n) => typeof n == "string" && n[0] === "@" ? Ln(n.slice(1)) : n;
|
472
|
-
return Array.isArray(e) ? e.map(t) : e instanceof RegExp ? [e] : Object.keys(e).reduce((n, r) => (n[r] = t(e[r]), n), {});
|
473
|
-
}
|
474
|
-
const Dn = (e) => {
|
475
|
-
let t = [];
|
476
|
-
const n = e.split(":")[0];
|
477
|
-
return e.includes(":") && (t = e.split(":").slice(1).join(":").split(",")), { name: n, params: t };
|
478
|
-
};
|
479
|
-
function Ln(e) {
|
480
|
-
const t = (n) => L(n, e) || n[e];
|
481
|
-
return t.__locatorRef = e, t;
|
482
|
-
}
|
483
|
-
function $n(e) {
|
484
|
-
return Array.isArray(e) ? e.filter(ct) : le(e).filter((t) => ct(e[t])).map((t) => e[t]);
|
485
|
-
}
|
486
|
-
const xn = {
|
487
|
-
generateMessage: ({ field: e }) => `${e} is not valid.`,
|
488
|
-
bails: !0,
|
489
|
-
validateOnBlur: !0,
|
490
|
-
validateOnChange: !0,
|
491
|
-
validateOnInput: !1,
|
492
|
-
validateOnModelUpdate: !0
|
493
|
-
};
|
494
|
-
let zn = Object.assign({}, xn);
|
495
|
-
const Se = () => zn;
|
496
|
-
async function Ht(e, t, n = {}) {
|
497
|
-
const r = n?.bails, i = {
|
498
|
-
name: n?.name || "{field}",
|
499
|
-
rules: t,
|
500
|
-
label: n?.label,
|
501
|
-
bails: r ?? !0,
|
502
|
-
formData: n?.values || {}
|
503
|
-
}, o = (await Wn(i, e)).errors;
|
504
|
-
return {
|
505
|
-
errors: o,
|
506
|
-
valid: !o.length
|
507
|
-
};
|
508
|
-
}
|
509
|
-
async function Wn(e, t) {
|
510
|
-
if (me(e.rules) || Ke(e.rules))
|
511
|
-
return Gn(t, e.rules);
|
512
|
-
if (ee(e.rules) || Array.isArray(e.rules)) {
|
513
|
-
const o = {
|
514
|
-
field: e.label || e.name,
|
515
|
-
name: e.name,
|
516
|
-
label: e.label,
|
517
|
-
form: e.formData,
|
518
|
-
value: t
|
519
|
-
}, d = Array.isArray(e.rules) ? e.rules : [e.rules], c = d.length, f = [];
|
520
|
-
for (let V = 0; V < c; V++) {
|
521
|
-
const b = d[V], C = await b(t, o);
|
522
|
-
if (!(typeof C != "string" && !Array.isArray(C) && C)) {
|
523
|
-
if (Array.isArray(C))
|
524
|
-
f.push(...C);
|
525
|
-
else {
|
526
|
-
const M = typeof C == "string" ? C : Qt(o);
|
527
|
-
f.push(M);
|
528
|
-
}
|
529
|
-
if (e.bails)
|
530
|
-
return {
|
531
|
-
errors: f
|
532
|
-
};
|
533
|
-
}
|
534
|
-
}
|
535
|
-
return {
|
536
|
-
errors: f
|
537
|
-
};
|
538
|
-
}
|
539
|
-
const n = Object.assign(Object.assign({}, e), { rules: Gt(e.rules) }), r = [], i = Object.keys(n.rules), u = i.length;
|
540
|
-
for (let o = 0; o < u; o++) {
|
541
|
-
const d = i[o], c = await Hn(n, t, {
|
542
|
-
name: d,
|
543
|
-
params: n.rules[d]
|
544
|
-
});
|
545
|
-
if (c.error && (r.push(c.error), e.bails))
|
546
|
-
return {
|
547
|
-
errors: r
|
548
|
-
};
|
549
|
-
}
|
550
|
-
return {
|
551
|
-
errors: r
|
552
|
-
};
|
553
|
-
}
|
554
|
-
function qn(e) {
|
555
|
-
return !!e && e.name === "ValidationError";
|
556
|
-
}
|
557
|
-
function Kt(e) {
|
558
|
-
return {
|
559
|
-
__type: "VVTypedSchema",
|
560
|
-
async parse(n) {
|
561
|
-
var r;
|
562
|
-
try {
|
563
|
-
return {
|
564
|
-
output: await e.validate(n, { abortEarly: !1 }),
|
565
|
-
errors: []
|
566
|
-
};
|
567
|
-
} catch (i) {
|
568
|
-
if (!qn(i))
|
569
|
-
throw i;
|
570
|
-
if (!(!((r = i.inner) === null || r === void 0) && r.length) && i.errors.length)
|
571
|
-
return { errors: [{ path: i.path, errors: i.errors }] };
|
572
|
-
const u = i.inner.reduce((o, d) => {
|
573
|
-
const c = d.path || "";
|
574
|
-
return o[c] || (o[c] = { errors: [], path: c }), o[c].errors.push(...d.errors), o;
|
575
|
-
}, {});
|
576
|
-
return { errors: Object.values(u) };
|
577
|
-
}
|
578
|
-
}
|
579
|
-
};
|
580
|
-
}
|
581
|
-
async function Gn(e, t) {
|
582
|
-
const r = await (me(t) ? t : Kt(t)).parse(e), i = [];
|
583
|
-
for (const u of r.errors)
|
584
|
-
u.errors.length && i.push(...u.errors);
|
585
|
-
return {
|
586
|
-
errors: i
|
587
|
-
};
|
588
|
-
}
|
589
|
-
async function Hn(e, t, n) {
|
590
|
-
const r = In(n.name);
|
591
|
-
if (!r)
|
592
|
-
throw new Error(`No such validator '${n.name}' exists.`);
|
593
|
-
const i = Kn(n.params, e.formData), u = {
|
594
|
-
field: e.label || e.name,
|
595
|
-
name: e.name,
|
596
|
-
label: e.label,
|
597
|
-
value: t,
|
598
|
-
form: e.formData,
|
599
|
-
rule: Object.assign(Object.assign({}, n), { params: i })
|
600
|
-
}, o = await r(t, i, u);
|
601
|
-
return typeof o == "string" ? {
|
602
|
-
error: o
|
603
|
-
} : {
|
604
|
-
error: o ? void 0 : Qt(u)
|
605
|
-
};
|
606
|
-
}
|
607
|
-
function Qt(e) {
|
608
|
-
const t = Se().generateMessage;
|
609
|
-
return t ? t(e) : "Field is invalid";
|
610
|
-
}
|
611
|
-
function Kn(e, t) {
|
612
|
-
const n = (r) => ct(r) ? r(t) : r;
|
613
|
-
return Array.isArray(e) ? e.map(n) : Object.keys(e).reduce((r, i) => (r[i] = n(e[i]), r), {});
|
614
|
-
}
|
615
|
-
async function Qn(e, t) {
|
616
|
-
const r = await (me(e) ? e : Kt(e)).parse(N(t)), i = {}, u = {};
|
617
|
-
for (const o of r.errors) {
|
618
|
-
const d = o.errors, c = (o.path || "").replace(/\["(\d+)"\]/g, (f, V) => `[${V}]`);
|
619
|
-
i[c] = { valid: !d.length, errors: d }, d.length && (u[c] = d[0]);
|
620
|
-
}
|
621
|
-
return {
|
622
|
-
valid: !r.errors.length,
|
623
|
-
results: i,
|
624
|
-
errors: u,
|
625
|
-
values: r.value
|
626
|
-
};
|
627
|
-
}
|
628
|
-
async function Jn(e, t, n) {
|
629
|
-
const i = le(e).map(async (f) => {
|
630
|
-
var V, b, C;
|
631
|
-
const A = (V = n?.names) === null || V === void 0 ? void 0 : V[f], M = await Ht(L(t, f), e[f], {
|
632
|
-
name: A?.name || f,
|
633
|
-
label: A?.label,
|
634
|
-
values: t,
|
635
|
-
bails: (C = (b = n?.bailsMap) === null || b === void 0 ? void 0 : b[f]) !== null && C !== void 0 ? C : !0
|
636
|
-
});
|
637
|
-
return Object.assign(Object.assign({}, M), { path: f });
|
638
|
-
});
|
639
|
-
let u = !0;
|
640
|
-
const o = await Promise.all(i), d = {}, c = {};
|
641
|
-
for (const f of o)
|
642
|
-
d[f.path] = {
|
643
|
-
valid: f.valid,
|
644
|
-
errors: f.errors
|
645
|
-
}, f.valid || (u = !1, c[f.path] = f.errors[0]);
|
646
|
-
return {
|
647
|
-
valid: u,
|
648
|
-
results: d,
|
649
|
-
errors: c
|
650
|
-
};
|
651
|
-
}
|
652
|
-
let Pt = 0;
|
653
|
-
function Yn(e, t) {
|
654
|
-
const { value: n, initialValue: r, setInitialValue: i } = Xn(e, t.modelValue, t.form);
|
655
|
-
if (!t.form) {
|
656
|
-
let C = function(A) {
|
657
|
-
var M;
|
658
|
-
"value" in A && (n.value = A.value), "errors" in A && f(A.errors), "touched" in A && (b.touched = (M = A.touched) !== null && M !== void 0 ? M : b.touched), "initialValue" in A && i(A.initialValue);
|
659
|
-
};
|
660
|
-
const { errors: c, setErrors: f } = tr(), V = Pt >= Number.MAX_SAFE_INTEGER ? 0 : ++Pt, b = er(n, r, c, t.schema);
|
661
|
-
return {
|
662
|
-
id: V,
|
663
|
-
path: e,
|
664
|
-
value: n,
|
665
|
-
initialValue: r,
|
666
|
-
meta: b,
|
667
|
-
flags: { pendingUnmount: { [V]: !1 }, pendingReset: !1 },
|
668
|
-
errors: c,
|
669
|
-
setState: C
|
670
|
-
};
|
671
|
-
}
|
672
|
-
const u = t.form.createPathState(e, {
|
673
|
-
bails: t.bails,
|
674
|
-
label: t.label,
|
675
|
-
type: t.type,
|
676
|
-
validate: t.validate,
|
677
|
-
schema: t.schema
|
678
|
-
}), o = k(() => u.errors);
|
679
|
-
function d(c) {
|
680
|
-
var f, V, b;
|
681
|
-
"value" in c && (n.value = c.value), "errors" in c && ((f = t.form) === null || f === void 0 || f.setFieldError(T(e), c.errors)), "touched" in c && ((V = t.form) === null || V === void 0 || V.setFieldTouched(T(e), (b = c.touched) !== null && b !== void 0 ? b : !1)), "initialValue" in c && i(c.initialValue);
|
682
|
-
}
|
683
|
-
return {
|
684
|
-
id: Array.isArray(u.id) ? u.id[u.id.length - 1] : u.id,
|
685
|
-
path: e,
|
686
|
-
value: n,
|
687
|
-
errors: o,
|
688
|
-
meta: u,
|
689
|
-
initialValue: r,
|
690
|
-
flags: u.__flags,
|
691
|
-
setState: d
|
692
|
-
};
|
693
|
-
}
|
694
|
-
function Xn(e, t, n) {
|
695
|
-
const r = se(T(t));
|
696
|
-
function i() {
|
697
|
-
return n ? L(n.initialValues.value, T(e), T(r)) : T(r);
|
698
|
-
}
|
699
|
-
function u(f) {
|
700
|
-
if (!n) {
|
701
|
-
r.value = f;
|
702
|
-
return;
|
703
|
-
}
|
704
|
-
n.setFieldInitialValue(T(e), f, !0);
|
705
|
-
}
|
706
|
-
const o = k(i);
|
707
|
-
if (!n)
|
708
|
-
return {
|
709
|
-
value: se(i()),
|
710
|
-
initialValue: o,
|
711
|
-
setInitialValue: u
|
712
|
-
};
|
713
|
-
const d = Zn(t, n, o, e);
|
714
|
-
return n.stageInitialValue(T(e), d, !0), {
|
715
|
-
value: k({
|
716
|
-
get() {
|
717
|
-
return L(n.values, T(e));
|
718
|
-
},
|
719
|
-
set(f) {
|
720
|
-
n.setFieldValue(T(e), f, !1);
|
721
|
-
}
|
722
|
-
}),
|
723
|
-
initialValue: o,
|
724
|
-
setInitialValue: u
|
725
|
-
};
|
726
|
-
}
|
727
|
-
function Zn(e, t, n, r) {
|
728
|
-
return qe(e) ? T(e) : e !== void 0 ? e : L(t.values, T(r), T(n));
|
729
|
-
}
|
730
|
-
function er(e, t, n, r) {
|
731
|
-
var i, u;
|
732
|
-
const o = (u = (i = r?.describe) === null || i === void 0 ? void 0 : i.call(r).required) !== null && u !== void 0 ? u : !1, d = We({
|
733
|
-
touched: !1,
|
734
|
-
pending: !1,
|
735
|
-
valid: !0,
|
736
|
-
required: o,
|
737
|
-
validated: !!T(n).length,
|
738
|
-
initialValue: k(() => T(t)),
|
739
|
-
dirty: k(() => !G(T(e), T(t)))
|
740
|
-
});
|
741
|
-
return fe(n, (c) => {
|
742
|
-
d.valid = !c.length;
|
743
|
-
}, {
|
744
|
-
immediate: !0,
|
745
|
-
flush: "sync"
|
746
|
-
}), d;
|
747
|
-
}
|
748
|
-
function tr() {
|
749
|
-
const e = se([]);
|
750
|
-
return {
|
751
|
-
errors: e,
|
752
|
-
setErrors: (t) => {
|
753
|
-
e.value = vt(t);
|
754
|
-
}
|
755
|
-
};
|
756
|
-
}
|
757
|
-
function Jt(e) {
|
758
|
-
process.env.NODE_ENV !== "production" && On({
|
759
|
-
id: "vee-validate-devtools-plugin",
|
760
|
-
label: "VeeValidate Plugin",
|
761
|
-
packageName: "vee-validate",
|
762
|
-
homepage: "https://vee-validate.logaretm.com/v4",
|
763
|
-
app: e,
|
764
|
-
logo: "https://vee-validate.logaretm.com/v4/logo.png"
|
765
|
-
}, ir);
|
766
|
-
}
|
767
|
-
const Me = {}, Be = {};
|
768
|
-
let ye;
|
769
|
-
const ke = Tn(() => {
|
770
|
-
setTimeout(async () => {
|
771
|
-
await he(), ye?.sendInspectorState(je), ye?.sendInspectorTree(je);
|
772
|
-
}, 100);
|
773
|
-
}, 100);
|
774
|
-
function nr(e) {
|
775
|
-
const t = Ee();
|
776
|
-
if (!ye) {
|
777
|
-
const n = t?.appContext.app;
|
778
|
-
if (!n)
|
779
|
-
return;
|
780
|
-
Jt(n);
|
781
|
-
}
|
782
|
-
Me[e.formId] = Object.assign({}, e), Me[e.formId]._vm = t, Lt(() => {
|
783
|
-
delete Me[e.formId], ke();
|
784
|
-
}), ke();
|
785
|
-
}
|
786
|
-
function rr(e) {
|
787
|
-
const t = Ee();
|
788
|
-
if (!ye) {
|
789
|
-
const n = t?.appContext.app;
|
790
|
-
if (!n)
|
791
|
-
return;
|
792
|
-
Jt(n);
|
793
|
-
}
|
794
|
-
Be[e.id] = Object.assign({}, e), Be[e.id]._vm = t, Lt(() => {
|
795
|
-
delete Be[e.id], ke();
|
796
|
-
}), ke();
|
797
|
-
}
|
798
|
-
const je = "vee-validate-inspector", ae = {
|
799
|
-
error: 12405579,
|
800
|
-
success: 448379,
|
801
|
-
unknown: 5522283,
|
802
|
-
white: 16777215,
|
803
|
-
black: 0,
|
804
|
-
blue: 218007,
|
805
|
-
purple: 12157168,
|
806
|
-
orange: 16099682,
|
807
|
-
gray: 12304330
|
808
|
-
};
|
809
|
-
let W = null;
|
810
|
-
function ir(e) {
|
811
|
-
ye = e, e.addInspector({
|
812
|
-
id: je,
|
813
|
-
icon: "rule",
|
814
|
-
label: "vee-validate",
|
815
|
-
noSelectionText: "Select a vee-validate node to inspect",
|
816
|
-
actions: [
|
817
|
-
{
|
818
|
-
icon: "done_outline",
|
819
|
-
tooltip: "Validate selected item",
|
820
|
-
action: async () => {
|
821
|
-
if (!W) {
|
822
|
-
console.error("There is not a valid selected vee-validate node or component");
|
823
|
-
return;
|
824
|
-
}
|
825
|
-
if (W.type === "field") {
|
826
|
-
await W.field.validate();
|
827
|
-
return;
|
828
|
-
}
|
829
|
-
if (W.type === "form") {
|
830
|
-
await W.form.validate();
|
831
|
-
return;
|
832
|
-
}
|
833
|
-
W.type === "pathState" && await W.form.validateField(W.state.path);
|
834
|
-
}
|
835
|
-
},
|
836
|
-
{
|
837
|
-
icon: "delete_sweep",
|
838
|
-
tooltip: "Clear validation state of the selected item",
|
839
|
-
action: () => {
|
840
|
-
if (!W) {
|
841
|
-
console.error("There is not a valid selected vee-validate node or component");
|
842
|
-
return;
|
843
|
-
}
|
844
|
-
if (W.type === "field") {
|
845
|
-
W.field.resetField();
|
846
|
-
return;
|
847
|
-
}
|
848
|
-
W.type === "form" && W.form.resetForm(), W.type === "pathState" && W.form.resetField(W.state.path);
|
849
|
-
}
|
850
|
-
}
|
851
|
-
]
|
852
|
-
}), e.on.getInspectorTree((t) => {
|
853
|
-
if (t.inspectorId !== je)
|
854
|
-
return;
|
855
|
-
const n = Object.values(Me), r = Object.values(Be);
|
856
|
-
t.rootNodes = [
|
857
|
-
...n.map(lr),
|
858
|
-
...r.map((i) => ur(i))
|
859
|
-
];
|
860
|
-
}), e.on.getInspectorState((t, n) => {
|
861
|
-
if (t.inspectorId !== je || n.currentTab !== `custom-inspector:${je}`)
|
862
|
-
return;
|
863
|
-
const { form: r, field: i, state: u, type: o } = or(t.nodeId);
|
864
|
-
if (r && o === "form") {
|
865
|
-
t.state = sr(r), W = { type: "form", form: r };
|
866
|
-
return;
|
867
|
-
}
|
868
|
-
if (u && o === "pathState" && r) {
|
869
|
-
t.state = Mt(u), W = { type: "pathState", state: u, form: r };
|
870
|
-
return;
|
871
|
-
}
|
872
|
-
if (i && o === "field") {
|
873
|
-
t.state = Mt({
|
874
|
-
errors: i.errors.value,
|
875
|
-
dirty: i.meta.dirty,
|
876
|
-
valid: i.meta.valid,
|
877
|
-
touched: i.meta.touched,
|
878
|
-
value: i.value.value,
|
879
|
-
initialValue: i.meta.initialValue
|
880
|
-
}), W = { field: i, type: "field" };
|
881
|
-
return;
|
882
|
-
}
|
883
|
-
W = null;
|
884
|
-
});
|
885
|
-
}
|
886
|
-
function lr(e) {
|
887
|
-
const { textColor: t, bgColor: n } = Xt(e.meta.value.valid), r = {};
|
888
|
-
Object.values(e.getAllPathStates()).forEach((o) => {
|
889
|
-
Y(r, T(o.path), ar(o, e));
|
890
|
-
});
|
891
|
-
function i(o, d = []) {
|
892
|
-
const c = [...d].pop();
|
893
|
-
return "id" in o ? Object.assign(Object.assign({}, o), { label: c || o.label }) : Ve(o) ? {
|
894
|
-
id: `${d.join(".")}`,
|
895
|
-
label: c || "",
|
896
|
-
children: Object.keys(o).map((f) => i(o[f], [...d, f]))
|
897
|
-
} : Array.isArray(o) ? {
|
898
|
-
id: `${d.join(".")}`,
|
899
|
-
label: `${c}[]`,
|
900
|
-
children: o.map((f, V) => i(f, [...d, String(V)]))
|
901
|
-
} : { id: "", label: "", children: [] };
|
902
|
-
}
|
903
|
-
const { children: u } = i(r);
|
904
|
-
return {
|
905
|
-
id: Vt(e),
|
906
|
-
label: "Form",
|
907
|
-
children: u,
|
908
|
-
tags: [
|
909
|
-
{
|
910
|
-
label: "Form",
|
911
|
-
textColor: t,
|
912
|
-
backgroundColor: n
|
913
|
-
},
|
914
|
-
{
|
915
|
-
label: `${e.getAllPathStates().length} fields`,
|
916
|
-
textColor: ae.white,
|
917
|
-
backgroundColor: ae.unknown
|
918
|
-
}
|
919
|
-
]
|
920
|
-
};
|
921
|
-
}
|
922
|
-
function ar(e, t) {
|
923
|
-
return {
|
924
|
-
id: Vt(t, e),
|
925
|
-
label: T(e.path),
|
926
|
-
tags: Yt(e.multiple, e.fieldsCount, e.type, e.valid, t)
|
927
|
-
};
|
928
|
-
}
|
929
|
-
function ur(e, t) {
|
930
|
-
return {
|
931
|
-
id: Vt(t, e),
|
932
|
-
label: T(e.name),
|
933
|
-
tags: Yt(!1, 1, e.type, e.meta.valid, t)
|
934
|
-
};
|
935
|
-
}
|
936
|
-
function Yt(e, t, n, r, i) {
|
937
|
-
const { textColor: u, bgColor: o } = Xt(r);
|
938
|
-
return [
|
939
|
-
e ? void 0 : {
|
940
|
-
label: "Field",
|
941
|
-
textColor: u,
|
942
|
-
backgroundColor: o
|
943
|
-
},
|
944
|
-
i ? void 0 : {
|
945
|
-
label: "Standalone",
|
946
|
-
textColor: ae.black,
|
947
|
-
backgroundColor: ae.gray
|
948
|
-
},
|
949
|
-
n === "checkbox" ? {
|
950
|
-
label: "Checkbox",
|
951
|
-
textColor: ae.white,
|
952
|
-
backgroundColor: ae.blue
|
953
|
-
} : void 0,
|
954
|
-
n === "radio" ? {
|
955
|
-
label: "Radio",
|
956
|
-
textColor: ae.white,
|
957
|
-
backgroundColor: ae.purple
|
958
|
-
} : void 0,
|
959
|
-
e ? {
|
960
|
-
label: "Multiple",
|
961
|
-
textColor: ae.black,
|
962
|
-
backgroundColor: ae.orange
|
963
|
-
} : void 0
|
964
|
-
].filter(Boolean);
|
965
|
-
}
|
966
|
-
function Vt(e, t) {
|
967
|
-
const n = t ? "path" in t ? "pathState" : "field" : "form", r = t ? "path" in t ? t?.path : T(t?.name) : "", i = { f: e?.formId, ff: r, type: n };
|
968
|
-
return btoa(encodeURIComponent(JSON.stringify(i)));
|
969
|
-
}
|
970
|
-
function or(e) {
|
971
|
-
try {
|
972
|
-
const t = JSON.parse(decodeURIComponent(atob(e))), n = Me[t.f];
|
973
|
-
if (!n && t.ff) {
|
974
|
-
const i = Be[t.ff];
|
975
|
-
return i ? {
|
976
|
-
type: t.type,
|
977
|
-
field: i
|
978
|
-
} : {};
|
979
|
-
}
|
980
|
-
if (!n)
|
981
|
-
return {};
|
982
|
-
const r = n.getPathState(t.ff);
|
983
|
-
return {
|
984
|
-
type: t.type,
|
985
|
-
form: n,
|
986
|
-
state: r
|
987
|
-
};
|
988
|
-
} catch {
|
989
|
-
}
|
990
|
-
return {};
|
991
|
-
}
|
992
|
-
function Mt(e) {
|
993
|
-
return {
|
994
|
-
"Field state": [
|
995
|
-
{ key: "errors", value: e.errors },
|
996
|
-
{
|
997
|
-
key: "initialValue",
|
998
|
-
value: e.initialValue
|
999
|
-
},
|
1000
|
-
{
|
1001
|
-
key: "currentValue",
|
1002
|
-
value: e.value
|
1003
|
-
},
|
1004
|
-
{
|
1005
|
-
key: "touched",
|
1006
|
-
value: e.touched
|
1007
|
-
},
|
1008
|
-
{
|
1009
|
-
key: "dirty",
|
1010
|
-
value: e.dirty
|
1011
|
-
},
|
1012
|
-
{
|
1013
|
-
key: "valid",
|
1014
|
-
value: e.valid
|
1015
|
-
}
|
1016
|
-
]
|
1017
|
-
};
|
1018
|
-
}
|
1019
|
-
function sr(e) {
|
1020
|
-
const { errorBag: t, meta: n, values: r, isSubmitting: i, isValidating: u, submitCount: o } = e;
|
1021
|
-
return {
|
1022
|
-
"Form state": [
|
1023
|
-
{
|
1024
|
-
key: "submitCount",
|
1025
|
-
value: o.value
|
1026
|
-
},
|
1027
|
-
{
|
1028
|
-
key: "isSubmitting",
|
1029
|
-
value: i.value
|
1030
|
-
},
|
1031
|
-
{
|
1032
|
-
key: "isValidating",
|
1033
|
-
value: u.value
|
1034
|
-
},
|
1035
|
-
{
|
1036
|
-
key: "touched",
|
1037
|
-
value: n.value.touched
|
1038
|
-
},
|
1039
|
-
{
|
1040
|
-
key: "dirty",
|
1041
|
-
value: n.value.dirty
|
1042
|
-
},
|
1043
|
-
{
|
1044
|
-
key: "valid",
|
1045
|
-
value: n.value.valid
|
1046
|
-
},
|
1047
|
-
{
|
1048
|
-
key: "initialValues",
|
1049
|
-
value: n.value.initialValues
|
1050
|
-
},
|
1051
|
-
{
|
1052
|
-
key: "currentValues",
|
1053
|
-
value: r
|
1054
|
-
},
|
1055
|
-
{
|
1056
|
-
key: "errors",
|
1057
|
-
value: le(t.value).reduce((d, c) => {
|
1058
|
-
var f;
|
1059
|
-
const V = (f = t.value[c]) === null || f === void 0 ? void 0 : f[0];
|
1060
|
-
return V && (d[c] = V), d;
|
1061
|
-
}, {})
|
1062
|
-
}
|
1063
|
-
]
|
1064
|
-
};
|
1065
|
-
}
|
1066
|
-
function Xt(e) {
|
1067
|
-
return {
|
1068
|
-
bgColor: e ? ae.success : ae.error,
|
1069
|
-
textColor: e ? ae.black : ae.white
|
1070
|
-
};
|
1071
|
-
}
|
1072
|
-
function dr(e, t, n) {
|
1073
|
-
return Ue(n?.type) ? fr(e, t, n) : Zt(e, t, n);
|
1074
|
-
}
|
1075
|
-
function Zt(e, t, n) {
|
1076
|
-
const { initialValue: r, validateOnMount: i, bails: u, type: o, checkedValue: d, label: c, validateOnValueUpdate: f, uncheckedValue: V, controlled: b, keepValueOnUnmount: C, syncVModel: A, form: M } = cr(n), X = b ? De(Ae) : void 0, E = M || X, q = k(() => Pe(S(e))), $ = k(() => {
|
1077
|
-
if (S(E?.schema))
|
1078
|
-
return;
|
1079
|
-
const w = T(t);
|
1080
|
-
return Ke(w) || me(w) || ee(w) || Array.isArray(w) ? w : Gt(w);
|
1081
|
-
}), { id: H, value: K, initialValue: m, meta: v, setState: _, errors: y, flags: I } = Yn(q, {
|
1082
|
-
modelValue: r,
|
1083
|
-
form: E,
|
1084
|
-
bails: u,
|
1085
|
-
label: c,
|
1086
|
-
type: o,
|
1087
|
-
validate: $.value ? oe : void 0,
|
1088
|
-
schema: me(t) ? t : void 0
|
1089
|
-
}), F = k(() => y.value[0]);
|
1090
|
-
A && vr({
|
1091
|
-
value: K,
|
1092
|
-
prop: A,
|
1093
|
-
handleChange: j,
|
1094
|
-
shouldValidate: () => f && !I.pendingReset
|
1095
|
-
});
|
1096
|
-
const D = (g, w = !1) => {
|
1097
|
-
v.touched = !0, w && ue();
|
1098
|
-
};
|
1099
|
-
async function Q(g) {
|
1100
|
-
var w, R;
|
1101
|
-
if (E?.validateSchema) {
|
1102
|
-
const { results: B } = await E.validateSchema(g);
|
1103
|
-
return (w = B[S(q)]) !== null && w !== void 0 ? w : { valid: !0, errors: [] };
|
1104
|
-
}
|
1105
|
-
return $.value ? Ht(K.value, $.value, {
|
1106
|
-
name: S(q),
|
1107
|
-
label: S(c),
|
1108
|
-
values: (R = E?.values) !== null && R !== void 0 ? R : {},
|
1109
|
-
bails: u
|
1110
|
-
}) : { valid: !0, errors: [] };
|
1111
|
-
}
|
1112
|
-
const ue = ft(async () => (v.pending = !0, v.validated = !0, Q("validated-only")), (g) => (I.pendingUnmount[J.id] || (_({ errors: g.errors }), v.pending = !1, v.valid = g.valid), g)), ne = ft(async () => Q("silent"), (g) => (v.valid = g.valid, g));
|
1113
|
-
function oe(g) {
|
1114
|
-
return g?.mode === "silent" ? ne() : ue();
|
1115
|
-
}
|
1116
|
-
function j(g, w = !0) {
|
1117
|
-
const R = Qe(g);
|
1118
|
-
Ne(R, w);
|
1119
|
-
}
|
1120
|
-
Ut(() => {
|
1121
|
-
if (i)
|
1122
|
-
return ue();
|
1123
|
-
(!E || !E.validateSchema) && ne();
|
1124
|
-
});
|
1125
|
-
function re(g) {
|
1126
|
-
v.touched = g;
|
1127
|
-
}
|
1128
|
-
function de(g) {
|
1129
|
-
var w;
|
1130
|
-
const R = g && "value" in g ? g.value : m.value;
|
1131
|
-
_({
|
1132
|
-
value: N(R),
|
1133
|
-
initialValue: N(R),
|
1134
|
-
touched: (w = g?.touched) !== null && w !== void 0 ? w : !1,
|
1135
|
-
errors: g?.errors || []
|
1136
|
-
}), v.pending = !1, v.validated = !1, ne();
|
1137
|
-
}
|
1138
|
-
const be = Ee();
|
1139
|
-
function Ne(g, w = !0) {
|
1140
|
-
K.value = be && A ? Pn(g, be.props.modelModifiers) : g, (w ? ue : ne)();
|
1141
|
-
}
|
1142
|
-
function Le(g) {
|
1143
|
-
_({ errors: Array.isArray(g) ? g : [g] });
|
1144
|
-
}
|
1145
|
-
const Ot = k({
|
1146
|
-
get() {
|
1147
|
-
return K.value;
|
1148
|
-
},
|
1149
|
-
set(g) {
|
1150
|
-
Ne(g, f);
|
1151
|
-
}
|
1152
|
-
}), J = {
|
1153
|
-
id: H,
|
1154
|
-
name: q,
|
1155
|
-
label: c,
|
1156
|
-
value: Ot,
|
1157
|
-
meta: v,
|
1158
|
-
errors: y,
|
1159
|
-
errorMessage: F,
|
1160
|
-
type: o,
|
1161
|
-
checkedValue: d,
|
1162
|
-
uncheckedValue: V,
|
1163
|
-
bails: u,
|
1164
|
-
keepValueOnUnmount: C,
|
1165
|
-
resetField: de,
|
1166
|
-
handleReset: () => de(),
|
1167
|
-
validate: oe,
|
1168
|
-
handleChange: j,
|
1169
|
-
handleBlur: D,
|
1170
|
-
setState: _,
|
1171
|
-
setTouched: re,
|
1172
|
-
setErrors: Le,
|
1173
|
-
setValue: Ne
|
1174
|
-
};
|
1175
|
-
if (Dt(Ye, J), qe(t) && typeof T(t) != "function" && fe(t, (g, w) => {
|
1176
|
-
G(g, w) || (v.validated ? ue() : ne());
|
1177
|
-
}, {
|
1178
|
-
deep: !0
|
1179
|
-
}), process.env.NODE_ENV !== "production" && (J._vm = Ee(), fe(() => Object.assign(Object.assign({ errors: y.value }, v), { value: K.value }), ke, {
|
1180
|
-
deep: !0
|
1181
|
-
}), E || rr(J)), !E)
|
1182
|
-
return J;
|
1183
|
-
const et = k(() => {
|
1184
|
-
const g = $.value;
|
1185
|
-
return !g || ee(g) || Ke(g) || me(g) || Array.isArray(g) ? {} : Object.keys(g).reduce((w, R) => {
|
1186
|
-
const B = $n(g[R]).map((pe) => pe.__locatorRef).reduce((pe, ge) => {
|
1187
|
-
const ce = L(E.values, ge) || E.values[ge];
|
1188
|
-
return ce !== void 0 && (pe[ge] = ce), pe;
|
1189
|
-
}, {});
|
1190
|
-
return Object.assign(w, B), w;
|
1191
|
-
}, {});
|
1192
|
-
});
|
1193
|
-
return fe(et, (g, w) => {
|
1194
|
-
if (!Object.keys(g).length)
|
1195
|
-
return;
|
1196
|
-
!G(g, w) && (v.validated ? ue() : ne());
|
1197
|
-
}), $t(() => {
|
1198
|
-
var g;
|
1199
|
-
const w = (g = S(J.keepValueOnUnmount)) !== null && g !== void 0 ? g : S(E.keepValuesOnUnmount), R = S(q);
|
1200
|
-
if (w || !E || I.pendingUnmount[J.id]) {
|
1201
|
-
E?.removePathState(R, H);
|
1202
|
-
return;
|
1203
|
-
}
|
1204
|
-
I.pendingUnmount[J.id] = !0;
|
1205
|
-
const B = E.getPathState(R);
|
1206
|
-
if (Array.isArray(B?.id) && B?.multiple ? B?.id.includes(J.id) : B?.id === J.id) {
|
1207
|
-
if (B?.multiple && Array.isArray(B.value)) {
|
1208
|
-
const ge = B.value.findIndex((ce) => G(ce, S(J.checkedValue)));
|
1209
|
-
if (ge > -1) {
|
1210
|
-
const ce = [...B.value];
|
1211
|
-
ce.splice(ge, 1), E.setFieldValue(R, ce);
|
1212
|
-
}
|
1213
|
-
Array.isArray(B.id) && B.id.splice(B.id.indexOf(J.id), 1);
|
1214
|
-
} else
|
1215
|
-
E.unsetPathValue(S(q));
|
1216
|
-
E.removePathState(R, H);
|
1217
|
-
}
|
1218
|
-
}), J;
|
1219
|
-
}
|
1220
|
-
function cr(e) {
|
1221
|
-
const t = () => ({
|
1222
|
-
initialValue: void 0,
|
1223
|
-
validateOnMount: !1,
|
1224
|
-
bails: !0,
|
1225
|
-
label: void 0,
|
1226
|
-
validateOnValueUpdate: !0,
|
1227
|
-
keepValueOnUnmount: void 0,
|
1228
|
-
syncVModel: !1,
|
1229
|
-
controlled: !0
|
1230
|
-
}), n = !!e?.syncVModel, r = typeof e?.syncVModel == "string" ? e.syncVModel : e?.modelPropName || "modelValue", i = n && !("initialValue" in (e || {})) ? ht(Ee(), r) : e?.initialValue;
|
1231
|
-
if (!e)
|
1232
|
-
return Object.assign(Object.assign({}, t()), { initialValue: i });
|
1233
|
-
const u = "valueProp" in e ? e.valueProp : e.checkedValue, o = "standalone" in e ? !e.standalone : e.controlled, d = e?.modelPropName || e?.syncVModel || !1;
|
1234
|
-
return Object.assign(Object.assign(Object.assign({}, t()), e || {}), {
|
1235
|
-
initialValue: i,
|
1236
|
-
controlled: o ?? !0,
|
1237
|
-
checkedValue: u,
|
1238
|
-
syncVModel: d
|
1239
|
-
});
|
1240
|
-
}
|
1241
|
-
function fr(e, t, n) {
|
1242
|
-
const r = n?.standalone ? void 0 : De(Ae), i = n?.checkedValue, u = n?.uncheckedValue;
|
1243
|
-
function o(d) {
|
1244
|
-
const c = d.handleChange, f = k(() => {
|
1245
|
-
const b = S(d.value), C = S(i);
|
1246
|
-
return Array.isArray(b) ? b.findIndex((A) => G(A, C)) >= 0 : G(C, b);
|
1247
|
-
});
|
1248
|
-
function V(b, C = !0) {
|
1249
|
-
var A, M;
|
1250
|
-
if (f.value === ((A = b?.target) === null || A === void 0 ? void 0 : A.checked)) {
|
1251
|
-
C && d.validate();
|
1252
|
-
return;
|
1253
|
-
}
|
1254
|
-
const X = S(e), E = r?.getPathState(X), q = Qe(b);
|
1255
|
-
let $ = (M = S(i)) !== null && M !== void 0 ? M : q;
|
1256
|
-
r && E?.multiple && E.type === "checkbox" ? $ = kt(L(r.values, X) || [], $, void 0) : n?.type === "checkbox" && ($ = kt(S(d.value), $, S(u))), c($, C);
|
1257
|
-
}
|
1258
|
-
return Object.assign(Object.assign({}, d), {
|
1259
|
-
checked: f,
|
1260
|
-
checkedValue: i,
|
1261
|
-
uncheckedValue: u,
|
1262
|
-
handleChange: V
|
1263
|
-
});
|
1264
|
-
}
|
1265
|
-
return o(Zt(e, t, n));
|
1266
|
-
}
|
1267
|
-
function vr({ prop: e, value: t, handleChange: n, shouldValidate: r }) {
|
1268
|
-
const i = Ee();
|
1269
|
-
if (!i || !e) {
|
1270
|
-
process.env.NODE_ENV !== "production" && console.warn("Failed to setup model events because `useField` was not called in setup.");
|
1271
|
-
return;
|
1272
|
-
}
|
1273
|
-
const u = typeof e == "string" ? e : "modelValue", o = `update:${u}`;
|
1274
|
-
u in i.props && (fe(t, (d) => {
|
1275
|
-
G(d, ht(i, u)) || i.emit(o, d);
|
1276
|
-
}), fe(() => ht(i, u), (d) => {
|
1277
|
-
if (d === He && t.value === void 0)
|
1278
|
-
return;
|
1279
|
-
const c = d === He ? void 0 : d;
|
1280
|
-
G(c, t.value) || n(c, r());
|
1281
|
-
}));
|
1282
|
-
}
|
1283
|
-
function ht(e, t) {
|
1284
|
-
if (e)
|
1285
|
-
return e.props[t];
|
1286
|
-
}
|
1287
|
-
const hr = /* @__PURE__ */ Je({
|
1288
|
-
name: "Field",
|
1289
|
-
inheritAttrs: !1,
|
1290
|
-
props: {
|
1291
|
-
as: {
|
1292
|
-
type: [String, Object],
|
1293
|
-
default: void 0
|
1294
|
-
},
|
1295
|
-
name: {
|
1296
|
-
type: String,
|
1297
|
-
required: !0
|
1298
|
-
},
|
1299
|
-
rules: {
|
1300
|
-
type: [Object, String, Function],
|
1301
|
-
default: void 0
|
1302
|
-
},
|
1303
|
-
validateOnMount: {
|
1304
|
-
type: Boolean,
|
1305
|
-
default: !1
|
1306
|
-
},
|
1307
|
-
validateOnBlur: {
|
1308
|
-
type: Boolean,
|
1309
|
-
default: void 0
|
1310
|
-
},
|
1311
|
-
validateOnChange: {
|
1312
|
-
type: Boolean,
|
1313
|
-
default: void 0
|
1314
|
-
},
|
1315
|
-
validateOnInput: {
|
1316
|
-
type: Boolean,
|
1317
|
-
default: void 0
|
1318
|
-
},
|
1319
|
-
validateOnModelUpdate: {
|
1320
|
-
type: Boolean,
|
1321
|
-
default: void 0
|
1322
|
-
},
|
1323
|
-
bails: {
|
1324
|
-
type: Boolean,
|
1325
|
-
default: () => Se().bails
|
1326
|
-
},
|
1327
|
-
label: {
|
1328
|
-
type: String,
|
1329
|
-
default: void 0
|
1330
|
-
},
|
1331
|
-
uncheckedValue: {
|
1332
|
-
type: null,
|
1333
|
-
default: void 0
|
1334
|
-
},
|
1335
|
-
modelValue: {
|
1336
|
-
type: null,
|
1337
|
-
default: He
|
1338
|
-
},
|
1339
|
-
modelModifiers: {
|
1340
|
-
type: null,
|
1341
|
-
default: () => ({})
|
1342
|
-
},
|
1343
|
-
"onUpdate:modelValue": {
|
1344
|
-
type: null,
|
1345
|
-
default: void 0
|
1346
|
-
},
|
1347
|
-
standalone: {
|
1348
|
-
type: Boolean,
|
1349
|
-
default: !1
|
1350
|
-
},
|
1351
|
-
keepValue: {
|
1352
|
-
type: Boolean,
|
1353
|
-
default: void 0
|
1354
|
-
}
|
1355
|
-
},
|
1356
|
-
setup(e, t) {
|
1357
|
-
const n = _e(e, "rules"), r = _e(e, "name"), i = _e(e, "label"), u = _e(e, "uncheckedValue"), o = _e(e, "keepValue"), { errors: d, value: c, errorMessage: f, validate: V, handleChange: b, handleBlur: C, setTouched: A, resetField: M, handleReset: X, meta: E, checked: q, setErrors: $ } = dr(r, n, {
|
1358
|
-
validateOnMount: e.validateOnMount,
|
1359
|
-
bails: e.bails,
|
1360
|
-
standalone: e.standalone,
|
1361
|
-
type: t.attrs.type,
|
1362
|
-
initialValue: gr(e, t),
|
1363
|
-
// Only for checkboxes and radio buttons
|
1364
|
-
checkedValue: t.attrs.value,
|
1365
|
-
uncheckedValue: u,
|
1366
|
-
label: i,
|
1367
|
-
validateOnValueUpdate: e.validateOnModelUpdate,
|
1368
|
-
keepValueOnUnmount: o,
|
1369
|
-
syncVModel: !0
|
1370
|
-
}), H = function(I, F = !0) {
|
1371
|
-
b(I, F);
|
1372
|
-
}, K = k(() => {
|
1373
|
-
const { validateOnInput: y, validateOnChange: I, validateOnBlur: F, validateOnModelUpdate: D } = mr(e);
|
1374
|
-
function Q(j) {
|
1375
|
-
C(j, F), ee(t.attrs.onBlur) && t.attrs.onBlur(j);
|
1376
|
-
}
|
1377
|
-
function ue(j) {
|
1378
|
-
H(j, y), ee(t.attrs.onInput) && t.attrs.onInput(j);
|
1379
|
-
}
|
1380
|
-
function ne(j) {
|
1381
|
-
H(j, I), ee(t.attrs.onChange) && t.attrs.onChange(j);
|
1382
|
-
}
|
1383
|
-
const oe = {
|
1384
|
-
name: e.name,
|
1385
|
-
onBlur: Q,
|
1386
|
-
onInput: ue,
|
1387
|
-
onChange: ne
|
1388
|
-
};
|
1389
|
-
return oe["onUpdate:modelValue"] = (j) => H(j, D), oe;
|
1390
|
-
}), m = k(() => {
|
1391
|
-
const y = Object.assign({}, K.value);
|
1392
|
-
Ue(t.attrs.type) && q && (y.checked = q.value);
|
1393
|
-
const I = Bt(e, t);
|
1394
|
-
return Nn(I, t.attrs) && (y.value = c.value), y;
|
1395
|
-
}), v = k(() => Object.assign(Object.assign({}, K.value), { modelValue: c.value }));
|
1396
|
-
function _() {
|
1397
|
-
return {
|
1398
|
-
field: m.value,
|
1399
|
-
componentField: v.value,
|
1400
|
-
value: c.value,
|
1401
|
-
meta: E,
|
1402
|
-
errors: d.value,
|
1403
|
-
errorMessage: f.value,
|
1404
|
-
validate: V,
|
1405
|
-
resetField: M,
|
1406
|
-
handleChange: H,
|
1407
|
-
handleInput: (y) => H(y, !1),
|
1408
|
-
handleReset: X,
|
1409
|
-
handleBlur: K.value.onBlur,
|
1410
|
-
setTouched: A,
|
1411
|
-
setErrors: $
|
1412
|
-
};
|
1413
|
-
}
|
1414
|
-
return t.expose({
|
1415
|
-
value: c,
|
1416
|
-
meta: E,
|
1417
|
-
errors: d,
|
1418
|
-
errorMessage: f,
|
1419
|
-
setErrors: $,
|
1420
|
-
setTouched: A,
|
1421
|
-
reset: M,
|
1422
|
-
validate: V,
|
1423
|
-
handleChange: b
|
1424
|
-
}), () => {
|
1425
|
-
const y = mt(Bt(e, t)), I = Ze(y, t, _);
|
1426
|
-
return y ? Ge(y, Object.assign(Object.assign({}, t.attrs), m.value), I) : I;
|
1427
|
-
};
|
1428
|
-
}
|
1429
|
-
});
|
1430
|
-
function Bt(e, t) {
|
1431
|
-
let n = e.as || "";
|
1432
|
-
return !e.as && !t.slots.default && (n = "input"), n;
|
1433
|
-
}
|
1434
|
-
function mr(e) {
|
1435
|
-
var t, n, r, i;
|
1436
|
-
const { validateOnInput: u, validateOnChange: o, validateOnBlur: d, validateOnModelUpdate: c } = Se();
|
1437
|
-
return {
|
1438
|
-
validateOnInput: (t = e.validateOnInput) !== null && t !== void 0 ? t : u,
|
1439
|
-
validateOnChange: (n = e.validateOnChange) !== null && n !== void 0 ? n : o,
|
1440
|
-
validateOnBlur: (r = e.validateOnBlur) !== null && r !== void 0 ? r : d,
|
1441
|
-
validateOnModelUpdate: (i = e.validateOnModelUpdate) !== null && i !== void 0 ? i : c
|
1442
|
-
};
|
1443
|
-
}
|
1444
|
-
function gr(e, t) {
|
1445
|
-
return Ue(t.attrs.type) ? wt(e, "modelValue") ? e.modelValue : void 0 : wt(e, "modelValue") ? e.modelValue : t.attrs.value;
|
1446
|
-
}
|
1447
|
-
const Nr = hr;
|
1448
|
-
let pr = 0;
|
1449
|
-
const xe = ["bails", "fieldsCount", "id", "multiple", "type", "validate"];
|
1450
|
-
function en(e) {
|
1451
|
-
const t = Object.assign({}, S(e?.initialValues || {})), n = T(e?.validationSchema);
|
1452
|
-
return n && me(n) && ee(n.cast) ? N(n.cast(t) || {}) : N(t);
|
1453
|
-
}
|
1454
|
-
function yr(e) {
|
1455
|
-
var t;
|
1456
|
-
const n = pr++;
|
1457
|
-
let r = 0;
|
1458
|
-
const i = se(!1), u = se(!1), o = se(0), d = [], c = We(en(e)), f = se([]), V = se({}), b = se({}), C = Bn(() => {
|
1459
|
-
b.value = f.value.reduce((a, l) => (a[Pe(S(l.path))] = l, a), {});
|
1460
|
-
});
|
1461
|
-
function A(a, l) {
|
1462
|
-
const s = j(a);
|
1463
|
-
if (!s) {
|
1464
|
-
typeof a == "string" && (V.value[Pe(a)] = vt(l));
|
1465
|
-
return;
|
1466
|
-
}
|
1467
|
-
if (typeof a == "string") {
|
1468
|
-
const h = Pe(a);
|
1469
|
-
V.value[h] && delete V.value[h];
|
1470
|
-
}
|
1471
|
-
s.errors = vt(l), s.valid = !s.errors.length;
|
1472
|
-
}
|
1473
|
-
function M(a) {
|
1474
|
-
le(a).forEach((l) => {
|
1475
|
-
A(l, a[l]);
|
1476
|
-
});
|
1477
|
-
}
|
1478
|
-
e?.initialErrors && M(e.initialErrors);
|
1479
|
-
const X = k(() => {
|
1480
|
-
const a = f.value.reduce((l, s) => (s.errors.length && (l[s.path] = s.errors), l), {});
|
1481
|
-
return Object.assign(Object.assign({}, V.value), a);
|
1482
|
-
}), E = k(() => le(X.value).reduce((a, l) => {
|
1483
|
-
const s = X.value[l];
|
1484
|
-
return s?.length && (a[l] = s[0]), a;
|
1485
|
-
}, {})), q = k(() => f.value.reduce((a, l) => (a[l.path] = { name: l.path || "", label: l.label || "" }, a), {})), $ = k(() => f.value.reduce((a, l) => {
|
1486
|
-
var s;
|
1487
|
-
return a[l.path] = (s = l.bails) !== null && s !== void 0 ? s : !0, a;
|
1488
|
-
}, {})), H = Object.assign({}, e?.initialErrors || {}), K = (t = e?.keepValuesOnUnmount) !== null && t !== void 0 ? t : !1, { initialValues: m, originalInitialValues: v, setInitialValues: _ } = Vr(f, c, e), y = br(f, c, v, E), I = k(() => f.value.reduce((a, l) => {
|
1489
|
-
const s = L(c, l.path);
|
1490
|
-
return Y(a, l.path, s), a;
|
1491
|
-
}, {})), F = e?.validationSchema;
|
1492
|
-
function D(a, l) {
|
1493
|
-
var s, h;
|
1494
|
-
const O = k(() => L(m.value, S(a))), p = b.value[S(a)], P = l?.type === "checkbox" || l?.type === "radio";
|
1495
|
-
if (p && P) {
|
1496
|
-
p.multiple = !0;
|
1497
|
-
const ve = r++;
|
1498
|
-
return Array.isArray(p.id) ? p.id.push(ve) : p.id = [p.id, ve], p.fieldsCount++, p.__flags.pendingUnmount[ve] = !1, p;
|
1499
|
-
}
|
1500
|
-
const x = k(() => L(c, S(a))), z = S(a), te = de.findIndex((ve) => ve === z);
|
1501
|
-
te !== -1 && de.splice(te, 1);
|
1502
|
-
const U = k(() => {
|
1503
|
-
var ve, Te, lt, At, at, ut;
|
1504
|
-
return me(F) ? (lt = (Te = (ve = F).describe) === null || Te === void 0 ? void 0 : Te.call(ve, S(a)).required) !== null && lt !== void 0 ? lt : !1 : me(l?.schema) && (ut = (at = (At = l?.schema).describe) === null || at === void 0 ? void 0 : at.call(At).required) !== null && ut !== void 0 ? ut : !1;
|
1505
|
-
}), Z = r++, ie = We({
|
1506
|
-
id: Z,
|
1507
|
-
path: a,
|
1508
|
-
touched: !1,
|
1509
|
-
pending: !1,
|
1510
|
-
valid: !0,
|
1511
|
-
validated: !!(!((s = H[z]) === null || s === void 0) && s.length),
|
1512
|
-
required: U,
|
1513
|
-
initialValue: O,
|
1514
|
-
errors: fn([]),
|
1515
|
-
bails: (h = l?.bails) !== null && h !== void 0 ? h : !1,
|
1516
|
-
label: l?.label,
|
1517
|
-
type: l?.type || "default",
|
1518
|
-
value: x,
|
1519
|
-
multiple: !1,
|
1520
|
-
__flags: {
|
1521
|
-
pendingUnmount: { [Z]: !1 },
|
1522
|
-
pendingReset: !1
|
1523
|
-
},
|
1524
|
-
fieldsCount: 1,
|
1525
|
-
validate: l?.validate,
|
1526
|
-
dirty: k(() => !G(T(x), T(O)))
|
1527
|
-
});
|
1528
|
-
return f.value.push(ie), b.value[z] = ie, C(), E.value[z] && !H[z] && he(() => {
|
1529
|
-
Oe(z, { mode: "silent" });
|
1530
|
-
}), qe(a) && fe(a, (ve) => {
|
1531
|
-
C();
|
1532
|
-
const Te = N(x.value);
|
1533
|
-
b.value[ve] = ie, he(() => {
|
1534
|
-
Y(c, ve, Te);
|
1535
|
-
});
|
1536
|
-
}), ie;
|
1537
|
-
}
|
1538
|
-
const Q = Nt(Et, 5), ue = Nt(Et, 5), ne = ft(async (a) => await (a === "silent" ? Q() : ue()), (a, [l]) => {
|
1539
|
-
const s = le(w.errorBag.value), O = [
|
1540
|
-
.../* @__PURE__ */ new Set([...le(a.results), ...f.value.map((p) => p.path), ...s])
|
1541
|
-
].sort().reduce((p, P) => {
|
1542
|
-
var x;
|
1543
|
-
const z = P, te = j(z) || re(z), U = ((x = a.results[z]) === null || x === void 0 ? void 0 : x.errors) || [], Z = S(te?.path) || z, ie = Or({ errors: U, valid: !U.length }, p.results[Z]);
|
1544
|
-
return p.results[Z] = ie, ie.valid || (p.errors[Z] = ie.errors[0]), te && V.value[Z] && delete V.value[Z], te ? (te.valid = ie.valid, l === "silent" || l === "validated-only" && !te.validated || A(te, ie.errors), p) : (A(Z, U), p);
|
1545
|
-
}, { valid: a.valid, results: {}, errors: {} });
|
1546
|
-
return a.values && (O.values = a.values), le(O.results).forEach((p) => {
|
1547
|
-
var P;
|
1548
|
-
const x = j(p);
|
1549
|
-
x && l !== "silent" && (l === "validated-only" && !x.validated || A(x, (P = O.results[p]) === null || P === void 0 ? void 0 : P.errors));
|
1550
|
-
}), O;
|
1551
|
-
});
|
1552
|
-
function oe(a) {
|
1553
|
-
f.value.forEach(a);
|
1554
|
-
}
|
1555
|
-
function j(a) {
|
1556
|
-
const l = typeof a == "string" ? Pe(a) : a;
|
1557
|
-
return typeof l == "string" ? b.value[l] : l;
|
1558
|
-
}
|
1559
|
-
function re(a) {
|
1560
|
-
return f.value.filter((s) => a.startsWith(s.path)).reduce((s, h) => s ? h.path.length > s.path.length ? h : s : h, void 0);
|
1561
|
-
}
|
1562
|
-
let de = [], be;
|
1563
|
-
function Ne(a) {
|
1564
|
-
return de.push(a), be || (be = he(() => {
|
1565
|
-
[...de].sort().reverse().forEach((s) => {
|
1566
|
-
Ct(c, s);
|
1567
|
-
}), de = [], be = null;
|
1568
|
-
})), be;
|
1569
|
-
}
|
1570
|
-
function Le(a) {
|
1571
|
-
return function(s, h) {
|
1572
|
-
return function(p) {
|
1573
|
-
return p instanceof Event && (p.preventDefault(), p.stopPropagation()), oe((P) => P.touched = !0), i.value = !0, o.value++, Ie().then((P) => {
|
1574
|
-
const x = N(c);
|
1575
|
-
if (P.valid && typeof s == "function") {
|
1576
|
-
const z = N(I.value);
|
1577
|
-
let te = a ? z : x;
|
1578
|
-
return P.values && (te = P.values), s(te, {
|
1579
|
-
evt: p,
|
1580
|
-
controlledValues: z,
|
1581
|
-
setErrors: M,
|
1582
|
-
setFieldError: A,
|
1583
|
-
setTouched: tt,
|
1584
|
-
setFieldTouched: ce,
|
1585
|
-
setValues: pe,
|
1586
|
-
setFieldValue: R,
|
1587
|
-
resetForm: nt,
|
1588
|
-
resetField: _t
|
1589
|
-
});
|
1590
|
-
}
|
1591
|
-
!P.valid && typeof h == "function" && h({
|
1592
|
-
values: x,
|
1593
|
-
evt: p,
|
1594
|
-
errors: P.errors,
|
1595
|
-
results: P.results
|
1596
|
-
});
|
1597
|
-
}).then((P) => (i.value = !1, P), (P) => {
|
1598
|
-
throw i.value = !1, P;
|
1599
|
-
});
|
1600
|
-
};
|
1601
|
-
};
|
1602
|
-
}
|
1603
|
-
const J = Le(!1);
|
1604
|
-
J.withControlled = Le(!0);
|
1605
|
-
function et(a, l) {
|
1606
|
-
const s = f.value.findIndex((O) => O.path === a && (Array.isArray(O.id) ? O.id.includes(l) : O.id === l)), h = f.value[s];
|
1607
|
-
if (!(s === -1 || !h)) {
|
1608
|
-
if (he(() => {
|
1609
|
-
Oe(a, { mode: "silent", warn: !1 });
|
1610
|
-
}), h.multiple && h.fieldsCount && h.fieldsCount--, Array.isArray(h.id)) {
|
1611
|
-
const O = h.id.indexOf(l);
|
1612
|
-
O >= 0 && h.id.splice(O, 1), delete h.__flags.pendingUnmount[l];
|
1613
|
-
}
|
1614
|
-
(!h.multiple || h.fieldsCount <= 0) && (f.value.splice(s, 1), St(a), C(), delete b.value[a]);
|
1615
|
-
}
|
1616
|
-
}
|
1617
|
-
function g(a) {
|
1618
|
-
le(b.value).forEach((l) => {
|
1619
|
-
l.startsWith(a) && delete b.value[l];
|
1620
|
-
}), f.value = f.value.filter((l) => !l.path.startsWith(a)), he(() => {
|
1621
|
-
C();
|
1622
|
-
});
|
1623
|
-
}
|
1624
|
-
const w = {
|
1625
|
-
formId: n,
|
1626
|
-
values: c,
|
1627
|
-
controlledValues: I,
|
1628
|
-
errorBag: X,
|
1629
|
-
errors: E,
|
1630
|
-
schema: F,
|
1631
|
-
submitCount: o,
|
1632
|
-
meta: y,
|
1633
|
-
isSubmitting: i,
|
1634
|
-
isValidating: u,
|
1635
|
-
fieldArrays: d,
|
1636
|
-
keepValuesOnUnmount: K,
|
1637
|
-
validateSchema: T(F) ? ne : void 0,
|
1638
|
-
validate: Ie,
|
1639
|
-
setFieldError: A,
|
1640
|
-
validateField: Oe,
|
1641
|
-
setFieldValue: R,
|
1642
|
-
setValues: pe,
|
1643
|
-
setErrors: M,
|
1644
|
-
setFieldTouched: ce,
|
1645
|
-
setTouched: tt,
|
1646
|
-
resetForm: nt,
|
1647
|
-
resetField: _t,
|
1648
|
-
handleSubmit: J,
|
1649
|
-
useFieldModel: un,
|
1650
|
-
defineInputBinds: on,
|
1651
|
-
defineComponentBinds: sn,
|
1652
|
-
defineField: it,
|
1653
|
-
stageInitialValue: ln,
|
1654
|
-
unsetInitialValue: St,
|
1655
|
-
setFieldInitialValue: rt,
|
1656
|
-
createPathState: D,
|
1657
|
-
getPathState: j,
|
1658
|
-
unsetPathValue: Ne,
|
1659
|
-
removePathState: et,
|
1660
|
-
initialValues: m,
|
1661
|
-
getAllPathStates: () => f.value,
|
1662
|
-
destroyPath: g,
|
1663
|
-
isFieldTouched: tn,
|
1664
|
-
isFieldDirty: nn,
|
1665
|
-
isFieldValid: rn
|
1666
|
-
};
|
1667
|
-
function R(a, l, s = !0) {
|
1668
|
-
const h = N(l), O = typeof a == "string" ? a : a.path;
|
1669
|
-
j(O) || D(O), Y(c, O, h), s && Oe(O);
|
1670
|
-
}
|
1671
|
-
function B(a, l = !0) {
|
1672
|
-
le(c).forEach((s) => {
|
1673
|
-
delete c[s];
|
1674
|
-
}), le(a).forEach((s) => {
|
1675
|
-
R(s, a[s], !1);
|
1676
|
-
}), l && Ie();
|
1677
|
-
}
|
1678
|
-
function pe(a, l = !0) {
|
1679
|
-
Re(c, a), d.forEach((s) => s && s.reset()), l && Ie();
|
1680
|
-
}
|
1681
|
-
function ge(a, l) {
|
1682
|
-
const s = j(S(a)) || D(a);
|
1683
|
-
return k({
|
1684
|
-
get() {
|
1685
|
-
return s.value;
|
1686
|
-
},
|
1687
|
-
set(h) {
|
1688
|
-
var O;
|
1689
|
-
const p = S(a);
|
1690
|
-
R(p, h, (O = S(l)) !== null && O !== void 0 ? O : !1);
|
1691
|
-
}
|
1692
|
-
});
|
1693
|
-
}
|
1694
|
-
function ce(a, l) {
|
1695
|
-
const s = j(a);
|
1696
|
-
s && (s.touched = l);
|
1697
|
-
}
|
1698
|
-
function tn(a) {
|
1699
|
-
const l = j(a);
|
1700
|
-
return l ? l.touched : f.value.filter((s) => s.path.startsWith(a)).some((s) => s.touched);
|
1701
|
-
}
|
1702
|
-
function nn(a) {
|
1703
|
-
const l = j(a);
|
1704
|
-
return l ? l.dirty : f.value.filter((s) => s.path.startsWith(a)).some((s) => s.dirty);
|
1705
|
-
}
|
1706
|
-
function rn(a) {
|
1707
|
-
const l = j(a);
|
1708
|
-
return l ? l.valid : f.value.filter((s) => s.path.startsWith(a)).every((s) => s.valid);
|
1709
|
-
}
|
1710
|
-
function tt(a) {
|
1711
|
-
if (typeof a == "boolean") {
|
1712
|
-
oe((l) => {
|
1713
|
-
l.touched = a;
|
1714
|
-
});
|
1715
|
-
return;
|
1716
|
-
}
|
1717
|
-
le(a).forEach((l) => {
|
1718
|
-
ce(l, !!a[l]);
|
1719
|
-
});
|
1720
|
-
}
|
1721
|
-
function _t(a, l) {
|
1722
|
-
var s;
|
1723
|
-
const h = l && "value" in l ? l.value : L(m.value, a), O = j(a);
|
1724
|
-
O && (O.__flags.pendingReset = !0), rt(a, N(h), !0), R(a, h, !1), ce(a, (s = l?.touched) !== null && s !== void 0 ? s : !1), A(a, l?.errors || []), he(() => {
|
1725
|
-
O && (O.__flags.pendingReset = !1);
|
1726
|
-
});
|
1727
|
-
}
|
1728
|
-
function nt(a, l) {
|
1729
|
-
let s = N(a?.values ? a.values : v.value);
|
1730
|
-
s = l?.force ? s : Re(v.value, s), s = me(F) && ee(F.cast) ? F.cast(s) : s, _(s), oe((h) => {
|
1731
|
-
var O;
|
1732
|
-
h.__flags.pendingReset = !0, h.validated = !1, h.touched = ((O = a?.touched) === null || O === void 0 ? void 0 : O[h.path]) || !1, R(h.path, L(s, h.path), !1), A(h.path, void 0);
|
1733
|
-
}), l?.force ? B(s, !1) : pe(s, !1), M(a?.errors || {}), o.value = a?.submitCount || 0, he(() => {
|
1734
|
-
Ie({ mode: "silent" }), oe((h) => {
|
1735
|
-
h.__flags.pendingReset = !1;
|
1736
|
-
});
|
1737
|
-
});
|
1738
|
-
}
|
1739
|
-
async function Ie(a) {
|
1740
|
-
const l = a?.mode || "force";
|
1741
|
-
if (l === "force" && oe((p) => p.validated = !0), w.validateSchema)
|
1742
|
-
return w.validateSchema(l);
|
1743
|
-
u.value = !0;
|
1744
|
-
const s = await Promise.all(f.value.map((p) => p.validate ? p.validate(a).then((P) => ({
|
1745
|
-
key: p.path,
|
1746
|
-
valid: P.valid,
|
1747
|
-
errors: P.errors
|
1748
|
-
})) : Promise.resolve({
|
1749
|
-
key: p.path,
|
1750
|
-
valid: !0,
|
1751
|
-
errors: []
|
1752
|
-
})));
|
1753
|
-
u.value = !1;
|
1754
|
-
const h = {}, O = {};
|
1755
|
-
for (const p of s)
|
1756
|
-
h[p.key] = {
|
1757
|
-
valid: p.valid,
|
1758
|
-
errors: p.errors
|
1759
|
-
}, p.errors.length && (O[p.key] = p.errors[0]);
|
1760
|
-
return {
|
1761
|
-
valid: s.every((p) => p.valid),
|
1762
|
-
results: h,
|
1763
|
-
errors: O
|
1764
|
-
};
|
1765
|
-
}
|
1766
|
-
async function Oe(a, l) {
|
1767
|
-
var s;
|
1768
|
-
const h = j(a);
|
1769
|
-
if (h && l?.mode !== "silent" && (h.validated = !0), F) {
|
1770
|
-
const { results: p } = await ne(l?.mode || "validated-only");
|
1771
|
-
return p[a] || { errors: [], valid: !0 };
|
1772
|
-
}
|
1773
|
-
return h?.validate ? h.validate(l) : (!h && ((s = l?.warn) !== null && s !== void 0 ? s : !0) && process.env.NODE_ENV !== "production" && Rt(`field with path ${a} was not found`), Promise.resolve({ errors: [], valid: !0 }));
|
1774
|
-
}
|
1775
|
-
function St(a) {
|
1776
|
-
Ct(m.value, a);
|
1777
|
-
}
|
1778
|
-
function ln(a, l, s = !1) {
|
1779
|
-
rt(a, l), Y(c, a, l), s && !e?.initialValues && Y(v.value, a, N(l));
|
1780
|
-
}
|
1781
|
-
function rt(a, l, s = !1) {
|
1782
|
-
Y(m.value, a, N(l)), s && Y(v.value, a, N(l));
|
1783
|
-
}
|
1784
|
-
async function Et() {
|
1785
|
-
const a = T(F);
|
1786
|
-
if (!a)
|
1787
|
-
return { valid: !0, results: {}, errors: {} };
|
1788
|
-
u.value = !0;
|
1789
|
-
const l = Ke(a) || me(a) ? await Qn(a, c) : await Jn(a, c, {
|
1790
|
-
names: q.value,
|
1791
|
-
bailsMap: $.value
|
1792
|
-
});
|
1793
|
-
return u.value = !1, l;
|
1794
|
-
}
|
1795
|
-
const an = J((a, { evt: l }) => {
|
1796
|
-
Wt(l) && l.target.submit();
|
1797
|
-
});
|
1798
|
-
Ut(() => {
|
1799
|
-
if (e?.initialErrors && M(e.initialErrors), e?.initialTouched && tt(e.initialTouched), e?.validateOnMount) {
|
1800
|
-
Ie();
|
1801
|
-
return;
|
1802
|
-
}
|
1803
|
-
w.validateSchema && w.validateSchema("silent");
|
1804
|
-
}), qe(F) && fe(F, () => {
|
1805
|
-
var a;
|
1806
|
-
(a = w.validateSchema) === null || a === void 0 || a.call(w, "validated-only");
|
1807
|
-
}), Dt(Ae, w), process.env.NODE_ENV !== "production" && (nr(w), fe(() => Object.assign(Object.assign({ errors: X.value }, y.value), { values: c, isSubmitting: i.value, isValidating: u.value, submitCount: o.value }), ke, {
|
1808
|
-
deep: !0
|
1809
|
-
}));
|
1810
|
-
function it(a, l) {
|
1811
|
-
const s = ee(l) ? void 0 : l?.label, h = j(S(a)) || D(a, { label: s }), O = () => ee(l) ? l($e(h, xe)) : l || {};
|
1812
|
-
function p() {
|
1813
|
-
var U;
|
1814
|
-
h.touched = !0, ((U = O().validateOnBlur) !== null && U !== void 0 ? U : Se().validateOnBlur) && Oe(h.path);
|
1815
|
-
}
|
1816
|
-
function P() {
|
1817
|
-
var U;
|
1818
|
-
((U = O().validateOnInput) !== null && U !== void 0 ? U : Se().validateOnInput) && he(() => {
|
1819
|
-
Oe(h.path);
|
1820
|
-
});
|
1821
|
-
}
|
1822
|
-
function x() {
|
1823
|
-
var U;
|
1824
|
-
((U = O().validateOnChange) !== null && U !== void 0 ? U : Se().validateOnChange) && he(() => {
|
1825
|
-
Oe(h.path);
|
1826
|
-
});
|
1827
|
-
}
|
1828
|
-
const z = k(() => {
|
1829
|
-
const U = {
|
1830
|
-
onChange: x,
|
1831
|
-
onInput: P,
|
1832
|
-
onBlur: p
|
1833
|
-
};
|
1834
|
-
return ee(l) ? Object.assign(Object.assign({}, U), l($e(h, xe)).props || {}) : l?.props ? Object.assign(Object.assign({}, U), l.props($e(h, xe))) : U;
|
1835
|
-
});
|
1836
|
-
return [ge(a, () => {
|
1837
|
-
var U, Z, ie;
|
1838
|
-
return (ie = (U = O().validateOnModelUpdate) !== null && U !== void 0 ? U : (Z = Se()) === null || Z === void 0 ? void 0 : Z.validateOnModelUpdate) !== null && ie !== void 0 ? ie : !0;
|
1839
|
-
}), z];
|
1840
|
-
}
|
1841
|
-
function un(a) {
|
1842
|
-
return Array.isArray(a) ? a.map((l) => ge(l, !0)) : ge(a);
|
1843
|
-
}
|
1844
|
-
function on(a, l) {
|
1845
|
-
const [s, h] = it(a, l);
|
1846
|
-
function O() {
|
1847
|
-
h.value.onBlur();
|
1848
|
-
}
|
1849
|
-
function p(x) {
|
1850
|
-
const z = Qe(x);
|
1851
|
-
R(S(a), z, !1), h.value.onInput();
|
1852
|
-
}
|
1853
|
-
function P(x) {
|
1854
|
-
const z = Qe(x);
|
1855
|
-
R(S(a), z, !1), h.value.onChange();
|
1856
|
-
}
|
1857
|
-
return k(() => Object.assign(Object.assign({}, h.value), {
|
1858
|
-
onBlur: O,
|
1859
|
-
onInput: p,
|
1860
|
-
onChange: P,
|
1861
|
-
value: s.value
|
1862
|
-
}));
|
1863
|
-
}
|
1864
|
-
function sn(a, l) {
|
1865
|
-
const [s, h] = it(a, l), O = j(S(a));
|
1866
|
-
function p(P) {
|
1867
|
-
s.value = P;
|
1868
|
-
}
|
1869
|
-
return k(() => {
|
1870
|
-
const P = ee(l) ? l($e(O, xe)) : l || {};
|
1871
|
-
return Object.assign({ [P.model || "modelValue"]: s.value, [`onUpdate:${P.model || "modelValue"}`]: p }, h.value);
|
1872
|
-
});
|
1873
|
-
}
|
1874
|
-
return Object.assign(Object.assign({}, w), { values: dn(c), handleReset: () => nt(), submitForm: an });
|
1875
|
-
}
|
1876
|
-
function br(e, t, n, r) {
|
1877
|
-
const i = {
|
1878
|
-
touched: "some",
|
1879
|
-
pending: "some",
|
1880
|
-
valid: "every"
|
1881
|
-
}, u = k(() => !G(t, T(n)));
|
1882
|
-
function o() {
|
1883
|
-
const c = e.value;
|
1884
|
-
return le(i).reduce((f, V) => {
|
1885
|
-
const b = i[V];
|
1886
|
-
return f[V] = c[b]((C) => C[V]), f;
|
1887
|
-
}, {});
|
1888
|
-
}
|
1889
|
-
const d = We(o());
|
1890
|
-
return cn(() => {
|
1891
|
-
const c = o();
|
1892
|
-
d.touched = c.touched, d.valid = c.valid, d.pending = c.pending;
|
1893
|
-
}), k(() => Object.assign(Object.assign({ initialValues: T(n) }, d), { valid: d.valid && !le(r.value).length, dirty: u.value }));
|
1894
|
-
}
|
1895
|
-
function Vr(e, t, n) {
|
1896
|
-
const r = en(n), i = se(r), u = se(N(r));
|
1897
|
-
function o(d, c = !1) {
|
1898
|
-
i.value = Re(N(i.value) || {}, N(d)), u.value = Re(N(u.value) || {}, N(d)), c && e.value.forEach((f) => {
|
1899
|
-
if (f.touched)
|
1900
|
-
return;
|
1901
|
-
const b = L(i.value, f.path);
|
1902
|
-
Y(t, f.path, N(b));
|
1903
|
-
});
|
1904
|
-
}
|
1905
|
-
return {
|
1906
|
-
initialValues: i,
|
1907
|
-
originalInitialValues: u,
|
1908
|
-
setInitialValues: o
|
1909
|
-
};
|
1910
|
-
}
|
1911
|
-
function Or(e, t) {
|
1912
|
-
return t ? {
|
1913
|
-
valid: e.valid && t.valid,
|
1914
|
-
errors: [...e.errors, ...t.errors]
|
1915
|
-
} : e;
|
1916
|
-
}
|
1917
|
-
const _r = /* @__PURE__ */ Je({
|
1918
|
-
name: "Form",
|
1919
|
-
inheritAttrs: !1,
|
1920
|
-
props: {
|
1921
|
-
as: {
|
1922
|
-
type: null,
|
1923
|
-
default: "form"
|
1924
|
-
},
|
1925
|
-
validationSchema: {
|
1926
|
-
type: Object,
|
1927
|
-
default: void 0
|
1928
|
-
},
|
1929
|
-
initialValues: {
|
1930
|
-
type: Object,
|
1931
|
-
default: void 0
|
1932
|
-
},
|
1933
|
-
initialErrors: {
|
1934
|
-
type: Object,
|
1935
|
-
default: void 0
|
1936
|
-
},
|
1937
|
-
initialTouched: {
|
1938
|
-
type: Object,
|
1939
|
-
default: void 0
|
1940
|
-
},
|
1941
|
-
validateOnMount: {
|
1942
|
-
type: Boolean,
|
1943
|
-
default: !1
|
1944
|
-
},
|
1945
|
-
onSubmit: {
|
1946
|
-
type: Function,
|
1947
|
-
default: void 0
|
1948
|
-
},
|
1949
|
-
onInvalidSubmit: {
|
1950
|
-
type: Function,
|
1951
|
-
default: void 0
|
1952
|
-
},
|
1953
|
-
keepValues: {
|
1954
|
-
type: Boolean,
|
1955
|
-
default: !1
|
1956
|
-
}
|
1957
|
-
},
|
1958
|
-
setup(e, t) {
|
1959
|
-
const n = _e(e, "validationSchema"), r = _e(e, "keepValues"), { errors: i, errorBag: u, values: o, meta: d, isSubmitting: c, isValidating: f, submitCount: V, controlledValues: b, validate: C, validateField: A, handleReset: M, resetForm: X, handleSubmit: E, setErrors: q, setFieldError: $, setFieldValue: H, setValues: K, setFieldTouched: m, setTouched: v, resetField: _ } = yr({
|
1960
|
-
validationSchema: n.value ? n : void 0,
|
1961
|
-
initialValues: e.initialValues,
|
1962
|
-
initialErrors: e.initialErrors,
|
1963
|
-
initialTouched: e.initialTouched,
|
1964
|
-
validateOnMount: e.validateOnMount,
|
1965
|
-
keepValuesOnUnmount: r
|
1966
|
-
}), y = E((j, { evt: re }) => {
|
1967
|
-
Wt(re) && re.target.submit();
|
1968
|
-
}, e.onInvalidSubmit), I = e.onSubmit ? E(e.onSubmit, e.onInvalidSubmit) : y;
|
1969
|
-
function F(j) {
|
1970
|
-
pt(j) && j.preventDefault(), M(), typeof t.attrs.onReset == "function" && t.attrs.onReset();
|
1971
|
-
}
|
1972
|
-
function D(j, re) {
|
1973
|
-
return E(typeof j == "function" && !re ? j : re, e.onInvalidSubmit)(j);
|
1974
|
-
}
|
1975
|
-
function Q() {
|
1976
|
-
return N(o);
|
1977
|
-
}
|
1978
|
-
function ue() {
|
1979
|
-
return N(d.value);
|
1980
|
-
}
|
1981
|
-
function ne() {
|
1982
|
-
return N(i.value);
|
1983
|
-
}
|
1984
|
-
function oe() {
|
1985
|
-
return {
|
1986
|
-
meta: d.value,
|
1987
|
-
errors: i.value,
|
1988
|
-
errorBag: u.value,
|
1989
|
-
values: o,
|
1990
|
-
isSubmitting: c.value,
|
1991
|
-
isValidating: f.value,
|
1992
|
-
submitCount: V.value,
|
1993
|
-
controlledValues: b.value,
|
1994
|
-
validate: C,
|
1995
|
-
validateField: A,
|
1996
|
-
handleSubmit: D,
|
1997
|
-
handleReset: M,
|
1998
|
-
submitForm: y,
|
1999
|
-
setErrors: q,
|
2000
|
-
setFieldError: $,
|
2001
|
-
setFieldValue: H,
|
2002
|
-
setValues: K,
|
2003
|
-
setFieldTouched: m,
|
2004
|
-
setTouched: v,
|
2005
|
-
resetForm: X,
|
2006
|
-
resetField: _,
|
2007
|
-
getValues: Q,
|
2008
|
-
getMeta: ue,
|
2009
|
-
getErrors: ne
|
2010
|
-
};
|
2011
|
-
}
|
2012
|
-
return t.expose({
|
2013
|
-
setFieldError: $,
|
2014
|
-
setErrors: q,
|
2015
|
-
setFieldValue: H,
|
2016
|
-
setValues: K,
|
2017
|
-
setFieldTouched: m,
|
2018
|
-
setTouched: v,
|
2019
|
-
resetForm: X,
|
2020
|
-
validate: C,
|
2021
|
-
validateField: A,
|
2022
|
-
resetField: _,
|
2023
|
-
getValues: Q,
|
2024
|
-
getMeta: ue,
|
2025
|
-
getErrors: ne,
|
2026
|
-
values: o,
|
2027
|
-
meta: d,
|
2028
|
-
errors: i
|
2029
|
-
}), function() {
|
2030
|
-
const re = e.as === "form" ? e.as : e.as ? mt(e.as) : null, de = Ze(re, t, oe);
|
2031
|
-
return re ? Ge(re, Object.assign(Object.assign(Object.assign({}, re === "form" ? {
|
2032
|
-
// Disables native validation as vee-validate will handle it.
|
2033
|
-
novalidate: !0
|
2034
|
-
} : {}), t.attrs), { onSubmit: I, onReset: F }), de) : de;
|
2035
|
-
};
|
2036
|
-
}
|
2037
|
-
}), Tr = _r;
|
2038
|
-
function Sr(e) {
|
2039
|
-
const t = De(Ae, void 0), n = se([]), r = () => {
|
2040
|
-
}, i = {
|
2041
|
-
fields: n,
|
2042
|
-
remove: r,
|
2043
|
-
push: r,
|
2044
|
-
swap: r,
|
2045
|
-
insert: r,
|
2046
|
-
update: r,
|
2047
|
-
replace: r,
|
2048
|
-
prepend: r,
|
2049
|
-
move: r
|
2050
|
-
};
|
2051
|
-
if (!t)
|
2052
|
-
return process.env.NODE_ENV !== "production" && ze("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"), i;
|
2053
|
-
if (!T(e))
|
2054
|
-
return process.env.NODE_ENV !== "production" && ze("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"), i;
|
2055
|
-
const u = t.fieldArrays.find((m) => T(m.path) === T(e));
|
2056
|
-
if (u)
|
2057
|
-
return u;
|
2058
|
-
let o = 0;
|
2059
|
-
function d() {
|
2060
|
-
return L(t?.values, S(e), []) || [];
|
2061
|
-
}
|
2062
|
-
function c() {
|
2063
|
-
const m = d();
|
2064
|
-
Array.isArray(m) && (n.value = m.map((v, _) => V(v, _, n.value)), f());
|
2065
|
-
}
|
2066
|
-
c();
|
2067
|
-
function f() {
|
2068
|
-
const m = n.value.length;
|
2069
|
-
for (let v = 0; v < m; v++) {
|
2070
|
-
const _ = n.value[v];
|
2071
|
-
_.isFirst = v === 0, _.isLast = v === m - 1;
|
2072
|
-
}
|
2073
|
-
}
|
2074
|
-
function V(m, v, _) {
|
2075
|
-
if (_ && !we(v) && _[v])
|
2076
|
-
return _[v];
|
2077
|
-
const y = o++;
|
2078
|
-
return {
|
2079
|
-
key: y,
|
2080
|
-
value: Mn({
|
2081
|
-
get() {
|
2082
|
-
const F = L(t?.values, S(e), []) || [], D = n.value.findIndex((Q) => Q.key === y);
|
2083
|
-
return D === -1 ? m : F[D];
|
2084
|
-
},
|
2085
|
-
set(F) {
|
2086
|
-
const D = n.value.findIndex((Q) => Q.key === y);
|
2087
|
-
if (D === -1) {
|
2088
|
-
process.env.NODE_ENV !== "production" && ze("Attempting to update a non-existent array item");
|
2089
|
-
return;
|
2090
|
-
}
|
2091
|
-
q(D, F);
|
2092
|
-
}
|
2093
|
-
}),
|
2094
|
-
// will be auto unwrapped
|
2095
|
-
isFirst: !1,
|
2096
|
-
isLast: !1
|
2097
|
-
};
|
2098
|
-
}
|
2099
|
-
function b() {
|
2100
|
-
f(), t?.validate({ mode: "silent" });
|
2101
|
-
}
|
2102
|
-
function C(m) {
|
2103
|
-
const v = S(e), _ = L(t?.values, v);
|
2104
|
-
if (!_ || !Array.isArray(_))
|
2105
|
-
return;
|
2106
|
-
const y = [..._];
|
2107
|
-
y.splice(m, 1);
|
2108
|
-
const I = v + `[${m}]`;
|
2109
|
-
t.destroyPath(I), t.unsetInitialValue(I), Y(t.values, v, y), n.value.splice(m, 1), b();
|
2110
|
-
}
|
2111
|
-
function A(m) {
|
2112
|
-
const v = N(m), _ = S(e), y = L(t?.values, _), I = we(y) ? [] : y;
|
2113
|
-
if (!Array.isArray(I))
|
2114
|
-
return;
|
2115
|
-
const F = [...I];
|
2116
|
-
F.push(v), t.stageInitialValue(_ + `[${F.length - 1}]`, v), Y(t.values, _, F), n.value.push(V(v)), b();
|
2117
|
-
}
|
2118
|
-
function M(m, v) {
|
2119
|
-
const _ = S(e), y = L(t?.values, _);
|
2120
|
-
if (!Array.isArray(y) || !(m in y) || !(v in y))
|
2121
|
-
return;
|
2122
|
-
const I = [...y], F = [...n.value], D = I[m];
|
2123
|
-
I[m] = I[v], I[v] = D;
|
2124
|
-
const Q = F[m];
|
2125
|
-
F[m] = F[v], F[v] = Q, Y(t.values, _, I), n.value = F, f();
|
2126
|
-
}
|
2127
|
-
function X(m, v) {
|
2128
|
-
const _ = N(v), y = S(e), I = L(t?.values, y);
|
2129
|
-
if (!Array.isArray(I) || I.length < m)
|
2130
|
-
return;
|
2131
|
-
const F = [...I], D = [...n.value];
|
2132
|
-
F.splice(m, 0, _), D.splice(m, 0, V(_)), Y(t.values, y, F), n.value = D, b();
|
2133
|
-
}
|
2134
|
-
function E(m) {
|
2135
|
-
const v = S(e);
|
2136
|
-
t.stageInitialValue(v, m), Y(t.values, v, m), c(), b();
|
2137
|
-
}
|
2138
|
-
function q(m, v) {
|
2139
|
-
const _ = S(e), y = L(t?.values, _);
|
2140
|
-
!Array.isArray(y) || y.length - 1 < m || (Y(t.values, `${_}[${m}]`, v), t?.validate({ mode: "validated-only" }));
|
2141
|
-
}
|
2142
|
-
function $(m) {
|
2143
|
-
const v = N(m), _ = S(e), y = L(t?.values, _), I = we(y) ? [] : y;
|
2144
|
-
if (!Array.isArray(I))
|
2145
|
-
return;
|
2146
|
-
const F = [v, ...I];
|
2147
|
-
Y(t.values, _, F), t.stageInitialValue(_ + "[0]", v), n.value.unshift(V(v)), b();
|
2148
|
-
}
|
2149
|
-
function H(m, v) {
|
2150
|
-
const _ = S(e), y = L(t?.values, _), I = we(y) ? [] : [...y];
|
2151
|
-
if (!Array.isArray(y) || !(m in y) || !(v in y))
|
2152
|
-
return;
|
2153
|
-
const F = [...n.value], D = F[m];
|
2154
|
-
F.splice(m, 1), F.splice(v, 0, D);
|
2155
|
-
const Q = I[m];
|
2156
|
-
I.splice(m, 1), I.splice(v, 0, Q), Y(t.values, _, I), n.value = F, b();
|
2157
|
-
}
|
2158
|
-
const K = {
|
2159
|
-
fields: n,
|
2160
|
-
remove: C,
|
2161
|
-
push: A,
|
2162
|
-
swap: M,
|
2163
|
-
insert: X,
|
2164
|
-
update: q,
|
2165
|
-
replace: E,
|
2166
|
-
prepend: $,
|
2167
|
-
move: H
|
2168
|
-
};
|
2169
|
-
return t.fieldArrays.push(Object.assign({ path: e, reset: c }, K)), $t(() => {
|
2170
|
-
const m = t.fieldArrays.findIndex((v) => S(v.path) === S(e));
|
2171
|
-
m >= 0 && t.fieldArrays.splice(m, 1);
|
2172
|
-
}), fe(d, (m) => {
|
2173
|
-
const v = n.value.map((_) => _.value);
|
2174
|
-
G(m, v) || c();
|
2175
|
-
}), K;
|
2176
|
-
}
|
2177
|
-
const Er = /* @__PURE__ */ Je({
|
2178
|
-
name: "FieldArray",
|
2179
|
-
inheritAttrs: !1,
|
2180
|
-
props: {
|
2181
|
-
name: {
|
2182
|
-
type: String,
|
2183
|
-
required: !0
|
2184
|
-
}
|
2185
|
-
},
|
2186
|
-
setup(e, t) {
|
2187
|
-
const { push: n, remove: r, swap: i, insert: u, replace: o, update: d, prepend: c, move: f, fields: V } = Sr(() => e.name);
|
2188
|
-
function b() {
|
2189
|
-
return {
|
2190
|
-
fields: V.value,
|
2191
|
-
push: n,
|
2192
|
-
remove: r,
|
2193
|
-
swap: i,
|
2194
|
-
insert: u,
|
2195
|
-
update: d,
|
2196
|
-
replace: o,
|
2197
|
-
prepend: c,
|
2198
|
-
move: f
|
2199
|
-
};
|
2200
|
-
}
|
2201
|
-
return t.expose({
|
2202
|
-
push: n,
|
2203
|
-
remove: r,
|
2204
|
-
swap: i,
|
2205
|
-
insert: u,
|
2206
|
-
update: d,
|
2207
|
-
replace: o,
|
2208
|
-
prepend: c,
|
2209
|
-
move: f
|
2210
|
-
}), () => Ze(void 0, t, b);
|
2211
|
-
}
|
2212
|
-
}), Pr = Er, Ar = /* @__PURE__ */ Je({
|
2213
|
-
name: "ErrorMessage",
|
2214
|
-
props: {
|
2215
|
-
as: {
|
2216
|
-
type: String,
|
2217
|
-
default: void 0
|
2218
|
-
},
|
2219
|
-
name: {
|
2220
|
-
type: String,
|
2221
|
-
required: !0
|
2222
|
-
}
|
2223
|
-
},
|
2224
|
-
setup(e, t) {
|
2225
|
-
const n = Ce(Ae, void 0), r = k(() => n?.errors.value[e.name]);
|
2226
|
-
function i() {
|
2227
|
-
return {
|
2228
|
-
message: r.value
|
2229
|
-
};
|
2230
|
-
}
|
2231
|
-
return () => {
|
2232
|
-
if (!r.value)
|
2233
|
-
return;
|
2234
|
-
const u = e.as ? mt(e.as) : e.as, o = Ze(u, t, i), d = Object.assign({ role: "alert" }, t.attrs);
|
2235
|
-
return !u && (Array.isArray(o) || !o) && o?.length ? o : (Array.isArray(o) || !o) && !o?.length ? Ge(u || "span", d, r.value) : Ge(u, d, o);
|
2236
|
-
};
|
2237
|
-
}
|
2238
|
-
}), Mr = Ar;
|
2239
|
-
function Ir(e) {
|
2240
|
-
const t = bt(e);
|
2241
|
-
return k(() => {
|
2242
|
-
var n, r;
|
2243
|
-
return t && (r = "meta" in t ? t.meta.dirty : (n = t?.value) === null || n === void 0 ? void 0 : n.dirty) !== null && r !== void 0 ? r : !1;
|
2244
|
-
});
|
2245
|
-
}
|
2246
|
-
function Fr(e) {
|
2247
|
-
const t = bt(e);
|
2248
|
-
return k(() => {
|
2249
|
-
var n, r;
|
2250
|
-
return t && (r = "meta" in t ? t.meta.touched : (n = t?.value) === null || n === void 0 ? void 0 : n.touched) !== null && r !== void 0 ? r : !1;
|
2251
|
-
});
|
2252
|
-
}
|
2253
|
-
function wr(e) {
|
2254
|
-
const t = bt(e);
|
2255
|
-
return k(() => {
|
2256
|
-
var n, r;
|
2257
|
-
return t && (r = "meta" in t ? t.meta.valid : (n = t?.value) === null || n === void 0 ? void 0 : n.valid) !== null && r !== void 0 ? r : !1;
|
2258
|
-
});
|
2259
|
-
}
|
2260
|
-
function jr(e) {
|
2261
|
-
const t = De(Ae), n = e ? void 0 : Ce(Ye);
|
2262
|
-
return k(() => e ? t?.errors.value[S(e)] : n?.errorMessage.value);
|
2263
|
-
}
|
2264
|
-
function Br() {
|
2265
|
-
const e = Ce(Ye), t = Ce(vn), n = {
|
2266
|
-
valid: wr(),
|
2267
|
-
isDirty: Ir(),
|
2268
|
-
isTouched: Fr(),
|
2269
|
-
error: jr()
|
2270
|
-
};
|
2271
|
-
if (!e)
|
2272
|
-
throw new Error("useFormField should be used within <BuiFormField>");
|
2273
|
-
const { name: r } = e, i = t;
|
2274
|
-
return {
|
2275
|
-
id: i,
|
2276
|
-
name: r,
|
2277
|
-
formItemId: `${i}-form-item`,
|
2278
|
-
formDescriptionId: `${i}-form-item-description`,
|
2279
|
-
formMessageId: `${i}-form-item-message`,
|
2280
|
-
...n
|
2281
|
-
};
|
2282
|
-
}
|
2283
|
-
export {
|
2284
|
-
Mr as E,
|
2285
|
-
Tr as F,
|
2286
|
-
Nr as a,
|
2287
|
-
Pr as b,
|
2288
|
-
Br as c,
|
2289
|
-
yr as u
|
2290
|
-
};
|