@effect-app/vue-components 1.0.0-next.9 → 1.0.1
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 +1 -1
- package/dist/types/components/OmegaForm/index.d.ts +1 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +26 -13
- package/dist/vue-components.es.js +21 -19
- package/dist/vue-components.es10.js +10 -5
- package/dist/vue-components.es11.js +5 -54
- package/dist/vue-components.es12.js +49 -66
- package/dist/vue-components.es13.js +71 -6
- package/dist/vue-components.es14.js +5 -5
- package/dist/vue-components.es15.js +6 -3
- package/dist/vue-components.es16.js +3 -3
- package/dist/vue-components.es17.js +3 -89
- package/dist/vue-components.es18.js +2 -42
- package/dist/vue-components.es19.js +42 -2
- package/dist/vue-components.es2.js +10 -8
- package/dist/vue-components.es21.js +2 -90
- package/dist/vue-components.es22.js +92 -0
- package/dist/vue-components.es24.js +7 -31
- package/dist/vue-components.es25.js +33 -0
- package/dist/vue-components.es30.js +1 -1
- package/dist/vue-components.es37.js +3 -3
- package/dist/vue-components.es38.js +3 -3
- package/dist/vue-components.es39.js +43 -23
- package/dist/vue-components.es4.js +80 -42
- package/dist/vue-components.es42.js +4 -65
- package/dist/vue-components.es43.js +54 -45
- package/dist/vue-components.es44.js +54 -15
- package/dist/vue-components.es45.js +15 -31
- package/dist/vue-components.es46.js +30 -26
- package/dist/vue-components.es47.js +29 -42
- package/dist/vue-components.es48.js +42 -4
- package/dist/vue-components.es5.js +51 -29
- package/dist/vue-components.es6.js +27 -207
- package/dist/vue-components.es7.js +202 -343
- package/dist/vue-components.es8.js +350 -2
- package/dist/vue-components.es9.js +2 -10
- package/package.json +4 -4
- package/src/components/OmegaForm/OmegaFormStuff.ts +1 -0
- package/src/components/OmegaForm/OmegaInputVuetify.vue +19 -0
- package/src/components/OmegaForm/index.ts +2 -0
- package/src/components/OmegaForm/useOmegaForm.ts +287 -29
- package/dist/vue-components.es23.js +0 -9
- package/dist/vue-components.es26.js +0 -4
|
@@ -1,352 +1,211 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
}
|
|
1
|
+
import { useForm as D, useStore as H } from "@tanstack/vue-form";
|
|
2
|
+
import { S as O, Effect as d, Fiber as y } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as J } from "./vue-components.es10.js";
|
|
4
|
+
import { isObject as q } from "./vue-components.es11.js";
|
|
5
|
+
import { computed as I, onUnmounted as K, onMounted as B, onBeforeUnmount as G, watch as W, h as $ } from "vue";
|
|
6
|
+
import k from "./vue-components.es12.js";
|
|
7
|
+
import z from "./vue-components.es13.js";
|
|
8
|
+
import { buildOmegaErrors as Q } from "./vue-components.es6.js";
|
|
9
|
+
import T from "./vue-components.es14.js";
|
|
10
|
+
import { generateMetaFromSchema as X } from "./vue-components.es8.js";
|
|
11
|
+
import Y from "./vue-components.es5.js";
|
|
12
|
+
import Z from "./vue-components.es15.js";
|
|
13
|
+
import { trace as P } from "./vue-components.es16.js";
|
|
14
|
+
import { context as g } from "./vue-components.es17.js";
|
|
15
|
+
const p = (c) => function(o) {
|
|
16
|
+
return {
|
|
17
|
+
render() {
|
|
18
|
+
return $(o, {
|
|
19
|
+
form: c,
|
|
20
|
+
on: this.$listeners,
|
|
21
|
+
attrs: this.$attrs
|
|
22
|
+
}, this.$slots);
|
|
155
23
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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))
|
|
24
|
+
};
|
|
25
|
+
}, C = (c) => function(o) {
|
|
26
|
+
return {
|
|
27
|
+
setup() {
|
|
182
28
|
return {
|
|
183
|
-
...
|
|
184
|
-
type: "multiple",
|
|
185
|
-
members: t.elements,
|
|
186
|
-
rest: t.rest
|
|
29
|
+
...c
|
|
187
30
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
31
|
+
},
|
|
32
|
+
render({ errors: h, generalErrors: w, showErrors: S }) {
|
|
33
|
+
return $(o, {
|
|
34
|
+
errors: h,
|
|
35
|
+
generalErrors: w,
|
|
36
|
+
showErrors: S,
|
|
37
|
+
on: this.$listeners,
|
|
38
|
+
attrs: this.$attrs
|
|
39
|
+
}, this.$slots);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, pe = (c, a, o) => {
|
|
43
|
+
if (!c) throw new Error("Schema is required");
|
|
44
|
+
const h = O.standardSchemaV1(c), w = O.decode(c), { filterItems: S, meta: f } = X(c), l = I(() => {
|
|
45
|
+
if (o?.persistency?.id)
|
|
46
|
+
return o.persistency.id;
|
|
47
|
+
const e = window.location.pathname, r = Object.keys(f);
|
|
48
|
+
return `${e}-${r.join("-")}`;
|
|
49
|
+
}), A = () => {
|
|
50
|
+
const e = new URLSearchParams(window.location.search);
|
|
51
|
+
e.delete(l.value);
|
|
52
|
+
const r = new URL(window.location.href);
|
|
53
|
+
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
54
|
+
};
|
|
55
|
+
function E(e, r) {
|
|
56
|
+
for (const t in r)
|
|
57
|
+
r[t] && q(r[t]) ? (e[t] || (e[t] = {}), E(e[t], r[t])) : e[t] = r[t];
|
|
58
|
+
return e;
|
|
202
59
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
60
|
+
const U = I(() => {
|
|
61
|
+
if (a?.defaultValues && !o?.persistency?.overrideDefaultValues)
|
|
62
|
+
return a?.defaultValues;
|
|
63
|
+
let e;
|
|
64
|
+
const r = o?.persistency;
|
|
65
|
+
if (!r?.policies || r.policies.length === 0) return {};
|
|
66
|
+
if (r.policies.includes("querystring"))
|
|
67
|
+
try {
|
|
68
|
+
const s = new URLSearchParams(window.location.search).get(l.value);
|
|
69
|
+
A(), s && (e = JSON.parse(s));
|
|
70
|
+
} catch (t) {
|
|
71
|
+
console.error(t);
|
|
72
|
+
}
|
|
73
|
+
if (
|
|
74
|
+
// query string has higher priority than local/session storage
|
|
75
|
+
!e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
76
|
+
) {
|
|
77
|
+
const t = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
78
|
+
if (t)
|
|
79
|
+
try {
|
|
80
|
+
const s = JSON.parse(
|
|
81
|
+
t.getItem(l.value) || "{}"
|
|
82
|
+
);
|
|
83
|
+
t.removeItem(l.value), e = s;
|
|
84
|
+
} catch (s) {
|
|
85
|
+
console.error(s);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (e ??= {}, a?.defaultValues == null)
|
|
89
|
+
return e;
|
|
90
|
+
{
|
|
91
|
+
const t = a?.defaultValues;
|
|
92
|
+
return E(t, e);
|
|
93
|
+
}
|
|
94
|
+
}), M = (e, r) => e ? g.with(P.setSpan(g.active(), e), r) : r(), u = D({
|
|
95
|
+
...a,
|
|
96
|
+
validators: {
|
|
97
|
+
onSubmit: h,
|
|
98
|
+
...a?.validators || {}
|
|
99
|
+
},
|
|
100
|
+
onSubmit: a?.onSubmit ? ({ formApi: e, meta: r, value: t }) => M(r?.currentSpan, async () => {
|
|
101
|
+
const s = await d.runPromise(w(t)), n = a.onSubmit({
|
|
102
|
+
formApi: e,
|
|
103
|
+
meta: r,
|
|
104
|
+
value: s
|
|
105
|
+
});
|
|
106
|
+
return y.isFiber(n) && y.isRuntimeFiber(n) ? await J(n) : d.isEffect(n) ? await d.runPromise(
|
|
107
|
+
n.pipe(
|
|
108
|
+
// meta?.currentSpan
|
|
109
|
+
// ? Effect.withParentSpan(meta.currentSpan)
|
|
110
|
+
// : (_) => _,
|
|
111
|
+
d.flatMap((m) => y.join(m))
|
|
112
|
+
)
|
|
113
|
+
) : n;
|
|
114
|
+
}) : void 0,
|
|
115
|
+
defaultValues: U.value
|
|
116
|
+
}), N = () => {
|
|
117
|
+
Object.keys(f).forEach((e) => {
|
|
118
|
+
u.setFieldValue(e, void 0);
|
|
211
119
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
120
|
+
}, V = (e) => e.reduce((r, t) => {
|
|
121
|
+
const s = t.split(".");
|
|
122
|
+
return s.reduce((n, m, x) => (x === s.length - 1 ? n[m] = u.getFieldValue(t) : n[m] = n[m] ?? {}, n[m]), r), r;
|
|
123
|
+
}, {}), F = (e) => {
|
|
124
|
+
if (e) {
|
|
125
|
+
if (Array.isArray(e.keys))
|
|
126
|
+
return V(e.keys);
|
|
127
|
+
if (Array.isArray(e.banKeys)) {
|
|
128
|
+
const r = Object.keys(f).filter((t) => e.banKeys?.includes(t));
|
|
129
|
+
return V(r);
|
|
218
130
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
|
|
131
|
+
return u.store.state.values;
|
|
132
|
+
}
|
|
133
|
+
}, v = () => {
|
|
134
|
+
const e = o?.persistency;
|
|
135
|
+
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
136
|
+
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
137
|
+
if (!r) return;
|
|
138
|
+
const t = F(e);
|
|
139
|
+
return r.setItem(l.value, JSON.stringify(t));
|
|
140
|
+
}
|
|
141
|
+
}, j = () => {
|
|
142
|
+
const e = o?.persistency;
|
|
143
|
+
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
144
|
+
const r = F(e), t = new URLSearchParams(window.location.search);
|
|
145
|
+
t.set(l.value, JSON.stringify(r));
|
|
146
|
+
const s = new URL(window.location.href);
|
|
147
|
+
s.search = t.toString(), window.history.replaceState({}, "", s.toString());
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
K(v), B(() => {
|
|
151
|
+
window.addEventListener("beforeunload", v), window.addEventListener("blur", j);
|
|
152
|
+
}), G(() => {
|
|
153
|
+
window.removeEventListener("beforeunload", v), window.removeEventListener("blur", j);
|
|
154
|
+
});
|
|
155
|
+
const R = u.handleSubmit, i = Object.assign(u, {
|
|
156
|
+
i18nNamespace: o?.i18nNamespace,
|
|
157
|
+
meta: f,
|
|
158
|
+
filterItems: S,
|
|
159
|
+
clear: N,
|
|
160
|
+
handleSubmit: (e) => {
|
|
161
|
+
const r = P.getSpan(g.active());
|
|
162
|
+
return R({ currentSpan: r, ...e });
|
|
163
|
+
}
|
|
164
|
+
// /** @experimental */
|
|
165
|
+
// handleSubmitEffect: (meta?: Record<string, any>) =>
|
|
166
|
+
// Effect.currentSpan.pipe(
|
|
167
|
+
// Effect.option,
|
|
168
|
+
// Effect
|
|
169
|
+
// .flatMap((span) =>
|
|
170
|
+
// Effect.promise(() => form.handleSubmit(Option.isSome(span) ? { currentSpan: span.value, ...meta } : meta))
|
|
171
|
+
// )
|
|
172
|
+
// )
|
|
173
|
+
}), _ = H(
|
|
174
|
+
i.store,
|
|
175
|
+
(e) => e.submissionAttempts
|
|
176
|
+
), b = i.useStore((e) => e.errors);
|
|
177
|
+
W(
|
|
178
|
+
() => [i.filterItems, b.value],
|
|
179
|
+
() => {
|
|
180
|
+
const e = i.filterItems, r = b.value;
|
|
181
|
+
return e ? r ? (Object.values(r).filter(
|
|
182
|
+
(s) => !!s
|
|
183
|
+
).flatMap(
|
|
184
|
+
(s) => Object.values(s).flat().map((n) => n.message)
|
|
185
|
+
).some((s) => s === e.message) && e.items.forEach((s) => {
|
|
186
|
+
const n = i.getFieldMeta(s);
|
|
187
|
+
n && i.setFieldMeta(s, {
|
|
188
|
+
...n,
|
|
189
|
+
errorMap: {
|
|
190
|
+
onSubmit: [
|
|
191
|
+
{ path: [s], message: e.message }
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}), {}) : {} : {};
|
|
196
|
+
}
|
|
238
197
|
);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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";
|
|
198
|
+
const L = Q(_, b, o?.showErrorsOn);
|
|
199
|
+
return Object.assign(i, {
|
|
200
|
+
errorContext: L,
|
|
201
|
+
Form: p(i)(Z),
|
|
202
|
+
Input: p(i)(o?.input ?? Y),
|
|
203
|
+
Field: u.Field,
|
|
204
|
+
Errors: C(L)(T),
|
|
205
|
+
Array: p(i)(k),
|
|
206
|
+
AutoGen: p(i)(z)
|
|
207
|
+
});
|
|
208
|
+
};
|
|
345
209
|
export {
|
|
346
|
-
|
|
347
|
-
I as duplicateSchema,
|
|
348
|
-
P as generateInputStandardSchemaFromFieldMeta,
|
|
349
|
-
K as generateMetaFromSchema,
|
|
350
|
-
F as getInputType,
|
|
351
|
-
j as nullableInput
|
|
210
|
+
pe as useOmegaForm
|
|
352
211
|
};
|