@effect-app/vue-components 4.0.0-beta.21 → 4.0.0-beta.210
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 +36 -8
- package/dist/reset.css +52 -0
- package/dist/types/components/CommandButton.vue.d.ts +6 -4
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -1
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/createUseFormWithCustomInput.d.ts +2 -2
- package/dist/types/components/OmegaForm/errors.d.ts +33 -0
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/hocs.d.ts +3 -0
- package/dist/types/components/OmegaForm/index.d.ts +13 -3
- package/dist/types/components/OmegaForm/inputs.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/checks.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/createMeta.d.ts +32 -0
- package/dist/types/components/OmegaForm/meta/defaults.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/redacted.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/types.d.ts +56 -0
- package/dist/types/components/OmegaForm/meta/walker.d.ts +18 -0
- package/dist/types/components/OmegaForm/persistency.d.ts +58 -0
- package/dist/types/components/OmegaForm/submit.d.ts +60 -0
- package/dist/types/components/OmegaForm/types.d.ts +281 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +7 -213
- package/dist/types/components/OmegaForm/validation/localized.d.ts +10 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/index.d.ts +6 -6
- package/dist/vue-components.es.js +29 -45
- package/dist/vue-components10.es.js +5 -0
- package/dist/vue-components11.es.js +20 -0
- package/dist/vue-components12.es.js +49 -0
- package/dist/vue-components13.es.js +128 -0
- package/dist/vue-components14.es.js +65 -0
- package/dist/vue-components15.es.js +60 -0
- package/dist/vue-components16.es.js +22 -0
- package/dist/vue-components17.es.js +5 -0
- package/dist/vue-components18.es.js +80 -0
- package/dist/vue-components19.es.js +92 -0
- package/dist/vue-components2.es.js +11 -0
- package/dist/vue-components20.es.js +73 -0
- package/dist/vue-components21.es.js +12 -0
- package/dist/vue-components22.es.js +56 -0
- package/dist/vue-components23.es.js +5 -0
- package/dist/vue-components24.es.js +44 -0
- package/dist/vue-components25.es.js +5 -0
- package/dist/vue-components26.es.js +84 -0
- package/dist/vue-components28.es.js +8 -0
- package/dist/vue-components29.es.js +9 -0
- package/dist/vue-components3.es.js +86 -0
- package/dist/vue-components30.es.js +269 -0
- package/dist/vue-components32.es.js +8 -0
- package/dist/vue-components33.es.js +73 -0
- package/dist/vue-components34.es.js +5 -0
- package/dist/vue-components35.es.js +52 -0
- package/dist/vue-components36.es.js +5 -0
- package/dist/vue-components37.es.js +24 -0
- package/dist/vue-components38.es.js +5 -0
- package/dist/vue-components39.es.js +59 -0
- package/dist/vue-components4.es.js +5 -0
- package/dist/vue-components40.es.js +5 -0
- package/dist/vue-components41.es.js +12 -0
- package/dist/vue-components42.es.js +22 -0
- package/dist/vue-components44.es.js +9 -0
- package/dist/vue-components45.es.js +4 -0
- package/dist/vue-components46.es.js +38 -0
- package/dist/vue-components47.es.js +27 -0
- package/dist/vue-components48.es.js +28 -0
- package/dist/vue-components49.es.js +7 -0
- package/dist/vue-components5.es.js +24 -0
- package/dist/vue-components50.es.js +18 -0
- package/dist/vue-components51.es.js +36 -0
- package/dist/vue-components52.es.js +18 -0
- package/dist/vue-components53.es.js +21 -0
- package/dist/vue-components54.es.js +30 -0
- package/dist/vue-components55.es.js +7 -0
- package/dist/vue-components56.es.js +9 -0
- package/dist/vue-components57.es.js +38 -0
- package/dist/vue-components58.es.js +25 -0
- package/dist/vue-components59.es.js +128 -0
- package/dist/vue-components6.es.js +13 -0
- package/dist/vue-components60.es.js +24 -0
- package/dist/vue-components61.es.js +21 -0
- package/dist/vue-components62.es.js +9 -0
- package/dist/vue-components63.es.js +19 -0
- package/dist/vue-components64.es.js +5 -0
- package/dist/vue-components65.es.js +29 -0
- package/dist/vue-components66.es.js +5 -0
- package/dist/vue-components67.es.js +29 -0
- package/dist/vue-components68.es.js +6 -0
- package/dist/vue-components69.es.js +18 -0
- package/dist/vue-components7.es.js +13 -0
- package/dist/vue-components70.es.js +40 -0
- package/dist/vue-components71.es.js +81 -0
- package/dist/vue-components72.es.js +33 -0
- package/dist/vue-components73.es.js +19 -0
- package/dist/vue-components74.es.js +48 -0
- package/dist/vue-components8.es.js +35 -0
- package/dist/vue-components9.es.js +47 -0
- package/package.json +35 -31
- package/src/components/CommandButton.vue +55 -7
- package/src/components/OmegaForm/OmegaArray.vue +2 -4
- package/src/components/OmegaForm/OmegaAutoGen.vue +2 -1
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaFormInput.vue +1 -1
- package/src/components/OmegaForm/OmegaInput.vue +7 -36
- package/src/components/OmegaForm/OmegaInputVuetify.vue +5 -2
- package/src/components/OmegaForm/OmegaInternalInput.vue +18 -10
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +2 -1
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
- package/src/components/OmegaForm/blockDialog.ts +18 -6
- package/src/components/OmegaForm/createUseFormWithCustomInput.ts +2 -1
- package/src/components/OmegaForm/errors.ts +136 -0
- package/src/components/OmegaForm/getOmegaStore.ts +1 -1
- package/src/components/OmegaForm/hocs.ts +19 -0
- package/src/components/OmegaForm/index.ts +16 -4
- package/src/components/OmegaForm/inputs.ts +22 -0
- package/src/components/OmegaForm/meta/checks.ts +81 -0
- package/src/components/OmegaForm/meta/createMeta.ts +138 -0
- package/src/components/OmegaForm/meta/defaults.ts +132 -0
- package/src/components/OmegaForm/meta/redacted.ts +66 -0
- package/src/components/OmegaForm/meta/types.ts +78 -0
- package/src/components/OmegaForm/meta/walker.ts +248 -0
- package/src/components/OmegaForm/persistency.ts +247 -0
- package/src/components/OmegaForm/submit.ts +128 -0
- package/src/components/OmegaForm/types.ts +751 -0
- package/src/components/OmegaForm/useOmegaForm.ts +58 -893
- package/src/components/OmegaForm/validation/localized.ts +202 -0
- package/src/index.ts +0 -1
- package/src/reset.css +52 -0
- package/src/utils/index.ts +10 -7
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -157
- package/dist/types/constants/index.d.ts +0 -1
- package/dist/vue-components.es10.js +0 -239
- package/dist/vue-components.es11.js +0 -32
- package/dist/vue-components.es12.js +0 -481
- package/dist/vue-components.es13.js +0 -49
- package/dist/vue-components.es14.js +0 -4
- package/dist/vue-components.es15.js +0 -4
- package/dist/vue-components.es16.js +0 -6
- package/dist/vue-components.es17.js +0 -13
- package/dist/vue-components.es18.js +0 -57
- package/dist/vue-components.es19.js +0 -56
- package/dist/vue-components.es2.js +0 -31
- package/dist/vue-components.es20.js +0 -8
- package/dist/vue-components.es21.js +0 -8
- package/dist/vue-components.es22.js +0 -5
- package/dist/vue-components.es23.js +0 -5
- package/dist/vue-components.es24.js +0 -4
- package/dist/vue-components.es25.js +0 -4
- package/dist/vue-components.es26.js +0 -4
- package/dist/vue-components.es27.js +0 -4
- package/dist/vue-components.es28.js +0 -19
- package/dist/vue-components.es29.js +0 -13
- package/dist/vue-components.es3.js +0 -17
- package/dist/vue-components.es30.js +0 -31
- package/dist/vue-components.es31.js +0 -6
- package/dist/vue-components.es32.js +0 -4
- package/dist/vue-components.es33.js +0 -4
- package/dist/vue-components.es34.js +0 -113
- package/dist/vue-components.es36.js +0 -9
- package/dist/vue-components.es37.js +0 -34
- package/dist/vue-components.es39.js +0 -194
- package/dist/vue-components.es4.js +0 -52
- package/dist/vue-components.es41.js +0 -6
- package/dist/vue-components.es42.js +0 -25
- package/dist/vue-components.es43.js +0 -7
- package/dist/vue-components.es44.js +0 -23
- package/dist/vue-components.es45.js +0 -32
- package/dist/vue-components.es46.js +0 -24
- package/dist/vue-components.es47.js +0 -14
- package/dist/vue-components.es48.js +0 -7
- package/dist/vue-components.es49.js +0 -21
- package/dist/vue-components.es5.js +0 -52
- package/dist/vue-components.es50.js +0 -11
- package/dist/vue-components.es51.js +0 -33
- package/dist/vue-components.es52.js +0 -50
- package/dist/vue-components.es53.js +0 -28
- package/dist/vue-components.es54.js +0 -13
- package/dist/vue-components.es55.js +0 -67
- package/dist/vue-components.es56.js +0 -58
- package/dist/vue-components.es57.js +0 -19
- package/dist/vue-components.es58.js +0 -35
- package/dist/vue-components.es59.js +0 -31
- package/dist/vue-components.es6.js +0 -69
- package/dist/vue-components.es60.js +0 -44
- package/dist/vue-components.es61.js +0 -4
- package/dist/vue-components.es62.js +0 -46
- package/dist/vue-components.es63.js +0 -4
- package/dist/vue-components.es7.js +0 -83
- package/dist/vue-components.es8.js +0 -63
- package/dist/vue-components.es9.js +0 -21
- package/src/components/OmegaForm/OmegaFormStuff.ts +0 -1184
- package/src/constants/index.ts +0 -1
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
import { S as i, Effect as F, Option as U } from "effect-app";
|
|
2
|
-
import { useIntl as _, getTransformationFrom as q } from "./vue-components.es3.js";
|
|
3
|
-
import { isObject as P } from "./vue-components.es16.js";
|
|
4
|
-
const b = (e) => {
|
|
5
|
-
let t = q(e);
|
|
6
|
-
for (; i.AST.isDeclaration(t) && t.typeParameters.length > 0; )
|
|
7
|
-
t = q(t.typeParameters[0]);
|
|
8
|
-
return t;
|
|
9
|
-
}, k = (e) => i.AST.isUndefined(e) || i.AST.isNull(e), D = (e) => i.AST.isUnion(e) ? e.types.find((t) => k(t)) : !1, g = (e) => !e || !i.AST.isUnion(e) ? !1 : e.types.find((t) => i.AST.isUndefined(t)) ? "undefined" : e.types.find((t) => i.AST.isNull(t)) ? "null" : !1, j = (e) => {
|
|
10
|
-
const t = [];
|
|
11
|
-
for (const n of e)
|
|
12
|
-
if (i.AST.isUnion(n)) {
|
|
13
|
-
const r = j(n.types);
|
|
14
|
-
t.push(...r);
|
|
15
|
-
} else
|
|
16
|
-
t.push(n);
|
|
17
|
-
return t;
|
|
18
|
-
}, V = (e) => j(e).map(b).filter((t) => !k(t)), I = (e) => {
|
|
19
|
-
const t = i.AST.resolve(e)?.jsonSchema;
|
|
20
|
-
return t && typeof t == "object" ? t : {};
|
|
21
|
-
}, w = (e) => {
|
|
22
|
-
const t = e.context?.defaultValue?.[0];
|
|
23
|
-
if (t?.transformation?.decode?.run)
|
|
24
|
-
try {
|
|
25
|
-
const n = F.runSync(t.transformation.decode.run(U.none()));
|
|
26
|
-
return U.isSome(n) ? n.value : void 0;
|
|
27
|
-
} catch {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
}, G = (e) => (e.checks ?? []).flatMap((n) => {
|
|
31
|
-
if (n._tag === "FilterGroup")
|
|
32
|
-
return n.checks.flatMap((o) => {
|
|
33
|
-
const s = o.annotations?.meta;
|
|
34
|
-
return s && typeof s == "object" ? [s] : [];
|
|
35
|
-
});
|
|
36
|
-
const r = n.annotations?.meta;
|
|
37
|
-
return r && typeof r == "object" ? [r] : [];
|
|
38
|
-
}), E = (e) => {
|
|
39
|
-
const t = {
|
|
40
|
-
description: i.AST.resolveDescription(e)
|
|
41
|
-
}, n = G(e);
|
|
42
|
-
if (i.AST.isString(e)) {
|
|
43
|
-
t.type = "string";
|
|
44
|
-
for (const r of n)
|
|
45
|
-
switch (r._tag) {
|
|
46
|
-
case "isMinLength":
|
|
47
|
-
t.minLength = r.minLength;
|
|
48
|
-
break;
|
|
49
|
-
case "isMaxLength":
|
|
50
|
-
t.maxLength = r.maxLength;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
i.AST.resolveTitle(e) === "Email" && (t.format = "email");
|
|
54
|
-
} else if (i.AST.isNumber(e)) {
|
|
55
|
-
t.type = "number";
|
|
56
|
-
for (const r of n)
|
|
57
|
-
switch (r._tag) {
|
|
58
|
-
case "isInt":
|
|
59
|
-
t.refinement = "int";
|
|
60
|
-
break;
|
|
61
|
-
case "isGreaterThanOrEqualTo":
|
|
62
|
-
t.minimum = r.minimum;
|
|
63
|
-
break;
|
|
64
|
-
case "isLessThanOrEqualTo":
|
|
65
|
-
t.maximum = r.maximum;
|
|
66
|
-
break;
|
|
67
|
-
case "isGreaterThan":
|
|
68
|
-
t.exclusiveMinimum = r.exclusiveMinimum;
|
|
69
|
-
break;
|
|
70
|
-
case "isLessThan":
|
|
71
|
-
t.exclusiveMaximum = r.exclusiveMaximum;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
} else i.AST.isBoolean(e) ? t.type = "boolean" : t.type = "unknown";
|
|
75
|
-
return t;
|
|
76
|
-
}, d = ({ meta: e = {}, parent: t = "", property: n, propertySignatures: r }, o = {}) => {
|
|
77
|
-
if (n && (n = b(n)), n && i.AST.isObjects(n))
|
|
78
|
-
return d({
|
|
79
|
-
meta: e,
|
|
80
|
-
propertySignatures: n.propertySignatures
|
|
81
|
-
});
|
|
82
|
-
if (r) {
|
|
83
|
-
for (const s of r) {
|
|
84
|
-
const l = t ? `${t}.${s.name.toString()}` : s.name.toString(), a = g(s.type);
|
|
85
|
-
let u;
|
|
86
|
-
e._isNullableDiscriminatedUnion && s.name.toString() === "_tag" || e.required === !1 ? u = !1 : u = !a;
|
|
87
|
-
const m = b(s.type);
|
|
88
|
-
if (i.AST.isUnion(s.type)) {
|
|
89
|
-
const c = V(s.type.types);
|
|
90
|
-
if (c.some(i.AST.isObjects)) {
|
|
91
|
-
if (!a) {
|
|
92
|
-
const f = d({
|
|
93
|
-
parent: l,
|
|
94
|
-
property: s.type,
|
|
95
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
96
|
-
});
|
|
97
|
-
o[l] = f;
|
|
98
|
-
}
|
|
99
|
-
for (const f of c)
|
|
100
|
-
if (i.AST.isObjects(f)) {
|
|
101
|
-
const p = a && c.length > 1;
|
|
102
|
-
Object.assign(
|
|
103
|
-
o,
|
|
104
|
-
d({
|
|
105
|
-
parent: l,
|
|
106
|
-
propertySignatures: f.propertySignatures,
|
|
107
|
-
meta: p ? { _isNullableDiscriminatedUnion: !0 } : {}
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
const f = c.filter(i.AST.isArrays);
|
|
113
|
-
if (f.length > 0) {
|
|
114
|
-
const p = f[0];
|
|
115
|
-
if (o[l] = {
|
|
116
|
-
type: "multiple",
|
|
117
|
-
members: p.elements,
|
|
118
|
-
rest: p.rest,
|
|
119
|
-
required: u,
|
|
120
|
-
nullableOrUndefined: a
|
|
121
|
-
}, p.rest && p.rest.length > 0) {
|
|
122
|
-
const S = b(p.rest[0]);
|
|
123
|
-
if (i.AST.isObjects(S))
|
|
124
|
-
for (const y of S.propertySignatures) {
|
|
125
|
-
const A = `${l}.${y.name.toString()}`, h = d({
|
|
126
|
-
parent: A,
|
|
127
|
-
property: y.type,
|
|
128
|
-
meta: {
|
|
129
|
-
required: !g(y.type),
|
|
130
|
-
nullableOrUndefined: g(y.type)
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (h && typeof h == "object" && "type" in h && (o[A] = h, h.type === "multiple" && i.AST.isArrays(y.type) && y.type.rest && y.type.rest.length > 0)) {
|
|
134
|
-
const L = b(y.type.rest[0]);
|
|
135
|
-
if (i.AST.isObjects(L))
|
|
136
|
-
for (const v of L.propertySignatures) {
|
|
137
|
-
const N = `${A}.${v.name.toString()}`, x = d({
|
|
138
|
-
parent: N,
|
|
139
|
-
property: v.type,
|
|
140
|
-
meta: {
|
|
141
|
-
required: !g(v.type),
|
|
142
|
-
nullableOrUndefined: g(v.type)
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
x && typeof x == "object" && "type" in x && (o[N] = x);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
} else {
|
|
151
|
-
const p = d({
|
|
152
|
-
parent: l,
|
|
153
|
-
property: s.type,
|
|
154
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
155
|
-
});
|
|
156
|
-
o[l] = p;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
} else if (i.AST.isObjects(m))
|
|
160
|
-
Object.assign(
|
|
161
|
-
o,
|
|
162
|
-
d({
|
|
163
|
-
parent: l,
|
|
164
|
-
propertySignatures: m.propertySignatures,
|
|
165
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
166
|
-
})
|
|
167
|
-
);
|
|
168
|
-
else if (i.AST.isArrays(s.type))
|
|
169
|
-
if (s.type.rest.length > 0 && i.AST.isObjects(b(s.type.rest[0]))) {
|
|
170
|
-
const T = b(s.type.rest[0]);
|
|
171
|
-
if (i.AST.isObjects(T))
|
|
172
|
-
for (const f of T.propertySignatures) {
|
|
173
|
-
const p = `${l}.${f.name.toString()}`;
|
|
174
|
-
if (i.AST.isArrays(f.type) && f.type.rest.length > 0) {
|
|
175
|
-
const S = b(f.type.rest[0]);
|
|
176
|
-
if (i.AST.isObjects(S))
|
|
177
|
-
for (const y of S.propertySignatures) {
|
|
178
|
-
const A = `${p}.${y.name.toString()}`, h = d({
|
|
179
|
-
parent: A,
|
|
180
|
-
property: y.type,
|
|
181
|
-
meta: {
|
|
182
|
-
required: !g(y.type),
|
|
183
|
-
nullableOrUndefined: g(y.type)
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
o[A] = h;
|
|
187
|
-
}
|
|
188
|
-
else
|
|
189
|
-
o[p] = {
|
|
190
|
-
type: "multiple",
|
|
191
|
-
members: f.type.elements,
|
|
192
|
-
rest: f.type.rest,
|
|
193
|
-
required: !g(f.type),
|
|
194
|
-
nullableOrUndefined: g(f.type)
|
|
195
|
-
};
|
|
196
|
-
} else {
|
|
197
|
-
const S = d({
|
|
198
|
-
parent: p,
|
|
199
|
-
property: f.type,
|
|
200
|
-
meta: {
|
|
201
|
-
required: !g(f.type),
|
|
202
|
-
nullableOrUndefined: g(f.type)
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
o[p] = S;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
} else
|
|
209
|
-
o[l] = {
|
|
210
|
-
type: "multiple",
|
|
211
|
-
members: s.type.elements,
|
|
212
|
-
rest: s.type.rest,
|
|
213
|
-
required: u,
|
|
214
|
-
nullableOrUndefined: a
|
|
215
|
-
};
|
|
216
|
-
else {
|
|
217
|
-
const c = d({
|
|
218
|
-
parent: l,
|
|
219
|
-
property: s.type,
|
|
220
|
-
meta: {
|
|
221
|
-
// an empty string is valid for a S.String field, so we should not mark it as required
|
|
222
|
-
// TODO: handle this better via the createMeta minLength parsing
|
|
223
|
-
required: u && (!i.AST.isString(m) || !!E(s.type).minLength),
|
|
224
|
-
nullableOrUndefined: a
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
o[l] = c;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return o;
|
|
231
|
-
}
|
|
232
|
-
if (n) {
|
|
233
|
-
const s = D(n);
|
|
234
|
-
if (n = b(n), Object.hasOwnProperty.call(e, "required") || (e.required = !s), i.AST.isUnion(n)) {
|
|
235
|
-
const l = j(n.types).map(b), a = l.find((u) => !k(u));
|
|
236
|
-
return i.AST.isObjects(a) ? d({
|
|
237
|
-
propertySignatures: a.propertySignatures,
|
|
238
|
-
parent: t,
|
|
239
|
-
meta: e
|
|
240
|
-
}) : l.every((u) => k(u) || i.AST.isLiteral(u)) ? {
|
|
241
|
-
...e,
|
|
242
|
-
type: "select",
|
|
243
|
-
members: l.filter(i.AST.isLiteral).map((u) => u.literal)
|
|
244
|
-
} : {
|
|
245
|
-
...e,
|
|
246
|
-
...d({
|
|
247
|
-
parent: t,
|
|
248
|
-
meta: e,
|
|
249
|
-
property: a
|
|
250
|
-
})
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
return i.AST.isArrays(n) ? {
|
|
254
|
-
...e,
|
|
255
|
-
type: "multiple",
|
|
256
|
-
members: n.elements,
|
|
257
|
-
rest: n.rest
|
|
258
|
-
} : (e = { ...I(n), ...E(n), ...e }, e);
|
|
259
|
-
}
|
|
260
|
-
return o;
|
|
261
|
-
}, $ = (e, t = "") => {
|
|
262
|
-
const n = {};
|
|
263
|
-
for (const r in e) {
|
|
264
|
-
const o = e[r], s = t ? `${t}.${r}` : r;
|
|
265
|
-
o && typeof o == "object" && "type" in o ? n[s] = o : o && typeof o == "object" && Object.assign(n, $(o, s));
|
|
266
|
-
}
|
|
267
|
-
return n;
|
|
268
|
-
}, K = (e) => {
|
|
269
|
-
const t = b(e.ast), n = {}, r = {}, o = {};
|
|
270
|
-
if (i.AST.isUnion(t)) {
|
|
271
|
-
const s = V(t.types);
|
|
272
|
-
if (s.every(i.AST.isObjects) && s.length > 0) {
|
|
273
|
-
const a = [];
|
|
274
|
-
for (const u of s)
|
|
275
|
-
if (i.AST.isObjects(u)) {
|
|
276
|
-
const m = u.propertySignatures.find(
|
|
277
|
-
(f) => f.name.toString() === "_tag"
|
|
278
|
-
);
|
|
279
|
-
let c = null;
|
|
280
|
-
m && i.AST.isLiteral(m.type) && (c = m.type.literal, a.push(c));
|
|
281
|
-
const T = d({
|
|
282
|
-
propertySignatures: u.propertySignatures
|
|
283
|
-
});
|
|
284
|
-
c && (o[c] = $(T)), Object.assign(n, T);
|
|
285
|
-
}
|
|
286
|
-
return a.length > 0 && (n._tag = {
|
|
287
|
-
type: "select",
|
|
288
|
-
members: a,
|
|
289
|
-
required: !0
|
|
290
|
-
}), { meta: n, defaultValues: r, unionMeta: o };
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
if (i.AST.isObjects(t)) {
|
|
294
|
-
const s = d({
|
|
295
|
-
propertySignatures: t.propertySignatures
|
|
296
|
-
});
|
|
297
|
-
if (Object.values(s).every((a) => a && "type" in a))
|
|
298
|
-
return { meta: s, defaultValues: r, unionMeta: o };
|
|
299
|
-
const l = (a, u = "") => {
|
|
300
|
-
for (const m in a) {
|
|
301
|
-
const c = u ? `${u}.${m}` : m;
|
|
302
|
-
a[m] && typeof a[m] == "object" && "type" in a[m] ? n[c] = a[m] : a[m] && typeof a[m] == "object" && l(a[m], c);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
l(s);
|
|
306
|
-
}
|
|
307
|
-
return { meta: n, defaultValues: r, unionMeta: o };
|
|
308
|
-
}, Q = (e) => e, W = (e) => {
|
|
309
|
-
const { meta: t, unionMeta: n } = K(e);
|
|
310
|
-
return { schema: e, meta: t, unionMeta: n };
|
|
311
|
-
}, X = (e, t) => {
|
|
312
|
-
t || (t = _().trans);
|
|
313
|
-
let n;
|
|
314
|
-
switch (e.type) {
|
|
315
|
-
case "string":
|
|
316
|
-
n = e.format === "email" ? i.Email.annotate({
|
|
317
|
-
message: t("validation.email.invalid")
|
|
318
|
-
}) : i.String.annotate({
|
|
319
|
-
message: t("validation.empty")
|
|
320
|
-
}), e.required && (n = n.check(i.isMinLength(1, {
|
|
321
|
-
message: t("validation.empty")
|
|
322
|
-
}))), typeof e.maxLength == "number" && (n = n.check(i.isMaxLength(e.maxLength, {
|
|
323
|
-
message: t("validation.string.maxLength", {
|
|
324
|
-
maxLength: e.maxLength
|
|
325
|
-
})
|
|
326
|
-
}))), typeof e.minLength == "number" && (n = n.check(i.isMinLength(e.minLength, {
|
|
327
|
-
message: t("validation.string.minLength", {
|
|
328
|
-
minLength: e.minLength
|
|
329
|
-
})
|
|
330
|
-
})));
|
|
331
|
-
break;
|
|
332
|
-
case "number":
|
|
333
|
-
e.refinement === "int" ? n = i.Number.annotate({
|
|
334
|
-
message: t("validation.empty")
|
|
335
|
-
}).check(i.isInt({
|
|
336
|
-
message: t("validation.integer.expected", { actualValue: "NaN" })
|
|
337
|
-
})) : (n = i.Number.annotate({
|
|
338
|
-
message: t("validation.number.expected", { actualValue: "NaN" })
|
|
339
|
-
}), e.required && (n = n.annotate({
|
|
340
|
-
message: t("validation.empty")
|
|
341
|
-
}))), typeof e.minimum == "number" && (n = n.check(i.isGreaterThanOrEqualTo(e.minimum, {
|
|
342
|
-
message: t(e.minimum === 0 ? "validation.number.positive" : "validation.number.min", {
|
|
343
|
-
minimum: e.minimum,
|
|
344
|
-
isExclusive: !0
|
|
345
|
-
})
|
|
346
|
-
}))), typeof e.maximum == "number" && (n = n.check(i.isLessThanOrEqualTo(e.maximum, {
|
|
347
|
-
message: t("validation.number.max", {
|
|
348
|
-
maximum: e.maximum,
|
|
349
|
-
isExclusive: !0
|
|
350
|
-
})
|
|
351
|
-
}))), typeof e.exclusiveMinimum == "number" && (n = n.check(i.isGreaterThan(e.exclusiveMinimum, {
|
|
352
|
-
message: t(e.exclusiveMinimum === 0 ? "validation.number.positive" : "validation.number.min", {
|
|
353
|
-
minimum: e.exclusiveMinimum,
|
|
354
|
-
isExclusive: !1
|
|
355
|
-
})
|
|
356
|
-
}))), typeof e.exclusiveMaximum == "number" && (n = n.check(i.isLessThan(e.exclusiveMaximum, {
|
|
357
|
-
message: t("validation.number.max", {
|
|
358
|
-
maximum: e.exclusiveMaximum,
|
|
359
|
-
isExclusive: !1
|
|
360
|
-
})
|
|
361
|
-
})));
|
|
362
|
-
break;
|
|
363
|
-
case "select":
|
|
364
|
-
n = i.Literals(e.members).annotate({
|
|
365
|
-
message: t("validation.not_a_valid", {
|
|
366
|
-
type: "select",
|
|
367
|
-
message: e.members.join(", ")
|
|
368
|
-
})
|
|
369
|
-
});
|
|
370
|
-
break;
|
|
371
|
-
case "multiple":
|
|
372
|
-
n = i.Array(i.String).annotate({
|
|
373
|
-
message: t("validation.not_a_valid", {
|
|
374
|
-
type: "multiple",
|
|
375
|
-
message: e.members.join(", ")
|
|
376
|
-
})
|
|
377
|
-
});
|
|
378
|
-
break;
|
|
379
|
-
case "boolean":
|
|
380
|
-
n = i.Boolean;
|
|
381
|
-
break;
|
|
382
|
-
case "unknown":
|
|
383
|
-
n = i.Unknown;
|
|
384
|
-
break;
|
|
385
|
-
default:
|
|
386
|
-
console.warn(`Unhandled field type: ${e}`), n = i.Unknown;
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
return e.required || (n = i.NullishOr(n)), i.toStandardSchemaV1(n);
|
|
390
|
-
}, Y = (e, t) => i.NullOr(e), B = [
|
|
391
|
-
"button",
|
|
392
|
-
"checkbox",
|
|
393
|
-
"color",
|
|
394
|
-
"date",
|
|
395
|
-
"email",
|
|
396
|
-
"number",
|
|
397
|
-
"password",
|
|
398
|
-
"radio",
|
|
399
|
-
"range",
|
|
400
|
-
"search",
|
|
401
|
-
"submit",
|
|
402
|
-
"tel",
|
|
403
|
-
"text",
|
|
404
|
-
"time",
|
|
405
|
-
"url"
|
|
406
|
-
], Z = (e) => B.includes(e) ? e : "text";
|
|
407
|
-
function R(e, t) {
|
|
408
|
-
const n = { ...e };
|
|
409
|
-
for (const r in t)
|
|
410
|
-
Array.isArray(t[r]) ? n[r] = t[r] : t[r] && P(t[r]) ? n[r] = R(n[r], t[r]) : n[r] = t[r];
|
|
411
|
-
return n;
|
|
412
|
-
}
|
|
413
|
-
function M(e) {
|
|
414
|
-
return e && "fields" in e && typeof e.fields == "object";
|
|
415
|
-
}
|
|
416
|
-
function C(e) {
|
|
417
|
-
return e && "members" in e && Array.isArray(e.members);
|
|
418
|
-
}
|
|
419
|
-
const O = (e, t = {}) => {
|
|
420
|
-
const n = e.ast, r = w(n);
|
|
421
|
-
if (r !== void 0)
|
|
422
|
-
return r;
|
|
423
|
-
if (g(e.ast) === "null")
|
|
424
|
-
return null;
|
|
425
|
-
if (g(e.ast) !== "undefined") {
|
|
426
|
-
if (M(e)) {
|
|
427
|
-
const o = {};
|
|
428
|
-
for (const [s, l] of Object.entries(e.fields)) {
|
|
429
|
-
const a = l?.ast;
|
|
430
|
-
if (a?.defaultValue)
|
|
431
|
-
try {
|
|
432
|
-
o[s] = a.defaultValue();
|
|
433
|
-
continue;
|
|
434
|
-
} catch {
|
|
435
|
-
}
|
|
436
|
-
const u = O(l, t[s] || {});
|
|
437
|
-
u !== void 0 && (o[s] = u);
|
|
438
|
-
}
|
|
439
|
-
return { ...o, ...t };
|
|
440
|
-
}
|
|
441
|
-
if (e?.from && M(e.from))
|
|
442
|
-
return O(e.from, t);
|
|
443
|
-
if (C(e)) {
|
|
444
|
-
const o = e.members.reduce((s, l) => (M(l) && Object.entries(l.fields).forEach(([a, u]) => {
|
|
445
|
-
const m = u.ast, c = s[a]?.ast;
|
|
446
|
-
(!s[a] || m?.defaultValue && !c?.defaultValue) && (s[a] = u);
|
|
447
|
-
}), s), {});
|
|
448
|
-
return Object.keys(o).length === 0 ? Object.keys(t).length > 0 ? t : void 0 : Object.entries(o).reduce((s, [l, a]) => (s[l] = O(a, t[l] || {}), s), t);
|
|
449
|
-
}
|
|
450
|
-
if (Object.keys(t).length === 0) {
|
|
451
|
-
if (i.AST.isObjects(n)) {
|
|
452
|
-
const o = { ...t };
|
|
453
|
-
for (const s of n.propertySignatures) {
|
|
454
|
-
const l = s.name.toString(), a = s.type, u = w(a);
|
|
455
|
-
if (u !== void 0) {
|
|
456
|
-
o[l] = u;
|
|
457
|
-
continue;
|
|
458
|
-
}
|
|
459
|
-
const m = i.make(a), c = O(m, t[l] || {});
|
|
460
|
-
c !== void 0 && (o[l] = c);
|
|
461
|
-
}
|
|
462
|
-
return o;
|
|
463
|
-
}
|
|
464
|
-
if (i.AST.isString(n))
|
|
465
|
-
return "";
|
|
466
|
-
if (i.AST.isBoolean(n))
|
|
467
|
-
return !1;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
export {
|
|
472
|
-
d as createMeta,
|
|
473
|
-
R as deepMerge,
|
|
474
|
-
O as defaultsValueFromSchema,
|
|
475
|
-
Q as duplicateSchema,
|
|
476
|
-
X as generateInputStandardSchemaFromFieldMeta,
|
|
477
|
-
W as generateMetaFromSchema,
|
|
478
|
-
Z as getInputType,
|
|
479
|
-
g as isNullableOrUndefined,
|
|
480
|
-
Y as nullableInput
|
|
481
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { h as o } from "vue";
|
|
2
|
-
import d from "./vue-components.es6.js";
|
|
3
|
-
import { useOmegaForm as s } from "./vue-components.es10.js";
|
|
4
|
-
const j = (m) => (...p) => {
|
|
5
|
-
const [f, l, u] = p;
|
|
6
|
-
return s(
|
|
7
|
-
f,
|
|
8
|
-
l,
|
|
9
|
-
{
|
|
10
|
-
...u,
|
|
11
|
-
input: {
|
|
12
|
-
name: "WrappedInput",
|
|
13
|
-
inheritAttrs: !1,
|
|
14
|
-
setup(c, { attrs: a, slots: e }) {
|
|
15
|
-
return () => o(d, {
|
|
16
|
-
...c,
|
|
17
|
-
...a
|
|
18
|
-
}, {
|
|
19
|
-
// Override the default slot that OmegaInternalInput provides
|
|
20
|
-
default: ({ field: r, state: i, ...n }) => {
|
|
21
|
-
const b = Object.fromEntries(
|
|
22
|
-
Object.entries(a).filter(
|
|
23
|
-
([t]) => !Object.prototype.hasOwnProperty.call(n, t) && t !== "form"
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
return o(m, { ...b, field: r, state: i, inputProps: n }, {
|
|
27
|
-
// Pass through label slot if it exists
|
|
28
|
-
...e.label && {
|
|
29
|
-
label: (t) => e.label(t)
|
|
30
|
-
},
|
|
31
|
-
// Pass through default slot if it exists
|
|
32
|
-
...e.default && {
|
|
33
|
-
default: (t) => e.default(t)
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
// Pass through label slot to OmegaInput
|
|
38
|
-
...e.label && {
|
|
39
|
-
label: (r) => e.label(r)
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
j as createUseFormWithCustomInput
|
|
49
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Exit as c, Cause as u } from "effect";
|
|
2
|
-
import { dual as i } from "./vue-components.es30.js";
|
|
3
|
-
import { isFunction as m } from "./vue-components.es31.js";
|
|
4
|
-
const n = /* @__PURE__ */ Symbol.for("clone-trait"), a = i(2, (o, t) => n in o ? o[n](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(o)));
|
|
5
|
-
i(2, (o, t) => a(o, { ...o, ...m(t) ? t(o) : t }));
|
|
6
|
-
const O = (o, t) => new Promise((r, s) => o.addObserver((e) => {
|
|
7
|
-
c.isSuccess(e) ? r(e.value) : s(u.squash(e.cause));
|
|
8
|
-
}));
|
|
9
|
-
export {
|
|
10
|
-
a as clone,
|
|
11
|
-
n as cloneTrait,
|
|
12
|
-
O as runtimeFiberAsPromise
|
|
13
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { defineComponent as F, computed as f, onMounted as M, provide as P, createBlock as c, openBlock as s, resolveDynamicComponent as p, withCtx as g, renderSlot as o, createElementBlock as k, normalizeProps as l, guardReactiveProps as u, Fragment as A, renderList as C, mergeProps as b } from "vue";
|
|
2
|
-
const N = /* @__PURE__ */ F({
|
|
3
|
-
inheritAttrs: !1,
|
|
4
|
-
__name: "OmegaArray",
|
|
5
|
-
props: {
|
|
6
|
-
form: {},
|
|
7
|
-
inputClass: {},
|
|
8
|
-
name: {},
|
|
9
|
-
defaultItems: {},
|
|
10
|
-
items: {}
|
|
11
|
-
},
|
|
12
|
-
setup(n) {
|
|
13
|
-
const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
|
|
14
|
-
const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
|
|
15
|
-
try {
|
|
16
|
-
return e.split(".").reduce((r, t) => r && r[t], y.value);
|
|
17
|
-
} catch (r) {
|
|
18
|
-
return console.error(r), [];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
M(async () => {
|
|
22
|
-
a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
|
|
23
|
-
});
|
|
24
|
-
const $ = f(() => (r) => {
|
|
25
|
-
const t = r.replace(/\[\d+\]/g, "");
|
|
26
|
-
return a.form.meta[t];
|
|
27
|
-
});
|
|
28
|
-
return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
|
|
29
|
-
default: g(({ field: t, state: d }) => [
|
|
30
|
-
o(e.$slots, "pre-array", l(u({ field: t, state: d }))),
|
|
31
|
-
(s(!0), k(A, null, C(i.value, (B, m) => (s(), c(p(n.form.Field), {
|
|
32
|
-
key: `${n.name}[${Number(m)}]`,
|
|
33
|
-
name: (
|
|
34
|
-
// eslint-disable-next-line
|
|
35
|
-
`${n.name}[${Number(m)}]`
|
|
36
|
-
)
|
|
37
|
-
}, {
|
|
38
|
-
default: g(({ field: v, state: h }) => [
|
|
39
|
-
o(e.$slots, "default", b({ ref_for: !0 }, {
|
|
40
|
-
subField: v,
|
|
41
|
-
subState: h,
|
|
42
|
-
index: Number(m),
|
|
43
|
-
field: t
|
|
44
|
-
}))
|
|
45
|
-
]),
|
|
46
|
-
_: 2
|
|
47
|
-
}, 1032, ["name"]))), 128)),
|
|
48
|
-
o(e.$slots, "post-array", l(u({ field: t, state: d }))),
|
|
49
|
-
o(e.$slots, "field", l(u({ field: t })))
|
|
50
|
-
]),
|
|
51
|
-
_: 3
|
|
52
|
-
}, 8, ["name"]));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
export {
|
|
56
|
-
N as default
|
|
57
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { defineComponent as b, computed as O, createElementBlock as j, openBlock as M, Fragment as E, renderList as _, renderSlot as h, createVNode as B, unref as F, mergeProps as N } from "vue";
|
|
2
|
-
import { Order as l } from "effect-app";
|
|
3
|
-
const v = /* @__PURE__ */ b({
|
|
4
|
-
__name: "OmegaAutoGen",
|
|
5
|
-
props: {
|
|
6
|
-
form: {},
|
|
7
|
-
pick: {},
|
|
8
|
-
omit: {},
|
|
9
|
-
labelMap: { type: Function },
|
|
10
|
-
filterMap: { type: Function },
|
|
11
|
-
order: {},
|
|
12
|
-
sort: {}
|
|
13
|
-
},
|
|
14
|
-
setup(i) {
|
|
15
|
-
const u = (r) => (s) => Object.fromEntries(
|
|
16
|
-
Object.entries(s).map(([e, n]) => [e, r(n, e)])
|
|
17
|
-
), a = (r) => (s) => Object.fromEntries(
|
|
18
|
-
Object.entries(s).filter(([e, n]) => r(n, e))
|
|
19
|
-
), d = (r) => (s) => Object.entries(s).reduce(
|
|
20
|
-
(e, [n, o]) => {
|
|
21
|
-
const t = r(o, n);
|
|
22
|
-
return t !== !1 && (e[n] = t), e;
|
|
23
|
-
},
|
|
24
|
-
{}
|
|
25
|
-
), c = i, p = (r, s) => {
|
|
26
|
-
const e = s?.indexOf(r) ?? -1;
|
|
27
|
-
return e === -1 ? Number.MAX_SAFE_INTEGER : e;
|
|
28
|
-
}, f = l.mapInput(
|
|
29
|
-
l.Number,
|
|
30
|
-
(r) => p(r.name, c.order || [])
|
|
31
|
-
), m = O(() => {
|
|
32
|
-
const r = a(
|
|
33
|
-
(o, t) => !!o && (c.pick ? c.pick.includes(t) && !c.omit?.includes(t) : !c.omit?.includes(t))
|
|
34
|
-
)(c.form.meta), s = u((o, t) => ({
|
|
35
|
-
name: t,
|
|
36
|
-
label: c.labelMap?.(t) || t,
|
|
37
|
-
...o
|
|
38
|
-
}))(r), e = c.filterMap ? d((o) => {
|
|
39
|
-
const t = c.filterMap?.(o.name, o);
|
|
40
|
-
return t === void 0 || t === !0 ? o : t;
|
|
41
|
-
})(s) : s, n = [...Object.values(e)].sort(f);
|
|
42
|
-
return c.sort ? n.sort(c.sort) : n;
|
|
43
|
-
});
|
|
44
|
-
return (r, s) => (M(!0), j(E, null, _(m.value, ({ name: e, label: n, ...o }) => h(r.$slots, "default", {
|
|
45
|
-
child: { name: e, label: n, ...o }
|
|
46
|
-
}, () => [
|
|
47
|
-
B(F(i.form).Input, N({
|
|
48
|
-
name: e,
|
|
49
|
-
label: n
|
|
50
|
-
}, { ref_for: !0 }, o), null, 16, ["name", "label"])
|
|
51
|
-
])), 256));
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
export {
|
|
55
|
-
v as default
|
|
56
|
-
};
|