@effect-app/vue-components 1.0.0-next.21 → 1.0.0-next.3
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/OmegaAutoGen.vue.d.ts +2 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +10 -3
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +9 -23
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/index.d.ts +0 -2
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +42 -53
- package/dist/vue-components.es.js +15 -18
- package/dist/vue-components.es10.js +5 -10
- package/dist/vue-components.es11.js +54 -5
- package/dist/vue-components.es12.js +66 -49
- package/dist/vue-components.es13.js +6 -71
- package/dist/vue-components.es14.js +5 -5
- package/dist/vue-components.es15.js +3 -6
- package/dist/vue-components.es16.js +3 -3
- package/dist/vue-components.es17.js +89 -3
- package/dist/vue-components.es18.js +42 -2
- package/dist/vue-components.es19.js +2 -135
- package/dist/vue-components.es2.js +8 -11
- package/dist/vue-components.es21.js +89 -41
- package/dist/vue-components.es23.js +7 -2
- package/dist/vue-components.es24.js +27 -86
- package/dist/vue-components.es26.js +2 -7
- package/dist/vue-components.es27.js +23 -31
- package/dist/vue-components.es28.js +7 -0
- package/dist/vue-components.es29.js +21 -4
- package/dist/vue-components.es30.js +29 -10
- package/dist/vue-components.es31.js +19 -20
- package/dist/vue-components.es32.js +12 -5
- package/dist/vue-components.es33.js +5 -21
- package/dist/vue-components.es34.js +18 -29
- package/dist/vue-components.es35.js +9 -22
- package/dist/vue-components.es36.js +26 -7
- package/dist/vue-components.es37.js +48 -5
- package/dist/vue-components.es38.js +26 -19
- package/dist/vue-components.es39.js +11 -9
- package/dist/vue-components.es4.js +46 -81
- package/dist/vue-components.es40.js +60 -26
- package/dist/vue-components.es41.js +45 -37
- package/dist/vue-components.es42.js +17 -26
- package/dist/vue-components.es43.js +32 -64
- package/dist/vue-components.es44.js +28 -55
- package/dist/vue-components.es45.js +41 -16
- package/dist/vue-components.es46.js +114 -32
- package/dist/vue-components.es48.js +2 -42
- package/dist/vue-components.es49.js +44 -2
- package/dist/vue-components.es5.js +29 -51
- package/dist/vue-components.es50.js +2 -44
- package/dist/vue-components.es51.js +4 -2
- package/dist/vue-components.es6.js +207 -27
- package/dist/vue-components.es7.js +326 -202
- package/dist/vue-components.es8.js +2 -350
- package/dist/vue-components.es9.js +10 -2
- package/package.json +2 -2
- package/src/components/OmegaForm/OmegaAutoGen.vue +5 -1
- package/src/components/OmegaForm/OmegaFormInput.vue +8 -6
- package/src/components/OmegaForm/OmegaFormStuff.ts +8 -56
- package/src/components/OmegaForm/OmegaInput.vue +4 -5
- package/src/components/OmegaForm/OmegaInputVuetify.vue +2 -21
- package/src/components/OmegaForm/OmegaWrapper.vue +2 -2
- package/src/components/OmegaForm/index.ts +0 -4
- package/src/components/OmegaForm/useOmegaForm.ts +50 -320
- package/dist/vue-components.es47.js +0 -31
- /package/dist/{vue-components.es22.js → vue-components.es20.js} +0 -0
|
@@ -1,352 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTransformationFrom as U, useIntl as _ } from "./vue-components.es3.js";
|
|
3
|
-
const N = n.NonEmptyArray(n.String), E = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === n.Null.ast), g = (e) => !e || !n.AST.isUnion(e) ? !1 : e.types.find((i) => i._tag === "UndefinedKeyword") ? "undefined" : e.types.find((i) => i === n.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: p }, o = {}) => {
|
|
4
|
-
if (t && t._tag === "Transformation")
|
|
5
|
-
return m({
|
|
6
|
-
parent: i,
|
|
7
|
-
meta: e,
|
|
8
|
-
property: t.from
|
|
9
|
-
});
|
|
10
|
-
if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
|
|
11
|
-
return m({
|
|
12
|
-
meta: e,
|
|
13
|
-
propertySignatures: t.propertySignatures
|
|
14
|
-
});
|
|
15
|
-
if (p) {
|
|
16
|
-
for (const r of p) {
|
|
17
|
-
const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
|
|
18
|
-
if (n.AST.isUnion(r.type)) {
|
|
19
|
-
const T = r.type.types.filter(
|
|
20
|
-
(s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
|
|
21
|
-
).map(U);
|
|
22
|
-
if (T.some(
|
|
23
|
-
(s) => "propertySignatures" in s
|
|
24
|
-
)) {
|
|
25
|
-
if (!a) {
|
|
26
|
-
const s = m({
|
|
27
|
-
parent: l,
|
|
28
|
-
property: r.type,
|
|
29
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
30
|
-
});
|
|
31
|
-
o[l] = s;
|
|
32
|
-
}
|
|
33
|
-
for (const s of T)
|
|
34
|
-
"propertySignatures" in s && Object.assign(
|
|
35
|
-
o,
|
|
36
|
-
m({
|
|
37
|
-
parent: l,
|
|
38
|
-
propertySignatures: s.propertySignatures,
|
|
39
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
} else {
|
|
43
|
-
const s = T.filter(n.AST.isTupleType);
|
|
44
|
-
if (s.length > 0) {
|
|
45
|
-
const f = s[0];
|
|
46
|
-
if (o[l] = {
|
|
47
|
-
type: "multiple",
|
|
48
|
-
members: f.elements,
|
|
49
|
-
rest: f.rest,
|
|
50
|
-
required: u,
|
|
51
|
-
nullableOrUndefined: a
|
|
52
|
-
}, f.rest && f.rest.length > 0) {
|
|
53
|
-
const d = f.rest[0];
|
|
54
|
-
if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
|
|
55
|
-
for (const y of d.type.propertySignatures) {
|
|
56
|
-
const b = `${l}.${y.name.toString()}`, S = m({
|
|
57
|
-
parent: b,
|
|
58
|
-
property: y.type,
|
|
59
|
-
meta: {
|
|
60
|
-
required: !g(y.type),
|
|
61
|
-
nullableOrUndefined: g(y.type)
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
if (S && typeof S == "object" && "type" in S && (o[b] = S, S.type === "multiple" && n.AST.isTupleType(y.type) && y.type.rest && y.type.rest.length > 0)) {
|
|
65
|
-
const O = y.type.rest[0];
|
|
66
|
-
if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
|
|
67
|
-
for (const x of O.type.propertySignatures) {
|
|
68
|
-
const M = `${b}.${x.name.toString()}`, v = m({
|
|
69
|
-
parent: M,
|
|
70
|
-
property: x.type,
|
|
71
|
-
meta: {
|
|
72
|
-
required: !g(x.type),
|
|
73
|
-
nullableOrUndefined: g(x.type)
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
v && typeof v == "object" && "type" in v && (o[M] = v);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
const f = m({
|
|
83
|
-
parent: l,
|
|
84
|
-
property: r.type,
|
|
85
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
86
|
-
});
|
|
87
|
-
o[l] = f;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} else if ("propertySignatures" in A)
|
|
91
|
-
Object.assign(
|
|
92
|
-
o,
|
|
93
|
-
m({
|
|
94
|
-
parent: l,
|
|
95
|
-
propertySignatures: A.propertySignatures,
|
|
96
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
97
|
-
})
|
|
98
|
-
);
|
|
99
|
-
else if (n.AST.isTupleType(r.type))
|
|
100
|
-
if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
|
|
101
|
-
const h = r.type.rest[0].type;
|
|
102
|
-
if (h._tag === "TypeLiteral" && "propertySignatures" in h)
|
|
103
|
-
for (const s of h.propertySignatures) {
|
|
104
|
-
const f = `${l}.${s.name.toString()}`;
|
|
105
|
-
if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
|
|
106
|
-
const d = s.type.rest[0].type;
|
|
107
|
-
if (d._tag === "TypeLiteral" && "propertySignatures" in d)
|
|
108
|
-
for (const y of d.propertySignatures) {
|
|
109
|
-
const b = `${f}.${y.name.toString()}`, S = m({
|
|
110
|
-
parent: b,
|
|
111
|
-
property: y.type,
|
|
112
|
-
meta: {
|
|
113
|
-
required: !g(y.type),
|
|
114
|
-
nullableOrUndefined: g(y.type)
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
o[b] = S;
|
|
118
|
-
}
|
|
119
|
-
else
|
|
120
|
-
o[f] = {
|
|
121
|
-
type: "multiple",
|
|
122
|
-
members: s.type.elements,
|
|
123
|
-
rest: s.type.rest,
|
|
124
|
-
required: !g(s.type),
|
|
125
|
-
nullableOrUndefined: g(s.type)
|
|
126
|
-
};
|
|
127
|
-
} else {
|
|
128
|
-
const d = m({
|
|
129
|
-
parent: f,
|
|
130
|
-
property: s.type,
|
|
131
|
-
meta: {
|
|
132
|
-
required: !g(s.type),
|
|
133
|
-
nullableOrUndefined: g(s.type)
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
o[f] = d;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
} else
|
|
140
|
-
o[l] = {
|
|
141
|
-
type: "multiple",
|
|
142
|
-
members: r.type.elements,
|
|
143
|
-
rest: r.type.rest,
|
|
144
|
-
required: u,
|
|
145
|
-
nullableOrUndefined: a
|
|
146
|
-
};
|
|
147
|
-
else {
|
|
148
|
-
const T = m({
|
|
149
|
-
parent: l,
|
|
150
|
-
property: r.type,
|
|
151
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
152
|
-
});
|
|
153
|
-
o[l] = T;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return o;
|
|
157
|
-
}
|
|
158
|
-
if (t) {
|
|
159
|
-
const r = E(t);
|
|
160
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
|
|
161
|
-
const a = t.types.find(
|
|
162
|
-
(u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
|
|
163
|
-
);
|
|
164
|
-
return "propertySignatures" in a ? m({
|
|
165
|
-
propertySignatures: a.propertySignatures,
|
|
166
|
-
parent: i,
|
|
167
|
-
meta: e
|
|
168
|
-
}) : t.types.every(n.AST.isLiteral) ? {
|
|
169
|
-
...e,
|
|
170
|
-
type: "select",
|
|
171
|
-
members: t.types.map((u) => u.literal)
|
|
172
|
-
} : {
|
|
173
|
-
...e,
|
|
174
|
-
...m({
|
|
175
|
-
parent: i,
|
|
176
|
-
meta: e,
|
|
177
|
-
property: a
|
|
178
|
-
})
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
if (n.AST.isTupleType(t))
|
|
182
|
-
return {
|
|
183
|
-
...e,
|
|
184
|
-
type: "multiple",
|
|
185
|
-
members: t.elements,
|
|
186
|
-
rest: t.rest
|
|
187
|
-
};
|
|
188
|
-
const l = n.AST.getAnnotation(
|
|
189
|
-
t,
|
|
190
|
-
n.AST.JSONSchemaAnnotationId
|
|
191
|
-
).pipe(c.getOrElse(() => ({})));
|
|
192
|
-
return e = { ...e, ...l }, "from" in t ? m({
|
|
193
|
-
parent: i,
|
|
194
|
-
meta: e,
|
|
195
|
-
property: t.from
|
|
196
|
-
}) : (e.type = n.AST.getAnnotation(
|
|
197
|
-
t,
|
|
198
|
-
n.AST.TitleAnnotationId
|
|
199
|
-
).pipe(
|
|
200
|
-
c.getOrElse(() => "unknown")
|
|
201
|
-
), e);
|
|
202
|
-
}
|
|
203
|
-
return o;
|
|
204
|
-
}, q = (e) => {
|
|
205
|
-
const i = e.ast, t = {};
|
|
206
|
-
if (i._tag === "Transformation" || i._tag === "Refinement")
|
|
207
|
-
return q(n.make(i.from));
|
|
208
|
-
if ("propertySignatures" in i) {
|
|
209
|
-
const p = m({
|
|
210
|
-
propertySignatures: i.propertySignatures
|
|
211
|
-
});
|
|
212
|
-
if (Object.values(p).every((r) => r && "type" in r))
|
|
213
|
-
return p;
|
|
214
|
-
const o = (r, l = "") => {
|
|
215
|
-
for (const a in r) {
|
|
216
|
-
const u = l ? `${l}.${a}` : a;
|
|
217
|
-
r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
o(p);
|
|
221
|
-
}
|
|
222
|
-
return t;
|
|
223
|
-
}, I = (e) => n.extend(e, n.Struct({})), K = (e) => {
|
|
224
|
-
const i = q(e), t = L(
|
|
225
|
-
e.ast,
|
|
226
|
-
c.liftPredicate((p) => p._tag === "Refinement" && "filter" in p),
|
|
227
|
-
c.flatMap((p) => n.AST.getJSONSchemaAnnotation(p)),
|
|
228
|
-
c.filter((p) => "items" in p),
|
|
229
|
-
c.filterMap(({ items: p }) => n.decodeUnknownOption(N)(p)),
|
|
230
|
-
c.zipWith(
|
|
231
|
-
n.AST.getMessageAnnotation(e.ast),
|
|
232
|
-
(p, o) => ({
|
|
233
|
-
items: p,
|
|
234
|
-
message: o("")
|
|
235
|
-
})
|
|
236
|
-
),
|
|
237
|
-
c.getOrUndefined
|
|
238
|
-
);
|
|
239
|
-
return { schema: e, meta: i, filterItems: t };
|
|
240
|
-
}, P = (e) => {
|
|
241
|
-
const { trans: i } = _();
|
|
242
|
-
let t;
|
|
243
|
-
switch (e.type) {
|
|
244
|
-
case "string":
|
|
245
|
-
t = n.String.annotations({
|
|
246
|
-
message: () => i("validation.empty")
|
|
247
|
-
}), e.format === "email" && (t = n.compose(
|
|
248
|
-
t,
|
|
249
|
-
n.Email.annotations({
|
|
250
|
-
message: () => i("validation.email.invalid")
|
|
251
|
-
})
|
|
252
|
-
)), e.required && t.annotations({
|
|
253
|
-
message: () => i("validation.empty")
|
|
254
|
-
}), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
|
|
255
|
-
message: () => i("validation.string.maxLength", {
|
|
256
|
-
maxLength: e.maxLength
|
|
257
|
-
})
|
|
258
|
-
})), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
|
|
259
|
-
message: () => i("validation.string.minLength", {
|
|
260
|
-
minLength: e.minLength
|
|
261
|
-
})
|
|
262
|
-
}));
|
|
263
|
-
break;
|
|
264
|
-
case "number":
|
|
265
|
-
t = n.Number.annotations({
|
|
266
|
-
message: () => i("validation.empty")
|
|
267
|
-
}), e.required && t.annotations({
|
|
268
|
-
message: () => i("validation.empty")
|
|
269
|
-
}), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
270
|
-
message: () => i("validation.number.min", {
|
|
271
|
-
minimum: e.minimum,
|
|
272
|
-
isExclusive: !0
|
|
273
|
-
})
|
|
274
|
-
})), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
|
|
275
|
-
message: () => i("validation.number.max", {
|
|
276
|
-
maximum: e.maximum,
|
|
277
|
-
isExclusive: !0
|
|
278
|
-
})
|
|
279
|
-
})), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
|
|
280
|
-
message: () => i("validation.number.min", {
|
|
281
|
-
minimum: e.exclusiveMinimum,
|
|
282
|
-
isExclusive: !1
|
|
283
|
-
})
|
|
284
|
-
})), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
|
|
285
|
-
message: () => i("validation.number.max", {
|
|
286
|
-
maximum: e.exclusiveMaximum,
|
|
287
|
-
isExclusive: !1
|
|
288
|
-
})
|
|
289
|
-
}));
|
|
290
|
-
break;
|
|
291
|
-
case "select":
|
|
292
|
-
t = n.Literal(...e.members).annotations({
|
|
293
|
-
message: () => ({
|
|
294
|
-
message: i("validation.not_a_valid", {
|
|
295
|
-
type: "select",
|
|
296
|
-
message: e.members.join(", ")
|
|
297
|
-
}),
|
|
298
|
-
override: !0
|
|
299
|
-
})
|
|
300
|
-
});
|
|
301
|
-
break;
|
|
302
|
-
case "multiple":
|
|
303
|
-
t = n.Array(n.String).annotations({
|
|
304
|
-
message: () => i("validation.not_a_valid", {
|
|
305
|
-
type: "multiple",
|
|
306
|
-
message: e.members.join(", ")
|
|
307
|
-
})
|
|
308
|
-
});
|
|
309
|
-
break;
|
|
310
|
-
case "boolean":
|
|
311
|
-
t = n.Boolean;
|
|
312
|
-
break;
|
|
313
|
-
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
314
|
-
case "unknown":
|
|
315
|
-
t = n.Unknown;
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
return e.required ? t.pipe(
|
|
319
|
-
n.annotations({
|
|
320
|
-
message: () => i("validation.empty")
|
|
321
|
-
})
|
|
322
|
-
) : t = n.NullishOr(t), n.standardSchemaV1(t);
|
|
323
|
-
}, j = (e, i) => n.NullOr(e).pipe(
|
|
324
|
-
n.transform(n.typeSchema(e), {
|
|
325
|
-
decode: (t) => t ?? i(),
|
|
326
|
-
encode: (t) => t
|
|
327
|
-
})
|
|
328
|
-
), k = [
|
|
329
|
-
"button",
|
|
330
|
-
"checkbox",
|
|
331
|
-
"color",
|
|
332
|
-
"date",
|
|
333
|
-
"email",
|
|
334
|
-
"number",
|
|
335
|
-
"password",
|
|
336
|
-
"radio",
|
|
337
|
-
"range",
|
|
338
|
-
"search",
|
|
339
|
-
"submit",
|
|
340
|
-
"tel",
|
|
341
|
-
"text",
|
|
342
|
-
"time",
|
|
343
|
-
"url"
|
|
344
|
-
], F = (e) => k.includes(e) ? e : "text";
|
|
1
|
+
import f from "./vue-components.es4.js";
|
|
345
2
|
export {
|
|
346
|
-
|
|
347
|
-
I as duplicateSchema,
|
|
348
|
-
P as generateInputStandardSchemaFromFieldMeta,
|
|
349
|
-
K as generateMetaFromSchema,
|
|
350
|
-
F as getInputType,
|
|
351
|
-
j as nullableInput
|
|
3
|
+
f as default
|
|
352
4
|
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Exit as c, Runtime as s } from "effect";
|
|
2
|
+
import { dual as n, isFunction as m } from "./vue-components.es18.js";
|
|
3
|
+
const i = Symbol.for("clone-trait"), u = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
|
|
4
|
+
n(2, (e, t) => u(e, { ...e, ...m(t) ? t(e) : t }));
|
|
5
|
+
const b = (e) => new Promise((t, r) => e.addObserver((o) => {
|
|
6
|
+
c.isSuccess(o) ? t(o.value) : r(s.makeFiberFailure(o.cause));
|
|
7
|
+
}));
|
|
2
8
|
export {
|
|
3
|
-
|
|
9
|
+
u as clone,
|
|
10
|
+
i as cloneTrait,
|
|
11
|
+
b as runtimeFiberAsPromise
|
|
4
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"effect": "^3.17.13",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@tanstack/vue-form": "^1.23.0",
|
|
50
50
|
"highlight.js": "^11.11.1",
|
|
51
51
|
"vue3-highlightjs": "^1.0.5",
|
|
52
|
-
"@effect-app/vue": "2.80.
|
|
52
|
+
"@effect-app/vue": "2.80.2",
|
|
53
53
|
"effect-app": "3.8.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
23
23
|
import { Array as A, Order, pipe } from "effect-app"
|
|
24
24
|
import { computed } from "vue"
|
|
25
|
-
import { type FieldMeta, type
|
|
25
|
+
import { type FieldMeta, type OmegaInputProps } from "./OmegaFormStuff"
|
|
26
26
|
|
|
27
|
+
export type OmegaAutoGenMeta<
|
|
28
|
+
From extends Record<PropertyKey, string>,
|
|
29
|
+
To extends Record<PropertyKey, string>
|
|
30
|
+
> = Omit<OmegaInputProps<From, To>, "form">
|
|
27
31
|
type NewMeta = OmegaAutoGenMeta<From, To>
|
|
28
32
|
|
|
29
33
|
const mapObject = <K extends string, A, B>(fn: (value: A, key: K) => B) => (obj: Record<K, A>): Record<K, B> =>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
27
27
|
import { inject } from "vue"
|
|
28
28
|
import type { InputProps } from "./InputProps"
|
|
29
|
-
import type {
|
|
29
|
+
import type { FieldValidators, OmegaInputProps, TypeOverride } from "./OmegaFormStuff"
|
|
30
30
|
import OmegaInput from "./OmegaInput.vue"
|
|
31
31
|
import { OmegaFormKey } from "./useOmegaForm"
|
|
32
32
|
|
|
@@ -39,11 +39,13 @@ if (!form) {
|
|
|
39
39
|
throw new Error("OmegaFormInput must be used within an OmegaForm context")
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
defineProps<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
defineProps<{
|
|
43
|
+
name: Name
|
|
44
|
+
label?: string
|
|
45
|
+
validators?: FieldValidators<From>
|
|
46
|
+
options?: { title: string; value: string }[]
|
|
47
|
+
type?: TypeOverride
|
|
48
|
+
}>()
|
|
47
49
|
|
|
48
50
|
defineSlots<{
|
|
49
51
|
default(props: InputProps<From, Name>): void
|
|
@@ -4,42 +4,21 @@ import { type DeepKeys, type FieldAsyncValidateOrFn, type FieldValidateOrFn, typ
|
|
|
4
4
|
import { type RuntimeFiber } from "effect/Fiber"
|
|
5
5
|
import { getTransformationFrom, useIntl } from "../../utils"
|
|
6
6
|
import { type OmegaFieldInternalApi } from "./InputProps"
|
|
7
|
-
import { type
|
|
7
|
+
import { type OmegaFormReturn } from "./useOmegaForm"
|
|
8
8
|
|
|
9
9
|
export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit"
|
|
10
10
|
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
validators?: FieldValidators<From>
|
|
14
|
-
options?: {
|
|
15
|
-
title: string
|
|
16
|
-
value: string
|
|
17
|
-
}[]
|
|
18
|
-
type?: TypeOverride
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type OmegaInputPropsBase<
|
|
22
|
-
From extends Record<PropertyKey, any>,
|
|
23
|
-
To extends Record<PropertyKey, any>
|
|
24
|
-
> = {
|
|
25
|
-
form: OF<From, To> & {
|
|
11
|
+
export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
|
|
12
|
+
form: OmegaFormReturn<From, To> & {
|
|
26
13
|
meta: MetaRecord<From>
|
|
27
14
|
i18nNamespace?: string
|
|
28
15
|
}
|
|
29
16
|
name: NestedKeyOf<From>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
InputProps = DefaultInputProps<From>
|
|
36
|
-
> = {
|
|
37
|
-
form: OmegaFormReturn<From, To, InputProps> & {
|
|
38
|
-
meta: MetaRecord<From>
|
|
39
|
-
i18nNamespace?: string
|
|
40
|
-
}
|
|
41
|
-
name: NestedKeyOf<From>
|
|
42
|
-
} & DefaultInputProps<From> // InputProps // TODO
|
|
17
|
+
validators?: FieldValidators<From>
|
|
18
|
+
label?: string
|
|
19
|
+
options?: { title: string; value: string }[]
|
|
20
|
+
type?: TypeOverride
|
|
21
|
+
}
|
|
43
22
|
|
|
44
23
|
export type TypeOverride =
|
|
45
24
|
| "string"
|
|
@@ -48,7 +27,6 @@ export type TypeOverride =
|
|
|
48
27
|
| "select"
|
|
49
28
|
| "multiple"
|
|
50
29
|
| "boolean"
|
|
51
|
-
| "radio"
|
|
52
30
|
| "autocomplete"
|
|
53
31
|
| "autocompletemultiple"
|
|
54
32
|
| "switch"
|
|
@@ -804,29 +782,3 @@ export const nullableInput = <A, I, R>(
|
|
|
804
782
|
encode: (input) => input
|
|
805
783
|
})
|
|
806
784
|
)
|
|
807
|
-
|
|
808
|
-
export type OmegaAutoGenMeta<
|
|
809
|
-
From extends Record<PropertyKey, any>,
|
|
810
|
-
To extends Record<PropertyKey, any>
|
|
811
|
-
> = Omit<OmegaInputProps<From, To>, "form">
|
|
812
|
-
|
|
813
|
-
const supportedInputs = [
|
|
814
|
-
"button",
|
|
815
|
-
"checkbox",
|
|
816
|
-
"color",
|
|
817
|
-
"date",
|
|
818
|
-
"email",
|
|
819
|
-
"number",
|
|
820
|
-
"password",
|
|
821
|
-
"radio",
|
|
822
|
-
"range",
|
|
823
|
-
"search",
|
|
824
|
-
"submit",
|
|
825
|
-
"tel",
|
|
826
|
-
"text",
|
|
827
|
-
"time",
|
|
828
|
-
"url"
|
|
829
|
-
] as const
|
|
830
|
-
export type SupportedInputs = typeof supportedInputs[number]
|
|
831
|
-
export const getInputType = (input: string): SupportedInputs =>
|
|
832
|
-
(supportedInputs as readonly string[]).includes(input) ? input as SupportedInputs : "text"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:is="form.Field"
|
|
2
|
+
<form.Field
|
|
4
3
|
:name="name"
|
|
5
4
|
:validators="{
|
|
6
5
|
onChange: schema,
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
</template>
|
|
23
22
|
</OmegaInternalInput>
|
|
24
23
|
</template>
|
|
25
|
-
</
|
|
24
|
+
</form.Field>
|
|
26
25
|
</template>
|
|
27
26
|
|
|
28
27
|
<script
|
|
@@ -36,10 +35,10 @@
|
|
|
36
35
|
>
|
|
37
36
|
import { computed, inject, type Ref } from "vue"
|
|
38
37
|
import { useIntl } from "../../utils"
|
|
39
|
-
import { type FieldMeta, generateInputStandardSchemaFromFieldMeta, type
|
|
38
|
+
import { type FieldMeta, generateInputStandardSchemaFromFieldMeta, type OmegaInputProps } from "./OmegaFormStuff"
|
|
40
39
|
import OmegaInternalInput from "./OmegaInternalInput.vue"
|
|
41
40
|
|
|
42
|
-
const props = defineProps<
|
|
41
|
+
const props = defineProps<OmegaInputProps<From, To>>()
|
|
43
42
|
|
|
44
43
|
defineOptions({
|
|
45
44
|
inheritAttrs: false
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
:required="inputProps.required"
|
|
24
24
|
:min-length="inputProps.minLength"
|
|
25
25
|
:max-length="inputProps.maxLength"
|
|
26
|
-
:type="
|
|
26
|
+
:type="inputProps.type"
|
|
27
27
|
:name="inputProps.name"
|
|
28
28
|
:label="inputProps.label"
|
|
29
29
|
:error-messages="inputProps.errorMessages"
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
:required="inputProps.required"
|
|
39
39
|
:min-length="inputProps.minLength"
|
|
40
40
|
:max-length="inputProps.maxLength"
|
|
41
|
+
:type="inputProps.type"
|
|
41
42
|
:name="inputProps.name"
|
|
42
43
|
:label="inputProps.label"
|
|
43
44
|
:error-messages="inputProps.errorMessages"
|
|
@@ -68,25 +69,6 @@
|
|
|
68
69
|
}
|
|
69
70
|
}"
|
|
70
71
|
/>
|
|
71
|
-
<template v-if="inputProps.type === 'radio'">
|
|
72
|
-
<v-radio-group
|
|
73
|
-
:id="inputProps.id"
|
|
74
|
-
:name="inputProps.name"
|
|
75
|
-
:label="inputProps.label"
|
|
76
|
-
:error-messages="inputProps.errorMessages"
|
|
77
|
-
:error="inputProps.error"
|
|
78
|
-
v-bind="$attrs"
|
|
79
|
-
:model-value="vuetifyValue"
|
|
80
|
-
@update:model-value="inputProps.field.handleChange"
|
|
81
|
-
>
|
|
82
|
-
<v-radio
|
|
83
|
-
v-for="option in inputProps.options"
|
|
84
|
-
:key="option.value"
|
|
85
|
-
:label="option.title"
|
|
86
|
-
:value="option.value"
|
|
87
|
-
/>
|
|
88
|
-
</v-radio-group>
|
|
89
|
-
</template>
|
|
90
72
|
<v-select
|
|
91
73
|
v-if="inputProps.type === 'select' || inputProps.type === 'multiple'"
|
|
92
74
|
:id="inputProps.id"
|
|
@@ -132,7 +114,6 @@
|
|
|
132
114
|
generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>"
|
|
133
115
|
>
|
|
134
116
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
135
|
-
import { getInputType } from "../OmegaForm/OmegaFormStuff"
|
|
136
117
|
import type { InputProps } from "./InputProps"
|
|
137
118
|
|
|
138
119
|
defineProps<{
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
32
32
|
import { useStore } from "@tanstack/vue-form"
|
|
33
33
|
import { getOmegaStore } from "./getOmegaStore"
|
|
34
|
-
import { type
|
|
35
|
-
import { type OmegaFormReturn } from "./useOmegaForm"
|
|
34
|
+
import { type OmegaFormApi, type OmegaFormState } from "./OmegaFormStuff"
|
|
35
|
+
import { type DefaultInputProps, type OmegaFormReturn } from "./useOmegaForm"
|
|
36
36
|
|
|
37
37
|
type OmegaWrapperProps = {
|
|
38
38
|
form: OmegaFormReturn<From, To, Props>
|
|
@@ -4,8 +4,4 @@ export * as OmegaErrorsContext from "./OmegaErrorsContext"
|
|
|
4
4
|
export * from "./OmegaFormStuff"
|
|
5
5
|
export { type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
|
|
6
6
|
|
|
7
|
-
export { default as OmegaVuetifyInput } from "./OmegaInternalInput.vue"
|
|
8
|
-
|
|
9
|
-
export { getInputType } from "./OmegaFormStuff"
|
|
10
|
-
|
|
11
7
|
export { OmegaInput }
|