@effect-app/vue-components 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/OmegaForm/InputProps.d.ts +64 -0
- package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +28 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +16 -6
- package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +16 -0
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +24 -3
- package/dist/types/components/OmegaForm/index.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/vue-components.es.js +31 -618
- package/dist/vue-components.es10.js +25 -0
- package/dist/vue-components.es11.js +64 -0
- package/dist/vue-components.es12.js +9 -0
- package/dist/vue-components.es13.js +4 -0
- package/dist/vue-components.es14.js +90 -0
- package/dist/vue-components.es15.js +86 -0
- package/dist/vue-components.es16.js +13 -0
- package/dist/vue-components.es17.js +4 -0
- package/dist/vue-components.es18.js +134 -0
- package/dist/vue-components.es2.js +22 -0
- package/dist/vue-components.es20.js +6 -0
- package/dist/vue-components.es3.js +11 -0
- package/dist/vue-components.es4.js +30 -0
- package/dist/vue-components.es5.js +25 -0
- package/dist/vue-components.es6.js +218 -0
- package/dist/vue-components.es7.js +7 -0
- package/dist/vue-components.es8.js +48 -0
- package/dist/vue-components.es9.js +7 -0
- package/package.json +11 -2
- package/src/components/OmegaForm/InputProps.ts +81 -0
- package/src/components/OmegaForm/OmegaErrors.vue +69 -30
- package/src/components/OmegaForm/OmegaFormStuff.ts +2 -0
- package/src/components/OmegaForm/OmegaInput.vue +25 -38
- package/src/components/OmegaForm/OmegaInputVuetify.vue +164 -0
- package/src/components/OmegaForm/OmegaInternalInput.vue +43 -88
- package/src/components/OmegaForm/useOmegaForm.ts +3 -1
- package/src/components/style.css +1 -1
- package/src/constants/index.ts +1 -1
- package/src/env.d.ts +2 -2
- package/src/index.ts +12 -8
- package/src/utils/index.ts +9 -5
- package/dist/vue-components.css +0 -1
|
@@ -1,622 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function de(e, n) {
|
|
16
|
-
const t = le([]), s = (u) => {
|
|
17
|
-
t.value = t.value.filter((o) => o.inputId !== u);
|
|
18
|
-
}, l = (u) => {
|
|
19
|
-
s(u.inputId), t.value.push(u);
|
|
20
|
-
}, a = () => {
|
|
21
|
-
t.value = [];
|
|
22
|
-
}, d = {
|
|
23
|
-
errors: Ae(t),
|
|
24
|
-
addError: l,
|
|
25
|
-
removeError: s,
|
|
26
|
-
clearErrors: a,
|
|
27
|
-
formSubmissionAttempts: e,
|
|
28
|
-
generalErrors: n
|
|
29
|
-
};
|
|
30
|
-
return oe(N, d), d;
|
|
31
|
-
}
|
|
32
|
-
function C() {
|
|
33
|
-
const e = ue(N);
|
|
34
|
-
if (!e)
|
|
35
|
-
throw new Error("useOmegaErrors must be used within an OmegaForm provider");
|
|
36
|
-
return e;
|
|
37
|
-
}
|
|
38
|
-
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
39
|
-
__proto__: null,
|
|
40
|
-
OmegaErrorsKey: N,
|
|
41
|
-
provideOmegaErrors: de,
|
|
42
|
-
useOmegaErrors: C
|
|
43
|
-
}, Symbol.toStringTag, { value: "Module" })), fe = Symbol(), ge = () => {
|
|
44
|
-
const e = ue(fe);
|
|
45
|
-
if (!e)
|
|
46
|
-
throw new Error("useIntl must be used within a IntlProvider");
|
|
47
|
-
return e;
|
|
48
|
-
}, dt = (e) => oe(fe, e), Re = i.NonEmptyArray(i.String), De = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKeyword" || n === i.Null.ast), xe = (e) => !e || !i.AST.isUnion(e) ? !1 : e.types.find((n) => n._tag === "UndefinedKeyword") ? "undefined" : e.types.find((n) => n === i.Null.ast) ? "null" : !1, y = ({ meta: e = {}, parent: n = "", property: t, propertySignatures: s }, l = {}) => {
|
|
49
|
-
if (t && t._tag === "Transformation")
|
|
50
|
-
return y({
|
|
51
|
-
parent: n,
|
|
52
|
-
meta: e,
|
|
53
|
-
property: t.from
|
|
54
|
-
});
|
|
55
|
-
if ((t == null ? void 0 : t._tag) === "TypeLiteral" && "propertySignatures" in t)
|
|
56
|
-
return y({
|
|
57
|
-
meta: e,
|
|
58
|
-
propertySignatures: t.propertySignatures
|
|
59
|
-
});
|
|
60
|
-
if (s) {
|
|
61
|
-
for (const a of s) {
|
|
62
|
-
const d = n ? `${n}.${a.name.toString()}` : a.name.toString(), u = xe(a.type), o = e.required ?? !u;
|
|
63
|
-
let p = a.type;
|
|
64
|
-
if (i.AST.isUnion(a.type) && (p = a.type.types.find(
|
|
65
|
-
(m) => m._tag !== "UndefinedKeyword" && m !== i.Null.ast
|
|
66
|
-
)), "propertySignatures" in p)
|
|
67
|
-
Object.assign(
|
|
68
|
-
l,
|
|
69
|
-
y({
|
|
70
|
-
parent: d,
|
|
71
|
-
propertySignatures: p.propertySignatures,
|
|
72
|
-
meta: { required: o, nullableOrUndefined: u }
|
|
73
|
-
})
|
|
74
|
-
);
|
|
75
|
-
else {
|
|
76
|
-
const m = y({
|
|
77
|
-
parent: d,
|
|
78
|
-
property: a.type,
|
|
79
|
-
meta: { required: o, nullableOrUndefined: u }
|
|
80
|
-
});
|
|
81
|
-
l[d] = m;
|
|
82
|
-
}
|
|
1
|
+
import * as r from "./vue-components.es2.js";
|
|
2
|
+
import { provideIntl as s, useIntl as l } from "./vue-components.es3.js";
|
|
3
|
+
import * as m from "./vue-components.es4.js";
|
|
4
|
+
import { useOmegaForm as i } from "./vue-components.es5.js";
|
|
5
|
+
import { duplicateSchema as g, generateInputStandardSchemaFromFieldMeta as x, generateMetaFromSchema as d, nullableInput as O } from "./vue-components.es6.js";
|
|
6
|
+
import { default as E } from "./vue-components.es7.js";
|
|
7
|
+
import { default as h } from "./vue-components.es8.js";
|
|
8
|
+
import { default as C } from "./vue-components.es9.js";
|
|
9
|
+
import { OmegaErrorsCE as b, OmegaFormCE as j, OmegaInputCE as M, registerOmegaForm as k } from "./vue-components.es10.js";
|
|
10
|
+
function a(t) {
|
|
11
|
+
for (const e in r)
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(r, e)) {
|
|
13
|
+
const o = r[e];
|
|
14
|
+
o && typeof o == "object" && t.component(e, o);
|
|
83
15
|
}
|
|
84
|
-
return l;
|
|
85
|
-
}
|
|
86
|
-
if (t) {
|
|
87
|
-
const a = De(t);
|
|
88
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !a), i.AST.isUnion(t)) {
|
|
89
|
-
const u = t.types.find(
|
|
90
|
-
(o) => o._tag !== "UndefinedKeyword" && o !== i.Null.ast
|
|
91
|
-
);
|
|
92
|
-
return "propertySignatures" in u ? y({
|
|
93
|
-
propertySignatures: u.propertySignatures,
|
|
94
|
-
parent: n,
|
|
95
|
-
meta: e
|
|
96
|
-
}) : t.types.every(i.AST.isLiteral) ? {
|
|
97
|
-
...e,
|
|
98
|
-
type: "select",
|
|
99
|
-
members: t.types.map((o) => o.literal)
|
|
100
|
-
} : {
|
|
101
|
-
...e,
|
|
102
|
-
...y({
|
|
103
|
-
parent: n,
|
|
104
|
-
meta: e,
|
|
105
|
-
property: u
|
|
106
|
-
})
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (i.AST.isTupleType(t))
|
|
110
|
-
return {
|
|
111
|
-
...e,
|
|
112
|
-
type: "multiple",
|
|
113
|
-
members: t.elements
|
|
114
|
-
};
|
|
115
|
-
const d = i.AST.getAnnotation(
|
|
116
|
-
t,
|
|
117
|
-
i.AST.JSONSchemaAnnotationId
|
|
118
|
-
).pipe(S.getOrElse(() => ({})));
|
|
119
|
-
return e = { ...e, ...d }, "from" in t ? y({
|
|
120
|
-
parent: n,
|
|
121
|
-
meta: e,
|
|
122
|
-
property: t.from
|
|
123
|
-
}) : (e.type = i.AST.getAnnotation(
|
|
124
|
-
t,
|
|
125
|
-
i.AST.TitleAnnotationId
|
|
126
|
-
).pipe(
|
|
127
|
-
S.getOrElse(() => "unknown")
|
|
128
|
-
), e);
|
|
129
|
-
}
|
|
130
|
-
return l;
|
|
131
|
-
}, pe = (e) => {
|
|
132
|
-
const n = e.ast, t = {};
|
|
133
|
-
if (n._tag === "Transformation" || n._tag === "Refinement")
|
|
134
|
-
return pe(i.make(n.from));
|
|
135
|
-
if ("propertySignatures" in n) {
|
|
136
|
-
const s = y({
|
|
137
|
-
propertySignatures: n.propertySignatures
|
|
138
|
-
});
|
|
139
|
-
if (Object.values(s).every((a) => a && "type" in a))
|
|
140
|
-
return s;
|
|
141
|
-
const l = (a, d = "") => {
|
|
142
|
-
for (const u in a) {
|
|
143
|
-
const o = d ? `${d}.${u}` : u;
|
|
144
|
-
a[u] && typeof a[u] == "object" && "type" in a[u] ? t[o] = a[u] : a[u] && typeof a[u] == "object" && l(a[u], o);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
l(s);
|
|
148
|
-
}
|
|
149
|
-
return t;
|
|
150
|
-
}, ze = (e) => i.extend(e, i.Struct({})), ce = (e) => {
|
|
151
|
-
const n = pe(e), t = Ce(
|
|
152
|
-
e.ast,
|
|
153
|
-
S.liftPredicate((s) => s._tag === "Refinement" && "filter" in s),
|
|
154
|
-
S.flatMap((s) => i.AST.getJSONSchemaAnnotation(s)),
|
|
155
|
-
S.filter((s) => "items" in s),
|
|
156
|
-
S.filterMap(
|
|
157
|
-
({ items: s }) => i.decodeUnknownOption(Re)(s)
|
|
158
|
-
),
|
|
159
|
-
S.zipWith(
|
|
160
|
-
i.AST.getMessageAnnotation(e.ast),
|
|
161
|
-
(s, l) => ({
|
|
162
|
-
items: s,
|
|
163
|
-
message: l("")
|
|
164
|
-
})
|
|
165
|
-
),
|
|
166
|
-
S.getOrUndefined
|
|
167
|
-
);
|
|
168
|
-
return { schema: e, meta: n, filterItems: t };
|
|
169
|
-
}, ve = (e) => {
|
|
170
|
-
const { trans: n } = ge();
|
|
171
|
-
let t;
|
|
172
|
-
switch (e.type) {
|
|
173
|
-
case "string":
|
|
174
|
-
t = i.String.annotations({
|
|
175
|
-
message: () => n("validation.empty")
|
|
176
|
-
}), e.format === "email" && (t = i.compose(
|
|
177
|
-
t,
|
|
178
|
-
i.Email.annotations({
|
|
179
|
-
message: () => n("validation.email.invalid")
|
|
180
|
-
})
|
|
181
|
-
)), e.required && t.annotations({
|
|
182
|
-
message: () => n("validation.empty")
|
|
183
|
-
}), e.maxLength && (t = t.pipe(i.maxLength(e.maxLength)).annotations({
|
|
184
|
-
message: () => n("validation.string.maxLength", {
|
|
185
|
-
maxLength: e.maxLength
|
|
186
|
-
})
|
|
187
|
-
})), e.minLength && (t = t.pipe(i.minLength(e.minLength)).annotations({
|
|
188
|
-
message: () => n("validation.string.minLength", {
|
|
189
|
-
minLength: e.minLength
|
|
190
|
-
})
|
|
191
|
-
}));
|
|
192
|
-
break;
|
|
193
|
-
case "number":
|
|
194
|
-
t = i.Number.annotations({
|
|
195
|
-
message: () => n("validation.empty")
|
|
196
|
-
}), e.required && t.annotations({
|
|
197
|
-
message: () => n("validation.empty")
|
|
198
|
-
}), e.minimum && (t = t.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
199
|
-
message: () => n("validation.number.min", {
|
|
200
|
-
minimum: e.minimum,
|
|
201
|
-
isExclusive: !0
|
|
202
|
-
})
|
|
203
|
-
})), e.maximum && (t = t.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
|
|
204
|
-
message: () => n("validation.number.max", {
|
|
205
|
-
maximum: e.maximum,
|
|
206
|
-
isExclusive: !0
|
|
207
|
-
})
|
|
208
|
-
})), e.exclusiveMinimum && (t = t.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
|
|
209
|
-
message: () => n("validation.number.min", {
|
|
210
|
-
minimum: e.exclusiveMinimum,
|
|
211
|
-
isExclusive: !1
|
|
212
|
-
})
|
|
213
|
-
})), e.exclusiveMaximum && (t = t.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
|
|
214
|
-
message: () => n("validation.number.max", {
|
|
215
|
-
maximum: e.exclusiveMaximum,
|
|
216
|
-
isExclusive: !1
|
|
217
|
-
})
|
|
218
|
-
}));
|
|
219
|
-
break;
|
|
220
|
-
case "select":
|
|
221
|
-
t = i.Literal(...e.members).annotations({
|
|
222
|
-
message: () => ({
|
|
223
|
-
message: n("validation.not_a_valid", {
|
|
224
|
-
type: "select",
|
|
225
|
-
message: e.members.join(", ")
|
|
226
|
-
}),
|
|
227
|
-
override: !0
|
|
228
|
-
})
|
|
229
|
-
});
|
|
230
|
-
break;
|
|
231
|
-
case "multiple":
|
|
232
|
-
t = i.Array(i.String).annotations({
|
|
233
|
-
message: () => n("validation.not_a_valid", {
|
|
234
|
-
type: "multiple",
|
|
235
|
-
message: e.members.join(", ")
|
|
236
|
-
})
|
|
237
|
-
});
|
|
238
|
-
break;
|
|
239
|
-
case "boolean":
|
|
240
|
-
t = i.Boolean;
|
|
241
|
-
break;
|
|
242
|
-
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
243
|
-
case "unknown":
|
|
244
|
-
t = i.Unknown;
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
return e.required ? t.pipe(
|
|
248
|
-
i.annotations({
|
|
249
|
-
message: () => n("validation.empty")
|
|
250
|
-
})
|
|
251
|
-
) : t = i.NullishOr(t), i.standardSchemaV1(t);
|
|
252
|
-
}, Je = (e, n) => i.NullOr(e).pipe(
|
|
253
|
-
i.transform(i.typeSchema(e), {
|
|
254
|
-
decode: (t) => t ?? n(),
|
|
255
|
-
encode: (t) => t
|
|
256
|
-
})
|
|
257
|
-
), he = (e, n) => {
|
|
258
|
-
if (!e) throw new Error("Schema is required");
|
|
259
|
-
const t = i.standardSchemaV1(e), { filterItems: s, meta: l } = ce(e), a = Ne({
|
|
260
|
-
...n,
|
|
261
|
-
validators: {
|
|
262
|
-
onSubmit: t,
|
|
263
|
-
...(n == null ? void 0 : n.validators) || {}
|
|
264
|
-
},
|
|
265
|
-
onSubmit: n != null && n.onSubmit ? ({ formApi: u, meta: o, value: p }) => {
|
|
266
|
-
var m;
|
|
267
|
-
return (m = n.onSubmit) == null ? void 0 : m.call(n, {
|
|
268
|
-
formApi: u,
|
|
269
|
-
meta: o,
|
|
270
|
-
value: p
|
|
271
|
-
});
|
|
272
|
-
} : void 0
|
|
273
|
-
});
|
|
274
|
-
return Object.assign(a, { meta: l, filterItems: s });
|
|
275
|
-
}, We = ["disabled"], Ge = /* @__PURE__ */ U({
|
|
276
|
-
__name: "OmegaWrapper",
|
|
277
|
-
props: {
|
|
278
|
-
subscribe: {},
|
|
279
|
-
form: {},
|
|
280
|
-
schema: {},
|
|
281
|
-
defaultValues: {},
|
|
282
|
-
defaultState: {},
|
|
283
|
-
asyncAlways: { type: Boolean },
|
|
284
|
-
asyncDebounceMs: {},
|
|
285
|
-
validators: {},
|
|
286
|
-
onSubmitMeta: {},
|
|
287
|
-
onSubmitInvalid: { type: Function },
|
|
288
|
-
transform: {},
|
|
289
|
-
onSubmit: { type: Function }
|
|
290
|
-
},
|
|
291
|
-
setup(e, { expose: n }) {
|
|
292
|
-
const t = e, s = t.form ?? he(t.schema, t), l = $(s.store, (o) => o.isSubmitting);
|
|
293
|
-
n(s);
|
|
294
|
-
const a = Pe(
|
|
295
|
-
s,
|
|
296
|
-
t.subscribe
|
|
297
|
-
), d = $(
|
|
298
|
-
s.store,
|
|
299
|
-
(o) => o.submissionAttempts
|
|
300
|
-
), u = s.useStore((o) => o.errors);
|
|
301
|
-
return L(
|
|
302
|
-
() => [s.filterItems, u.value],
|
|
303
|
-
() => {
|
|
304
|
-
const o = s.filterItems;
|
|
305
|
-
return o ? u.value ? (Object.values(u.value).filter(
|
|
306
|
-
(m) => !!m
|
|
307
|
-
).flatMap(
|
|
308
|
-
(m) => Object.values(m).flat().map((h) => h.message)
|
|
309
|
-
).some((m) => m === o.message) && o.items.forEach((m) => {
|
|
310
|
-
const h = s.getFieldMeta(m);
|
|
311
|
-
s.setFieldMeta(m, {
|
|
312
|
-
...h,
|
|
313
|
-
errorMap: {
|
|
314
|
-
onSubmit: [{ path: [m], message: o.message }]
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
}), {}) : {} : {};
|
|
318
|
-
}
|
|
319
|
-
), de(d, u), (o, p) => (g(), k("form", {
|
|
320
|
-
onSubmit: p[0] || (p[0] = Ie((m) => f(s).handleSubmit(), ["prevent", "stop"]))
|
|
321
|
-
}, [
|
|
322
|
-
_("fieldset", { disabled: f(l) }, [
|
|
323
|
-
me(o.$slots, "default", {
|
|
324
|
-
form: f(s),
|
|
325
|
-
subscribedValues: f(a)
|
|
326
|
-
}, void 0, !0)
|
|
327
|
-
], 8, We)
|
|
328
|
-
], 32));
|
|
329
|
-
}
|
|
330
|
-
}), be = (e, n) => {
|
|
331
|
-
const t = e.__vccOpts || e;
|
|
332
|
-
for (const [s, l] of n)
|
|
333
|
-
t[s] = l;
|
|
334
|
-
return t;
|
|
335
|
-
}, ye = /* @__PURE__ */ be(Ge, [["__scopeId", "data-v-0de09910"]]), He = { class: "omega-input" }, Qe = /* @__PURE__ */ U({
|
|
336
|
-
inheritAttrs: !1,
|
|
337
|
-
__name: "OmegaInternalInput",
|
|
338
|
-
props: {
|
|
339
|
-
field: {},
|
|
340
|
-
meta: {},
|
|
341
|
-
label: {},
|
|
342
|
-
options: {},
|
|
343
|
-
type: {},
|
|
344
|
-
validators: {}
|
|
345
|
-
},
|
|
346
|
-
setup(e) {
|
|
347
|
-
const n = e, t = Me(), s = n.field, l = $(s.store, (r) => r), a = O(() => {
|
|
348
|
-
var r, c;
|
|
349
|
-
return n.type ? n.type : ((r = n.meta) == null ? void 0 : r.type) === "string" ? n.meta.format === "email" ? "email" : "string" : ((c = n.meta) == null ? void 0 : c.type) || "unknown";
|
|
350
|
-
}), d = O(() => l.value.value), u = O(
|
|
351
|
-
() => l.value.meta.errors.map((r) => r.message).filter(Boolean)
|
|
352
|
-
);
|
|
353
|
-
L(
|
|
354
|
-
() => [!!d.value],
|
|
355
|
-
() => {
|
|
356
|
-
var r, c;
|
|
357
|
-
u.value.length && !d.value && !((r = n.meta) != null && r.required) && s.setValue(
|
|
358
|
-
((c = n.meta) == null ? void 0 : c.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
), $e(() => {
|
|
362
|
-
var r, c;
|
|
363
|
-
!d.value && !((r = n.meta) != null && r.required) && ((c = n.meta) == null ? void 0 : c.nullableOrUndefined) === "null" && s.setValue(null);
|
|
364
|
-
});
|
|
365
|
-
const o = le(!1), p = () => {
|
|
366
|
-
o.value = !0;
|
|
367
|
-
}, { addError: m, formSubmissionAttempts: h, removeError: we } = C();
|
|
368
|
-
Ue(() => {
|
|
369
|
-
h.value > 0 && (o.value = !0);
|
|
370
|
-
});
|
|
371
|
-
const b = O(() => !o.value && a.value !== "select" ? [] : u.value);
|
|
372
|
-
return L(
|
|
373
|
-
() => l.value.meta.errors,
|
|
374
|
-
() => {
|
|
375
|
-
l.value.meta.errors.length ? m({
|
|
376
|
-
inputId: t,
|
|
377
|
-
errors: l.value.meta.errors.map((r) => r.message).filter(Boolean),
|
|
378
|
-
label: n.label
|
|
379
|
-
}) : we(t);
|
|
380
|
-
}
|
|
381
|
-
), (r, c) => {
|
|
382
|
-
var F, B, j, P, K, R, D, x, z, J, W, G, H, Q, X, Y, Z, ee;
|
|
383
|
-
const _e = I("v-textarea"), qe = I("v-btn");
|
|
384
|
-
return g(), k("div", He, [
|
|
385
|
-
a.value === "email" || a.value === "string" ? (g(), v(f(se), q({ key: 0 }, r.$attrs, {
|
|
386
|
-
id: f(t),
|
|
387
|
-
required: (F = r.meta) == null ? void 0 : F.required,
|
|
388
|
-
"min-length": ((B = r.meta) == null ? void 0 : B.type) === "string" && ((j = r.meta) == null ? void 0 : j.minLength),
|
|
389
|
-
"max-length": ((P = r.meta) == null ? void 0 : P.type) === "string" && ((K = r.meta) == null ? void 0 : K.maxLength),
|
|
390
|
-
type: a.value,
|
|
391
|
-
name: r.field.name,
|
|
392
|
-
label: `${r.label}${(R = r.meta) != null && R.required ? " *" : ""}`,
|
|
393
|
-
"model-value": r.field.state.value,
|
|
394
|
-
"error-messages": b.value,
|
|
395
|
-
error: !!b.value.length,
|
|
396
|
-
"onUpdate:modelValue": r.field.handleChange,
|
|
397
|
-
onBlur: p
|
|
398
|
-
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "model-value", "error-messages", "error", "onUpdate:modelValue"])) : T("", !0),
|
|
399
|
-
a.value === "text" ? (g(), v(_e, q({ key: 1 }, r.$attrs, {
|
|
400
|
-
id: f(t),
|
|
401
|
-
required: (D = r.meta) == null ? void 0 : D.required,
|
|
402
|
-
"min-length": ((x = r.meta) == null ? void 0 : x.type) === "string" && ((z = r.meta) == null ? void 0 : z.minLength),
|
|
403
|
-
"max-length": ((J = r.meta) == null ? void 0 : J.type) === "string" && ((W = r.meta) == null ? void 0 : W.maxLength),
|
|
404
|
-
type: a.value,
|
|
405
|
-
name: r.field.name,
|
|
406
|
-
label: `${r.label}${(G = r.meta) != null && G.required ? " *" : ""}`,
|
|
407
|
-
"model-value": r.field.state.value,
|
|
408
|
-
"error-messages": b.value,
|
|
409
|
-
error: !!b.value.length,
|
|
410
|
-
"onUpdate:modelValue": r.field.handleChange,
|
|
411
|
-
onBlur: p
|
|
412
|
-
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "model-value", "error-messages", "error", "onUpdate:modelValue"])) : T("", !0),
|
|
413
|
-
a.value === "number" ? (g(), v(f(se), q({ key: 2 }, r.$attrs, {
|
|
414
|
-
id: f(t),
|
|
415
|
-
required: (H = r.meta) == null ? void 0 : H.required,
|
|
416
|
-
min: ((Q = r.meta) == null ? void 0 : Q.type) === "number" && r.meta.minimum,
|
|
417
|
-
max: ((X = r.meta) == null ? void 0 : X.type) === "number" && r.meta.maximum,
|
|
418
|
-
type: a.value,
|
|
419
|
-
name: r.field.name,
|
|
420
|
-
label: `${r.label}${(Y = r.meta) != null && Y.required ? " *" : ""}`,
|
|
421
|
-
"model-value": r.field.state.value,
|
|
422
|
-
"error-messages": b.value,
|
|
423
|
-
error: !!b.value.length,
|
|
424
|
-
"onUpdate:modelValue": c[0] || (c[0] = (te) => {
|
|
425
|
-
r.field.handleChange(Number(te));
|
|
426
|
-
}),
|
|
427
|
-
onBlur: p
|
|
428
|
-
}), null, 16, ["id", "required", "min", "max", "type", "name", "label", "model-value", "error-messages", "error"])) : T("", !0),
|
|
429
|
-
a.value === "select" || a.value === "multiple" ? (g(), k("div", {
|
|
430
|
-
key: 3,
|
|
431
|
-
class: Le(a.value !== "multiple" && "d-flex align-center")
|
|
432
|
-
}, [
|
|
433
|
-
M(f(Fe), q(r.$attrs, {
|
|
434
|
-
id: f(t),
|
|
435
|
-
required: (Z = r.meta) == null ? void 0 : Z.required,
|
|
436
|
-
multiple: a.value === "multiple",
|
|
437
|
-
chips: a.value === "multiple",
|
|
438
|
-
name: r.field.name,
|
|
439
|
-
"model-value": r.field.state.value,
|
|
440
|
-
label: `${r.label}${(ee = r.meta) != null && ee.required ? " *" : ""}`,
|
|
441
|
-
items: r.options,
|
|
442
|
-
"error-messages": b.value,
|
|
443
|
-
error: !!b.value.length,
|
|
444
|
-
"onUpdate:modelValue": r.field.handleChange,
|
|
445
|
-
onBlur: p
|
|
446
|
-
}), null, 16, ["id", "required", "multiple", "chips", "name", "model-value", "label", "items", "error-messages", "error", "onUpdate:modelValue"]),
|
|
447
|
-
a.value !== "multiple" ? (g(), v(qe, {
|
|
448
|
-
key: 0,
|
|
449
|
-
"variant-btn": "secondary",
|
|
450
|
-
"variant-icon": f(Be),
|
|
451
|
-
class: "mr-2",
|
|
452
|
-
title: "Reset",
|
|
453
|
-
onClick: c[1] || (c[1] = (te) => r.field.handleChange(void 0))
|
|
454
|
-
}, null, 8, ["variant-icon"])) : T("", !0)
|
|
455
|
-
], 2)) : T("", !0)
|
|
456
|
-
]);
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
}), Se = /* @__PURE__ */ U({
|
|
460
|
-
inheritAttrs: !1,
|
|
461
|
-
__name: "OmegaInput",
|
|
462
|
-
props: {
|
|
463
|
-
form: {},
|
|
464
|
-
name: {},
|
|
465
|
-
validators: {},
|
|
466
|
-
label: {},
|
|
467
|
-
options: {},
|
|
468
|
-
type: {}
|
|
469
|
-
},
|
|
470
|
-
setup(e) {
|
|
471
|
-
const n = e, t = O(() => n.form.meta[n.name]), s = O(() => {
|
|
472
|
-
if (!t.value)
|
|
473
|
-
throw new Error("Meta is undefined");
|
|
474
|
-
return ve(t.value);
|
|
475
|
-
});
|
|
476
|
-
return (l, a) => (g(), v(A(l.form.Field), {
|
|
477
|
-
name: l.name,
|
|
478
|
-
validators: {
|
|
479
|
-
onChange: s.value,
|
|
480
|
-
...l.validators
|
|
481
|
-
}
|
|
482
|
-
}, {
|
|
483
|
-
default: E(({
|
|
484
|
-
field: d
|
|
485
|
-
}) => [
|
|
486
|
-
me(l.$slots, "default", {
|
|
487
|
-
field: d,
|
|
488
|
-
label: l.label,
|
|
489
|
-
options: l.options,
|
|
490
|
-
meta: t.value,
|
|
491
|
-
type: l.type
|
|
492
|
-
}, () => [
|
|
493
|
-
M(Qe, q(l.$attrs, {
|
|
494
|
-
field: d,
|
|
495
|
-
label: l.label,
|
|
496
|
-
options: l.options,
|
|
497
|
-
meta: t.value,
|
|
498
|
-
type: l.type
|
|
499
|
-
}), null, 16, ["field", "label", "options", "meta", "type"])
|
|
500
|
-
])
|
|
501
|
-
]),
|
|
502
|
-
_: 3
|
|
503
|
-
}, 8, ["name", "validators"]));
|
|
504
|
-
}
|
|
505
|
-
}), Xe = {
|
|
506
|
-
key: 0,
|
|
507
|
-
class: "error-alert"
|
|
508
|
-
}, Ye = { class: "text-h6 mb-3" }, Ze = { class: "font-weight-medium" }, et = { class: "error-message" }, tt = ["href"], nt = { key: 1 }, rt = /* @__PURE__ */ U({
|
|
509
|
-
__name: "OmegaErrors",
|
|
510
|
-
setup(e) {
|
|
511
|
-
const { errors: n, formSubmissionAttempts: t, generalErrors: s } = C(), { trans: l } = ge(), a = O(() => s.value ? s.value.filter(
|
|
512
|
-
(d) => !!d
|
|
513
|
-
).flatMap(
|
|
514
|
-
(d) => Object.values(d).filter((u) => !!u).flatMap(
|
|
515
|
-
(u) => u.filter(
|
|
516
|
-
(o) => !!(o != null && o.message)
|
|
517
|
-
).map((o) => o.message)
|
|
518
|
-
)
|
|
519
|
-
) : []);
|
|
520
|
-
return (d, u) => {
|
|
521
|
-
const o = I("v-icon"), p = I("v-alert");
|
|
522
|
-
return g(), v(Ve, null, {
|
|
523
|
-
default: E(() => [
|
|
524
|
-
f(t) > 0 && (f(n).length || a.value.length) ? (g(), k("div", Xe, [
|
|
525
|
-
M(p, {
|
|
526
|
-
type: "error",
|
|
527
|
-
variant: "tonal",
|
|
528
|
-
role: "alert",
|
|
529
|
-
"aria-live": "polite",
|
|
530
|
-
class: "mb-4"
|
|
531
|
-
}, {
|
|
532
|
-
default: E(() => [
|
|
533
|
-
_("div", Ye, w(f(l)("form.includes_error")) + ":", 1),
|
|
534
|
-
f(n).length ? (g(), v(A(f(n).length > 1 ? "ul" : "div"), {
|
|
535
|
-
key: 0,
|
|
536
|
-
class: "error-list"
|
|
537
|
-
}, {
|
|
538
|
-
default: E(() => [
|
|
539
|
-
(g(!0), k(ne, null, re(f(n), (m) => (g(), v(A(f(n).length > 1 ? "li" : "div"), {
|
|
540
|
-
key: m.inputId,
|
|
541
|
-
class: "error-item"
|
|
542
|
-
}, {
|
|
543
|
-
default: E(() => [
|
|
544
|
-
_("div", Ze, w(m.label), 1),
|
|
545
|
-
_("div", et, [
|
|
546
|
-
(g(), v(A(m.errors.length > 1 ? "ul" : "div"), { class: "error-list" }, {
|
|
547
|
-
default: E(() => [
|
|
548
|
-
(g(!0), k(ne, null, re(m.errors, (h) => (g(), v(A(m.errors.length > 1 ? "li" : "span"), { key: h }, {
|
|
549
|
-
default: E(() => [
|
|
550
|
-
ae(w(h), 1)
|
|
551
|
-
]),
|
|
552
|
-
_: 2
|
|
553
|
-
}, 1024))), 128))
|
|
554
|
-
]),
|
|
555
|
-
_: 2
|
|
556
|
-
}, 1024))
|
|
557
|
-
]),
|
|
558
|
-
_("a", {
|
|
559
|
-
href: `#${m.inputId}`,
|
|
560
|
-
class: "error-link"
|
|
561
|
-
}, [
|
|
562
|
-
M(o, { icon: f(je) }, null, 8, ["icon"]),
|
|
563
|
-
ae(" " + w(f(l)("form.fix_input")), 1)
|
|
564
|
-
], 8, tt)
|
|
565
|
-
]),
|
|
566
|
-
_: 2
|
|
567
|
-
}, 1024))), 128))
|
|
568
|
-
]),
|
|
569
|
-
_: 1
|
|
570
|
-
})) : (g(), k("span", nt, w(a.value[0]), 1))
|
|
571
|
-
]),
|
|
572
|
-
_: 1
|
|
573
|
-
})
|
|
574
|
-
])) : T("", !0)
|
|
575
|
-
]),
|
|
576
|
-
_: 1
|
|
577
|
-
});
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
}), Oe = /* @__PURE__ */ be(rt, [["__scopeId", "data-v-55fda615"]]), Ee = V(ye), ke = V(Se), Te = V(Oe);
|
|
581
|
-
function at() {
|
|
582
|
-
customElements.get("omega-form") || customElements.define("omega-form", Ee), customElements.get("omega-input") || customElements.define("omega-input", ke), customElements.get("omega-errors") || customElements.define("omega-errors", Te);
|
|
583
|
-
}
|
|
584
|
-
const ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
585
|
-
__proto__: null,
|
|
586
|
-
OmegaErrors: Oe,
|
|
587
|
-
OmegaErrorsCE: Te,
|
|
588
|
-
OmegaErrorsContext: Ke,
|
|
589
|
-
OmegaForm: ye,
|
|
590
|
-
OmegaFormCE: Ee,
|
|
591
|
-
OmegaInput: Se,
|
|
592
|
-
OmegaInputCE: ke,
|
|
593
|
-
duplicateSchema: ze,
|
|
594
|
-
generateInputStandardSchemaFromFieldMeta: ve,
|
|
595
|
-
generateMetaFromSchema: ce,
|
|
596
|
-
nullableInput: Je,
|
|
597
|
-
registerOmegaForm: at,
|
|
598
|
-
useOmegaForm: he
|
|
599
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
600
|
-
function st(e) {
|
|
601
|
-
for (const n in ie)
|
|
602
|
-
e.component(n, ie[n]);
|
|
603
16
|
}
|
|
604
|
-
const
|
|
17
|
+
const n = { install: a };
|
|
605
18
|
export {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
19
|
+
C as OmegaErrors,
|
|
20
|
+
b as OmegaErrorsCE,
|
|
21
|
+
m as OmegaErrorsContext,
|
|
22
|
+
E as OmegaForm,
|
|
23
|
+
j as OmegaFormCE,
|
|
24
|
+
h as OmegaInput,
|
|
25
|
+
M as OmegaInputCE,
|
|
26
|
+
n as default,
|
|
27
|
+
g as duplicateSchema,
|
|
28
|
+
x as generateInputStandardSchemaFromFieldMeta,
|
|
29
|
+
d as generateMetaFromSchema,
|
|
30
|
+
O as nullableInput,
|
|
31
|
+
s as provideIntl,
|
|
32
|
+
k as registerOmegaForm,
|
|
33
|
+
l as useIntl,
|
|
34
|
+
i as useOmegaForm
|
|
622
35
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineCustomElement as e } from "vue";
|
|
2
|
+
import m from "./vue-components.es7.js";
|
|
3
|
+
import t from "./vue-components.es8.js";
|
|
4
|
+
import o from "./vue-components.es9.js";
|
|
5
|
+
import { duplicateSchema as d, generateInputStandardSchemaFromFieldMeta as O, generateMetaFromSchema as F, nullableInput as C } from "./vue-components.es6.js";
|
|
6
|
+
import "@tanstack/vue-form";
|
|
7
|
+
import "effect-app";
|
|
8
|
+
const r = e(m), a = e(t), n = e(o);
|
|
9
|
+
function p() {
|
|
10
|
+
customElements.get("omega-form") || customElements.define("omega-form", r), customElements.get("omega-input") || customElements.define("omega-input", a), customElements.get("omega-errors") || customElements.define("omega-errors", n);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
o as OmegaErrors,
|
|
14
|
+
n as OmegaErrorsCE,
|
|
15
|
+
m as OmegaForm,
|
|
16
|
+
r as OmegaFormCE,
|
|
17
|
+
t as OmegaInput,
|
|
18
|
+
a as OmegaInputCE,
|
|
19
|
+
m as default,
|
|
20
|
+
d as duplicateSchema,
|
|
21
|
+
O as generateInputStandardSchemaFromFieldMeta,
|
|
22
|
+
F as generateMetaFromSchema,
|
|
23
|
+
C as nullableInput,
|
|
24
|
+
p as registerOmegaForm
|
|
25
|
+
};
|