@volverjs/form-vue 1.0.0-beta.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils.ts CHANGED
@@ -1,104 +1,125 @@
1
1
  import {
2
- type z,
3
- type AnyZodObject,
4
- type ZodTypeAny,
5
- ZodDefault,
6
- ZodObject,
7
- ZodEffects,
8
- ZodSchema,
9
- ZodNullable,
10
- ZodOptional,
11
- ZodArray,
2
+
3
+ ZodDefault,
4
+ ZodObject,
5
+ ZodEffects,
6
+ ZodSchema,
7
+ ZodNullable,
8
+ ZodOptional,
9
+ ZodRecord,
10
+ ZodArray,
12
11
  } from 'zod'
13
- import type { FormSchema } from './types'
12
+ import type { z, AnyZodObject, ZodTypeAny } from 'zod'
13
+ import type { EffectType, FormSchema } from './types'
14
14
 
15
- export const defaultObjectBySchema = <Schema extends FormSchema>(
16
- schema: Schema,
17
- original: Partial<z.infer<Schema>> & Record<string, unknown> = {},
18
- ): Partial<z.infer<Schema>> => {
19
- const getInnerType = <Type extends ZodTypeAny>(
20
- schema:
21
- | Type
22
- | ZodEffects<Type>
23
- | ZodEffects<ZodEffects<Type>>
24
- | ZodOptional<Type>,
25
- ) => {
26
- let toReturn = schema
27
- while (toReturn instanceof ZodEffects) {
28
- toReturn = toReturn.innerType()
29
- }
30
- if (toReturn instanceof ZodOptional) {
31
- toReturn = toReturn._def.innerType
32
- }
33
- return toReturn
34
- }
35
- const innerType = getInnerType<AnyZodObject>(schema)
36
- const unknownKeys =
37
- innerType instanceof ZodObject
38
- ? innerType._def.unknownKeys === 'passthrough'
39
- : false
40
- return {
41
- ...(unknownKeys ? original : {}),
42
- ...Object.fromEntries(
43
- (Object.entries(innerType.shape) as [string, ZodTypeAny][]).map(
44
- ([key, subSchema]) => {
45
- const originalValue = original[key]
46
- let innerType = getInnerType(subSchema)
47
- let defaultValue: Partial<z.infer<Schema>> | undefined =
48
- undefined
49
- if (innerType instanceof ZodDefault) {
50
- defaultValue = innerType._def.defaultValue()
51
- innerType = innerType._def.innerType
52
- }
53
- if (
54
- originalValue === null &&
55
- innerType instanceof ZodNullable
56
- ) {
57
- return [key, originalValue]
58
- }
59
- if (innerType instanceof ZodSchema) {
60
- const parse = subSchema.safeParse(originalValue)
61
- if (parse.success) {
62
- return [key, parse.data ?? defaultValue]
63
- }
64
- }
65
- if (
66
- innerType instanceof ZodArray &&
67
- Array.isArray(originalValue) &&
68
- originalValue.length
69
- ) {
70
- const arrayType = getInnerType(innerType._def.type)
71
- if (arrayType instanceof ZodObject) {
72
- return [
73
- key,
74
- originalValue.map((element: unknown) =>
75
- defaultObjectBySchema(
76
- arrayType,
77
- (element && typeof element === 'object'
78
- ? element
79
- : undefined) as Partial<
80
- typeof arrayType
81
- >,
82
- ),
83
- ) ?? defaultValue,
84
- ]
85
- }
86
- }
87
- if (innerType instanceof ZodObject) {
88
- return [
89
- key,
90
- defaultObjectBySchema(
91
- innerType,
92
- originalValue &&
93
- typeof originalValue === 'object'
94
- ? originalValue
95
- : defaultValue,
96
- ),
97
- ]
98
- }
99
- return [key, defaultValue]
100
- },
101
- ),
102
- ),
103
- } as Partial<z.infer<Schema>>
15
+ export function defaultObjectBySchema<Schema extends FormSchema>(schema: Schema, original: Partial<z.infer<Schema>> & Record<string, unknown> = {}): Partial<z.infer<Schema>> {
16
+ const getSchemaInnerType = <Type extends ZodTypeAny>(
17
+ schema: EffectType<Type>,
18
+ ) => {
19
+ let toReturn = schema
20
+ while (toReturn instanceof ZodEffects) {
21
+ toReturn = toReturn.innerType()
22
+ }
23
+ if (toReturn instanceof ZodOptional) {
24
+ toReturn = toReturn._def.innerType
25
+ }
26
+ return toReturn
27
+ }
28
+ const isSchemaOptional = <Type extends ZodTypeAny>(
29
+ schema:
30
+ | Type
31
+ | ZodEffects<Type>
32
+ | ZodEffects<ZodEffects<Type>>
33
+ | ZodOptional<Type>,
34
+ ) => {
35
+ let toReturn = schema
36
+ while (toReturn instanceof ZodEffects) {
37
+ toReturn = toReturn.innerType()
38
+ }
39
+ if (toReturn instanceof ZodOptional) {
40
+ return true
41
+ }
42
+ return false
43
+ }
44
+ const innerType = getSchemaInnerType<AnyZodObject>(schema)
45
+ const unknownKeys
46
+ = innerType instanceof ZodObject
47
+ ? innerType._def.unknownKeys === 'passthrough'
48
+ : false
49
+ return {
50
+ ...(unknownKeys ? original : {}),
51
+ ...Object.fromEntries(
52
+ (Object.entries(innerType.shape) as [string, ZodTypeAny][]).map(
53
+ ([key, subSchema]) => {
54
+ const originalValue = original[key]
55
+ const isOptional = isSchemaOptional(subSchema)
56
+ let innerType = getSchemaInnerType(subSchema)
57
+ let defaultValue: Partial<z.infer<Schema>> | undefined
58
+ if (innerType instanceof ZodDefault) {
59
+ defaultValue = innerType._def.defaultValue()
60
+ innerType = innerType._def.innerType
61
+ }
62
+ if (
63
+ originalValue === null
64
+ && innerType instanceof ZodNullable
65
+ ) {
66
+ return [key, originalValue]
67
+ }
68
+ if ((originalValue === undefined || originalValue === null) && isOptional) {
69
+ return [key, defaultValue]
70
+ }
71
+ if (innerType instanceof ZodSchema) {
72
+ const parse = subSchema.safeParse(originalValue)
73
+ if (parse.success) {
74
+ return [key, parse.data ?? defaultValue]
75
+ }
76
+ }
77
+ if (
78
+ innerType instanceof ZodArray
79
+ && Array.isArray(originalValue)
80
+ && originalValue.length
81
+ ) {
82
+ const arrayType = getSchemaInnerType(innerType._def.type)
83
+ if (arrayType instanceof ZodObject) {
84
+ return [
85
+ key,
86
+ originalValue.map((element: unknown) =>
87
+ defaultObjectBySchema(
88
+ arrayType,
89
+ (element && typeof element === 'object'
90
+ ? element
91
+ : undefined) as Partial<
92
+ typeof arrayType
93
+ >,
94
+ ),
95
+ ),
96
+ ]
97
+ }
98
+ }
99
+ if (innerType instanceof ZodRecord && originalValue) {
100
+ const valueType = getSchemaInnerType(innerType._def.valueType)
101
+ if (valueType instanceof ZodObject) {
102
+ return [key, Object.keys(originalValue).reduce((acc: Record<string, unknown>, recordKey: string) => {
103
+ acc[recordKey] = defaultObjectBySchema(valueType, (originalValue as Record<string, unknown>)[recordKey] as Partial<any> & Record<string, unknown>)
104
+ return acc
105
+ }, {})]
106
+ }
107
+ }
108
+ if (innerType instanceof ZodObject) {
109
+ return [
110
+ key,
111
+ defaultObjectBySchema(
112
+ innerType,
113
+ originalValue
114
+ && typeof originalValue === 'object'
115
+ ? (originalValue as Partial<z.infer<Schema>> & Record<string, unknown>)
116
+ : defaultValue,
117
+ ),
118
+ ]
119
+ }
120
+ return [key, defaultValue]
121
+ },
122
+ ),
123
+ ),
124
+ } as Partial<z.infer<Schema>>
104
125
  }
@@ -1,202 +0,0 @@
1
- import { type Component, type InjectionKey, type DeepReadonly, type Ref, type PropType, type WatchStopHandle } from 'vue';
2
- import { type IgnoredUpdater } from '@vueuse/core';
3
- import { type z, type TypeOf } from 'zod';
4
- import type { FormComponentOptions, FormSchema, FormTemplate, InjectedFormData } from './types';
5
- import { FormStatus } from './enums';
6
- export declare const defineForm: <Schema extends FormSchema>(schema: Schema, provideKey: InjectionKey<InjectedFormData<Schema>>, options?: FormComponentOptions<Schema> | undefined, VvFormTemplate?: Component) => {
7
- errors: Ref<z.inferFormattedError<Schema, string> | undefined>;
8
- status: Ref<FormStatus | undefined>;
9
- invalid: import("vue").ComputedRef<boolean>;
10
- readonly: Ref<boolean>;
11
- formData: Ref<Partial<z.TypeOf<Schema> | undefined>>;
12
- validate: (value?: Partial<z.TypeOf<Schema> | undefined>) => Promise<boolean>;
13
- submit: () => Promise<boolean>;
14
- ignoreUpdates: IgnoredUpdater;
15
- stopUpdatesWatch: WatchStopHandle;
16
- /**
17
- * An hack to add types to the default slot
18
- */
19
- VvForm: {
20
- new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
21
- continuosValidation: {
22
- type: BooleanConstructor;
23
- default: boolean;
24
- };
25
- modelValue: {
26
- type: ObjectConstructor;
27
- default: () => {};
28
- };
29
- readonly: {
30
- type: BooleanConstructor;
31
- default: boolean;
32
- };
33
- tag: {
34
- type: StringConstructor;
35
- default: string;
36
- };
37
- template: {
38
- type: PropType<FormTemplate<Schema>>;
39
- default: undefined;
40
- };
41
- }>> & {
42
- onInvalid?: ((...args: any[]) => any) | undefined;
43
- onValid?: ((...args: any[]) => any) | undefined;
44
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
45
- onSubmit?: ((...args: any[]) => any) | undefined;
46
- "onUpdate:readonly"?: ((...args: any[]) => any) | undefined;
47
- }, {
48
- formData: Ref<Partial<z.TypeOf<Schema> | undefined>>;
49
- submit: () => Promise<boolean>;
50
- validate: (value?: Partial<z.TypeOf<Schema> | undefined>) => Promise<boolean>;
51
- ignoreUpdates: IgnoredUpdater;
52
- stopUpdatesWatch: WatchStopHandle;
53
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>;
54
- status: Readonly<Ref<FormStatus | undefined>>;
55
- invalid: import("vue").ComputedRef<boolean>;
56
- isReadonly: Ref<boolean>;
57
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "update:modelValue" | "submit" | "update:readonly")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
58
- continuosValidation: {
59
- type: BooleanConstructor;
60
- default: boolean;
61
- };
62
- modelValue: {
63
- type: ObjectConstructor;
64
- default: () => {};
65
- };
66
- readonly: {
67
- type: BooleanConstructor;
68
- default: boolean;
69
- };
70
- tag: {
71
- type: StringConstructor;
72
- default: string;
73
- };
74
- template: {
75
- type: PropType<FormTemplate<Schema>>;
76
- default: undefined;
77
- };
78
- }>> & {
79
- onInvalid?: ((...args: any[]) => any) | undefined;
80
- onValid?: ((...args: any[]) => any) | undefined;
81
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
82
- onSubmit?: ((...args: any[]) => any) | undefined;
83
- "onUpdate:readonly"?: ((...args: any[]) => any) | undefined;
84
- }, {
85
- readonly: boolean;
86
- template: FormTemplate<Schema>;
87
- modelValue: Record<string, any>;
88
- continuosValidation: boolean;
89
- tag: string;
90
- }, true, {}, {}, {
91
- P: {};
92
- B: {};
93
- D: {};
94
- C: {};
95
- M: {};
96
- Defaults: {};
97
- }, Readonly<import("vue").ExtractPropTypes<{
98
- continuosValidation: {
99
- type: BooleanConstructor;
100
- default: boolean;
101
- };
102
- modelValue: {
103
- type: ObjectConstructor;
104
- default: () => {};
105
- };
106
- readonly: {
107
- type: BooleanConstructor;
108
- default: boolean;
109
- };
110
- tag: {
111
- type: StringConstructor;
112
- default: string;
113
- };
114
- template: {
115
- type: PropType<FormTemplate<Schema>>;
116
- default: undefined;
117
- };
118
- }>> & {
119
- onInvalid?: ((...args: any[]) => any) | undefined;
120
- onValid?: ((...args: any[]) => any) | undefined;
121
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
122
- onSubmit?: ((...args: any[]) => any) | undefined;
123
- "onUpdate:readonly"?: ((...args: any[]) => any) | undefined;
124
- }, {
125
- formData: Ref<Partial<z.TypeOf<Schema> | undefined>>;
126
- submit: () => Promise<boolean>;
127
- validate: (value?: Partial<z.TypeOf<Schema> | undefined>) => Promise<boolean>;
128
- ignoreUpdates: IgnoredUpdater;
129
- stopUpdatesWatch: WatchStopHandle;
130
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>;
131
- status: Readonly<Ref<FormStatus | undefined>>;
132
- invalid: import("vue").ComputedRef<boolean>;
133
- isReadonly: Ref<boolean>;
134
- }, {}, {}, {}, {
135
- readonly: boolean;
136
- template: FormTemplate<Schema>;
137
- modelValue: Record<string, any>;
138
- continuosValidation: boolean;
139
- tag: string;
140
- }>;
141
- __isFragment?: undefined;
142
- __isTeleport?: undefined;
143
- __isSuspense?: undefined;
144
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
145
- continuosValidation: {
146
- type: BooleanConstructor;
147
- default: boolean;
148
- };
149
- modelValue: {
150
- type: ObjectConstructor;
151
- default: () => {};
152
- };
153
- readonly: {
154
- type: BooleanConstructor;
155
- default: boolean;
156
- };
157
- tag: {
158
- type: StringConstructor;
159
- default: string;
160
- };
161
- template: {
162
- type: PropType<FormTemplate<Schema>>;
163
- default: undefined;
164
- };
165
- }>> & {
166
- onInvalid?: ((...args: any[]) => any) | undefined;
167
- onValid?: ((...args: any[]) => any) | undefined;
168
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
169
- onSubmit?: ((...args: any[]) => any) | undefined;
170
- "onUpdate:readonly"?: ((...args: any[]) => any) | undefined;
171
- }, {
172
- formData: Ref<Partial<z.TypeOf<Schema> | undefined>>;
173
- submit: () => Promise<boolean>;
174
- validate: (value?: Partial<z.TypeOf<Schema> | undefined>) => Promise<boolean>;
175
- ignoreUpdates: IgnoredUpdater;
176
- stopUpdatesWatch: WatchStopHandle;
177
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>;
178
- status: Readonly<Ref<FormStatus | undefined>>;
179
- invalid: import("vue").ComputedRef<boolean>;
180
- isReadonly: Ref<boolean>;
181
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "update:modelValue" | "submit" | "update:readonly")[], "invalid" | "valid" | "update:modelValue" | "submit" | "update:readonly", {
182
- readonly: boolean;
183
- template: FormTemplate<Schema>;
184
- modelValue: Record<string, any>;
185
- continuosValidation: boolean;
186
- tag: string;
187
- }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
188
- $slots: {
189
- default: (_: {
190
- formData: unknown extends Partial<z.TypeOf<Schema>> | undefined ? undefined : Partial<z.TypeOf<Schema>> | undefined;
191
- submit: () => Promise<boolean>;
192
- validate: () => Promise<boolean>;
193
- ignoreUpdates: IgnoredUpdater;
194
- stopUpdatesWatch: WatchStopHandle;
195
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>>>>;
196
- status: Ref<DeepReadonly<`${FormStatus}` | undefined>>;
197
- invalid: Ref<DeepReadonly<boolean>>;
198
- readonly: Ref<boolean>;
199
- }) => any;
200
- };
201
- });
202
- };
@@ -1,116 +0,0 @@
1
- import { type Component, type InjectionKey, type PropType, type Ref, type ConcreteComponent } from 'vue';
2
- import type { z } from 'zod';
3
- import { FormFieldType } from './enums';
4
- import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormFieldComponentOptions, Path, FormSchema } from './types';
5
- export declare const defineFormField: <Schema extends FormSchema>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?: FormFieldComponentOptions) => import("vue").DefineComponent<{
6
- type: {
7
- type: PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
8
- validator: (value: FormFieldType) => boolean;
9
- default: FormFieldType;
10
- };
11
- is: {
12
- type: PropType<Component>;
13
- default: undefined;
14
- };
15
- name: {
16
- type: PropType<Path<z.TypeOf<Schema>>>;
17
- required: true;
18
- };
19
- props: {
20
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
21
- default: () => {};
22
- };
23
- showValid: {
24
- type: BooleanConstructor;
25
- default: boolean;
26
- };
27
- defaultValue: {
28
- type: (StringConstructor | ObjectConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor)[];
29
- default: undefined;
30
- };
31
- lazyLoad: {
32
- type: BooleanConstructor;
33
- default: boolean;
34
- };
35
- readonly: {
36
- type: BooleanConstructor;
37
- default: undefined;
38
- };
39
- }, {
40
- component: import("vue").ComputedRef<{
41
- new (...args: any[]): any;
42
- __isFragment?: undefined;
43
- __isTeleport?: undefined;
44
- __isSuspense?: undefined;
45
- } | ConcreteComponent>;
46
- hasProps: import("vue").ComputedRef<{
47
- name: {} | ([{
48
- type: PropType<Path<z.TypeOf<Schema>>>;
49
- required: true;
50
- }] extends [import("vue").Prop<infer V, infer D>] ? unknown extends V ? import("@vue/shared").IfAny<V, V, D> : V : {
51
- type: PropType<Path<z.TypeOf<Schema>>>;
52
- required: true;
53
- });
54
- invalid: boolean;
55
- valid: boolean | undefined;
56
- type: FormFieldType | undefined;
57
- invalidLabel: any;
58
- modelValue: any;
59
- readonly: {} | undefined;
60
- 'onUpdate:modelValue': (value: unknown) => void;
61
- }>;
62
- invalid: import("vue").ComputedRef<boolean>;
63
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "update:formData" | "update:modelValue")[], "invalid" | "valid" | "update:formData" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
64
- type: {
65
- type: PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
66
- validator: (value: FormFieldType) => boolean;
67
- default: FormFieldType;
68
- };
69
- is: {
70
- type: PropType<Component>;
71
- default: undefined;
72
- };
73
- name: {
74
- type: PropType<Path<z.TypeOf<Schema>>>;
75
- required: true;
76
- };
77
- props: {
78
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
79
- default: () => {};
80
- };
81
- showValid: {
82
- type: BooleanConstructor;
83
- default: boolean;
84
- };
85
- defaultValue: {
86
- type: (StringConstructor | ObjectConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor)[];
87
- default: undefined;
88
- };
89
- lazyLoad: {
90
- type: BooleanConstructor;
91
- default: boolean;
92
- };
93
- readonly: {
94
- type: BooleanConstructor;
95
- default: undefined;
96
- };
97
- }>> & {
98
- onInvalid?: ((...args: any[]) => any) | undefined;
99
- onValid?: ((...args: any[]) => any) | undefined;
100
- "onUpdate:formData"?: ((...args: any[]) => any) | undefined;
101
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
102
- }, {
103
- type: "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom";
104
- props: [{
105
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
106
- default: () => {};
107
- }] extends [import("vue").Prop<infer V, infer D>] ? unknown extends V ? import("@vue/shared").IfAny<V, V, D> : V : {
108
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.TypeOf<Schema>> | undefined) | undefined>>;
109
- default: () => {};
110
- };
111
- is: Component;
112
- showValid: boolean;
113
- defaultValue: string | number | boolean | unknown[] | Record<string, any>;
114
- lazyLoad: boolean;
115
- readonly: boolean;
116
- }, {}>;
@@ -1,60 +0,0 @@
1
- import { type Component, type PropType, type InjectionKey, type DeepReadonly, type Ref, type VNode } from 'vue';
2
- import type { TypeOf, z } from 'zod';
3
- import type { FormSchema, InjectedFormData, FormTemplate } from './types';
4
- import type { FormStatus } from './enums';
5
- export declare const defineFormTemplate: <Schema extends FormSchema>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, VvFormField: Component) => {
6
- new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
7
- schema: {
8
- type: PropType<FormTemplate<Schema>>;
9
- required: true;
10
- };
11
- }>>, (() => (VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
- [key: string]: any;
13
- }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
14
- [key: string]: any;
15
- }>[] | undefined)[]) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
16
- schema: {
17
- type: PropType<FormTemplate<Schema>>;
18
- required: true;
19
- };
20
- }>>, {}, true, {}, {}, {
21
- P: {};
22
- B: {};
23
- D: {};
24
- C: {};
25
- M: {};
26
- Defaults: {};
27
- }, Readonly<import("vue").ExtractPropTypes<{
28
- schema: {
29
- type: PropType<FormTemplate<Schema>>;
30
- required: true;
31
- };
32
- }>>, {} | (() => (VNode<import("vue").RendererNode, import("vue").RendererElement, {
33
- [key: string]: any;
34
- }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
35
- [key: string]: any;
36
- }>[] | undefined)[]), {}, {}, {}, {}>;
37
- __isFragment?: undefined;
38
- __isTeleport?: undefined;
39
- __isSuspense?: undefined;
40
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
41
- schema: {
42
- type: PropType<FormTemplate<Schema>>;
43
- required: true;
44
- };
45
- }>>, (() => (VNode<import("vue").RendererNode, import("vue").RendererElement, {
46
- [key: string]: any;
47
- }> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
48
- [key: string]: any;
49
- }>[] | undefined)[]) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
50
- $slots: {
51
- default: (_: {
52
- formData: unknown extends Partial<TypeOf<Schema>> | undefined ? undefined : Partial<TypeOf<Schema>> | undefined;
53
- submit: () => Promise<boolean>;
54
- validate: () => Promise<boolean>;
55
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>>>>;
56
- status: Ref<DeepReadonly<`${FormStatus}` | undefined>>;
57
- invalid: Ref<DeepReadonly<boolean>>;
58
- }) => any;
59
- };
60
- });