@effect-app/vue-components 4.0.0-beta.3 → 4.0.0-beta.30
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/README.md +24 -0
- package/dist/reset.css +51 -0
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +14 -12
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +2 -4
- package/dist/types/utils/index.d.ts +3 -4
- package/dist/vue-components.es10.js +131 -129
- package/dist/vue-components.es11.js +2 -2
- package/dist/vue-components.es12.js +407 -343
- package/dist/vue-components.es16.js +4 -723
- package/dist/vue-components.es17.js +10 -140
- package/dist/vue-components.es18.js +55 -4
- package/dist/vue-components.es19.js +54 -11
- package/dist/vue-components.es20.js +6 -3
- package/dist/vue-components.es21.js +6 -24
- package/dist/vue-components.es22.js +3 -4
- package/dist/vue-components.es23.js +3 -8
- package/dist/vue-components.es24.js +2 -55
- package/dist/vue-components.es25.js +2 -69
- package/dist/vue-components.es26.js +2 -6
- package/dist/vue-components.es27.js +2 -6
- package/dist/vue-components.es28.js +17 -3
- package/dist/vue-components.es29.js +11 -3
- package/dist/vue-components.es3.js +11 -10
- package/dist/vue-components.es30.js +192 -2
- package/dist/vue-components.es32.js +29 -2
- package/dist/vue-components.es33.js +4 -2
- package/dist/vue-components.es34.js +2 -17
- package/dist/vue-components.es35.js +2 -11
- package/dist/vue-components.es36.js +109 -36
- package/dist/vue-components.es38.js +7 -83
- package/dist/vue-components.es39.js +31 -51
- package/dist/vue-components.es41.js +4 -41
- package/dist/vue-components.es42.js +22 -26
- package/dist/vue-components.es43.js +5 -5
- package/dist/vue-components.es44.js +21 -40
- package/dist/vue-components.es45.js +27 -311
- package/dist/vue-components.es46.js +22 -31
- package/dist/vue-components.es47.js +12 -4
- package/dist/vue-components.es48.js +5 -24
- package/dist/vue-components.es49.js +17 -73
- package/dist/vue-components.es5.js +1 -1
- package/dist/vue-components.es50.js +9 -99
- package/dist/vue-components.es51.js +31 -2
- package/dist/vue-components.es52.js +45 -315
- package/dist/vue-components.es53.js +26 -64
- package/dist/vue-components.es54.js +11 -2
- package/dist/vue-components.es55.js +65 -2
- package/dist/vue-components.es56.js +55 -110
- package/dist/{vue-components.es94.js → vue-components.es57.js} +1 -1
- package/dist/vue-components.es58.js +33 -7
- package/dist/vue-components.es59.js +29 -32
- package/dist/{vue-components.es97.js → vue-components.es60.js} +1 -1
- package/dist/vue-components.es61.js +2 -192
- package/dist/{vue-components.es99.js → vue-components.es62.js} +1 -1
- package/dist/vue-components.es63.js +2 -4
- package/dist/vue-components.es7.js +37 -37
- package/package.json +16 -12
- package/src/components/OmegaForm/OmegaAutoGen.vue +25 -30
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +2 -3
- package/src/components/OmegaForm/OmegaFormStuff.ts +425 -323
- package/src/components/OmegaForm/OmegaInternalInput.vue +9 -5
- package/src/components/OmegaForm/useOmegaForm.ts +30 -32
- package/src/reset.css +51 -0
- package/src/utils/index.ts +4 -8
- package/dist/vue-components.es100.js +0 -4
- package/dist/vue-components.es31.js +0 -4
- package/dist/vue-components.es37.js +0 -6
- package/dist/vue-components.es40.js +0 -563
- package/dist/vue-components.es64.js +0 -103
- package/dist/vue-components.es65.js +0 -84
- package/dist/vue-components.es66.js +0 -17
- package/dist/vue-components.es67.js +0 -34
- package/dist/vue-components.es68.js +0 -4
- package/dist/vue-components.es69.js +0 -23
- package/dist/vue-components.es70.js +0 -14
- package/dist/vue-components.es71.js +0 -115
- package/dist/vue-components.es72.js +0 -5
- package/dist/vue-components.es73.js +0 -4
- package/dist/vue-components.es74.js +0 -4
- package/dist/vue-components.es75.js +0 -17
- package/dist/vue-components.es76.js +0 -72
- package/dist/vue-components.es77.js +0 -25
- package/dist/vue-components.es78.js +0 -7
- package/dist/vue-components.es79.js +0 -23
- package/dist/vue-components.es80.js +0 -32
- package/dist/vue-components.es81.js +0 -24
- package/dist/vue-components.es82.js +0 -14
- package/dist/vue-components.es83.js +0 -7
- package/dist/vue-components.es84.js +0 -21
- package/dist/vue-components.es85.js +0 -11
- package/dist/vue-components.es86.js +0 -33
- package/dist/vue-components.es87.js +0 -50
- package/dist/vue-components.es88.js +0 -28
- package/dist/vue-components.es89.js +0 -18
- package/dist/vue-components.es90.js +0 -10
- package/dist/vue-components.es91.js +0 -13
- package/dist/vue-components.es92.js +0 -67
- package/dist/vue-components.es93.js +0 -58
- package/dist/vue-components.es95.js +0 -35
- package/dist/vue-components.es96.js +0 -31
- package/dist/vue-components.es98.js +0 -4
package/README.md
CHANGED
|
@@ -183,6 +183,30 @@ In [tsconfig.json](tsconfig.js), set the following to address [Issue #32](https:
|
|
|
183
183
|
}
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
## v4 Breaking Changes (from v3)
|
|
187
|
+
|
|
188
|
+
### 1. Vuetify 4 CSS Reset Removed
|
|
189
|
+
|
|
190
|
+
Vuetify 4 removed the aggressive global CSS reset that v3 included (universal `margin: 0; padding: 0`, list/heading/input resets, etc.). If your app relied on these defaults, opt in to the supplemental reset:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import '@effect-app/vue-components/reset.css'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 2. Nested union `_tag` handling
|
|
197
|
+
|
|
198
|
+
`S.TaggedStruct` produces a bare `Literal` AST node, while legacy `S.Struct({ _tag: S.Literal("X") })` produces `Union([Literal("X")])` after `AST.toType`. Both patterns now correctly produce `"select"` metadata thanks to the `unwrapSingleLiteralUnion` helper. A `console.warn` is emitted for the legacy pattern to encourage migration to `TaggedStruct`.
|
|
199
|
+
|
|
200
|
+
### 3. `UndefinedOr` defaults include the key with explicit `undefined`
|
|
201
|
+
|
|
202
|
+
- **v3**: `defaultsValueFromSchema` skipped keys where the recursive call returned `undefined`, so `UndefinedOr` fields were omitted from the result object entirely.
|
|
203
|
+
- **v4**: The key is present in the result with an explicit `undefined` value.
|
|
204
|
+
|
|
205
|
+
### 4. `S.optionalKey(X).pipe(S.withDecodingDefault(...))` support
|
|
206
|
+
|
|
207
|
+
- **v3**: Not supported. The v3 equivalent `S.optionalWith` encoded defaults inside a `PropertySignatureTransformation`, opaque to AST inspection.
|
|
208
|
+
- **v4**: `defaultsValueFromSchema` detects `PropertySignatureTransformation` and extracts defaults, enabling `withDecodingDefault` as a new pattern for declaring field defaults directly on the schema.
|
|
209
|
+
|
|
186
210
|
### On Submit event
|
|
187
211
|
The :on-submit event could be tricky in `<OmegaForm />` component.
|
|
188
212
|
This is a prop that is basically a map of Tanstack Form `onSubmit` option and accept a function that return a Promise. If you want to use it as an event, you have to manage the state of loading yourself with `@submit` with a function returning `void`
|
package/dist/reset.css
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Supplemental CSS reset for Vuetify 4.
|
|
3
|
+
* Vuetify 4 removed the aggressive global reset that v3 included.
|
|
4
|
+
* Import this file to restore equivalent behavior:
|
|
5
|
+
* import '@effect-app/vue-components/reset.css'
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ul,
|
|
13
|
+
ol {
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
list-style: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h1,
|
|
20
|
+
h2,
|
|
21
|
+
h3,
|
|
22
|
+
h4,
|
|
23
|
+
h5,
|
|
24
|
+
h6 {
|
|
25
|
+
margin: 0;
|
|
26
|
+
font-size: inherit;
|
|
27
|
+
font-weight: inherit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
p {
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
input,
|
|
35
|
+
textarea,
|
|
36
|
+
select {
|
|
37
|
+
border: 0;
|
|
38
|
+
background: transparent;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
a {
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
color: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
figure,
|
|
47
|
+
details,
|
|
48
|
+
summary {
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DeepKeys } from "@tanstack/vue-form";
|
|
2
|
-
import
|
|
2
|
+
import { Order } from "effect-app";
|
|
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,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as AST from "effect/SchemaAST";
|
|
1
|
+
import { Effect, S } from "effect-app";
|
|
3
2
|
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";
|
|
4
|
-
import
|
|
3
|
+
import type { Fiber as EffectFiber } from "effect/Fiber";
|
|
5
4
|
import { useIntl } from "../../utils";
|
|
6
5
|
import { type OmegaFieldInternalApi } from "./InputProps";
|
|
7
6
|
import { type OF, type OmegaFormReturn } from "./useOmegaForm";
|
|
@@ -68,7 +67,7 @@ export type FormProps<From, To> = Omit<FormOptions<From, FormValidateOrFn<From>
|
|
|
68
67
|
formApi: OmegaFormParams<From, To>;
|
|
69
68
|
meta: any;
|
|
70
69
|
value: To;
|
|
71
|
-
}) => Promise<any> | Effect.Effect<unknown, any, never>;
|
|
70
|
+
}) => Promise<any> | EffectFiber<any, any> | Effect.Effect<unknown, any, never>;
|
|
72
71
|
};
|
|
73
72
|
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>;
|
|
74
73
|
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>;
|
|
@@ -110,15 +109,18 @@ export type SelectFieldMeta = BaseFieldMeta & {
|
|
|
110
109
|
export type MultipleFieldMeta = BaseFieldMeta & {
|
|
111
110
|
type: "multiple";
|
|
112
111
|
members: any[];
|
|
113
|
-
rest: readonly AST.AST[];
|
|
112
|
+
rest: readonly S.AST.AST[];
|
|
114
113
|
};
|
|
115
114
|
export type BooleanFieldMeta = BaseFieldMeta & {
|
|
116
115
|
type: "boolean";
|
|
117
116
|
};
|
|
117
|
+
export type DateFieldMeta = BaseFieldMeta & {
|
|
118
|
+
type: "date";
|
|
119
|
+
};
|
|
118
120
|
export type UnknownFieldMeta = BaseFieldMeta & {
|
|
119
121
|
type: "unknown";
|
|
120
122
|
};
|
|
121
|
-
export type FieldMeta = StringFieldMeta | NumberFieldMeta | SelectFieldMeta | MultipleFieldMeta | BooleanFieldMeta | UnknownFieldMeta;
|
|
123
|
+
export type FieldMeta = StringFieldMeta | NumberFieldMeta | SelectFieldMeta | MultipleFieldMeta | BooleanFieldMeta | DateFieldMeta | UnknownFieldMeta;
|
|
122
124
|
export type MetaRecord<T = string> = {
|
|
123
125
|
[K in NestedKeyOf<T>]?: FieldMeta;
|
|
124
126
|
};
|
|
@@ -133,17 +135,17 @@ export type CreateMeta = {
|
|
|
133
135
|
meta?: Record<string, any>;
|
|
134
136
|
nullableOrUndefined?: false | "undefined" | "null";
|
|
135
137
|
} & ({
|
|
136
|
-
propertySignatures: readonly AST.PropertySignature[];
|
|
138
|
+
propertySignatures: readonly S.AST.PropertySignature[];
|
|
137
139
|
property?: never;
|
|
138
140
|
} | {
|
|
139
141
|
propertySignatures?: never;
|
|
140
|
-
property: AST.AST;
|
|
142
|
+
property: S.AST.AST;
|
|
141
143
|
});
|
|
142
|
-
export declare const isNullableOrUndefined: (property: false | AST.AST | undefined) => false | "undefined" | "null";
|
|
144
|
+
export declare const isNullableOrUndefined: (property: false | S.AST.AST | undefined) => false | "undefined" | "null";
|
|
143
145
|
export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
|
|
144
146
|
export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never, never>;
|
|
145
|
-
export declare const generateMetaFromSchema: <
|
|
146
|
-
schema:
|
|
147
|
+
export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From, never>) => {
|
|
148
|
+
schema: S.Codec<To, From, never>;
|
|
147
149
|
meta: MetaRecord<To>;
|
|
148
150
|
unionMeta: Record<string, MetaRecord<To>>;
|
|
149
151
|
};
|
|
@@ -153,5 +155,5 @@ declare const supportedInputs: readonly ["button", "checkbox", "color", "date",
|
|
|
153
155
|
export type SupportedInputs = typeof supportedInputs[number];
|
|
154
156
|
export declare const getInputType: (input: string) => SupportedInputs;
|
|
155
157
|
export declare function deepMerge(target: any, source: any): any;
|
|
156
|
-
export declare const defaultsValueFromSchema: (schema: S.
|
|
158
|
+
export declare const defaultsValueFromSchema: (schema: S.Schema<any>, record?: Record<string, any>) => any;
|
|
157
159
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type DeepKeys, DeepValue, StandardSchemaV1Issue, ValidationError, ValidationErrorMap } from "@tanstack/vue-form";
|
|
2
|
+
import { Effect, Order, S } from "effect-app";
|
|
2
3
|
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";
|
|
6
4
|
import { ComputedRef, type InjectionKey } from "vue";
|
|
7
5
|
import { MergedInputProps } from "./InputProps";
|
|
8
6
|
import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff";
|
|
@@ -13,7 +11,7 @@ type keysRule<T> = {
|
|
|
13
11
|
keys?: "You should only use one of banKeys or keys, not both, moron";
|
|
14
12
|
banKeys?: NestedKeyOf<T>[];
|
|
15
13
|
};
|
|
16
|
-
declare const FormErrors_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").
|
|
14
|
+
declare const FormErrors_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
17
15
|
readonly _tag: "FormErrors";
|
|
18
16
|
} & Readonly<A>;
|
|
19
17
|
export declare class FormErrors<From> extends FormErrors_base<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type makeIntl } from "@effect-app/vue";
|
|
2
|
-
import {
|
|
2
|
+
import { S } from "effect-app";
|
|
3
3
|
import { type InjectionKey } from "vue";
|
|
4
4
|
export declare const useIntlKey: InjectionKey<ReturnType<typeof makeIntl>["useIntl"]>;
|
|
5
5
|
export declare const useIntl: () => {
|
|
@@ -11,10 +11,9 @@ 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
|
-
*
|
|
15
|
-
* This function returns the encoded form if an encoding chain exists, otherwise returns the AST itself.
|
|
14
|
+
* If the provided AST is a transformation, it follows the chain to find the original source AST.
|
|
16
15
|
*
|
|
17
16
|
* @param ast - The AST node to extract the transformation source from
|
|
18
|
-
* @returns The source AST
|
|
17
|
+
* @returns The source AST at the end of the transformation chain
|
|
19
18
|
*/
|
|
20
19
|
export declare function getTransformationFrom(ast: S.AST.AST): S.AST.AST;
|
|
@@ -1,60 +1,56 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
import de from "./vue-components.es27.js";
|
|
17
|
-
import { trace as D } from "./vue-components.es28.js";
|
|
18
|
-
import { context as P } from "./vue-components.es29.js";
|
|
19
|
-
class me extends B("FormErrors") {
|
|
1
|
+
import { useForm as K } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as T, S as I, Effect as m, Fiber as V, Option as z, Array as P } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as W } from "./vue-components.es17.js";
|
|
4
|
+
import { computed as $, onUnmounted as D, onMounted as G, onBeforeUnmount as Z, watch as R, ref as Q, h as J } from "vue";
|
|
5
|
+
import { useIntl as X } from "./vue-components.es3.js";
|
|
6
|
+
import Y from "./vue-components.es18.js";
|
|
7
|
+
import C from "./vue-components.es19.js";
|
|
8
|
+
import ee from "./vue-components.es20.js";
|
|
9
|
+
import { generateMetaFromSchema as re, deepMerge as N, defaultsValueFromSchema as te } from "./vue-components.es12.js";
|
|
10
|
+
import se from "./vue-components.es6.js";
|
|
11
|
+
import ne from "./vue-components.es8.js";
|
|
12
|
+
import oe from "./vue-components.es21.js";
|
|
13
|
+
import { trace as H } from "./vue-components.es22.js";
|
|
14
|
+
import { context as _ } from "./vue-components.es23.js";
|
|
15
|
+
class ie extends T.TaggedError("FormErrors") {
|
|
20
16
|
}
|
|
21
|
-
const
|
|
17
|
+
const M = (a) => function(s) {
|
|
22
18
|
return {
|
|
23
19
|
render() {
|
|
24
|
-
return
|
|
25
|
-
form:
|
|
20
|
+
return J(s, {
|
|
21
|
+
form: a,
|
|
26
22
|
...this.$attrs
|
|
27
23
|
}, this.$slots);
|
|
28
24
|
}
|
|
29
25
|
};
|
|
30
|
-
},
|
|
31
|
-
const { formatMessage: l } =
|
|
32
|
-
return (
|
|
33
|
-
},
|
|
26
|
+
}, ae = (a) => {
|
|
27
|
+
const { formatMessage: l } = X(), s = (c) => c.replace(/([A-Z])/g, " $1").replace(/^./, (F) => F.toUpperCase()).trim(), p = (c) => l ? l({ id: `general.fields.${c}`, defaultMessage: s(c) }) : s(c);
|
|
28
|
+
return (c) => a.i18nNamespace ? l({ id: `${a.i18nNamespace}.fields.${c}`, defaultMessage: p(c) }) : p(c);
|
|
29
|
+
}, ce = (a) => function(s) {
|
|
34
30
|
return {
|
|
35
31
|
setup() {
|
|
36
|
-
const { fieldMap:
|
|
37
|
-
const
|
|
38
|
-
const u =
|
|
32
|
+
const { fieldMap: p, form: v } = a, c = v.useStore((S) => S.errors), F = v.useStore((S) => S.fieldMeta), h = v.useStore((S) => S.errorMap), A = ae(v), L = $(() => {
|
|
33
|
+
const S = Object.entries(F.value).reduce((y, [w, g]) => {
|
|
34
|
+
const u = g?.errors ?? [];
|
|
39
35
|
if (!u.length)
|
|
40
|
-
return
|
|
41
|
-
const d =
|
|
42
|
-
return d &&
|
|
36
|
+
return y;
|
|
37
|
+
const d = p.value.get(w);
|
|
38
|
+
return d && y.push({
|
|
43
39
|
label: d.label,
|
|
44
40
|
inputId: d.id,
|
|
45
41
|
errors: [u[0]?.message].filter(Boolean)
|
|
46
|
-
}),
|
|
42
|
+
}), y;
|
|
47
43
|
}, []), o = [];
|
|
48
|
-
if (
|
|
49
|
-
for (const [
|
|
50
|
-
if (
|
|
51
|
-
for (const
|
|
52
|
-
const u =
|
|
53
|
-
if (u?.path &&
|
|
44
|
+
if (h.value.onSubmit) {
|
|
45
|
+
for (const [y, w] of Object.entries(h.value.onSubmit))
|
|
46
|
+
if (P.isArray(w) && w.length)
|
|
47
|
+
for (const g of w) {
|
|
48
|
+
const u = g;
|
|
49
|
+
if (u?.path && P.isArray(u.path) && u.path.length) {
|
|
54
50
|
const d = u.path.join(".");
|
|
55
|
-
if (!
|
|
51
|
+
if (!p.value.has(d)) {
|
|
56
52
|
o.push({
|
|
57
|
-
label:
|
|
53
|
+
label: A(d),
|
|
58
54
|
inputId: d,
|
|
59
55
|
errors: [u.message].filter(Boolean)
|
|
60
56
|
});
|
|
@@ -63,175 +59,181 @@ const A = (i) => function(s) {
|
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
|
-
return [...
|
|
62
|
+
return [...S, ...o];
|
|
67
63
|
});
|
|
68
64
|
return {
|
|
69
|
-
generalErrors:
|
|
65
|
+
generalErrors: c,
|
|
70
66
|
errors: L
|
|
71
67
|
};
|
|
72
68
|
},
|
|
73
|
-
render({ errors:
|
|
74
|
-
return
|
|
75
|
-
errors:
|
|
76
|
-
generalErrors:
|
|
69
|
+
render({ errors: p, generalErrors: v }) {
|
|
70
|
+
return J(s, {
|
|
71
|
+
errors: p,
|
|
72
|
+
generalErrors: v,
|
|
77
73
|
...this.$attrs
|
|
78
74
|
}, this.$slots);
|
|
79
75
|
}
|
|
80
76
|
};
|
|
81
|
-
},
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
77
|
+
}, b = (a, l) => a.includes(l), Fe = (a, l, s) => {
|
|
78
|
+
if (!a) throw new Error("Schema is required");
|
|
79
|
+
const p = I.toStandardSchemaV1(a), v = I.decodeUnknownEffect(a), { meta: c, unionMeta: F } = re(a), h = $(() => {
|
|
84
80
|
if (s?.persistency?.id)
|
|
85
81
|
return s.persistency.id;
|
|
86
|
-
const e = window.location.pathname, r = Object.keys(
|
|
82
|
+
const e = window.location.pathname, r = Object.keys(c);
|
|
87
83
|
return `${e}-${r.join("-")}`;
|
|
88
|
-
}),
|
|
84
|
+
}), A = () => {
|
|
89
85
|
const e = new URLSearchParams(window.location.search);
|
|
90
|
-
e.delete(
|
|
86
|
+
e.delete(h.value);
|
|
91
87
|
const r = new URL(window.location.href);
|
|
92
88
|
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
93
|
-
}, L =
|
|
89
|
+
}, L = $(() => {
|
|
94
90
|
let e;
|
|
95
91
|
const r = s?.persistency;
|
|
96
92
|
if (
|
|
97
93
|
// query string has higher priority than local/session storage
|
|
98
|
-
r?.policies && !e && (
|
|
94
|
+
r?.policies && !e && (b(r.policies, "local") || b(r.policies, "session"))
|
|
99
95
|
) {
|
|
100
|
-
const n =
|
|
96
|
+
const n = b(r.policies, "local") ? localStorage : sessionStorage;
|
|
101
97
|
if (n)
|
|
102
98
|
try {
|
|
103
99
|
const t = JSON.parse(
|
|
104
|
-
n.getItem(
|
|
100
|
+
n.getItem(h.value) || "{}"
|
|
105
101
|
);
|
|
106
|
-
n.removeItem(
|
|
102
|
+
n.removeItem(h.value), e = t;
|
|
107
103
|
} catch (t) {
|
|
108
104
|
console.error(t);
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
|
-
if (r?.policies &&
|
|
107
|
+
if (r?.policies && b(r.policies, "querystring"))
|
|
112
108
|
try {
|
|
113
|
-
const t = new URLSearchParams(window.location.search).get(
|
|
114
|
-
|
|
109
|
+
const t = new URLSearchParams(window.location.search).get(h.value);
|
|
110
|
+
A(), t && (e = N(e || {}, JSON.parse(t)));
|
|
115
111
|
} catch (n) {
|
|
116
112
|
console.error(n);
|
|
117
113
|
}
|
|
118
114
|
e ??= {};
|
|
119
|
-
const
|
|
115
|
+
const i = {
|
|
120
116
|
tanstack: l?.defaultValues || {},
|
|
121
117
|
persistency: e,
|
|
122
|
-
schema:
|
|
118
|
+
schema: te(a)
|
|
123
119
|
};
|
|
124
120
|
return (s?.defaultValuesPriority || ["tanstack", "persistency", "schema"]).reverse().reduce(
|
|
125
|
-
(n, t) => Object.keys(n).length ?
|
|
121
|
+
(n, t) => Object.keys(n).length ? N(n, i[t]) : i[t],
|
|
126
122
|
{}
|
|
127
123
|
);
|
|
128
|
-
}),
|
|
124
|
+
}), S = (e, r) => e ? _.with(H.setSpan(_.active(), e), r) : r(), o = K({
|
|
129
125
|
...l,
|
|
130
126
|
validators: {
|
|
131
|
-
onSubmit:
|
|
127
|
+
onSubmit: p,
|
|
132
128
|
...l?.validators || {}
|
|
133
129
|
},
|
|
134
|
-
onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value:
|
|
135
|
-
const n = await
|
|
130
|
+
onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value: i }) => S(r?.currentSpan, async () => {
|
|
131
|
+
const n = await m.runPromise(v(i)), t = l.onSubmit({
|
|
136
132
|
formApi: e,
|
|
137
133
|
meta: r,
|
|
138
134
|
value: n
|
|
139
135
|
});
|
|
140
|
-
|
|
136
|
+
if (V.isFiber(t))
|
|
137
|
+
return await W(t);
|
|
138
|
+
if (m.isEffect(t)) {
|
|
139
|
+
const f = await m.runPromise(t);
|
|
140
|
+
return V.isFiber(f) ? await W(f) : f;
|
|
141
|
+
}
|
|
142
|
+
return t;
|
|
141
143
|
}) : void 0,
|
|
142
144
|
defaultValues: L.value
|
|
143
|
-
}),
|
|
144
|
-
Object.keys(
|
|
145
|
+
}), y = () => {
|
|
146
|
+
Object.keys(c).forEach((e) => {
|
|
145
147
|
o.setFieldValue(e, void 0);
|
|
146
148
|
});
|
|
147
|
-
},
|
|
148
|
-
const n =
|
|
149
|
-
return n.reduce((t,
|
|
150
|
-
}, {}),
|
|
151
|
-
if (e)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return o.store.state.values;
|
|
149
|
+
}, w = (e) => e.reduce((r, i) => {
|
|
150
|
+
const n = i.split(".");
|
|
151
|
+
return n.reduce((t, f, U) => (U === n.length - 1 ? t[f] = o.getFieldValue(i) : t[f] = t[f] ?? {}, t[f]), r), r;
|
|
152
|
+
}, {}), g = (e) => {
|
|
153
|
+
if (!e) return;
|
|
154
|
+
const { banKeys: r, keys: i } = e;
|
|
155
|
+
if (P.isArray(i))
|
|
156
|
+
return w(i);
|
|
157
|
+
if (P.isArray(r)) {
|
|
158
|
+
const n = Object.keys(c).filter((t) => r.includes(t));
|
|
159
|
+
return w(n);
|
|
159
160
|
}
|
|
161
|
+
return o.store.state.values;
|
|
160
162
|
}, u = () => {
|
|
161
163
|
const e = s?.persistency;
|
|
162
|
-
if (!(!e?.policies || e.policies.length === 0) && (
|
|
163
|
-
const r =
|
|
164
|
+
if (!(!e?.policies || e.policies.length === 0) && (b(e.policies, "local") || b(e.policies, "session"))) {
|
|
165
|
+
const r = b(e.policies, "local") ? localStorage : sessionStorage;
|
|
164
166
|
if (!r) return;
|
|
165
|
-
const
|
|
166
|
-
return r.setItem(
|
|
167
|
+
const i = g(e);
|
|
168
|
+
return r.setItem(h.value, JSON.stringify(i));
|
|
167
169
|
}
|
|
168
170
|
}, d = () => {
|
|
169
171
|
const e = s?.persistency;
|
|
170
|
-
if (!(!e?.policies || e.policies.length === 0) &&
|
|
171
|
-
const r =
|
|
172
|
-
|
|
172
|
+
if (!(!e?.policies || e.policies.length === 0) && b(e.policies, "querystring")) {
|
|
173
|
+
const r = g(e), i = new URLSearchParams(window.location.search);
|
|
174
|
+
i.set(h.value, JSON.stringify(r));
|
|
173
175
|
const n = new URL(window.location.href);
|
|
174
|
-
n.search =
|
|
176
|
+
n.search = i.toString(), window.history.replaceState({}, "", n.toString());
|
|
175
177
|
}
|
|
176
|
-
},
|
|
178
|
+
}, j = (e) => {
|
|
177
179
|
o.store.state.isDirty && e.preventDefault();
|
|
178
180
|
};
|
|
179
|
-
if (
|
|
180
|
-
window.addEventListener("beforeunload", u), window.addEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload",
|
|
181
|
-
}),
|
|
182
|
-
window.removeEventListener("beforeunload", u), window.removeEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload",
|
|
181
|
+
if (D(u), G(() => {
|
|
182
|
+
window.addEventListener("beforeunload", u), window.addEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", j);
|
|
183
|
+
}), Z(() => {
|
|
184
|
+
window.removeEventListener("beforeunload", u), window.removeEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", j);
|
|
183
185
|
}), s?.preventWindowExit === "prevent-and-reset") {
|
|
184
|
-
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts),
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), i = o.useStore((t) => t.canSubmit), n = o.useStore((t) => t.values);
|
|
187
|
+
R([e, r], ([t, f], [U]) => {
|
|
188
|
+
U && !t && f > 0 && i.value && o.reset(n.value);
|
|
187
189
|
});
|
|
188
190
|
}
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
(r) =>
|
|
191
|
+
const x = (e) => m.currentSpan.pipe(
|
|
192
|
+
m.option,
|
|
193
|
+
m.flatMap(
|
|
194
|
+
(r) => m.promise(() => o.handleSubmit(z.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
193
195
|
)
|
|
194
|
-
),
|
|
196
|
+
), q = (e) => e?.checkErrors ? x(e?.meta).pipe(m.flatMap(m.fnUntraced(function* () {
|
|
195
197
|
const r = o.getAllErrors();
|
|
196
198
|
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
197
|
-
return yield* new
|
|
198
|
-
}))) :
|
|
199
|
+
return yield* m.fail(new ie({ form: r.form, fields: r.fields }));
|
|
200
|
+
}))) : x(e?.meta), B = o.handleSubmit, O = Q(/* @__PURE__ */ new Map()), E = Object.assign(o, {
|
|
199
201
|
i18nNamespace: s?.i18nNamespace,
|
|
200
202
|
ignorePreventCloseEvents: s?.ignorePreventCloseEvents,
|
|
201
|
-
meta:
|
|
202
|
-
unionMeta:
|
|
203
|
-
clear:
|
|
203
|
+
meta: c,
|
|
204
|
+
unionMeta: F,
|
|
205
|
+
clear: y,
|
|
204
206
|
handleSubmit: (e) => {
|
|
205
|
-
const r =
|
|
206
|
-
return
|
|
207
|
+
const r = H.getSpan(_.active());
|
|
208
|
+
return B({ currentSpan: r, ...e });
|
|
207
209
|
},
|
|
208
210
|
// /** @experimental */
|
|
209
|
-
handleSubmitEffect:
|
|
211
|
+
handleSubmitEffect: q,
|
|
210
212
|
registerField: (e) => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, { immediate: !0 }),
|
|
214
|
-
|
|
213
|
+
R(e, (r) => {
|
|
214
|
+
O.value.set(r.name, { label: r.label, id: r.id });
|
|
215
|
+
}, { immediate: !0 }), D(() => {
|
|
216
|
+
O.value.get(e.value.name)?.id === e.value.id && O.value.delete(e.value.name);
|
|
215
217
|
});
|
|
216
218
|
}
|
|
217
|
-
}),
|
|
218
|
-
return Object.assign(
|
|
219
|
+
}), k = { form: E, fieldMap: O };
|
|
220
|
+
return Object.assign(E, {
|
|
219
221
|
// Type-level properties for performance optimization (not used at runtime)
|
|
220
222
|
_paths: void 0,
|
|
221
223
|
_keys: void 0,
|
|
222
|
-
_schema:
|
|
223
|
-
errorContext:
|
|
224
|
-
Form:
|
|
225
|
-
Input:
|
|
226
|
-
TaggedUnion:
|
|
224
|
+
_schema: a,
|
|
225
|
+
errorContext: k,
|
|
226
|
+
Form: M(E)(oe),
|
|
227
|
+
Input: M(E)(s?.input ?? se),
|
|
228
|
+
TaggedUnion: M(E)(ne),
|
|
227
229
|
Field: o.Field,
|
|
228
|
-
Errors:
|
|
229
|
-
Array:
|
|
230
|
-
AutoGen:
|
|
230
|
+
Errors: ce(k)(ee),
|
|
231
|
+
Array: M(E)(Y),
|
|
232
|
+
AutoGen: M(E)(C)
|
|
231
233
|
});
|
|
232
234
|
};
|
|
233
235
|
export {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
ie as FormErrors,
|
|
237
|
+
ae as useErrorLabel,
|
|
238
|
+
Fe as useOmegaForm
|
|
237
239
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import l from "./vue-components.
|
|
1
|
+
import l from "./vue-components.es28.js";
|
|
2
2
|
import { inject as c, provide as u } from "vue";
|
|
3
|
-
import { onMountedWithCleanup as f } from "./vue-components.
|
|
3
|
+
import { onMountedWithCleanup as f } from "./vue-components.es29.js";
|
|
4
4
|
const p = () => l(), i = /* @__PURE__ */ Symbol("DialogBus"), r = () => c(i, null), g = () => {
|
|
5
5
|
const n = p();
|
|
6
6
|
return u(i, n), n;
|