@vergelijkdirect/comparison-forms 2.0.2 → 2.1.0-ver-9053.1
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/README.md +5 -5
- package/dist/vue/VdInput-CRb-iTiH.js +145 -0
- package/dist/vue/VdPopover-B78nVpNU.js +200 -0
- package/dist/vue/VdRadioGroup-D5kHcpsY.js +166 -0
- package/dist/vue/VdSearchableSelect-THqVGo_Q.js +209 -0
- package/dist/vue/VdSelect-Dv35x4sz.js +112 -0
- package/dist/vue/bike-Ch7ZcSpI.js +2 -0
- package/dist/vue/bike.presenter-CdCny1-M.js +1673 -0
- package/dist/vue/birthdate.schema-B9q6IeIR.js +91 -0
- package/dist/vue/businessCar.presenter-DR-Ozf6B.js +121 -0
- package/dist/vue/businessLiability-w4xhGnik.js +2 -0
- package/dist/vue/businessLiability.presenter-8iyRbLgw.js +80 -0
- package/dist/vue/car-business-DMYPV4UK.js +2 -0
- package/dist/vue/car-jPvIXEVK.js +2 -0
- package/dist/vue/car.presenter-gd62kiqS.js +130 -0
- package/dist/vue/caravan-B8l6zEkk.js +2 -0
- package/dist/vue/caravan.presenter-Cr5vuB_r.js +157 -0
- package/dist/vue/company.schema-DStHJpGH.js +241 -0
- package/dist/vue/comparison-forms.d.ts +34 -34
- package/dist/vue/comparison-forms.js +119 -5590
- package/dist/vue/date.util-DjJZwKvn.js +24 -0
- package/dist/vue/familyComposition.enum-D26VYo_a.js +6 -0
- package/dist/vue/familyComposition.schema-CNMH-wP0.js +75 -0
- package/dist/vue/house-BtQscoRa.js +2 -0
- package/dist/vue/house.presenter-DLeGfJAY.js +118 -0
- package/dist/vue/houseOwnedBuilding.model-BLLI1Vm0.js +14 -0
- package/dist/vue/itc-KSDsJZsI.js +10 -0
- package/dist/vue/legal-BjG3LO5G.js +2 -0
- package/dist/vue/legal.presenter-CwEVdXZJ.js +100 -0
- package/dist/vue/liability-_Sp33TSY.js +2 -0
- package/dist/vue/liability.presenter-C_5O-OQm.js +110 -0
- package/dist/vue/loan-T0OYMmxG.js +2 -0
- package/dist/vue/loan.presenter-CEZ3PcSo.js +198 -0
- package/dist/vue/messages-DRFu-PCu.js +40 -0
- package/dist/vue/moped-D9KUmwn6.js +2 -0
- package/dist/vue/moped.presenter-DazWxVEM.js +133 -0
- package/dist/vue/motor-BEAQ5N4w.js +2 -0
- package/dist/vue/motor.presenter-e_ESWwhI.js +130 -0
- package/dist/vue/package-DjsxU0ny.js +2 -0
- package/dist/vue/package.presenter-BA6S0X_L.js +137 -0
- package/dist/vue/pet-Bguvk2H4.js +2 -0
- package/dist/vue/pet.presenter-BpDDlFSQ.js +170 -0
- package/dist/vue/rules-3BZkSj_K.js +13 -0
- package/dist/vue/travel-C_cvpQNA.js +2 -0
- package/dist/vue/travel.presenter-DeoXBmrT.js +108 -0
- package/dist/vue/useAddress-C-h1pGI5.js +245 -0
- package/dist/vue/useLicensePlate-wAVrX9tr.js +187 -0
- package/dist/vue/useValidator-B8ZuqyvJ.js +535 -0
- package/dist/vue/yesNo-BvJlCm7Y.js +6 -0
- package/dist/wc/comparison-forms.js +14836 -14413
- package/dist/wc-noitc/comparison-forms.umd.cjs +3 -3
- package/package.json +1 -1
- package/dist/client/.vite/ssr-manifest.json +0 -600
- package/dist/client/assets/index-6Enzr9rU.css +0 -4
- package/dist/client/assets/index-6Enzr9rU.css.br +0 -0
- package/dist/client/assets/index-DUchBxEo.js +0 -57
- package/dist/client/assets/index-DUchBxEo.js.br +0 -0
- package/dist/client/index.html +0 -15
- package/dist/server/entry-server.js +0 -9981
- package/dist/server/entry-server.js.br +0 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, inject as c, mergeDefaults as l, mergeProps as u, nextTick as d, normalizeClass as f, openBlock as p, provide as m, ref as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, useSlots as b, withCtx as x, withModifiers as S } from "vue";
|
|
2
|
+
import { cloneDeep as C } from "es-toolkit";
|
|
3
|
+
import { reactivePick as w } from "@vueuse/core";
|
|
4
|
+
import "yup";
|
|
5
|
+
//#region src/enums/comparisonName.enum.ts
|
|
6
|
+
var T = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.Bike = "bike", e.Car = "car", e.Caravan = "caravan", e.CarBusiness = "car-business", e.BusinessLiability = "business-liability", e.Housing = "housing", e.LegalAssistance = "legal-assistance", e.Liability = "liability", e.Loan = "loan", e.Moped = "moped", e.Motor = "motor", e.Package = "package", e.Pet = "pet", e.Travel = "travel", e;
|
|
8
|
+
}({}), E = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "vd-btn-new__label"
|
|
11
|
+
}, D = /* @__PURE__ */ s({
|
|
12
|
+
__name: "VdButton",
|
|
13
|
+
props: {
|
|
14
|
+
buttonType: { default: "primary" },
|
|
15
|
+
type: { default: "button" },
|
|
16
|
+
label: { default: "" },
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
isLoading: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !1
|
|
24
|
+
},
|
|
25
|
+
icon: { default: "" },
|
|
26
|
+
iconLeft: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
size: { default: null },
|
|
31
|
+
href: { default: null },
|
|
32
|
+
target: { default: "_blank" },
|
|
33
|
+
hideLabelOnResize: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
block: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !1
|
|
40
|
+
},
|
|
41
|
+
tabindex: { default: null }
|
|
42
|
+
},
|
|
43
|
+
emits: ["click"],
|
|
44
|
+
setup(o, { emit: s }) {
|
|
45
|
+
let c = o, l = s, d = b(), m = e(() => !!c.href), h = e(() => c.disabled || c.isLoading), y = e(() => !!c.label || !!d.default), S = e(() => m.value ? "a" : "button"), C = e(() => [
|
|
46
|
+
"vd-btn-new",
|
|
47
|
+
...c.buttonType.split("-").map((e) => `vd-btn-new--${e}`),
|
|
48
|
+
{
|
|
49
|
+
"vd-btn-new--link-type": m.value,
|
|
50
|
+
"vd-btn-new--full-width": c.block,
|
|
51
|
+
"vd-btn-new--loading": c.isLoading,
|
|
52
|
+
"vd-btn-new--hide-label": c.hideLabelOnResize,
|
|
53
|
+
"vd-btn-new--disabled": h.value
|
|
54
|
+
},
|
|
55
|
+
c.size ? `vd-btn-new--${c.size}` : ""
|
|
56
|
+
]), w = e(() => {
|
|
57
|
+
let e = {
|
|
58
|
+
"aria-busy": c.isLoading || void 0,
|
|
59
|
+
"aria-label": c.hideLabelOnResize && c.label || void 0
|
|
60
|
+
};
|
|
61
|
+
return m.value ? {
|
|
62
|
+
...e,
|
|
63
|
+
href: h.value ? void 0 : c.href,
|
|
64
|
+
target: c.target,
|
|
65
|
+
rel: c.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
66
|
+
"aria-disabled": h.value || void 0,
|
|
67
|
+
tabindex: h.value ? -1 : c.tabindex ?? void 0
|
|
68
|
+
} : {
|
|
69
|
+
...e,
|
|
70
|
+
type: c.type,
|
|
71
|
+
disabled: h.value,
|
|
72
|
+
tabindex: c.tabindex ?? void 0
|
|
73
|
+
};
|
|
74
|
+
}), T = (e) => {
|
|
75
|
+
if (h.value) {
|
|
76
|
+
e.preventDefault(), e.stopPropagation();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
l("click", e);
|
|
80
|
+
};
|
|
81
|
+
return (e, s) => (p(), t(_(S.value), u({ class: C.value }, w.value, { onClick: T }), {
|
|
82
|
+
default: x(() => [
|
|
83
|
+
o.icon && o.iconLeft ? (p(), r("i", {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: f([
|
|
86
|
+
"vd-btn-new__icon",
|
|
87
|
+
o.icon,
|
|
88
|
+
{ "vd-btn-new__icon--non-label": !y.value }
|
|
89
|
+
]),
|
|
90
|
+
"aria-hidden": "true"
|
|
91
|
+
}, null, 2)) : n("", !0),
|
|
92
|
+
y.value ? (p(), r("span", E, [g(e.$slots, "default", {}, () => [a(v(o.label), 1)])])) : n("", !0),
|
|
93
|
+
o.icon && !o.iconLeft ? (p(), r("i", {
|
|
94
|
+
key: 2,
|
|
95
|
+
class: f([
|
|
96
|
+
"vd-btn-new__icon",
|
|
97
|
+
o.icon,
|
|
98
|
+
{ "vd-btn-new__icon--non-label": !y.value }
|
|
99
|
+
]),
|
|
100
|
+
"aria-hidden": "true"
|
|
101
|
+
}, null, 2)) : n("", !0),
|
|
102
|
+
s[0] ||= i("div", {
|
|
103
|
+
class: "loader-circle",
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}, null, -1)
|
|
106
|
+
]),
|
|
107
|
+
_: 3
|
|
108
|
+
}, 16, ["class"]));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
|
|
113
|
+
function O(e, t) {
|
|
114
|
+
return e === t || Number.isNaN(e) && Number.isNaN(t);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region node_modules/es-toolkit/dist/compat/util/toString.mjs
|
|
118
|
+
function k(e) {
|
|
119
|
+
if (e == null) return "";
|
|
120
|
+
if (typeof e == "string") return e;
|
|
121
|
+
if (Array.isArray(e)) return e.map(k).join(",");
|
|
122
|
+
let t = String(e);
|
|
123
|
+
return t === "0" && Object.is(Number(e), -0) ? "-0" : t;
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region node_modules/es-toolkit/dist/compat/_internal/toKey.mjs
|
|
127
|
+
function A(e) {
|
|
128
|
+
return typeof e == "string" || typeof e == "symbol" ? e : Object.is(e?.valueOf?.(), -0) ? "-0" : String(e);
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region node_modules/es-toolkit/dist/compat/util/toPath.mjs
|
|
132
|
+
function j(e) {
|
|
133
|
+
if (Array.isArray(e)) return e.map(A);
|
|
134
|
+
if (typeof e == "symbol") return [e];
|
|
135
|
+
e = k(e);
|
|
136
|
+
let t = [], n = e.length;
|
|
137
|
+
if (n === 0) return t;
|
|
138
|
+
let r = 0, i = "", a = "", o = !1;
|
|
139
|
+
for (e.charCodeAt(0) === 46 && t.push(""); r < n;) {
|
|
140
|
+
let s = e[r];
|
|
141
|
+
if (a) s === "\\" && r + 1 < n ? (r++, i += e[r]) : s === a ? a = "" : i += s;
|
|
142
|
+
else if (o) s === "\"" || s === "'" ? a = s : s === "]" ? (o = !1, t.push(i), i = "") : i += s;
|
|
143
|
+
else if (s === "[") o = !0, i &&= (t.push(i), "");
|
|
144
|
+
else if (s === ".") {
|
|
145
|
+
i &&= (t.push(i), "");
|
|
146
|
+
let n = e[r + 1];
|
|
147
|
+
(n === void 0 || n === ".") && t.push("");
|
|
148
|
+
} else i += s;
|
|
149
|
+
r++;
|
|
150
|
+
}
|
|
151
|
+
return i && t.push(i), t;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
|
|
155
|
+
function M(e) {
|
|
156
|
+
return e === "__proto__";
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs
|
|
160
|
+
function N(e) {
|
|
161
|
+
switch (typeof e) {
|
|
162
|
+
case "number":
|
|
163
|
+
case "symbol": return !1;
|
|
164
|
+
case "string": return e.includes(".") || e.includes("[") || e.includes("]");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region node_modules/es-toolkit/dist/compat/object/get.mjs
|
|
169
|
+
function P(e, t, n) {
|
|
170
|
+
if (e == null) return n;
|
|
171
|
+
switch (typeof t) {
|
|
172
|
+
case "string": {
|
|
173
|
+
if (M(t)) return n;
|
|
174
|
+
let r = e[t];
|
|
175
|
+
return r === void 0 ? N(t) && !Object.hasOwn(e, t) ? P(e, j(t), n) : n : r;
|
|
176
|
+
}
|
|
177
|
+
case "number":
|
|
178
|
+
case "symbol": {
|
|
179
|
+
typeof t == "number" && (t = A(t));
|
|
180
|
+
let r = e[t];
|
|
181
|
+
return r === void 0 ? n : r;
|
|
182
|
+
}
|
|
183
|
+
default: {
|
|
184
|
+
if (Array.isArray(t)) return F(e, t, n);
|
|
185
|
+
if (t = Object.is(t?.valueOf(), -0) ? "-0" : String(t), M(t)) return n;
|
|
186
|
+
let r = e[t];
|
|
187
|
+
return r === void 0 ? n : r;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function F(e, t, n) {
|
|
192
|
+
if (t.length === 0) return n;
|
|
193
|
+
let r = e;
|
|
194
|
+
for (let e = 0; e < t.length; e++) {
|
|
195
|
+
if (r == null || M(t[e])) return n;
|
|
196
|
+
r = r[t[e]];
|
|
197
|
+
}
|
|
198
|
+
return r === void 0 ? n : r;
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
|
|
202
|
+
function I(e) {
|
|
203
|
+
return e !== null && (typeof e == "object" || typeof e == "function");
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
|
|
207
|
+
var L = /^(?:0|[1-9]\d*)$/;
|
|
208
|
+
function R(e, t = 2 ** 53 - 1) {
|
|
209
|
+
switch (typeof e) {
|
|
210
|
+
case "number": return Number.isInteger(e) && e >= 0 && e < t;
|
|
211
|
+
case "symbol": return !1;
|
|
212
|
+
case "string": return L.test(e);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
|
|
217
|
+
function z(e) {
|
|
218
|
+
return typeof e == "symbol" || e instanceof Symbol;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region node_modules/es-toolkit/dist/compat/_internal/isKey.mjs
|
|
222
|
+
var B = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, V = /^\w*$/;
|
|
223
|
+
function ee(e, t) {
|
|
224
|
+
return Array.isArray(e) ? !1 : typeof e == "number" || typeof e == "boolean" || e == null || z(e) ? !0 : typeof e == "string" && (V.test(e) || !B.test(e)) || t != null && Object.hasOwn(t, e);
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs
|
|
228
|
+
var H = (e, t, n) => {
|
|
229
|
+
let r = e[t];
|
|
230
|
+
(!(Object.hasOwn(e, t) && O(r, n)) || n === void 0 && !(t in e)) && (e[t] = n);
|
|
231
|
+
};
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region node_modules/es-toolkit/dist/compat/object/updateWith.mjs
|
|
234
|
+
function te(e, t, n, r) {
|
|
235
|
+
if (e == null && !I(e)) return e;
|
|
236
|
+
let i;
|
|
237
|
+
i = ee(t, e) ? [t] : Array.isArray(t) ? t : j(t);
|
|
238
|
+
let a = n(P(e, i)), o = e;
|
|
239
|
+
for (let t = 0; t < i.length && o != null; t++) {
|
|
240
|
+
let n = A(i[t]);
|
|
241
|
+
if (M(n)) continue;
|
|
242
|
+
let s;
|
|
243
|
+
if (t === i.length - 1) s = a;
|
|
244
|
+
else {
|
|
245
|
+
let a = o[n], c = r?.(a, n, e);
|
|
246
|
+
s = c === void 0 ? I(a) ? a : R(i[t + 1]) ? [] : {} : c;
|
|
247
|
+
}
|
|
248
|
+
H(o, n, s), o = o[n];
|
|
249
|
+
}
|
|
250
|
+
return e;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region node_modules/es-toolkit/dist/compat/object/set.mjs
|
|
254
|
+
function ne(e, t, n) {
|
|
255
|
+
return te(e, t, () => n, () => void 0);
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/composables/useComparisonForm.ts
|
|
259
|
+
var U = {
|
|
260
|
+
title: "",
|
|
261
|
+
description: "",
|
|
262
|
+
banner: "",
|
|
263
|
+
layout: "vertical",
|
|
264
|
+
card: !0,
|
|
265
|
+
flat: !1,
|
|
266
|
+
fullWidth: !1,
|
|
267
|
+
submitLabel: "Vergelijken",
|
|
268
|
+
submitDisabled: !1
|
|
269
|
+
}, re = Object.keys(U);
|
|
270
|
+
function ie(e) {
|
|
271
|
+
return w(e, ...re);
|
|
272
|
+
}
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region \0plugin-vue:export-helper
|
|
275
|
+
var W = (e, t) => {
|
|
276
|
+
let n = e.__vccOpts || e;
|
|
277
|
+
for (let [e, r] of t) n[e] = r;
|
|
278
|
+
return n;
|
|
279
|
+
}, G = {}, K = { class: "vd-form__row" };
|
|
280
|
+
function q(e, t) {
|
|
281
|
+
return p(), r("div", K, [g(e.$slots, "default")]);
|
|
282
|
+
}
|
|
283
|
+
var J = /*#__PURE__*/ W(G, [["render", q]]), Y = /* @__PURE__ */ s({
|
|
284
|
+
__name: "VdFormCol",
|
|
285
|
+
props: {
|
|
286
|
+
span: { default: null },
|
|
287
|
+
md: { default: null },
|
|
288
|
+
ratio: { default: null }
|
|
289
|
+
},
|
|
290
|
+
setup(t) {
|
|
291
|
+
let n = t, i = e(() => [
|
|
292
|
+
n.span == null ? null : `vd-form__col-${n.span}`,
|
|
293
|
+
n.md == null ? null : `vd-form__col-md-${n.md}`,
|
|
294
|
+
n.ratio == null ? null : `vd-form__ratio-${n.ratio}`
|
|
295
|
+
]);
|
|
296
|
+
return (e, t) => (p(), r("div", { class: f(i.value) }, [g(e.$slots, "default")], 2));
|
|
297
|
+
}
|
|
298
|
+
}), ae = {
|
|
299
|
+
key: 0,
|
|
300
|
+
class: "vd-form__banner"
|
|
301
|
+
}, oe = ["innerHTML"], se = {
|
|
302
|
+
key: 1,
|
|
303
|
+
class: "vd-form__header"
|
|
304
|
+
}, ce = {
|
|
305
|
+
key: 0,
|
|
306
|
+
class: "vd-form__title"
|
|
307
|
+
}, le = {
|
|
308
|
+
key: 1,
|
|
309
|
+
class: "vd-form__description"
|
|
310
|
+
}, ue = /* @__PURE__ */ s({
|
|
311
|
+
__name: "VdComparisonForm",
|
|
312
|
+
props: /*@__PURE__*/ l({
|
|
313
|
+
actionSpan: {},
|
|
314
|
+
actionMd: {},
|
|
315
|
+
title: {},
|
|
316
|
+
description: {},
|
|
317
|
+
banner: {},
|
|
318
|
+
layout: {},
|
|
319
|
+
card: { type: Boolean },
|
|
320
|
+
flat: { type: Boolean },
|
|
321
|
+
fullWidth: { type: Boolean },
|
|
322
|
+
submitLabel: {},
|
|
323
|
+
submitDisabled: { type: Boolean }
|
|
324
|
+
}, {
|
|
325
|
+
...U,
|
|
326
|
+
actionSpan: 2,
|
|
327
|
+
actionMd: null
|
|
328
|
+
}),
|
|
329
|
+
emits: ["submit"],
|
|
330
|
+
setup(t, { emit: a }) {
|
|
331
|
+
let s = t, c = a, l = b(), u = e(() => [
|
|
332
|
+
"vd-form",
|
|
333
|
+
`vd-form--${s.layout}`,
|
|
334
|
+
{ "vd-form--card": s.card },
|
|
335
|
+
{ "vd-form--flat": s.flat },
|
|
336
|
+
{ "vd-form--full-width": s.fullWidth }
|
|
337
|
+
]), d = (e) => {
|
|
338
|
+
c("submit", e);
|
|
339
|
+
};
|
|
340
|
+
return (e, a) => (p(), r("form", {
|
|
341
|
+
class: f(u.value),
|
|
342
|
+
onSubmit: S(d, ["prevent", "stop"])
|
|
343
|
+
}, [
|
|
344
|
+
y(l).banner || t.banner ? (p(), r("div", ae, [g(e.$slots, "banner", {}, () => [i("span", { innerHTML: t.banner }, null, 8, oe)])])) : n("", !0),
|
|
345
|
+
y(l).header || t.title || t.description ? (p(), r("div", se, [g(e.$slots, "header", {}, () => [t.title ? (p(), r("h2", ce, v(t.title), 1)) : n("", !0), t.description ? (p(), r("p", le, v(t.description), 1)) : n("", !0)])])) : n("", !0),
|
|
346
|
+
o(J, null, {
|
|
347
|
+
default: x(() => [g(e.$slots, "default"), o(Y, {
|
|
348
|
+
class: "vd-form__action",
|
|
349
|
+
span: t.actionSpan,
|
|
350
|
+
md: t.actionMd
|
|
351
|
+
}, {
|
|
352
|
+
default: x(() => [g(e.$slots, "action", {}, () => [o(D, {
|
|
353
|
+
type: "submit",
|
|
354
|
+
label: t.submitLabel,
|
|
355
|
+
"button-type": "green",
|
|
356
|
+
size: "big",
|
|
357
|
+
block: "",
|
|
358
|
+
disabled: t.submitDisabled,
|
|
359
|
+
icon: "fas fa-chevron-right"
|
|
360
|
+
}, null, 8, ["label", "disabled"])])]),
|
|
361
|
+
_: 3
|
|
362
|
+
}, 8, ["span", "md"])]),
|
|
363
|
+
_: 3
|
|
364
|
+
})
|
|
365
|
+
], 34));
|
|
366
|
+
}
|
|
367
|
+
}), de = (e) => e.replace(/\["(\d+)"\]/g, "[$1]"), X = (e, t) => `${e}${t}`, fe = (e) => (e.inner || []).reduce((e, t) => {
|
|
368
|
+
let n = de(t.path);
|
|
369
|
+
return e[n] || (e[n] = t.message), e;
|
|
370
|
+
}, {}), Z = (e) => {
|
|
371
|
+
if (!e.inner) throw e;
|
|
372
|
+
return fe(e);
|
|
373
|
+
}, Q = { isValidating: !1 }, pe = {
|
|
374
|
+
validateAt: "blur",
|
|
375
|
+
strict: !0,
|
|
376
|
+
abortEarly: !1
|
|
377
|
+
}, $ = Symbol("useValidator"), me = (t, n, r) => {
|
|
378
|
+
let i = {
|
|
379
|
+
...pe,
|
|
380
|
+
...r
|
|
381
|
+
}, a = C(n), o = h(C(a)), s = h({}), c = h(!1), l = h(!1), u = h({}), f = (t) => e({
|
|
382
|
+
get: () => b(t),
|
|
383
|
+
set: (e) => x(t, e)
|
|
384
|
+
}), p = (t, n) => e(() => ({
|
|
385
|
+
onBlur: () => S(t, n),
|
|
386
|
+
onChange: () => w(t, n),
|
|
387
|
+
onInput: () => T(t, n)
|
|
388
|
+
})), g = (t) => e(() => F(t)), _ = (t) => e(() => ({
|
|
389
|
+
isValid: !F(t),
|
|
390
|
+
isValidating: u.value[t]?.isValidating ?? !1
|
|
391
|
+
})), v = (e, t) => {
|
|
392
|
+
let n = t && "value" in t ? t.value : P(a, e), r = { isValidating: t?.isValidating ?? !1 }, i = t?.error ?? "";
|
|
393
|
+
x(e, C(n)), y(e, r), i ? N({ [e]: i }) : I(e);
|
|
394
|
+
}, y = (e, t) => {
|
|
395
|
+
u.value[e] = {
|
|
396
|
+
...u.value[e],
|
|
397
|
+
...t
|
|
398
|
+
};
|
|
399
|
+
}, b = (e) => P(o.value, e), x = (e, t) => {
|
|
400
|
+
ne(o.value, e, t);
|
|
401
|
+
}, S = (e, t) => {
|
|
402
|
+
t === "blur" && M(e);
|
|
403
|
+
}, w = (e, t) => {
|
|
404
|
+
t === "change" && d(() => M(e));
|
|
405
|
+
}, T = (e, t) => {
|
|
406
|
+
t === "input" && d(() => M(e));
|
|
407
|
+
}, E = (e, t) => {
|
|
408
|
+
let n = t?.validateAt ?? i.validateAt;
|
|
409
|
+
return y(e, Q), [
|
|
410
|
+
f(e),
|
|
411
|
+
p(e, n),
|
|
412
|
+
g(e),
|
|
413
|
+
_(e)
|
|
414
|
+
];
|
|
415
|
+
}, D = (e) => {
|
|
416
|
+
let t = f(e), n = (t, n) => {
|
|
417
|
+
let r = n?.validateAt ?? i.validateAt, a = X(e, t);
|
|
418
|
+
return p(a, r).value;
|
|
419
|
+
}, r = (t) => {
|
|
420
|
+
let n = X(e, t);
|
|
421
|
+
return F(n);
|
|
422
|
+
};
|
|
423
|
+
return {
|
|
424
|
+
fields: t,
|
|
425
|
+
getAttrs: n,
|
|
426
|
+
getError: r,
|
|
427
|
+
getMeta: (t) => {
|
|
428
|
+
let n = X(e, t);
|
|
429
|
+
return _(n);
|
|
430
|
+
},
|
|
431
|
+
arrayError: r(e),
|
|
432
|
+
push: (n, r = 1) => {
|
|
433
|
+
if (!t.value) {
|
|
434
|
+
console.warn(`Fields at path "${e}" is not initialized`);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
for (let e = 0; e < r; e++) t.value.push(C(n));
|
|
438
|
+
I(e);
|
|
439
|
+
},
|
|
440
|
+
pop: (n = 1) => {
|
|
441
|
+
if (!t.value?.length) return [];
|
|
442
|
+
let r = Math.min(n, t.value.length), i = t.value.splice(-r);
|
|
443
|
+
return O(e, t.value.length, r), i;
|
|
444
|
+
},
|
|
445
|
+
clear: () => {
|
|
446
|
+
t.value && (t.value = [], k(e));
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}, O = (e, t, n) => {
|
|
450
|
+
for (let r = t; r < t + n; r++) Object.keys(s.value).forEach((t) => {
|
|
451
|
+
t.includes(`${e}[${r}]`) && I(t);
|
|
452
|
+
});
|
|
453
|
+
}, k = (e) => {
|
|
454
|
+
Object.keys(s.value).forEach((t) => {
|
|
455
|
+
t.startsWith(e) && I(t);
|
|
456
|
+
});
|
|
457
|
+
}, A = async (e, t) => {
|
|
458
|
+
B(!0);
|
|
459
|
+
try {
|
|
460
|
+
let n = await j();
|
|
461
|
+
if (n && typeof e == "function") return await e(n);
|
|
462
|
+
if (!n && typeof t == "function") return await t();
|
|
463
|
+
} catch (e) {
|
|
464
|
+
console.error(e);
|
|
465
|
+
} finally {
|
|
466
|
+
B(!1);
|
|
467
|
+
}
|
|
468
|
+
}, j = async () => {
|
|
469
|
+
z(!0), R();
|
|
470
|
+
try {
|
|
471
|
+
return await t.validate(o.value, {
|
|
472
|
+
strict: i.strict,
|
|
473
|
+
abortEarly: i.abortEarly
|
|
474
|
+
}), o.value;
|
|
475
|
+
} catch (e) {
|
|
476
|
+
let t = Z(e);
|
|
477
|
+
N(t);
|
|
478
|
+
return;
|
|
479
|
+
} finally {
|
|
480
|
+
z(!1);
|
|
481
|
+
}
|
|
482
|
+
}, M = async (e) => {
|
|
483
|
+
y(e, { isValidating: !0 }), L(e);
|
|
484
|
+
try {
|
|
485
|
+
await t.validateAt(e, o.value, {
|
|
486
|
+
strict: i.strict,
|
|
487
|
+
abortEarly: i.abortEarly
|
|
488
|
+
});
|
|
489
|
+
} catch (e) {
|
|
490
|
+
let t = Z(e);
|
|
491
|
+
N(t);
|
|
492
|
+
} finally {
|
|
493
|
+
y(e, { isValidating: !1 });
|
|
494
|
+
}
|
|
495
|
+
}, N = (e) => {
|
|
496
|
+
Object.assign(s.value, e);
|
|
497
|
+
}, F = (e) => s.value[e], I = (e) => {
|
|
498
|
+
delete s.value[e];
|
|
499
|
+
}, L = (e) => {
|
|
500
|
+
Object.keys(s.value).forEach((t) => {
|
|
501
|
+
(t === e || t.startsWith(`${e}.`) || t.startsWith(`${e}[`)) && I(t);
|
|
502
|
+
});
|
|
503
|
+
}, R = () => {
|
|
504
|
+
s.value = {};
|
|
505
|
+
}, z = (e) => {
|
|
506
|
+
l.value = e;
|
|
507
|
+
}, B = (e) => {
|
|
508
|
+
c.value = e;
|
|
509
|
+
}, V = {
|
|
510
|
+
formData: o,
|
|
511
|
+
errors: e(() => s.value),
|
|
512
|
+
isValid: e(() => Object.keys(s.value).length === 0),
|
|
513
|
+
isSubmitting: e(() => c.value),
|
|
514
|
+
isValidating: e(() => l.value),
|
|
515
|
+
handleSubmit: A,
|
|
516
|
+
defineField: E,
|
|
517
|
+
defineArray: D,
|
|
518
|
+
getFieldMeta: _,
|
|
519
|
+
resetField: v,
|
|
520
|
+
setErrors: N,
|
|
521
|
+
setFieldMeta: y,
|
|
522
|
+
getError: F,
|
|
523
|
+
removeError: I,
|
|
524
|
+
resetErrors: R,
|
|
525
|
+
validateForm: j,
|
|
526
|
+
validateField: M
|
|
527
|
+
};
|
|
528
|
+
return m($, V), V;
|
|
529
|
+
}, he = () => {
|
|
530
|
+
let e = c($);
|
|
531
|
+
if (!e) throw Error("useValidatorContext must be used within a component that has called useValidator");
|
|
532
|
+
return e;
|
|
533
|
+
};
|
|
534
|
+
//#endregion
|
|
535
|
+
export { J as a, P as c, Y as i, D as l, he as n, U as o, ue as r, ie as s, me as t, T as u };
|