@effect-app/vue-components 0.12.22 → 0.13.1
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 +6 -4
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +3 -2
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +5 -4
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +27 -4
- package/package.json +3 -3
- package/src/components/OmegaForm/InputProps.ts +34 -23
- package/src/components/OmegaForm/OmegaArray.vue +1 -1
- package/src/components/OmegaForm/OmegaAutoGen.vue +2 -2
- package/src/components/OmegaForm/OmegaFormInput.vue +3 -4
- package/src/components/OmegaForm/OmegaFormStuff.ts +3 -3
- package/src/components/OmegaForm/OmegaInput.vue +1 -1
- package/src/components/OmegaForm/OmegaInputVuetify.vue +7 -6
- package/src/components/OmegaForm/OmegaInternalInput.vue +6 -6
- package/src/components/OmegaForm/useOmegaForm.ts +32 -5
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { DeepValue, DeepKeys, FieldApi, FormAsyncValidateOrFn, FormValidateOrFn, StandardSchemaV1, FieldValidateOrFn, FieldValidateFn, FieldValidateAsyncFn, FieldAsyncValidateOrFn } from "@tanstack/vue-form";
|
|
2
|
-
export type OmegaFieldInternalApi<From,
|
|
3
|
-
|
|
2
|
+
export type OmegaFieldInternalApi<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = FieldApi<From, TName, DeepValue<From, TName>, FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateFn<From, TName>, StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateAsyncFn<From, TName>, FieldValidateOrFn<From, TName, DeepValue<From, TName>>, FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>>, FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, any, // FormAsyncValidateOrFn<From>,
|
|
3
|
+
// FormAsyncValidateOrFn<From>,
|
|
4
|
+
FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
|
|
5
|
+
export type InputProps<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
|
|
4
6
|
id: string;
|
|
5
7
|
required?: boolean;
|
|
6
8
|
minLength?: number | false;
|
|
@@ -8,10 +10,10 @@ export type InputProps<T, S = unknown> = {
|
|
|
8
10
|
max?: number | false;
|
|
9
11
|
min?: number | false;
|
|
10
12
|
name: string;
|
|
11
|
-
modelValue:
|
|
13
|
+
modelValue: DeepValue<From, TName>;
|
|
12
14
|
errorMessages: string[];
|
|
13
15
|
error: boolean;
|
|
14
|
-
field: OmegaFieldInternalApi<
|
|
16
|
+
field: OmegaFieldInternalApi<From, TName>;
|
|
15
17
|
setRealDirty: () => void;
|
|
16
18
|
type: string;
|
|
17
19
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
2
|
import { type DeepValue, type DeepKeys } from "@tanstack/vue-form";
|
|
3
|
-
declare const _default: <From, To
|
|
3
|
+
declare const _default: <From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>>(__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> & (Omit<OmegaInputProps<From, To>, "type" | "label" | "items" | "options" | "validators"> & {
|
|
5
5
|
items?: DeepValue<To, DeepKeys<To>>;
|
|
6
6
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
2
|
import { Order } from "effect-app";
|
|
3
3
|
import { DeepKeys } from "@tanstack/vue-form";
|
|
4
|
-
export type OmegaAutoGenMeta<From, To
|
|
5
|
-
declare const _default: <From, To
|
|
4
|
+
export type OmegaAutoGenMeta<From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>> = Omit<OmegaInputProps<From, To>, "form">;
|
|
5
|
+
declare const _default: <From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>>(__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<{
|
|
6
6
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
7
7
|
form: OmegaInputProps<From, To>["form"];
|
|
8
8
|
pick?: DeepKeys<From>[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { FieldValidators, TypeOverride } from "./OmegaFormStuff";
|
|
2
2
|
import type { InputProps } from "./InputProps";
|
|
3
3
|
import { DeepKeys } from "@tanstack/vue-form";
|
|
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
|
+
declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
6
|
-
name:
|
|
6
|
+
name: Name;
|
|
7
7
|
label: string;
|
|
8
8
|
validators?: FieldValidators<From>;
|
|
9
9
|
options?: {
|
|
@@ -15,7 +15,7 @@ declare const _default: <From, To extends Record<PropertyKey, any>>(__VLS_props:
|
|
|
15
15
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {
|
|
18
|
-
default: InputProps<From,
|
|
18
|
+
default(props: InputProps<From, Name>): void;
|
|
19
19
|
};
|
|
20
20
|
emit: {};
|
|
21
21
|
}>) => import("vue").VNode & {
|
|
@@ -3,7 +3,7 @@ import { type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV
|
|
|
3
3
|
import { OmegaFormReturn } from "./useOmegaForm";
|
|
4
4
|
import { OmegaFieldInternalApi } from "./InputProps";
|
|
5
5
|
export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit";
|
|
6
|
-
export type OmegaInputProps<From, To
|
|
6
|
+
export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
|
|
7
7
|
form: OmegaFormReturn<From, To> & {
|
|
8
8
|
meta: MetaRecord<From>;
|
|
9
9
|
};
|
|
@@ -33,8 +33,8 @@ export type OmegaFormParams<From, To> = FormApi<From, FormValidateOrFn<From> | u
|
|
|
33
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
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
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>;
|
|
36
|
-
export type FormType<
|
|
37
|
-
Field: OmegaFieldInternalApi<
|
|
36
|
+
export type FormType<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = OmegaFormApi<From, To> & {
|
|
37
|
+
Field: OmegaFieldInternalApi<From, Name>;
|
|
38
38
|
};
|
|
39
39
|
export type PrefixFromDepth<K extends string | number, _TDepth extends any[]> = K;
|
|
40
40
|
export type NestedKeyOf<T> = DeepKeys<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
|
-
declare const _default: <From, To
|
|
2
|
+
declare const _default: <From extends Record<PropertyKey, any>, 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<{
|
|
3
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;
|
|
4
4
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
5
5
|
attrs: any;
|
|
@@ -12,7 +12,7 @@ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
12
12
|
max?: number | false;
|
|
13
13
|
min?: number | false;
|
|
14
14
|
name: string;
|
|
15
|
-
modelValue: any
|
|
15
|
+
modelValue: import("@tanstack/vue-form").DeepValue<From, any>;
|
|
16
16
|
errorMessages: string[];
|
|
17
17
|
error: boolean;
|
|
18
18
|
field: import("./InputProps").OmegaFieldInternalApi<From, any>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
1
2
|
import type { InputProps } from "./InputProps";
|
|
2
|
-
declare const _default: <
|
|
3
|
+
declare const _default: <From extends Record<PropertyKey, any>, 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
5
|
readonly onBlur?: ((event: Event) => any) | undefined;
|
|
5
6
|
readonly onFocus?: ((event: Event) => any) | undefined;
|
|
6
7
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onFocus"> & {
|
|
7
|
-
inputProps: InputProps<
|
|
8
|
+
inputProps: InputProps<From, Name>;
|
|
8
9
|
vuetifyValue: unknown;
|
|
9
10
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
10
11
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
1
2
|
import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
|
|
2
3
|
import type { OmegaFieldInternalApi } from "./InputProps";
|
|
3
|
-
declare const _default: <From,
|
|
4
|
+
declare const _default: <From extends Record<PropertyKey, any>, 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_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
|
-
field: OmegaFieldInternalApi<From,
|
|
6
|
+
field: OmegaFieldInternalApi<From, Name>;
|
|
6
7
|
meta: MetaRecord<From>[NestedKeyOf<From>];
|
|
7
8
|
label: string;
|
|
8
9
|
options?: {
|
|
@@ -23,10 +24,10 @@ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
23
24
|
max?: number | false;
|
|
24
25
|
min?: number | false;
|
|
25
26
|
name: string;
|
|
26
|
-
modelValue:
|
|
27
|
+
modelValue: import("@tanstack/vue-form").DeepValue<From, Name>;
|
|
27
28
|
errorMessages: string[];
|
|
28
29
|
error: boolean;
|
|
29
|
-
field: OmegaFieldInternalApi<From,
|
|
30
|
+
field: OmegaFieldInternalApi<From, Name>;
|
|
30
31
|
setRealDirty: () => void;
|
|
31
32
|
type: string;
|
|
32
33
|
label: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
1
2
|
import { type Record, S } from "effect-app";
|
|
2
|
-
import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi } from "./OmegaFormStuff";
|
|
3
|
+
import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi, TypeOverride, FieldValidators } from "./OmegaFormStuff";
|
|
3
4
|
import { type InjectionKey } from "vue";
|
|
4
|
-
import
|
|
5
|
+
import { InputProps } from "./InputProps";
|
|
5
6
|
type keysRule<T> = {
|
|
6
7
|
keys?: NestedKeyOf<T>[];
|
|
7
8
|
banKeys?: "You should only use one of banKeys or keys, not both, moron";
|
|
@@ -26,8 +27,30 @@ interface OF<From, To> extends OmegaFormApi<From, To> {
|
|
|
26
27
|
clear: () => void;
|
|
27
28
|
}
|
|
28
29
|
export declare const OmegaFormKey: InjectionKey<OF<any, any>>;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
type __VLS_PrettifyLocal<T> = {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
} & {};
|
|
33
|
+
export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> extends OF<From, To> {
|
|
34
|
+
Input: <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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
35
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
36
|
+
name: Name;
|
|
37
|
+
label: string;
|
|
38
|
+
validators?: FieldValidators<From>;
|
|
39
|
+
options?: {
|
|
40
|
+
title: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}[];
|
|
43
|
+
type?: TypeOverride;
|
|
44
|
+
} & Partial<{}>> & import("vue").PublicProps;
|
|
45
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
46
|
+
attrs: any;
|
|
47
|
+
slots: {
|
|
48
|
+
default(props: InputProps<From, Name>): void;
|
|
49
|
+
};
|
|
50
|
+
emit: {};
|
|
51
|
+
}>) => import("vue").VNode & {
|
|
52
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
53
|
+
};
|
|
31
54
|
}
|
|
32
55
|
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<To, From, never>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To>;
|
|
33
56
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"@tanstack/vue-form": "^1.2.4",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"highlight.js": "^11.11.1",
|
|
52
52
|
"vue3-highlightjs": "^1.0.5",
|
|
53
|
-
"effect-app": "
|
|
54
|
-
"
|
|
53
|
+
"@effect-app/vue": "2.51.10",
|
|
54
|
+
"effect-app": "3.0.9"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "pnpm build:run",
|
|
@@ -13,29 +13,40 @@ import type {
|
|
|
13
13
|
FieldAsyncValidateOrFn,
|
|
14
14
|
} from "@tanstack/vue-form"
|
|
15
15
|
|
|
16
|
-
export type OmegaFieldInternalApi<From,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DeepValue<From,
|
|
20
|
-
FieldValidateOrFn<From,
|
|
21
|
-
StandardSchemaV1<
|
|
22
|
-
StandardSchemaV1<
|
|
23
|
-
FieldValidateOrFn<From,
|
|
24
|
-
FieldAsyncValidateOrFn<From,
|
|
25
|
-
FieldValidateOrFn<From,
|
|
26
|
-
FieldAsyncValidateOrFn<From,
|
|
27
|
-
FormValidateOrFn<From> | undefined,
|
|
28
|
-
FormValidateOrFn<From> | undefined,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
export type OmegaFieldInternalApi<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = FieldApi<
|
|
17
|
+
/* in out TParentData*/ From,
|
|
18
|
+
/* in out TName*/ TName,
|
|
19
|
+
/* in out TData*/ DeepValue<From, TName>,
|
|
20
|
+
/* in out TOnMount*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
|
|
21
|
+
/* in out TOnChange*/ StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateFn<From, TName>,
|
|
22
|
+
/* in out TOnChangeAsync*/ StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateAsyncFn<From, TName>,
|
|
23
|
+
/* in out TOnBlur*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>>,
|
|
24
|
+
/* in out TOnBlurAsync*/ FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>>,
|
|
25
|
+
/* in out TOnSubmit*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
|
|
26
|
+
/* in out TOnSubmitAsync*/ FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
|
|
27
|
+
/* in out TFormOnMount*/ FormValidateOrFn<From> | undefined,
|
|
28
|
+
/* in out TFormOnChange*/ FormValidateOrFn<From> | undefined,
|
|
29
|
+
// using `any` for now to silence:
|
|
30
|
+
/*
|
|
31
|
+
Type 'FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<...>>> | undefined, ... 14 more ..., FormAsyncValidateOrFn<...> | undefined>' is not assignable to type 'OmegaFieldInternalApi<From, any>'.
|
|
32
|
+
The types of 'form.options.defaultState' are incompatible between these types.
|
|
33
|
+
Type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>> | undefined' is not assignable to type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>> | undefined'.
|
|
34
|
+
Type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>>' is not assignable to type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>>'.
|
|
35
|
+
Types of property 'errorMap' are incompatible.
|
|
36
|
+
Type 'FormValidationErrorMap<undefined, undefined, Record<string, StandardSchemaV1Issue[]>, undefined, undefined, undefined, undefined, undefined> | undefined' is not assignable to type 'FormValidationErrorMap<undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined> | undefined'.
|
|
37
|
+
Type 'FormValidationErrorMap<undefined, undefined, Record<string, StandardSchemaV1Issue[]>, undefined, undefined, undefined, undefined, undefined>' is not assignable to type 'FormValidationErrorMap<undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined>'.
|
|
38
|
+
Type 'Record<string, StandardSchemaV1Issue[]>' is not assignable to type 'undefined'.
|
|
39
|
+
*/
|
|
40
|
+
/* in out TFormOnChangeAsync*/ any, // FormAsyncValidateOrFn<From>,
|
|
41
|
+
/* in out TFormOnBlur*/ FormValidateOrFn<From> | undefined,
|
|
42
|
+
/* in out TFormOnBlurAsync*/ FormAsyncValidateOrFn<From> | undefined,
|
|
43
|
+
/* in out TFormOnSubmit*/ FormValidateOrFn<From> | undefined,
|
|
44
|
+
/* in out TFormOnSubmitAsync*/ FormAsyncValidateOrFn<From> | undefined,
|
|
45
|
+
/* in out TFormOnServer*/ FormAsyncValidateOrFn<From> | undefined,
|
|
46
|
+
/* in out TParentSubmitMeta*/ FormAsyncValidateOrFn<From> | undefined
|
|
36
47
|
>
|
|
37
48
|
|
|
38
|
-
export type InputProps<
|
|
49
|
+
export type InputProps<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
|
|
39
50
|
id: string
|
|
40
51
|
required?: boolean
|
|
41
52
|
minLength?: number | false
|
|
@@ -43,10 +54,10 @@ export type InputProps<T, S = unknown> = {
|
|
|
43
54
|
max?: number | false
|
|
44
55
|
min?: number | false
|
|
45
56
|
name: string
|
|
46
|
-
modelValue:
|
|
57
|
+
modelValue: DeepValue<From, TName>
|
|
47
58
|
errorMessages: string[]
|
|
48
59
|
error: boolean
|
|
49
|
-
field: OmegaFieldInternalApi<
|
|
60
|
+
field: OmegaFieldInternalApi<From, TName>
|
|
50
61
|
setRealDirty: () => void
|
|
51
62
|
type: string
|
|
52
63
|
label: string
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</component>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script setup lang="ts" generic="From, To">
|
|
28
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>">
|
|
29
29
|
import { computed, onMounted, provide } from "vue"
|
|
30
30
|
import {
|
|
31
31
|
type CreateMeta,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</slot>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script setup lang="ts" generic="From, To">
|
|
10
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>">
|
|
11
11
|
import { computed } from "vue"
|
|
12
12
|
import {
|
|
13
13
|
type NestedKeyOf,
|
|
@@ -21,7 +21,7 @@ import OmegaInput from "./OmegaInput.vue"
|
|
|
21
21
|
import { DeepKeys } from "@tanstack/vue-form"
|
|
22
22
|
import { OmegaFormReturn } from "./useOmegaForm"
|
|
23
23
|
|
|
24
|
-
export type OmegaAutoGenMeta<From, To
|
|
24
|
+
export type OmegaAutoGenMeta<From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>> = Omit<OmegaInputProps<From, To>, "form">
|
|
25
25
|
type NewMeta = OmegaAutoGenMeta<From, To>
|
|
26
26
|
|
|
27
27
|
const mapObject =
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</OmegaInput>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
|
-
<script setup lang="ts" generic="From, To extends Record<PropertyKey, any>">
|
|
17
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
|
|
18
18
|
import { inject } from "vue"
|
|
19
19
|
import type {
|
|
20
20
|
FieldValidators,
|
|
@@ -33,7 +33,7 @@ if (!form) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
defineProps<{
|
|
36
|
-
name:
|
|
36
|
+
name: Name
|
|
37
37
|
label: string
|
|
38
38
|
validators?: FieldValidators<From>
|
|
39
39
|
options?: { title: string; value: string }[]
|
|
@@ -41,7 +41,6 @@ defineProps<{
|
|
|
41
41
|
}>()
|
|
42
42
|
|
|
43
43
|
defineSlots<{
|
|
44
|
-
|
|
45
|
-
default: InputProps<From, To>
|
|
44
|
+
default(props: InputProps<From, Name>): void
|
|
46
45
|
}>()
|
|
47
46
|
</script>
|
|
@@ -18,7 +18,7 @@ import { OmegaFieldInternalApi } from "./InputProps"
|
|
|
18
18
|
|
|
19
19
|
export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit"
|
|
20
20
|
|
|
21
|
-
export type OmegaInputProps<From, To
|
|
21
|
+
export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
|
|
22
22
|
form: OmegaFormReturn<From, To> & {
|
|
23
23
|
meta: MetaRecord<From>
|
|
24
24
|
}
|
|
@@ -123,8 +123,8 @@ export type FormComponent<T, S> = VueFormApi<
|
|
|
123
123
|
FormAsyncValidateOrFn<T> | undefined
|
|
124
124
|
>
|
|
125
125
|
|
|
126
|
-
export type FormType<
|
|
127
|
-
Field: OmegaFieldInternalApi<
|
|
126
|
+
export type FormType<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = OmegaFormApi<From, To> & {
|
|
127
|
+
Field: OmegaFieldInternalApi<From, Name>
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export type PrefixFromDepth<
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</component>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script setup lang="ts" generic="From, To">
|
|
28
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>">
|
|
29
29
|
import { computed, inject, type Ref } from "vue"
|
|
30
30
|
import {
|
|
31
31
|
type FieldMeta,
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
@update:model-value="
|
|
65
65
|
(e: any) => {
|
|
66
66
|
if (e || e === 0) {
|
|
67
|
-
inputProps.field.handleChange(Number(e))
|
|
67
|
+
inputProps.field.handleChange(Number(e) as any)
|
|
68
68
|
} else {
|
|
69
|
-
inputProps.field.handleChange(undefined)
|
|
69
|
+
inputProps.field.handleChange(undefined as any)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
:error="inputProps.error"
|
|
86
86
|
v-bind="$attrs"
|
|
87
87
|
:model-value="vuetifyValue"
|
|
88
|
-
@clear="inputProps.field.handleChange(undefined)"
|
|
88
|
+
@clear="inputProps.field.handleChange(undefined as any)"
|
|
89
89
|
@update:model-value="inputProps.field.handleChange"
|
|
90
90
|
/>
|
|
91
91
|
|
|
@@ -106,17 +106,18 @@
|
|
|
106
106
|
:chips="inputProps.type === 'autocompletemultiple'"
|
|
107
107
|
v-bind="$attrs"
|
|
108
108
|
:model-value="vuetifyValue"
|
|
109
|
-
@clear="inputProps.field.handleChange(undefined)"
|
|
109
|
+
@clear="inputProps.field.handleChange(undefined as any)"
|
|
110
110
|
@update:model-value="inputProps.field.handleChange"
|
|
111
111
|
/>
|
|
112
112
|
</div>
|
|
113
113
|
</template>
|
|
114
114
|
|
|
115
|
-
<script setup lang="ts" generic="
|
|
115
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
|
|
116
|
+
import { DeepKeys } from "@tanstack/vue-form";
|
|
116
117
|
import type { InputProps } from "./InputProps"
|
|
117
118
|
|
|
118
119
|
defineProps<{
|
|
119
|
-
inputProps: InputProps<
|
|
120
|
+
inputProps: InputProps<From, Name>
|
|
120
121
|
vuetifyValue: unknown
|
|
121
122
|
}>()
|
|
122
123
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
</slot>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
|
-
<script setup lang="ts" generic="From,
|
|
15
|
-
import { useStore } from "@tanstack/vue-form"
|
|
14
|
+
<script setup lang="ts" generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
|
|
15
|
+
import { DeepKeys, useStore } from "@tanstack/vue-form"
|
|
16
16
|
import {
|
|
17
17
|
useId,
|
|
18
18
|
computed,
|
|
@@ -39,7 +39,7 @@ defineOptions({
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
const props = defineProps<{
|
|
42
|
-
field: OmegaFieldInternalApi<From,
|
|
42
|
+
field: OmegaFieldInternalApi<From, Name>
|
|
43
43
|
meta: MetaRecord<From>[NestedKeyOf<From>]
|
|
44
44
|
label: string
|
|
45
45
|
options?: { title: string; value: string }[]
|
|
@@ -83,7 +83,7 @@ watch(
|
|
|
83
83
|
if (isFalsyButNotZero(fieldValue.value) && props.meta?.type !== "boolean") {
|
|
84
84
|
nextTick(() => {
|
|
85
85
|
fieldApi.setValue(
|
|
86
|
-
props.meta?.nullableOrUndefined === "undefined" ? undefined : null,
|
|
86
|
+
props.meta?.nullableOrUndefined === "undefined" ? undefined : null as any,
|
|
87
87
|
)
|
|
88
88
|
})
|
|
89
89
|
}
|
|
@@ -96,7 +96,7 @@ onMounted(() => {
|
|
|
96
96
|
!props.meta?.required &&
|
|
97
97
|
props.meta?.nullableOrUndefined === "null"
|
|
98
98
|
) {
|
|
99
|
-
fieldApi.setValue(null)
|
|
99
|
+
fieldApi.setValue(null as any)
|
|
100
100
|
}
|
|
101
101
|
})
|
|
102
102
|
const { addError, removeError, showErrors, showErrorsOn } = useOmegaErrors()
|
|
@@ -143,7 +143,7 @@ watch(
|
|
|
143
143
|
},
|
|
144
144
|
)
|
|
145
145
|
|
|
146
|
-
const inputProps: ComputedRef<InputProps<From,
|
|
146
|
+
const inputProps: ComputedRef<InputProps<From, Name>> = computed(() => ({
|
|
147
147
|
id,
|
|
148
148
|
required: props.meta?.required,
|
|
149
149
|
minLength: props.meta?.type === "string" && props.meta?.minLength,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type FormValidateOrFn,
|
|
5
5
|
type FormAsyncValidateOrFn,
|
|
6
6
|
type StandardSchemaV1,
|
|
7
|
+
DeepKeys,
|
|
7
8
|
} from "@tanstack/vue-form"
|
|
8
9
|
import { type Record, S } from "effect-app"
|
|
9
10
|
import {
|
|
@@ -13,6 +14,8 @@ import {
|
|
|
13
14
|
type FormProps,
|
|
14
15
|
type MetaRecord,
|
|
15
16
|
type OmegaFormApi,
|
|
17
|
+
TypeOverride,
|
|
18
|
+
FieldValidators,
|
|
16
19
|
} from "./OmegaFormStuff"
|
|
17
20
|
import {
|
|
18
21
|
computed,
|
|
@@ -24,7 +27,7 @@ import {
|
|
|
24
27
|
} from "vue"
|
|
25
28
|
import { isObject } from "effect/Predicate"
|
|
26
29
|
import OmegaFormInput from "./OmegaFormInput.vue"
|
|
27
|
-
import { OmegaFieldInternalApi } from "./InputProps"
|
|
30
|
+
import { InputProps, OmegaFieldInternalApi } from "./InputProps"
|
|
28
31
|
|
|
29
32
|
type keysRule<T> =
|
|
30
33
|
| {
|
|
@@ -56,15 +59,39 @@ interface OF<From, To> extends OmegaFormApi<From, To> {
|
|
|
56
59
|
|
|
57
60
|
export const OmegaFormKey = Symbol("OmegaForm") as InjectionKey<OF<any, any>>
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
type __VLS_PrettifyLocal<T> = {
|
|
63
|
+
[K in keyof T]: T[K];
|
|
64
|
+
} & {};
|
|
65
|
+
|
|
66
|
+
export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> extends OF<From, To> {
|
|
67
|
+
// this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above..
|
|
68
|
+
Input: <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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
69
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
70
|
+
name: Name;
|
|
71
|
+
label: string;
|
|
72
|
+
validators?: FieldValidators<From>;
|
|
73
|
+
options?: {
|
|
74
|
+
title: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}[];
|
|
77
|
+
type?: TypeOverride;
|
|
78
|
+
} & Partial<{}>> & import("vue").PublicProps;
|
|
79
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
80
|
+
attrs: any;
|
|
81
|
+
slots: {
|
|
82
|
+
default(props: InputProps<From, Name>): void;
|
|
83
|
+
};
|
|
84
|
+
emit: {};
|
|
85
|
+
}>) => import("vue").VNode & {
|
|
86
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
87
|
+
};
|
|
61
88
|
}
|
|
62
89
|
|
|
63
90
|
export const useOmegaForm = <
|
|
64
91
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
92
|
From extends Record<PropertyKey, any>,
|
|
66
93
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
To extends Record<PropertyKey, any
|
|
94
|
+
To extends Record<PropertyKey, any>,
|
|
68
95
|
>(
|
|
69
96
|
schema: S.Schema<To, From, never>,
|
|
70
97
|
tanstackFormOptions?: NoInfer<FormProps<From, To>>,
|
|
@@ -287,6 +314,6 @@ export const useOmegaForm = <
|
|
|
287
314
|
|
|
288
315
|
return Object.assign(formWithExtras, {
|
|
289
316
|
Input: OmegaFormInput,
|
|
290
|
-
Field: form.Field
|
|
317
|
+
Field: form.Field
|
|
291
318
|
})
|
|
292
319
|
}
|