@effect-app/vue-components 2.11.5 → 3.0.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/OmegaFormStuff.d.ts +0 -1
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +0 -1
- package/dist/vue-components.es10.js +101 -106
- package/dist/vue-components.es12.js +147 -154
- package/dist/vue-components.es6.js +31 -28
- package/dist/vue-components.es8.js +13 -13
- package/dist/vue-components.es9.js +9 -16
- package/package.json +3 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +7 -24
- package/src/components/OmegaForm/OmegaInput.vue +16 -5
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +0 -1
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +8 -19
- package/src/components/OmegaForm/useOmegaForm.ts +3 -16
- package/src/components/OmegaForm/useRegisterField.ts +1 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as i, Option as
|
|
1
|
+
import { S as i, Option as q } from "effect-app";
|
|
2
2
|
import { getMetadataFromSchema as V } from "@effect-app/vue/form";
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { isObject as
|
|
5
|
-
const
|
|
3
|
+
import { useIntl as E, getTransformationFrom as U } from "./vue-components.es3.js";
|
|
4
|
+
import { isObject as $ } from "./vue-components.es16.js";
|
|
5
|
+
const j = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKeyword" || n === i.Null.ast), g = (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, _ = (e) => {
|
|
6
6
|
const n = [];
|
|
7
7
|
for (const t of e)
|
|
8
8
|
if (i.AST.isUnion(t)) {
|
|
@@ -20,76 +20,74 @@ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
20
20
|
});
|
|
21
21
|
if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
|
|
22
22
|
return y({
|
|
23
|
-
parent: n,
|
|
24
|
-
// Pass parent to maintain the key prefix for nested structures
|
|
25
23
|
meta: e,
|
|
26
24
|
propertySignatures: t.propertySignatures
|
|
27
25
|
});
|
|
28
26
|
if (o) {
|
|
29
27
|
for (const s of o) {
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
e._isNullableDiscriminatedUnion && s.name.toString() === "_tag" || e.required === !1 ?
|
|
33
|
-
const
|
|
28
|
+
const l = n ? `${n}.${s.name.toString()}` : s.name.toString(), a = g(s.type);
|
|
29
|
+
let f;
|
|
30
|
+
e._isNullableDiscriminatedUnion && s.name.toString() === "_tag" || e.required === !1 ? f = !1 : f = !a;
|
|
31
|
+
const p = s.type;
|
|
34
32
|
if (i.AST.isUnion(s.type)) {
|
|
35
|
-
const
|
|
36
|
-
(
|
|
33
|
+
const c = _(s.type.types).filter(
|
|
34
|
+
(u) => u._tag !== "UndefinedKeyword" && u !== i.Null.ast
|
|
37
35
|
).map(U);
|
|
38
|
-
if (
|
|
39
|
-
(
|
|
36
|
+
if (c.some(
|
|
37
|
+
(u) => "propertySignatures" in u
|
|
40
38
|
)) {
|
|
41
|
-
if (!
|
|
42
|
-
const
|
|
43
|
-
parent:
|
|
39
|
+
if (!a) {
|
|
40
|
+
const u = y({
|
|
41
|
+
parent: l,
|
|
44
42
|
property: s.type,
|
|
45
|
-
meta: { required:
|
|
43
|
+
meta: { required: f, nullableOrUndefined: a }
|
|
46
44
|
});
|
|
47
|
-
|
|
45
|
+
r[l] = u;
|
|
48
46
|
}
|
|
49
|
-
for (const
|
|
50
|
-
if ("propertySignatures" in
|
|
51
|
-
const m =
|
|
47
|
+
for (const u of c)
|
|
48
|
+
if ("propertySignatures" in u) {
|
|
49
|
+
const m = a && c.length > 1;
|
|
52
50
|
Object.assign(
|
|
53
51
|
r,
|
|
54
52
|
y({
|
|
55
|
-
parent:
|
|
56
|
-
propertySignatures:
|
|
53
|
+
parent: l,
|
|
54
|
+
propertySignatures: u.propertySignatures,
|
|
57
55
|
meta: m ? { _isNullableDiscriminatedUnion: !0 } : {}
|
|
58
56
|
})
|
|
59
57
|
);
|
|
60
58
|
}
|
|
61
59
|
} else {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const m =
|
|
65
|
-
if (r[
|
|
60
|
+
const u = c.filter(i.AST.isTupleType);
|
|
61
|
+
if (u.length > 0) {
|
|
62
|
+
const m = u[0];
|
|
63
|
+
if (r[l] = {
|
|
66
64
|
type: "multiple",
|
|
67
65
|
members: m.elements,
|
|
68
66
|
rest: m.rest,
|
|
69
|
-
required:
|
|
70
|
-
nullableOrUndefined:
|
|
67
|
+
required: f,
|
|
68
|
+
nullableOrUndefined: a
|
|
71
69
|
}, m.rest && m.rest.length > 0) {
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
for (const
|
|
75
|
-
const
|
|
76
|
-
parent:
|
|
77
|
-
property:
|
|
70
|
+
const T = m.rest[0];
|
|
71
|
+
if (T.type._tag === "TypeLiteral" && "propertySignatures" in T.type)
|
|
72
|
+
for (const d of T.type.propertySignatures) {
|
|
73
|
+
const h = `${l}.${d.name.toString()}`, v = y({
|
|
74
|
+
parent: h,
|
|
75
|
+
property: d.type,
|
|
78
76
|
meta: {
|
|
79
|
-
required: !
|
|
80
|
-
nullableOrUndefined:
|
|
77
|
+
required: !g(d.type),
|
|
78
|
+
nullableOrUndefined: g(d.type)
|
|
81
79
|
}
|
|
82
80
|
});
|
|
83
|
-
if (v && typeof v == "object" && "type" in v && (r[
|
|
84
|
-
const w =
|
|
81
|
+
if (v && typeof v == "object" && "type" in v && (r[h] = v, v.type === "multiple" && i.AST.isTupleType(d.type) && d.type.rest && d.type.rest.length > 0)) {
|
|
82
|
+
const w = d.type.rest[0];
|
|
85
83
|
if (w.type._tag === "TypeLiteral" && "propertySignatures" in w.type)
|
|
86
84
|
for (const A of w.type.propertySignatures) {
|
|
87
|
-
const L = `${
|
|
85
|
+
const L = `${h}.${A.name.toString()}`, O = y({
|
|
88
86
|
parent: L,
|
|
89
87
|
property: A.type,
|
|
90
88
|
meta: {
|
|
91
|
-
required: !
|
|
92
|
-
nullableOrUndefined:
|
|
89
|
+
required: !g(A.type),
|
|
90
|
+
nullableOrUndefined: g(A.type)
|
|
93
91
|
}
|
|
94
92
|
});
|
|
95
93
|
O && typeof O == "object" && "type" in O && (r[L] = O);
|
|
@@ -99,109 +97,109 @@ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
99
97
|
}
|
|
100
98
|
} else {
|
|
101
99
|
const m = y({
|
|
102
|
-
parent:
|
|
100
|
+
parent: l,
|
|
103
101
|
property: s.type,
|
|
104
|
-
meta: { required:
|
|
102
|
+
meta: { required: f, nullableOrUndefined: a }
|
|
105
103
|
});
|
|
106
|
-
r[
|
|
104
|
+
r[l] = m;
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
107
|
} else {
|
|
110
|
-
const
|
|
111
|
-
if ("propertySignatures" in
|
|
108
|
+
const S = U(p);
|
|
109
|
+
if ("propertySignatures" in S)
|
|
112
110
|
Object.assign(
|
|
113
111
|
r,
|
|
114
112
|
y({
|
|
115
|
-
parent:
|
|
116
|
-
propertySignatures:
|
|
117
|
-
meta: { required:
|
|
113
|
+
parent: l,
|
|
114
|
+
propertySignatures: S.propertySignatures,
|
|
115
|
+
meta: { required: f, nullableOrUndefined: a }
|
|
118
116
|
})
|
|
119
117
|
);
|
|
120
118
|
else if (i.AST.isTupleType(s.type))
|
|
121
119
|
if (s.type.rest.length > 0 && s.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in s.type.rest[0].type) {
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
for (const
|
|
125
|
-
const m = `${
|
|
126
|
-
if (i.AST.isTupleType(
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
for (const
|
|
130
|
-
const
|
|
131
|
-
parent:
|
|
132
|
-
property:
|
|
120
|
+
const b = s.type.rest[0].type;
|
|
121
|
+
if (b._tag === "TypeLiteral" && "propertySignatures" in b)
|
|
122
|
+
for (const u of b.propertySignatures) {
|
|
123
|
+
const m = `${l}.${u.name.toString()}`;
|
|
124
|
+
if (i.AST.isTupleType(u.type) && u.type.rest.length > 0) {
|
|
125
|
+
const T = u.type.rest[0].type;
|
|
126
|
+
if (T._tag === "TypeLiteral" && "propertySignatures" in T)
|
|
127
|
+
for (const d of T.propertySignatures) {
|
|
128
|
+
const h = `${m}.${d.name.toString()}`, v = y({
|
|
129
|
+
parent: h,
|
|
130
|
+
property: d.type,
|
|
133
131
|
meta: {
|
|
134
|
-
required: !
|
|
135
|
-
nullableOrUndefined:
|
|
132
|
+
required: !g(d.type),
|
|
133
|
+
nullableOrUndefined: g(d.type)
|
|
136
134
|
}
|
|
137
135
|
});
|
|
138
|
-
r[
|
|
136
|
+
r[h] = v;
|
|
139
137
|
}
|
|
140
138
|
else
|
|
141
139
|
r[m] = {
|
|
142
140
|
type: "multiple",
|
|
143
|
-
members:
|
|
144
|
-
rest:
|
|
145
|
-
required: !
|
|
146
|
-
nullableOrUndefined:
|
|
141
|
+
members: u.type.elements,
|
|
142
|
+
rest: u.type.rest,
|
|
143
|
+
required: !g(u.type),
|
|
144
|
+
nullableOrUndefined: g(u.type)
|
|
147
145
|
};
|
|
148
146
|
} else {
|
|
149
|
-
const
|
|
147
|
+
const T = y({
|
|
150
148
|
parent: m,
|
|
151
|
-
property:
|
|
149
|
+
property: u.type,
|
|
152
150
|
meta: {
|
|
153
|
-
required: !
|
|
154
|
-
nullableOrUndefined:
|
|
151
|
+
required: !g(u.type),
|
|
152
|
+
nullableOrUndefined: g(u.type)
|
|
155
153
|
}
|
|
156
154
|
});
|
|
157
|
-
r[m] =
|
|
155
|
+
r[m] = T;
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
} else
|
|
161
|
-
r[
|
|
159
|
+
r[l] = {
|
|
162
160
|
type: "multiple",
|
|
163
161
|
members: s.type.elements,
|
|
164
162
|
rest: s.type.rest,
|
|
165
|
-
required:
|
|
166
|
-
nullableOrUndefined:
|
|
163
|
+
required: f,
|
|
164
|
+
nullableOrUndefined: a
|
|
167
165
|
};
|
|
168
166
|
else {
|
|
169
|
-
const
|
|
170
|
-
parent:
|
|
167
|
+
const c = y({
|
|
168
|
+
parent: l,
|
|
171
169
|
property: s.type,
|
|
172
170
|
meta: {
|
|
173
171
|
// an empty string is valid for a S.String field, so we should not mark it as required
|
|
174
172
|
// TODO: handle this better via the createMeta minLength parsing
|
|
175
|
-
required:
|
|
176
|
-
nullableOrUndefined:
|
|
173
|
+
required: f && (s.type._tag !== "StringKeyword" || V(s.type).minLength),
|
|
174
|
+
nullableOrUndefined: a
|
|
177
175
|
}
|
|
178
176
|
});
|
|
179
|
-
r[
|
|
177
|
+
r[l] = c;
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
181
|
return r;
|
|
184
182
|
}
|
|
185
183
|
if (t) {
|
|
186
|
-
const s =
|
|
184
|
+
const s = j(t);
|
|
187
185
|
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), i.AST.isUnion(t)) {
|
|
188
|
-
const
|
|
189
|
-
(
|
|
186
|
+
const a = _(t.types), f = a.find(
|
|
187
|
+
(p) => p._tag !== "UndefinedKeyword" && p !== i.Null.ast
|
|
190
188
|
);
|
|
191
|
-
return "propertySignatures" in
|
|
192
|
-
propertySignatures:
|
|
189
|
+
return "propertySignatures" in f ? y({
|
|
190
|
+
propertySignatures: f.propertySignatures,
|
|
193
191
|
parent: n,
|
|
194
192
|
meta: e
|
|
195
|
-
}) :
|
|
193
|
+
}) : a.every(i.AST.isLiteral) ? {
|
|
196
194
|
...e,
|
|
197
195
|
type: "select",
|
|
198
|
-
members:
|
|
196
|
+
members: a.map((p) => p.literal)
|
|
199
197
|
} : {
|
|
200
198
|
...e,
|
|
201
199
|
...y({
|
|
202
200
|
parent: n,
|
|
203
201
|
meta: e,
|
|
204
|
-
property:
|
|
202
|
+
property: f
|
|
205
203
|
})
|
|
206
204
|
};
|
|
207
205
|
}
|
|
@@ -213,7 +211,7 @@ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
213
211
|
} : (e = { ...i.AST.getAnnotation(
|
|
214
212
|
t,
|
|
215
213
|
i.AST.JSONSchemaAnnotationId
|
|
216
|
-
).pipe(
|
|
214
|
+
).pipe(q.getOrElse(() => ({}))), ...e }, "from" in t ? y({
|
|
217
215
|
parent: n,
|
|
218
216
|
meta: e,
|
|
219
217
|
property: t.from
|
|
@@ -221,69 +219,64 @@ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
221
219
|
t,
|
|
222
220
|
i.AST.TitleAnnotationId
|
|
223
221
|
).pipe(
|
|
224
|
-
|
|
222
|
+
q.getOrElse(() => "unknown")
|
|
225
223
|
), e));
|
|
226
224
|
}
|
|
227
225
|
return r;
|
|
228
|
-
},
|
|
226
|
+
}, N = (e, n = "") => {
|
|
229
227
|
const t = {};
|
|
230
228
|
for (const o in e) {
|
|
231
229
|
const r = e[o], s = n ? `${n}.${o}` : o;
|
|
232
|
-
r && typeof r == "object" && "type" in r ? t[s] = r : r && typeof r == "object" && Object.assign(t,
|
|
230
|
+
r && typeof r == "object" && "type" in r ? t[s] = r : r && typeof r == "object" && Object.assign(t, N(r, s));
|
|
233
231
|
}
|
|
234
232
|
return t;
|
|
235
|
-
},
|
|
236
|
-
const n = e.ast, t = {}, o = {}, r = {}
|
|
233
|
+
}, k = (e) => {
|
|
234
|
+
const n = e.ast, t = {}, o = {}, r = {};
|
|
237
235
|
if (n._tag === "Transformation" || n._tag === "Refinement")
|
|
238
|
-
return
|
|
236
|
+
return k(i.make(n.from));
|
|
239
237
|
if (n._tag === "Union") {
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
const
|
|
243
|
-
for (const
|
|
244
|
-
if ("propertySignatures" in
|
|
245
|
-
const
|
|
246
|
-
(
|
|
238
|
+
const a = (n.types || []).filter((p) => p._tag !== "UndefinedKeyword" && p !== i.Null.ast).map(U);
|
|
239
|
+
if (a.every((p) => p._tag === "TypeLiteral" && "propertySignatures" in p) && a.length > 0) {
|
|
240
|
+
const p = [];
|
|
241
|
+
for (const S of a)
|
|
242
|
+
if ("propertySignatures" in S) {
|
|
243
|
+
const c = S.propertySignatures.find(
|
|
244
|
+
(m) => m.name.toString() === "_tag"
|
|
247
245
|
);
|
|
248
|
-
let
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
propertySignatures:
|
|
246
|
+
let b = null;
|
|
247
|
+
c && i.AST.isLiteral(c.type) && (b = c.type.literal, p.push(b));
|
|
248
|
+
const u = y({
|
|
249
|
+
propertySignatures: S.propertySignatures
|
|
252
250
|
});
|
|
253
|
-
|
|
254
|
-
r[p] = q(m);
|
|
255
|
-
const g = i.make(d);
|
|
256
|
-
s[p] = h(g);
|
|
257
|
-
}
|
|
258
|
-
Object.assign(t, m);
|
|
251
|
+
b && (r[b] = N(u)), Object.assign(t, u);
|
|
259
252
|
}
|
|
260
|
-
return
|
|
253
|
+
return p.length > 0 && (t._tag = {
|
|
261
254
|
type: "select",
|
|
262
|
-
members:
|
|
255
|
+
members: p,
|
|
263
256
|
required: !0
|
|
264
|
-
}), { meta: t, defaultValues: o, unionMeta: r
|
|
257
|
+
}), { meta: t, defaultValues: o, unionMeta: r };
|
|
265
258
|
}
|
|
266
259
|
}
|
|
267
260
|
if ("propertySignatures" in n) {
|
|
268
|
-
const
|
|
261
|
+
const s = y({
|
|
269
262
|
propertySignatures: n.propertySignatures
|
|
270
263
|
});
|
|
271
|
-
if (Object.values(
|
|
272
|
-
return { meta:
|
|
273
|
-
const
|
|
274
|
-
for (const
|
|
275
|
-
const
|
|
276
|
-
|
|
264
|
+
if (Object.values(s).every((a) => a && "type" in a))
|
|
265
|
+
return { meta: s, defaultValues: o, unionMeta: r };
|
|
266
|
+
const l = (a, f = "") => {
|
|
267
|
+
for (const p in a) {
|
|
268
|
+
const S = f ? `${f}.${p}` : p;
|
|
269
|
+
a[p] && typeof a[p] == "object" && "type" in a[p] ? t[S] = a[p] : a[p] && typeof a[p] == "object" && l(a[p], S);
|
|
277
270
|
}
|
|
278
271
|
};
|
|
279
|
-
|
|
272
|
+
l(s);
|
|
280
273
|
}
|
|
281
|
-
return { meta: t, defaultValues: o, unionMeta: r
|
|
274
|
+
return { meta: t, defaultValues: o, unionMeta: r };
|
|
282
275
|
}, B = (e) => i.extend(e, i.Struct({})), z = (e) => {
|
|
283
|
-
const { meta: n,
|
|
284
|
-
return { schema: e, meta: n, unionMeta:
|
|
276
|
+
const { meta: n, unionMeta: t } = k(e);
|
|
277
|
+
return { schema: e, meta: n, unionMeta: t };
|
|
285
278
|
}, C = (e, n) => {
|
|
286
|
-
n || (n =
|
|
279
|
+
n || (n = E().trans);
|
|
287
280
|
let t;
|
|
288
281
|
switch (e.type) {
|
|
289
282
|
case "string":
|
|
@@ -394,7 +387,7 @@ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKe
|
|
|
394
387
|
function F(e, n) {
|
|
395
388
|
const t = { ...e };
|
|
396
389
|
for (const o in n)
|
|
397
|
-
Array.isArray(n[o]) ? t[o] = n[o] : n[o] &&
|
|
390
|
+
Array.isArray(n[o]) ? t[o] = n[o] : n[o] && $(n[o]) ? t[o] = F(t[o], n[o]) : t[o] = n[o];
|
|
398
391
|
return t;
|
|
399
392
|
}
|
|
400
393
|
function M(e) {
|
|
@@ -403,59 +396,59 @@ function M(e) {
|
|
|
403
396
|
function P(e) {
|
|
404
397
|
return e && "members" in e && Array.isArray(e.members);
|
|
405
398
|
}
|
|
406
|
-
const
|
|
399
|
+
const x = (e, n = {}) => {
|
|
407
400
|
const t = e.ast;
|
|
408
401
|
if (t?.defaultValue)
|
|
409
402
|
return t.defaultValue();
|
|
410
|
-
if (
|
|
403
|
+
if (g(e.ast) === "null")
|
|
411
404
|
return null;
|
|
412
|
-
if (
|
|
405
|
+
if (g(e.ast) !== "undefined") {
|
|
413
406
|
if (M(e)) {
|
|
414
407
|
const o = {};
|
|
415
408
|
for (const [r, s] of Object.entries(e.fields)) {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
409
|
+
const l = s?.ast;
|
|
410
|
+
if (l?.defaultValue)
|
|
418
411
|
try {
|
|
419
|
-
o[r] =
|
|
412
|
+
o[r] = l.defaultValue();
|
|
420
413
|
continue;
|
|
421
414
|
} catch {
|
|
422
415
|
}
|
|
423
|
-
const
|
|
424
|
-
|
|
416
|
+
const a = x(s, n[r] || {});
|
|
417
|
+
a !== void 0 && (o[r] = a);
|
|
425
418
|
}
|
|
426
419
|
return { ...o, ...n };
|
|
427
420
|
}
|
|
428
421
|
if (e?.from && M(e.from))
|
|
429
|
-
return
|
|
422
|
+
return x(e.from, n);
|
|
430
423
|
if (P(e)) {
|
|
431
|
-
const o = e.members.reduce((r, s) => (M(s) && Object.entries(s.fields).forEach(([
|
|
432
|
-
const
|
|
433
|
-
(!r[
|
|
424
|
+
const o = e.members.reduce((r, s) => (M(s) && Object.entries(s.fields).forEach(([l, a]) => {
|
|
425
|
+
const f = a.ast, p = r[l]?.ast;
|
|
426
|
+
(!r[l] || f?.defaultValue && !p?.defaultValue) && (r[l] = a);
|
|
434
427
|
}), r), {});
|
|
435
|
-
return Object.entries(o).reduce((r, [s,
|
|
428
|
+
return Object.entries(o).reduce((r, [s, l]) => (r[s] = x(l, n[s] || {}), r), n);
|
|
436
429
|
}
|
|
437
430
|
if (Object.keys(n).length === 0)
|
|
438
431
|
switch (e.ast._tag) {
|
|
439
432
|
case "Refinement":
|
|
440
|
-
return
|
|
433
|
+
return x(i.make(e.ast.from), n);
|
|
441
434
|
case "Transformation": {
|
|
442
435
|
const o = i.make(e.ast.from);
|
|
443
|
-
return
|
|
436
|
+
return x(o, n);
|
|
444
437
|
}
|
|
445
438
|
case "TypeLiteral": {
|
|
446
439
|
const o = { ...n };
|
|
447
440
|
for (const r of t.propertySignatures) {
|
|
448
|
-
const s = r.name.toString(),
|
|
449
|
-
if (
|
|
450
|
-
o[s] =
|
|
441
|
+
const s = r.name.toString(), l = r.type;
|
|
442
|
+
if (l._tag === "Transformation" && l.defaultValue) {
|
|
443
|
+
o[s] = l.defaultValue();
|
|
451
444
|
continue;
|
|
452
445
|
}
|
|
453
|
-
if (
|
|
454
|
-
o[s] =
|
|
446
|
+
if (l.defaultValue) {
|
|
447
|
+
o[s] = l.defaultValue();
|
|
455
448
|
continue;
|
|
456
449
|
}
|
|
457
|
-
const
|
|
458
|
-
|
|
450
|
+
const a = i.make(l), f = x(a, n[s] || {});
|
|
451
|
+
f !== void 0 && (o[s] = f);
|
|
459
452
|
}
|
|
460
453
|
return o;
|
|
461
454
|
}
|
|
@@ -469,11 +462,11 @@ const h = (e, n = {}) => {
|
|
|
469
462
|
export {
|
|
470
463
|
y as createMeta,
|
|
471
464
|
F as deepMerge,
|
|
472
|
-
|
|
465
|
+
x as defaultsValueFromSchema,
|
|
473
466
|
B as duplicateSchema,
|
|
474
467
|
C as generateInputStandardSchemaFromFieldMeta,
|
|
475
468
|
z as generateMetaFromSchema,
|
|
476
469
|
H as getInputType,
|
|
477
|
-
|
|
470
|
+
g as isNullableOrUndefined,
|
|
478
471
|
G as nullableInput
|
|
479
472
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as F, computed as l, useAttrs as A, inject as M, createBlock as i, openBlock as f, resolveDynamicComponent as S, withCtx as u, createCommentVNode as w, mergeProps as I, unref as L, createSlots as P, renderSlot as c, normalizeProps as d, guardReactiveProps as v } from "vue";
|
|
2
2
|
import { useIntl as j } from "./vue-components.es3.js";
|
|
3
3
|
import { generateInputStandardSchemaFromFieldMeta as B } from "./vue-components.es12.js";
|
|
4
4
|
import E from "./vue-components.es7.js";
|
|
5
5
|
import { useErrorLabel as N } from "./vue-components.es10.js";
|
|
6
|
-
const V = /* @__PURE__ */
|
|
6
|
+
const V = /* @__PURE__ */ F({
|
|
7
7
|
inheritAttrs: !1,
|
|
8
8
|
__name: "OmegaInput",
|
|
9
9
|
props: {
|
|
@@ -13,49 +13,52 @@ const V = /* @__PURE__ */ M({
|
|
|
13
13
|
name: {},
|
|
14
14
|
inputClass: {}
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const e =
|
|
16
|
+
setup(a) {
|
|
17
|
+
const e = a, n = l(() => e.name), p = A(), g = l(() => {
|
|
18
18
|
if (e.inputClass !== null)
|
|
19
|
-
return e.inputClass !== void 0 ? e.inputClass :
|
|
20
|
-
}),
|
|
19
|
+
return e.inputClass !== void 0 ? e.inputClass : p.class;
|
|
20
|
+
}), s = M(
|
|
21
21
|
"getMetaFromArray",
|
|
22
22
|
null
|
|
23
|
-
),
|
|
24
|
-
const t =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
), o = l(() => s?.value && s.value(e.name) ? s.value(n.value) : e.form.meta[n.value]), $ = l(() => {
|
|
24
|
+
const t = o.value;
|
|
25
|
+
if (!t) return n.value;
|
|
26
|
+
const r = t;
|
|
27
|
+
return `${n.value}-${r.type}-${r.minLength ?? ""}-${r.maxLength ?? ""}-${r.minimum ?? ""}-${r.maximum ?? ""}`;
|
|
28
|
+
}), { trans: C } = j(), b = l(() => {
|
|
29
|
+
if (!o.value)
|
|
28
30
|
throw console.log(e.name, Object.keys(e.form.meta), e.form.meta), new Error("Meta is undefined");
|
|
29
|
-
return B(
|
|
30
|
-
}),
|
|
31
|
-
return (t,
|
|
32
|
-
|
|
31
|
+
return B(o.value, C);
|
|
32
|
+
}), h = N(e.form);
|
|
33
|
+
return (t, r) => (f(), i(S(a.form.Field), {
|
|
34
|
+
key: $.value,
|
|
35
|
+
name: a.name,
|
|
33
36
|
validators: {
|
|
34
|
-
onChange:
|
|
35
|
-
...
|
|
37
|
+
onChange: b.value,
|
|
38
|
+
...a.validators
|
|
36
39
|
}
|
|
37
40
|
}, {
|
|
38
|
-
default:
|
|
39
|
-
|
|
41
|
+
default: u(({ field: y, state: k }) => [
|
|
42
|
+
o.value ? (f(), i(E, I({ key: 0 }, { ...t.$attrs, ...t.$props, inputClass: g.value }, {
|
|
40
43
|
field: y,
|
|
41
|
-
state:
|
|
42
|
-
register:
|
|
43
|
-
label:
|
|
44
|
-
meta:
|
|
44
|
+
state: k,
|
|
45
|
+
register: a.form.registerField,
|
|
46
|
+
label: a.label ?? L(h)(n.value),
|
|
47
|
+
meta: o.value
|
|
45
48
|
}), P({
|
|
46
|
-
default:
|
|
47
|
-
|
|
49
|
+
default: u((m) => [
|
|
50
|
+
c(t.$slots, "default", d(v(m)))
|
|
48
51
|
]),
|
|
49
52
|
_: 2
|
|
50
53
|
}, [
|
|
51
54
|
t.$slots.label ? {
|
|
52
55
|
name: "label",
|
|
53
|
-
fn:
|
|
54
|
-
|
|
56
|
+
fn: u((m) => [
|
|
57
|
+
c(t.$slots, "label", d(v(m)))
|
|
55
58
|
]),
|
|
56
59
|
key: "0"
|
|
57
60
|
} : void 0
|
|
58
|
-
]), 1040, ["field", "state", "register", "label", "meta"])) :
|
|
61
|
+
]), 1040, ["field", "state", "register", "label", "meta"])) : w("", !0)
|
|
59
62
|
]),
|
|
60
63
|
_: 3
|
|
61
64
|
}, 8, ["name", "validators"]));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as M, ref as C, computed as s, watch as b, provide as k, createBlock as F, openBlock as O, unref as f, withCtx as
|
|
1
|
+
import { defineComponent as M, ref as C, computed as s, watch as b, provide as k, createBlock as F, openBlock as O, unref as f, withCtx as c, renderSlot as o, createVNode as i, createCommentVNode as S, normalizeProps as g, guardReactiveProps as d, createSlots as V, renderList as w } from "vue";
|
|
2
2
|
import A from "./vue-components.es9.js";
|
|
3
3
|
const N = /* @__PURE__ */ M({
|
|
4
4
|
__name: "OmegaTaggedUnion",
|
|
@@ -10,28 +10,28 @@ const N = /* @__PURE__ */ M({
|
|
|
10
10
|
label: {}
|
|
11
11
|
},
|
|
12
12
|
setup(t) {
|
|
13
|
-
const n = t,
|
|
13
|
+
const n = t, r = C(null), v = s(() => n.name ? `${n.name}._tag` : "_tag"), $ = n.form.useStore((e) => e.values);
|
|
14
14
|
b(
|
|
15
|
-
() => v.value.split(".").reduce((
|
|
15
|
+
() => v.value.split(".").reduce((l, a) => l?.[a], $.value),
|
|
16
16
|
(e) => {
|
|
17
|
-
|
|
17
|
+
r.value = e ?? null;
|
|
18
18
|
},
|
|
19
19
|
{ immediate: !0 }
|
|
20
20
|
);
|
|
21
21
|
const y = s(() => {
|
|
22
|
-
const e =
|
|
22
|
+
const e = r.value;
|
|
23
23
|
return (a) => {
|
|
24
24
|
if (!e) return null;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const m = n.form.unionMeta[e];
|
|
26
|
+
return m ? m[a] ?? null : null;
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
|
-
return k("getMetaFromArray", y), (e,
|
|
29
|
+
return k("getMetaFromArray", y), (e, l) => (O(), F(f(t.form).Field, {
|
|
30
30
|
name: t.name ? `${t.name}._tag` : "_tag"
|
|
31
31
|
}, {
|
|
32
|
-
default:
|
|
32
|
+
default: c((a) => [
|
|
33
33
|
o(e.$slots, "OmegaCustomInput", g(d(a)), () => [
|
|
34
|
-
|
|
34
|
+
i(f(t.form).Input, {
|
|
35
35
|
name: t.name ? `${t.name}._tag` : "_tag",
|
|
36
36
|
label: t.label,
|
|
37
37
|
type: t.type ?? "select",
|
|
@@ -39,15 +39,15 @@ const N = /* @__PURE__ */ M({
|
|
|
39
39
|
}, null, 8, ["name", "label", "type", "options"])
|
|
40
40
|
]),
|
|
41
41
|
o(e.$slots, "default"),
|
|
42
|
-
|
|
42
|
+
i(A, {
|
|
43
43
|
field: a.field,
|
|
44
44
|
state: a.state.value,
|
|
45
45
|
name: t.name,
|
|
46
46
|
form: t.form
|
|
47
47
|
}, V({ _: 2 }, [
|
|
48
|
-
w(e.$slots, (
|
|
48
|
+
w(e.$slots, (m, u) => ({
|
|
49
49
|
name: u,
|
|
50
|
-
fn:
|
|
50
|
+
fn: c((h) => [
|
|
51
51
|
o(e.$slots, u, g(d(h)))
|
|
52
52
|
])
|
|
53
53
|
}))
|