@foormjs/vue 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +385 -236
- package/dist/index.cjs +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +454 -146
- package/dist/index.js +1518 -1022
- package/package.json +30 -26
- package/scripts/setup-skills.js +78 -0
- package/skills/foormjs-vue/.placeholder +0 -0
- package/skills/foormjs-vue/SKILL.md +53 -0
- package/skills/foormjs-vue/composables.md +189 -0
- package/skills/foormjs-vue/core.md +279 -0
- package/skills/foormjs-vue/custom-components.md +677 -0
- package/skills/foormjs-vue/defaults.md +266 -0
- package/skills/foormjs-vue/rendering.md +175 -0
- package/dist/index.umd.cjs +0 -3
- package/dist/style.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,305 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
const ge = /* @__PURE__ */ new Set(["action", "paragraph"]);
|
|
9
|
-
function ve(o) {
|
|
10
|
-
var e;
|
|
11
|
-
const t = {};
|
|
12
|
-
for (const r of o)
|
|
13
|
-
if (!ge.has(r.type)) {
|
|
14
|
-
const s = {
|
|
15
|
-
v: void 0,
|
|
16
|
-
data: t,
|
|
17
|
-
context: {},
|
|
18
|
-
entry: {
|
|
19
|
-
field: r.field,
|
|
20
|
-
type: r.type,
|
|
21
|
-
component: r.component,
|
|
22
|
-
name: r.name || r.field
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
t[r.field] = (e = M(r.value, s)) !== null && e !== void 0 ? e : void 0;
|
|
26
|
-
}
|
|
27
|
-
return t;
|
|
28
|
-
}
|
|
29
|
-
function be(o, e) {
|
|
30
|
-
return o.fields.some((t) => t.altAction === e);
|
|
31
|
-
}
|
|
32
|
-
function xe(o, e) {
|
|
1
|
+
import { computed as f, inject as I, provide as q, defineComponent as A, watch as Ue, openBlock as n, createBlock as w, resolveDynamicComponent as mo, mergeProps as ae, unref as l, createElementBlock as m, toDisplayString as g, isRef as vo, ref as J, withModifiers as Ze, renderSlot as W, createVNode as ie, createElementVNode as L, toRaw as fo, Fragment as T, renderList as X, withKeys as Je, onBeforeUnmount as yo, normalizeClass as re, createCommentVNode as k, useId as bo, withDirectives as N, vShow as Q, withCtx as H, vModelDynamic as ho, vModelSelect as po, vModelRadio as go, createTextVNode as _e, reactive as eo } from "vue";
|
|
2
|
+
import { useFoormField as xo, useFoormForm as Bo } from "@foormjs/composables";
|
|
3
|
+
import { getByPath as ko, setByPath as $o, isObjectField as Se, isArrayField as qe, isTupleField as Me, isUnionField as je, getFieldMeta as y, createFieldValidator as Fo, resolveOptions as Ie, resolveAttrs as Te, resolveFieldProp as S, buildFieldEntry as Co, createFoormValueResolver as xe, createFormData as le, getFormValidator as Ro, resolveFormProp as Qe, supportsAltAction as Lo, optKey as ge, optLabel as oo, detectUnionVariant as Oo, createFoormDef as Vo } from "@foormjs/atscript";
|
|
4
|
+
const wo = f(() => "");
|
|
5
|
+
function Ne(e) {
|
|
6
|
+
const o = I("__foorm_form");
|
|
33
7
|
if (!o)
|
|
34
|
-
|
|
35
|
-
const t =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
rules: {}
|
|
44
|
-
}, {
|
|
45
|
-
modelValue: {},
|
|
46
|
-
modelModifiers: {}
|
|
47
|
-
}),
|
|
48
|
-
emits: ["update:modelValue"],
|
|
49
|
-
setup(o) {
|
|
50
|
-
const e = o, t = ae(o, "modelValue"), r = te("vuiless"), s = q(), a = q(!1), l = q(!1), c = _(() => {
|
|
51
|
-
var u;
|
|
52
|
-
if ((u = r == null ? void 0 : r.value) != null && u.firstValidation)
|
|
53
|
-
switch (r.value.firstValidation) {
|
|
54
|
-
case "on-change":
|
|
55
|
-
return r.value.firstSubmitHappened || a.value;
|
|
56
|
-
case "touched-on-blur":
|
|
57
|
-
return r.value.firstSubmitHappened || l.value && a.value;
|
|
58
|
-
case "on-blur":
|
|
59
|
-
return r.value.firstSubmitHappened || l.value;
|
|
60
|
-
case "on-submit":
|
|
61
|
-
return r.value.firstSubmitHappened;
|
|
62
|
-
case "none":
|
|
63
|
-
return !1;
|
|
64
|
-
}
|
|
65
|
-
return !1;
|
|
66
|
-
}), m = _(() => {
|
|
67
|
-
if (c.value || s.value)
|
|
68
|
-
return p();
|
|
8
|
+
throw new Error(`${e} must be used inside an OoForm component`);
|
|
9
|
+
const t = o, r = I("__foorm_root_data");
|
|
10
|
+
if (!r)
|
|
11
|
+
throw new Error(`${e} must be used inside an OoForm component (missing root data)`);
|
|
12
|
+
const a = () => r.value, d = I("__foorm_path_prefix", wo), s = I("__foorm_form_context"), v = f(() => s?.value ?? {});
|
|
13
|
+
function b(h) {
|
|
14
|
+
return f(() => {
|
|
15
|
+
const p = typeof h == "function" ? h() : h;
|
|
16
|
+
return p ? d.value ? `${d.value}.${p}` : p : d.value;
|
|
69
17
|
});
|
|
70
|
-
oe([t], () => {
|
|
71
|
-
s.value = void 0, a.value = !0;
|
|
72
|
-
}), le(() => {
|
|
73
|
-
var u;
|
|
74
|
-
(u = r == null ? void 0 : r.value) == null || u.unregister(Q());
|
|
75
|
-
}), r != null && r.value && r.value.register(Q(), {
|
|
76
|
-
validate: () => (s.value = p(), s.value || !0),
|
|
77
|
-
clearErrors: () => {
|
|
78
|
-
a.value = !1, l.value = !1, s.value = void 0;
|
|
79
|
-
},
|
|
80
|
-
reset: () => {
|
|
81
|
-
t.value = "";
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
function p() {
|
|
85
|
-
var u, d, A;
|
|
86
|
-
if ((u = e.rules) != null && u.length)
|
|
87
|
-
for (const v of e.rules) {
|
|
88
|
-
const E = v(
|
|
89
|
-
t.value,
|
|
90
|
-
(d = r == null ? void 0 : r.value) == null ? void 0 : d.formData,
|
|
91
|
-
(A = r == null ? void 0 : r.value) == null ? void 0 : A.formContext
|
|
92
|
-
);
|
|
93
|
-
if (E !== !0)
|
|
94
|
-
return E || "Wrong value";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function f() {
|
|
98
|
-
l.value = !0;
|
|
99
|
-
}
|
|
100
|
-
const h = {
|
|
101
|
-
v: _({
|
|
102
|
-
get: () => t.value,
|
|
103
|
-
set: (u) => t.value = u
|
|
104
|
-
})
|
|
105
|
-
};
|
|
106
|
-
return (u, d) => {
|
|
107
|
-
var A, v;
|
|
108
|
-
return w(u.$slots, "default", {
|
|
109
|
-
onBlur: f,
|
|
110
|
-
error: m.value,
|
|
111
|
-
formData: (A = x(r)) == null ? void 0 : A.formData,
|
|
112
|
-
formContext: (v = x(r)) == null ? void 0 : v.formContext,
|
|
113
|
-
model: h.v
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
18
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
register: (f, h) => {
|
|
130
|
-
s.set(f, h);
|
|
131
|
-
},
|
|
132
|
-
unregister: (f) => s.delete(f),
|
|
133
|
-
formData: t.formData,
|
|
134
|
-
formContext: t.formContext
|
|
135
|
-
}));
|
|
136
|
-
ue("vuiless", l);
|
|
137
|
-
function c() {
|
|
138
|
-
a.value = !1;
|
|
139
|
-
for (const { clearErrors: f } of s.values())
|
|
140
|
-
f();
|
|
141
|
-
}
|
|
142
|
-
async function m() {
|
|
143
|
-
for (const { reset: f } of s.values())
|
|
144
|
-
f();
|
|
145
|
-
await pe(), c();
|
|
146
|
-
}
|
|
147
|
-
function p() {
|
|
148
|
-
a.value = !0;
|
|
149
|
-
let f = !1;
|
|
150
|
-
if (t.firstValidation !== "none")
|
|
151
|
-
for (const { validate: h } of s.values())
|
|
152
|
-
h() !== !0 && (f = !0);
|
|
153
|
-
f || r("submit", t.formData);
|
|
154
|
-
}
|
|
155
|
-
return (f, h) => (y(), b("form", {
|
|
156
|
-
onSubmit: ce(p, ["prevent"])
|
|
157
|
-
}, [
|
|
158
|
-
w(f.$slots, "default", {
|
|
159
|
-
clearErrors: c,
|
|
160
|
-
reset: m
|
|
161
|
-
})
|
|
162
|
-
], 32));
|
|
19
|
+
function O(h) {
|
|
20
|
+
return h ? d.value ? `${d.value}.${h}` : h : d.value;
|
|
21
|
+
}
|
|
22
|
+
function x(h) {
|
|
23
|
+
return ko(a(), h);
|
|
24
|
+
}
|
|
25
|
+
function $(h, p) {
|
|
26
|
+
$o(a(), h, p);
|
|
27
|
+
}
|
|
28
|
+
function F(h, p) {
|
|
29
|
+
const B = a();
|
|
30
|
+
return { v: h, data: B.value, context: v.value, entry: p };
|
|
163
31
|
}
|
|
164
|
-
|
|
32
|
+
return {
|
|
33
|
+
foormState: t,
|
|
34
|
+
rootFormData: a,
|
|
35
|
+
pathPrefix: d,
|
|
36
|
+
formContext: v,
|
|
37
|
+
joinPath: b,
|
|
38
|
+
buildPath: O,
|
|
39
|
+
getByPath: x,
|
|
40
|
+
setByPath: $,
|
|
41
|
+
buildScope: F
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Be() {
|
|
45
|
+
const e = I("__foorm_union", void 0);
|
|
46
|
+
return q("__foorm_union", void 0), e;
|
|
47
|
+
}
|
|
48
|
+
function to(e, o) {
|
|
49
|
+
return o !== void 0 ? e ? `${e} #${o + 1}` : `#${o + 1}` : e;
|
|
50
|
+
}
|
|
51
|
+
const Ao = { key: 1 }, pe = {
|
|
52
|
+
v: void 0,
|
|
53
|
+
data: {},
|
|
54
|
+
context: {},
|
|
55
|
+
entry: void 0
|
|
56
|
+
}, de = /* @__PURE__ */ A({
|
|
165
57
|
__name: "oo-field",
|
|
166
58
|
props: {
|
|
167
59
|
field: {},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
name: {},
|
|
174
|
-
label: { type: [String, Function] },
|
|
175
|
-
description: { type: [String, Function] },
|
|
176
|
-
hint: { type: [String, Function] },
|
|
177
|
-
placeholder: { type: [String, Function] },
|
|
178
|
-
optional: { type: [Boolean, Function] },
|
|
179
|
-
disabled: { type: [Boolean, Function] },
|
|
180
|
-
hidden: { type: [Boolean, Function] },
|
|
181
|
-
readonly: { type: [Boolean, Function] },
|
|
182
|
-
classes: { type: [String, Object, Function] },
|
|
183
|
-
styles: { type: [String, Object, Function] },
|
|
184
|
-
options: { type: [Array, Function] },
|
|
185
|
-
attrs: {},
|
|
186
|
-
value: { type: Function },
|
|
187
|
-
validators: {},
|
|
188
|
-
maxLength: {},
|
|
189
|
-
minLength: {},
|
|
190
|
-
min: {},
|
|
191
|
-
max: {},
|
|
192
|
-
error: {}
|
|
60
|
+
error: {},
|
|
61
|
+
onRemove: { type: Function },
|
|
62
|
+
canRemove: { type: Boolean },
|
|
63
|
+
removeLabel: {},
|
|
64
|
+
arrayIndex: {}
|
|
193
65
|
},
|
|
194
|
-
setup(
|
|
195
|
-
const
|
|
196
|
-
|
|
66
|
+
setup(e) {
|
|
67
|
+
const o = e, t = I("__foorm_types"), r = I("__foorm_components"), a = I("__foorm_errors"), d = I("__foorm_action_handler", () => {
|
|
68
|
+
}), s = I(
|
|
69
|
+
"__foorm_change_handler",
|
|
70
|
+
() => {
|
|
71
|
+
}
|
|
72
|
+
), { rootFormData: v, formContext: b, joinPath: O, buildPath: x, getByPath: $, setByPath: F, buildScope: h } = Ne("OoField"), p = O(() => o.field.path), B = Se(o.field) || qe(o.field) || Me(o.field), E = je(o.field), j = I(
|
|
73
|
+
"__foorm_level",
|
|
74
|
+
f(() => -1)
|
|
75
|
+
), M = B ? j.value + 1 : -1;
|
|
76
|
+
(B || E) && q(
|
|
77
|
+
"__foorm_path_prefix",
|
|
78
|
+
f(() => p.value)
|
|
79
|
+
), B && q(
|
|
80
|
+
"__foorm_level",
|
|
81
|
+
f(() => M)
|
|
197
82
|
);
|
|
198
|
-
|
|
199
|
-
|
|
83
|
+
const u = (c) => vo(c) ? c.value : c;
|
|
84
|
+
function R(c, z, _) {
|
|
85
|
+
return c ? f(z) : _;
|
|
200
86
|
}
|
|
201
|
-
|
|
202
|
-
v: t.value.formData[e.field],
|
|
203
|
-
data: t.value.formData,
|
|
204
|
-
context: t.value.formContext ?? {},
|
|
205
|
-
entry: void 0
|
|
206
|
-
})), l = r(e.optional, a, !1), c = r(e.disabled, a, !1), m = r(e.hidden, a, !1), p = r(e.readonly, a, !1), f = _(() => !s(l)), h = _(() => ({
|
|
207
|
-
v: t.value.formData[e.field],
|
|
208
|
-
data: t.value.formData,
|
|
209
|
-
context: t.value.formContext ?? {},
|
|
210
|
-
entry: {
|
|
211
|
-
field: e.field,
|
|
212
|
-
type: e.type,
|
|
213
|
-
component: e.component,
|
|
214
|
-
name: e.name || e.field,
|
|
215
|
-
optional: s(l),
|
|
216
|
-
disabled: s(c),
|
|
217
|
-
hidden: s(m),
|
|
218
|
-
readonly: s(p)
|
|
219
|
-
}
|
|
220
|
-
})), u = r(e.label, h, void 0), d = r(e.description, h, void 0), A = r(e.hint, h, void 0), v = r(e.placeholder, h, void 0), E = r(e.options, h, void 0), C = r(e.styles, h, void 0), n = _(() => {
|
|
221
|
-
const i = typeof e.classes == "function" ? e.classes(h.value) : e.classes;
|
|
222
|
-
return typeof i == "string" ? {
|
|
223
|
-
[i]: !0,
|
|
224
|
-
disabled: s(c),
|
|
225
|
-
required: !s(l)
|
|
226
|
-
} : {
|
|
227
|
-
...i,
|
|
228
|
-
disabled: s(c),
|
|
229
|
-
required: !s(l)
|
|
230
|
-
};
|
|
231
|
-
});
|
|
232
|
-
function F(i, k) {
|
|
87
|
+
function P(c, z, _) {
|
|
233
88
|
return {
|
|
234
|
-
...
|
|
235
|
-
|
|
89
|
+
...typeof c == "string" ? { [c]: !0 } : c,
|
|
90
|
+
disabled: z,
|
|
91
|
+
required: _
|
|
236
92
|
};
|
|
237
93
|
}
|
|
238
|
-
const D =
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
94
|
+
const i = o.field.prop, D = y(i, "foorm.autocomplete"), se = y(i, "expect.maxLength")?.length, Y = y(i, "foorm.component"), oe = y(i, "foorm.altAction"), $e = oe ? {
|
|
95
|
+
id: oe.id,
|
|
96
|
+
label: oe.label ?? y(i, "meta.label") ?? o.field.name
|
|
97
|
+
} : void 0, C = Fo(
|
|
98
|
+
i,
|
|
99
|
+
B || E ? { rootOnly: !0 } : void 0
|
|
100
|
+
);
|
|
101
|
+
function V() {
|
|
102
|
+
return $(p.value);
|
|
103
|
+
}
|
|
104
|
+
function G(c) {
|
|
105
|
+
F(p.value, c);
|
|
106
|
+
}
|
|
107
|
+
function ue(c) {
|
|
108
|
+
if (c) {
|
|
109
|
+
const z = xe(
|
|
110
|
+
v().value,
|
|
111
|
+
b.value
|
|
112
|
+
);
|
|
113
|
+
G(le(o.field.prop, z).value);
|
|
114
|
+
} else
|
|
115
|
+
G(void 0);
|
|
116
|
+
s("update", p.value, V());
|
|
117
|
+
}
|
|
118
|
+
const We = f(() => Y ? r?.value?.[Y] : t?.value?.[o.field.type]);
|
|
119
|
+
let K, ce, te, Z, me, ve, Fe, Ce, Re, Le, Oe, Ve, we, Ae, Ee, fe;
|
|
120
|
+
const ne = y(i, "meta.required") !== void 0;
|
|
121
|
+
if (o.field.allStatic)
|
|
122
|
+
fe = !1, K = y(i, "foorm.disabled") !== void 0, ce = y(i, "foorm.hidden") !== void 0, te = o.field.prop.optional ?? !1, Z = y(i, "foorm.readonly") !== void 0, me = o.field.phantom ? void 0 : ne, ve = y(i, "meta.label") ?? o.field.name, Fe = y(i, "meta.description"), Ce = y(i, "meta.hint"), Re = y(i, "meta.placeholder"), Oe = y(i, "foorm.styles"), Ve = Ie(i, pe), we = y(i, "foorm.attr") !== void 0 ? Te(i, pe) : void 0, Le = B ? y(i, "foorm.title") ?? y(i, "meta.label") ?? o.field.name : void 0, Ae = P(
|
|
123
|
+
y(i, "foorm.classes"),
|
|
124
|
+
K,
|
|
125
|
+
ne
|
|
126
|
+
), Ee = o.field.phantom ? y(i, "foorm.value") : void 0;
|
|
127
|
+
else {
|
|
128
|
+
const c = /* @__PURE__ */ new Set();
|
|
129
|
+
for (const he of i.metadata.keys())
|
|
130
|
+
he.startsWith("foorm.fn.") && c.add(he.slice(9));
|
|
131
|
+
fe = y(i, "foorm.validate") !== void 0;
|
|
132
|
+
const z = c.has("disabled") || c.has("hidden") || c.has("readonly"), _ = c.has("label") || c.has("description") || c.has("hint") || c.has("placeholder") || c.has("classes") || c.has("styles") || c.has("options") || c.has("value") || c.has("attr") || c.has("title") || fe, be = z || _ ? f(() => h(V())) : void 0, Pe = { staticAsBoolean: !0 };
|
|
133
|
+
K = R(
|
|
134
|
+
c.has("disabled"),
|
|
135
|
+
() => S(i, "foorm.fn.disabled", "foorm.disabled", be.value, Pe) ?? !1,
|
|
136
|
+
y(i, "foorm.disabled") !== void 0
|
|
137
|
+
), ce = R(
|
|
138
|
+
c.has("hidden"),
|
|
139
|
+
() => S(i, "foorm.fn.hidden", "foorm.hidden", be.value, Pe) ?? !1,
|
|
140
|
+
y(i, "foorm.hidden") !== void 0
|
|
141
|
+
), te = o.field.prop.optional ?? !1, Z = R(
|
|
142
|
+
c.has("readonly"),
|
|
143
|
+
() => S(i, "foorm.fn.readonly", "foorm.readonly", be.value, Pe) ?? !1,
|
|
144
|
+
y(i, "foorm.readonly") !== void 0
|
|
145
|
+
), me = o.field.phantom ? void 0 : ne;
|
|
146
|
+
const U = _ ? f(
|
|
147
|
+
() => Co(i, be.value, o.field.path, {
|
|
148
|
+
type: o.field.type,
|
|
149
|
+
component: Y,
|
|
150
|
+
name: o.field.name,
|
|
151
|
+
optional: u(te),
|
|
152
|
+
disabled: u(K),
|
|
153
|
+
hidden: u(ce),
|
|
154
|
+
readonly: u(Z)
|
|
155
|
+
})
|
|
156
|
+
) : void 0;
|
|
157
|
+
if (ve = R(
|
|
158
|
+
c.has("label"),
|
|
159
|
+
() => S(i, "foorm.fn.label", "meta.label", U.value) ?? o.field.name,
|
|
160
|
+
y(i, "meta.label") ?? o.field.name
|
|
161
|
+
), Fe = R(
|
|
162
|
+
c.has("description"),
|
|
163
|
+
() => S(i, "foorm.fn.description", "meta.description", U.value),
|
|
164
|
+
y(i, "meta.description")
|
|
165
|
+
), Ce = R(
|
|
166
|
+
c.has("hint"),
|
|
167
|
+
() => S(i, "foorm.fn.hint", "meta.hint", U.value),
|
|
168
|
+
y(i, "meta.hint")
|
|
169
|
+
), Re = R(
|
|
170
|
+
c.has("placeholder"),
|
|
171
|
+
() => S(i, "foorm.fn.placeholder", "meta.placeholder", U.value),
|
|
172
|
+
y(i, "meta.placeholder")
|
|
173
|
+
), Oe = R(
|
|
174
|
+
c.has("styles"),
|
|
175
|
+
() => S(i, "foorm.fn.styles", "foorm.styles", U.value),
|
|
176
|
+
y(i, "foorm.styles")
|
|
177
|
+
), Ve = R(
|
|
178
|
+
c.has("options"),
|
|
179
|
+
() => Ie(i, U.value),
|
|
180
|
+
Ie(i, pe)
|
|
181
|
+
), we = c.has("attr") || y(i, "foorm.attr") !== void 0 ? c.has("attr") ? f(() => Te(i, U.value)) : Te(i, pe) : void 0, Le = B ? R(
|
|
182
|
+
c.has("title"),
|
|
183
|
+
() => S(i, "foorm.fn.title", "foorm.title", U.value) ?? y(i, "meta.label") ?? o.field.name,
|
|
184
|
+
y(i, "foorm.title") ?? y(i, "meta.label") ?? o.field.name
|
|
185
|
+
) : void 0, Ae = c.has("classes") || typeof K != "boolean" ? f(
|
|
186
|
+
() => P(
|
|
187
|
+
c.has("classes") ? S(i, "foorm.fn.classes", void 0, U.value) : y(i, "foorm.classes"),
|
|
188
|
+
u(K),
|
|
189
|
+
ne
|
|
190
|
+
)
|
|
191
|
+
) : P(y(i, "foorm.classes"), K, ne), Ee = o.field.phantom ? R(
|
|
192
|
+
c.has("value"),
|
|
193
|
+
() => S(i, "foorm.fn.value", "foorm.value", U.value),
|
|
194
|
+
y(i, "foorm.value")
|
|
195
|
+
) : void 0, c.has("value") && !o.field.phantom) {
|
|
196
|
+
const he = f(() => {
|
|
197
|
+
if (u(Z)) return S(i, "foorm.fn.value", "foorm.value", U.value);
|
|
198
|
+
});
|
|
199
|
+
Ue(
|
|
200
|
+
he,
|
|
201
|
+
(He) => {
|
|
202
|
+
He !== void 0 && u(Z) && F(p.value, He);
|
|
203
|
+
},
|
|
204
|
+
{ immediate: !0 }
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function lo(c) {
|
|
209
|
+
return C(
|
|
210
|
+
c,
|
|
211
|
+
fe ? { data: v(), context: b.value } : void 0
|
|
250
212
|
);
|
|
251
213
|
}
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
214
|
+
const ao = o.field.prop.optional ?? !1, {
|
|
215
|
+
model: ye,
|
|
216
|
+
error: io,
|
|
217
|
+
onBlur: Xe
|
|
218
|
+
} = xo({
|
|
219
|
+
getValue: V,
|
|
220
|
+
setValue: G,
|
|
221
|
+
rules: [lo],
|
|
222
|
+
path: () => p.value,
|
|
223
|
+
...ao ? { resetValue: void 0 } : qe(o.field) || Me(o.field) ? { resetValue: [] } : Se(o.field) ? { resetValue: {} } : {}
|
|
224
|
+
});
|
|
225
|
+
let Ye = ye.value;
|
|
226
|
+
const ro = B || E ? Xe : () => {
|
|
227
|
+
Xe();
|
|
228
|
+
const c = ye.value;
|
|
229
|
+
c !== Ye && (Ye = c, s("update", p.value, c));
|
|
230
|
+
}, Ge = f(() => {
|
|
231
|
+
const c = x(o.field.path);
|
|
232
|
+
return (c ? a?.value?.[c] : void 0) ?? o.error ?? io.value;
|
|
233
|
+
}), so = {
|
|
234
|
+
onBlur: ro,
|
|
235
|
+
model: {
|
|
236
|
+
get value() {
|
|
237
|
+
return ye.value;
|
|
238
|
+
},
|
|
239
|
+
set value(c) {
|
|
240
|
+
ye.value = c;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
type: o.field.type,
|
|
244
|
+
altAction: $e,
|
|
245
|
+
name: o.field.name,
|
|
246
|
+
field: o.field,
|
|
247
|
+
maxLength: se,
|
|
248
|
+
autocomplete: D,
|
|
249
|
+
level: B ? M : void 0
|
|
250
|
+
}, uo = f(() => ({
|
|
251
|
+
value: u(Ee),
|
|
252
|
+
label: u(ve),
|
|
253
|
+
description: u(Fe),
|
|
254
|
+
hint: u(Ce),
|
|
255
|
+
placeholder: u(Re),
|
|
256
|
+
style: u(Oe),
|
|
257
|
+
optional: u(te),
|
|
258
|
+
onToggleOptional: u(te) ? ue : void 0,
|
|
259
|
+
required: me !== void 0 ? u(me) : void 0,
|
|
260
|
+
disabled: u(K),
|
|
261
|
+
hidden: u(ce),
|
|
262
|
+
readonly: u(Z),
|
|
263
|
+
options: u(Ve),
|
|
264
|
+
title: u(Le),
|
|
265
|
+
onRemove: o.onRemove,
|
|
266
|
+
canRemove: o.canRemove,
|
|
267
|
+
removeLabel: o.removeLabel,
|
|
268
|
+
arrayIndex: o.arrayIndex,
|
|
269
|
+
...u(we)
|
|
270
|
+
})), co = f(() => ({
|
|
271
|
+
...so,
|
|
272
|
+
...uo.value,
|
|
273
|
+
error: Ge.value,
|
|
274
|
+
class: { ...u(Ae), error: !!Ge.value }
|
|
257
275
|
}));
|
|
258
|
-
return (
|
|
259
|
-
modelValue: x(t).formData[e.field],
|
|
260
|
-
"onUpdate:modelValue": k[0] || (k[0] = (S) => x(t).formData[e.field] = S),
|
|
261
|
-
rules: x(j)
|
|
262
|
-
}, {
|
|
263
|
-
default: K((S) => [
|
|
264
|
-
w(i.$slots, "default", {
|
|
265
|
-
onBlur: S.onBlur,
|
|
266
|
-
error: o.error || S.error,
|
|
267
|
-
model: S.model,
|
|
268
|
-
formData: x(t).formData,
|
|
269
|
-
formContext: x(t).formContext,
|
|
270
|
-
label: x(u),
|
|
271
|
-
description: x(d),
|
|
272
|
-
hint: x(A),
|
|
273
|
-
placeholder: x(v),
|
|
274
|
-
classes: F(o.error, S.error),
|
|
275
|
-
styles: x(C),
|
|
276
|
-
optional: x(l),
|
|
277
|
-
disabled: x(c),
|
|
278
|
-
hidden: x(m),
|
|
279
|
-
readonly: x(p),
|
|
280
|
-
type: o.type,
|
|
281
|
-
altAction: o.altAction,
|
|
282
|
-
component: o.component,
|
|
283
|
-
vName: o.name,
|
|
284
|
-
field: o.field,
|
|
285
|
-
options: x(E),
|
|
286
|
-
maxLength: o.maxLength,
|
|
287
|
-
required: f.value,
|
|
288
|
-
autocomplete: o.autocomplete,
|
|
289
|
-
attrs: D.value
|
|
290
|
-
})
|
|
291
|
-
]),
|
|
292
|
-
_: 3
|
|
293
|
-
}, 8, ["modelValue", "rules"]));
|
|
276
|
+
return (c, z) => We.value ? (n(), w(mo(We.value), ae({ key: 0 }, co.value, { onAction: l(d) }), null, 16, ["onAction"])) : (n(), m("div", Ao, " [" + g(u(l(ve))) + '] No component for type "' + g(e.field.type) + '"' + g(l(Y) ? ` (component "${l(Y)}" not supplied)` : ""), 1));
|
|
294
277
|
}
|
|
295
|
-
}),
|
|
296
|
-
key: 0,
|
|
297
|
-
value: "",
|
|
298
|
-
disabled: ""
|
|
299
|
-
}, Fe = ["value"], De = { class: "oo-error-slot" }, je = { class: "oo-field-label" }, Pe = { key: 0 }, Oe = { class: "oo-radio-group" }, Ue = ["value", "onUpdate:modelValue", "onBlur", "name", "disabled", "readonly"], qe = { class: "oo-error-slot" }, Me = ["onUpdate:modelValue", "onBlur", "name", "disabled", "readonly"], Ne = { key: 0 }, Ie = { class: "oo-error-slot" }, ze = ["onClick"], He = { key: 9 }, Re = ["disabled"], ut = /* @__PURE__ */ I({
|
|
278
|
+
}), Eo = ["disabled"], St = /* @__PURE__ */ A({
|
|
300
279
|
__name: "oo-form",
|
|
301
280
|
props: {
|
|
302
|
-
|
|
281
|
+
def: {},
|
|
303
282
|
formData: {},
|
|
304
283
|
formContext: {},
|
|
305
284
|
firstValidation: {},
|
|
@@ -307,789 +286,1306 @@ const ke = /* @__PURE__ */ I({
|
|
|
307
286
|
types: {},
|
|
308
287
|
errors: {}
|
|
309
288
|
},
|
|
310
|
-
emits: ["submit", "action", "unsupported-action"],
|
|
311
|
-
setup(
|
|
312
|
-
const t =
|
|
289
|
+
emits: ["submit", "error", "action", "unsupported-action", "change"],
|
|
290
|
+
setup(e, { emit: o }) {
|
|
291
|
+
const t = e, r = J({}), a = f(() => t.formData || r.value);
|
|
292
|
+
function d() {
|
|
293
|
+
return a.value.value;
|
|
294
|
+
}
|
|
295
|
+
const s = f(() => Ro(t.def)), { clearErrors: v, reset: b, submit: O, setErrors: x } = Bo({
|
|
296
|
+
formData: a,
|
|
297
|
+
formContext: f(() => t.formContext),
|
|
298
|
+
firstValidation: f(() => t.firstValidation),
|
|
299
|
+
submitValidator: () => s.value({
|
|
300
|
+
data: d(),
|
|
301
|
+
context: t.formContext ?? {}
|
|
302
|
+
})
|
|
303
|
+
});
|
|
304
|
+
q(
|
|
305
|
+
"__foorm_root_data",
|
|
306
|
+
f(() => a.value)
|
|
307
|
+
), q(
|
|
308
|
+
"__foorm_path_prefix",
|
|
309
|
+
f(() => "")
|
|
310
|
+
), q(
|
|
311
|
+
"__foorm_types",
|
|
312
|
+
f(() => t.types)
|
|
313
|
+
), q(
|
|
314
|
+
"__foorm_components",
|
|
315
|
+
f(() => t.components)
|
|
316
|
+
), q(
|
|
317
|
+
"__foorm_errors",
|
|
318
|
+
f(() => t.errors)
|
|
319
|
+
);
|
|
320
|
+
const $ = f(() => ({
|
|
313
321
|
v: void 0,
|
|
314
|
-
data:
|
|
322
|
+
data: d(),
|
|
315
323
|
context: t.formContext ?? {},
|
|
316
324
|
entry: void 0
|
|
317
|
-
})),
|
|
318
|
-
|
|
319
|
-
|
|
325
|
+
})), F = f(
|
|
326
|
+
() => Qe(
|
|
327
|
+
t.def.type,
|
|
328
|
+
"foorm.fn.submit.text",
|
|
329
|
+
"foorm.submit.text",
|
|
330
|
+
$.value
|
|
331
|
+
) ?? "Submit"
|
|
332
|
+
), h = f(
|
|
333
|
+
() => Qe(
|
|
334
|
+
t.def.type,
|
|
335
|
+
"foorm.fn.submit.disabled",
|
|
336
|
+
"foorm.submit.disabled",
|
|
337
|
+
$.value
|
|
338
|
+
) ?? !1
|
|
339
|
+
), p = o, B = () => fo(d());
|
|
340
|
+
function E(u) {
|
|
341
|
+
Lo(t.def, u) ? p("action", u, B()) : p("unsupported-action", u, B());
|
|
320
342
|
}
|
|
321
|
-
|
|
322
|
-
function
|
|
323
|
-
|
|
343
|
+
q("__foorm_action_handler", E);
|
|
344
|
+
function j(u, R, P) {
|
|
345
|
+
p("change", u, R, P, B());
|
|
324
346
|
}
|
|
325
|
-
|
|
326
|
-
|
|
347
|
+
q("__foorm_change_handler", j);
|
|
348
|
+
function M() {
|
|
349
|
+
const u = O();
|
|
350
|
+
u === !0 ? p("submit", B()) : p("error", u);
|
|
327
351
|
}
|
|
328
|
-
return (
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
"form
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
error: n.error,
|
|
363
|
-
model: n.model,
|
|
364
|
-
"form-data": n.formData,
|
|
365
|
-
"form-context": n.formContext,
|
|
366
|
-
label: n.label,
|
|
367
|
-
description: n.description,
|
|
368
|
-
hint: n.hint,
|
|
369
|
-
placeholder: n.placeholder,
|
|
370
|
-
class: n.classes,
|
|
371
|
-
style: n.styles,
|
|
372
|
-
optional: n.optional,
|
|
373
|
-
required: !n.required,
|
|
374
|
-
disabled: n.disabled,
|
|
375
|
-
hidden: n.hidden,
|
|
376
|
-
type: n.type,
|
|
377
|
-
"alt-action": n.altAction,
|
|
378
|
-
name: n.vName,
|
|
379
|
-
field: n,
|
|
380
|
-
options: n.options,
|
|
381
|
-
"max-length": n.maxLength,
|
|
382
|
-
autocomplete: n.autocomplete,
|
|
383
|
-
onAction: p
|
|
384
|
-
}, { ref_for: !0 }, n.attrs, {
|
|
385
|
-
modelValue: n.model.value,
|
|
386
|
-
"onUpdate:modelValue": (i) => n.model.value = i
|
|
387
|
-
}), null, 16, ["on-blur", "error", "model", "form-data", "form-context", "label", "description", "hint", "placeholder", "class", "style", "optional", "required", "disabled", "hidden", "type", "alt-action", "name", "field", "options", "max-length", "autocomplete", "modelValue", "onUpdate:modelValue"])) : E.component && !((D = t.components) != null && D[E.component]) ? (y(), b("div", $e, " [" + g(n.label) + '] Component "' + g(n.component) + '" not supplied ', 1)) : (j = t.types) != null && j[E.type] ? (y(), U(J(t.types[E.type]), L({
|
|
388
|
-
key: 2,
|
|
389
|
-
"on-blur": n.onBlur,
|
|
390
|
-
error: n.error,
|
|
391
|
-
model: n.model,
|
|
392
|
-
"form-data": n.formData,
|
|
393
|
-
"form-context": n.formContext,
|
|
394
|
-
label: n.label,
|
|
395
|
-
description: n.description,
|
|
396
|
-
hint: n.hint,
|
|
397
|
-
placeholder: n.placeholder,
|
|
398
|
-
class: n.classes,
|
|
399
|
-
style: n.styles,
|
|
400
|
-
optional: n.optional,
|
|
401
|
-
required: !n.required,
|
|
402
|
-
disabled: n.disabled,
|
|
403
|
-
hidden: n.hidden,
|
|
404
|
-
type: n.type,
|
|
405
|
-
"alt-action": n.altAction,
|
|
406
|
-
name: n.vName,
|
|
407
|
-
field: n,
|
|
408
|
-
options: n.options,
|
|
409
|
-
"max-length": n.maxLength,
|
|
410
|
-
autocomplete: n.autocomplete,
|
|
411
|
-
onAction: p
|
|
412
|
-
}, { ref_for: !0 }, n.attrs, {
|
|
413
|
-
modelValue: n.model.value,
|
|
414
|
-
"onUpdate:modelValue": (i) => n.model.value = i
|
|
415
|
-
}), null, 16, ["on-blur", "error", "model", "form-data", "form-context", "label", "description", "hint", "placeholder", "class", "style", "optional", "required", "disabled", "hidden", "type", "alt-action", "name", "field", "options", "max-length", "autocomplete", "modelValue", "onUpdate:modelValue"])) : ["text", "password", "number"].includes(n.type) ? T((y(), b("div", {
|
|
416
|
-
key: 3,
|
|
417
|
-
class: O(["oo-default-field", n.classes])
|
|
418
|
-
}, [
|
|
419
|
-
V("label", null, g(n.label), 1),
|
|
420
|
-
n.description ? (y(), b("span", Ae, g(n.description), 1)) : P("", !0),
|
|
421
|
-
T(V("input", L({
|
|
422
|
-
"onUpdate:modelValue": (i) => n.model.value = i,
|
|
423
|
-
onBlur: n.onBlur,
|
|
424
|
-
placeholder: n.placeholder,
|
|
425
|
-
autocomplete: n.autocomplete,
|
|
426
|
-
name: n.vName,
|
|
427
|
-
type: n.type,
|
|
428
|
-
disabled: n.disabled,
|
|
429
|
-
readonly: n.readonly
|
|
430
|
-
}, { ref_for: !0 }, n.attrs), null, 16, Se), [
|
|
431
|
-
[de, n.model.value]
|
|
432
|
-
]),
|
|
433
|
-
V("div", we, g(n.error || n.hint), 1)
|
|
434
|
-
], 2)), [
|
|
435
|
-
[N, !n.hidden]
|
|
436
|
-
]) : n.type === "paragraph" ? (y(), b("p", Ce, g(n.description), 1)) : n.type === "select" ? T((y(), b("div", {
|
|
437
|
-
key: 5,
|
|
438
|
-
class: O(["oo-default-field", n.classes])
|
|
439
|
-
}, [
|
|
440
|
-
V("label", null, g(n.label), 1),
|
|
441
|
-
n.description ? (y(), b("span", Le, g(n.description), 1)) : P("", !0),
|
|
442
|
-
T(V("select", L({
|
|
443
|
-
"onUpdate:modelValue": (i) => n.model.value = i,
|
|
444
|
-
onBlur: n.onBlur,
|
|
445
|
-
name: n.vName,
|
|
446
|
-
disabled: n.disabled,
|
|
447
|
-
readonly: n.readonly
|
|
448
|
-
}, { ref_for: !0 }, n.attrs), [
|
|
449
|
-
n.placeholder ? (y(), b("option", Be, g(n.placeholder), 1)) : P("", !0),
|
|
450
|
-
(y(!0), b(H, null, R(n.options, (i) => (y(), b("option", {
|
|
451
|
-
key: h(i),
|
|
452
|
-
value: h(i)
|
|
453
|
-
}, g(u(i)), 9, Fe))), 128))
|
|
454
|
-
], 16, Te), [
|
|
455
|
-
[me, n.model.value]
|
|
456
|
-
]),
|
|
457
|
-
V("div", De, g(n.error || n.hint), 1)
|
|
458
|
-
], 2)), [
|
|
459
|
-
[N, !n.hidden]
|
|
460
|
-
]) : n.type === "radio" ? T((y(), b("div", {
|
|
461
|
-
key: 6,
|
|
462
|
-
class: O(["oo-default-field oo-radio-field", n.classes])
|
|
463
|
-
}, [
|
|
464
|
-
V("span", je, g(n.label), 1),
|
|
465
|
-
n.description ? (y(), b("span", Pe, g(n.description), 1)) : P("", !0),
|
|
466
|
-
V("div", Oe, [
|
|
467
|
-
(y(!0), b(H, null, R(n.options, (i) => (y(), b("label", {
|
|
468
|
-
key: h(i)
|
|
469
|
-
}, [
|
|
470
|
-
T(V("input", L({
|
|
471
|
-
type: "radio",
|
|
472
|
-
value: h(i),
|
|
473
|
-
"onUpdate:modelValue": (k) => n.model.value = k,
|
|
474
|
-
onBlur: n.onBlur,
|
|
475
|
-
name: n.vName,
|
|
476
|
-
disabled: n.disabled,
|
|
477
|
-
readonly: n.readonly
|
|
478
|
-
}, { ref_for: !0 }, n.attrs), null, 16, Ue), [
|
|
479
|
-
[fe, n.model.value]
|
|
480
|
-
]),
|
|
481
|
-
Z(" " + g(u(i)), 1)
|
|
482
|
-
]))), 128))
|
|
483
|
-
]),
|
|
484
|
-
V("div", qe, g(n.error || n.hint), 1)
|
|
485
|
-
], 2)), [
|
|
486
|
-
[N, !n.hidden]
|
|
487
|
-
]) : n.type === "checkbox" ? T((y(), b("div", {
|
|
488
|
-
key: 7,
|
|
489
|
-
class: O(["oo-default-field oo-checkbox-field", n.classes])
|
|
490
|
-
}, [
|
|
491
|
-
V("label", null, [
|
|
492
|
-
T(V("input", L({
|
|
493
|
-
type: "checkbox",
|
|
494
|
-
"onUpdate:modelValue": (i) => n.model.value = i,
|
|
495
|
-
onBlur: n.onBlur,
|
|
496
|
-
name: n.vName,
|
|
497
|
-
disabled: n.disabled,
|
|
498
|
-
readonly: n.readonly
|
|
499
|
-
}, { ref_for: !0 }, n.attrs), null, 16, Me), [
|
|
500
|
-
[he, n.model.value]
|
|
501
|
-
]),
|
|
502
|
-
Z(" " + g(n.label), 1)
|
|
503
|
-
]),
|
|
504
|
-
n.description ? (y(), b("span", Ne, g(n.description), 1)) : P("", !0),
|
|
505
|
-
V("div", Ie, g(n.error || n.hint), 1)
|
|
506
|
-
], 2)), [
|
|
507
|
-
[N, !n.hidden]
|
|
508
|
-
]) : n.type === "action" ? (y(), b("div", {
|
|
509
|
-
key: 8,
|
|
510
|
-
class: O(["oo-default-field oo-action-field", n.classes])
|
|
511
|
-
}, [
|
|
512
|
-
V("button", {
|
|
513
|
-
type: "button",
|
|
514
|
-
onClick: (i) => p(n.altAction)
|
|
515
|
-
}, g(n.label), 9, ze)
|
|
516
|
-
], 2)) : (y(), b("div", He, " [" + g(n.label) + '] Not supported field type "' + g(n.type) + '" ' + g(n.component), 1))
|
|
517
|
-
];
|
|
518
|
-
})
|
|
519
|
-
]),
|
|
520
|
-
_: 2
|
|
521
|
-
}, 1040, ["error"]);
|
|
522
|
-
}), 128)),
|
|
523
|
-
w(d.$slots, "form.after", {
|
|
524
|
-
clearErrors: v.clearErrors,
|
|
525
|
-
reset: v.reset,
|
|
526
|
-
disabled: m.value,
|
|
527
|
-
formContext: o.formContext
|
|
528
|
-
}),
|
|
529
|
-
w(d.$slots, "form.submit", {
|
|
530
|
-
disabled: m.value,
|
|
531
|
-
text: c.value,
|
|
532
|
-
clearErrors: v.clearErrors,
|
|
533
|
-
reset: v.reset,
|
|
534
|
-
formContext: o.formContext
|
|
535
|
-
}, () => [
|
|
536
|
-
V("button", { disabled: m.value }, g(c.value), 9, Re)
|
|
537
|
-
]),
|
|
538
|
-
w(d.$slots, "form.footer", {
|
|
539
|
-
disabled: m.value,
|
|
540
|
-
clearErrors: v.clearErrors,
|
|
541
|
-
reset: v.reset,
|
|
542
|
-
formContext: o.formContext
|
|
543
|
-
})
|
|
352
|
+
return (u, R) => (n(), m("form", {
|
|
353
|
+
onSubmit: Ze(M, ["prevent"])
|
|
354
|
+
}, [
|
|
355
|
+
W(u.$slots, "form.header", {
|
|
356
|
+
clearErrors: l(v),
|
|
357
|
+
reset: l(b),
|
|
358
|
+
setErrors: l(x),
|
|
359
|
+
formContext: e.formContext,
|
|
360
|
+
disabled: h.value
|
|
361
|
+
}),
|
|
362
|
+
W(u.$slots, "form.before", {
|
|
363
|
+
clearErrors: l(v),
|
|
364
|
+
reset: l(b),
|
|
365
|
+
setErrors: l(x)
|
|
366
|
+
}),
|
|
367
|
+
ie(de, {
|
|
368
|
+
field: e.def.rootField
|
|
369
|
+
}, null, 8, ["field"]),
|
|
370
|
+
W(u.$slots, "form.after", {
|
|
371
|
+
clearErrors: l(v),
|
|
372
|
+
reset: l(b),
|
|
373
|
+
setErrors: l(x),
|
|
374
|
+
disabled: h.value,
|
|
375
|
+
formContext: e.formContext
|
|
376
|
+
}),
|
|
377
|
+
W(u.$slots, "form.submit", {
|
|
378
|
+
disabled: h.value,
|
|
379
|
+
text: F.value,
|
|
380
|
+
clearErrors: l(v),
|
|
381
|
+
reset: l(b),
|
|
382
|
+
setErrors: l(x),
|
|
383
|
+
formContext: e.formContext
|
|
384
|
+
}, () => [
|
|
385
|
+
L("button", { disabled: h.value }, g(F.value), 9, Eo)
|
|
544
386
|
]),
|
|
545
|
-
|
|
546
|
-
|
|
387
|
+
W(u.$slots, "form.footer", {
|
|
388
|
+
disabled: h.value,
|
|
389
|
+
clearErrors: l(v),
|
|
390
|
+
reset: l(b),
|
|
391
|
+
setErrors: l(x),
|
|
392
|
+
formContext: e.formContext
|
|
393
|
+
})
|
|
394
|
+
], 32));
|
|
547
395
|
}
|
|
548
|
-
}),
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
window: null,
|
|
570
|
-
self: null,
|
|
571
|
-
document: null,
|
|
572
|
-
localStorage: null,
|
|
573
|
-
sessionStorage: null,
|
|
574
|
-
indexedDB: null,
|
|
575
|
-
caches: null,
|
|
576
|
-
console: null,
|
|
577
|
-
performance: null,
|
|
578
|
-
fetch: null,
|
|
579
|
-
XMLHttpRequest: null,
|
|
580
|
-
Image: null,
|
|
581
|
-
Audio: null,
|
|
582
|
-
navigator: null,
|
|
583
|
-
navigation: null,
|
|
584
|
-
location: null,
|
|
585
|
-
history: null,
|
|
586
|
-
screen: null,
|
|
587
|
-
requestAnimationFrame: null,
|
|
588
|
-
cancelAnimationFrame: null,
|
|
589
|
-
cancelIdleCallback: null,
|
|
590
|
-
captureEvents: null,
|
|
591
|
-
chrome: null,
|
|
592
|
-
clientInformation: null,
|
|
593
|
-
addEventListener: null,
|
|
594
|
-
removeEventListener: null,
|
|
595
|
-
blur: null,
|
|
596
|
-
close: null,
|
|
597
|
-
closed: null,
|
|
598
|
-
confirm: null,
|
|
599
|
-
alert: null,
|
|
600
|
-
customElements: null,
|
|
601
|
-
dispatchEvent: null,
|
|
602
|
-
debug: null,
|
|
603
|
-
focus: null,
|
|
604
|
-
find: null,
|
|
605
|
-
frames: null,
|
|
606
|
-
getSelection: null,
|
|
607
|
-
getScreenDetails: null,
|
|
608
|
-
getEventListeners: null,
|
|
609
|
-
keys: null,
|
|
610
|
-
launchQueue: null,
|
|
611
|
-
parent: null,
|
|
612
|
-
postMessage: null,
|
|
613
|
-
print: null,
|
|
614
|
-
profile: null,
|
|
615
|
-
profileEnd: null,
|
|
616
|
-
prompt: null,
|
|
617
|
-
queryLocalFonts: null,
|
|
618
|
-
queryObjects: null,
|
|
619
|
-
releaseEvents: null,
|
|
620
|
-
reportError: null,
|
|
621
|
-
resizeBy: null,
|
|
622
|
-
resizeTo: null,
|
|
623
|
-
scheduler: null,
|
|
624
|
-
stop: null,
|
|
625
|
-
scroll: null,
|
|
626
|
-
scrollBy: null,
|
|
627
|
-
scrollTo: null,
|
|
628
|
-
scrollY: null,
|
|
629
|
-
scrollX: null,
|
|
630
|
-
top: null,
|
|
631
|
-
// other
|
|
632
|
-
eval: null,
|
|
633
|
-
__ctx__: null
|
|
634
|
-
};
|
|
635
|
-
class Ke {
|
|
636
|
-
constructor() {
|
|
637
|
-
Y(this, "cache", /* @__PURE__ */ new Map());
|
|
396
|
+
}), Po = /* @__PURE__ */ A({
|
|
397
|
+
__name: "oo-iterator",
|
|
398
|
+
props: {
|
|
399
|
+
def: {},
|
|
400
|
+
pathPrefix: {},
|
|
401
|
+
onRemove: { type: Function },
|
|
402
|
+
canRemove: { type: Boolean },
|
|
403
|
+
removeLabel: {}
|
|
404
|
+
},
|
|
405
|
+
setup(e) {
|
|
406
|
+
const o = e, t = I(
|
|
407
|
+
"__foorm_path_prefix",
|
|
408
|
+
f(() => "")
|
|
409
|
+
), r = f(() => o.pathPrefix !== void 0 ? t.value ? `${t.value}.${o.pathPrefix}` : o.pathPrefix : t.value);
|
|
410
|
+
return q("__foorm_path_prefix", r), (a, d) => (n(!0), m(T, null, X(e.def.fields, (s) => (n(), w(de, {
|
|
411
|
+
key: s.path ?? s.name,
|
|
412
|
+
field: s,
|
|
413
|
+
"on-remove": e.onRemove,
|
|
414
|
+
"can-remove": e.canRemove,
|
|
415
|
+
"remove-label": e.removeLabel
|
|
416
|
+
}, null, 8, ["field", "on-remove", "can-remove", "remove-label"]))), 128));
|
|
638
417
|
}
|
|
639
|
-
|
|
640
|
-
|
|
418
|
+
}), Io = { class: "oo-no-data-text" }, ee = /* @__PURE__ */ A({
|
|
419
|
+
__name: "oo-no-data",
|
|
420
|
+
props: {
|
|
421
|
+
onEdit: { type: Function }
|
|
422
|
+
},
|
|
423
|
+
setup(e) {
|
|
424
|
+
const o = J(!1);
|
|
425
|
+
return (t, r) => (n(), m("div", {
|
|
426
|
+
class: "oo-no-data",
|
|
427
|
+
onMouseenter: r[0] || (r[0] = (a) => o.value = !0),
|
|
428
|
+
onMouseleave: r[1] || (r[1] = (a) => o.value = !1),
|
|
429
|
+
onClick: r[2] || (r[2] = //@ts-ignore
|
|
430
|
+
(...a) => e.onEdit && e.onEdit(...a)),
|
|
431
|
+
role: "button",
|
|
432
|
+
tabindex: "0",
|
|
433
|
+
onKeydown: [
|
|
434
|
+
r[3] || (r[3] = Je(
|
|
435
|
+
//@ts-ignore
|
|
436
|
+
(...a) => e.onEdit && e.onEdit(...a),
|
|
437
|
+
["enter"]
|
|
438
|
+
)),
|
|
439
|
+
r[4] || (r[4] = Je(Ze(
|
|
440
|
+
//@ts-ignore
|
|
441
|
+
(...a) => e.onEdit && e.onEdit(...a),
|
|
442
|
+
["prevent"]
|
|
443
|
+
), ["space"]))
|
|
444
|
+
]
|
|
445
|
+
}, [
|
|
446
|
+
L("span", Io, g(o.value ? "Edit" : "No Data"), 1)
|
|
447
|
+
], 32));
|
|
641
448
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
449
|
+
});
|
|
450
|
+
function Ke(e) {
|
|
451
|
+
const o = J(!1);
|
|
452
|
+
function t() {
|
|
453
|
+
o.value = !o.value;
|
|
645
454
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
const e = `with(__ctx__){
|
|
649
|
-
${o}
|
|
650
|
-
}`, t = new Function("__ctx__", e);
|
|
651
|
-
return (r) => {
|
|
652
|
-
const s = Object.freeze(Object.assign({}, Ge, r));
|
|
653
|
-
return t(s);
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
const W = new Ke();
|
|
657
|
-
function ne(o) {
|
|
658
|
-
const e = `return (${o})(v, data, context, entry)`;
|
|
659
|
-
return W.getFn(e);
|
|
660
|
-
}
|
|
661
|
-
function G(o) {
|
|
662
|
-
const e = `return (${o})(data, context)`;
|
|
663
|
-
return W.getFn(e);
|
|
664
|
-
}
|
|
665
|
-
function Xe(o) {
|
|
666
|
-
const e = `return (${o})(v, data, context, entry)`;
|
|
667
|
-
return W.getFn(e);
|
|
668
|
-
}
|
|
669
|
-
function Ye(o, e) {
|
|
670
|
-
switch (o.type.kind) {
|
|
671
|
-
case "": {
|
|
672
|
-
const t = o;
|
|
673
|
-
return e.phantom && t.type.designType === "phantom" ? e.phantom(t) : e.final(t);
|
|
674
|
-
}
|
|
675
|
-
case "object":
|
|
676
|
-
return e.object(o);
|
|
677
|
-
case "array":
|
|
678
|
-
return e.array(o);
|
|
679
|
-
case "union":
|
|
680
|
-
return e.union(o);
|
|
681
|
-
case "intersection":
|
|
682
|
-
return e.intersection(o);
|
|
683
|
-
case "tuple":
|
|
684
|
-
return e.tuple(o);
|
|
685
|
-
default:
|
|
686
|
-
throw new Error(`Unknown type kind "${o.type.kind}"`);
|
|
455
|
+
function r() {
|
|
456
|
+
o.value = !1;
|
|
687
457
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return e in o ? Object.defineProperty(o, e, {
|
|
691
|
-
value: t,
|
|
692
|
-
enumerable: !0,
|
|
693
|
-
configurable: !0,
|
|
694
|
-
writable: !0
|
|
695
|
-
}) : o[e] = t, o;
|
|
696
|
-
}
|
|
697
|
-
const ee = /* @__PURE__ */ new Map();
|
|
698
|
-
var Qe = class {
|
|
699
|
-
isLimitExceeded() {
|
|
700
|
-
return this.stackErrors.length > 0 ? this.stackErrors[this.stackErrors.length - 1].length >= this.opts.errorLimit : this.errors.length >= this.opts.errorLimit;
|
|
458
|
+
function a(s) {
|
|
459
|
+
s(), r();
|
|
701
460
|
}
|
|
702
|
-
|
|
703
|
-
|
|
461
|
+
function d(s) {
|
|
462
|
+
e.value && !e.value.contains(s.target) && r();
|
|
704
463
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
464
|
+
return Ue(o, (s) => {
|
|
465
|
+
s ? document.addEventListener("click", d, !0) : document.removeEventListener("click", d, !0);
|
|
466
|
+
}), yo(() => document.removeEventListener("click", d, !0)), { isOpen: o, toggle: t, close: r, select: a };
|
|
467
|
+
}
|
|
468
|
+
const To = ["disabled", "title"], Do = {
|
|
469
|
+
key: 0,
|
|
470
|
+
class: "oo-dropdown-menu"
|
|
471
|
+
}, So = ["onClick"], no = /* @__PURE__ */ A({
|
|
472
|
+
__name: "oo-variant-picker",
|
|
473
|
+
props: {
|
|
474
|
+
unionContext: {},
|
|
475
|
+
disabled: { type: Boolean }
|
|
476
|
+
},
|
|
477
|
+
setup(e) {
|
|
478
|
+
const o = J(null), { isOpen: t, toggle: r, select: a } = Ke(o);
|
|
479
|
+
function d(s, v) {
|
|
480
|
+
a(() => s.changeVariant(v));
|
|
481
|
+
}
|
|
482
|
+
return (s, v) => (n(), m("div", {
|
|
483
|
+
ref_key: "dropdownRef",
|
|
484
|
+
ref: o,
|
|
485
|
+
class: "oo-dropdown"
|
|
486
|
+
}, [
|
|
487
|
+
L("button", {
|
|
488
|
+
type: "button",
|
|
489
|
+
class: "oo-variant-trigger",
|
|
490
|
+
disabled: e.disabled,
|
|
491
|
+
title: e.unionContext.variants[e.unionContext.currentIndex.value]?.label ?? "Switch variant",
|
|
492
|
+
onClick: v[0] || (v[0] = //@ts-ignore
|
|
493
|
+
(...b) => l(r) && l(r)(...b))
|
|
494
|
+
}, [...v[1] || (v[1] = [
|
|
495
|
+
L("svg", {
|
|
496
|
+
width: "14",
|
|
497
|
+
height: "14",
|
|
498
|
+
viewBox: "0 0 16 16",
|
|
499
|
+
fill: "none"
|
|
500
|
+
}, [
|
|
501
|
+
L("circle", {
|
|
502
|
+
cx: "3",
|
|
503
|
+
cy: "8",
|
|
504
|
+
r: "1.5",
|
|
505
|
+
fill: "currentColor"
|
|
506
|
+
}),
|
|
507
|
+
L("circle", {
|
|
508
|
+
cx: "8",
|
|
509
|
+
cy: "8",
|
|
510
|
+
r: "1.5",
|
|
511
|
+
fill: "currentColor"
|
|
512
|
+
}),
|
|
513
|
+
L("circle", {
|
|
514
|
+
cx: "13",
|
|
515
|
+
cy: "8",
|
|
516
|
+
r: "1.5",
|
|
517
|
+
fill: "currentColor"
|
|
518
|
+
})
|
|
519
|
+
], -1)
|
|
520
|
+
])], 8, To),
|
|
521
|
+
l(t) ? (n(), m("div", Do, [
|
|
522
|
+
(n(!0), m(T, null, X(e.unionContext.variants, (b, O) => (n(), m("button", {
|
|
523
|
+
key: O,
|
|
524
|
+
type: "button",
|
|
525
|
+
class: re(["oo-dropdown-item", { "oo-dropdown-item--active": e.unionContext.currentIndex.value === O }]),
|
|
526
|
+
onClick: (x) => d(e.unionContext, O)
|
|
527
|
+
}, g(b.label), 11, So))), 128))
|
|
528
|
+
])) : k("", !0)
|
|
529
|
+
], 512));
|
|
711
530
|
}
|
|
712
|
-
|
|
713
|
-
|
|
531
|
+
}), qo = {
|
|
532
|
+
key: 0,
|
|
533
|
+
class: "oo-field-header-row"
|
|
534
|
+
}, Mo = { class: "oo-field-header-content" }, Uo = {
|
|
535
|
+
key: 0,
|
|
536
|
+
class: "oo-field-header-actions"
|
|
537
|
+
}, jo = ["disabled", "aria-label"], No = { class: "oo-field-input-row" }, Ko = ["role"], ke = /* @__PURE__ */ A({
|
|
538
|
+
__name: "oo-field-shell",
|
|
539
|
+
props: {
|
|
540
|
+
onBlur: { type: Function },
|
|
541
|
+
error: {},
|
|
542
|
+
model: {},
|
|
543
|
+
value: {},
|
|
544
|
+
label: {},
|
|
545
|
+
description: {},
|
|
546
|
+
hint: {},
|
|
547
|
+
placeholder: {},
|
|
548
|
+
class: {},
|
|
549
|
+
style: {},
|
|
550
|
+
optional: { type: Boolean },
|
|
551
|
+
onToggleOptional: { type: Function },
|
|
552
|
+
required: { type: Boolean },
|
|
553
|
+
readonly: { type: Boolean },
|
|
554
|
+
type: {},
|
|
555
|
+
altAction: {},
|
|
556
|
+
name: {},
|
|
557
|
+
field: {},
|
|
558
|
+
options: {},
|
|
559
|
+
maxLength: {},
|
|
560
|
+
autocomplete: {},
|
|
561
|
+
title: {},
|
|
562
|
+
level: {},
|
|
563
|
+
onRemove: { type: Function },
|
|
564
|
+
canRemove: { type: Boolean },
|
|
565
|
+
removeLabel: {},
|
|
566
|
+
arrayIndex: {},
|
|
567
|
+
disabled: { type: Boolean },
|
|
568
|
+
hidden: { type: Boolean },
|
|
569
|
+
fieldClass: {},
|
|
570
|
+
idPrefix: {}
|
|
571
|
+
},
|
|
572
|
+
setup(e) {
|
|
573
|
+
const o = e, t = bo(), r = o.idPrefix ?? "oo-field", a = `${r}-${t}`, d = `${r}-${t}-err`, s = `${r}-${t}-desc`, v = f(() => o.model?.value !== void 0), b = Be(), O = b !== void 0 && b.variants.length > 1, x = f(() => to(o.label, o.arrayIndex));
|
|
574
|
+
return ($, F) => N((n(), m("div", {
|
|
575
|
+
class: re(["oo-default-field", [e.fieldClass, $.$props.class]])
|
|
576
|
+
}, [
|
|
577
|
+
x.value || e.onRemove || e.optional && v.value || l(O) || $.$slots.header ? (n(), m("div", qo, [
|
|
578
|
+
L("div", Mo, [
|
|
579
|
+
$.$slots.header ? W($.$slots, "header", {
|
|
580
|
+
key: 0,
|
|
581
|
+
inputId: a,
|
|
582
|
+
descId: s,
|
|
583
|
+
optionalEnabled: v.value
|
|
584
|
+
}) : (n(), m(T, { key: 1 }, [
|
|
585
|
+
x.value ? (n(), m("label", {
|
|
586
|
+
key: 0,
|
|
587
|
+
for: a
|
|
588
|
+
}, g(x.value), 1)) : k("", !0),
|
|
589
|
+
e.description ? (n(), m("span", {
|
|
590
|
+
key: 1,
|
|
591
|
+
id: s
|
|
592
|
+
}, g(e.description), 1)) : k("", !0)
|
|
593
|
+
], 64)),
|
|
594
|
+
l(O) ? (n(), w(no, {
|
|
595
|
+
key: 2,
|
|
596
|
+
"union-context": l(b),
|
|
597
|
+
disabled: e.disabled
|
|
598
|
+
}, null, 8, ["union-context", "disabled"])) : k("", !0)
|
|
599
|
+
]),
|
|
600
|
+
e.optional && v.value || e.onRemove ? (n(), m("div", Uo, [
|
|
601
|
+
e.optional && v.value ? (n(), m("button", {
|
|
602
|
+
key: 0,
|
|
603
|
+
type: "button",
|
|
604
|
+
class: "oo-optional-clear",
|
|
605
|
+
onClick: F[0] || (F[0] = (h) => e.onToggleOptional?.(!1))
|
|
606
|
+
}, " × ")) : k("", !0),
|
|
607
|
+
e.onRemove ? (n(), m("button", {
|
|
608
|
+
key: 1,
|
|
609
|
+
type: "button",
|
|
610
|
+
class: "oo-field-remove-btn",
|
|
611
|
+
disabled: !e.canRemove,
|
|
612
|
+
"aria-label": e.removeLabel || "Remove item",
|
|
613
|
+
onClick: F[1] || (F[1] = //@ts-ignore
|
|
614
|
+
(...h) => e.onRemove && e.onRemove(...h))
|
|
615
|
+
}, g(e.removeLabel || "Remove"), 9, jo)) : k("", !0)
|
|
616
|
+
])) : k("", !0)
|
|
617
|
+
])) : k("", !0),
|
|
618
|
+
e.optional && !v.value ? (n(), w(ee, {
|
|
619
|
+
key: 1,
|
|
620
|
+
"on-edit": () => e.onToggleOptional?.(!0)
|
|
621
|
+
}, null, 8, ["on-edit"])) : (n(), m(T, { key: 2 }, [
|
|
622
|
+
L("div", No, [
|
|
623
|
+
W($.$slots, "default", {
|
|
624
|
+
inputId: a,
|
|
625
|
+
errorId: d,
|
|
626
|
+
descId: s
|
|
627
|
+
})
|
|
628
|
+
]),
|
|
629
|
+
W($.$slots, "after-input", { descId: s }),
|
|
630
|
+
L("div", {
|
|
631
|
+
id: d,
|
|
632
|
+
class: "oo-error-slot",
|
|
633
|
+
role: e.error ? "alert" : void 0
|
|
634
|
+
}, g(e.error || e.hint), 9, Ko)
|
|
635
|
+
], 64))
|
|
636
|
+
], 2)), [
|
|
637
|
+
[Q, !e.hidden]
|
|
638
|
+
]);
|
|
714
639
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
|
|
640
|
+
}), zo = ["id", "placeholder", "autocomplete", "name", "type", "disabled", "readonly", "aria-required", "aria-invalid", "aria-describedby", "aria-label"], De = /* @__PURE__ */ A({
|
|
641
|
+
__name: "oo-input",
|
|
642
|
+
props: {
|
|
643
|
+
onBlur: { type: Function },
|
|
644
|
+
error: {},
|
|
645
|
+
model: {},
|
|
646
|
+
value: {},
|
|
647
|
+
label: {},
|
|
648
|
+
description: {},
|
|
649
|
+
hint: {},
|
|
650
|
+
placeholder: {},
|
|
651
|
+
class: {},
|
|
652
|
+
style: {},
|
|
653
|
+
optional: { type: Boolean },
|
|
654
|
+
onToggleOptional: { type: Function },
|
|
655
|
+
required: { type: Boolean },
|
|
656
|
+
readonly: { type: Boolean },
|
|
657
|
+
type: {},
|
|
658
|
+
altAction: {},
|
|
659
|
+
name: {},
|
|
660
|
+
field: {},
|
|
661
|
+
options: {},
|
|
662
|
+
maxLength: {},
|
|
663
|
+
autocomplete: {},
|
|
664
|
+
title: {},
|
|
665
|
+
level: {},
|
|
666
|
+
onRemove: { type: Function },
|
|
667
|
+
canRemove: { type: Boolean },
|
|
668
|
+
removeLabel: {},
|
|
669
|
+
arrayIndex: {},
|
|
670
|
+
disabled: { type: Boolean },
|
|
671
|
+
hidden: { type: Boolean }
|
|
672
|
+
},
|
|
673
|
+
setup(e) {
|
|
674
|
+
return (o, t) => (n(), w(ke, ae(o.$props, { "id-prefix": "oo-input" }), {
|
|
675
|
+
default: H(({ inputId: r, errorId: a, descId: d }) => [
|
|
676
|
+
N(L("input", {
|
|
677
|
+
id: r,
|
|
678
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => e.model.value = s),
|
|
679
|
+
onBlur: t[1] || (t[1] = //@ts-ignore
|
|
680
|
+
(...s) => e.onBlur && e.onBlur(...s)),
|
|
681
|
+
placeholder: e.placeholder,
|
|
682
|
+
autocomplete: e.autocomplete,
|
|
683
|
+
name: e.name,
|
|
684
|
+
type: e.type,
|
|
685
|
+
disabled: e.disabled,
|
|
686
|
+
readonly: e.readonly,
|
|
687
|
+
"aria-required": e.required || void 0,
|
|
688
|
+
"aria-invalid": !!e.error || void 0,
|
|
689
|
+
"aria-describedby": e.error || e.hint ? a : e.description ? d : void 0,
|
|
690
|
+
"aria-label": e.label ? void 0 : e.name
|
|
691
|
+
}, null, 40, zo), [
|
|
692
|
+
[ho, e.model.value]
|
|
693
|
+
])
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
}, 16));
|
|
721
697
|
}
|
|
722
|
-
|
|
723
|
-
|
|
698
|
+
}), Wo = ["id", "name", "disabled", "readonly", "aria-required", "aria-invalid", "aria-describedby", "aria-label"], Xo = {
|
|
699
|
+
key: 0,
|
|
700
|
+
value: "",
|
|
701
|
+
disabled: ""
|
|
702
|
+
}, Yo = ["value"], Go = /* @__PURE__ */ A({
|
|
703
|
+
__name: "oo-select",
|
|
704
|
+
props: {
|
|
705
|
+
onBlur: { type: Function },
|
|
706
|
+
error: {},
|
|
707
|
+
model: {},
|
|
708
|
+
value: {},
|
|
709
|
+
label: {},
|
|
710
|
+
description: {},
|
|
711
|
+
hint: {},
|
|
712
|
+
placeholder: {},
|
|
713
|
+
class: {},
|
|
714
|
+
style: {},
|
|
715
|
+
optional: { type: Boolean },
|
|
716
|
+
onToggleOptional: { type: Function },
|
|
717
|
+
required: { type: Boolean },
|
|
718
|
+
readonly: { type: Boolean },
|
|
719
|
+
type: {},
|
|
720
|
+
altAction: {},
|
|
721
|
+
name: {},
|
|
722
|
+
field: {},
|
|
723
|
+
options: {},
|
|
724
|
+
maxLength: {},
|
|
725
|
+
autocomplete: {},
|
|
726
|
+
title: {},
|
|
727
|
+
level: {},
|
|
728
|
+
onRemove: { type: Function },
|
|
729
|
+
canRemove: { type: Boolean },
|
|
730
|
+
removeLabel: {},
|
|
731
|
+
arrayIndex: {},
|
|
732
|
+
disabled: { type: Boolean },
|
|
733
|
+
hidden: { type: Boolean }
|
|
734
|
+
},
|
|
735
|
+
setup(e) {
|
|
736
|
+
return (o, t) => (n(), w(ke, ae(o.$props, { "id-prefix": "oo-select" }), {
|
|
737
|
+
default: H(({ inputId: r, errorId: a, descId: d }) => [
|
|
738
|
+
N(L("select", {
|
|
739
|
+
id: r,
|
|
740
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => e.model.value = s),
|
|
741
|
+
onChange: t[1] || (t[1] = //@ts-ignore
|
|
742
|
+
(...s) => e.onBlur && e.onBlur(...s)),
|
|
743
|
+
onBlur: t[2] || (t[2] = //@ts-ignore
|
|
744
|
+
(...s) => e.onBlur && e.onBlur(...s)),
|
|
745
|
+
name: e.name,
|
|
746
|
+
disabled: e.disabled,
|
|
747
|
+
readonly: e.readonly,
|
|
748
|
+
"aria-required": e.required || void 0,
|
|
749
|
+
"aria-invalid": !!e.error || void 0,
|
|
750
|
+
"aria-describedby": e.error || e.hint ? a : e.description ? d : void 0,
|
|
751
|
+
"aria-label": e.label ? void 0 : e.name
|
|
752
|
+
}, [
|
|
753
|
+
e.placeholder ? (n(), m("option", Xo, g(e.placeholder), 1)) : k("", !0),
|
|
754
|
+
(n(!0), m(T, null, X(e.options, (s) => (n(), m("option", {
|
|
755
|
+
key: l(ge)(s),
|
|
756
|
+
value: l(ge)(s)
|
|
757
|
+
}, g(l(oo)(s)), 9, Yo))), 128))
|
|
758
|
+
], 40, Wo), [
|
|
759
|
+
[po, e.model.value]
|
|
760
|
+
])
|
|
761
|
+
]),
|
|
762
|
+
_: 1
|
|
763
|
+
}, 16));
|
|
724
764
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
|
|
765
|
+
}), Ho = ["id"], Jo = ["id"], Qo = ["aria-labelledby", "aria-required", "aria-invalid", "aria-describedby"], Zo = ["value", "name", "disabled", "readonly"], _o = /* @__PURE__ */ A({
|
|
766
|
+
__name: "oo-radio",
|
|
767
|
+
props: {
|
|
768
|
+
onBlur: { type: Function },
|
|
769
|
+
error: {},
|
|
770
|
+
model: {},
|
|
771
|
+
value: {},
|
|
772
|
+
label: {},
|
|
773
|
+
description: {},
|
|
774
|
+
hint: {},
|
|
775
|
+
placeholder: {},
|
|
776
|
+
class: {},
|
|
777
|
+
style: {},
|
|
778
|
+
optional: { type: Boolean },
|
|
779
|
+
onToggleOptional: { type: Function },
|
|
780
|
+
required: { type: Boolean },
|
|
781
|
+
readonly: { type: Boolean },
|
|
782
|
+
type: {},
|
|
783
|
+
altAction: {},
|
|
784
|
+
name: {},
|
|
785
|
+
field: {},
|
|
786
|
+
options: {},
|
|
787
|
+
maxLength: {},
|
|
788
|
+
autocomplete: {},
|
|
789
|
+
title: {},
|
|
790
|
+
level: {},
|
|
791
|
+
onRemove: { type: Function },
|
|
792
|
+
canRemove: { type: Boolean },
|
|
793
|
+
removeLabel: {},
|
|
794
|
+
arrayIndex: {},
|
|
795
|
+
disabled: { type: Boolean },
|
|
796
|
+
hidden: { type: Boolean }
|
|
797
|
+
},
|
|
798
|
+
setup(e) {
|
|
799
|
+
return (o, t) => (n(), w(ke, ae(o.$props, {
|
|
800
|
+
"field-class": "oo-radio-field",
|
|
801
|
+
"id-prefix": "oo-radio"
|
|
802
|
+
}), {
|
|
803
|
+
header: H(({ inputId: r, descId: a }) => [
|
|
804
|
+
L("span", {
|
|
805
|
+
id: r,
|
|
806
|
+
class: "oo-field-label"
|
|
807
|
+
}, g(e.label), 9, Ho),
|
|
808
|
+
e.description ? (n(), m("span", {
|
|
809
|
+
key: 0,
|
|
810
|
+
id: a
|
|
811
|
+
}, g(e.description), 9, Jo)) : k("", !0)
|
|
812
|
+
]),
|
|
813
|
+
default: H(({ inputId: r, errorId: a, descId: d }) => [
|
|
814
|
+
L("div", {
|
|
815
|
+
class: "oo-radio-group",
|
|
816
|
+
role: "radiogroup",
|
|
817
|
+
"aria-labelledby": r,
|
|
818
|
+
"aria-required": e.required || void 0,
|
|
819
|
+
"aria-invalid": !!e.error || void 0,
|
|
820
|
+
"aria-describedby": e.error || e.hint ? a : e.description ? d : void 0
|
|
821
|
+
}, [
|
|
822
|
+
(n(!0), m(T, null, X(e.options, (s) => (n(), m("label", {
|
|
823
|
+
key: l(ge)(s)
|
|
824
|
+
}, [
|
|
825
|
+
N(L("input", {
|
|
826
|
+
type: "radio",
|
|
827
|
+
value: l(ge)(s),
|
|
828
|
+
"onUpdate:modelValue": t[0] || (t[0] = (v) => e.model.value = v),
|
|
829
|
+
onChange: t[1] || (t[1] = //@ts-ignore
|
|
830
|
+
(...v) => e.onBlur && e.onBlur(...v)),
|
|
831
|
+
onBlur: t[2] || (t[2] = //@ts-ignore
|
|
832
|
+
(...v) => e.onBlur && e.onBlur(...v)),
|
|
833
|
+
name: e.name,
|
|
834
|
+
disabled: e.disabled,
|
|
835
|
+
readonly: e.readonly
|
|
836
|
+
}, null, 40, Zo), [
|
|
837
|
+
[go, e.model.value]
|
|
838
|
+
]),
|
|
839
|
+
_e(" " + g(l(oo)(s)), 1)
|
|
840
|
+
]))), 128))
|
|
841
|
+
], 8, Qo)
|
|
842
|
+
]),
|
|
843
|
+
_: 1
|
|
844
|
+
}, 16));
|
|
744
845
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
|
|
846
|
+
}), et = {
|
|
847
|
+
key: 0,
|
|
848
|
+
class: "oo-field-label"
|
|
849
|
+
}, ot = ["for"], tt = ["id", "checked", "name", "disabled", "readonly", "aria-invalid", "aria-describedby"], nt = ["id"], lt = /* @__PURE__ */ A({
|
|
850
|
+
__name: "oo-checkbox",
|
|
851
|
+
props: {
|
|
852
|
+
onBlur: { type: Function },
|
|
853
|
+
error: {},
|
|
854
|
+
model: {},
|
|
855
|
+
value: {},
|
|
856
|
+
label: {},
|
|
857
|
+
description: {},
|
|
858
|
+
hint: {},
|
|
859
|
+
placeholder: {},
|
|
860
|
+
class: {},
|
|
861
|
+
style: {},
|
|
862
|
+
optional: { type: Boolean },
|
|
863
|
+
onToggleOptional: { type: Function },
|
|
864
|
+
required: { type: Boolean },
|
|
865
|
+
readonly: { type: Boolean },
|
|
866
|
+
type: {},
|
|
867
|
+
altAction: {},
|
|
868
|
+
name: {},
|
|
869
|
+
field: {},
|
|
870
|
+
options: {},
|
|
871
|
+
maxLength: {},
|
|
872
|
+
autocomplete: {},
|
|
873
|
+
title: {},
|
|
874
|
+
level: {},
|
|
875
|
+
onRemove: { type: Function },
|
|
876
|
+
canRemove: { type: Boolean },
|
|
877
|
+
removeLabel: {},
|
|
878
|
+
arrayIndex: {},
|
|
879
|
+
disabled: { type: Boolean },
|
|
880
|
+
hidden: { type: Boolean }
|
|
881
|
+
},
|
|
882
|
+
setup(e) {
|
|
883
|
+
return (o, t) => (n(), w(ke, ae(o.$props, {
|
|
884
|
+
"field-class": "oo-checkbox-field",
|
|
885
|
+
"id-prefix": "oo-checkbox"
|
|
886
|
+
}), {
|
|
887
|
+
header: H(({ optionalEnabled: r }) => [
|
|
888
|
+
e.optional && !r ? (n(), m("span", et, g(e.label), 1)) : k("", !0)
|
|
889
|
+
]),
|
|
890
|
+
default: H(({ inputId: r, errorId: a, descId: d }) => [
|
|
891
|
+
L("label", { for: r }, [
|
|
892
|
+
L("input", {
|
|
893
|
+
id: r,
|
|
894
|
+
type: "checkbox",
|
|
895
|
+
checked: !!e.model.value,
|
|
896
|
+
onChange: t[0] || (t[0] = (s) => {
|
|
897
|
+
e.model.value = s.target.checked, e.onBlur();
|
|
898
|
+
}),
|
|
899
|
+
onBlur: t[1] || (t[1] = //@ts-ignore
|
|
900
|
+
(...s) => e.onBlur && e.onBlur(...s)),
|
|
901
|
+
name: e.name,
|
|
902
|
+
disabled: e.disabled,
|
|
903
|
+
readonly: e.readonly,
|
|
904
|
+
"aria-invalid": !!e.error || void 0,
|
|
905
|
+
"aria-describedby": e.error || e.hint ? a : e.description ? d : void 0
|
|
906
|
+
}, null, 40, tt),
|
|
907
|
+
_e(" " + g(e.label), 1)
|
|
908
|
+
], 8, ot)
|
|
909
|
+
]),
|
|
910
|
+
"after-input": H(({ descId: r }) => [
|
|
911
|
+
e.description ? (n(), m("span", {
|
|
912
|
+
key: 0,
|
|
913
|
+
id: r
|
|
914
|
+
}, g(e.description), 9, nt)) : k("", !0)
|
|
915
|
+
]),
|
|
916
|
+
_: 1
|
|
917
|
+
}, 16));
|
|
754
918
|
}
|
|
755
|
-
|
|
756
|
-
|
|
919
|
+
}), at = /* @__PURE__ */ A({
|
|
920
|
+
__name: "oo-paragraph",
|
|
921
|
+
props: {
|
|
922
|
+
onBlur: { type: Function },
|
|
923
|
+
error: {},
|
|
924
|
+
model: {},
|
|
925
|
+
value: {},
|
|
926
|
+
label: {},
|
|
927
|
+
description: {},
|
|
928
|
+
hint: {},
|
|
929
|
+
placeholder: {},
|
|
930
|
+
class: {},
|
|
931
|
+
style: {},
|
|
932
|
+
optional: { type: Boolean },
|
|
933
|
+
onToggleOptional: { type: Function },
|
|
934
|
+
required: { type: Boolean },
|
|
935
|
+
readonly: { type: Boolean },
|
|
936
|
+
type: {},
|
|
937
|
+
altAction: {},
|
|
938
|
+
name: {},
|
|
939
|
+
field: {},
|
|
940
|
+
options: {},
|
|
941
|
+
maxLength: {},
|
|
942
|
+
autocomplete: {},
|
|
943
|
+
title: {},
|
|
944
|
+
level: {},
|
|
945
|
+
onRemove: { type: Function },
|
|
946
|
+
canRemove: { type: Boolean },
|
|
947
|
+
removeLabel: {},
|
|
948
|
+
arrayIndex: {},
|
|
949
|
+
disabled: { type: Boolean },
|
|
950
|
+
hidden: { type: Boolean }
|
|
951
|
+
},
|
|
952
|
+
setup(e) {
|
|
953
|
+
return (o, t) => N((n(), m("p", { "aria-live": "polite" }, g(e.value), 513)), [
|
|
954
|
+
[Q, !e.hidden]
|
|
955
|
+
]);
|
|
757
956
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
957
|
+
}), it = /* @__PURE__ */ A({
|
|
958
|
+
__name: "oo-action",
|
|
959
|
+
props: {
|
|
960
|
+
onBlur: { type: Function },
|
|
961
|
+
error: {},
|
|
962
|
+
model: {},
|
|
963
|
+
value: {},
|
|
964
|
+
label: {},
|
|
965
|
+
description: {},
|
|
966
|
+
hint: {},
|
|
967
|
+
placeholder: {},
|
|
968
|
+
class: {},
|
|
969
|
+
style: {},
|
|
970
|
+
optional: { type: Boolean },
|
|
971
|
+
onToggleOptional: { type: Function },
|
|
972
|
+
required: { type: Boolean },
|
|
973
|
+
readonly: { type: Boolean },
|
|
974
|
+
type: {},
|
|
975
|
+
altAction: {},
|
|
976
|
+
name: {},
|
|
977
|
+
field: {},
|
|
978
|
+
options: {},
|
|
979
|
+
maxLength: {},
|
|
980
|
+
autocomplete: {},
|
|
981
|
+
title: {},
|
|
982
|
+
level: {},
|
|
983
|
+
onRemove: { type: Function },
|
|
984
|
+
canRemove: { type: Boolean },
|
|
985
|
+
removeLabel: {},
|
|
986
|
+
arrayIndex: {},
|
|
987
|
+
disabled: { type: Boolean },
|
|
988
|
+
hidden: { type: Boolean }
|
|
989
|
+
},
|
|
990
|
+
emits: ["action"],
|
|
991
|
+
setup(e, { emit: o }) {
|
|
992
|
+
const t = o;
|
|
993
|
+
return (r, a) => N((n(), m("div", {
|
|
994
|
+
class: re(["oo-default-field oo-action-field", r.$props.class])
|
|
995
|
+
}, [
|
|
996
|
+
L("button", {
|
|
997
|
+
type: "button",
|
|
998
|
+
onClick: a[0] || (a[0] = (d) => e.altAction && t("action", e.altAction.id))
|
|
999
|
+
}, g(e.altAction?.label), 1)
|
|
1000
|
+
], 2)), [
|
|
1001
|
+
[Q, !e.hidden]
|
|
1002
|
+
]);
|
|
768
1003
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
1004
|
+
}), rt = {
|
|
1005
|
+
key: 0,
|
|
1006
|
+
class: "oo-structured-header"
|
|
1007
|
+
}, dt = { class: "oo-structured-header-content" }, st = {
|
|
1008
|
+
key: 0,
|
|
1009
|
+
class: "oo-structured-title oo-form-title"
|
|
1010
|
+
}, ut = {
|
|
1011
|
+
key: 1,
|
|
1012
|
+
class: "oo-structured-title"
|
|
1013
|
+
}, ct = ["disabled", "aria-label"], ze = /* @__PURE__ */ A({
|
|
1014
|
+
__name: "oo-structured-header",
|
|
1015
|
+
props: {
|
|
1016
|
+
title: {},
|
|
1017
|
+
level: {},
|
|
1018
|
+
onRemove: { type: Function },
|
|
1019
|
+
canRemove: { type: Boolean },
|
|
1020
|
+
removeLabel: {},
|
|
1021
|
+
optional: { type: Boolean },
|
|
1022
|
+
optionalEnabled: { type: Boolean },
|
|
1023
|
+
onToggleOptional: { type: Function },
|
|
1024
|
+
disabled: { type: Boolean },
|
|
1025
|
+
unionContext: {}
|
|
1026
|
+
},
|
|
1027
|
+
setup(e) {
|
|
1028
|
+
const o = e, t = o.unionContext !== void 0 && o.unionContext.variants.length > 1;
|
|
1029
|
+
return (r, a) => e.title || e.onRemove || e.optional || l(t) ? (n(), m("div", rt, [
|
|
1030
|
+
L("div", dt, [
|
|
1031
|
+
e.title && e.level === 0 ? (n(), m("h2", st, g(e.title), 1)) : e.title ? (n(), m("h3", ut, g(e.title), 1)) : k("", !0),
|
|
1032
|
+
l(t) ? (n(), w(no, {
|
|
1033
|
+
key: 2,
|
|
1034
|
+
"union-context": e.unionContext,
|
|
1035
|
+
disabled: e.disabled
|
|
1036
|
+
}, null, 8, ["union-context", "disabled"])) : k("", !0)
|
|
1037
|
+
]),
|
|
1038
|
+
e.optional && e.optionalEnabled ? (n(), m("button", {
|
|
1039
|
+
key: 0,
|
|
1040
|
+
type: "button",
|
|
1041
|
+
class: "oo-optional-clear",
|
|
1042
|
+
onClick: a[0] || (a[0] = (d) => e.onToggleOptional?.(!1))
|
|
1043
|
+
}, " × ")) : k("", !0),
|
|
1044
|
+
e.onRemove ? (n(), m("button", {
|
|
1045
|
+
key: 1,
|
|
1046
|
+
type: "button",
|
|
1047
|
+
class: "oo-structured-remove-btn",
|
|
1048
|
+
disabled: !e.canRemove,
|
|
1049
|
+
"aria-label": e.removeLabel || "Remove item",
|
|
1050
|
+
onClick: a[1] || (a[1] = //@ts-ignore
|
|
1051
|
+
(...d) => e.onRemove && e.onRemove(...d))
|
|
1052
|
+
}, g(e.removeLabel || "Remove"), 9, ct)) : k("", !0)
|
|
1053
|
+
])) : k("", !0);
|
|
781
1054
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1055
|
+
}), mt = {
|
|
1056
|
+
key: 0,
|
|
1057
|
+
class: "oo-object-error",
|
|
1058
|
+
role: "alert"
|
|
1059
|
+
}, vt = /* @__PURE__ */ A({
|
|
1060
|
+
__name: "oo-object",
|
|
1061
|
+
props: {
|
|
1062
|
+
onBlur: { type: Function },
|
|
1063
|
+
error: {},
|
|
1064
|
+
model: {},
|
|
1065
|
+
value: {},
|
|
1066
|
+
label: {},
|
|
1067
|
+
description: {},
|
|
1068
|
+
hint: {},
|
|
1069
|
+
placeholder: {},
|
|
1070
|
+
class: {},
|
|
1071
|
+
style: {},
|
|
1072
|
+
optional: { type: Boolean },
|
|
1073
|
+
onToggleOptional: { type: Function },
|
|
1074
|
+
required: { type: Boolean },
|
|
1075
|
+
readonly: { type: Boolean },
|
|
1076
|
+
type: {},
|
|
1077
|
+
altAction: {},
|
|
1078
|
+
name: {},
|
|
1079
|
+
field: {},
|
|
1080
|
+
options: {},
|
|
1081
|
+
maxLength: {},
|
|
1082
|
+
autocomplete: {},
|
|
1083
|
+
title: {},
|
|
1084
|
+
level: {},
|
|
1085
|
+
onRemove: { type: Function },
|
|
1086
|
+
canRemove: { type: Boolean },
|
|
1087
|
+
removeLabel: {},
|
|
1088
|
+
arrayIndex: {},
|
|
1089
|
+
disabled: { type: Boolean },
|
|
1090
|
+
hidden: { type: Boolean }
|
|
1091
|
+
},
|
|
1092
|
+
setup(e) {
|
|
1093
|
+
const o = e, t = Se(o.field) ? o.field.objectDef : void 0, r = Be(), a = f(() => to(o.title, o.arrayIndex)), d = f(() => o.model?.value !== void 0);
|
|
1094
|
+
return (s, v) => N((n(), m("div", {
|
|
1095
|
+
class: re(["oo-object", { "oo-object--root": e.level === 0, "oo-object--nested": (e.level ?? 0) > 0 }])
|
|
1096
|
+
}, [
|
|
1097
|
+
ie(ze, {
|
|
1098
|
+
title: a.value,
|
|
1099
|
+
level: e.level,
|
|
1100
|
+
"on-remove": e.onRemove && l(t) ? e.onRemove : void 0,
|
|
1101
|
+
"can-remove": e.canRemove,
|
|
1102
|
+
"remove-label": e.removeLabel,
|
|
1103
|
+
optional: e.optional,
|
|
1104
|
+
"optional-enabled": d.value,
|
|
1105
|
+
"on-toggle-optional": e.onToggleOptional,
|
|
1106
|
+
disabled: e.disabled,
|
|
1107
|
+
"union-context": l(r)
|
|
1108
|
+
}, null, 8, ["title", "level", "on-remove", "can-remove", "remove-label", "optional", "optional-enabled", "on-toggle-optional", "disabled", "union-context"]),
|
|
1109
|
+
e.optional && !d.value ? (n(), w(ee, {
|
|
1110
|
+
key: 0,
|
|
1111
|
+
"on-edit": () => e.onToggleOptional?.(!0)
|
|
1112
|
+
}, null, 8, ["on-edit"])) : (n(), m(T, { key: 1 }, [
|
|
1113
|
+
e.error ? (n(), m("div", mt, g(e.error), 1)) : k("", !0),
|
|
1114
|
+
l(t) ? (n(), w(Po, {
|
|
1115
|
+
key: 1,
|
|
1116
|
+
def: l(t)
|
|
1117
|
+
}, null, 8, ["def"])) : k("", !0)
|
|
1118
|
+
], 64))
|
|
1119
|
+
], 2)), [
|
|
1120
|
+
[Q, !e.hidden]
|
|
1121
|
+
]);
|
|
785
1122
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
if (this.push(`[${t}]`), !this.validateSafe(r, e[t]))
|
|
792
|
-
return this.pop(!0), !1;
|
|
793
|
-
this.pop(!1), t++;
|
|
1123
|
+
});
|
|
1124
|
+
function ft(e, o) {
|
|
1125
|
+
const { rootFormData: t, formContext: r, pathPrefix: a, getByPath: d, setByPath: s } = Ne("useFoormArray"), v = I(
|
|
1126
|
+
"__foorm_change_handler",
|
|
1127
|
+
() => {
|
|
794
1128
|
}
|
|
795
|
-
|
|
1129
|
+
), b = f(() => {
|
|
1130
|
+
const C = d(a.value);
|
|
1131
|
+
return Array.isArray(C) ? C : [];
|
|
1132
|
+
});
|
|
1133
|
+
let O = 0;
|
|
1134
|
+
const x = eo([]);
|
|
1135
|
+
function $() {
|
|
1136
|
+
return `oo-item-${O++}`;
|
|
796
1137
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
if (
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
const r = o.metadata.get("expect.maxLength");
|
|
809
|
-
if (r) {
|
|
810
|
-
const l = typeof r == "number" ? r : r.length;
|
|
811
|
-
if (e.length > l) {
|
|
812
|
-
const c = typeof r == "object" && r.message ? r.message : `Expected maximum length of ${l} items, got ${e.length} items`;
|
|
813
|
-
return this.error(c), !1;
|
|
814
|
-
}
|
|
1138
|
+
function F() {
|
|
1139
|
+
for (; x.length < b.value.length; )
|
|
1140
|
+
x.push($());
|
|
1141
|
+
const C = b.value.length;
|
|
1142
|
+
if (x.length > C) {
|
|
1143
|
+
for (const V of B.keys())
|
|
1144
|
+
V >= C && B.delete(V);
|
|
1145
|
+
for (; x.length > C; )
|
|
1146
|
+
x.pop();
|
|
815
1147
|
}
|
|
816
|
-
let s = 0, a = !0;
|
|
817
|
-
for (const l of e) {
|
|
818
|
-
if (this.push(`[${s}]`), this.validateSafe(o.type.of, l))
|
|
819
|
-
this.pop(!1);
|
|
820
|
-
else if (a = !1, this.pop(!0), this.isLimitExceeded()) return !1;
|
|
821
|
-
s++;
|
|
822
|
-
}
|
|
823
|
-
return a;
|
|
824
1148
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
if (m.startsWith(c)) {
|
|
834
|
-
const p = m.slice(c.length);
|
|
835
|
-
a.add(p), r.delete(p);
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
let l = !1;
|
|
840
|
-
typeof this.opts.partial == "function" && (l = this.opts.partial(o, this.path));
|
|
841
|
-
for (const [c, m] of o.type.props.entries())
|
|
842
|
-
if (!(a.has(c) || et(m)) && (s.add(c), !(e[c] === void 0 && (l || this.opts.partial === "deep" || this.opts.partial === !0 && this.stackPath.length <= 1)))) {
|
|
843
|
-
if (this.push(c), this.validateSafe(m, e[c])) this.pop(!1);
|
|
844
|
-
else if (t = !1, this.pop(!0), this.isLimitExceeded()) return !1;
|
|
845
|
-
}
|
|
846
|
-
for (const c of r)
|
|
847
|
-
if (!s.has(c)) {
|
|
848
|
-
const m = [];
|
|
849
|
-
for (const { pattern: p, def: f } of o.type.propsPatterns) p.test(c) && m.push({
|
|
850
|
-
pattern: p,
|
|
851
|
-
def: f
|
|
852
|
-
});
|
|
853
|
-
if (m.length) {
|
|
854
|
-
let p = !1;
|
|
855
|
-
for (const { def: f } of m) if (this.validateSafe(f, e[c])) {
|
|
856
|
-
this.pop(!1), p = !0;
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
if (!p && (this.push(c), this.validateSafe(m[0].def, e[c]), this.pop(!0), t = !1, this.isLimitExceeded()))
|
|
860
|
-
return !1;
|
|
861
|
-
} else if (this.opts.unknwonProps !== "ignore")
|
|
862
|
-
if (this.opts.unknwonProps === "error") {
|
|
863
|
-
if (this.push(c), this.error("Unexpected property"), this.pop(!0), this.isLimitExceeded()) return !1;
|
|
864
|
-
t = !1;
|
|
865
|
-
} else this.opts.unknwonProps === "strip" && delete e[c];
|
|
866
|
-
}
|
|
867
|
-
return t;
|
|
1149
|
+
F(), Ue(
|
|
1150
|
+
() => b.value.length,
|
|
1151
|
+
() => F()
|
|
1152
|
+
);
|
|
1153
|
+
const h = je(e.itemField), p = h ? e.itemField.unionVariants : [], B = /* @__PURE__ */ new Map();
|
|
1154
|
+
function E(C) {
|
|
1155
|
+
let V = B.get(C);
|
|
1156
|
+
return V || (V = { ...e.itemField, path: String(C), name: "" }, B.set(C, V)), V;
|
|
868
1157
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
switch (o.type.designType) {
|
|
874
|
-
case "never":
|
|
875
|
-
return this.error("This type is impossible, must be an internal problem"), !1;
|
|
876
|
-
case "any":
|
|
877
|
-
return !0;
|
|
878
|
-
case "string":
|
|
879
|
-
return t !== o.type.designType ? (this.error(`Expected ${o.type.designType}, got ${t}`), !1) : this.validateString(o, e);
|
|
880
|
-
case "number":
|
|
881
|
-
return t !== o.type.designType ? (this.error(`Expected ${o.type.designType}, got ${t}`), !1) : this.validateNumber(o, e);
|
|
882
|
-
case "boolean":
|
|
883
|
-
return t !== o.type.designType ? (this.error(`Expected ${o.type.designType}, got ${t}`), !1) : !0;
|
|
884
|
-
case "undefined":
|
|
885
|
-
return e !== void 0 ? (this.error(`Expected ${o.type.designType}, got ${t}`), !1) : !0;
|
|
886
|
-
case "null":
|
|
887
|
-
return e !== null ? (this.error(`Expected ${o.type.designType}, got ${t}`), !1) : !0;
|
|
888
|
-
default:
|
|
889
|
-
throw new Error(`Unknown type "${o.type.designType}"`);
|
|
890
|
-
}
|
|
1158
|
+
const j = y(e.prop, "expect.minLength"), M = y(e.prop, "expect.maxLength"), u = j?.length ?? 0, R = M?.length ?? 1 / 0, P = f(() => !o?.value && b.value.length < R), i = f(() => !o?.value && b.value.length > u);
|
|
1159
|
+
function D() {
|
|
1160
|
+
let C = d(a.value);
|
|
1161
|
+
return Array.isArray(C) || (C = [], s(a.value, C)), C;
|
|
891
1162
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
return this.error(l), !1;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
const s = o.metadata.get("expect.pattern");
|
|
910
|
-
for (const { pattern: a, flags: l, message: c } of s || []) {
|
|
911
|
-
if (!a) continue;
|
|
912
|
-
const m = `${a}//${l || ""}`;
|
|
913
|
-
let p = ee.get(m);
|
|
914
|
-
if (p || (p = new RegExp(a, l), ee.set(m, p)), !p.test(e))
|
|
915
|
-
return this.error(c || `Value is expected to match pattern "${a}"`), !1;
|
|
916
|
-
}
|
|
917
|
-
return !0;
|
|
1163
|
+
function se(C = 0) {
|
|
1164
|
+
if (!P.value) return;
|
|
1165
|
+
const V = xe(
|
|
1166
|
+
t().value,
|
|
1167
|
+
r.value
|
|
1168
|
+
);
|
|
1169
|
+
let G;
|
|
1170
|
+
if (h) {
|
|
1171
|
+
const ue = p[C];
|
|
1172
|
+
if (!ue) return;
|
|
1173
|
+
G = le(ue.type, V).value;
|
|
1174
|
+
} else
|
|
1175
|
+
G = le(e.itemType, V).value;
|
|
1176
|
+
D().push(G), x.push($()), v("array-add", a.value, b.value);
|
|
918
1177
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
const
|
|
923
|
-
|
|
1178
|
+
function Y(C) {
|
|
1179
|
+
if (i.value) {
|
|
1180
|
+
D().splice(C, 1), x.splice(C, 1);
|
|
1181
|
+
for (const V of B.keys())
|
|
1182
|
+
V >= C && B.delete(V);
|
|
1183
|
+
v("array-remove", a.value, b.value);
|
|
924
1184
|
}
|
|
925
|
-
const r = o.metadata.get("expect.min");
|
|
926
|
-
if (r) {
|
|
927
|
-
const a = typeof r == "number" ? r : r.minValue;
|
|
928
|
-
if (e < a) {
|
|
929
|
-
const l = typeof r == "object" && r.message ? r.message : `Expected minimum ${a}, got ${e}`;
|
|
930
|
-
return this.error(l), !1;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
const s = o.metadata.get("expect.max");
|
|
934
|
-
if (s) {
|
|
935
|
-
const a = typeof s == "number" ? s : s.maxValue;
|
|
936
|
-
if (e > a) {
|
|
937
|
-
const l = typeof s == "object" && s.message ? s.message : `Expected maximum ${a}, got ${e}`;
|
|
938
|
-
return this.error(l), !1;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return !0;
|
|
942
1185
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1186
|
+
const oe = y(e.prop, "foorm.array.add.label") ?? "Add item", $e = y(e.prop, "foorm.array.remove.label") ?? "Remove";
|
|
1187
|
+
return {
|
|
1188
|
+
arrayValue: b,
|
|
1189
|
+
itemKeys: x,
|
|
1190
|
+
isUnion: h,
|
|
1191
|
+
unionVariants: p,
|
|
1192
|
+
getItemField: E,
|
|
1193
|
+
addItem: se,
|
|
1194
|
+
removeItem: Y,
|
|
1195
|
+
canAdd: P,
|
|
1196
|
+
canRemove: i,
|
|
1197
|
+
addLabel: oe,
|
|
1198
|
+
removeLabel: $e
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
const yt = { class: "oo-array-add" }, bt = ["disabled"], ht = ["disabled"], pt = {
|
|
1202
|
+
key: 0,
|
|
1203
|
+
class: "oo-dropdown-menu"
|
|
1204
|
+
}, gt = ["onClick"], xt = {
|
|
1205
|
+
key: 0,
|
|
1206
|
+
class: "oo-array-error",
|
|
1207
|
+
role: "alert"
|
|
1208
|
+
}, Bt = /* @__PURE__ */ A({
|
|
1209
|
+
__name: "oo-array",
|
|
1210
|
+
props: {
|
|
1211
|
+
onBlur: { type: Function },
|
|
1212
|
+
error: {},
|
|
1213
|
+
model: {},
|
|
1214
|
+
value: {},
|
|
1215
|
+
label: {},
|
|
1216
|
+
description: {},
|
|
1217
|
+
hint: {},
|
|
1218
|
+
placeholder: {},
|
|
1219
|
+
class: {},
|
|
1220
|
+
style: {},
|
|
1221
|
+
optional: { type: Boolean },
|
|
1222
|
+
onToggleOptional: { type: Function },
|
|
1223
|
+
required: { type: Boolean },
|
|
1224
|
+
readonly: { type: Boolean },
|
|
1225
|
+
type: {},
|
|
1226
|
+
altAction: {},
|
|
1227
|
+
name: {},
|
|
1228
|
+
field: {},
|
|
1229
|
+
options: {},
|
|
1230
|
+
maxLength: {},
|
|
1231
|
+
autocomplete: {},
|
|
1232
|
+
title: {},
|
|
1233
|
+
level: {},
|
|
1234
|
+
onRemove: { type: Function },
|
|
1235
|
+
canRemove: { type: Boolean },
|
|
1236
|
+
removeLabel: {},
|
|
1237
|
+
arrayIndex: {},
|
|
1238
|
+
disabled: { type: Boolean },
|
|
1239
|
+
hidden: { type: Boolean }
|
|
1240
|
+
},
|
|
1241
|
+
setup(e) {
|
|
1242
|
+
const o = e, t = qe(o.field) ? o.field : void 0, r = Be(), a = f(() => Array.isArray(o.model?.value)), {
|
|
1243
|
+
arrayValue: d,
|
|
1244
|
+
itemKeys: s,
|
|
1245
|
+
getItemField: v,
|
|
1246
|
+
isUnion: b,
|
|
1247
|
+
unionVariants: O,
|
|
1248
|
+
addItem: x,
|
|
1249
|
+
removeItem: $,
|
|
1250
|
+
canAdd: F,
|
|
1251
|
+
canRemove: h,
|
|
1252
|
+
addLabel: p,
|
|
1253
|
+
removeLabel: B
|
|
1254
|
+
} = ft(
|
|
1255
|
+
t,
|
|
1256
|
+
f(() => o.disabled ?? !1)
|
|
1257
|
+
), E = J(null), { isOpen: j, toggle: M, select: u } = Ke(E);
|
|
1258
|
+
return (R, P) => N((n(), m("div", {
|
|
1259
|
+
class: re(["oo-array", { "oo-array--root": e.level === 0, "oo-array--nested": (e.level ?? 0) > 0 }])
|
|
1260
|
+
}, [
|
|
1261
|
+
ie(ze, {
|
|
1262
|
+
title: e.title,
|
|
1263
|
+
level: e.level,
|
|
1264
|
+
"on-remove": e.onRemove,
|
|
1265
|
+
"can-remove": o.canRemove,
|
|
1266
|
+
"remove-label": o.removeLabel,
|
|
1267
|
+
optional: e.optional,
|
|
1268
|
+
"optional-enabled": a.value,
|
|
1269
|
+
"on-toggle-optional": e.onToggleOptional,
|
|
1270
|
+
disabled: e.disabled,
|
|
1271
|
+
"union-context": l(r)
|
|
1272
|
+
}, null, 8, ["title", "level", "on-remove", "can-remove", "remove-label", "optional", "optional-enabled", "on-toggle-optional", "disabled", "union-context"]),
|
|
1273
|
+
e.optional && !a.value ? (n(), w(ee, {
|
|
1274
|
+
key: 0,
|
|
1275
|
+
"on-edit": () => e.onToggleOptional?.(!0)
|
|
1276
|
+
}, null, 8, ["on-edit"])) : (n(), m(T, { key: 1 }, [
|
|
1277
|
+
(n(!0), m(T, null, X(l(d), (i, D) => (n(), w(de, {
|
|
1278
|
+
key: l(s)[D],
|
|
1279
|
+
field: l(v)(D),
|
|
1280
|
+
"on-remove": () => l($)(D),
|
|
1281
|
+
"can-remove": l(h),
|
|
1282
|
+
"remove-label": l(B),
|
|
1283
|
+
"array-index": D
|
|
1284
|
+
}, null, 8, ["field", "on-remove", "can-remove", "remove-label", "array-index"]))), 128)),
|
|
1285
|
+
L("div", yt, [
|
|
1286
|
+
l(b) ? (n(), m("div", {
|
|
1287
|
+
key: 1,
|
|
1288
|
+
ref_key: "addDropdownRef",
|
|
1289
|
+
ref: E,
|
|
1290
|
+
class: "oo-dropdown"
|
|
1291
|
+
}, [
|
|
1292
|
+
L("button", {
|
|
1293
|
+
type: "button",
|
|
1294
|
+
class: "oo-array-add-btn",
|
|
1295
|
+
disabled: !l(F),
|
|
1296
|
+
onClick: P[1] || (P[1] = //@ts-ignore
|
|
1297
|
+
(...i) => l(M) && l(M)(...i))
|
|
1298
|
+
}, g(l(p)) + " ▾ ", 9, ht),
|
|
1299
|
+
l(j) ? (n(), m("div", pt, [
|
|
1300
|
+
(n(!0), m(T, null, X(l(O), (i, D) => (n(), m("button", {
|
|
1301
|
+
key: D,
|
|
1302
|
+
type: "button",
|
|
1303
|
+
class: "oo-dropdown-item",
|
|
1304
|
+
onClick: (se) => l(u)(() => l(x)(D))
|
|
1305
|
+
}, g(i.label), 9, gt))), 128))
|
|
1306
|
+
])) : k("", !0)
|
|
1307
|
+
], 512)) : (n(), m("button", {
|
|
1308
|
+
key: 0,
|
|
1309
|
+
type: "button",
|
|
1310
|
+
class: "oo-array-add-btn",
|
|
1311
|
+
disabled: !l(F),
|
|
1312
|
+
onClick: P[0] || (P[0] = (i) => l(x)(0))
|
|
1313
|
+
}, g(l(p)), 9, bt))
|
|
1314
|
+
]),
|
|
1315
|
+
e.error ? (n(), m("div", xt, g(e.error), 1)) : k("", !0)
|
|
1316
|
+
], 64))
|
|
1317
|
+
], 2)), [
|
|
1318
|
+
[Q, !e.hidden]
|
|
1319
|
+
]);
|
|
951
1320
|
}
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
|
|
1321
|
+
});
|
|
1322
|
+
function kt(e) {
|
|
1323
|
+
const o = I(
|
|
1324
|
+
"__foorm_path_prefix",
|
|
1325
|
+
f(() => "")
|
|
1326
|
+
), { rootFormData: t, formContext: r } = Ne("useFoormUnion"), a = I(
|
|
1327
|
+
"__foorm_change_handler",
|
|
1328
|
+
() => {
|
|
1329
|
+
}
|
|
1330
|
+
), d = f(
|
|
1331
|
+
() => e.field && je(e.field) ? e.field : void 0
|
|
1332
|
+
), s = f(
|
|
1333
|
+
() => d.value !== void 0 && d.value.unionVariants.length > 1
|
|
1334
|
+
), v = J(
|
|
1335
|
+
d.value ? Oo(e.model?.value, d.value.unionVariants) : 0
|
|
1336
|
+
), b = f(() => {
|
|
1337
|
+
const u = d.value?.unionVariants;
|
|
1338
|
+
if (u)
|
|
1339
|
+
return u[v.value] ?? u[0];
|
|
1340
|
+
});
|
|
1341
|
+
function O() {
|
|
1342
|
+
const u = b.value;
|
|
1343
|
+
if (!u) return;
|
|
1344
|
+
const R = d.value?.name ?? "";
|
|
1345
|
+
if (u.def)
|
|
1346
|
+
return { ...u.def.rootField, path: "", name: R };
|
|
1347
|
+
if (u.itemField)
|
|
1348
|
+
return { ...u.itemField, path: "" };
|
|
955
1349
|
}
|
|
956
|
-
|
|
957
|
-
function
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1350
|
+
const x = f(O), $ = /* @__PURE__ */ new Map();
|
|
1351
|
+
function F(u) {
|
|
1352
|
+
$.set(v.value, e.model?.value), v.value = u;
|
|
1353
|
+
const R = d.value?.unionVariants[u];
|
|
1354
|
+
if (R && e.model) {
|
|
1355
|
+
const P = $.get(u);
|
|
1356
|
+
e.model.value = P !== void 0 ? P : le(
|
|
1357
|
+
R.type,
|
|
1358
|
+
xe(
|
|
1359
|
+
t().value,
|
|
1360
|
+
r.value
|
|
1361
|
+
)
|
|
1362
|
+
).value;
|
|
969
1363
|
}
|
|
970
|
-
|
|
1364
|
+
a("union-switch", o.value, e.model?.value);
|
|
1365
|
+
}
|
|
1366
|
+
const h = f(() => e.model?.value !== void 0);
|
|
1367
|
+
d.value && q("__foorm_union", {
|
|
1368
|
+
variants: d.value.unionVariants,
|
|
1369
|
+
currentIndex: v,
|
|
1370
|
+
changeVariant: F
|
|
971
1371
|
});
|
|
972
|
-
}
|
|
973
|
-
function
|
|
974
|
-
|
|
975
|
-
if (typeof m == "string")
|
|
976
|
-
return c(m);
|
|
977
|
-
if (e !== void 0) {
|
|
978
|
-
const p = t.get(e);
|
|
979
|
-
if (p !== void 0)
|
|
980
|
-
return l ? !0 : s ? s(p) : p;
|
|
1372
|
+
const p = J(null), { isOpen: B, toggle: E, select: j } = Ke(p);
|
|
1373
|
+
function M() {
|
|
1374
|
+
s.value ? E() : e.onToggleOptional?.(!0);
|
|
981
1375
|
}
|
|
982
|
-
return a;
|
|
983
|
-
}
|
|
984
|
-
function nt(o, e) {
|
|
985
|
-
var t, r, s, a;
|
|
986
|
-
return {
|
|
987
|
-
optional: (t = $("foorm.fn.optional", void 0, o)) !== null && t !== void 0 ? t : e ?? !1,
|
|
988
|
-
disabled: (r = $("foorm.fn.disabled", "foorm.disabled", o, {
|
|
989
|
-
staticAsBoolean: !0
|
|
990
|
-
})) !== null && r !== void 0 ? r : !1,
|
|
991
|
-
hidden: (s = $("foorm.fn.hidden", "foorm.hidden", o, {
|
|
992
|
-
staticAsBoolean: !0
|
|
993
|
-
})) !== null && s !== void 0 ? s : !1,
|
|
994
|
-
readonly: (a = $("foorm.fn.readonly", "foorm.readonly", o, {
|
|
995
|
-
staticAsBoolean: !0
|
|
996
|
-
})) !== null && a !== void 0 ? a : !1
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
function rt(o, e) {
|
|
1000
1376
|
return {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1377
|
+
unionField: d,
|
|
1378
|
+
hasMultipleVariants: s,
|
|
1379
|
+
localUnionIndex: v,
|
|
1380
|
+
currentVariant: b,
|
|
1381
|
+
innerField: x,
|
|
1382
|
+
changeVariant: F,
|
|
1383
|
+
optionalEnabled: h,
|
|
1384
|
+
dropdownRef: p,
|
|
1385
|
+
isOpen: B,
|
|
1386
|
+
toggle: E,
|
|
1387
|
+
select: j,
|
|
1388
|
+
handleNaClick: M
|
|
1007
1389
|
};
|
|
1008
1390
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1391
|
+
const $t = { class: "oo-union" }, Ft = {
|
|
1392
|
+
key: 0,
|
|
1393
|
+
class: "oo-dropdown-menu"
|
|
1394
|
+
}, Ct = ["onClick"], Rt = /* @__PURE__ */ A({
|
|
1395
|
+
__name: "oo-union",
|
|
1396
|
+
props: {
|
|
1397
|
+
onBlur: { type: Function },
|
|
1398
|
+
error: {},
|
|
1399
|
+
model: {},
|
|
1400
|
+
value: {},
|
|
1401
|
+
label: {},
|
|
1402
|
+
description: {},
|
|
1403
|
+
hint: {},
|
|
1404
|
+
placeholder: {},
|
|
1405
|
+
class: {},
|
|
1406
|
+
style: {},
|
|
1407
|
+
optional: { type: Boolean },
|
|
1408
|
+
onToggleOptional: { type: Function },
|
|
1409
|
+
required: { type: Boolean },
|
|
1410
|
+
readonly: { type: Boolean },
|
|
1411
|
+
type: {},
|
|
1412
|
+
altAction: {},
|
|
1413
|
+
name: {},
|
|
1414
|
+
field: {},
|
|
1415
|
+
options: {},
|
|
1416
|
+
maxLength: {},
|
|
1417
|
+
autocomplete: {},
|
|
1418
|
+
title: {},
|
|
1419
|
+
level: {},
|
|
1420
|
+
onRemove: { type: Function },
|
|
1421
|
+
canRemove: { type: Boolean },
|
|
1422
|
+
removeLabel: {},
|
|
1423
|
+
arrayIndex: {},
|
|
1424
|
+
disabled: { type: Boolean },
|
|
1425
|
+
hidden: { type: Boolean }
|
|
1426
|
+
},
|
|
1427
|
+
setup(e) {
|
|
1428
|
+
const o = e, {
|
|
1429
|
+
unionField: t,
|
|
1430
|
+
hasMultipleVariants: r,
|
|
1431
|
+
localUnionIndex: a,
|
|
1432
|
+
innerField: d,
|
|
1433
|
+
changeVariant: s,
|
|
1434
|
+
optionalEnabled: v,
|
|
1435
|
+
dropdownRef: b,
|
|
1436
|
+
isOpen: O,
|
|
1437
|
+
toggle: x,
|
|
1438
|
+
select: $,
|
|
1439
|
+
handleNaClick: F
|
|
1440
|
+
} = kt(o);
|
|
1441
|
+
return (h, p) => N((n(), m("div", $t, [
|
|
1442
|
+
e.optional && !l(v) ? (n(), m(T, { key: 0 }, [
|
|
1443
|
+
l(r) ? (n(), m("div", {
|
|
1444
|
+
key: 0,
|
|
1445
|
+
ref_key: "dropdownRef",
|
|
1446
|
+
ref: b,
|
|
1447
|
+
class: "oo-dropdown-anchor"
|
|
1448
|
+
}, [
|
|
1449
|
+
ie(ee, { "on-edit": l(F) }, null, 8, ["on-edit"]),
|
|
1450
|
+
l(O) ? (n(), m("div", Ft, [
|
|
1451
|
+
(n(!0), m(T, null, X(l(t).unionVariants, (B, E) => (n(), m("button", {
|
|
1452
|
+
key: E,
|
|
1453
|
+
type: "button",
|
|
1454
|
+
class: "oo-dropdown-item",
|
|
1455
|
+
onClick: (j) => l($)(() => {
|
|
1456
|
+
l(s)(E), e.onToggleOptional?.(!0);
|
|
1457
|
+
})
|
|
1458
|
+
}, g(B.label), 9, Ct))), 128))
|
|
1459
|
+
])) : k("", !0)
|
|
1460
|
+
], 512)) : (n(), w(ee, {
|
|
1461
|
+
key: 1,
|
|
1462
|
+
"on-edit": () => e.onToggleOptional?.(!0)
|
|
1463
|
+
}, null, 8, ["on-edit"]))
|
|
1464
|
+
], 64)) : (n(), m(T, { key: 1 }, [
|
|
1465
|
+
e.optional ? (n(), m("button", {
|
|
1466
|
+
key: 0,
|
|
1467
|
+
type: "button",
|
|
1468
|
+
class: "oo-optional-clear",
|
|
1469
|
+
onClick: p[0] || (p[0] = (B) => e.onToggleOptional?.(!1))
|
|
1470
|
+
}, " × ")) : k("", !0),
|
|
1471
|
+
l(d) ? (n(), w(de, {
|
|
1472
|
+
key: l(a),
|
|
1473
|
+
field: l(d),
|
|
1474
|
+
"array-index": e.arrayIndex,
|
|
1475
|
+
"on-remove": e.onRemove,
|
|
1476
|
+
"can-remove": e.canRemove,
|
|
1477
|
+
"remove-label": e.removeLabel
|
|
1478
|
+
}, null, 8, ["field", "array-index", "on-remove", "can-remove", "remove-label"])) : k("", !0)
|
|
1479
|
+
], 64))
|
|
1480
|
+
], 512)), [
|
|
1481
|
+
[Q, !e.hidden]
|
|
1482
|
+
]);
|
|
1029
1483
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1484
|
+
}), Lt = { class: "oo-tuple" }, Ot = {
|
|
1485
|
+
key: 1,
|
|
1486
|
+
class: "oo-tuple-error",
|
|
1487
|
+
role: "alert"
|
|
1488
|
+
}, Vt = /* @__PURE__ */ A({
|
|
1489
|
+
__name: "oo-tuple",
|
|
1490
|
+
props: {
|
|
1491
|
+
onBlur: { type: Function },
|
|
1492
|
+
error: {},
|
|
1493
|
+
model: {},
|
|
1494
|
+
value: {},
|
|
1495
|
+
label: {},
|
|
1496
|
+
description: {},
|
|
1497
|
+
hint: {},
|
|
1498
|
+
placeholder: {},
|
|
1499
|
+
class: {},
|
|
1500
|
+
style: {},
|
|
1501
|
+
optional: { type: Boolean },
|
|
1502
|
+
onToggleOptional: { type: Function },
|
|
1503
|
+
required: { type: Boolean },
|
|
1504
|
+
readonly: { type: Boolean },
|
|
1505
|
+
type: {},
|
|
1506
|
+
altAction: {},
|
|
1507
|
+
name: {},
|
|
1508
|
+
field: {},
|
|
1509
|
+
options: {},
|
|
1510
|
+
maxLength: {},
|
|
1511
|
+
autocomplete: {},
|
|
1512
|
+
title: {},
|
|
1513
|
+
level: {},
|
|
1514
|
+
onRemove: { type: Function },
|
|
1515
|
+
canRemove: { type: Boolean },
|
|
1516
|
+
removeLabel: {},
|
|
1517
|
+
arrayIndex: {},
|
|
1518
|
+
disabled: { type: Boolean },
|
|
1519
|
+
hidden: { type: Boolean }
|
|
1520
|
+
},
|
|
1521
|
+
setup(e) {
|
|
1522
|
+
const o = e, t = Me(o.field) ? o.field : void 0, r = Be(), a = f(() => o.model?.value !== void 0);
|
|
1523
|
+
return (d, s) => N((n(), m("div", Lt, [
|
|
1524
|
+
ie(ze, {
|
|
1525
|
+
title: e.title,
|
|
1526
|
+
level: e.level,
|
|
1527
|
+
"on-remove": e.onRemove,
|
|
1528
|
+
"can-remove": e.canRemove,
|
|
1529
|
+
"remove-label": e.removeLabel,
|
|
1530
|
+
optional: e.optional,
|
|
1531
|
+
"optional-enabled": a.value,
|
|
1532
|
+
"on-toggle-optional": e.onToggleOptional,
|
|
1533
|
+
disabled: e.disabled,
|
|
1534
|
+
"union-context": l(r)
|
|
1535
|
+
}, null, 8, ["title", "level", "on-remove", "can-remove", "remove-label", "optional", "optional-enabled", "on-toggle-optional", "disabled", "union-context"]),
|
|
1536
|
+
e.optional && !a.value ? (n(), w(ee, {
|
|
1537
|
+
key: 0,
|
|
1538
|
+
"on-edit": () => e.onToggleOptional?.(!0)
|
|
1539
|
+
}, null, 8, ["on-edit"])) : (n(), m(T, { key: 1 }, [
|
|
1540
|
+
l(t) ? (n(!0), m(T, { key: 0 }, X(l(t).itemFields, (v, b) => (n(), w(de, {
|
|
1541
|
+
key: b,
|
|
1542
|
+
field: v
|
|
1543
|
+
}, null, 8, ["field"]))), 128)) : k("", !0),
|
|
1544
|
+
e.error ? (n(), m("div", Ot, g(e.error), 1)) : k("", !0)
|
|
1545
|
+
], 64))
|
|
1546
|
+
], 512)), [
|
|
1547
|
+
[Q, !e.hidden]
|
|
1548
|
+
]);
|
|
1081
1549
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1550
|
+
});
|
|
1551
|
+
function qt(e, o) {
|
|
1552
|
+
const t = Vo(e), r = o ? xe({}, o) : void 0, a = eo(le(e, r));
|
|
1553
|
+
return { def: t, formData: a };
|
|
1086
1554
|
}
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1089
|
-
|
|
1555
|
+
function Mt() {
|
|
1556
|
+
return {
|
|
1557
|
+
text: De,
|
|
1558
|
+
password: De,
|
|
1559
|
+
number: De,
|
|
1560
|
+
select: Go,
|
|
1561
|
+
radio: _o,
|
|
1562
|
+
checkbox: lt,
|
|
1563
|
+
paragraph: at,
|
|
1564
|
+
action: it,
|
|
1565
|
+
object: vt,
|
|
1566
|
+
array: Bt,
|
|
1567
|
+
union: Rt,
|
|
1568
|
+
tuple: Vt
|
|
1569
|
+
};
|
|
1090
1570
|
}
|
|
1091
1571
|
export {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1572
|
+
it as OoAction,
|
|
1573
|
+
Bt as OoArray,
|
|
1574
|
+
lt as OoCheckbox,
|
|
1575
|
+
de as OoField,
|
|
1576
|
+
St as OoForm,
|
|
1577
|
+
De as OoInput,
|
|
1578
|
+
Po as OoIterator,
|
|
1579
|
+
vt as OoObject,
|
|
1580
|
+
at as OoParagraph,
|
|
1581
|
+
_o as OoRadio,
|
|
1582
|
+
Go as OoSelect,
|
|
1583
|
+
Vt as OoTuple,
|
|
1584
|
+
Rt as OoUnion,
|
|
1585
|
+
Mt as createDefaultTypes,
|
|
1586
|
+
to as formatIndexedLabel,
|
|
1587
|
+
Be as useConsumeUnionContext,
|
|
1588
|
+
qt as useFoorm,
|
|
1589
|
+
ft as useFoormArray,
|
|
1590
|
+
kt as useFoormUnion
|
|
1095
1591
|
};
|