@macrulez/vue-form-schema 0.1.7 → 0.2.0
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/LICENSE +21 -0
- package/README.md +461 -180
- package/dist/MaskEngine-BEXwX4BK.js +144 -0
- package/dist/MaskEngine-CPr-fSPy.cjs +1 -0
- package/dist/ValidationEngine-BC4U1ef1.js +135 -0
- package/dist/ValidationEngine-Diz-qTFs.cjs +1 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/core/ConditionEvaluator.d.ts.map +1 -1
- package/dist/core/MaskEngine.d.ts.map +1 -1
- package/dist/core/ValidationEngine.d.ts +13 -0
- package/dist/core/ValidationEngine.d.ts.map +1 -1
- package/dist/core/formRegistry.d.ts +33 -0
- package/dist/core/formRegistry.d.ts.map +1 -0
- package/dist/core/inferTypes.d.ts.map +1 -1
- package/dist/core/schemaUtils.d.ts +38 -0
- package/dist/core/schemaUtils.d.ts.map +1 -1
- package/dist/core/serverErrors.d.ts +69 -0
- package/dist/core/serverErrors.d.ts.map +1 -0
- package/dist/core/types.d.ts +22 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/useForm.d.ts +4 -1
- package/dist/core/useForm.d.ts.map +1 -1
- package/dist/core/useMultiStepForm.d.ts.map +1 -1
- package/dist/devtools/index.d.ts +26 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools.cjs +1 -0
- package/dist/devtools.d.ts +6 -0
- package/dist/devtools.js +93 -0
- package/dist/formRegistry-Bv1eaWQ-.js +31 -0
- package/dist/formRegistry-DaDmXyYY.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +392 -359
- package/dist/openapi.cjs +1 -0
- package/dist/openapi.d.ts +202 -0
- package/dist/openapi.js +118 -0
- package/dist/parsers/json.d.ts.map +1 -1
- package/dist/parsers/openapi.d.ts +139 -0
- package/dist/parsers/openapi.d.ts.map +1 -0
- package/dist/parsers/valibot.d.ts +13 -4
- package/dist/parsers/valibot.d.ts.map +1 -1
- package/dist/parsers/yup.d.ts +10 -4
- package/dist/parsers/yup.d.ts.map +1 -1
- package/dist/parsers/zod.d.ts +18 -4
- package/dist/parsers/zod.d.ts.map +1 -1
- package/dist/schemaUtils-Cc7CwGXB.cjs +1 -0
- package/dist/schemaUtils-Cvlsk24U.js +337 -0
- package/dist/style.css +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/naive/index.d.ts +11 -0
- package/dist/ui/naive/index.d.ts.map +1 -0
- package/dist/ui/primevue/index.d.ts +11 -0
- package/dist/ui/primevue/index.d.ts.map +1 -0
- package/dist/ui/shadcn/index.d.ts +11 -0
- package/dist/ui/shadcn/index.d.ts.map +1 -0
- package/dist/ui/tailwind/index.d.ts +11 -0
- package/dist/ui/tailwind/index.d.ts.map +1 -0
- package/dist/ui-naive.cjs +1 -0
- package/dist/ui-naive.d.ts +411 -0
- package/dist/ui-naive.js +667 -0
- package/dist/ui-primevue.cjs +1 -0
- package/dist/ui-primevue.d.ts +411 -0
- package/dist/ui-primevue.js +651 -0
- package/dist/ui-shadcn.cjs +1 -0
- package/dist/ui-shadcn.d.ts +411 -0
- package/dist/ui-shadcn.js +650 -0
- package/dist/ui-tailwind.cjs +1 -0
- package/dist/ui-tailwind.d.ts +411 -0
- package/dist/ui-tailwind.js +669 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +61 -10
- package/dist/ui.js +434 -299
- package/dist/valibot.cjs +1 -1
- package/dist/valibot.d.ts +35 -4
- package/dist/valibot.js +47 -20
- package/dist/yup.cjs +1 -1
- package/dist/yup.d.ts +33 -5
- package/dist/yup.js +16 -15
- package/dist/zod.cjs +1 -1
- package/dist/zod.d.ts +41 -5
- package/dist/zod.js +58 -28
- package/package.json +99 -25
- package/dist/MaskEngine-BqJQYybS.js +0 -233
- package/dist/MaskEngine-BwAs2Zb0.cjs +0 -1
- package/dist/__tests__/ConditionEvaluator.test.d.ts +0 -2
- package/dist/__tests__/ConditionEvaluator.test.d.ts.map +0 -1
- package/dist/__tests__/MaskEngine.test.d.ts +0 -2
- package/dist/__tests__/MaskEngine.test.d.ts.map +0 -1
- package/dist/__tests__/ValidationEngine.test.d.ts +0 -2
- package/dist/__tests__/ValidationEngine.test.d.ts.map +0 -1
- package/dist/__tests__/parsers.test.d.ts +0 -2
- package/dist/__tests__/parsers.test.d.ts.map +0 -1
- package/dist/__tests__/phase3.test.d.ts +0 -2
- package/dist/__tests__/phase3.test.d.ts.map +0 -1
- package/dist/__tests__/phase4.test.d.ts +0 -2
- package/dist/__tests__/phase4.test.d.ts.map +0 -1
- package/dist/__tests__/useFieldArray.test.d.ts +0 -2
- package/dist/__tests__/useFieldArray.test.d.ts.map +0 -1
- package/dist/__tests__/useForm.test.d.ts +0 -2
- package/dist/__tests__/useForm.test.d.ts.map +0 -1
- package/dist/__tests__/useMultiStepForm.test.d.ts +0 -2
- package/dist/__tests__/useMultiStepForm.test.d.ts.map +0 -1
package/dist/ui.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { b as
|
|
3
|
-
|
|
1
|
+
import { defineComponent as V, computed as B, openBlock as t, createElementBlock as n, normalizeClass as T, createTextVNode as I, toDisplayString as y, createCommentVNode as k, renderSlot as A, normalizeProps as W, guardReactiveProps as X, Fragment as x, renderList as S, ref as w, onMounted as Y, onUnmounted as Z, createBlock as F, withCtx as q, createElementVNode as b, mergeProps as R, createVNode as M, unref as z, resolveDynamicComponent as U, resolveComponent as _, createSlots as ee } from "vue";
|
|
2
|
+
import { b as te, d as P, u as le } from "./MaskEngine-BEXwX4BK.js";
|
|
3
|
+
import { g as K } from "./ValidationEngine-BC4U1ef1.js";
|
|
4
|
+
const ae = ["for"], re = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "vfs-field__required",
|
|
6
7
|
"aria-hidden": "true"
|
|
7
|
-
},
|
|
8
|
+
}, ne = ["id"], C = /* @__PURE__ */ V({
|
|
8
9
|
__name: "BaseField",
|
|
9
10
|
props: {
|
|
10
11
|
field: {},
|
|
@@ -12,37 +13,41 @@ const _ = ["for"], ee = {
|
|
|
12
13
|
touched: { type: Boolean }
|
|
13
14
|
},
|
|
14
15
|
setup(e) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const o = e, l = B(() => {
|
|
17
|
+
var d;
|
|
18
|
+
return !!(o.touched && ((d = o.error) != null && d.length));
|
|
19
|
+
}), s = B(() => `${o.field.name}-error`), a = B(() => ({
|
|
20
|
+
"aria-required": o.field.required ? "true" : void 0,
|
|
21
|
+
"aria-invalid": l.value ? "true" : "false",
|
|
22
|
+
"aria-describedby": l.value ? s.value : void 0
|
|
23
|
+
}));
|
|
24
|
+
return (d, m) => (t(), n("div", {
|
|
25
|
+
class: T(["vfs-field", [`vfs-field--${o.field.type}`, { "vfs-field--error": l.value }]])
|
|
26
|
+
}, [
|
|
27
|
+
o.field.label ? (t(), n("label", {
|
|
28
|
+
key: 0,
|
|
29
|
+
for: o.field.name,
|
|
30
|
+
class: "vfs-field__label"
|
|
20
31
|
}, [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
key: m,
|
|
39
|
-
class: "vfs-field__error"
|
|
40
|
-
}, v(h), 1))), 128))
|
|
41
|
-
], 8, te)) : k("", !0)
|
|
42
|
-
], 2);
|
|
43
|
-
};
|
|
32
|
+
I(y(o.field.label) + " ", 1),
|
|
33
|
+
o.field.required ? (t(), n("span", re, "*")) : k("", !0)
|
|
34
|
+
], 8, ae)) : k("", !0),
|
|
35
|
+
A(d.$slots, "default", W(X(a.value))),
|
|
36
|
+
l.value ? (t(), n("ul", {
|
|
37
|
+
key: 1,
|
|
38
|
+
id: s.value,
|
|
39
|
+
class: "vfs-field__errors",
|
|
40
|
+
role: "alert",
|
|
41
|
+
"aria-live": "polite"
|
|
42
|
+
}, [
|
|
43
|
+
(t(!0), n(x, null, S(e.error, (f, h) => (t(), n("li", {
|
|
44
|
+
key: h,
|
|
45
|
+
class: "vfs-field__error"
|
|
46
|
+
}, y(f), 1))), 128))
|
|
47
|
+
], 8, ne)) : k("", !0)
|
|
48
|
+
], 2));
|
|
44
49
|
}
|
|
45
|
-
}),
|
|
50
|
+
}), oe = ["id", "type", "name", "value", "placeholder", "disabled", "required"], N = /* @__PURE__ */ V({
|
|
46
51
|
__name: "TextField",
|
|
47
52
|
props: {
|
|
48
53
|
field: {},
|
|
@@ -51,40 +56,41 @@ const _ = ["for"], ee = {
|
|
|
51
56
|
touched: { type: Boolean }
|
|
52
57
|
},
|
|
53
58
|
emits: ["update:modelValue", "blur"],
|
|
54
|
-
setup(e, { emit:
|
|
55
|
-
const
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}),
|
|
60
|
-
function
|
|
61
|
-
s("update:modelValue",
|
|
59
|
+
setup(e, { emit: o }) {
|
|
60
|
+
const l = e, s = o, a = w(null);
|
|
61
|
+
let d = null;
|
|
62
|
+
Y(() => {
|
|
63
|
+
a.value && l.field.mask && (d = te(a.value, l.field.mask));
|
|
64
|
+
}), Z(() => d == null ? void 0 : d());
|
|
65
|
+
function m(f) {
|
|
66
|
+
s("update:modelValue", f.target.value);
|
|
62
67
|
}
|
|
63
|
-
return (
|
|
68
|
+
return (f, h) => (t(), F(C, {
|
|
64
69
|
field: e.field,
|
|
65
70
|
error: e.error,
|
|
66
71
|
touched: e.touched
|
|
67
72
|
}, {
|
|
68
|
-
default:
|
|
69
|
-
b("input", {
|
|
73
|
+
default: q((c) => [
|
|
74
|
+
b("input", R({
|
|
70
75
|
id: e.field.name,
|
|
71
76
|
ref_key: "inputRef",
|
|
72
|
-
ref:
|
|
77
|
+
ref: a,
|
|
73
78
|
type: e.field.type === "email" ? "email" : "text",
|
|
74
79
|
name: e.field.name,
|
|
75
|
-
value: e.modelValue,
|
|
80
|
+
value: e.modelValue ?? "",
|
|
76
81
|
placeholder: e.field.placeholder,
|
|
77
82
|
disabled: e.field.disabled === !0,
|
|
78
|
-
required: e.field.required
|
|
83
|
+
required: e.field.required
|
|
84
|
+
}, c, {
|
|
79
85
|
class: "vfs-input",
|
|
80
|
-
onInput:
|
|
81
|
-
onBlur:
|
|
82
|
-
}, null,
|
|
86
|
+
onInput: m,
|
|
87
|
+
onBlur: h[0] || (h[0] = (g) => s("blur"))
|
|
88
|
+
}), null, 16, oe)
|
|
83
89
|
]),
|
|
84
90
|
_: 1
|
|
85
91
|
}, 8, ["field", "error", "touched"]));
|
|
86
92
|
}
|
|
87
|
-
}),
|
|
93
|
+
}), ie = ["id", "name", "value", "placeholder", "disabled", "required"], O = /* @__PURE__ */ V({
|
|
88
94
|
__name: "NumberField",
|
|
89
95
|
props: {
|
|
90
96
|
field: {},
|
|
@@ -93,35 +99,36 @@ const _ = ["for"], ee = {
|
|
|
93
99
|
touched: { type: Boolean }
|
|
94
100
|
},
|
|
95
101
|
emits: ["update:modelValue", "blur"],
|
|
96
|
-
setup(e, { emit:
|
|
97
|
-
const
|
|
98
|
-
function s(
|
|
99
|
-
const
|
|
100
|
-
|
|
102
|
+
setup(e, { emit: o }) {
|
|
103
|
+
const l = o;
|
|
104
|
+
function s(a) {
|
|
105
|
+
const d = a.target.value;
|
|
106
|
+
l("update:modelValue", d === "" ? null : Number(d));
|
|
101
107
|
}
|
|
102
|
-
return (
|
|
108
|
+
return (a, d) => (t(), F(C, {
|
|
103
109
|
field: e.field,
|
|
104
110
|
error: e.error,
|
|
105
111
|
touched: e.touched
|
|
106
112
|
}, {
|
|
107
|
-
default:
|
|
108
|
-
b("input", {
|
|
113
|
+
default: q((m) => [
|
|
114
|
+
b("input", R({
|
|
109
115
|
id: e.field.name,
|
|
110
116
|
type: "number",
|
|
111
117
|
name: e.field.name,
|
|
112
118
|
value: e.modelValue ?? "",
|
|
113
119
|
placeholder: e.field.placeholder,
|
|
114
120
|
disabled: e.field.disabled === !0,
|
|
115
|
-
required: e.field.required
|
|
121
|
+
required: e.field.required
|
|
122
|
+
}, m, {
|
|
116
123
|
class: "vfs-input",
|
|
117
124
|
onInput: s,
|
|
118
|
-
onBlur:
|
|
119
|
-
}, null,
|
|
125
|
+
onBlur: d[0] || (d[0] = (f) => l("blur"))
|
|
126
|
+
}), null, 16, ie)
|
|
120
127
|
]),
|
|
121
128
|
_: 1
|
|
122
129
|
}, 8, ["field", "error", "touched"]));
|
|
123
130
|
}
|
|
124
|
-
}),
|
|
131
|
+
}), ue = ["id", "name", "value", "placeholder", "disabled", "required"], j = /* @__PURE__ */ V({
|
|
125
132
|
__name: "TextareaField",
|
|
126
133
|
props: {
|
|
127
134
|
field: {},
|
|
@@ -130,33 +137,34 @@ const _ = ["for"], ee = {
|
|
|
130
137
|
touched: { type: Boolean }
|
|
131
138
|
},
|
|
132
139
|
emits: ["update:modelValue", "blur"],
|
|
133
|
-
setup(e, { emit:
|
|
134
|
-
const
|
|
135
|
-
return (s,
|
|
140
|
+
setup(e, { emit: o }) {
|
|
141
|
+
const l = o;
|
|
142
|
+
return (s, a) => (t(), F(C, {
|
|
136
143
|
field: e.field,
|
|
137
144
|
error: e.error,
|
|
138
145
|
touched: e.touched
|
|
139
146
|
}, {
|
|
140
|
-
default:
|
|
141
|
-
b("textarea", {
|
|
147
|
+
default: q((d) => [
|
|
148
|
+
b("textarea", R({
|
|
142
149
|
id: e.field.name,
|
|
143
150
|
name: e.field.name,
|
|
144
|
-
value: e.modelValue,
|
|
151
|
+
value: e.modelValue ?? "",
|
|
145
152
|
placeholder: e.field.placeholder,
|
|
146
153
|
disabled: e.field.disabled === !0,
|
|
147
|
-
required: e.field.required
|
|
154
|
+
required: e.field.required
|
|
155
|
+
}, d, {
|
|
148
156
|
class: "vfs-textarea",
|
|
149
|
-
onInput:
|
|
150
|
-
onBlur:
|
|
151
|
-
}, null,
|
|
157
|
+
onInput: a[0] || (a[0] = (m) => l("update:modelValue", m.target.value)),
|
|
158
|
+
onBlur: a[1] || (a[1] = (m) => l("blur"))
|
|
159
|
+
}), null, 16, ue)
|
|
152
160
|
]),
|
|
153
161
|
_: 1
|
|
154
162
|
}, 8, ["field", "error", "touched"]));
|
|
155
163
|
}
|
|
156
|
-
}),
|
|
164
|
+
}), de = {
|
|
157
165
|
key: 0,
|
|
158
166
|
class: "vfs-select-loading"
|
|
159
|
-
},
|
|
167
|
+
}, se = ["id", "name", "disabled", "required"], ce = ["selected"], me = ["value", "selected"], G = /* @__PURE__ */ V({
|
|
160
168
|
__name: "SelectField",
|
|
161
169
|
props: {
|
|
162
170
|
field: {},
|
|
@@ -165,84 +173,92 @@ const _ = ["for"], ee = {
|
|
|
165
173
|
touched: { type: Boolean }
|
|
166
174
|
},
|
|
167
175
|
emits: ["update:modelValue", "blur"],
|
|
168
|
-
setup(e, { emit:
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const m = h.target, i = n.value.find(($) => String($.value) === m.value);
|
|
174
|
-
s("update:modelValue", (i == null ? void 0 : i.value) ?? m.value);
|
|
176
|
+
setup(e, { emit: o }) {
|
|
177
|
+
const l = e, s = o, a = B(() => Array.isArray(l.field.options) ? l.field.options : []);
|
|
178
|
+
function d(m) {
|
|
179
|
+
const f = m.target, h = a.value.find((c) => String(c.value) === f.value);
|
|
180
|
+
s("update:modelValue", (h == null ? void 0 : h.value) ?? f.value);
|
|
175
181
|
}
|
|
176
|
-
return (
|
|
182
|
+
return (m, f) => (t(), F(C, {
|
|
177
183
|
field: e.field,
|
|
178
184
|
error: e.error,
|
|
179
185
|
touched: e.touched
|
|
180
186
|
}, {
|
|
181
|
-
default:
|
|
182
|
-
e.field.optionsLoading ? (t(),
|
|
187
|
+
default: q((h) => [
|
|
188
|
+
e.field.optionsLoading ? (t(), n("div", de, "Loading…")) : (t(), n("select", R({
|
|
183
189
|
key: 1,
|
|
184
190
|
id: e.field.name,
|
|
185
191
|
name: e.field.name,
|
|
186
192
|
disabled: e.field.disabled === !0 || e.field.optionsLoading,
|
|
187
|
-
required: e.field.required
|
|
193
|
+
required: e.field.required
|
|
194
|
+
}, h, {
|
|
188
195
|
class: "vfs-select",
|
|
189
|
-
onChange:
|
|
190
|
-
onBlur:
|
|
191
|
-
}, [
|
|
196
|
+
onChange: d,
|
|
197
|
+
onBlur: f[0] || (f[0] = (c) => s("blur"))
|
|
198
|
+
}), [
|
|
192
199
|
b("option", {
|
|
193
200
|
value: "",
|
|
194
201
|
disabled: "",
|
|
195
202
|
selected: e.modelValue === null || e.modelValue === void 0 || e.modelValue === ""
|
|
196
|
-
},
|
|
197
|
-
(t(!0),
|
|
198
|
-
key: String(
|
|
199
|
-
value: String(
|
|
200
|
-
selected: e.modelValue ===
|
|
201
|
-
},
|
|
202
|
-
],
|
|
203
|
+
}, y(e.field.placeholder ?? "Select an option"), 9, ce),
|
|
204
|
+
(t(!0), n(x, null, S(a.value, (c) => (t(), n("option", {
|
|
205
|
+
key: String(c.value),
|
|
206
|
+
value: String(c.value),
|
|
207
|
+
selected: e.modelValue === c.value
|
|
208
|
+
}, y(c.label), 9, me))), 128))
|
|
209
|
+
], 16, se))
|
|
203
210
|
]),
|
|
204
211
|
_: 1
|
|
205
212
|
}, 8, ["field", "error", "touched"]));
|
|
206
213
|
}
|
|
207
|
-
}),
|
|
214
|
+
}), fe = { class: "vfs-checkbox-label" }, ve = ["id", "name", "checked", "disabled", "required", "aria-checked"], be = {
|
|
208
215
|
key: 0,
|
|
209
216
|
class: "vfs-checkbox-text"
|
|
210
|
-
},
|
|
217
|
+
}, H = /* @__PURE__ */ V({
|
|
211
218
|
__name: "CheckboxField",
|
|
212
219
|
props: {
|
|
213
220
|
field: {},
|
|
214
|
-
modelValue: { type: Boolean },
|
|
221
|
+
modelValue: { type: [Boolean, null] },
|
|
215
222
|
error: {},
|
|
216
223
|
touched: { type: Boolean }
|
|
217
224
|
},
|
|
218
225
|
emits: ["update:modelValue", "blur"],
|
|
219
|
-
setup(e, { emit:
|
|
220
|
-
const
|
|
221
|
-
return (s,
|
|
226
|
+
setup(e, { emit: o }) {
|
|
227
|
+
const l = o;
|
|
228
|
+
return (s, a) => (t(), F(C, {
|
|
222
229
|
field: { ...e.field, label: void 0 },
|
|
223
230
|
error: e.error,
|
|
224
231
|
touched: e.touched
|
|
225
232
|
}, {
|
|
226
|
-
default:
|
|
227
|
-
b("label",
|
|
228
|
-
b("input", {
|
|
233
|
+
default: q((d) => [
|
|
234
|
+
b("label", fe, [
|
|
235
|
+
b("input", R({
|
|
229
236
|
id: e.field.name,
|
|
230
237
|
type: "checkbox",
|
|
231
238
|
name: e.field.name,
|
|
232
|
-
checked: e.modelValue,
|
|
239
|
+
checked: !!e.modelValue,
|
|
233
240
|
disabled: e.field.disabled === !0,
|
|
234
241
|
required: e.field.required,
|
|
242
|
+
"aria-checked": e.modelValue ? "true" : "false"
|
|
243
|
+
}, d, {
|
|
235
244
|
class: "vfs-checkbox",
|
|
236
|
-
onChange:
|
|
237
|
-
onBlur:
|
|
238
|
-
}, null,
|
|
239
|
-
e.field.label ? (t(),
|
|
245
|
+
onChange: a[0] || (a[0] = (m) => l("update:modelValue", m.target.checked)),
|
|
246
|
+
onBlur: a[1] || (a[1] = (m) => l("blur"))
|
|
247
|
+
}), null, 16, ve),
|
|
248
|
+
e.field.label ? (t(), n("span", be, y(e.field.label), 1)) : k("", !0)
|
|
240
249
|
])
|
|
241
250
|
]),
|
|
242
251
|
_: 1
|
|
243
252
|
}, 8, ["field", "error", "touched"]));
|
|
244
253
|
}
|
|
245
|
-
}),
|
|
254
|
+
}), he = ["aria-required", "aria-invalid", "aria-describedby"], ye = {
|
|
255
|
+
key: 0,
|
|
256
|
+
class: "vfs-field__label"
|
|
257
|
+
}, $e = {
|
|
258
|
+
key: 0,
|
|
259
|
+
class: "vfs-field__required",
|
|
260
|
+
"aria-hidden": "true"
|
|
261
|
+
}, ke = { class: "vfs-radio-group" }, ge = ["name", "value", "checked", "disabled", "onChange"], Ve = ["id"], J = /* @__PURE__ */ V({
|
|
246
262
|
__name: "RadioField",
|
|
247
263
|
props: {
|
|
248
264
|
field: {},
|
|
@@ -251,41 +267,54 @@ const _ = ["for"], ee = {
|
|
|
251
267
|
touched: { type: Boolean }
|
|
252
268
|
},
|
|
253
269
|
emits: ["update:modelValue", "blur"],
|
|
254
|
-
setup(e, { emit:
|
|
255
|
-
const a =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
setup(e, { emit: o }) {
|
|
271
|
+
const l = e, s = o, a = B(() => {
|
|
272
|
+
var f;
|
|
273
|
+
return !!(l.touched && ((f = l.error) != null && f.length));
|
|
274
|
+
}), d = B(() => `${l.field.name}-error`), m = B(() => Array.isArray(l.field.options) ? l.field.options : []);
|
|
275
|
+
return (f, h) => (t(), n("fieldset", {
|
|
276
|
+
class: T(["vfs-field vfs-field--radio", { "vfs-field--error": a.value }]),
|
|
277
|
+
"aria-required": e.field.required ? "true" : void 0,
|
|
278
|
+
"aria-invalid": a.value ? "true" : "false",
|
|
279
|
+
"aria-describedby": a.value ? d.value : void 0
|
|
280
|
+
}, [
|
|
281
|
+
e.field.label ? (t(), n("legend", ye, [
|
|
282
|
+
I(y(e.field.label) + " ", 1),
|
|
283
|
+
e.field.required ? (t(), n("span", $e, "*")) : k("", !0)
|
|
284
|
+
])) : k("", !0),
|
|
285
|
+
b("div", ke, [
|
|
286
|
+
(t(!0), n(x, null, S(m.value, (c) => (t(), n("label", {
|
|
287
|
+
key: String(c.value),
|
|
288
|
+
class: "vfs-radio-label"
|
|
266
289
|
}, [
|
|
267
|
-
(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
onBlur: n[0] || (n[0] = (h) => a("blur"))
|
|
280
|
-
}, null, 40, fe),
|
|
281
|
-
D(" " + v(o.label), 1)
|
|
282
|
-
]))), 128))
|
|
283
|
-
], 8, ce)
|
|
290
|
+
b("input", {
|
|
291
|
+
type: "radio",
|
|
292
|
+
name: e.field.name,
|
|
293
|
+
value: String(c.value),
|
|
294
|
+
checked: e.modelValue === c.value,
|
|
295
|
+
disabled: e.field.disabled === !0,
|
|
296
|
+
class: "vfs-radio",
|
|
297
|
+
onChange: (g) => s("update:modelValue", c.value),
|
|
298
|
+
onBlur: h[0] || (h[0] = (g) => s("blur"))
|
|
299
|
+
}, null, 40, ge),
|
|
300
|
+
I(" " + y(c.label), 1)
|
|
301
|
+
]))), 128))
|
|
284
302
|
]),
|
|
285
|
-
|
|
286
|
-
|
|
303
|
+
a.value ? (t(), n("ul", {
|
|
304
|
+
key: 1,
|
|
305
|
+
id: d.value,
|
|
306
|
+
class: "vfs-field__errors",
|
|
307
|
+
role: "alert",
|
|
308
|
+
"aria-live": "polite"
|
|
309
|
+
}, [
|
|
310
|
+
(t(!0), n(x, null, S(e.error, (c, g) => (t(), n("li", {
|
|
311
|
+
key: g,
|
|
312
|
+
class: "vfs-field__error"
|
|
313
|
+
}, y(c), 1))), 128))
|
|
314
|
+
], 8, Ve)) : k("", !0)
|
|
315
|
+
], 10, he));
|
|
287
316
|
}
|
|
288
|
-
}),
|
|
317
|
+
}), pe = ["id", "name", "value", "disabled", "required"], Q = /* @__PURE__ */ V({
|
|
289
318
|
__name: "DateField",
|
|
290
319
|
props: {
|
|
291
320
|
field: {},
|
|
@@ -294,33 +323,34 @@ const _ = ["for"], ee = {
|
|
|
294
323
|
touched: { type: Boolean }
|
|
295
324
|
},
|
|
296
325
|
emits: ["update:modelValue", "blur"],
|
|
297
|
-
setup(e, { emit:
|
|
298
|
-
const
|
|
299
|
-
return (s,
|
|
326
|
+
setup(e, { emit: o }) {
|
|
327
|
+
const l = o;
|
|
328
|
+
return (s, a) => (t(), F(C, {
|
|
300
329
|
field: e.field,
|
|
301
330
|
error: e.error,
|
|
302
331
|
touched: e.touched
|
|
303
332
|
}, {
|
|
304
|
-
default:
|
|
305
|
-
b("input", {
|
|
333
|
+
default: q((d) => [
|
|
334
|
+
b("input", R({
|
|
306
335
|
id: e.field.name,
|
|
307
336
|
type: "date",
|
|
308
337
|
name: e.field.name,
|
|
309
|
-
value: e.modelValue,
|
|
338
|
+
value: e.modelValue ?? "",
|
|
310
339
|
disabled: e.field.disabled === !0,
|
|
311
|
-
required: e.field.required
|
|
340
|
+
required: e.field.required
|
|
341
|
+
}, d, {
|
|
312
342
|
class: "vfs-input",
|
|
313
|
-
onInput:
|
|
314
|
-
onBlur:
|
|
315
|
-
}, null,
|
|
343
|
+
onInput: a[0] || (a[0] = (m) => l("update:modelValue", m.target.value)),
|
|
344
|
+
onBlur: a[1] || (a[1] = (m) => l("blur"))
|
|
345
|
+
}), null, 16, pe)
|
|
316
346
|
]),
|
|
317
347
|
_: 1
|
|
318
348
|
}, 8, ["field", "error", "touched"]));
|
|
319
349
|
}
|
|
320
|
-
}),
|
|
350
|
+
}), xe = { class: "vfs-array" }, Fe = {
|
|
321
351
|
key: 0,
|
|
322
352
|
class: "vfs-field__label"
|
|
323
|
-
},
|
|
353
|
+
}, qe = ["onClick"], Be = /* @__PURE__ */ V({
|
|
324
354
|
__name: "ArrayField",
|
|
325
355
|
props: {
|
|
326
356
|
field: {},
|
|
@@ -328,187 +358,291 @@ const _ = ["for"], ee = {
|
|
|
328
358
|
components: {}
|
|
329
359
|
},
|
|
330
360
|
setup(e) {
|
|
331
|
-
const
|
|
361
|
+
const o = e, l = P(), s = {
|
|
332
362
|
text: N,
|
|
333
363
|
email: N,
|
|
334
|
-
number:
|
|
335
|
-
textarea:
|
|
336
|
-
select:
|
|
337
|
-
checkbox:
|
|
338
|
-
radio:
|
|
339
|
-
date:
|
|
364
|
+
number: O,
|
|
365
|
+
textarea: j,
|
|
366
|
+
select: G,
|
|
367
|
+
checkbox: H,
|
|
368
|
+
radio: J,
|
|
369
|
+
date: Q
|
|
340
370
|
};
|
|
341
|
-
function
|
|
342
|
-
var
|
|
343
|
-
return
|
|
371
|
+
function a($) {
|
|
372
|
+
var r;
|
|
373
|
+
return $.component ? $.component : ((r = o.components) == null ? void 0 : r[$.type]) ?? l[$.type] ?? s[$.type] ?? null;
|
|
344
374
|
}
|
|
345
|
-
const { rows:
|
|
346
|
-
function
|
|
347
|
-
return
|
|
375
|
+
const { rows: d, append: m, remove: f } = le(o.form, o.field.name);
|
|
376
|
+
function h($) {
|
|
377
|
+
return K(o.form.values.value, $.name);
|
|
348
378
|
}
|
|
349
|
-
function
|
|
350
|
-
|
|
379
|
+
function c($, r) {
|
|
380
|
+
o.form.setField($.name, r);
|
|
351
381
|
}
|
|
352
|
-
function
|
|
353
|
-
var
|
|
354
|
-
const
|
|
355
|
-
(
|
|
382
|
+
function g($) {
|
|
383
|
+
var i;
|
|
384
|
+
const r = o.form;
|
|
385
|
+
(i = r.touchField) == null || i.call(r, $.name);
|
|
356
386
|
}
|
|
357
|
-
function
|
|
358
|
-
return
|
|
387
|
+
function D($) {
|
|
388
|
+
return o.form.errors.value[$.name] ?? [];
|
|
359
389
|
}
|
|
360
|
-
function
|
|
361
|
-
return
|
|
390
|
+
function L($) {
|
|
391
|
+
return o.form.touched.value[$.name] ?? !1;
|
|
362
392
|
}
|
|
363
|
-
return (
|
|
364
|
-
|
|
393
|
+
return ($, r) => (t(), n("div", xe, [
|
|
394
|
+
M(C, {
|
|
365
395
|
field: { ...e.field, label: void 0 },
|
|
366
396
|
error: [],
|
|
367
397
|
touched: !1
|
|
368
398
|
}, {
|
|
369
|
-
default:
|
|
370
|
-
e.field.label ? (t(),
|
|
371
|
-
(t(!0),
|
|
372
|
-
key:
|
|
399
|
+
default: q(() => [
|
|
400
|
+
e.field.label ? (t(), n("div", Fe, y(e.field.label), 1)) : k("", !0),
|
|
401
|
+
(t(!0), n(x, null, S(z(d), (i) => (t(), n("div", {
|
|
402
|
+
key: i.key,
|
|
373
403
|
class: "vfs-array__row"
|
|
374
404
|
}, [
|
|
375
|
-
(t(!0),
|
|
376
|
-
key:
|
|
405
|
+
(t(!0), n(x, null, S(i.fields, (v) => (t(), n(x, {
|
|
406
|
+
key: v.name
|
|
377
407
|
}, [
|
|
378
|
-
|
|
408
|
+
a(v) ? (t(), F(U(a(v)), {
|
|
379
409
|
key: 0,
|
|
380
|
-
field:
|
|
381
|
-
"model-value":
|
|
382
|
-
error:
|
|
383
|
-
touched:
|
|
384
|
-
"onUpdate:modelValue": (u) =>
|
|
385
|
-
onBlur: (u) =>
|
|
410
|
+
field: v,
|
|
411
|
+
"model-value": h(v),
|
|
412
|
+
error: D(v),
|
|
413
|
+
touched: L(v),
|
|
414
|
+
"onUpdate:modelValue": (u) => c(v, u),
|
|
415
|
+
onBlur: (u) => g(v)
|
|
386
416
|
}, null, 40, ["field", "model-value", "error", "touched", "onUpdate:modelValue", "onBlur"])) : k("", !0)
|
|
387
417
|
], 64))), 128)),
|
|
388
418
|
b("button", {
|
|
389
419
|
type: "button",
|
|
390
420
|
class: "vfs-array__remove",
|
|
391
|
-
onClick: (
|
|
392
|
-
}, "
|
|
421
|
+
onClick: (v) => z(f)(i.index)
|
|
422
|
+
}, "Remove", 8, qe)
|
|
393
423
|
]))), 128)),
|
|
394
424
|
b("button", {
|
|
395
425
|
type: "button",
|
|
396
426
|
class: "vfs-array__add",
|
|
397
|
-
onClick:
|
|
398
|
-
}, "
|
|
427
|
+
onClick: r[0] || (r[0] = (i) => z(m)())
|
|
428
|
+
}, "+ Add row")
|
|
399
429
|
]),
|
|
400
430
|
_: 1
|
|
401
431
|
}, 8, ["field"])
|
|
402
432
|
]));
|
|
403
433
|
}
|
|
404
|
-
}),
|
|
434
|
+
}), Se = ["id", "name", "accept", "multiple", "disabled", "required"], Ce = ["for"], Re = {
|
|
435
|
+
key: 0,
|
|
436
|
+
class: "vfs-file-hint"
|
|
437
|
+
}, De = {
|
|
438
|
+
key: 0,
|
|
439
|
+
class: "vfs-file-list"
|
|
440
|
+
}, Le = { class: "vfs-file-name" }, Ae = { class: "vfs-file-size" }, Ne = ["aria-label", "onClick"], Te = /* @__PURE__ */ V({
|
|
441
|
+
__name: "FileField",
|
|
442
|
+
props: {
|
|
443
|
+
field: {},
|
|
444
|
+
modelValue: {},
|
|
445
|
+
error: {},
|
|
446
|
+
touched: { type: Boolean }
|
|
447
|
+
},
|
|
448
|
+
emits: ["update:modelValue", "blur"],
|
|
449
|
+
setup(e, { emit: o }) {
|
|
450
|
+
const l = e, s = o, a = w(!1), d = w(null), m = B(() => l.modelValue ? Array.isArray(l.modelValue) ? l.modelValue : [l.modelValue] : []), f = B(() => l.field.multiple ?? !1);
|
|
451
|
+
function h(i) {
|
|
452
|
+
if (!i || i.length === 0) {
|
|
453
|
+
s("update:modelValue", null);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
f.value ? s("update:modelValue", Array.from(i)) : s("update:modelValue", i[0]);
|
|
457
|
+
}
|
|
458
|
+
function c(i) {
|
|
459
|
+
h(i.target.files), s("blur");
|
|
460
|
+
}
|
|
461
|
+
function g(i) {
|
|
462
|
+
var v;
|
|
463
|
+
a.value = !1, i.preventDefault(), h(((v = i.dataTransfer) == null ? void 0 : v.files) ?? null), s("blur");
|
|
464
|
+
}
|
|
465
|
+
function D(i) {
|
|
466
|
+
i.preventDefault(), a.value = !0;
|
|
467
|
+
}
|
|
468
|
+
function L() {
|
|
469
|
+
a.value = !1;
|
|
470
|
+
}
|
|
471
|
+
function $(i) {
|
|
472
|
+
const v = m.value.filter((u, p) => p !== i);
|
|
473
|
+
v.length === 0 ? (s("update:modelValue", null), d.value && (d.value.value = "")) : f.value ? s("update:modelValue", v) : s("update:modelValue", v[0]);
|
|
474
|
+
}
|
|
475
|
+
function r(i) {
|
|
476
|
+
return i < 1024 ? `${i} B` : i < 1024 * 1024 ? `${(i / 1024).toFixed(1)} KB` : `${(i / (1024 * 1024)).toFixed(1)} MB`;
|
|
477
|
+
}
|
|
478
|
+
return (i, v) => (t(), F(C, {
|
|
479
|
+
field: e.field,
|
|
480
|
+
error: e.error,
|
|
481
|
+
touched: e.touched
|
|
482
|
+
}, {
|
|
483
|
+
default: q((u) => [
|
|
484
|
+
b("div", {
|
|
485
|
+
class: T(["vfs-file-zone", { "vfs-file-zone--dragging": a.value }]),
|
|
486
|
+
onDragover: D,
|
|
487
|
+
onDragleave: L,
|
|
488
|
+
onDrop: g
|
|
489
|
+
}, [
|
|
490
|
+
b("input", R({
|
|
491
|
+
id: e.field.name,
|
|
492
|
+
ref_key: "inputRef",
|
|
493
|
+
ref: d,
|
|
494
|
+
type: "file",
|
|
495
|
+
name: e.field.name,
|
|
496
|
+
accept: e.field.accept,
|
|
497
|
+
multiple: f.value,
|
|
498
|
+
disabled: e.field.disabled === !0,
|
|
499
|
+
required: e.field.required
|
|
500
|
+
}, u, {
|
|
501
|
+
class: "vfs-file-input",
|
|
502
|
+
onChange: c
|
|
503
|
+
}), null, 16, Se),
|
|
504
|
+
b("label", {
|
|
505
|
+
for: e.field.name,
|
|
506
|
+
class: "vfs-file-label"
|
|
507
|
+
}, [
|
|
508
|
+
v[0] || (v[0] = b("span", {
|
|
509
|
+
class: "vfs-file-icon",
|
|
510
|
+
"aria-hidden": "true"
|
|
511
|
+
}, "📁", -1)),
|
|
512
|
+
b("span", null, y(a.value ? "Drop files here" : "Click to upload or drag & drop"), 1),
|
|
513
|
+
e.field.accept ? (t(), n("span", Re, y(e.field.accept), 1)) : k("", !0)
|
|
514
|
+
], 8, Ce)
|
|
515
|
+
], 34),
|
|
516
|
+
m.value.length ? (t(), n("ul", De, [
|
|
517
|
+
(t(!0), n(x, null, S(m.value, (p, E) => (t(), n("li", {
|
|
518
|
+
key: `${p.name}-${E}`,
|
|
519
|
+
class: "vfs-file-item"
|
|
520
|
+
}, [
|
|
521
|
+
b("span", Le, y(p.name), 1),
|
|
522
|
+
b("span", Ae, y(r(p.size)), 1),
|
|
523
|
+
b("button", {
|
|
524
|
+
type: "button",
|
|
525
|
+
class: "vfs-file-remove",
|
|
526
|
+
"aria-label": `Remove ${p.name}`,
|
|
527
|
+
onClick: (He) => $(E)
|
|
528
|
+
}, " × ", 8, Ne)
|
|
529
|
+
]))), 128))
|
|
530
|
+
])) : k("", !0)
|
|
531
|
+
]),
|
|
532
|
+
_: 1
|
|
533
|
+
}, 8, ["field", "error", "touched"]));
|
|
534
|
+
}
|
|
535
|
+
}), ze = {
|
|
405
536
|
key: 1,
|
|
406
537
|
class: "vfs-group"
|
|
407
|
-
},
|
|
538
|
+
}, Ie = { key: 0 }, we = ["disabled"], Ee = /* @__PURE__ */ V({
|
|
408
539
|
__name: "FormRenderer",
|
|
409
540
|
props: {
|
|
410
541
|
form: {},
|
|
411
542
|
components: {},
|
|
412
|
-
submitLabel: {}
|
|
543
|
+
submitLabel: {},
|
|
544
|
+
fields: {}
|
|
413
545
|
},
|
|
414
546
|
emits: ["submit"],
|
|
415
|
-
setup(e, { emit:
|
|
416
|
-
const
|
|
547
|
+
setup(e, { emit: o }) {
|
|
548
|
+
const l = e, s = P(), a = o, d = {
|
|
417
549
|
text: N,
|
|
418
550
|
email: N,
|
|
419
|
-
number:
|
|
420
|
-
textarea:
|
|
421
|
-
select:
|
|
422
|
-
checkbox:
|
|
423
|
-
radio:
|
|
424
|
-
date:
|
|
551
|
+
number: O,
|
|
552
|
+
textarea: j,
|
|
553
|
+
select: G,
|
|
554
|
+
checkbox: H,
|
|
555
|
+
radio: J,
|
|
556
|
+
date: Q,
|
|
557
|
+
file: Te
|
|
425
558
|
};
|
|
426
|
-
function
|
|
427
|
-
var
|
|
428
|
-
return
|
|
559
|
+
function m(r) {
|
|
560
|
+
var i;
|
|
561
|
+
return r.component ? r.component : ((i = l.components) == null ? void 0 : i[r.type]) ?? s[r.type] ?? d[r.type] ?? null;
|
|
429
562
|
}
|
|
430
|
-
function
|
|
431
|
-
return
|
|
563
|
+
function f(r) {
|
|
564
|
+
return K(l.form.values.value, r.name);
|
|
432
565
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
566
|
+
function h(r, i) {
|
|
567
|
+
l.form.setField(r.name, i);
|
|
435
568
|
}
|
|
436
|
-
function
|
|
437
|
-
var
|
|
438
|
-
const
|
|
439
|
-
(
|
|
569
|
+
function c(r) {
|
|
570
|
+
var v;
|
|
571
|
+
const i = l.form;
|
|
572
|
+
(v = i.touchField) == null || v.call(i, r.name);
|
|
440
573
|
}
|
|
441
|
-
function
|
|
442
|
-
return
|
|
574
|
+
function g(r) {
|
|
575
|
+
return l.form.errors.value[r.name] ?? [];
|
|
443
576
|
}
|
|
444
|
-
function
|
|
445
|
-
return
|
|
577
|
+
function D(r) {
|
|
578
|
+
return l.form.touched.value[r.name] ?? !1;
|
|
446
579
|
}
|
|
447
|
-
const
|
|
448
|
-
() =>
|
|
580
|
+
const L = B(
|
|
581
|
+
() => (l.fields ?? l.form.fields.value).filter((r) => r.visible !== !1)
|
|
449
582
|
);
|
|
450
|
-
async function
|
|
451
|
-
|
|
583
|
+
async function $(r) {
|
|
584
|
+
r.preventDefault(), await l.form.submit(), a("submit");
|
|
452
585
|
}
|
|
453
|
-
return (
|
|
454
|
-
const
|
|
455
|
-
return t(),
|
|
586
|
+
return (r, i) => {
|
|
587
|
+
const v = _("FormRenderer", !0);
|
|
588
|
+
return t(), n("form", {
|
|
456
589
|
class: "vfs-form",
|
|
457
590
|
novalidate: "",
|
|
458
|
-
onSubmit:
|
|
591
|
+
onSubmit: $
|
|
459
592
|
}, [
|
|
460
|
-
(t(!0),
|
|
593
|
+
(t(!0), n(x, null, S(L.value, (u) => (t(), n(x, {
|
|
461
594
|
key: u.name
|
|
462
595
|
}, [
|
|
463
|
-
|
|
596
|
+
r.$slots[`field-${u.name}`] ? A(r.$slots, `field-${u.name}`, {
|
|
464
597
|
key: 0,
|
|
465
598
|
field: u,
|
|
466
|
-
value:
|
|
467
|
-
error:
|
|
468
|
-
touched:
|
|
469
|
-
setValue: (
|
|
470
|
-
touch: () =>
|
|
471
|
-
}) : u.type === "group" ? (t(),
|
|
472
|
-
u.label ? (t(),
|
|
473
|
-
u.fields ? (t(),
|
|
599
|
+
value: f(u),
|
|
600
|
+
error: g(u),
|
|
601
|
+
touched: D(u),
|
|
602
|
+
setValue: (p) => h(u, p),
|
|
603
|
+
touch: () => c(u)
|
|
604
|
+
}) : u.type === "group" ? (t(), n("fieldset", ze, [
|
|
605
|
+
u.label ? (t(), n("legend", Ie, y(u.label), 1)) : k("", !0),
|
|
606
|
+
u.fields ? (t(), F(v, {
|
|
474
607
|
key: 1,
|
|
475
608
|
form: e.form,
|
|
609
|
+
fields: u.fields,
|
|
476
610
|
components: e.components
|
|
477
|
-
}, null, 8, ["form", "components"])) : k("", !0)
|
|
478
|
-
])) : u.type === "array" ? (t(),
|
|
611
|
+
}, null, 8, ["form", "fields", "components"])) : k("", !0)
|
|
612
|
+
])) : u.type === "array" ? (t(), F(Be, {
|
|
479
613
|
key: 2,
|
|
480
614
|
field: u,
|
|
481
615
|
form: e.form,
|
|
482
616
|
components: e.components
|
|
483
|
-
}, null, 8, ["field", "form", "components"])) :
|
|
617
|
+
}, null, 8, ["field", "form", "components"])) : m(u) ? (t(), F(U(m(u)), {
|
|
484
618
|
key: 3,
|
|
485
619
|
field: u,
|
|
486
|
-
"model-value":
|
|
487
|
-
error:
|
|
488
|
-
touched:
|
|
489
|
-
"onUpdate:modelValue": (
|
|
490
|
-
onBlur: (
|
|
491
|
-
},
|
|
492
|
-
|
|
620
|
+
"model-value": f(u),
|
|
621
|
+
error: g(u),
|
|
622
|
+
touched: D(u),
|
|
623
|
+
"onUpdate:modelValue": (p) => h(u, p),
|
|
624
|
+
onBlur: (p) => c(u)
|
|
625
|
+
}, ee({ _: 2 }, [
|
|
626
|
+
r.$slots[`label-${u.name}`] ? {
|
|
493
627
|
name: "label",
|
|
494
|
-
fn:
|
|
495
|
-
|
|
628
|
+
fn: q(() => [
|
|
629
|
+
A(r.$slots, `label-${u.name}`, { field: u })
|
|
496
630
|
]),
|
|
497
631
|
key: "0"
|
|
498
632
|
} : void 0,
|
|
499
|
-
|
|
633
|
+
r.$slots[`error-${u.name}`] ? {
|
|
500
634
|
name: "error",
|
|
501
|
-
fn:
|
|
502
|
-
|
|
635
|
+
fn: q(() => [
|
|
636
|
+
A(r.$slots, `error-${u.name}`, {
|
|
503
637
|
field: u,
|
|
504
|
-
error:
|
|
638
|
+
error: g(u)
|
|
505
639
|
})
|
|
506
640
|
]),
|
|
507
641
|
key: "1"
|
|
508
642
|
} : void 0
|
|
509
643
|
]), 1064, ["field", "model-value", "error", "touched", "onUpdate:modelValue", "onBlur"])) : k("", !0)
|
|
510
644
|
], 64))), 128)),
|
|
511
|
-
|
|
645
|
+
A(r.$slots, "submit", {
|
|
512
646
|
isSubmitting: e.form.isSubmitting.value,
|
|
513
647
|
isValid: e.form.isValid.value
|
|
514
648
|
}, () => [
|
|
@@ -516,15 +650,15 @@ const _ = ["for"], ee = {
|
|
|
516
650
|
type: "submit",
|
|
517
651
|
disabled: e.form.isSubmitting.value,
|
|
518
652
|
class: "vfs-submit"
|
|
519
|
-
},
|
|
653
|
+
}, y(e.submitLabel ?? "Submit"), 9, we)
|
|
520
654
|
])
|
|
521
655
|
], 32);
|
|
522
656
|
};
|
|
523
657
|
}
|
|
524
|
-
}),
|
|
658
|
+
}), Me = { class: "vfs-multistep" }, Ue = { class: "vfs-multistep__steps" }, Pe = { class: "vfs-multistep__step-number" }, Ke = {
|
|
525
659
|
key: 0,
|
|
526
660
|
class: "vfs-multistep__step-label"
|
|
527
|
-
},
|
|
661
|
+
}, Oe = { class: "vfs-multistep__progress" }, je = { class: "vfs-multistep__nav" }, Ge = ["disabled"], Xe = /* @__PURE__ */ V({
|
|
528
662
|
__name: "MultiStepFormRenderer",
|
|
529
663
|
props: {
|
|
530
664
|
form: {},
|
|
@@ -535,55 +669,55 @@ const _ = ["for"], ee = {
|
|
|
535
669
|
stepLabels: {}
|
|
536
670
|
},
|
|
537
671
|
emits: ["submit"],
|
|
538
|
-
setup(e, { emit:
|
|
539
|
-
const
|
|
540
|
-
async function
|
|
541
|
-
await
|
|
672
|
+
setup(e, { emit: o }) {
|
|
673
|
+
const l = e, s = o;
|
|
674
|
+
async function a() {
|
|
675
|
+
await l.form.next();
|
|
542
676
|
}
|
|
543
|
-
async function
|
|
544
|
-
await
|
|
677
|
+
async function d() {
|
|
678
|
+
await l.form.submit(), s("submit");
|
|
545
679
|
}
|
|
546
|
-
return (
|
|
547
|
-
b("div",
|
|
548
|
-
(t(!0),
|
|
549
|
-
var
|
|
550
|
-
return t(),
|
|
551
|
-
key:
|
|
552
|
-
class:
|
|
553
|
-
"vfs-multistep__step--active":
|
|
554
|
-
"vfs-multistep__step--done":
|
|
680
|
+
return (m, f) => (t(), n("div", Me, [
|
|
681
|
+
b("div", Ue, [
|
|
682
|
+
(t(!0), n(x, null, S(e.form.steps, (h, c) => {
|
|
683
|
+
var g;
|
|
684
|
+
return t(), n("div", {
|
|
685
|
+
key: c,
|
|
686
|
+
class: T(["vfs-multistep__step", {
|
|
687
|
+
"vfs-multistep__step--active": c === e.form.currentStep.value,
|
|
688
|
+
"vfs-multistep__step--done": c < e.form.currentStep.value
|
|
555
689
|
}])
|
|
556
690
|
}, [
|
|
557
|
-
b("span",
|
|
558
|
-
(
|
|
691
|
+
b("span", Pe, y(c + 1), 1),
|
|
692
|
+
(g = e.stepLabels) != null && g[c] ? (t(), n("span", Ke, y(e.stepLabels[c]), 1)) : k("", !0)
|
|
559
693
|
], 2);
|
|
560
694
|
}), 128))
|
|
561
695
|
]),
|
|
562
|
-
b("div",
|
|
563
|
-
|
|
696
|
+
b("div", Oe, " Step " + y(e.form.currentStep.value + 1) + " of " + y(e.form.totalSteps), 1),
|
|
697
|
+
M(Ee, {
|
|
564
698
|
form: e.form.form.value,
|
|
565
699
|
components: e.components
|
|
566
700
|
}, {
|
|
567
|
-
submit:
|
|
568
|
-
b("div",
|
|
569
|
-
e.form.isFirstStep.value ? k("", !0) : (t(),
|
|
701
|
+
submit: q(() => [
|
|
702
|
+
b("div", je, [
|
|
703
|
+
e.form.isFirstStep.value ? k("", !0) : (t(), n("button", {
|
|
570
704
|
key: 0,
|
|
571
705
|
type: "button",
|
|
572
706
|
class: "vfs-multistep__back",
|
|
573
|
-
onClick:
|
|
574
|
-
},
|
|
575
|
-
e.form.isLastStep.value ? (t(),
|
|
707
|
+
onClick: f[0] || (f[0] = (h) => e.form.back())
|
|
708
|
+
}, y(e.backLabel ?? "← Back"), 1)),
|
|
709
|
+
e.form.isLastStep.value ? (t(), n("button", {
|
|
576
710
|
key: 2,
|
|
577
711
|
type: "button",
|
|
578
712
|
class: "vfs-submit",
|
|
579
713
|
disabled: e.form.isSubmitting.value,
|
|
580
|
-
onClick:
|
|
581
|
-
},
|
|
714
|
+
onClick: d
|
|
715
|
+
}, y(e.submitLabel ?? "Submit"), 9, Ge)) : (t(), n("button", {
|
|
582
716
|
key: 1,
|
|
583
717
|
type: "button",
|
|
584
718
|
class: "vfs-multistep__next",
|
|
585
|
-
onClick:
|
|
586
|
-
},
|
|
719
|
+
onClick: a
|
|
720
|
+
}, y(e.nextLabel ?? "Next →"), 1))
|
|
587
721
|
])
|
|
588
722
|
]),
|
|
589
723
|
_: 1
|
|
@@ -592,14 +726,15 @@ const _ = ["for"], ee = {
|
|
|
592
726
|
}
|
|
593
727
|
});
|
|
594
728
|
export {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
729
|
+
Be as ArrayField,
|
|
730
|
+
H as CheckboxField,
|
|
731
|
+
Q as DateField,
|
|
732
|
+
Te as FileField,
|
|
733
|
+
Ee as FormRenderer,
|
|
734
|
+
Xe as MultiStepFormRenderer,
|
|
735
|
+
O as NumberField,
|
|
736
|
+
J as RadioField,
|
|
737
|
+
G as SelectField,
|
|
603
738
|
N as TextField,
|
|
604
|
-
|
|
739
|
+
j as TextareaField
|
|
605
740
|
};
|