@effect-app/vue-components 3.2.0 → 4.0.0-beta.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/OmegaAutoGen.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +11 -13
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -4
- package/dist/types/utils/index.d.ts +4 -3
- package/dist/vue-components.es.js +13 -14
- package/dist/vue-components.es10.js +109 -115
- package/dist/vue-components.es11.js +1 -1
- package/dist/vue-components.es12.js +290 -341
- package/dist/vue-components.es17.js +723 -4
- package/dist/vue-components.es18.js +140 -9
- package/dist/vue-components.es19.js +4 -55
- package/dist/vue-components.es2.js +17 -18
- package/dist/vue-components.es20.js +11 -68
- package/dist/vue-components.es21.js +3 -6
- package/dist/vue-components.es22.js +24 -6
- package/dist/vue-components.es23.js +4 -3
- package/dist/vue-components.es24.js +8 -3
- package/dist/vue-components.es25.js +55 -2
- package/dist/vue-components.es26.js +69 -2
- package/dist/vue-components.es27.js +6 -2
- package/dist/vue-components.es28.js +6 -2
- package/dist/vue-components.es29.js +3 -17
- package/dist/vue-components.es3.js +9 -9
- package/dist/vue-components.es30.js +3 -192
- package/dist/vue-components.es31.js +4 -0
- package/dist/vue-components.es32.js +2 -42
- package/dist/vue-components.es33.js +1 -1
- package/dist/vue-components.es34.js +1 -1
- package/dist/vue-components.es35.js +17 -111
- package/dist/vue-components.es36.js +40 -0
- package/dist/vue-components.es37.js +4 -7
- package/dist/vue-components.es38.js +82 -31
- package/dist/vue-components.es39.js +54 -0
- package/dist/vue-components.es40.js +561 -4
- package/dist/vue-components.es41.js +40 -22
- package/dist/vue-components.es42.js +27 -5
- package/dist/vue-components.es43.js +5 -21
- package/dist/vue-components.es44.js +39 -29
- package/dist/vue-components.es45.js +313 -21
- package/dist/vue-components.es46.js +31 -12
- package/dist/vue-components.es47.js +4 -5
- package/dist/vue-components.es48.js +23 -18
- package/dist/vue-components.es49.js +74 -8
- package/dist/vue-components.es50.js +98 -30
- package/dist/vue-components.es51.js +2 -48
- package/dist/vue-components.es52.js +317 -25
- package/dist/vue-components.es53.js +64 -11
- package/dist/vue-components.es54.js +2 -65
- package/dist/vue-components.es55.js +2 -56
- package/dist/vue-components.es56.js +110 -16
- package/dist/vue-components.es58.js +7 -29
- package/dist/vue-components.es59.js +31 -41
- package/dist/vue-components.es61.js +190 -42
- package/dist/vue-components.es63.js +6 -0
- package/dist/vue-components.es64.js +103 -0
- package/dist/vue-components.es65.js +4 -0
- package/dist/vue-components.es66.js +23 -0
- package/dist/vue-components.es67.js +84 -0
- package/dist/vue-components.es68.js +14 -0
- package/dist/vue-components.es69.js +115 -0
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es70.js +5 -0
- package/dist/vue-components.es71.js +34 -0
- package/dist/vue-components.es72.js +4 -0
- package/dist/vue-components.es73.js +4 -0
- package/dist/vue-components.es74.js +17 -0
- package/dist/vue-components.es75.js +72 -0
- package/dist/vue-components.es76.js +25 -0
- package/dist/vue-components.es77.js +7 -0
- package/dist/vue-components.es78.js +23 -0
- package/dist/vue-components.es79.js +32 -0
- package/dist/vue-components.es80.js +24 -0
- package/dist/vue-components.es81.js +14 -0
- package/dist/vue-components.es82.js +7 -0
- package/dist/vue-components.es83.js +21 -0
- package/dist/vue-components.es84.js +11 -0
- package/dist/vue-components.es85.js +33 -0
- package/dist/vue-components.es86.js +50 -0
- package/dist/vue-components.es87.js +28 -0
- package/dist/vue-components.es88.js +17 -0
- package/dist/vue-components.es89.js +18 -0
- package/dist/vue-components.es90.js +10 -0
- package/dist/vue-components.es91.js +13 -0
- package/dist/vue-components.es92.js +67 -0
- package/dist/vue-components.es93.js +58 -0
- package/dist/vue-components.es94.js +19 -0
- package/dist/{vue-components.es57.js → vue-components.es95.js} +3 -3
- package/dist/vue-components.es96.js +31 -0
- package/dist/vue-components.es97.js +44 -0
- package/dist/vue-components.es99.js +46 -0
- package/package.json +25 -24
- package/src/components/OmegaForm/OmegaAutoGen.vue +11 -10
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +3 -2
- package/src/components/OmegaForm/OmegaFormStuff.ts +249 -274
- package/src/components/OmegaForm/OmegaInternalInput.vue +1 -1
- package/src/components/OmegaForm/useOmegaForm.ts +27 -28
- package/src/utils/index.ts +7 -7
- /package/dist/{vue-components.es62.js → vue-components.es100.js} +0 -0
- /package/dist/{vue-components.es60.js → vue-components.es98.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DeepKeys } from "@tanstack/vue-form";
|
|
2
|
-
import
|
|
2
|
+
import * as Order from "effect/Order";
|
|
3
3
|
import { type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff";
|
|
4
4
|
declare const __VLS_export: <// dprint-ignore
|
|
5
5
|
From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as Effect from "effect/Effect";
|
|
2
|
+
import * as AST from "effect/SchemaAST";
|
|
2
3
|
import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldValidateOrFn, type FormApi, type FormAsyncValidateOrFn, type FormOptions, type FormState, type FormValidateOrFn, type StandardSchemaV1, type VueFormApi } from "@tanstack/vue-form";
|
|
3
|
-
import
|
|
4
|
+
import * as S from "effect/Schema";
|
|
4
5
|
import { useIntl } from "../../utils";
|
|
5
6
|
import { type OmegaFieldInternalApi } from "./InputProps";
|
|
6
7
|
import { type OF, type OmegaFormReturn } from "./useOmegaForm";
|
|
@@ -67,7 +68,7 @@ export type FormProps<From, To> = Omit<FormOptions<From, FormValidateOrFn<From>
|
|
|
67
68
|
formApi: OmegaFormParams<From, To>;
|
|
68
69
|
meta: any;
|
|
69
70
|
value: To;
|
|
70
|
-
}) => Promise<any> |
|
|
71
|
+
}) => Promise<any> | Effect.Effect<unknown, any, never>;
|
|
71
72
|
};
|
|
72
73
|
export type OmegaFormParams<From, To> = FormApi<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
|
|
73
74
|
export type OmegaFormState<From, To> = FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
|
|
@@ -109,7 +110,7 @@ export type SelectFieldMeta = BaseFieldMeta & {
|
|
|
109
110
|
export type MultipleFieldMeta = BaseFieldMeta & {
|
|
110
111
|
type: "multiple";
|
|
111
112
|
members: any[];
|
|
112
|
-
rest:
|
|
113
|
+
rest: readonly AST.AST[];
|
|
113
114
|
};
|
|
114
115
|
export type BooleanFieldMeta = BaseFieldMeta & {
|
|
115
116
|
type: "boolean";
|
|
@@ -132,24 +133,21 @@ export type CreateMeta = {
|
|
|
132
133
|
meta?: Record<string, any>;
|
|
133
134
|
nullableOrUndefined?: false | "undefined" | "null";
|
|
134
135
|
} & ({
|
|
135
|
-
propertySignatures: readonly
|
|
136
|
+
propertySignatures: readonly AST.PropertySignature[];
|
|
136
137
|
property?: never;
|
|
137
138
|
} | {
|
|
138
139
|
propertySignatures?: never;
|
|
139
|
-
property:
|
|
140
|
+
property: AST.AST;
|
|
140
141
|
});
|
|
141
|
-
export declare const isNullableOrUndefined: (property: false |
|
|
142
|
+
export declare const isNullableOrUndefined: (property: false | AST.AST | undefined) => false | "undefined" | "null";
|
|
142
143
|
export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
|
|
143
|
-
export declare const duplicateSchema: <From, To>(schema: S.
|
|
144
|
-
export declare const generateMetaFromSchema: <
|
|
145
|
-
schema:
|
|
144
|
+
export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never, never>;
|
|
145
|
+
export declare const generateMetaFromSchema: <_From, To>(schema: any) => {
|
|
146
|
+
schema: any;
|
|
146
147
|
meta: MetaRecord<To>;
|
|
147
148
|
unionMeta: Record<string, MetaRecord<To>>;
|
|
148
149
|
};
|
|
149
150
|
export declare const generateInputStandardSchemaFromFieldMeta: (meta: FieldMeta, trans?: ReturnType<typeof useIntl>["trans"]) => StandardSchemaV1<any, any>;
|
|
150
|
-
export declare const nullableInput: <A, I, R>(schema: S.Schema<A, I, R>, defaultValue: () => A) => S.transform<import("effect/Schema").NullOr<S.Schema<A, I, R>> & {
|
|
151
|
-
withDefault: S.PropertySignature<":", A | null, never, ":", I | null, true, R>;
|
|
152
|
-
}, S.SchemaClass<A, A, never>>;
|
|
153
151
|
export type OmegaAutoGenMeta<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = Omit<OmegaInputProps<From, To, Name>, "form">;
|
|
154
152
|
declare const supportedInputs: readonly ["button", "checkbox", "color", "date", "email", "number", "password", "radio", "range", "search", "submit", "tel", "text", "time", "url"];
|
|
155
153
|
export type SupportedInputs = typeof supportedInputs[number];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type DeepKeys, DeepValue, StandardSchemaV1Issue, ValidationError, ValidationErrorMap } from "@tanstack/vue-form";
|
|
2
|
-
import { Effect, Order, S } from "effect-app";
|
|
3
2
|
import { UnionToTuples } from "effect-app/utils";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Order from "effect/Order";
|
|
5
|
+
import * as S from "effect/Schema";
|
|
4
6
|
import { ComputedRef, type InjectionKey } from "vue";
|
|
5
7
|
import { MergedInputProps } from "./InputProps";
|
|
6
8
|
import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff";
|
|
@@ -11,7 +13,7 @@ type keysRule<T> = {
|
|
|
11
13
|
keys?: "You should only use one of banKeys or keys, not both, moron";
|
|
12
14
|
banKeys?: NestedKeyOf<T>[];
|
|
13
15
|
};
|
|
14
|
-
declare const FormErrors_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").
|
|
16
|
+
declare const FormErrors_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").MatchRecord<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }, void, { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
15
17
|
readonly _tag: "FormErrors";
|
|
16
18
|
} & Readonly<A>;
|
|
17
19
|
export declare class FormErrors<From> extends FormErrors_base<{
|
|
@@ -94,7 +96,7 @@ type CachedFieldState<From, To, TypeProps = DefaultTypeProps> = import("@tanstac
|
|
|
94
96
|
export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps> extends OF<From, To> {
|
|
95
97
|
_paths: FieldPath<From>;
|
|
96
98
|
_keys: DeepKeys<From>;
|
|
97
|
-
_schema: S.
|
|
99
|
+
_schema: S.Codec<To, From, never>;
|
|
98
100
|
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<{
|
|
99
101
|
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;
|
|
100
102
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -210,5 +212,5 @@ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To exten
|
|
|
210
212
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
211
213
|
};
|
|
212
214
|
}
|
|
213
|
-
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps>(schema: S.
|
|
215
|
+
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps>(schema: S.Codec<To, From, never>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To, TypeProps>;
|
|
214
216
|
export {};
|
|
@@ -11,9 +11,10 @@ export declare const useIntl: () => {
|
|
|
11
11
|
export declare const provideIntl: (intl: ReturnType<typeof makeIntl>["useIntl"]) => void;
|
|
12
12
|
/**
|
|
13
13
|
* Recursively extracts the source AST from a transformation chain.
|
|
14
|
-
*
|
|
14
|
+
* In v4, transformations are stored in the `encoding` property, not as wrapped AST nodes.
|
|
15
|
+
* This function returns the encoded form if an encoding chain exists, otherwise returns the AST itself.
|
|
15
16
|
*
|
|
16
17
|
* @param ast - The AST node to extract the transformation source from
|
|
17
|
-
* @returns The source AST
|
|
18
|
+
* @returns The source AST (the decoded/type form, which is the AST itself in v4)
|
|
18
19
|
*/
|
|
19
|
-
export declare function getTransformationFrom(ast: S.AST.AST): S.AST.
|
|
20
|
+
export declare function getTransformationFrom(ast: S.AST.AST): S.AST.AST;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as o from "./vue-components.es2.js";
|
|
2
|
-
import { getTransformationFrom as
|
|
2
|
+
import { getTransformationFrom as p, provideIntl as l, useIntl as s, useIntlKey as u } from "./vue-components.es3.js";
|
|
3
3
|
import { default as i } from "./vue-components.es4.js";
|
|
4
4
|
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, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N
|
|
12
|
-
import { createUseFormWithCustomInput as
|
|
8
|
+
import { default as C } from "./vue-components.es9.js";
|
|
9
|
+
import { useOmegaForm as T } from "./vue-components.es10.js";
|
|
10
|
+
import { useOnClose as b, 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 } from "./vue-components.es12.js";
|
|
12
|
+
import { createUseFormWithCustomInput as $ } 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,10 +23,10 @@ export {
|
|
|
23
23
|
g as Dialog,
|
|
24
24
|
I as OmegaInput,
|
|
25
25
|
h as OmegaTaggedUnion,
|
|
26
|
-
|
|
26
|
+
C as OmegaTaggedUnionInternal,
|
|
27
27
|
y as OmegaVuetifyInput,
|
|
28
28
|
P as createMeta,
|
|
29
|
-
|
|
29
|
+
$ as createUseFormWithCustomInput,
|
|
30
30
|
V as deepMerge,
|
|
31
31
|
n as default,
|
|
32
32
|
k as defaultsValueFromSchema,
|
|
@@ -34,13 +34,12 @@ export {
|
|
|
34
34
|
B as generateInputStandardSchemaFromFieldMeta,
|
|
35
35
|
D as generateMetaFromSchema,
|
|
36
36
|
K as getInputType,
|
|
37
|
-
|
|
37
|
+
p as getTransformationFrom,
|
|
38
38
|
N as isNullableOrUndefined,
|
|
39
|
-
W as nullableInput,
|
|
40
39
|
l as provideIntl,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
s as useIntl,
|
|
41
|
+
u as useIntlKey,
|
|
42
|
+
T as useOmegaForm,
|
|
43
|
+
b as useOnClose,
|
|
45
44
|
j as usePreventClose
|
|
46
45
|
};
|
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import C from "./vue-components.
|
|
8
|
-
import ee from "
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
|
|
1
|
+
import { useForm as J } from "@tanstack/vue-form";
|
|
2
|
+
import { runtimeFiberAsPromise as q } from "./vue-components.es20.js";
|
|
3
|
+
import { TaggedError as B } from "./vue-components.es21.js";
|
|
4
|
+
import { currentSpan as K, runPromise as x, isEffect as T, flatMap as k, fnUntraced as z, option as G, promise as Z } from "./vue-components.es22.js";
|
|
5
|
+
import { isFiber as Q } from "./vue-components.es23.js";
|
|
6
|
+
import { isSome as X } from "./vue-components.es24.js";
|
|
7
|
+
import { toStandardSchemaV1 as Y, decodeEffect as C } from "./vue-components.es18.js";
|
|
8
|
+
import { computed as _, onUnmounted as I, onMounted as ee, onBeforeUnmount as re, watch as V, ref as te, h as N } from "vue";
|
|
9
|
+
import { useIntl as se } from "./vue-components.es3.js";
|
|
10
|
+
import ne from "./vue-components.es25.js";
|
|
11
|
+
import oe from "./vue-components.es26.js";
|
|
12
|
+
import ie from "./vue-components.es27.js";
|
|
13
|
+
import { generateMetaFromSchema as ae, deepMerge as W, defaultsValueFromSchema as ce } from "./vue-components.es12.js";
|
|
14
|
+
import le from "./vue-components.es6.js";
|
|
15
|
+
import ue from "./vue-components.es8.js";
|
|
16
|
+
import de from "./vue-components.es28.js";
|
|
17
|
+
import { trace as D } from "./vue-components.es29.js";
|
|
18
|
+
import { context as P } from "./vue-components.es30.js";
|
|
19
|
+
class me extends B("FormErrors") {
|
|
16
20
|
}
|
|
17
|
-
const
|
|
21
|
+
const A = (i) => function(s) {
|
|
18
22
|
return {
|
|
19
23
|
render() {
|
|
20
|
-
return
|
|
24
|
+
return N(s, {
|
|
21
25
|
form: i,
|
|
22
26
|
...this.$attrs
|
|
23
27
|
}, this.$slots);
|
|
24
28
|
}
|
|
25
29
|
};
|
|
26
|
-
},
|
|
27
|
-
const { formatMessage: l } =
|
|
28
|
-
return (a) => i.i18nNamespace ? l({ id: `${i.i18nNamespace}.fields.${a}`, defaultMessage:
|
|
29
|
-
},
|
|
30
|
+
}, fe = (i) => {
|
|
31
|
+
const { formatMessage: l } = se(), s = (a) => a.replace(/([A-Z])/g, " $1").replace(/^./, (g) => g.toUpperCase()).trim(), m = (a) => l ? l({ id: `general.fields.${a}`, defaultMessage: s(a) }) : s(a);
|
|
32
|
+
return (a) => i.i18nNamespace ? l({ id: `${i.i18nNamespace}.fields.${a}`, defaultMessage: m(a) }) : m(a);
|
|
33
|
+
}, pe = (i) => function(s) {
|
|
30
34
|
return {
|
|
31
35
|
setup() {
|
|
32
|
-
const { fieldMap:
|
|
33
|
-
const v =
|
|
34
|
-
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}) : j.none();
|
|
45
|
-
}
|
|
46
|
-
), o = [];
|
|
36
|
+
const { fieldMap: m, form: f } = i, a = f.useStore((v) => v.errors), g = f.useStore((v) => v.fieldMeta), p = f.useStore((v) => v.errorMap), M = fe(f), L = _(() => {
|
|
37
|
+
const v = Object.entries(g.value).reduce((b, [h, y]) => {
|
|
38
|
+
const u = y?.errors ?? [];
|
|
39
|
+
if (!u.length)
|
|
40
|
+
return b;
|
|
41
|
+
const d = m.value.get(h);
|
|
42
|
+
return d && b.push({
|
|
43
|
+
label: d.label,
|
|
44
|
+
inputId: d.id,
|
|
45
|
+
errors: [u[0]?.message].filter(Boolean)
|
|
46
|
+
}), b;
|
|
47
|
+
}, []), o = [];
|
|
47
48
|
if (p.value.onSubmit) {
|
|
48
|
-
for (const [
|
|
49
|
-
if (
|
|
50
|
-
for (const
|
|
51
|
-
const u =
|
|
52
|
-
if (u?.path &&
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
49
|
+
for (const [b, h] of Object.entries(p.value.onSubmit))
|
|
50
|
+
if (Array.isArray(h) && h.length)
|
|
51
|
+
for (const y of h) {
|
|
52
|
+
const u = y;
|
|
53
|
+
if (u?.path && Array.isArray(u.path) && u.path.length) {
|
|
54
|
+
const d = u.path.join(".");
|
|
55
|
+
if (!m.value.has(d)) {
|
|
55
56
|
o.push({
|
|
56
|
-
label:
|
|
57
|
-
inputId:
|
|
57
|
+
label: M(d),
|
|
58
|
+
inputId: d,
|
|
58
59
|
errors: [u.message].filter(Boolean)
|
|
59
60
|
});
|
|
60
61
|
break;
|
|
@@ -69,34 +70,34 @@ const M = (i) => function(s) {
|
|
|
69
70
|
errors: L
|
|
70
71
|
};
|
|
71
72
|
},
|
|
72
|
-
render({ errors:
|
|
73
|
-
return
|
|
74
|
-
errors:
|
|
75
|
-
generalErrors:
|
|
73
|
+
render({ errors: m, generalErrors: f }) {
|
|
74
|
+
return N(s, {
|
|
75
|
+
errors: m,
|
|
76
|
+
generalErrors: f,
|
|
76
77
|
...this.$attrs
|
|
77
78
|
}, this.$slots);
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
|
-
},
|
|
81
|
+
}, S = (i, l) => i.includes(l), xe = (i, l, s) => {
|
|
81
82
|
if (!i) throw new Error("Schema is required");
|
|
82
|
-
const
|
|
83
|
+
const m = Y(i), f = C(i), { meta: a, unionMeta: g } = ae(i), p = _(() => {
|
|
83
84
|
if (s?.persistency?.id)
|
|
84
85
|
return s.persistency.id;
|
|
85
86
|
const e = window.location.pathname, r = Object.keys(a);
|
|
86
87
|
return `${e}-${r.join("-")}`;
|
|
87
|
-
}),
|
|
88
|
+
}), M = () => {
|
|
88
89
|
const e = new URLSearchParams(window.location.search);
|
|
89
90
|
e.delete(p.value);
|
|
90
91
|
const r = new URL(window.location.href);
|
|
91
92
|
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
92
|
-
}, L =
|
|
93
|
+
}, L = _(() => {
|
|
93
94
|
let e;
|
|
94
95
|
const r = s?.persistency;
|
|
95
96
|
if (
|
|
96
97
|
// query string has higher priority than local/session storage
|
|
97
|
-
r?.policies && !e && (
|
|
98
|
+
r?.policies && !e && (S(r.policies, "local") || S(r.policies, "session"))
|
|
98
99
|
) {
|
|
99
|
-
const n =
|
|
100
|
+
const n = S(r.policies, "local") ? localStorage : sessionStorage;
|
|
100
101
|
if (n)
|
|
101
102
|
try {
|
|
102
103
|
const t = JSON.parse(
|
|
@@ -107,10 +108,10 @@ const M = (i) => function(s) {
|
|
|
107
108
|
console.error(t);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
if (r?.policies &&
|
|
111
|
+
if (r?.policies && S(r.policies, "querystring"))
|
|
111
112
|
try {
|
|
112
113
|
const t = new URLSearchParams(window.location.search).get(p.value);
|
|
113
|
-
|
|
114
|
+
M(), t && (e = W(e || {}, JSON.parse(t)));
|
|
114
115
|
} catch (n) {
|
|
115
116
|
console.error(n);
|
|
116
117
|
}
|
|
@@ -118,46 +119,39 @@ const M = (i) => function(s) {
|
|
|
118
119
|
const c = {
|
|
119
120
|
tanstack: l?.defaultValues || {},
|
|
120
121
|
persistency: e,
|
|
121
|
-
schema:
|
|
122
|
+
schema: ce(i)
|
|
122
123
|
};
|
|
123
124
|
return (s?.defaultValuesPriority || ["tanstack", "persistency", "schema"]).reverse().reduce(
|
|
124
|
-
(n, t) => Object.keys(n).length ?
|
|
125
|
+
(n, t) => Object.keys(n).length ? W(n, c[t]) : c[t],
|
|
125
126
|
{}
|
|
126
127
|
);
|
|
127
|
-
}), v = (e, r) => e ?
|
|
128
|
+
}), v = (e, r) => e ? P.with(D.setSpan(P.active(), e), r) : r(), o = J({
|
|
128
129
|
...l,
|
|
129
130
|
validators: {
|
|
130
|
-
onSubmit:
|
|
131
|
+
onSubmit: m,
|
|
131
132
|
...l?.validators || {}
|
|
132
133
|
},
|
|
133
134
|
onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value: c }) => v(r?.currentSpan, async () => {
|
|
134
|
-
const n = await
|
|
135
|
+
const n = await x(f(c)), t = l.onSubmit({
|
|
135
136
|
formApi: e,
|
|
136
137
|
meta: r,
|
|
137
138
|
value: n
|
|
138
139
|
});
|
|
139
|
-
return
|
|
140
|
-
t.pipe(
|
|
141
|
-
// meta?.currentSpan
|
|
142
|
-
// ? Effect.withParentSpan(meta.currentSpan)
|
|
143
|
-
// : (_) => _,
|
|
144
|
-
d.flatMap((S) => $.join(S))
|
|
145
|
-
)
|
|
146
|
-
) : t;
|
|
140
|
+
return Q(t) ? await q(t) : T(t) ? await x(t) : t;
|
|
147
141
|
}) : void 0,
|
|
148
142
|
defaultValues: L.value
|
|
149
|
-
}),
|
|
143
|
+
}), b = () => {
|
|
150
144
|
Object.keys(a).forEach((e) => {
|
|
151
145
|
o.setFieldValue(e, void 0);
|
|
152
146
|
});
|
|
153
147
|
}, h = (e) => e.reduce((r, c) => {
|
|
154
148
|
const n = c.split(".");
|
|
155
|
-
return n.reduce((t,
|
|
156
|
-
}, {}),
|
|
149
|
+
return n.reduce((t, E, O) => (O === n.length - 1 ? t[E] = o.getFieldValue(c) : t[E] = t[E] ?? {}, t[E]), r), r;
|
|
150
|
+
}, {}), y = (e) => {
|
|
157
151
|
if (e) {
|
|
158
|
-
if (
|
|
152
|
+
if (Array.isArray(e.keys))
|
|
159
153
|
return h(e.keys);
|
|
160
|
-
if (
|
|
154
|
+
if (Array.isArray(e.banKeys)) {
|
|
161
155
|
const r = Object.keys(a).filter((c) => e.banKeys?.includes(c));
|
|
162
156
|
return h(r);
|
|
163
157
|
}
|
|
@@ -165,79 +159,79 @@ const M = (i) => function(s) {
|
|
|
165
159
|
}
|
|
166
160
|
}, u = () => {
|
|
167
161
|
const e = s?.persistency;
|
|
168
|
-
if (!(!e?.policies || e.policies.length === 0) && (
|
|
169
|
-
const r =
|
|
162
|
+
if (!(!e?.policies || e.policies.length === 0) && (S(e.policies, "local") || S(e.policies, "session"))) {
|
|
163
|
+
const r = S(e.policies, "local") ? localStorage : sessionStorage;
|
|
170
164
|
if (!r) return;
|
|
171
|
-
const c =
|
|
165
|
+
const c = y(e);
|
|
172
166
|
return r.setItem(p.value, JSON.stringify(c));
|
|
173
167
|
}
|
|
174
|
-
},
|
|
168
|
+
}, d = () => {
|
|
175
169
|
const e = s?.persistency;
|
|
176
|
-
if (!(!e?.policies || e.policies.length === 0) &&
|
|
177
|
-
const r =
|
|
170
|
+
if (!(!e?.policies || e.policies.length === 0) && S(e.policies, "querystring")) {
|
|
171
|
+
const r = y(e), c = new URLSearchParams(window.location.search);
|
|
178
172
|
c.set(p.value, JSON.stringify(r));
|
|
179
173
|
const n = new URL(window.location.href);
|
|
180
174
|
n.search = c.toString(), window.history.replaceState({}, "", n.toString());
|
|
181
175
|
}
|
|
182
|
-
},
|
|
176
|
+
}, $ = (e) => {
|
|
183
177
|
o.store.state.isDirty && e.preventDefault();
|
|
184
178
|
};
|
|
185
|
-
if (
|
|
186
|
-
window.addEventListener("beforeunload", u), window.addEventListener("blur",
|
|
187
|
-
}),
|
|
188
|
-
window.removeEventListener("beforeunload", u), window.removeEventListener("blur",
|
|
179
|
+
if (I(u), ee(() => {
|
|
180
|
+
window.addEventListener("beforeunload", u), window.addEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", $);
|
|
181
|
+
}), re(() => {
|
|
182
|
+
window.removeEventListener("beforeunload", u), window.removeEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", $);
|
|
189
183
|
}), s?.preventWindowExit === "prevent-and-reset") {
|
|
190
184
|
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), c = o.useStore((t) => t.canSubmit), n = o.useStore((t) => t.values);
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
V([e, r], ([t, E], [O]) => {
|
|
186
|
+
O && !t && E > 0 && c.value && o.reset(n.value);
|
|
193
187
|
});
|
|
194
188
|
}
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
(r) =>
|
|
189
|
+
const j = (e) => K.pipe(
|
|
190
|
+
G,
|
|
191
|
+
k(
|
|
192
|
+
(r) => Z(() => o.handleSubmit(X(r) ? { currentSpan: r.value, ...e } : e))
|
|
199
193
|
)
|
|
200
|
-
),
|
|
194
|
+
), R = (e) => e?.checkErrors ? j(e?.meta).pipe(k(z(function* () {
|
|
201
195
|
const r = o.getAllErrors();
|
|
202
196
|
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
203
|
-
return yield* new
|
|
204
|
-
}))) :
|
|
197
|
+
return yield* new me({ form: r.form, fields: r.fields });
|
|
198
|
+
}))) : j(e?.meta), H = o.handleSubmit, F = te(/* @__PURE__ */ new Map()), w = Object.assign(o, {
|
|
205
199
|
i18nNamespace: s?.i18nNamespace,
|
|
206
200
|
ignorePreventCloseEvents: s?.ignorePreventCloseEvents,
|
|
207
201
|
meta: a,
|
|
208
202
|
unionMeta: g,
|
|
209
|
-
clear:
|
|
203
|
+
clear: b,
|
|
210
204
|
handleSubmit: (e) => {
|
|
211
|
-
const r =
|
|
212
|
-
return
|
|
205
|
+
const r = D.getSpan(P.active());
|
|
206
|
+
return H({ currentSpan: r, ...e });
|
|
213
207
|
},
|
|
214
208
|
// /** @experimental */
|
|
215
|
-
handleSubmitEffect:
|
|
209
|
+
handleSubmitEffect: R,
|
|
216
210
|
registerField: (e) => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}, { immediate: !0 }),
|
|
220
|
-
|
|
211
|
+
V(e, (r) => {
|
|
212
|
+
F.value.set(r.name, { label: r.label, id: r.id });
|
|
213
|
+
}, { immediate: !0 }), I(() => {
|
|
214
|
+
F.value.get(e.value.name)?.id === e.value.id && F.value.delete(e.value.name);
|
|
221
215
|
});
|
|
222
216
|
}
|
|
223
|
-
}),
|
|
224
|
-
return Object.assign(
|
|
217
|
+
}), U = { form: w, fieldMap: F };
|
|
218
|
+
return Object.assign(w, {
|
|
225
219
|
// Type-level properties for performance optimization (not used at runtime)
|
|
226
220
|
_paths: void 0,
|
|
227
221
|
_keys: void 0,
|
|
228
222
|
_schema: i,
|
|
229
|
-
errorContext:
|
|
230
|
-
Form:
|
|
231
|
-
Input:
|
|
232
|
-
TaggedUnion:
|
|
223
|
+
errorContext: U,
|
|
224
|
+
Form: A(w)(de),
|
|
225
|
+
Input: A(w)(s?.input ?? le),
|
|
226
|
+
TaggedUnion: A(w)(ue),
|
|
233
227
|
Field: o.Field,
|
|
234
|
-
Errors:
|
|
235
|
-
Array:
|
|
236
|
-
AutoGen:
|
|
228
|
+
Errors: pe(U)(ie),
|
|
229
|
+
Array: A(w)(ne),
|
|
230
|
+
AutoGen: A(w)(oe)
|
|
237
231
|
});
|
|
238
232
|
};
|
|
239
233
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
me as FormErrors,
|
|
235
|
+
fe as useErrorLabel,
|
|
236
|
+
xe as useOmegaForm
|
|
243
237
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import l from "./vue-components.
|
|
1
|
+
import l from "./vue-components.es35.js";
|
|
2
2
|
import { inject as c, provide as u } from "vue";
|
|
3
3
|
import { onMountedWithCleanup as f } from "./vue-components.es16.js";
|
|
4
4
|
const p = () => l(), i = /* @__PURE__ */ Symbol("DialogBus"), r = () => c(i, null), g = () => {
|