@volverjs/form-vue 0.0.10-beta.1 → 0.0.10-beta.3
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/VvForm.d.ts +48 -31
- package/dist/VvFormField.d.ts +94 -2
- package/dist/VvFormWrapper.d.ts +15 -2
- package/dist/index.d.ts +198 -12
- package/dist/index.es.js +259 -236
- package/dist/index.umd.js +1 -1
- package/dist/types.d.ts +23 -8
- package/dist/utils.d.ts +8 -0
- package/package.json +9 -9
- package/src/VvForm.ts +118 -97
- package/src/VvFormField.ts +26 -11
- package/src/VvFormWrapper.ts +13 -7
- package/src/index.ts +30 -10
- package/src/types.d.ts +23 -8
- package/src/utils.ts +26 -14
package/dist/VvForm.d.ts
CHANGED
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
import { type InjectionKey } from 'vue';
|
|
2
|
-
import
|
|
2
|
+
import { type z } from 'zod';
|
|
3
3
|
import type { InjectedFormData } from './types';
|
|
4
4
|
export declare enum FormStatus {
|
|
5
5
|
invalid = "invalid",
|
|
6
6
|
valid = "valid"
|
|
7
7
|
}
|
|
8
|
-
export declare const defineForm:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
default: () => {};
|
|
15
|
-
};
|
|
16
|
-
continuosValidation: {
|
|
17
|
-
type: BooleanConstructor;
|
|
18
|
-
default: boolean;
|
|
19
|
-
};
|
|
8
|
+
export declare const defineForm: <Schema extends z.AnyZodObject | z.ZodEffects<z.AnyZodObject, {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
}> | z.ZodEffects<z.ZodEffects<z.AnyZodObject, {
|
|
13
|
+
[x: string]: any;
|
|
20
14
|
}, {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type: ObjectConstructor;
|
|
25
|
-
default: () => {};
|
|
26
|
-
};
|
|
27
|
-
continuosValidation: {
|
|
28
|
-
type: BooleanConstructor;
|
|
29
|
-
default: boolean;
|
|
30
|
-
};
|
|
31
|
-
}>> & {
|
|
32
|
-
onValid?: ((...args: any[]) => any) | undefined;
|
|
33
|
-
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
34
|
-
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
35
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
}>, {
|
|
17
|
+
[x: string]: any;
|
|
36
18
|
}, {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
}>>(schema: Schema, provideKey: InjectionKey<InjectedFormData<Schema>>, options?: {
|
|
21
|
+
updateThrottle?: number;
|
|
22
|
+
continuosValidation?: boolean;
|
|
23
|
+
}) => {
|
|
24
|
+
errors: import("vue").Ref<z.ZodFormattedError<z.TypeOf<Schema>> | undefined>;
|
|
25
|
+
status: import("vue").Ref<FormStatus | undefined>;
|
|
26
|
+
formData: import("vue").Ref<Partial<z.TypeOf<Schema> | undefined>>;
|
|
27
|
+
component: import("vue").DefineComponent<{
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: ObjectConstructor;
|
|
30
|
+
default: () => {};
|
|
31
|
+
};
|
|
32
|
+
continuosValidation: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
submit: () => boolean;
|
|
38
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("valid" | "invalid" | "submit" | "update:modelValue")[], "valid" | "invalid" | "submit" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: ObjectConstructor;
|
|
41
|
+
default: () => {};
|
|
42
|
+
};
|
|
43
|
+
continuosValidation: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
}>> & {
|
|
48
|
+
onValid?: ((...args: any[]) => any) | undefined;
|
|
49
|
+
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
50
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
51
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
modelValue: Record<string, any>;
|
|
54
|
+
continuosValidation: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
package/dist/VvFormField.d.ts
CHANGED
|
@@ -1,3 +1,95 @@
|
|
|
1
|
-
import { type Component, type InjectionKey } from 'vue';
|
|
1
|
+
import { type Component, type InjectionKey, type PropType, type Ref, type ConcreteComponent } from 'vue';
|
|
2
|
+
import type { AnyZodObject, ZodEffects, z } from 'zod';
|
|
3
|
+
import { FormFieldType } from './enums';
|
|
2
4
|
import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormComposableOptions } from './types';
|
|
3
|
-
export declare const defineFormField:
|
|
5
|
+
export declare const defineFormField: <Schema extends AnyZodObject | ZodEffects<AnyZodObject, {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
}, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}> | ZodEffects<ZodEffects<AnyZodObject, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
}>, {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}, {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}>>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?: FormComposableOptions) => import("vue").DefineComponent<{
|
|
18
|
+
type: {
|
|
19
|
+
type: PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
20
|
+
validator: (value: FormFieldType) => boolean;
|
|
21
|
+
default: FormFieldType;
|
|
22
|
+
};
|
|
23
|
+
is: {
|
|
24
|
+
type: PropType<Component>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
name: {
|
|
28
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
props: {
|
|
32
|
+
type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
|
|
33
|
+
default: () => {};
|
|
34
|
+
};
|
|
35
|
+
showValid: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
defaultValue: {
|
|
40
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
component: import("vue").ComputedRef<{
|
|
45
|
+
new (...args: any[]): any;
|
|
46
|
+
__isFragment?: undefined;
|
|
47
|
+
__isTeleport?: undefined;
|
|
48
|
+
__isSuspense?: undefined;
|
|
49
|
+
} | ConcreteComponent>;
|
|
50
|
+
hasProps: import("vue").ComputedRef<any>;
|
|
51
|
+
invalid: import("vue").ComputedRef<boolean>;
|
|
52
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("valid" | "invalid" | "update:modelValue" | "update:formData")[], "valid" | "invalid" | "update:modelValue" | "update:formData", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
type: {
|
|
54
|
+
type: PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
55
|
+
validator: (value: FormFieldType) => boolean;
|
|
56
|
+
default: FormFieldType;
|
|
57
|
+
};
|
|
58
|
+
is: {
|
|
59
|
+
type: PropType<Component>;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
name: {
|
|
63
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
64
|
+
required: true;
|
|
65
|
+
};
|
|
66
|
+
props: {
|
|
67
|
+
type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
|
|
68
|
+
default: () => {};
|
|
69
|
+
};
|
|
70
|
+
showValid: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
defaultValue: {
|
|
75
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
}>> & {
|
|
79
|
+
onValid?: ((...args: any[]) => any) | undefined;
|
|
80
|
+
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
81
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
82
|
+
"onUpdate:formData"?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
type: "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom";
|
|
85
|
+
props: [{
|
|
86
|
+
type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
|
|
87
|
+
default: () => {};
|
|
88
|
+
}] extends [import("vue").Prop<infer V, infer D>] ? unknown extends V ? import("@vue/shared").IfAny<V, V, D> : V : {
|
|
89
|
+
type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
|
|
90
|
+
default: () => {};
|
|
91
|
+
};
|
|
92
|
+
is: Component;
|
|
93
|
+
showValid: boolean;
|
|
94
|
+
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
95
|
+
}>;
|
package/dist/VvFormWrapper.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { AnyZodObject, ZodEffects } from 'zod';
|
|
2
3
|
import type { InjectedFormData, InjectedFormWrapperData } from './types';
|
|
3
|
-
export declare const defineFormWrapper:
|
|
4
|
+
export declare const defineFormWrapper: <Schema extends AnyZodObject | ZodEffects<AnyZodObject, {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}> | ZodEffects<ZodEffects<AnyZodObject, {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
}>, {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
}, {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
}>>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>) => import("vue").DefineComponent<{
|
|
4
17
|
name: {
|
|
5
18
|
type: StringConstructor;
|
|
6
19
|
required: true;
|
|
@@ -10,7 +23,7 @@ export declare const defineFormWrapper: (formProvideKey: InjectionKey<InjectedFo
|
|
|
10
23
|
default: undefined;
|
|
11
24
|
};
|
|
12
25
|
}, {
|
|
13
|
-
formProvided: InjectedFormData | undefined;
|
|
26
|
+
formProvided: InjectedFormData<Schema> | undefined;
|
|
14
27
|
invalid: import("vue").ComputedRef<boolean>;
|
|
15
28
|
fields: Ref<Set<string>>;
|
|
16
29
|
errors: Ref<Map<string, Record<string, {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,19 @@ import { defineFormField } from './VvFormField';
|
|
|
4
4
|
import { defineForm } from './VvForm';
|
|
5
5
|
import { defineFormWrapper } from './VvFormWrapper';
|
|
6
6
|
import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormComposableOptions, FormPluginOptions } from './types';
|
|
7
|
-
export declare const formFactory:
|
|
7
|
+
export declare const formFactory: <Schema extends AnyZodObject | ZodEffects<AnyZodObject, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}> | ZodEffects<ZodEffects<AnyZodObject, {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
}, {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}>, {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}, {
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
}>>(schema: Schema, options?: FormComposableOptions) => {
|
|
8
20
|
VvForm: import("vue").DefineComponent<{
|
|
9
21
|
modelValue: {
|
|
10
22
|
type: ObjectConstructor;
|
|
@@ -44,7 +56,7 @@ export declare const formFactory: (schema: AnyZodObject | ZodEffects<AnyZodObjec
|
|
|
44
56
|
default: undefined;
|
|
45
57
|
};
|
|
46
58
|
}, {
|
|
47
|
-
formProvided: InjectedFormData | undefined;
|
|
59
|
+
formProvided: InjectedFormData<Schema> | undefined;
|
|
48
60
|
invalid: import("vue").ComputedRef<boolean>;
|
|
49
61
|
fields: import("vue").Ref<Set<string>>;
|
|
50
62
|
errors: import("vue").Ref<Map<string, Record<string, {
|
|
@@ -65,14 +77,107 @@ export declare const formFactory: (schema: AnyZodObject | ZodEffects<AnyZodObjec
|
|
|
65
77
|
}, {
|
|
66
78
|
tag: string;
|
|
67
79
|
}>;
|
|
68
|
-
VvFormField: import("vue").
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
VvFormField: import("vue").DefineComponent<{
|
|
81
|
+
type: {
|
|
82
|
+
type: import("vue").PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
83
|
+
validator: (value: import("./enums").FormFieldType) => boolean;
|
|
84
|
+
default: import("./enums").FormFieldType;
|
|
85
|
+
};
|
|
86
|
+
is: {
|
|
87
|
+
type: import("vue").PropType<import("vue").Component>;
|
|
88
|
+
default: undefined;
|
|
89
|
+
};
|
|
90
|
+
name: {
|
|
91
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
92
|
+
required: true;
|
|
93
|
+
};
|
|
94
|
+
props: {
|
|
95
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
96
|
+
default: () => {};
|
|
97
|
+
};
|
|
98
|
+
showValid: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
default: boolean;
|
|
101
|
+
};
|
|
102
|
+
defaultValue: {
|
|
103
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
104
|
+
default: undefined;
|
|
105
|
+
};
|
|
106
|
+
}, {
|
|
107
|
+
component: import("vue").ComputedRef<{
|
|
108
|
+
new (...args: any[]): any;
|
|
109
|
+
__isFragment?: undefined;
|
|
110
|
+
__isTeleport?: undefined;
|
|
111
|
+
__isSuspense?: undefined;
|
|
112
|
+
} | import("vue").ConcreteComponent>;
|
|
113
|
+
hasProps: import("vue").ComputedRef<any>;
|
|
114
|
+
invalid: import("vue").ComputedRef<boolean>;
|
|
115
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("valid" | "invalid" | "update:modelValue" | "update:formData")[], "valid" | "invalid" | "update:modelValue" | "update:formData", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
116
|
+
type: {
|
|
117
|
+
type: import("vue").PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
118
|
+
validator: (value: import("./enums").FormFieldType) => boolean;
|
|
119
|
+
default: import("./enums").FormFieldType;
|
|
120
|
+
};
|
|
121
|
+
is: {
|
|
122
|
+
type: import("vue").PropType<import("vue").Component>;
|
|
123
|
+
default: undefined;
|
|
124
|
+
};
|
|
125
|
+
name: {
|
|
126
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
127
|
+
required: true;
|
|
128
|
+
};
|
|
129
|
+
props: {
|
|
130
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
131
|
+
default: () => {};
|
|
132
|
+
};
|
|
133
|
+
showValid: {
|
|
134
|
+
type: BooleanConstructor;
|
|
135
|
+
default: boolean;
|
|
136
|
+
};
|
|
137
|
+
defaultValue: {
|
|
138
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
139
|
+
default: undefined;
|
|
140
|
+
};
|
|
141
|
+
}>> & {
|
|
142
|
+
onValid?: ((...args: any[]) => any) | undefined;
|
|
143
|
+
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
144
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
145
|
+
"onUpdate:formData"?: ((...args: any[]) => any) | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
type: "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom";
|
|
148
|
+
props: [{
|
|
149
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
150
|
+
default: () => {};
|
|
151
|
+
}] extends [import("vue").Prop<infer V, infer D>] ? unknown extends V ? import("@vue/shared").IfAny<V, V, D> : V : {
|
|
152
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
153
|
+
default: () => {};
|
|
154
|
+
};
|
|
155
|
+
is: import("vue").Component;
|
|
156
|
+
showValid: boolean;
|
|
157
|
+
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
158
|
+
}>;
|
|
159
|
+
formInjectionKey: InjectionKey<InjectedFormData<Schema>>;
|
|
160
|
+
formWrapperInjectionKey: InjectionKey<InjectedFormWrapperData<Schema>>;
|
|
161
|
+
formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>;
|
|
162
|
+
errors: import("vue").Ref<import("zod").ZodFormattedError<import("zod").TypeOf<Schema>> | undefined>;
|
|
163
|
+
status: import("vue").Ref<import("./VvForm").FormStatus | undefined>;
|
|
164
|
+
formData: import("vue").Ref<Partial<import("zod").TypeOf<Schema> | undefined>>;
|
|
72
165
|
};
|
|
73
166
|
export declare const pluginInjectionKey: InjectionKey<FormPluginOptions>;
|
|
74
167
|
export declare const createForm: (options: FormPluginOptions) => Plugin & Partial<ReturnType<typeof useForm>>;
|
|
75
|
-
export declare const useForm:
|
|
168
|
+
export declare const useForm: <Schema extends AnyZodObject | ZodEffects<AnyZodObject, {
|
|
169
|
+
[x: string]: any;
|
|
170
|
+
}, {
|
|
171
|
+
[x: string]: any;
|
|
172
|
+
}> | ZodEffects<ZodEffects<AnyZodObject, {
|
|
173
|
+
[x: string]: any;
|
|
174
|
+
}, {
|
|
175
|
+
[x: string]: any;
|
|
176
|
+
}>, {
|
|
177
|
+
[x: string]: any;
|
|
178
|
+
}, {
|
|
179
|
+
[x: string]: any;
|
|
180
|
+
}>>(schema: Schema, options?: FormComposableOptions) => {
|
|
76
181
|
VvForm: import("vue").DefineComponent<{
|
|
77
182
|
modelValue: {
|
|
78
183
|
type: ObjectConstructor;
|
|
@@ -112,7 +217,7 @@ export declare const useForm: (schema: AnyZodObject | ZodEffects<AnyZodObject>,
|
|
|
112
217
|
default: undefined;
|
|
113
218
|
};
|
|
114
219
|
}, {
|
|
115
|
-
formProvided: InjectedFormData | undefined;
|
|
220
|
+
formProvided: InjectedFormData<Schema> | undefined;
|
|
116
221
|
invalid: import("vue").ComputedRef<boolean>;
|
|
117
222
|
fields: import("vue").Ref<Set<string>>;
|
|
118
223
|
errors: import("vue").Ref<Map<string, Record<string, {
|
|
@@ -133,10 +238,91 @@ export declare const useForm: (schema: AnyZodObject | ZodEffects<AnyZodObject>,
|
|
|
133
238
|
}, {
|
|
134
239
|
tag: string;
|
|
135
240
|
}>;
|
|
136
|
-
VvFormField: import("vue").
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
241
|
+
VvFormField: import("vue").DefineComponent<{
|
|
242
|
+
type: {
|
|
243
|
+
type: import("vue").PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
244
|
+
validator: (value: import("./enums").FormFieldType) => boolean;
|
|
245
|
+
default: import("./enums").FormFieldType;
|
|
246
|
+
};
|
|
247
|
+
is: {
|
|
248
|
+
type: import("vue").PropType<import("vue").Component>;
|
|
249
|
+
default: undefined;
|
|
250
|
+
};
|
|
251
|
+
name: {
|
|
252
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
253
|
+
required: true;
|
|
254
|
+
};
|
|
255
|
+
props: {
|
|
256
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
257
|
+
default: () => {};
|
|
258
|
+
};
|
|
259
|
+
showValid: {
|
|
260
|
+
type: BooleanConstructor;
|
|
261
|
+
default: boolean;
|
|
262
|
+
};
|
|
263
|
+
defaultValue: {
|
|
264
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
265
|
+
default: undefined;
|
|
266
|
+
};
|
|
267
|
+
}, {
|
|
268
|
+
component: import("vue").ComputedRef<{
|
|
269
|
+
new (...args: any[]): any;
|
|
270
|
+
__isFragment?: undefined;
|
|
271
|
+
__isTeleport?: undefined;
|
|
272
|
+
__isSuspense?: undefined;
|
|
273
|
+
} | import("vue").ConcreteComponent>;
|
|
274
|
+
hasProps: import("vue").ComputedRef<any>;
|
|
275
|
+
invalid: import("vue").ComputedRef<boolean>;
|
|
276
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("valid" | "invalid" | "update:modelValue" | "update:formData")[], "valid" | "invalid" | "update:modelValue" | "update:formData", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
277
|
+
type: {
|
|
278
|
+
type: import("vue").PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
279
|
+
validator: (value: import("./enums").FormFieldType) => boolean;
|
|
280
|
+
default: import("./enums").FormFieldType;
|
|
281
|
+
};
|
|
282
|
+
is: {
|
|
283
|
+
type: import("vue").PropType<import("vue").Component>;
|
|
284
|
+
default: undefined;
|
|
285
|
+
};
|
|
286
|
+
name: {
|
|
287
|
+
type: (SymbolConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
|
|
288
|
+
required: true;
|
|
289
|
+
};
|
|
290
|
+
props: {
|
|
291
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
292
|
+
default: () => {};
|
|
293
|
+
};
|
|
294
|
+
showValid: {
|
|
295
|
+
type: BooleanConstructor;
|
|
296
|
+
default: boolean;
|
|
297
|
+
};
|
|
298
|
+
defaultValue: {
|
|
299
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
300
|
+
default: undefined;
|
|
301
|
+
};
|
|
302
|
+
}>> & {
|
|
303
|
+
onValid?: ((...args: any[]) => any) | undefined;
|
|
304
|
+
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
305
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
306
|
+
"onUpdate:formData"?: ((...args: any[]) => any) | undefined;
|
|
307
|
+
}, {
|
|
308
|
+
type: "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom";
|
|
309
|
+
props: [{
|
|
310
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
311
|
+
default: () => {};
|
|
312
|
+
}] extends [import("vue").Prop<infer V, infer D>] ? unknown extends V ? import("@vue/shared").IfAny<V, V, D> : V : {
|
|
313
|
+
type: import("vue").PropType<Partial<import("zod").TypeOf<Schema> | ((formData?: import("vue").Ref<ObjectConstructor> | undefined) => Partial<import("zod").TypeOf<Schema>> | undefined) | undefined>>;
|
|
314
|
+
default: () => {};
|
|
315
|
+
};
|
|
316
|
+
is: import("vue").Component;
|
|
317
|
+
showValid: boolean;
|
|
318
|
+
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
319
|
+
}>;
|
|
320
|
+
formInjectionKey: InjectionKey<InjectedFormData<Schema>>;
|
|
321
|
+
formWrapperInjectionKey: InjectionKey<InjectedFormWrapperData<Schema>>;
|
|
322
|
+
formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>;
|
|
323
|
+
errors: import("vue").Ref<import("zod").ZodFormattedError<import("zod").TypeOf<Schema>> | undefined>;
|
|
324
|
+
status: import("vue").Ref<import("./VvForm").FormStatus | undefined>;
|
|
325
|
+
formData: import("vue").Ref<Partial<import("zod").TypeOf<Schema> | undefined>>;
|
|
140
326
|
};
|
|
141
327
|
export { FormFieldType } from './enums';
|
|
142
328
|
export { defaultObjectBySchema } from './utils';
|