@effect-app/vue-components 2.7.11 → 2.9.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/defaultAST.d.ts +4 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +1 -0
- package/dist/vue-components.es10.js +149 -239
- package/dist/vue-components.es17.js +97 -5
- package/dist/vue-components.es20.js +2 -2
- package/dist/vue-components.es21.js +2 -2
- package/dist/vue-components.es22.js +1 -1
- package/dist/vue-components.es23.js +1 -1
- package/dist/vue-components.es31.js +4 -2
- package/dist/vue-components.es32.js +1 -1
- package/dist/vue-components.es33.js +2 -111
- package/dist/vue-components.es34.js +113 -0
- package/dist/vue-components.es36.js +7 -32
- package/dist/vue-components.es37.js +34 -0
- package/dist/vue-components.es41.js +4 -23
- package/dist/vue-components.es42.js +23 -5
- package/dist/vue-components.es43.js +5 -21
- package/dist/vue-components.es44.js +16 -25
- package/dist/vue-components.es45.js +23 -15
- package/dist/vue-components.es46.js +17 -7
- package/dist/vue-components.es47.js +12 -5
- package/dist/vue-components.es48.js +5 -19
- package/dist/vue-components.es49.js +19 -9
- package/dist/vue-components.es50.js +9 -31
- package/dist/vue-components.es51.js +25 -42
- package/dist/vue-components.es52.js +38 -16
- package/dist/vue-components.es53.js +26 -11
- package/dist/vue-components.es54.js +11 -65
- package/dist/vue-components.es55.js +54 -45
- package/dist/vue-components.es56.js +54 -15
- package/dist/vue-components.es57.js +15 -31
- package/dist/vue-components.es58.js +30 -26
- package/dist/vue-components.es59.js +29 -42
- package/dist/vue-components.es60.js +42 -2
- package/dist/vue-components.es61.js +2 -44
- package/dist/vue-components.es62.js +44 -2
- package/dist/vue-components.es63.js +4 -0
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es9.js +33 -10
- package/package.json +23 -23
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +50 -1
- package/src/components/OmegaForm/defaultAST.ts +191 -0
- package/src/components/OmegaForm/useOmegaForm.ts +5 -187
- package/dist/vue-components.es35.js +0 -9
- package/dist/vue-components.es40.js +0 -6
- /package/dist/{vue-components.es38.js → vue-components.es39.js} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { S } from "effect-app";
|
|
2
|
+
export declare function deepMerge(target: any, source: any): any;
|
|
3
|
+
export declare const extractDefaultsFromAST: (schemaObj: any) => any;
|
|
4
|
+
export declare const extractSchemaDefaults: <From, To>(schema: S.Schema<To, From, never>, defaultValues?: Partial<From>) => any;
|
|
@@ -81,6 +81,7 @@ type CachedFieldState<From, To, TypeProps = DefaultTypeProps> = import("@tanstac
|
|
|
81
81
|
export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps> extends OF<From, To> {
|
|
82
82
|
_paths: FieldPath<From>;
|
|
83
83
|
_keys: DeepKeys<From>;
|
|
84
|
+
_schema: S.Schema<To, From, never>;
|
|
84
85
|
Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
85
86
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & TypeProps & Partial<{}>> & BaseProps<From, Name> & import("vue").PublicProps;
|
|
86
87
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -1,318 +1,228 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { generateMetaFromSchema as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { trace as
|
|
1
|
+
import { useForm as q } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as B, S as D, Effect as c, Fiber as A, Option as P, Array as g } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as K } from "./vue-components.es16.js";
|
|
4
|
+
import { computed as U, onUnmounted as N, onMounted as T, onBeforeUnmount as G, watch as W, ref as z, h as k } from "vue";
|
|
5
|
+
import { deepMerge as O, extractSchemaDefaults as Q } from "./vue-components.es17.js";
|
|
6
|
+
import X from "./vue-components.es18.js";
|
|
7
|
+
import Y from "./vue-components.es19.js";
|
|
8
|
+
import Z from "./vue-components.es20.js";
|
|
9
|
+
import { generateMetaFromSchema as C } from "./vue-components.es12.js";
|
|
10
|
+
import ee from "./vue-components.es6.js";
|
|
11
|
+
import re from "./vue-components.es8.js";
|
|
12
|
+
import te from "./vue-components.es21.js";
|
|
13
|
+
import { trace as R } from "./vue-components.es22.js";
|
|
14
14
|
import { context as L } from "./vue-components.es23.js";
|
|
15
|
-
|
|
16
|
-
const i = c.ast;
|
|
17
|
-
if (i._tag === "Refinement") {
|
|
18
|
-
const n = i, u = p.make(n.from);
|
|
19
|
-
return g(u);
|
|
20
|
-
}
|
|
21
|
-
if (i._tag === "Union") {
|
|
22
|
-
const n = i.types.map((f) => {
|
|
23
|
-
const l = p.make(f);
|
|
24
|
-
return g(l).ast;
|
|
25
|
-
}), u = {
|
|
26
|
-
...i,
|
|
27
|
-
types: n
|
|
28
|
-
};
|
|
29
|
-
return p.make(u);
|
|
30
|
-
}
|
|
31
|
-
if (i._tag === "Transformation") {
|
|
32
|
-
const n = i;
|
|
33
|
-
if (n.to._tag === "Declaration") {
|
|
34
|
-
const h = p.make(n.from);
|
|
35
|
-
return g(h);
|
|
36
|
-
}
|
|
37
|
-
const u = p.make(n.from), f = p.make(n.to), l = g(u), d = g(f), w = {
|
|
38
|
-
...i,
|
|
39
|
-
from: l.ast,
|
|
40
|
-
to: d.ast
|
|
41
|
-
};
|
|
42
|
-
return p.make(w);
|
|
43
|
-
}
|
|
44
|
-
if (i._tag === "TypeLiteral") {
|
|
45
|
-
const n = i.propertySignatures.map((f) => {
|
|
46
|
-
const l = f.type;
|
|
47
|
-
let d = l;
|
|
48
|
-
if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation" || l._tag === "Refinement") {
|
|
49
|
-
const w = p.make(l);
|
|
50
|
-
d = g(w).ast;
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
...f,
|
|
54
|
-
type: d,
|
|
55
|
-
isOptional: !0
|
|
56
|
-
};
|
|
57
|
-
}), u = {
|
|
58
|
-
...i,
|
|
59
|
-
propertySignatures: n
|
|
60
|
-
};
|
|
61
|
-
return p.make(u);
|
|
62
|
-
}
|
|
63
|
-
return c;
|
|
64
|
-
};
|
|
65
|
-
class ae extends G.TaggedError("FormErrors") {
|
|
15
|
+
class se extends B.TaggedError("FormErrors") {
|
|
66
16
|
}
|
|
67
|
-
const
|
|
17
|
+
const E = (l) => function(n) {
|
|
68
18
|
return {
|
|
69
19
|
render() {
|
|
70
|
-
return
|
|
71
|
-
form:
|
|
20
|
+
return k(n, {
|
|
21
|
+
form: l,
|
|
72
22
|
...this.$attrs
|
|
73
23
|
}, this.$slots);
|
|
74
24
|
}
|
|
75
25
|
};
|
|
76
|
-
},
|
|
26
|
+
}, ne = (l) => function(n) {
|
|
77
27
|
return {
|
|
78
28
|
setup() {
|
|
79
|
-
const { fieldMap:
|
|
80
|
-
const
|
|
81
|
-
Object.entries(
|
|
82
|
-
([M,
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
label:
|
|
88
|
-
inputId:
|
|
29
|
+
const { fieldMap: w, form: v } = l, b = v.useStore((u) => u.errors), m = v.useStore((u) => u.fieldMeta), F = v.useStore((u) => u.errorMap), _ = U(() => {
|
|
30
|
+
const u = g.filterMap(
|
|
31
|
+
Object.entries(m.value),
|
|
32
|
+
([M, f]) => {
|
|
33
|
+
const S = f.errors ?? [];
|
|
34
|
+
if (!S.length) return P.none();
|
|
35
|
+
const a = w.value.get(M);
|
|
36
|
+
return a ? P.some({
|
|
37
|
+
label: a.label,
|
|
38
|
+
inputId: a.id,
|
|
89
39
|
// Only show the first error
|
|
90
|
-
errors: [
|
|
91
|
-
}) :
|
|
40
|
+
errors: [S[0]?.message].filter(Boolean)
|
|
41
|
+
}) : P.none();
|
|
92
42
|
}
|
|
93
|
-
),
|
|
94
|
-
if (
|
|
95
|
-
for (const [M,
|
|
96
|
-
if (
|
|
97
|
-
for (const
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
|
|
103
|
-
label:
|
|
104
|
-
inputId:
|
|
105
|
-
errors: [
|
|
43
|
+
), o = [];
|
|
44
|
+
if (F.value.onSubmit) {
|
|
45
|
+
for (const [M, f] of Object.entries(F.value.onSubmit))
|
|
46
|
+
if (g.isArray(f) && f.length)
|
|
47
|
+
for (const S of f) {
|
|
48
|
+
const a = S;
|
|
49
|
+
if (a?.path && g.isArray(a.path) && a.path.length) {
|
|
50
|
+
const y = a.path.join(".");
|
|
51
|
+
if (!w.value.has(y)) {
|
|
52
|
+
o.push({
|
|
53
|
+
label: y,
|
|
54
|
+
inputId: y,
|
|
55
|
+
errors: [a.message].filter(Boolean)
|
|
106
56
|
});
|
|
107
57
|
break;
|
|
108
58
|
}
|
|
109
59
|
}
|
|
110
60
|
}
|
|
111
61
|
}
|
|
112
|
-
return [...
|
|
62
|
+
return [...u, ...o];
|
|
113
63
|
});
|
|
114
64
|
return {
|
|
115
|
-
generalErrors:
|
|
116
|
-
errors:
|
|
65
|
+
generalErrors: b,
|
|
66
|
+
errors: _
|
|
117
67
|
};
|
|
118
68
|
},
|
|
119
|
-
render({ errors:
|
|
120
|
-
return
|
|
121
|
-
errors:
|
|
122
|
-
generalErrors:
|
|
69
|
+
render({ errors: w, generalErrors: v }) {
|
|
70
|
+
return k(n, {
|
|
71
|
+
errors: w,
|
|
72
|
+
generalErrors: v,
|
|
123
73
|
...this.$attrs
|
|
124
74
|
}, this.$slots);
|
|
125
75
|
}
|
|
126
76
|
};
|
|
127
|
-
},
|
|
128
|
-
if (!
|
|
129
|
-
const
|
|
77
|
+
}, be = (l, d, n) => {
|
|
78
|
+
if (!l) throw new Error("Schema is required");
|
|
79
|
+
const w = D.standardSchemaV1(l), v = D.decode(l), { meta: b } = C(l), m = U(() => {
|
|
130
80
|
if (n?.persistency?.id)
|
|
131
81
|
return n.persistency.id;
|
|
132
|
-
const e = window.location.pathname,
|
|
133
|
-
return `${e}-${
|
|
134
|
-
}),
|
|
82
|
+
const e = window.location.pathname, r = Object.keys(b);
|
|
83
|
+
return `${e}-${r.join("-")}`;
|
|
84
|
+
}), F = () => {
|
|
135
85
|
const e = new URLSearchParams(window.location.search);
|
|
136
|
-
e.delete(
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
function h(e, t) {
|
|
141
|
-
for (const r in t)
|
|
142
|
-
A.isArray(t[r]) ? e[r] = t[r] : t[r] && Q(t[r]) ? (e[r] || (e[r] = {}), h(e[r], t[r])) : e[r] = t[r];
|
|
143
|
-
return e;
|
|
144
|
-
}
|
|
145
|
-
const S = (e) => {
|
|
146
|
-
const t = {};
|
|
147
|
-
if (e?.fields && typeof e.fields == "object")
|
|
148
|
-
for (const [r, o] of Object.entries(e.fields)) {
|
|
149
|
-
if (o?.ast?.defaultValue)
|
|
150
|
-
try {
|
|
151
|
-
const m = o.ast.defaultValue();
|
|
152
|
-
t[r] = m;
|
|
153
|
-
} catch {
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
const m = o?.ast;
|
|
157
|
-
switch (ne(m)) {
|
|
158
|
-
case "null":
|
|
159
|
-
t[r] = null;
|
|
160
|
-
break;
|
|
161
|
-
case "undefined":
|
|
162
|
-
t[r] = void 0;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const s = S(o);
|
|
167
|
-
Object.keys(s).length > 0 && (t[r] && typeof t[r] == "object" ? Object.assign(t[r], s) : t[r] || (t[r] = s));
|
|
168
|
-
}
|
|
169
|
-
else if (e?.from?.fields && typeof e?.from?.fields == "object")
|
|
170
|
-
return S(e.from);
|
|
171
|
-
return t;
|
|
172
|
-
}, F = (e = {}) => {
|
|
173
|
-
let t = {};
|
|
174
|
-
try {
|
|
175
|
-
const r = S(c);
|
|
176
|
-
t = p.encodeSync(g(c))(r);
|
|
177
|
-
} catch (r) {
|
|
178
|
-
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", r);
|
|
179
|
-
}
|
|
180
|
-
return h(t, e);
|
|
181
|
-
}, M = V(() => {
|
|
86
|
+
e.delete(m.value);
|
|
87
|
+
const r = new URL(window.location.href);
|
|
88
|
+
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
89
|
+
}, _ = U(() => {
|
|
182
90
|
let e;
|
|
183
|
-
const
|
|
91
|
+
const r = n?.persistency;
|
|
184
92
|
if (
|
|
185
93
|
// query string has higher priority than local/session storage
|
|
186
|
-
|
|
94
|
+
r?.policies && !e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
187
95
|
) {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
96
|
+
const s = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
97
|
+
if (s)
|
|
190
98
|
try {
|
|
191
|
-
const
|
|
192
|
-
|
|
99
|
+
const i = JSON.parse(
|
|
100
|
+
s.getItem(m.value) || "{}"
|
|
193
101
|
);
|
|
194
|
-
|
|
195
|
-
} catch (
|
|
196
|
-
console.error(
|
|
102
|
+
s.removeItem(m.value), e = i;
|
|
103
|
+
} catch (i) {
|
|
104
|
+
console.error(i);
|
|
197
105
|
}
|
|
198
106
|
}
|
|
199
|
-
if (
|
|
107
|
+
if (r?.policies && r.policies.includes("querystring"))
|
|
200
108
|
try {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
} catch (
|
|
204
|
-
console.error(
|
|
109
|
+
const i = new URLSearchParams(window.location.search).get(m.value);
|
|
110
|
+
F(), i && (e = O(e || {}, JSON.parse(i)));
|
|
111
|
+
} catch (s) {
|
|
112
|
+
console.error(s);
|
|
205
113
|
}
|
|
206
|
-
return e ??= {},
|
|
207
|
-
|
|
114
|
+
return e ??= {}, Q(
|
|
115
|
+
l,
|
|
116
|
+
n?.persistency?.overrideDefaultValues ? O(d?.defaultValues || {}, e) : O(e, d?.defaultValues || {})
|
|
208
117
|
);
|
|
209
|
-
}),
|
|
210
|
-
...
|
|
118
|
+
}), u = (e, r) => e ? L.with(R.setSpan(L.active(), e), r) : r(), o = q({
|
|
119
|
+
...d,
|
|
211
120
|
validators: {
|
|
212
|
-
onSubmit:
|
|
213
|
-
...
|
|
121
|
+
onSubmit: w,
|
|
122
|
+
...d?.validators || {}
|
|
214
123
|
},
|
|
215
|
-
onSubmit:
|
|
216
|
-
const
|
|
124
|
+
onSubmit: d?.onSubmit ? ({ formApi: e, meta: r, value: s }) => u(r?.currentSpan, async () => {
|
|
125
|
+
const i = await c.runPromise(v(s)), t = d.onSubmit({
|
|
217
126
|
formApi: e,
|
|
218
|
-
meta:
|
|
219
|
-
value:
|
|
127
|
+
meta: r,
|
|
128
|
+
value: i
|
|
220
129
|
});
|
|
221
|
-
return
|
|
222
|
-
|
|
130
|
+
return A.isFiber(t) && A.isRuntimeFiber(t) ? await K(t) : c.isEffect(t) ? await c.runPromise(
|
|
131
|
+
t.pipe(
|
|
223
132
|
// meta?.currentSpan
|
|
224
133
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
225
134
|
// : (_) => _,
|
|
226
|
-
|
|
135
|
+
c.flatMap((p) => A.join(p))
|
|
227
136
|
)
|
|
228
|
-
) :
|
|
137
|
+
) : t;
|
|
229
138
|
}) : void 0,
|
|
230
|
-
defaultValues:
|
|
231
|
-
}),
|
|
232
|
-
Object.keys(
|
|
233
|
-
|
|
139
|
+
defaultValues: _.value
|
|
140
|
+
}), M = () => {
|
|
141
|
+
Object.keys(b).forEach((e) => {
|
|
142
|
+
o.setFieldValue(e, void 0);
|
|
234
143
|
});
|
|
235
|
-
},
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
}, {}),
|
|
144
|
+
}, f = (e) => e.reduce((r, s) => {
|
|
145
|
+
const i = s.split(".");
|
|
146
|
+
return i.reduce((t, p, x) => (x === i.length - 1 ? t[p] = o.getFieldValue(s) : t[p] = t[p] ?? {}, t[p]), r), r;
|
|
147
|
+
}, {}), S = (e) => {
|
|
239
148
|
if (e) {
|
|
240
|
-
if (
|
|
241
|
-
return
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
return
|
|
149
|
+
if (g.isArray(e.keys))
|
|
150
|
+
return f(e.keys);
|
|
151
|
+
if (g.isArray(e.banKeys)) {
|
|
152
|
+
const r = Object.keys(b).filter((s) => e.banKeys?.includes(s));
|
|
153
|
+
return f(r);
|
|
245
154
|
}
|
|
246
|
-
return
|
|
155
|
+
return o.store.state.values;
|
|
247
156
|
}
|
|
248
|
-
},
|
|
157
|
+
}, a = () => {
|
|
249
158
|
const e = n?.persistency;
|
|
250
159
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
253
|
-
const
|
|
254
|
-
return
|
|
160
|
+
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
161
|
+
if (!r) return;
|
|
162
|
+
const s = S(e);
|
|
163
|
+
return r.setItem(m.value, JSON.stringify(s));
|
|
255
164
|
}
|
|
256
|
-
},
|
|
165
|
+
}, y = () => {
|
|
257
166
|
const e = n?.persistency;
|
|
258
167
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
168
|
+
const r = S(e), s = new URLSearchParams(window.location.search);
|
|
169
|
+
s.set(m.value, JSON.stringify(r));
|
|
170
|
+
const i = new URL(window.location.href);
|
|
171
|
+
i.search = s.toString(), window.history.replaceState({}, "", i.toString());
|
|
263
172
|
}
|
|
264
|
-
},
|
|
265
|
-
|
|
173
|
+
}, V = (e) => {
|
|
174
|
+
o.store.state.isDirty && e.preventDefault();
|
|
266
175
|
};
|
|
267
|
-
if (N(
|
|
268
|
-
window.addEventListener("beforeunload",
|
|
269
|
-
}),
|
|
270
|
-
window.removeEventListener("beforeunload",
|
|
176
|
+
if (N(a), T(() => {
|
|
177
|
+
window.addEventListener("beforeunload", a), window.addEventListener("blur", y), n?.preventWindowExit && n.preventWindowExit !== "nope" && window.addEventListener("beforeunload", V);
|
|
178
|
+
}), G(() => {
|
|
179
|
+
window.removeEventListener("beforeunload", a), window.removeEventListener("blur", y), n?.preventWindowExit && n.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", V);
|
|
271
180
|
}), n?.preventWindowExit === "prevent-and-reset") {
|
|
272
|
-
const e =
|
|
273
|
-
W([e,
|
|
274
|
-
|
|
181
|
+
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), s = o.useStore((t) => t.canSubmit), i = o.useStore((t) => t.values);
|
|
182
|
+
W([e, r], ([t, p], [x]) => {
|
|
183
|
+
x && !t && p > 0 && s.value && o.reset(i.value);
|
|
275
184
|
});
|
|
276
185
|
}
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
(
|
|
186
|
+
const I = (e) => c.currentSpan.pipe(
|
|
187
|
+
c.option,
|
|
188
|
+
c.flatMap(
|
|
189
|
+
(r) => c.promise(() => o.handleSubmit(P.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
281
190
|
)
|
|
282
|
-
),
|
|
283
|
-
const
|
|
284
|
-
if (Object.keys(
|
|
285
|
-
return yield* new
|
|
286
|
-
}))) :
|
|
191
|
+
), H = (e) => e?.checkErrors ? I(e?.meta).pipe(c.flatMap(c.fnUntraced(function* () {
|
|
192
|
+
const r = o.getAllErrors();
|
|
193
|
+
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
194
|
+
return yield* new se({ form: r.form, fields: r.fields });
|
|
195
|
+
}))) : I(e?.meta), J = o.handleSubmit, j = z(/* @__PURE__ */ new Map()), h = Object.assign(o, {
|
|
287
196
|
i18nNamespace: n?.i18nNamespace,
|
|
288
197
|
ignorePreventCloseEvents: n?.ignorePreventCloseEvents,
|
|
289
|
-
meta:
|
|
290
|
-
clear:
|
|
198
|
+
meta: b,
|
|
199
|
+
clear: M,
|
|
291
200
|
handleSubmit: (e) => {
|
|
292
|
-
const
|
|
293
|
-
return
|
|
201
|
+
const r = R.getSpan(L.active());
|
|
202
|
+
return J({ currentSpan: r, ...e });
|
|
294
203
|
},
|
|
295
204
|
// /** @experimental */
|
|
296
|
-
handleSubmitEffect:
|
|
205
|
+
handleSubmitEffect: H,
|
|
297
206
|
registerField: (e) => {
|
|
298
|
-
W(e, (
|
|
207
|
+
W(e, (r) => j.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), N(() => j.value.delete(e.value.name));
|
|
299
208
|
}
|
|
300
|
-
}), $ = { form:
|
|
301
|
-
return Object.assign(
|
|
209
|
+
}), $ = { form: h, fieldMap: j };
|
|
210
|
+
return Object.assign(h, {
|
|
302
211
|
// Type-level properties for performance optimization (not used at runtime)
|
|
303
212
|
_paths: void 0,
|
|
304
213
|
_keys: void 0,
|
|
214
|
+
_schema: l,
|
|
305
215
|
errorContext: $,
|
|
306
|
-
Form:
|
|
307
|
-
Input:
|
|
308
|
-
TaggedUnion:
|
|
309
|
-
Field:
|
|
310
|
-
Errors:
|
|
311
|
-
Array:
|
|
312
|
-
AutoGen:
|
|
216
|
+
Form: E(h)(te),
|
|
217
|
+
Input: E(h)(n?.input ?? ee),
|
|
218
|
+
TaggedUnion: E(h)(re),
|
|
219
|
+
Field: o.Field,
|
|
220
|
+
Errors: ne($)(Z),
|
|
221
|
+
Array: E(h)(X),
|
|
222
|
+
AutoGen: E(h)(Y)
|
|
313
223
|
});
|
|
314
224
|
};
|
|
315
225
|
export {
|
|
316
|
-
|
|
317
|
-
|
|
226
|
+
se as FormErrors,
|
|
227
|
+
be as useOmegaForm
|
|
318
228
|
};
|
|
@@ -1,7 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { S as s } from "effect-app";
|
|
2
|
+
import { isNullableOrUndefined as p } from "./vue-components.es12.js";
|
|
3
|
+
import { isObject as d } from "./vue-components.es31.js";
|
|
4
|
+
function u(n, e) {
|
|
5
|
+
for (const t in e)
|
|
6
|
+
Array.isArray(e[t]) ? n[t] = e[t] : e[t] && d(e[t]) ? (n[t] || (n[t] = {}), u(n[t], e[t])) : n[t] = e[t];
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
const i = (n) => {
|
|
10
|
+
const e = n.ast;
|
|
11
|
+
if (e._tag === "Refinement") {
|
|
12
|
+
const t = e, r = s.make(t.from);
|
|
13
|
+
return i(r);
|
|
14
|
+
}
|
|
15
|
+
if (e._tag === "Union") {
|
|
16
|
+
const t = e.types.map((o) => {
|
|
17
|
+
const a = s.make(o);
|
|
18
|
+
return i(a).ast;
|
|
19
|
+
}), r = {
|
|
20
|
+
...e,
|
|
21
|
+
types: t
|
|
22
|
+
};
|
|
23
|
+
return s.make(r);
|
|
24
|
+
}
|
|
25
|
+
if (e._tag === "Transformation") {
|
|
26
|
+
const t = e;
|
|
27
|
+
if (t.to._tag === "Declaration") {
|
|
28
|
+
const m = s.make(t.from);
|
|
29
|
+
return i(m);
|
|
30
|
+
}
|
|
31
|
+
const r = s.make(t.from), o = s.make(t.to), a = i(r), f = i(o), l = {
|
|
32
|
+
...e,
|
|
33
|
+
from: a.ast,
|
|
34
|
+
to: f.ast
|
|
35
|
+
};
|
|
36
|
+
return s.make(l);
|
|
37
|
+
}
|
|
38
|
+
if (e._tag === "TypeLiteral") {
|
|
39
|
+
const t = e.propertySignatures.map((o) => {
|
|
40
|
+
const a = o.type;
|
|
41
|
+
let f = a;
|
|
42
|
+
if (a._tag === "TypeLiteral" || a._tag === "Union" || a._tag === "Transformation" || a._tag === "Refinement") {
|
|
43
|
+
const l = s.make(a);
|
|
44
|
+
f = i(l).ast;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...o,
|
|
48
|
+
type: f,
|
|
49
|
+
isOptional: !0
|
|
50
|
+
};
|
|
51
|
+
}), r = {
|
|
52
|
+
...e,
|
|
53
|
+
propertySignatures: t
|
|
54
|
+
};
|
|
55
|
+
return s.make(r);
|
|
56
|
+
}
|
|
57
|
+
return n;
|
|
58
|
+
}, c = (n) => {
|
|
59
|
+
const e = {};
|
|
60
|
+
if (n?.fields && typeof n.fields == "object")
|
|
61
|
+
for (const [t, r] of Object.entries(n.fields)) {
|
|
62
|
+
if (r?.ast?.defaultValue)
|
|
63
|
+
try {
|
|
64
|
+
const a = r.ast.defaultValue();
|
|
65
|
+
e[t] = a;
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const a = r?.ast;
|
|
70
|
+
switch (p(a)) {
|
|
71
|
+
case "null":
|
|
72
|
+
e[t] = null;
|
|
73
|
+
break;
|
|
74
|
+
case "undefined":
|
|
75
|
+
e[t] = void 0;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const o = c(r);
|
|
80
|
+
Object.keys(o).length > 0 && (e[t] && typeof e[t] == "object" ? Object.assign(e[t], o) : e[t] || (e[t] = o));
|
|
81
|
+
}
|
|
82
|
+
else if (n?.from?.fields && typeof n?.from?.fields == "object")
|
|
83
|
+
return c(n.from);
|
|
84
|
+
return e;
|
|
85
|
+
}, b = (n, e = {}) => {
|
|
86
|
+
let t = {};
|
|
87
|
+
try {
|
|
88
|
+
const r = c(n);
|
|
89
|
+
t = s.encodeSync(i(n))(r);
|
|
90
|
+
} catch (r) {
|
|
91
|
+
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", r);
|
|
92
|
+
}
|
|
93
|
+
return u(t, e);
|
|
94
|
+
};
|
|
3
95
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
96
|
+
u as deepMerge,
|
|
97
|
+
c as extractDefaultsFromAST,
|
|
98
|
+
b as extractSchemaDefaults
|
|
7
99
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");if(a.appendChild(document.createTextNode('.v-enter-from[data-v-6b2bf87e],.v-leave-to[data-v-6b2bf87e]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-6b2bf87e],.v-leave-active[data-v-6b2bf87e]{display:grid;transition:all .15s}.v-enter-to[data-v-6b2bf87e],.v-leave-from[data-v-6b2bf87e]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-6b2bf87e]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-6b2bf87e]{min-height:0}.error-list[data-v-6b2bf87e]{list-style-position:inside}.error-list [data-v-6b2bf87e]::marker{margin:0;padding:0}.error-alert-content[data-v-6b2bf87e]{background-color:var(--error-background, #fff5f5);color:var(--error-color, #c92a2a);padding:1em}.error-link[data-v-6b2bf87e]{font-weight:700;position:relative;color:var(--error-color, #c92a2a);cursor:pointer}.error-link[data-v-6b2bf87e]:after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:rgba(from var(--error-color, #c92a2a) r g b / .5)}.text-h6[data-v-6b2bf87e]{font-weight:700;font-size:1.25em}.error-message[data-v-6b2bf87e]{font-style:italic}.error-item[data-v-6b2bf87e]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-6b2bf87e]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-6b2bf87e]{display:flex;gap:1.5em}.container svg[data-v-6b2bf87e]{width:3em}.container .single-error[data-v-6b2bf87e]{display:inline-block}')),document.head.appendChild(a),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const r=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(r&&r.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode('.v-enter-from[data-v-6b2bf87e],.v-leave-to[data-v-6b2bf87e]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-6b2bf87e],.v-leave-active[data-v-6b2bf87e]{display:grid;transition:all .15s}.v-enter-to[data-v-6b2bf87e],.v-leave-from[data-v-6b2bf87e]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-6b2bf87e]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-6b2bf87e]{min-height:0}.error-list[data-v-6b2bf87e]{list-style-position:inside}.error-list [data-v-6b2bf87e]::marker{margin:0;padding:0}.error-alert-content[data-v-6b2bf87e]{background-color:var(--error-background, #fff5f5);color:var(--error-color, #c92a2a);padding:1em}.error-link[data-v-6b2bf87e]{font-weight:700;position:relative;color:var(--error-color, #c92a2a);cursor:pointer}.error-link[data-v-6b2bf87e]:after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:rgba(from var(--error-color, #c92a2a) r g b / .5)}.text-h6[data-v-6b2bf87e]{font-weight:700;font-size:1.25em}.error-message[data-v-6b2bf87e]{font-style:italic}.error-item[data-v-6b2bf87e]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-6b2bf87e]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-6b2bf87e]{display:flex;gap:1.5em}.container svg[data-v-6b2bf87e]{width:3em}.container .single-error[data-v-6b2bf87e]{display:inline-block}')),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import r from "./vue-components.
|
|
2
|
+
import r from "./vue-components.es34.js";
|
|
3
3
|
|
|
4
|
-
import o from "./vue-components.
|
|
4
|
+
import o from "./vue-components.es36.js";
|
|
5
5
|
const m = /* @__PURE__ */ o(r, [["__scopeId", "data-v-6b2bf87e"]]);
|
|
6
6
|
export {
|
|
7
7
|
m as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import o from "./vue-components.
|
|
2
|
+
import o from "./vue-components.es37.js";
|
|
3
3
|
|
|
4
|
-
import m from "./vue-components.
|
|
4
|
+
import m from "./vue-components.es36.js";
|
|
5
5
|
const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
|
|
6
6
|
export {
|
|
7
7
|
e as default
|