@effect-app/vue-components 2.0.0 → 2.1.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/InputProps.d.ts +24 -0
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +34 -0
- package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +32 -0
- package/dist/types/components/OmegaForm/index.d.ts +3 -1
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +26 -0
- package/dist/vue-components.es.js +30 -26
- package/dist/vue-components.es10.js +223 -341
- package/dist/vue-components.es11.js +29 -33
- package/dist/vue-components.es12.js +357 -2
- package/dist/vue-components.es13.js +34 -2
- package/dist/vue-components.es14.js +2 -10
- package/dist/vue-components.es15.js +2 -5
- package/dist/vue-components.es16.js +10 -54
- package/dist/vue-components.es17.js +5 -68
- package/dist/vue-components.es18.js +54 -6
- package/dist/vue-components.es19.js +68 -6
- package/dist/vue-components.es2.js +20 -16
- package/dist/vue-components.es20.js +6 -3
- package/dist/vue-components.es21.js +6 -3
- package/dist/vue-components.es22.js +3 -2
- package/dist/vue-components.es23.js +3 -2
- package/dist/vue-components.es24.js +2 -17
- package/dist/vue-components.es25.js +2 -11
- package/dist/vue-components.es26.js +2 -136
- package/dist/vue-components.es27.js +4 -0
- package/dist/vue-components.es28.js +17 -42
- package/dist/vue-components.es29.js +11 -2
- package/dist/vue-components.es30.js +136 -2
- package/dist/vue-components.es32.js +44 -0
- package/dist/vue-components.es33.js +2 -7
- package/dist/vue-components.es34.js +2 -32
- package/dist/vue-components.es37.js +7 -23
- package/dist/vue-components.es38.js +32 -5
- package/dist/vue-components.es40.js +4 -30
- package/dist/vue-components.es41.js +20 -19
- package/dist/vue-components.es42.js +5 -12
- package/dist/vue-components.es43.js +21 -5
- package/dist/vue-components.es44.js +29 -18
- package/dist/vue-components.es45.js +22 -9
- package/dist/vue-components.es46.js +7 -26
- package/dist/vue-components.es47.js +5 -48
- package/dist/vue-components.es48.js +19 -26
- package/dist/vue-components.es49.js +9 -11
- package/dist/vue-components.es5.js +2 -2
- package/dist/vue-components.es50.js +26 -60
- package/dist/vue-components.es51.js +37 -45
- package/dist/vue-components.es52.js +26 -17
- package/dist/vue-components.es53.js +10 -32
- package/dist/vue-components.es54.js +65 -29
- package/dist/vue-components.es55.js +45 -31
- package/dist/vue-components.es56.js +17 -2
- package/dist/vue-components.es57.js +29 -40
- package/dist/vue-components.es58.js +29 -2
- package/dist/vue-components.es59.js +44 -0
- package/dist/vue-components.es6.js +9 -9
- package/dist/vue-components.es60.js +4 -0
- package/dist/vue-components.es61.js +46 -0
- package/dist/vue-components.es62.js +4 -0
- package/dist/vue-components.es7.js +26 -25
- package/dist/vue-components.es8.js +51 -198
- package/dist/vue-components.es9.js +17 -30
- package/package.json +1 -1
- package/src/components/OmegaForm/InputProps.ts +32 -0
- package/src/components/OmegaForm/OmegaFormStuff.ts +22 -3
- package/src/components/OmegaForm/OmegaInput.vue +4 -1
- package/src/components/OmegaForm/OmegaInternalInput.vue +35 -13
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +73 -0
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +38 -0
- package/src/components/OmegaForm/index.ts +3 -1
- package/src/components/OmegaForm/useOmegaForm.ts +178 -11
- package/dist/vue-components.es36.js +0 -6
- package/dist/vue-components.es39.js +0 -23
- /package/dist/{vue-components.es31.js → vue-components.es35.js} +0 -0
|
@@ -1,353 +1,235 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
for (const p of T)
|
|
44
|
-
"propertySignatures" in p && Object.assign(
|
|
45
|
-
a,
|
|
46
|
-
l({
|
|
47
|
-
parent: o,
|
|
48
|
-
propertySignatures: p.propertySignatures,
|
|
49
|
-
meta: { required: u, nullableOrUndefined: s }
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
} else {
|
|
53
|
-
const p = T.filter(n.AST.isTupleType);
|
|
54
|
-
if (p.length > 0) {
|
|
55
|
-
const m = p[0];
|
|
56
|
-
if (a[o] = {
|
|
57
|
-
type: "multiple",
|
|
58
|
-
members: m.elements,
|
|
59
|
-
rest: m.rest,
|
|
60
|
-
required: u,
|
|
61
|
-
nullableOrUndefined: s
|
|
62
|
-
}, m.rest && m.rest.length > 0) {
|
|
63
|
-
const c = m.rest[0];
|
|
64
|
-
if (c.type._tag === "TypeLiteral" && "propertySignatures" in c.type)
|
|
65
|
-
for (const d of c.type.propertySignatures) {
|
|
66
|
-
const b = `${o}.${d.name.toString()}`, h = l({
|
|
67
|
-
parent: b,
|
|
68
|
-
property: d.type,
|
|
69
|
-
meta: {
|
|
70
|
-
required: !f(d.type),
|
|
71
|
-
nullableOrUndefined: f(d.type)
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (h && typeof h == "object" && "type" in h && (a[b] = h, h.type === "multiple" && n.AST.isTupleType(d.type) && d.type.rest && d.type.rest.length > 0)) {
|
|
75
|
-
const A = d.type.rest[0];
|
|
76
|
-
if (A.type._tag === "TypeLiteral" && "propertySignatures" in A.type)
|
|
77
|
-
for (const x of A.type.propertySignatures) {
|
|
78
|
-
const q = `${b}.${x.name.toString()}`, v = l({
|
|
79
|
-
parent: q,
|
|
80
|
-
property: x.type,
|
|
81
|
-
meta: {
|
|
82
|
-
required: !f(x.type),
|
|
83
|
-
nullableOrUndefined: f(x.type)
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
v && typeof v == "object" && "type" in v && (a[q] = v);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
const m = l({
|
|
93
|
-
parent: o,
|
|
94
|
-
property: i.type,
|
|
95
|
-
meta: { required: u, nullableOrUndefined: s }
|
|
96
|
-
});
|
|
97
|
-
a[o] = m;
|
|
1
|
+
import { useForm as q } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as B, S as D, Effect as c, Fiber as x, Option as P, Array as g } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as K } from "./vue-components.es16.js";
|
|
4
|
+
import { isObject as T } from "./vue-components.es17.js";
|
|
5
|
+
import { computed as O, onUnmounted as N, onMounted as G, onBeforeUnmount as z, watch as W, ref as Q, h as H } from "vue";
|
|
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
|
+
import { context as L } from "./vue-components.es23.js";
|
|
15
|
+
class ne extends B.TaggedError("FormErrors") {
|
|
16
|
+
}
|
|
17
|
+
const E = (u) => function(s) {
|
|
18
|
+
return {
|
|
19
|
+
render() {
|
|
20
|
+
return H(s, {
|
|
21
|
+
form: u,
|
|
22
|
+
...this.$attrs
|
|
23
|
+
}, this.$slots);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, se = (u) => function(s) {
|
|
27
|
+
return {
|
|
28
|
+
setup() {
|
|
29
|
+
const { fieldMap: b, form: p } = u, y = p.useStore((d) => d.errors), f = p.useStore((d) => d.fieldMeta), M = p.useStore((d) => d.errorMap), j = O(() => {
|
|
30
|
+
const d = g.filterMap(
|
|
31
|
+
Object.entries(f.value),
|
|
32
|
+
([i, v]) => {
|
|
33
|
+
const h = v.errors ?? [];
|
|
34
|
+
if (!h.length) return P.none();
|
|
35
|
+
const a = b.value.get(i);
|
|
36
|
+
return a ? P.some({
|
|
37
|
+
label: a.label,
|
|
38
|
+
inputId: a.id,
|
|
39
|
+
// Only show the first error
|
|
40
|
+
errors: [h[0]?.message].filter(Boolean)
|
|
41
|
+
}) : P.none();
|
|
98
42
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (T._tag === "TypeLiteral" && "propertySignatures" in T)
|
|
113
|
-
for (const y of T.propertySignatures) {
|
|
114
|
-
const p = `${o}.${y.name.toString()}`;
|
|
115
|
-
if (n.AST.isTupleType(y.type) && y.type.rest.length > 0) {
|
|
116
|
-
const m = y.type.rest[0].type;
|
|
117
|
-
if (m._tag === "TypeLiteral" && "propertySignatures" in m)
|
|
118
|
-
for (const c of m.propertySignatures) {
|
|
119
|
-
const d = `${p}.${c.name.toString()}`, b = l({
|
|
120
|
-
parent: d,
|
|
121
|
-
property: c.type,
|
|
122
|
-
meta: {
|
|
123
|
-
required: !f(c.type),
|
|
124
|
-
nullableOrUndefined: f(c.type)
|
|
125
|
-
}
|
|
43
|
+
), F = [];
|
|
44
|
+
if (M.value.onSubmit) {
|
|
45
|
+
for (const [i, v] of Object.entries(M.value.onSubmit))
|
|
46
|
+
if (g.isArray(v) && v.length)
|
|
47
|
+
for (const h of v) {
|
|
48
|
+
const a = h;
|
|
49
|
+
if (a?.path && g.isArray(a.path) && a.path.length) {
|
|
50
|
+
const S = a.path.join(".");
|
|
51
|
+
if (!b.value.has(S)) {
|
|
52
|
+
F.push({
|
|
53
|
+
label: S,
|
|
54
|
+
inputId: S,
|
|
55
|
+
errors: [a.message].filter(Boolean)
|
|
126
56
|
});
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
else
|
|
130
|
-
a[p] = {
|
|
131
|
-
type: "multiple",
|
|
132
|
-
members: y.type.elements,
|
|
133
|
-
rest: y.type.rest,
|
|
134
|
-
required: !f(y.type),
|
|
135
|
-
nullableOrUndefined: f(y.type)
|
|
136
|
-
};
|
|
137
|
-
} else {
|
|
138
|
-
const m = l({
|
|
139
|
-
parent: p,
|
|
140
|
-
property: y.type,
|
|
141
|
-
meta: {
|
|
142
|
-
required: !f(y.type),
|
|
143
|
-
nullableOrUndefined: f(y.type)
|
|
57
|
+
break;
|
|
144
58
|
}
|
|
145
|
-
}
|
|
146
|
-
a[p] = m;
|
|
59
|
+
}
|
|
147
60
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
type: "multiple",
|
|
152
|
-
members: i.type.elements,
|
|
153
|
-
rest: i.type.rest,
|
|
154
|
-
required: u,
|
|
155
|
-
nullableOrUndefined: s
|
|
156
|
-
};
|
|
157
|
-
else {
|
|
158
|
-
const O = l({
|
|
159
|
-
parent: o,
|
|
160
|
-
property: i.type,
|
|
161
|
-
meta: {
|
|
162
|
-
// an empty string is valid for a S.String field, so we should not mark it as required
|
|
163
|
-
// TODO: handle this better via the createMeta minLength parsing
|
|
164
|
-
required: u && (i.type._tag !== "StringKeyword" || w(i.type).minLength),
|
|
165
|
-
nullableOrUndefined: s
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
a[o] = O;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return a;
|
|
172
|
-
}
|
|
173
|
-
if (t) {
|
|
174
|
-
const i = E(t);
|
|
175
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !i), n.AST.isUnion(t)) {
|
|
176
|
-
const s = L(t.types), u = s.find(
|
|
177
|
-
(S) => S._tag !== "UndefinedKeyword" && S !== n.Null.ast
|
|
178
|
-
);
|
|
179
|
-
return "propertySignatures" in u ? l({
|
|
180
|
-
propertySignatures: u.propertySignatures,
|
|
181
|
-
parent: r,
|
|
182
|
-
meta: e
|
|
183
|
-
}) : s.every(n.AST.isLiteral) ? {
|
|
184
|
-
...e,
|
|
185
|
-
type: "select",
|
|
186
|
-
members: s.map((S) => S.literal)
|
|
187
|
-
} : {
|
|
188
|
-
...e,
|
|
189
|
-
...l({
|
|
190
|
-
parent: r,
|
|
191
|
-
meta: e,
|
|
192
|
-
property: u
|
|
193
|
-
})
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
if (n.AST.isTupleType(t))
|
|
61
|
+
}
|
|
62
|
+
return [...d, ...F];
|
|
63
|
+
});
|
|
197
64
|
return {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
members: t.elements,
|
|
201
|
-
rest: t.rest
|
|
65
|
+
generalErrors: y,
|
|
66
|
+
errors: j
|
|
202
67
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
68
|
+
},
|
|
69
|
+
render({ errors: b, generalErrors: p }) {
|
|
70
|
+
return H(s, {
|
|
71
|
+
errors: b,
|
|
72
|
+
generalErrors: p,
|
|
73
|
+
...this.$attrs
|
|
74
|
+
}, this.$slots);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}, be = (u, l, s) => {
|
|
78
|
+
if (!u) throw new Error("Schema is required");
|
|
79
|
+
const b = D.standardSchemaV1(u), p = D.decode(u), { meta: y } = C(u), f = O(() => {
|
|
80
|
+
if (s?.persistency?.id)
|
|
81
|
+
return s.persistency.id;
|
|
82
|
+
const e = window.location.pathname, r = Object.keys(y);
|
|
83
|
+
return `${e}-${r.join("-")}`;
|
|
84
|
+
}), M = () => {
|
|
85
|
+
const e = new URLSearchParams(window.location.search);
|
|
86
|
+
e.delete(f.value);
|
|
87
|
+
const r = new URL(window.location.href);
|
|
88
|
+
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
89
|
+
};
|
|
90
|
+
function j(e, r) {
|
|
91
|
+
for (const t in r)
|
|
92
|
+
r[t] && T(r[t]) ? (e[t] || (e[t] = {}), j(e[t], r[t])) : e[t] = r[t];
|
|
93
|
+
return e;
|
|
217
94
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
for (const s in i) {
|
|
231
|
-
const u = o ? `${o}.${s}` : s;
|
|
232
|
-
i[s] && typeof i[s] == "object" && "type" in i[s] ? t[u] = i[s] : i[s] && typeof i[s] == "object" && a(i[s], u);
|
|
95
|
+
const d = O(() => {
|
|
96
|
+
if (l?.defaultValues && !s?.persistency?.overrideDefaultValues)
|
|
97
|
+
return l?.defaultValues;
|
|
98
|
+
let e;
|
|
99
|
+
const r = s?.persistency;
|
|
100
|
+
if (!r?.policies || r.policies.length === 0) return {};
|
|
101
|
+
if (r.policies.includes("querystring"))
|
|
102
|
+
try {
|
|
103
|
+
const o = new URLSearchParams(window.location.search).get(f.value);
|
|
104
|
+
M(), o && (e = JSON.parse(o));
|
|
105
|
+
} catch (t) {
|
|
106
|
+
console.error(t);
|
|
233
107
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
t = n.Number.annotations({
|
|
267
|
-
message: () => r("validation.empty")
|
|
268
|
-
}), e.required && t.annotations({
|
|
269
|
-
message: () => r("validation.empty")
|
|
270
|
-
}), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
271
|
-
message: () => r("validation.number.min", {
|
|
272
|
-
minimum: e.minimum,
|
|
273
|
-
isExclusive: !0
|
|
274
|
-
})
|
|
275
|
-
})), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
|
|
276
|
-
message: () => r("validation.number.max", {
|
|
277
|
-
maximum: e.maximum,
|
|
278
|
-
isExclusive: !0
|
|
279
|
-
})
|
|
280
|
-
})), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
|
|
281
|
-
message: () => r("validation.number.min", {
|
|
282
|
-
minimum: e.exclusiveMinimum,
|
|
283
|
-
isExclusive: !1
|
|
284
|
-
})
|
|
285
|
-
})), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
|
|
286
|
-
message: () => r("validation.number.max", {
|
|
287
|
-
maximum: e.exclusiveMaximum,
|
|
288
|
-
isExclusive: !1
|
|
289
|
-
})
|
|
290
|
-
}));
|
|
291
|
-
break;
|
|
292
|
-
case "select":
|
|
293
|
-
t = n.Literal(...e.members).annotations({
|
|
294
|
-
message: () => ({
|
|
295
|
-
message: r("validation.not_a_valid", {
|
|
296
|
-
type: "select",
|
|
297
|
-
message: e.members.join(", ")
|
|
298
|
-
}),
|
|
299
|
-
override: !0
|
|
300
|
-
})
|
|
301
|
-
});
|
|
302
|
-
break;
|
|
303
|
-
case "multiple":
|
|
304
|
-
t = n.Array(n.String).annotations({
|
|
305
|
-
message: () => r("validation.not_a_valid", {
|
|
306
|
-
type: "multiple",
|
|
307
|
-
message: e.members.join(", ")
|
|
308
|
-
})
|
|
108
|
+
if (
|
|
109
|
+
// query string has higher priority than local/session storage
|
|
110
|
+
!e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
111
|
+
) {
|
|
112
|
+
const t = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
113
|
+
if (t)
|
|
114
|
+
try {
|
|
115
|
+
const o = JSON.parse(
|
|
116
|
+
t.getItem(f.value) || "{}"
|
|
117
|
+
);
|
|
118
|
+
t.removeItem(f.value), e = o;
|
|
119
|
+
} catch (o) {
|
|
120
|
+
console.error(o);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (e ??= {}, l?.defaultValues == null)
|
|
124
|
+
return e;
|
|
125
|
+
{
|
|
126
|
+
const t = l?.defaultValues;
|
|
127
|
+
return j(t, e);
|
|
128
|
+
}
|
|
129
|
+
}), F = (e, r) => e ? L.with(R.setSpan(L.active(), e), r) : r(), i = q({
|
|
130
|
+
...l,
|
|
131
|
+
validators: {
|
|
132
|
+
onSubmit: b,
|
|
133
|
+
...l?.validators || {}
|
|
134
|
+
},
|
|
135
|
+
onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value: t }) => F(r?.currentSpan, async () => {
|
|
136
|
+
const o = await c.runPromise(p(t)), n = l.onSubmit({
|
|
137
|
+
formApi: e,
|
|
138
|
+
meta: r,
|
|
139
|
+
value: o
|
|
309
140
|
});
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
141
|
+
return x.isFiber(n) && x.isRuntimeFiber(n) ? await K(n) : c.isEffect(n) ? await c.runPromise(
|
|
142
|
+
n.pipe(
|
|
143
|
+
// meta?.currentSpan
|
|
144
|
+
// ? Effect.withParentSpan(meta.currentSpan)
|
|
145
|
+
// : (_) => _,
|
|
146
|
+
c.flatMap((m) => x.join(m))
|
|
147
|
+
)
|
|
148
|
+
) : n;
|
|
149
|
+
}) : void 0,
|
|
150
|
+
defaultValues: d.value
|
|
151
|
+
}), v = () => {
|
|
152
|
+
Object.keys(y).forEach((e) => {
|
|
153
|
+
i.setFieldValue(e, void 0);
|
|
154
|
+
});
|
|
155
|
+
}, h = (e) => e.reduce((r, t) => {
|
|
156
|
+
const o = t.split(".");
|
|
157
|
+
return o.reduce((n, m, A) => (A === o.length - 1 ? n[m] = i.getFieldValue(t) : n[m] = n[m] ?? {}, n[m]), r), r;
|
|
158
|
+
}, {}), a = (e) => {
|
|
159
|
+
if (e) {
|
|
160
|
+
if (g.isArray(e.keys))
|
|
161
|
+
return h(e.keys);
|
|
162
|
+
if (g.isArray(e.banKeys)) {
|
|
163
|
+
const r = Object.keys(y).filter((t) => e.banKeys?.includes(t));
|
|
164
|
+
return h(r);
|
|
165
|
+
}
|
|
166
|
+
return i.store.state.values;
|
|
167
|
+
}
|
|
168
|
+
}, S = () => {
|
|
169
|
+
const e = s?.persistency;
|
|
170
|
+
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
171
|
+
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
172
|
+
if (!r) return;
|
|
173
|
+
const t = a(e);
|
|
174
|
+
return r.setItem(f.value, JSON.stringify(t));
|
|
175
|
+
}
|
|
176
|
+
}, U = () => {
|
|
177
|
+
const e = s?.persistency;
|
|
178
|
+
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
179
|
+
const r = a(e), t = new URLSearchParams(window.location.search);
|
|
180
|
+
t.set(f.value, JSON.stringify(r));
|
|
181
|
+
const o = new URL(window.location.href);
|
|
182
|
+
o.search = t.toString(), window.history.replaceState({}, "", o.toString());
|
|
183
|
+
}
|
|
184
|
+
}, _ = (e) => {
|
|
185
|
+
i.store.state.isDirty && e.preventDefault();
|
|
186
|
+
};
|
|
187
|
+
if (N(S), G(() => {
|
|
188
|
+
window.addEventListener("beforeunload", S), window.addEventListener("blur", U), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", _);
|
|
189
|
+
}), z(() => {
|
|
190
|
+
window.removeEventListener("beforeunload", S), window.removeEventListener("blur", U), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", _);
|
|
191
|
+
}), s?.preventWindowExit === "prevent-and-reset") {
|
|
192
|
+
const e = i.useStore((n) => n.isSubmitting), r = i.useStore((n) => n.submissionAttempts), t = i.useStore((n) => n.canSubmit), o = i.useStore((n) => n.values);
|
|
193
|
+
W([e, r], ([n, m], [A]) => {
|
|
194
|
+
A && !n && m > 0 && t.value && i.reset(o.value);
|
|
195
|
+
});
|
|
318
196
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
197
|
+
const I = (e) => c.currentSpan.pipe(
|
|
198
|
+
c.option,
|
|
199
|
+
c.flatMap(
|
|
200
|
+
(r) => c.promise(() => i.handleSubmit(P.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
201
|
+
)
|
|
202
|
+
), J = (e) => e?.checkErrors ? I(e?.meta).pipe(c.flatMap(c.fnUntraced(function* () {
|
|
203
|
+
const r = i.getAllErrors();
|
|
204
|
+
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
205
|
+
return yield* new ne({ form: r.form, fields: r.fields });
|
|
206
|
+
}))) : I(e?.meta), k = i.handleSubmit, V = Q(/* @__PURE__ */ new Map()), w = Object.assign(i, {
|
|
207
|
+
i18nNamespace: s?.i18nNamespace,
|
|
208
|
+
ignorePreventCloseEvents: s?.ignorePreventCloseEvents,
|
|
209
|
+
meta: y,
|
|
210
|
+
clear: v,
|
|
211
|
+
handleSubmit: (e) => {
|
|
212
|
+
const r = R.getSpan(L.active());
|
|
213
|
+
return k({ currentSpan: r, ...e });
|
|
214
|
+
},
|
|
215
|
+
// /** @experimental */
|
|
216
|
+
handleSubmitEffect: J,
|
|
217
|
+
registerField: (e) => {
|
|
218
|
+
W(e, (r) => V.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), N(() => V.value.delete(e.value.name));
|
|
219
|
+
}
|
|
220
|
+
}), $ = { form: w, fieldMap: V };
|
|
221
|
+
return Object.assign(w, {
|
|
222
|
+
errorContext: $,
|
|
223
|
+
Form: E(w)(te),
|
|
224
|
+
Input: E(w)(s?.input ?? ee),
|
|
225
|
+
TaggedUnion: E(w)(re),
|
|
226
|
+
Field: i.Field,
|
|
227
|
+
Errors: se($)(Z),
|
|
228
|
+
Array: E(w)(X),
|
|
229
|
+
AutoGen: E(w)(Y)
|
|
230
|
+
});
|
|
231
|
+
};
|
|
346
232
|
export {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
j as generateInputStandardSchemaFromFieldMeta,
|
|
350
|
-
F as generateMetaFromSchema,
|
|
351
|
-
J as getInputType,
|
|
352
|
-
R as nullableInput
|
|
233
|
+
ne as FormErrors,
|
|
234
|
+
be as useOmegaForm
|
|
353
235
|
};
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return o(n, { ...u, field: f, state: i, inputProps: r });
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
);
|
|
1
|
+
import l from "./vue-components.es28.js";
|
|
2
|
+
import { inject as c, provide as u } from "vue";
|
|
3
|
+
import { onMountedWithCleanup as f } from "./vue-components.es29.js";
|
|
4
|
+
const p = () => l(), i = Symbol("DialogBus"), r = () => c(i, null), g = () => {
|
|
5
|
+
const n = p();
|
|
6
|
+
return u(i, n), n;
|
|
7
|
+
}, d = (n) => {
|
|
8
|
+
const o = r();
|
|
9
|
+
if (!o)
|
|
10
|
+
return;
|
|
11
|
+
const s = n();
|
|
12
|
+
f(() => {
|
|
13
|
+
const e = (t) => {
|
|
14
|
+
s.value && (confirm("Es sind ungespeicherte Änderungen vorhanden. Wirklich schließen?") || (t.prevent = !0));
|
|
15
|
+
};
|
|
16
|
+
return o.on("dialog-closing", e), () => o.off("dialog-closing", e);
|
|
17
|
+
});
|
|
18
|
+
}, h = (n) => {
|
|
19
|
+
let o = r();
|
|
20
|
+
return o || (o = g()), () => {
|
|
21
|
+
const e = {};
|
|
22
|
+
o.emit("dialog-closing", e), e.prevent ? typeof e.prevent == "object" && "then" in e.prevent && e.prevent.then((t) => {
|
|
23
|
+
t !== !1 && n();
|
|
24
|
+
}) : n();
|
|
25
|
+
};
|
|
33
26
|
};
|
|
34
27
|
export {
|
|
35
|
-
|
|
28
|
+
r as injectBus,
|
|
29
|
+
g as provideBus,
|
|
30
|
+
h as useOnClose,
|
|
31
|
+
d as usePreventClose
|
|
36
32
|
};
|