@effect-app/vue-components 2.9.2 → 2.10.2
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 +2 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +13 -2
- package/dist/vue-components.es.js +17 -15
- package/dist/vue-components.es10.js +120 -115
- package/dist/vue-components.es12.js +282 -204
- package/dist/vue-components.es16.js +4 -10
- package/dist/vue-components.es17.js +10 -97
- package/dist/vue-components.es2.js +29 -27
- 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 +2 -4
- package/dist/vue-components.es32.js +1 -1
- package/dist/vue-components.es33.js +111 -2
- package/dist/vue-components.es35.js +9 -0
- package/dist/vue-components.es36.js +32 -7
- package/dist/vue-components.es40.js +6 -0
- package/dist/vue-components.es41.js +23 -4
- package/dist/vue-components.es42.js +5 -23
- package/dist/vue-components.es43.js +21 -5
- package/dist/vue-components.es44.js +25 -16
- package/dist/vue-components.es45.js +15 -23
- package/dist/vue-components.es46.js +7 -17
- package/dist/vue-components.es47.js +5 -12
- package/dist/vue-components.es48.js +19 -5
- package/dist/vue-components.es49.js +9 -19
- package/dist/vue-components.es50.js +31 -9
- package/dist/vue-components.es51.js +42 -25
- package/dist/vue-components.es52.js +16 -38
- package/dist/vue-components.es53.js +11 -26
- package/dist/vue-components.es54.js +65 -11
- package/dist/vue-components.es55.js +45 -54
- package/dist/vue-components.es56.js +15 -54
- package/dist/vue-components.es57.js +31 -15
- package/dist/vue-components.es58.js +26 -30
- package/dist/vue-components.es59.js +42 -29
- package/dist/vue-components.es60.js +2 -42
- package/dist/vue-components.es61.js +44 -2
- package/dist/vue-components.es62.js +2 -44
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es9.js +10 -33
- package/package.json +3 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +174 -11
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +0 -48
- package/src/components/OmegaForm/useOmegaForm.ts +49 -25
- package/dist/types/components/OmegaForm/defaultAST.d.ts +0 -4
- package/dist/vue-components.es34.js +0 -113
- package/dist/vue-components.es37.js +0 -34
- package/dist/vue-components.es63.js +0 -4
- package/src/components/OmegaForm/defaultAST.ts +0 -191
- /package/dist/{vue-components.es39.js → vue-components.es38.js} +0 -0
|
@@ -151,4 +151,6 @@ export type OmegaAutoGenMeta<From extends Record<PropertyKey, any>, To extends R
|
|
|
151
151
|
declare const supportedInputs: readonly ["button", "checkbox", "color", "date", "email", "number", "password", "radio", "range", "search", "submit", "tel", "text", "time", "url"];
|
|
152
152
|
export type SupportedInputs = typeof supportedInputs[number];
|
|
153
153
|
export declare const getInputType: (input: string) => SupportedInputs;
|
|
154
|
+
export declare function deepMerge(target: any, source: any): any;
|
|
155
|
+
export declare const defaultsValueFromSchema: (schema: S.Schema<any>, record?: Record<string, any>) => any;
|
|
154
156
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DeepKeys, DeepValue, StandardSchemaV1Issue, ValidationError, ValidationErrorMap } from "@tanstack/vue-form";
|
|
2
2
|
import { Effect, Order, S } from "effect-app";
|
|
3
|
+
import { UnionToTuples } from "effect-app/utils";
|
|
3
4
|
import { ComputedRef, type InjectionKey } from "vue";
|
|
4
5
|
import { MergedInputProps } from "./InputProps";
|
|
5
6
|
import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff";
|
|
@@ -24,6 +25,8 @@ export declare class FormErrors<From> extends FormErrors_base<{
|
|
|
24
25
|
}>;
|
|
25
26
|
}> {
|
|
26
27
|
}
|
|
28
|
+
export type Policies = "local" | "session" | "querystring";
|
|
29
|
+
export type defaultValuesPriorityUnion = "tanstack" | "persistency" | "schema";
|
|
27
30
|
export type OmegaConfig<T> = {
|
|
28
31
|
i18nNamespace?: string;
|
|
29
32
|
persistency?: {
|
|
@@ -31,8 +34,8 @@ export type OmegaConfig<T> = {
|
|
|
31
34
|
* - "querystring": Highest priority when persisting
|
|
32
35
|
* - "local" and then "session": Lower priority storage options
|
|
33
36
|
*/
|
|
34
|
-
policies?:
|
|
35
|
-
overrideDefaultValues?:
|
|
37
|
+
policies?: UnionToTuples<Policies>;
|
|
38
|
+
overrideDefaultValues?: "deprecated: use defaultValuesPriority";
|
|
36
39
|
id?: string;
|
|
37
40
|
} & keysRule<T>;
|
|
38
41
|
ignorePreventCloseEvents?: boolean;
|
|
@@ -46,6 +49,14 @@ export type OmegaConfig<T> = {
|
|
|
46
49
|
*/
|
|
47
50
|
preventWindowExit?: "prevent" | "prevent-and-reset" | "nope";
|
|
48
51
|
input?: any;
|
|
52
|
+
/**
|
|
53
|
+
* Default values order is: Tanstack default values passed as second parameter to useOmegaForm, then persistency
|
|
54
|
+
* default values from querystring or local/session storage, then defaults from schema
|
|
55
|
+
* You can customize the order and with omegaConfig.defaultValuesPriority
|
|
56
|
+
* default value = ['tanstack', 'persistency', 'schema']
|
|
57
|
+
*/
|
|
58
|
+
defaultValuesPriority?: UnionToTuples<defaultValuesPriorityUnion>;
|
|
59
|
+
defaultFromSchema?: "deprecated: use defaultValuesPriority";
|
|
49
60
|
};
|
|
50
61
|
export interface OF<From, To> extends OmegaFormApi<From, To> {
|
|
51
62
|
meta: MetaRecord<From>;
|
|
@@ -5,11 +5,11 @@ import { default as g } from "./vue-components.es5.js";
|
|
|
5
5
|
import { default as I } from "./vue-components.es6.js";
|
|
6
6
|
import { default as y } from "./vue-components.es7.js";
|
|
7
7
|
import { default as h } from "./vue-components.es8.js";
|
|
8
|
-
import { default as
|
|
9
|
-
import { useOmegaForm as
|
|
10
|
-
import { useOnClose as
|
|
11
|
-
import { createMeta as P,
|
|
12
|
-
import { createUseFormWithCustomInput as
|
|
8
|
+
import { default as b } from "./vue-components.es9.js";
|
|
9
|
+
import { useOmegaForm as M } from "./vue-components.es10.js";
|
|
10
|
+
import { useOnClose as U, usePreventClose as j } from "./vue-components.es11.js";
|
|
11
|
+
import { createMeta as P, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N, nullableInput as W } from "./vue-components.es12.js";
|
|
12
|
+
import { createUseFormWithCustomInput as q } from "./vue-components.es13.js";
|
|
13
13
|
function r(a) {
|
|
14
14
|
for (const e in o)
|
|
15
15
|
if (Object.prototype.hasOwnProperty.call(o, e)) {
|
|
@@ -23,22 +23,24 @@ export {
|
|
|
23
23
|
g as Dialog,
|
|
24
24
|
I as OmegaInput,
|
|
25
25
|
h as OmegaTaggedUnion,
|
|
26
|
-
|
|
26
|
+
b as OmegaTaggedUnionInternal,
|
|
27
27
|
y as OmegaVuetifyInput,
|
|
28
28
|
P as createMeta,
|
|
29
|
-
|
|
29
|
+
q as createUseFormWithCustomInput,
|
|
30
|
+
V as deepMerge,
|
|
30
31
|
n as default,
|
|
31
|
-
k as
|
|
32
|
-
w as
|
|
33
|
-
B as
|
|
34
|
-
D as
|
|
32
|
+
k as defaultsValueFromSchema,
|
|
33
|
+
w as duplicateSchema,
|
|
34
|
+
B as generateInputStandardSchemaFromFieldMeta,
|
|
35
|
+
D as generateMetaFromSchema,
|
|
36
|
+
K as getInputType,
|
|
35
37
|
f as getTransformationFrom,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
N as isNullableOrUndefined,
|
|
39
|
+
W as nullableInput,
|
|
38
40
|
l as provideIntl,
|
|
39
41
|
u as useIntl,
|
|
40
42
|
s as useIntlKey,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
M as useOmegaForm,
|
|
44
|
+
U as useOnClose,
|
|
43
45
|
j as usePreventClose
|
|
44
46
|
};
|
|
@@ -1,228 +1,233 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { computed as U, onUnmounted as N, onMounted as
|
|
5
|
-
import { deepMerge as O, extractSchemaDefaults as Q } from "./vue-components.es17.js";
|
|
1
|
+
import { useForm as B } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as K, S as $, Effect as l, Fiber as x, Option as P, Array as F } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as T } from "./vue-components.es17.js";
|
|
4
|
+
import { computed as U, onUnmounted as N, onMounted as G, onBeforeUnmount as z, watch as W, ref as Q, h as H } from "vue";
|
|
6
5
|
import X from "./vue-components.es18.js";
|
|
7
6
|
import Y from "./vue-components.es19.js";
|
|
8
7
|
import Z from "./vue-components.es20.js";
|
|
9
|
-
import { generateMetaFromSchema as C } from "./vue-components.es12.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
8
|
+
import { generateMetaFromSchema as C, deepMerge as D, defaultsValueFromSchema as ee } from "./vue-components.es12.js";
|
|
9
|
+
import re from "./vue-components.es6.js";
|
|
10
|
+
import te from "./vue-components.es8.js";
|
|
11
|
+
import se from "./vue-components.es21.js";
|
|
13
12
|
import { trace as R } from "./vue-components.es22.js";
|
|
14
13
|
import { context as L } from "./vue-components.es23.js";
|
|
15
|
-
class
|
|
14
|
+
class ne extends K.TaggedError("FormErrors") {
|
|
16
15
|
}
|
|
17
|
-
const
|
|
16
|
+
const g = (a) => function(n) {
|
|
18
17
|
return {
|
|
19
18
|
render() {
|
|
20
|
-
return
|
|
21
|
-
form:
|
|
19
|
+
return H(n, {
|
|
20
|
+
form: a,
|
|
22
21
|
...this.$attrs
|
|
23
22
|
}, this.$slots);
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
},
|
|
25
|
+
}, oe = (a) => function(n) {
|
|
27
26
|
return {
|
|
28
27
|
setup() {
|
|
29
|
-
const { fieldMap:
|
|
30
|
-
const
|
|
28
|
+
const { fieldMap: b, form: h } = a, y = h.useStore((d) => d.errors), m = h.useStore((d) => d.fieldMeta), M = h.useStore((d) => d.errorMap), j = U(() => {
|
|
29
|
+
const d = F.filterMap(
|
|
31
30
|
Object.entries(m.value),
|
|
32
|
-
([
|
|
31
|
+
([O, f]) => {
|
|
33
32
|
const S = f.errors ?? [];
|
|
34
33
|
if (!S.length) return P.none();
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
label:
|
|
38
|
-
inputId:
|
|
34
|
+
const c = b.value.get(O);
|
|
35
|
+
return c ? P.some({
|
|
36
|
+
label: c.label,
|
|
37
|
+
inputId: c.id,
|
|
39
38
|
// Only show the first error
|
|
40
39
|
errors: [S[0]?.message].filter(Boolean)
|
|
41
40
|
}) : P.none();
|
|
42
41
|
}
|
|
43
42
|
), o = [];
|
|
44
|
-
if (
|
|
45
|
-
for (const [
|
|
46
|
-
if (
|
|
43
|
+
if (M.value.onSubmit) {
|
|
44
|
+
for (const [O, f] of Object.entries(M.value.onSubmit))
|
|
45
|
+
if (F.isArray(f) && f.length)
|
|
47
46
|
for (const S of f) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
47
|
+
const c = S;
|
|
48
|
+
if (c?.path && F.isArray(c.path) && c.path.length) {
|
|
49
|
+
const E = c.path.join(".");
|
|
50
|
+
if (!b.value.has(E)) {
|
|
52
51
|
o.push({
|
|
53
|
-
label:
|
|
54
|
-
inputId:
|
|
55
|
-
errors: [
|
|
52
|
+
label: E,
|
|
53
|
+
inputId: E,
|
|
54
|
+
errors: [c.message].filter(Boolean)
|
|
56
55
|
});
|
|
57
56
|
break;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
return [...
|
|
61
|
+
return [...d, ...o];
|
|
63
62
|
});
|
|
64
63
|
return {
|
|
65
|
-
generalErrors:
|
|
66
|
-
errors:
|
|
64
|
+
generalErrors: y,
|
|
65
|
+
errors: j
|
|
67
66
|
};
|
|
68
67
|
},
|
|
69
|
-
render({ errors:
|
|
70
|
-
return
|
|
71
|
-
errors:
|
|
72
|
-
generalErrors:
|
|
68
|
+
render({ errors: b, generalErrors: h }) {
|
|
69
|
+
return H(n, {
|
|
70
|
+
errors: b,
|
|
71
|
+
generalErrors: h,
|
|
73
72
|
...this.$attrs
|
|
74
73
|
}, this.$slots);
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
|
-
}, be = (
|
|
78
|
-
if (!
|
|
79
|
-
const
|
|
76
|
+
}, v = (a, u) => a.includes(u), be = (a, u, n) => {
|
|
77
|
+
if (!a) throw new Error("Schema is required");
|
|
78
|
+
const b = $.standardSchemaV1(a), h = $.decode(a), { meta: y } = C(a), m = U(() => {
|
|
80
79
|
if (n?.persistency?.id)
|
|
81
80
|
return n.persistency.id;
|
|
82
|
-
const e = window.location.pathname, r = Object.keys(
|
|
81
|
+
const e = window.location.pathname, r = Object.keys(y);
|
|
83
82
|
return `${e}-${r.join("-")}`;
|
|
84
|
-
}),
|
|
83
|
+
}), M = () => {
|
|
85
84
|
const e = new URLSearchParams(window.location.search);
|
|
86
85
|
e.delete(m.value);
|
|
87
86
|
const r = new URL(window.location.href);
|
|
88
87
|
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
89
|
-
},
|
|
88
|
+
}, j = U(() => {
|
|
90
89
|
let e;
|
|
91
90
|
const r = n?.persistency;
|
|
92
91
|
if (
|
|
93
92
|
// query string has higher priority than local/session storage
|
|
94
|
-
r?.policies && !e && (r.policies
|
|
93
|
+
r?.policies && !e && (v(r.policies, "local") || v(r.policies, "session"))
|
|
95
94
|
) {
|
|
96
|
-
const s = r.policies
|
|
95
|
+
const s = v(r.policies, "local") ? localStorage : sessionStorage;
|
|
97
96
|
if (s)
|
|
98
97
|
try {
|
|
99
|
-
const
|
|
98
|
+
const t = JSON.parse(
|
|
100
99
|
s.getItem(m.value) || "{}"
|
|
101
100
|
);
|
|
102
|
-
s.removeItem(m.value), e =
|
|
103
|
-
} catch (
|
|
104
|
-
console.error(
|
|
101
|
+
s.removeItem(m.value), e = t;
|
|
102
|
+
} catch (t) {
|
|
103
|
+
console.error(t);
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
if (r?.policies && r.policies
|
|
106
|
+
if (r?.policies && v(r.policies, "querystring"))
|
|
108
107
|
try {
|
|
109
|
-
const
|
|
110
|
-
|
|
108
|
+
const t = new URLSearchParams(window.location.search).get(m.value);
|
|
109
|
+
M(), t && (e = D(e || {}, JSON.parse(t)));
|
|
111
110
|
} catch (s) {
|
|
112
111
|
console.error(s);
|
|
113
112
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
e ??= {};
|
|
114
|
+
const i = {
|
|
115
|
+
tanstack: u?.defaultValues || {},
|
|
116
|
+
persistency: e,
|
|
117
|
+
schema: ee(a)
|
|
118
|
+
};
|
|
119
|
+
return (n?.defaultValuesPriority || ["tanstack", "persistency", "schema"]).reverse().reduce(
|
|
120
|
+
(s, t) => Object.keys(s).length ? D(s, i[t]) : i[t],
|
|
121
|
+
{}
|
|
117
122
|
);
|
|
118
|
-
}),
|
|
119
|
-
...
|
|
123
|
+
}), d = (e, r) => e ? L.with(R.setSpan(L.active(), e), r) : r(), o = B({
|
|
124
|
+
...u,
|
|
120
125
|
validators: {
|
|
121
|
-
onSubmit:
|
|
122
|
-
...
|
|
126
|
+
onSubmit: b,
|
|
127
|
+
...u?.validators || {}
|
|
123
128
|
},
|
|
124
|
-
onSubmit:
|
|
125
|
-
const
|
|
129
|
+
onSubmit: u?.onSubmit ? ({ formApi: e, meta: r, value: i }) => d(r?.currentSpan, async () => {
|
|
130
|
+
const s = await l.runPromise(h(i)), t = u.onSubmit({
|
|
126
131
|
formApi: e,
|
|
127
132
|
meta: r,
|
|
128
|
-
value:
|
|
133
|
+
value: s
|
|
129
134
|
});
|
|
130
|
-
return
|
|
135
|
+
return x.isFiber(t) && x.isRuntimeFiber(t) ? await T(t) : l.isEffect(t) ? await l.runPromise(
|
|
131
136
|
t.pipe(
|
|
132
137
|
// meta?.currentSpan
|
|
133
138
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
134
139
|
// : (_) => _,
|
|
135
|
-
|
|
140
|
+
l.flatMap((p) => x.join(p))
|
|
136
141
|
)
|
|
137
142
|
) : t;
|
|
138
143
|
}) : void 0,
|
|
139
|
-
defaultValues:
|
|
140
|
-
}),
|
|
141
|
-
Object.keys(
|
|
144
|
+
defaultValues: j.value
|
|
145
|
+
}), O = () => {
|
|
146
|
+
Object.keys(y).forEach((e) => {
|
|
142
147
|
o.setFieldValue(e, void 0);
|
|
143
148
|
});
|
|
144
|
-
}, f = (e) => e.reduce((r,
|
|
145
|
-
const
|
|
146
|
-
return
|
|
149
|
+
}, f = (e) => e.reduce((r, i) => {
|
|
150
|
+
const s = i.split(".");
|
|
151
|
+
return s.reduce((t, p, A) => (A === s.length - 1 ? t[p] = o.getFieldValue(i) : t[p] = t[p] ?? {}, t[p]), r), r;
|
|
147
152
|
}, {}), S = (e) => {
|
|
148
153
|
if (e) {
|
|
149
|
-
if (
|
|
154
|
+
if (F.isArray(e.keys))
|
|
150
155
|
return f(e.keys);
|
|
151
|
-
if (
|
|
152
|
-
const r = Object.keys(
|
|
156
|
+
if (F.isArray(e.banKeys)) {
|
|
157
|
+
const r = Object.keys(y).filter((i) => e.banKeys?.includes(i));
|
|
153
158
|
return f(r);
|
|
154
159
|
}
|
|
155
160
|
return o.store.state.values;
|
|
156
161
|
}
|
|
157
|
-
},
|
|
162
|
+
}, c = () => {
|
|
158
163
|
const e = n?.persistency;
|
|
159
|
-
if (!(!e?.policies || e.policies.length === 0) && (e.policies
|
|
160
|
-
const r = e.policies
|
|
164
|
+
if (!(!e?.policies || e.policies.length === 0) && (v(e.policies, "local") || v(e.policies, "session"))) {
|
|
165
|
+
const r = v(e.policies, "local") ? localStorage : sessionStorage;
|
|
161
166
|
if (!r) return;
|
|
162
|
-
const
|
|
163
|
-
return r.setItem(m.value, JSON.stringify(
|
|
167
|
+
const i = S(e);
|
|
168
|
+
return r.setItem(m.value, JSON.stringify(i));
|
|
164
169
|
}
|
|
165
|
-
},
|
|
170
|
+
}, E = () => {
|
|
166
171
|
const e = n?.persistency;
|
|
167
|
-
if (!(!e?.policies || e.policies.length === 0) && e.policies
|
|
168
|
-
const r = S(e),
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
+
if (!(!e?.policies || e.policies.length === 0) && v(e.policies, "querystring")) {
|
|
173
|
+
const r = S(e), i = new URLSearchParams(window.location.search);
|
|
174
|
+
i.set(m.value, JSON.stringify(r));
|
|
175
|
+
const s = new URL(window.location.href);
|
|
176
|
+
s.search = i.toString(), window.history.replaceState({}, "", s.toString());
|
|
172
177
|
}
|
|
173
178
|
}, V = (e) => {
|
|
174
179
|
o.store.state.isDirty && e.preventDefault();
|
|
175
180
|
};
|
|
176
|
-
if (N(
|
|
177
|
-
window.addEventListener("beforeunload",
|
|
178
|
-
}),
|
|
179
|
-
window.removeEventListener("beforeunload",
|
|
181
|
+
if (N(c), G(() => {
|
|
182
|
+
window.addEventListener("beforeunload", c), window.addEventListener("blur", E), n?.preventWindowExit && n.preventWindowExit !== "nope" && window.addEventListener("beforeunload", V);
|
|
183
|
+
}), z(() => {
|
|
184
|
+
window.removeEventListener("beforeunload", c), window.removeEventListener("blur", E), n?.preventWindowExit && n.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", V);
|
|
180
185
|
}), n?.preventWindowExit === "prevent-and-reset") {
|
|
181
|
-
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts),
|
|
182
|
-
W([e, r], ([t, p], [
|
|
183
|
-
|
|
186
|
+
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), i = o.useStore((t) => t.canSubmit), s = o.useStore((t) => t.values);
|
|
187
|
+
W([e, r], ([t, p], [A]) => {
|
|
188
|
+
A && !t && p > 0 && i.value && o.reset(s.value);
|
|
184
189
|
});
|
|
185
190
|
}
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
(r) =>
|
|
191
|
+
const k = (e) => l.currentSpan.pipe(
|
|
192
|
+
l.option,
|
|
193
|
+
l.flatMap(
|
|
194
|
+
(r) => l.promise(() => o.handleSubmit(P.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
190
195
|
)
|
|
191
|
-
),
|
|
196
|
+
), J = (e) => e?.checkErrors ? k(e?.meta).pipe(l.flatMap(l.fnUntraced(function* () {
|
|
192
197
|
const r = o.getAllErrors();
|
|
193
198
|
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
194
|
-
return yield* new
|
|
195
|
-
}))) :
|
|
199
|
+
return yield* new ne({ form: r.form, fields: r.fields });
|
|
200
|
+
}))) : k(e?.meta), q = o.handleSubmit, _ = Q(/* @__PURE__ */ new Map()), w = Object.assign(o, {
|
|
196
201
|
i18nNamespace: n?.i18nNamespace,
|
|
197
202
|
ignorePreventCloseEvents: n?.ignorePreventCloseEvents,
|
|
198
|
-
meta:
|
|
199
|
-
clear:
|
|
203
|
+
meta: y,
|
|
204
|
+
clear: O,
|
|
200
205
|
handleSubmit: (e) => {
|
|
201
206
|
const r = R.getSpan(L.active());
|
|
202
|
-
return
|
|
207
|
+
return q({ currentSpan: r, ...e });
|
|
203
208
|
},
|
|
204
209
|
// /** @experimental */
|
|
205
|
-
handleSubmitEffect:
|
|
210
|
+
handleSubmitEffect: J,
|
|
206
211
|
registerField: (e) => {
|
|
207
|
-
W(e, (r) =>
|
|
212
|
+
W(e, (r) => _.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), N(() => _.value.delete(e.value.name));
|
|
208
213
|
}
|
|
209
|
-
}),
|
|
210
|
-
return Object.assign(
|
|
214
|
+
}), I = { form: w, fieldMap: _ };
|
|
215
|
+
return Object.assign(w, {
|
|
211
216
|
// Type-level properties for performance optimization (not used at runtime)
|
|
212
217
|
_paths: void 0,
|
|
213
218
|
_keys: void 0,
|
|
214
|
-
_schema:
|
|
215
|
-
errorContext:
|
|
216
|
-
Form:
|
|
217
|
-
Input:
|
|
218
|
-
TaggedUnion:
|
|
219
|
+
_schema: a,
|
|
220
|
+
errorContext: I,
|
|
221
|
+
Form: g(w)(se),
|
|
222
|
+
Input: g(w)(n?.input ?? re),
|
|
223
|
+
TaggedUnion: g(w)(te),
|
|
219
224
|
Field: o.Field,
|
|
220
|
-
Errors:
|
|
221
|
-
Array:
|
|
222
|
-
AutoGen:
|
|
225
|
+
Errors: oe(I)(Z),
|
|
226
|
+
Array: g(w)(X),
|
|
227
|
+
AutoGen: g(w)(Y)
|
|
223
228
|
});
|
|
224
229
|
};
|
|
225
230
|
export {
|
|
226
|
-
|
|
231
|
+
ne as FormErrors,
|
|
227
232
|
be as useOmegaForm
|
|
228
233
|
};
|