@foormjs/vue 0.2.4 → 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 +446 -216
- package/dist/index.js +1554 -371
- package/package.json +29 -25
- 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 -1
- package/dist/style.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,156 +1,284 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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");
|
|
7
|
+
if (!o)
|
|
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;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
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 };
|
|
31
|
+
}
|
|
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;
|
|
12
47
|
}
|
|
13
|
-
|
|
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({
|
|
14
57
|
__name: "oo-field",
|
|
15
58
|
props: {
|
|
16
59
|
field: {},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: {},
|
|
23
|
-
phantom: { type: Boolean },
|
|
24
|
-
label: { type: [String, Function] },
|
|
25
|
-
description: { type: [String, Function] },
|
|
26
|
-
hint: { type: [String, Function] },
|
|
27
|
-
placeholder: { type: [String, Function] },
|
|
28
|
-
optional: { type: [Boolean, Function] },
|
|
29
|
-
disabled: { type: [Boolean, Function] },
|
|
30
|
-
hidden: { type: [Boolean, Function] },
|
|
31
|
-
readonly: { type: [Boolean, Function] },
|
|
32
|
-
classes: { type: [String, Object, Function] },
|
|
33
|
-
styles: { type: [String, Object, Function] },
|
|
34
|
-
options: { type: [Array, Function] },
|
|
35
|
-
attrs: {},
|
|
36
|
-
value: { type: Function },
|
|
37
|
-
validators: {},
|
|
38
|
-
maxLength: {},
|
|
39
|
-
minLength: {},
|
|
40
|
-
min: {},
|
|
41
|
-
max: {},
|
|
42
|
-
error: {}
|
|
60
|
+
error: {},
|
|
61
|
+
onRemove: { type: Function },
|
|
62
|
+
canRemove: { type: Boolean },
|
|
63
|
+
removeLabel: {},
|
|
64
|
+
arrayIndex: {}
|
|
43
65
|
},
|
|
44
|
-
setup(
|
|
45
|
-
const o =
|
|
46
|
-
|
|
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)
|
|
47
82
|
);
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
const u = (c) => vo(c) ? c.value : c;
|
|
84
|
+
function R(c, z, _) {
|
|
85
|
+
return c ? f(z) : _;
|
|
50
86
|
}
|
|
51
|
-
|
|
52
|
-
v: t.value.formData[o.field],
|
|
53
|
-
data: t.value.formData,
|
|
54
|
-
context: t.value.formContext ?? {},
|
|
55
|
-
entry: void 0
|
|
56
|
-
})), C = y(o.optional, V, !1), F = y(o.disabled, V, !1), _ = y(o.hidden, V, !1), g = y(o.readonly, V, !1), E = o.phantom ? void 0 : h(() => !i(C)), m = h(() => ({
|
|
57
|
-
v: t.value.formData[o.field],
|
|
58
|
-
data: t.value.formData,
|
|
59
|
-
context: t.value.formContext ?? {},
|
|
60
|
-
entry: {
|
|
61
|
-
field: o.field,
|
|
62
|
-
type: o.type,
|
|
63
|
-
component: o.component,
|
|
64
|
-
name: o.name || o.field,
|
|
65
|
-
optional: i(C),
|
|
66
|
-
disabled: i(F),
|
|
67
|
-
hidden: i(_),
|
|
68
|
-
readonly: i(g)
|
|
69
|
-
}
|
|
70
|
-
})), f = y(o.label, m, void 0), s = y(o.description, m, void 0), q = y(o.hint, m, void 0), v = y(o.placeholder, m, void 0), b = y(o.options, m, void 0), $ = y(o.styles, m, void 0), e = h(() => {
|
|
71
|
-
const l = typeof o.classes == "function" ? o.classes(m.value) : o.classes;
|
|
72
|
-
return typeof l == "string" ? {
|
|
73
|
-
[l]: !0,
|
|
74
|
-
disabled: i(F),
|
|
75
|
-
required: !i(C)
|
|
76
|
-
} : {
|
|
77
|
-
...l,
|
|
78
|
-
disabled: i(F),
|
|
79
|
-
required: !i(C)
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
function L(l, x) {
|
|
87
|
+
function P(c, z, _) {
|
|
83
88
|
return {
|
|
84
|
-
...
|
|
85
|
-
|
|
89
|
+
...typeof c == "string" ? { [c]: !0 } : c,
|
|
90
|
+
disabled: z,
|
|
91
|
+
required: _
|
|
86
92
|
};
|
|
87
93
|
}
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
100
212
|
);
|
|
101
213
|
}
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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 }
|
|
107
275
|
}));
|
|
108
|
-
return (
|
|
109
|
-
modelValue: d(t).formData[o.field],
|
|
110
|
-
"onUpdate:modelValue": x[0] || (x[0] = (k) => d(t).formData[o.field] = k),
|
|
111
|
-
rules: d(c)
|
|
112
|
-
}, {
|
|
113
|
-
default: z((k) => [
|
|
114
|
-
A(l.$slots, "default", {
|
|
115
|
-
onBlur: k.onBlur,
|
|
116
|
-
error: a.error || k.error,
|
|
117
|
-
model: k.model,
|
|
118
|
-
formData: d(t).formData,
|
|
119
|
-
formContext: d(t).formContext,
|
|
120
|
-
label: d(f),
|
|
121
|
-
description: d(s),
|
|
122
|
-
hint: d(q),
|
|
123
|
-
placeholder: d(v),
|
|
124
|
-
value: d(w),
|
|
125
|
-
classes: L(a.error, k.error),
|
|
126
|
-
styles: d($),
|
|
127
|
-
optional: d(C),
|
|
128
|
-
disabled: d(F),
|
|
129
|
-
hidden: d(_),
|
|
130
|
-
readonly: d(g),
|
|
131
|
-
type: a.type,
|
|
132
|
-
altAction: a.altAction,
|
|
133
|
-
component: a.component,
|
|
134
|
-
vName: a.name,
|
|
135
|
-
field: a.field,
|
|
136
|
-
options: d(b),
|
|
137
|
-
maxLength: a.maxLength,
|
|
138
|
-
required: d(E),
|
|
139
|
-
autocomplete: a.autocomplete,
|
|
140
|
-
attrs: j.value
|
|
141
|
-
})
|
|
142
|
-
]),
|
|
143
|
-
_: 3
|
|
144
|
-
}, 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));
|
|
145
277
|
}
|
|
146
|
-
}),
|
|
147
|
-
key: 0,
|
|
148
|
-
value: "",
|
|
149
|
-
disabled: ""
|
|
150
|
-
}, be = ["value"], xe = { class: "oo-error-slot" }, ke = { class: "oo-field-label" }, Ce = { key: 0 }, Ve = { class: "oo-radio-group" }, _e = ["value", "onUpdate:modelValue", "onBlur", "name", "disabled", "readonly"], ge = { class: "oo-error-slot" }, Be = ["onUpdate:modelValue", "onBlur", "name", "disabled", "readonly"], De = { key: 0 }, Fe = { class: "oo-error-slot" }, Ae = ["onClick"], Ue = { key: 9 }, Ee = ["disabled"], $e = /* @__PURE__ */ G({
|
|
278
|
+
}), Eo = ["disabled"], St = /* @__PURE__ */ A({
|
|
151
279
|
__name: "oo-form",
|
|
152
280
|
props: {
|
|
153
|
-
|
|
281
|
+
def: {},
|
|
154
282
|
formData: {},
|
|
155
283
|
formContext: {},
|
|
156
284
|
firstValidation: {},
|
|
@@ -158,251 +286,1306 @@ const se = /* @__PURE__ */ G({
|
|
|
158
286
|
types: {},
|
|
159
287
|
errors: {}
|
|
160
288
|
},
|
|
161
|
-
emits: ["submit", "action", "unsupported-action"],
|
|
162
|
-
setup(
|
|
163
|
-
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(() => ({
|
|
164
321
|
v: void 0,
|
|
165
|
-
data:
|
|
322
|
+
data: d(),
|
|
166
323
|
context: t.formContext ?? {},
|
|
167
324
|
entry: void 0
|
|
168
|
-
})),
|
|
169
|
-
|
|
170
|
-
|
|
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());
|
|
171
342
|
}
|
|
172
|
-
|
|
173
|
-
function
|
|
174
|
-
|
|
343
|
+
q("__foorm_action_handler", E);
|
|
344
|
+
function j(u, R, P) {
|
|
345
|
+
p("change", u, R, P, B());
|
|
175
346
|
}
|
|
176
|
-
|
|
177
|
-
|
|
347
|
+
q("__foorm_change_handler", j);
|
|
348
|
+
function M() {
|
|
349
|
+
const u = O();
|
|
350
|
+
u === !0 ? p("submit", B()) : p("error", u);
|
|
178
351
|
}
|
|
179
|
-
return (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
"form
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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)
|
|
386
|
+
]),
|
|
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));
|
|
395
|
+
}
|
|
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));
|
|
417
|
+
}
|
|
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));
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
function Ke(e) {
|
|
451
|
+
const o = J(!1);
|
|
452
|
+
function t() {
|
|
453
|
+
o.value = !o.value;
|
|
454
|
+
}
|
|
455
|
+
function r() {
|
|
456
|
+
o.value = !1;
|
|
457
|
+
}
|
|
458
|
+
function a(s) {
|
|
459
|
+
s(), r();
|
|
460
|
+
}
|
|
461
|
+
function d(s) {
|
|
462
|
+
e.value && !e.value.contains(s.target) && r();
|
|
463
|
+
}
|
|
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));
|
|
530
|
+
}
|
|
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)
|
|
194
599
|
]),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
optional: e.optional,
|
|
224
|
-
required: !e.required,
|
|
225
|
-
disabled: e.disabled,
|
|
226
|
-
hidden: e.hidden,
|
|
227
|
-
type: e.type,
|
|
228
|
-
"alt-action": e.altAction,
|
|
229
|
-
name: e.vName,
|
|
230
|
-
field: e,
|
|
231
|
-
options: e.options,
|
|
232
|
-
"max-length": e.maxLength,
|
|
233
|
-
autocomplete: e.autocomplete,
|
|
234
|
-
onAction: g
|
|
235
|
-
}, { ref_for: !0 }, e.attrs, {
|
|
236
|
-
modelValue: e.model.value,
|
|
237
|
-
"onUpdate:modelValue": (c) => e.model.value = c
|
|
238
|
-
}), 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"])) : b.component && !((j = t.components) != null && j[b.component]) ? (r(), u("div", ue, " [" + n(e.label) + '] Component "' + n(e.component) + '" not supplied ', 1)) : (w = t.types) != null && w[b.type] ? (r(), N(K(t.types[b.type]), B({
|
|
239
|
-
key: 2,
|
|
240
|
-
"on-blur": e.onBlur,
|
|
241
|
-
error: e.error,
|
|
242
|
-
model: e.model,
|
|
243
|
-
"form-data": e.formData,
|
|
244
|
-
"form-context": e.formContext,
|
|
245
|
-
label: e.label,
|
|
246
|
-
description: e.description,
|
|
247
|
-
hint: e.hint,
|
|
248
|
-
placeholder: e.placeholder,
|
|
249
|
-
class: e.classes,
|
|
250
|
-
style: e.styles,
|
|
251
|
-
optional: e.optional,
|
|
252
|
-
required: !e.required,
|
|
253
|
-
disabled: e.disabled,
|
|
254
|
-
hidden: e.hidden,
|
|
255
|
-
type: e.type,
|
|
256
|
-
"alt-action": e.altAction,
|
|
257
|
-
name: e.vName,
|
|
258
|
-
field: e,
|
|
259
|
-
options: e.options,
|
|
260
|
-
"max-length": e.maxLength,
|
|
261
|
-
autocomplete: e.autocomplete,
|
|
262
|
-
onAction: g
|
|
263
|
-
}, { ref_for: !0 }, e.attrs, {
|
|
264
|
-
modelValue: e.model.value,
|
|
265
|
-
"onUpdate:modelValue": (c) => e.model.value = c
|
|
266
|
-
}), 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(e.type) ? D((r(), u("div", {
|
|
267
|
-
key: 3,
|
|
268
|
-
class: S(["oo-default-field", e.classes])
|
|
269
|
-
}, [
|
|
270
|
-
p("label", null, n(e.label), 1),
|
|
271
|
-
e.description ? (r(), u("span", de, n(e.description), 1)) : U("", !0),
|
|
272
|
-
D(p("input", B({
|
|
273
|
-
"onUpdate:modelValue": (c) => e.model.value = c,
|
|
274
|
-
onBlur: e.onBlur,
|
|
275
|
-
placeholder: e.placeholder,
|
|
276
|
-
autocomplete: e.autocomplete,
|
|
277
|
-
name: e.vName,
|
|
278
|
-
type: e.type,
|
|
279
|
-
disabled: e.disabled,
|
|
280
|
-
readonly: e.readonly
|
|
281
|
-
}, { ref_for: !0 }, e.attrs), null, 16, ie), [
|
|
282
|
-
[W, e.model.value]
|
|
283
|
-
]),
|
|
284
|
-
p("div", me, n(e.error || e.hint), 1)
|
|
285
|
-
], 2)), [
|
|
286
|
-
[O, !e.hidden]
|
|
287
|
-
]) : e.type === "paragraph" ? (r(), u("p", pe, n(e.value), 1)) : e.type === "select" ? D((r(), u("div", {
|
|
288
|
-
key: 5,
|
|
289
|
-
class: S(["oo-default-field", e.classes])
|
|
290
|
-
}, [
|
|
291
|
-
p("label", null, n(e.label), 1),
|
|
292
|
-
e.description ? (r(), u("span", ye, n(e.description), 1)) : U("", !0),
|
|
293
|
-
D(p("select", B({
|
|
294
|
-
"onUpdate:modelValue": (c) => e.model.value = c,
|
|
295
|
-
onBlur: e.onBlur,
|
|
296
|
-
name: e.vName,
|
|
297
|
-
disabled: e.disabled,
|
|
298
|
-
readonly: e.readonly
|
|
299
|
-
}, { ref_for: !0 }, e.attrs), [
|
|
300
|
-
e.placeholder ? (r(), u("option", he, n(e.placeholder), 1)) : U("", !0),
|
|
301
|
-
(r(!0), u(R, null, T(e.options, (c) => (r(), u("option", {
|
|
302
|
-
key: m(c),
|
|
303
|
-
value: m(c)
|
|
304
|
-
}, n(f(c)), 9, be))), 128))
|
|
305
|
-
], 16, ve), [
|
|
306
|
-
[X, e.model.value]
|
|
307
|
-
]),
|
|
308
|
-
p("div", xe, n(e.error || e.hint), 1)
|
|
309
|
-
], 2)), [
|
|
310
|
-
[O, !e.hidden]
|
|
311
|
-
]) : e.type === "radio" ? D((r(), u("div", {
|
|
312
|
-
key: 6,
|
|
313
|
-
class: S(["oo-default-field oo-radio-field", e.classes])
|
|
314
|
-
}, [
|
|
315
|
-
p("span", ke, n(e.label), 1),
|
|
316
|
-
e.description ? (r(), u("span", Ce, n(e.description), 1)) : U("", !0),
|
|
317
|
-
p("div", Ve, [
|
|
318
|
-
(r(!0), u(R, null, T(e.options, (c) => (r(), u("label", {
|
|
319
|
-
key: m(c)
|
|
320
|
-
}, [
|
|
321
|
-
D(p("input", B({
|
|
322
|
-
type: "radio",
|
|
323
|
-
value: m(c),
|
|
324
|
-
"onUpdate:modelValue": (l) => e.model.value = l,
|
|
325
|
-
onBlur: e.onBlur,
|
|
326
|
-
name: e.vName,
|
|
327
|
-
disabled: e.disabled,
|
|
328
|
-
readonly: e.readonly
|
|
329
|
-
}, { ref_for: !0 }, e.attrs), null, 16, _e), [
|
|
330
|
-
[Y, e.model.value]
|
|
331
|
-
]),
|
|
332
|
-
P(" " + n(f(c)), 1)
|
|
333
|
-
]))), 128))
|
|
334
|
-
]),
|
|
335
|
-
p("div", ge, n(e.error || e.hint), 1)
|
|
336
|
-
], 2)), [
|
|
337
|
-
[O, !e.hidden]
|
|
338
|
-
]) : e.type === "checkbox" ? D((r(), u("div", {
|
|
339
|
-
key: 7,
|
|
340
|
-
class: S(["oo-default-field oo-checkbox-field", e.classes])
|
|
341
|
-
}, [
|
|
342
|
-
p("label", null, [
|
|
343
|
-
D(p("input", B({
|
|
344
|
-
type: "checkbox",
|
|
345
|
-
"onUpdate:modelValue": (c) => e.model.value = c,
|
|
346
|
-
onBlur: e.onBlur,
|
|
347
|
-
name: e.vName,
|
|
348
|
-
disabled: e.disabled,
|
|
349
|
-
readonly: e.readonly
|
|
350
|
-
}, { ref_for: !0 }, e.attrs), null, 16, Be), [
|
|
351
|
-
[Z, e.model.value]
|
|
352
|
-
]),
|
|
353
|
-
P(" " + n(e.label), 1)
|
|
354
|
-
]),
|
|
355
|
-
e.description ? (r(), u("span", De, n(e.description), 1)) : U("", !0),
|
|
356
|
-
p("div", Fe, n(e.error || e.hint), 1)
|
|
357
|
-
], 2)), [
|
|
358
|
-
[O, !e.hidden]
|
|
359
|
-
]) : e.type === "action" ? (r(), u("div", {
|
|
360
|
-
key: 8,
|
|
361
|
-
class: S(["oo-default-field oo-action-field", e.classes])
|
|
362
|
-
}, [
|
|
363
|
-
p("button", {
|
|
364
|
-
type: "button",
|
|
365
|
-
onClick: (c) => g(e.altAction)
|
|
366
|
-
}, n(e.label), 9, Ae)
|
|
367
|
-
], 2)) : (r(), u("div", Ue, " [" + n(e.label) + '] Not supported field type "' + n(e.type) + '" ' + n(e.component), 1))
|
|
368
|
-
];
|
|
369
|
-
})
|
|
370
|
-
]),
|
|
371
|
-
_: 2
|
|
372
|
-
}, 1040, ["error"]);
|
|
373
|
-
}), 128)),
|
|
374
|
-
A(s.$slots, "form.after", {
|
|
375
|
-
clearErrors: v.clearErrors,
|
|
376
|
-
reset: v.reset,
|
|
377
|
-
disabled: _.value,
|
|
378
|
-
formContext: a.formContext
|
|
379
|
-
}),
|
|
380
|
-
A(s.$slots, "form.submit", {
|
|
381
|
-
disabled: _.value,
|
|
382
|
-
text: F.value,
|
|
383
|
-
clearErrors: v.clearErrors,
|
|
384
|
-
reset: v.reset,
|
|
385
|
-
formContext: a.formContext
|
|
386
|
-
}, () => [
|
|
387
|
-
p("button", { disabled: _.value }, n(F.value), 9, Ee)
|
|
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
|
+
})
|
|
388
628
|
]),
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
})
|
|
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
|
+
]);
|
|
639
|
+
}
|
|
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
|
+
])
|
|
395
694
|
]),
|
|
396
|
-
_:
|
|
397
|
-
},
|
|
695
|
+
_: 1
|
|
696
|
+
}, 16));
|
|
697
|
+
}
|
|
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));
|
|
764
|
+
}
|
|
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));
|
|
845
|
+
}
|
|
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));
|
|
918
|
+
}
|
|
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
|
+
]);
|
|
956
|
+
}
|
|
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
|
+
]);
|
|
1003
|
+
}
|
|
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);
|
|
1054
|
+
}
|
|
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
|
+
]);
|
|
1122
|
+
}
|
|
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
|
+
() => {
|
|
1128
|
+
}
|
|
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++}`;
|
|
1137
|
+
}
|
|
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();
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
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;
|
|
1157
|
+
}
|
|
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;
|
|
1162
|
+
}
|
|
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);
|
|
1177
|
+
}
|
|
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);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
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
|
+
]);
|
|
1320
|
+
}
|
|
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: "" };
|
|
1349
|
+
}
|
|
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;
|
|
1363
|
+
}
|
|
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
|
|
1371
|
+
});
|
|
1372
|
+
const p = J(null), { isOpen: B, toggle: E, select: j } = Ke(p);
|
|
1373
|
+
function M() {
|
|
1374
|
+
s.value ? E() : e.onToggleOptional?.(!0);
|
|
1375
|
+
}
|
|
1376
|
+
return {
|
|
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
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
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
|
+
]);
|
|
1483
|
+
}
|
|
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
|
+
]);
|
|
398
1549
|
}
|
|
399
1550
|
});
|
|
400
|
-
function
|
|
401
|
-
const
|
|
402
|
-
return {
|
|
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 };
|
|
1554
|
+
}
|
|
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
|
+
};
|
|
403
1570
|
}
|
|
404
1571
|
export {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
|
408
1591
|
};
|