@effect-app/vue-components 0.12.18 → 0.12.20
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 +5 -47
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +5 -5
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +8 -9
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +4 -3
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +14 -13
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -3
- package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +6 -6
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +3 -3
- package/dist/types/components/OmegaForm/index.d.ts +2 -1
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +2 -2
- package/dist/vue-components.es.js +15 -13
- package/dist/vue-components.es10.js +246 -6
- package/dist/vue-components.es11.js +5 -5
- package/dist/vue-components.es12.js +6 -111
- package/dist/vue-components.es13.js +113 -0
- package/dist/vue-components.es15.js +7 -2
- package/dist/vue-components.es16.js +2 -89
- package/dist/vue-components.es17.js +4 -0
- package/dist/vue-components.es18.js +89 -2
- package/dist/vue-components.es2.js +17 -15
- package/dist/vue-components.es20.js +2 -5
- package/dist/vue-components.es21.js +2 -32
- package/dist/vue-components.es22.js +5 -11
- package/dist/vue-components.es23.js +2 -90
- package/dist/vue-components.es24.js +90 -2
- package/dist/vue-components.es25.js +11 -2
- package/dist/vue-components.es26.js +1 -1
- package/dist/vue-components.es4.js +2 -2
- package/dist/vue-components.es5.js +28 -66
- package/dist/vue-components.es6.js +65 -55
- package/dist/vue-components.es7.js +60 -29
- package/dist/vue-components.es8.js +28 -124
- package/dist/vue-components.es9.js +118 -241
- package/package.json +6 -10
- package/src/components/OmegaForm/InputProps.ts +37 -64
- package/src/components/OmegaForm/OmegaArray.vue +5 -3
- package/src/components/OmegaForm/OmegaAutoGen.vue +10 -10
- package/src/components/OmegaForm/OmegaFormInput.vue +6 -8
- package/src/components/OmegaForm/OmegaFormStuff.ts +76 -77
- package/src/components/OmegaForm/OmegaInput.vue +1 -2
- package/src/components/OmegaForm/OmegaInputVuetify.vue +3 -3
- package/src/components/OmegaForm/OmegaInternalInput.vue +5 -5
- package/src/components/OmegaForm/OmegaWrapper.vue +2 -2
- package/src/components/OmegaForm/index.ts +2 -1
- package/src/components/OmegaForm/useOmegaForm.ts +20 -22
- package/dist/vue-components.es14.js +0 -9
- package/dist/vue-components.es19.js +0 -4
|
@@ -1,47 +1,6 @@
|
|
|
1
|
-
import type { FieldApi,
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
value: any;
|
|
5
|
-
fieldApi: any;
|
|
6
|
-
}) => ValidationError | undefined;
|
|
7
|
-
type ValidatorFnAsync = (opts: {
|
|
8
|
-
value: any;
|
|
9
|
-
fieldApi: any;
|
|
10
|
-
}) => Promise<ValidationError | undefined>;
|
|
11
|
-
type FormValidatorFnSync = (opts: {
|
|
12
|
-
value: any;
|
|
13
|
-
formApi: any;
|
|
14
|
-
}) => ValidationError | undefined;
|
|
15
|
-
type FormValidatorFnAsync = (opts: {
|
|
16
|
-
value: any;
|
|
17
|
-
formApi: any;
|
|
18
|
-
}) => Promise<ValidationError | undefined>;
|
|
19
|
-
type FormServerError = any;
|
|
20
|
-
type SubmitMeta = any;
|
|
21
|
-
type FlexibleUpdater<T> = ((prev: T) => T) | T;
|
|
22
|
-
export type OmegaFieldInternalApi<To> = Omit<FieldApi<To, // TParentData
|
|
23
|
-
NestedKeyOf<To>, // TName
|
|
24
|
-
DeepValue<To, NestedKeyOf<To>>, // TData
|
|
25
|
-
ValidatorFnSync, // TOnMount
|
|
26
|
-
ValidatorFnSync, // TOnChange
|
|
27
|
-
ValidatorFnAsync, // TOnChangeAsync
|
|
28
|
-
ValidatorFnSync, // TOnBlur
|
|
29
|
-
ValidatorFnAsync, // TOnBlurAsync
|
|
30
|
-
ValidatorFnSync, // TOnSubmit
|
|
31
|
-
ValidatorFnAsync, // TOnSubmitAsync
|
|
32
|
-
FormValidatorFnSync, // TFormOnMount
|
|
33
|
-
FormValidatorFnSync, // TFormOnChange
|
|
34
|
-
FormValidatorFnAsync, // TFormOnChangeAsync
|
|
35
|
-
FormValidatorFnSync, // TFormOnBlur
|
|
36
|
-
FormValidatorFnAsync, // TFormOnBlurAsync
|
|
37
|
-
FormValidatorFnSync, // TFormOnSubmit
|
|
38
|
-
FormValidatorFnAsync, // TFormOnSubmitAsync
|
|
39
|
-
FormServerError, // TFormOnServer
|
|
40
|
-
SubmitMeta>, "handleChange" | "setValue"> & {
|
|
41
|
-
handleChange: (updater: FlexibleUpdater<DeepValue<To, NestedKeyOf<To>>> | any) => void;
|
|
42
|
-
setValue: (updater: FlexibleUpdater<DeepValue<To, NestedKeyOf<To>>> | any) => void;
|
|
43
|
-
};
|
|
44
|
-
export type InputProps<T> = {
|
|
1
|
+
import type { DeepValue, DeepKeys, FieldApi, FormAsyncValidateOrFn, FormValidateOrFn, StandardSchemaV1, FieldValidateOrFn, FieldValidateFn, FieldValidateAsyncFn, FieldAsyncValidateOrFn } from "@tanstack/vue-form";
|
|
2
|
+
export type OmegaFieldInternalApi<From, To> = FieldApi<From, DeepKeys<From>, DeepValue<From, any>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, StandardSchemaV1<unknown, To> | FieldValidateFn<From, any, To>, StandardSchemaV1<unknown, To> | FieldValidateAsyncFn<From, any, To>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>, FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, any, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
|
|
3
|
+
export type InputProps<T, S = unknown> = {
|
|
45
4
|
id: string;
|
|
46
5
|
required?: boolean;
|
|
47
6
|
minLength?: number | false;
|
|
@@ -49,10 +8,10 @@ export type InputProps<T> = {
|
|
|
49
8
|
max?: number | false;
|
|
50
9
|
min?: number | false;
|
|
51
10
|
name: string;
|
|
52
|
-
modelValue:
|
|
11
|
+
modelValue: S;
|
|
53
12
|
errorMessages: string[];
|
|
54
13
|
error: boolean;
|
|
55
|
-
field: OmegaFieldInternalApi<T>;
|
|
14
|
+
field: OmegaFieldInternalApi<T, S>;
|
|
56
15
|
setRealDirty: () => void;
|
|
57
16
|
type: string;
|
|
58
17
|
label: string;
|
|
@@ -61,4 +20,3 @@ export type InputProps<T> = {
|
|
|
61
20
|
value: string;
|
|
62
21
|
}[];
|
|
63
22
|
};
|
|
64
|
-
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
2
|
import { type DeepValue, type DeepKeys } from "@tanstack/vue-form";
|
|
3
3
|
declare const _default: <From, To>(__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<{
|
|
4
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "type" | "
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "type" | "label" | "items" | "options" | "validators"> & {
|
|
5
5
|
items?: DeepValue<To, DeepKeys<To>>;
|
|
6
6
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
7
7
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
8
8
|
attrs: any;
|
|
9
9
|
slots: {
|
|
10
10
|
default?: (props: {
|
|
11
|
-
field:
|
|
12
|
-
subField:
|
|
13
|
-
subState:
|
|
11
|
+
field: import("@tanstack/vue-form").FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
12
|
+
subField: import("@tanstack/vue-form").FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
13
|
+
subState: import("@tanstack/vue-form").FieldState<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
14
14
|
index: number;
|
|
15
15
|
}) => any;
|
|
16
16
|
} & {
|
|
17
17
|
field?: (props: {
|
|
18
|
-
field:
|
|
18
|
+
field: import("@tanstack/vue-form").FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
19
19
|
}) => any;
|
|
20
20
|
};
|
|
21
21
|
emit: {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
2
|
import { Order } from "effect-app";
|
|
3
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
3
4
|
export type OmegaAutoGenMeta<From, To> = Omit<OmegaInputProps<From, To>, "form">;
|
|
4
5
|
declare const _default: <From, To>(__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<{
|
|
5
6
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
6
|
-
form:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: NestedKeyOf<To>, meta: M) => boolean | M;
|
|
13
|
-
order?: NestedKeyOf<To>[];
|
|
7
|
+
form: OmegaInputProps<From, To>["form"];
|
|
8
|
+
pick?: DeepKeys<From>[];
|
|
9
|
+
omit?: DeepKeys<From>[];
|
|
10
|
+
labelMap?: (key: DeepKeys<From>) => string | undefined;
|
|
11
|
+
filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: DeepKeys<From>, meta: M) => boolean | M;
|
|
12
|
+
order?: DeepKeys<From>[];
|
|
14
13
|
sort?: Order.Order<OmegaAutoGenMeta<From, To>>;
|
|
15
14
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
16
15
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { FieldValidators,
|
|
1
|
+
import type { FieldValidators, TypeOverride } from "./OmegaFormStuff";
|
|
2
2
|
import type { InputProps } from "./InputProps";
|
|
3
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
3
4
|
declare const _default: <From, To extends Record<PropertyKey, any>>(__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<{
|
|
4
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
5
|
-
name:
|
|
6
|
+
name: DeepKeys<From>;
|
|
6
7
|
label: string;
|
|
7
8
|
validators?: FieldValidators<From>;
|
|
8
9
|
options?: {
|
|
@@ -14,7 +15,7 @@ declare const _default: <From, To extends Record<PropertyKey, any>>(__VLS_props:
|
|
|
14
15
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
15
16
|
attrs: any;
|
|
16
17
|
slots: {
|
|
17
|
-
default:
|
|
18
|
+
default: InputProps<From, To>;
|
|
18
19
|
};
|
|
19
20
|
emit: {};
|
|
20
21
|
}>) => import("vue").VNode & {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { S, type Record, type Effect } from "effect-app";
|
|
2
|
-
import { type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV1, type FormApi, type VueFormApi, type
|
|
3
|
-
import
|
|
2
|
+
import { type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV1, type FormApi, type VueFormApi, type FormOptions, type DeepKeys, type FieldValidateOrFn, type FieldAsyncValidateOrFn, type FormState } from "@tanstack/vue-form";
|
|
3
|
+
import { OmegaFormReturn } from "./useOmegaForm";
|
|
4
|
+
import { OmegaFieldInternalApi } from "./InputProps";
|
|
4
5
|
export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit";
|
|
5
6
|
export type OmegaInputProps<From, To> = {
|
|
6
|
-
form:
|
|
7
|
-
meta: MetaRecord<
|
|
7
|
+
form: OmegaFormReturn<From, To> & {
|
|
8
|
+
meta: MetaRecord<From>;
|
|
8
9
|
};
|
|
9
|
-
name: NestedKeyOf<
|
|
10
|
+
name: NestedKeyOf<From>;
|
|
10
11
|
validators?: FieldValidators<From>;
|
|
11
12
|
label: string;
|
|
12
13
|
options?: {
|
|
@@ -21,19 +22,19 @@ export interface OmegaError {
|
|
|
21
22
|
inputId: string;
|
|
22
23
|
errors: readonly string[];
|
|
23
24
|
}
|
|
24
|
-
export type FormProps<
|
|
25
|
+
export type FormProps<From, To> = Omit<FormOptions<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>, "onSubmit"> & {
|
|
25
26
|
onSubmit?: (props: {
|
|
26
|
-
formApi: OmegaFormParams<
|
|
27
|
+
formApi: OmegaFormParams<From, To>;
|
|
27
28
|
meta: any;
|
|
28
|
-
value:
|
|
29
|
+
value: To;
|
|
29
30
|
}) => Promise<any> | any;
|
|
30
31
|
};
|
|
31
|
-
export type OmegaFormParams<
|
|
32
|
-
export type OmegaFormState<
|
|
33
|
-
export type OmegaFormApi<
|
|
34
|
-
export type FormComponent<T, S> =
|
|
32
|
+
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, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
|
|
33
|
+
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, FormAsyncValidateOrFn<From> | undefined>;
|
|
34
|
+
export type OmegaFormApi<From, To> = OmegaFormParams<From, To> & VueFormApi<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
|
|
35
|
+
export type FormComponent<T, S> = VueFormApi<T, FormValidateOrFn<T> | undefined, FormValidateOrFn<T> | undefined, StandardSchemaV1<T, S>, FormValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined>;
|
|
35
36
|
export type FormType<T, S = unknown> = OmegaFormApi<T, S> & {
|
|
36
|
-
Field:
|
|
37
|
+
Field: OmegaFieldInternalApi<T, S>;
|
|
37
38
|
};
|
|
38
39
|
export type PrefixFromDepth<K extends string | number, _TDepth extends any[]> = K;
|
|
39
40
|
export type NestedKeyOf<T> = DeepKeys<T>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
|
-
import type { OmegaFieldInternalApi } from "./InputProps";
|
|
3
2
|
declare const _default: <From, To>(__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<{
|
|
4
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & OmegaInputProps<From, To> & Partial<{}>> & import("vue").PublicProps;
|
|
5
4
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -13,10 +12,10 @@ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
13
12
|
max?: number | false;
|
|
14
13
|
min?: number | false;
|
|
15
14
|
name: string;
|
|
16
|
-
modelValue:
|
|
15
|
+
modelValue: any;
|
|
17
16
|
errorMessages: string[];
|
|
18
17
|
error: boolean;
|
|
19
|
-
field: OmegaFieldInternalApi<
|
|
18
|
+
field: import("./InputProps").OmegaFieldInternalApi<From, any>;
|
|
20
19
|
setRealDirty: () => void;
|
|
21
20
|
type: string;
|
|
22
21
|
label: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { InputProps } from "./InputProps";
|
|
2
|
-
declare const _default: <T>(__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<{
|
|
2
|
+
declare const _default: <T, S>(__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<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly onBlur?: ((event: Event) => any) | undefined;
|
|
5
5
|
readonly onFocus?: ((event: Event) => any) | undefined;
|
|
6
6
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onFocus"> & {
|
|
7
|
-
inputProps: InputProps<T>;
|
|
7
|
+
inputProps: InputProps<T, S>;
|
|
8
8
|
vuetifyValue: unknown;
|
|
9
9
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
10
10
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
|
|
2
2
|
import type { OmegaFieldInternalApi } from "./InputProps";
|
|
3
|
-
declare const _default: <To>(__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<{
|
|
3
|
+
declare const _default: <From, To>(__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<{
|
|
4
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
5
|
-
field: OmegaFieldInternalApi<To>;
|
|
6
|
-
meta: MetaRecord<
|
|
5
|
+
field: OmegaFieldInternalApi<From, To>;
|
|
6
|
+
meta: MetaRecord<From>[NestedKeyOf<From>];
|
|
7
7
|
label: string;
|
|
8
8
|
options?: {
|
|
9
9
|
title: string;
|
|
10
10
|
value: string;
|
|
11
11
|
}[];
|
|
12
12
|
type?: TypeOverride;
|
|
13
|
-
validators?: FieldValidators<
|
|
13
|
+
validators?: FieldValidators<From>;
|
|
14
14
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
15
15
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
16
16
|
attrs: any;
|
|
@@ -23,10 +23,10 @@ declare const _default: <To>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
23
23
|
max?: number | false;
|
|
24
24
|
min?: number | false;
|
|
25
25
|
name: string;
|
|
26
|
-
modelValue:
|
|
26
|
+
modelValue: To;
|
|
27
27
|
errorMessages: string[];
|
|
28
28
|
error: boolean;
|
|
29
|
-
field: OmegaFieldInternalApi<To>;
|
|
29
|
+
field: OmegaFieldInternalApi<From, To>;
|
|
30
30
|
setRealDirty: () => void;
|
|
31
31
|
type: string;
|
|
32
32
|
label: string;
|
|
@@ -13,7 +13,7 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
13
13
|
value: From;
|
|
14
14
|
}) => Promise<any> | any) | undefined;
|
|
15
15
|
} & ({
|
|
16
|
-
form: OmegaFormReturn<
|
|
16
|
+
form: OmegaFormReturn<From, To>;
|
|
17
17
|
schema?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
form?: undefined;
|
|
@@ -25,10 +25,10 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
25
25
|
default(): void;
|
|
26
26
|
internalForm(props: {
|
|
27
27
|
form: OmegaFormReturn<To, From>;
|
|
28
|
-
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<
|
|
28
|
+
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>;
|
|
29
29
|
}): void;
|
|
30
30
|
externalForm(props: {
|
|
31
|
-
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<
|
|
31
|
+
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>;
|
|
32
32
|
}): void;
|
|
33
33
|
};
|
|
34
34
|
emit: {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as OmegaForm } from "./OmegaWrapper.vue";
|
|
2
2
|
import { default as OmegaInput } from "./OmegaInput.vue";
|
|
3
|
+
import { default as OmegaFormInput } from "./OmegaFormInput.vue";
|
|
3
4
|
import { default as OmegaErrors } from "./OmegaErrors.vue";
|
|
4
5
|
import { default as OmegaAutoGen } from "./OmegaAutoGen.vue";
|
|
5
6
|
import { default as OmegaArray } from "./OmegaArray.vue";
|
|
@@ -7,4 +8,4 @@ export * as OmegaErrorsContext from "./OmegaErrorsContext";
|
|
|
7
8
|
export * from "./OmegaFormStuff";
|
|
8
9
|
export { useOmegaForm, type OmegaFormReturn } from "./useOmegaForm";
|
|
9
10
|
export { default } from "./OmegaWrapper.vue";
|
|
10
|
-
export { OmegaForm, OmegaInput, OmegaErrors, OmegaAutoGen, OmegaArray };
|
|
11
|
+
export { OmegaForm, OmegaInput, OmegaFormInput, OmegaErrors, OmegaAutoGen, OmegaArray };
|
|
@@ -26,8 +26,8 @@ interface OF<To, From> extends OmegaFormApi<To, From> {
|
|
|
26
26
|
clear: () => void;
|
|
27
27
|
}
|
|
28
28
|
export declare const OmegaFormKey: InjectionKey<OF<any, any>>;
|
|
29
|
-
export interface OmegaFormReturn<
|
|
29
|
+
export interface OmegaFormReturn<From, To> extends OF<From, To> {
|
|
30
30
|
Input: typeof OmegaFormInput;
|
|
31
31
|
}
|
|
32
|
-
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<From, To, never>, tanstackFormOptions?: NoInfer<FormProps<To, From>>, omegaConfig?: OmegaConfig<From>) => OmegaFormReturn<
|
|
32
|
+
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<From, To, never>, tanstackFormOptions?: NoInfer<FormProps<To, From>>, omegaConfig?: OmegaConfig<From>) => OmegaFormReturn<From, To>;
|
|
33
33
|
export {};
|
|
@@ -3,11 +3,12 @@ import { provideIntl as l, useIntl as s } from "./vue-components.es3.js";
|
|
|
3
3
|
import { default as c } from "./vue-components.es4.js";
|
|
4
4
|
import { default as x } from "./vue-components.es5.js";
|
|
5
5
|
import { default as g } from "./vue-components.es6.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { default as F } from "./vue-components.es7.js";
|
|
7
|
+
import * as m from "./vue-components.es8.js";
|
|
8
|
+
import { useOmegaForm as y } from "./vue-components.es9.js";
|
|
9
|
+
import { createMeta as S, duplicateSchema as b, generateInputStandardSchemaFromFieldMeta as M, generateMetaFromSchema as j, nullableInput as A } from "./vue-components.es10.js";
|
|
10
10
|
import { default as k } from "./vue-components.es11.js";
|
|
11
|
+
import { default as w } from "./vue-components.es12.js";
|
|
11
12
|
function a(r) {
|
|
12
13
|
for (const e in o)
|
|
13
14
|
if (Object.prototype.hasOwnProperty.call(o, e)) {
|
|
@@ -17,18 +18,19 @@ function a(r) {
|
|
|
17
18
|
}
|
|
18
19
|
const n = { install: a };
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
F as OmegaArray,
|
|
22
|
+
g as OmegaAutoGen,
|
|
23
|
+
w as OmegaErrors,
|
|
23
24
|
m as OmegaErrorsContext,
|
|
24
|
-
|
|
25
|
+
k as OmegaForm,
|
|
26
|
+
x as OmegaFormInput,
|
|
25
27
|
c as OmegaInput,
|
|
26
|
-
|
|
28
|
+
S as createMeta,
|
|
27
29
|
n as default,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
b as duplicateSchema,
|
|
31
|
+
M as generateInputStandardSchemaFromFieldMeta,
|
|
32
|
+
j as generateMetaFromSchema,
|
|
33
|
+
A as nullableInput,
|
|
32
34
|
l as provideIntl,
|
|
33
35
|
s as useIntl,
|
|
34
36
|
y as useOmegaForm
|
|
@@ -1,8 +1,248 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { S as t, Option as g, pipe as S } from "effect-app";
|
|
2
|
+
import { useIntl as v } from "./vue-components.es3.js";
|
|
3
|
+
const x = t.NonEmptyArray(t.String), T = (e) => t.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === t.Null.ast), h = (e) => !e || !t.AST.isUnion(e) ? !1 : e.types.find((i) => i._tag === "UndefinedKeyword") ? "undefined" : e.types.find((i) => i === t.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: i = "", property: n, propertySignatures: a }, u = {}) => {
|
|
4
|
+
if (n && n._tag === "Transformation")
|
|
5
|
+
return m({
|
|
6
|
+
parent: i,
|
|
7
|
+
meta: e,
|
|
8
|
+
property: n.from
|
|
9
|
+
});
|
|
10
|
+
if (n?._tag === "TypeLiteral" && "propertySignatures" in n)
|
|
11
|
+
return m({
|
|
12
|
+
meta: e,
|
|
13
|
+
propertySignatures: n.propertySignatures
|
|
14
|
+
});
|
|
15
|
+
if (a) {
|
|
16
|
+
for (const s of a) {
|
|
17
|
+
const o = i ? `${i}.${s.name.toString()}` : s.name.toString(), r = h(s.type), l = !r, d = s.type;
|
|
18
|
+
if (t.AST.isUnion(s.type)) {
|
|
19
|
+
const p = s.type.types.filter(
|
|
20
|
+
(f) => f._tag !== "UndefinedKeyword" && f !== t.Null.ast
|
|
21
|
+
);
|
|
22
|
+
if (p.some(
|
|
23
|
+
(f) => "propertySignatures" in f
|
|
24
|
+
)) {
|
|
25
|
+
const f = m({
|
|
26
|
+
parent: o,
|
|
27
|
+
property: s.type,
|
|
28
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
29
|
+
});
|
|
30
|
+
u[o] = f;
|
|
31
|
+
for (const c of p)
|
|
32
|
+
"propertySignatures" in c && Object.assign(
|
|
33
|
+
u,
|
|
34
|
+
m({
|
|
35
|
+
parent: o,
|
|
36
|
+
propertySignatures: c.propertySignatures,
|
|
37
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
const f = m({
|
|
42
|
+
parent: o,
|
|
43
|
+
property: s.type,
|
|
44
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
45
|
+
});
|
|
46
|
+
u[o] = f;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if ("propertySignatures" in d)
|
|
50
|
+
Object.assign(
|
|
51
|
+
u,
|
|
52
|
+
m({
|
|
53
|
+
parent: o,
|
|
54
|
+
propertySignatures: d.propertySignatures,
|
|
55
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
else {
|
|
59
|
+
const p = m({
|
|
60
|
+
parent: o,
|
|
61
|
+
property: s.type,
|
|
62
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
63
|
+
});
|
|
64
|
+
u[o] = p;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return u;
|
|
68
|
+
}
|
|
69
|
+
if (n) {
|
|
70
|
+
const s = T(n);
|
|
71
|
+
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), t.AST.isUnion(n)) {
|
|
72
|
+
const r = n.types.find(
|
|
73
|
+
(l) => l._tag !== "UndefinedKeyword" && l !== t.Null.ast
|
|
74
|
+
);
|
|
75
|
+
return "propertySignatures" in r ? m({
|
|
76
|
+
propertySignatures: r.propertySignatures,
|
|
77
|
+
parent: i,
|
|
78
|
+
meta: e
|
|
79
|
+
}) : n.types.every(t.AST.isLiteral) ? {
|
|
80
|
+
...e,
|
|
81
|
+
type: "select",
|
|
82
|
+
members: n.types.map((l) => l.literal)
|
|
83
|
+
} : {
|
|
84
|
+
...e,
|
|
85
|
+
...m({
|
|
86
|
+
parent: i,
|
|
87
|
+
meta: e,
|
|
88
|
+
property: r
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (t.AST.isTupleType(n))
|
|
93
|
+
return {
|
|
94
|
+
...e,
|
|
95
|
+
type: "multiple",
|
|
96
|
+
members: n.elements,
|
|
97
|
+
rest: n.rest
|
|
98
|
+
};
|
|
99
|
+
const o = t.AST.getAnnotation(
|
|
100
|
+
n,
|
|
101
|
+
t.AST.JSONSchemaAnnotationId
|
|
102
|
+
).pipe(g.getOrElse(() => ({})));
|
|
103
|
+
return e = { ...e, ...o }, "from" in n ? m({
|
|
104
|
+
parent: i,
|
|
105
|
+
meta: e,
|
|
106
|
+
property: n.from
|
|
107
|
+
}) : (e.type = t.AST.getAnnotation(
|
|
108
|
+
n,
|
|
109
|
+
t.AST.TitleAnnotationId
|
|
110
|
+
).pipe(
|
|
111
|
+
g.getOrElse(() => "unknown")
|
|
112
|
+
), e);
|
|
113
|
+
}
|
|
114
|
+
return u;
|
|
115
|
+
}, y = (e) => {
|
|
116
|
+
const i = e.ast, n = {};
|
|
117
|
+
if (i._tag === "Transformation" || i._tag === "Refinement")
|
|
118
|
+
return y(t.make(i.from));
|
|
119
|
+
if ("propertySignatures" in i) {
|
|
120
|
+
const a = m({
|
|
121
|
+
propertySignatures: i.propertySignatures
|
|
122
|
+
});
|
|
123
|
+
if (Object.values(a).every((s) => s && "type" in s))
|
|
124
|
+
return a;
|
|
125
|
+
const u = (s, o = "") => {
|
|
126
|
+
for (const r in s) {
|
|
127
|
+
const l = o ? `${o}.${r}` : r;
|
|
128
|
+
s[r] && typeof s[r] == "object" && "type" in s[r] ? n[l] = s[r] : s[r] && typeof s[r] == "object" && u(s[r], l);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
u(a);
|
|
132
|
+
}
|
|
133
|
+
return n;
|
|
134
|
+
}, M = (e) => t.extend(e, t.Struct({})), N = (e) => {
|
|
135
|
+
const i = y(e), n = S(
|
|
136
|
+
e.ast,
|
|
137
|
+
g.liftPredicate((a) => a._tag === "Refinement" && "filter" in a),
|
|
138
|
+
g.flatMap((a) => t.AST.getJSONSchemaAnnotation(a)),
|
|
139
|
+
g.filter((a) => "items" in a),
|
|
140
|
+
g.filterMap(
|
|
141
|
+
({ items: a }) => t.decodeUnknownOption(x)(a)
|
|
142
|
+
),
|
|
143
|
+
g.zipWith(
|
|
144
|
+
t.AST.getMessageAnnotation(e.ast),
|
|
145
|
+
(a, u) => ({
|
|
146
|
+
items: a,
|
|
147
|
+
message: u("")
|
|
148
|
+
})
|
|
149
|
+
),
|
|
150
|
+
g.getOrUndefined
|
|
151
|
+
);
|
|
152
|
+
return { schema: e, meta: i, filterItems: n };
|
|
153
|
+
}, L = (e) => {
|
|
154
|
+
const { trans: i } = v();
|
|
155
|
+
let n;
|
|
156
|
+
switch (e.type) {
|
|
157
|
+
case "string":
|
|
158
|
+
n = t.String.annotations({
|
|
159
|
+
message: () => i("validation.empty")
|
|
160
|
+
}), e.format === "email" && (n = t.compose(
|
|
161
|
+
n,
|
|
162
|
+
t.Email.annotations({
|
|
163
|
+
message: () => i("validation.email.invalid")
|
|
164
|
+
})
|
|
165
|
+
)), e.required && n.annotations({
|
|
166
|
+
message: () => i("validation.empty")
|
|
167
|
+
}), e.maxLength && (n = n.pipe(t.maxLength(e.maxLength)).annotations({
|
|
168
|
+
message: () => i("validation.string.maxLength", {
|
|
169
|
+
maxLength: e.maxLength
|
|
170
|
+
})
|
|
171
|
+
})), e.minLength && (n = n.pipe(t.minLength(e.minLength)).annotations({
|
|
172
|
+
message: () => i("validation.string.minLength", {
|
|
173
|
+
minLength: e.minLength
|
|
174
|
+
})
|
|
175
|
+
}));
|
|
176
|
+
break;
|
|
177
|
+
case "number":
|
|
178
|
+
n = t.Number.annotations({
|
|
179
|
+
message: () => i("validation.empty")
|
|
180
|
+
}), e.required && n.annotations({
|
|
181
|
+
message: () => i("validation.empty")
|
|
182
|
+
}), e.minimum && (n = n.pipe(t.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
183
|
+
message: () => i("validation.number.min", {
|
|
184
|
+
minimum: e.minimum,
|
|
185
|
+
isExclusive: !0
|
|
186
|
+
})
|
|
187
|
+
})), e.maximum && (n = n.pipe(t.lessThanOrEqualTo(e.maximum)).annotations({
|
|
188
|
+
message: () => i("validation.number.max", {
|
|
189
|
+
maximum: e.maximum,
|
|
190
|
+
isExclusive: !0
|
|
191
|
+
})
|
|
192
|
+
})), e.exclusiveMinimum && (n = n.pipe(t.greaterThan(e.exclusiveMinimum)).annotations({
|
|
193
|
+
message: () => i("validation.number.min", {
|
|
194
|
+
minimum: e.exclusiveMinimum,
|
|
195
|
+
isExclusive: !1
|
|
196
|
+
})
|
|
197
|
+
})), e.exclusiveMaximum && (n = n.pipe(t.lessThan(e.exclusiveMaximum)).annotations({
|
|
198
|
+
message: () => i("validation.number.max", {
|
|
199
|
+
maximum: e.exclusiveMaximum,
|
|
200
|
+
isExclusive: !1
|
|
201
|
+
})
|
|
202
|
+
}));
|
|
203
|
+
break;
|
|
204
|
+
case "select":
|
|
205
|
+
n = t.Literal(...e.members).annotations({
|
|
206
|
+
message: () => ({
|
|
207
|
+
message: i("validation.not_a_valid", {
|
|
208
|
+
type: "select",
|
|
209
|
+
message: e.members.join(", ")
|
|
210
|
+
}),
|
|
211
|
+
override: !0
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
break;
|
|
215
|
+
case "multiple":
|
|
216
|
+
n = t.Array(t.String).annotations({
|
|
217
|
+
message: () => i("validation.not_a_valid", {
|
|
218
|
+
type: "multiple",
|
|
219
|
+
message: e.members.join(", ")
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
break;
|
|
223
|
+
case "boolean":
|
|
224
|
+
n = t.Boolean;
|
|
225
|
+
break;
|
|
226
|
+
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
227
|
+
case "unknown":
|
|
228
|
+
n = t.Unknown;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
return e.required ? n.pipe(
|
|
232
|
+
t.annotations({
|
|
233
|
+
message: () => i("validation.empty")
|
|
234
|
+
})
|
|
235
|
+
) : n = t.NullishOr(n), t.standardSchemaV1(n);
|
|
236
|
+
}, U = (e, i) => t.NullOr(e).pipe(
|
|
237
|
+
t.transform(t.typeSchema(e), {
|
|
238
|
+
decode: (n) => n ?? i(),
|
|
239
|
+
encode: (n) => n
|
|
240
|
+
})
|
|
241
|
+
);
|
|
6
242
|
export {
|
|
7
|
-
m as
|
|
243
|
+
m as createMeta,
|
|
244
|
+
M as duplicateSchema,
|
|
245
|
+
L as generateInputStandardSchemaFromFieldMeta,
|
|
246
|
+
N as generateMetaFromSchema,
|
|
247
|
+
U as nullableInput
|
|
8
248
|
};
|