@volverjs/form-vue 1.0.0-beta.32 → 1.0.0-beta.33

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 CHANGED
@@ -85,11 +85,11 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
85
85
  modelValue: Record<string, any>;
86
86
  }, SlotsType<{
87
87
  default: {
88
- errors: import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined;
89
- formData: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined;
90
- invalid: boolean;
91
- readonly: boolean;
92
- status: FormStatus | undefined;
88
+ errors: UnwrapRef<Readonly<import('vue').Ref<import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined, import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>>;
89
+ formData: UnwrapRef<import('vue').Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined>>;
90
+ invalid: UnwrapRef<import('vue').ComputedRef<boolean>>;
91
+ readonly: UnwrapRef<import('vue').Ref<boolean, boolean>>;
92
+ status: UnwrapRef<Readonly<import('vue').Ref<FormStatus | undefined, FormStatus | undefined>>>;
93
93
  wrappers: typeof wrappers;
94
94
  clear: () => void;
95
95
  ignoreUpdates: import('@vueuse/core').IgnoredUpdater;
@@ -1,23 +1,23 @@
1
- import { Component, ConcreteComponent, DeepReadonly, InjectionKey, PropType, Ref, SlotsType, readonly } from 'vue';
1
+ import { Component, ConcreteComponent, DeepReadonly, InjectionKey, PropType, Ref, SlotsType } from 'vue';
2
2
  import { z } from 'zod';
3
3
  import { FormFieldType } from './enums';
4
4
  import { FormFieldComponentOptions, FormSchema, InjectedFormData, InjectedFormFieldData, InjectedFormWrapperData, Path } from './types';
5
5
  export declare function defineFormField<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?: FormFieldComponentOptions): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
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">;
7
+ type: PropType<`${FormFieldType}`>;
8
8
  validator: (value: FormFieldType) => boolean;
9
9
  default: FormFieldType;
10
10
  };
11
11
  is: {
12
- type: PropType<string | Component>;
12
+ type: PropType<Component | string>;
13
13
  default: undefined;
14
14
  };
15
15
  name: {
16
- type: PropType<Path<z.TypeOf<Schema>>>;
16
+ type: PropType<Path<z.infer<Schema>>>;
17
17
  required: true;
18
18
  };
19
19
  props: {
20
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
20
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
21
21
  default: () => {};
22
22
  };
23
23
  showValid: {
@@ -39,16 +39,16 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
39
39
  }>, {
40
40
  component: import('vue').ComputedRef<{
41
41
  new (...args: any[]): any;
42
- __isFragment?: undefined;
43
- __isTeleport?: undefined;
44
- __isSuspense?: undefined;
42
+ __isFragment?: never;
43
+ __isTeleport?: never;
44
+ __isSuspense?: never;
45
45
  } | ConcreteComponent>;
46
46
  hasProps: import('vue').ComputedRef<{
47
47
  name: {} | ([{
48
- type: PropType<Path<z.TypeOf<Schema>>>;
48
+ type: PropType<Path<z.infer<Schema>>>;
49
49
  required: true;
50
50
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
51
- type: PropType<Path<z.TypeOf<Schema>>>;
51
+ type: PropType<Path<z.infer<Schema>>>;
52
52
  required: true;
53
53
  });
54
54
  invalid: boolean;
@@ -62,20 +62,20 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
62
62
  invalid: import('vue').ComputedRef<boolean>;
63
63
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid" | "update:modelValue" | "update:formData")[], "invalid" | "valid" | "update:modelValue" | "update:formData", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
64
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">;
65
+ type: PropType<`${FormFieldType}`>;
66
66
  validator: (value: FormFieldType) => boolean;
67
67
  default: FormFieldType;
68
68
  };
69
69
  is: {
70
- type: PropType<string | Component>;
70
+ type: PropType<Component | string>;
71
71
  default: undefined;
72
72
  };
73
73
  name: {
74
- type: PropType<Path<z.TypeOf<Schema>>>;
74
+ type: PropType<Path<z.infer<Schema>>>;
75
75
  required: true;
76
76
  };
77
77
  props: {
78
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
78
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
79
79
  default: () => {};
80
80
  };
81
81
  showValid: {
@@ -103,10 +103,10 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
103
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
104
  readonly: boolean;
105
105
  props: [{
106
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
106
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
107
107
  default: () => {};
108
108
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
109
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
109
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
110
110
  default: () => {};
111
111
  };
112
112
  is: string | Component;
@@ -117,14 +117,14 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
117
117
  [key: string]: any;
118
118
  default: {
119
119
  errors: DeepReadonly<z.inferFormattedError<Schema>>;
120
- formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined;
121
- formErrors?: DeepReadonly<z.inferFormattedError<Schema, string>> | undefined;
120
+ formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
121
+ formErrors?: DeepReadonly<z.inferFormattedError<Schema, string>>;
122
122
  invalid: boolean;
123
- invalidLabel?: string[] | undefined;
123
+ invalidLabel?: string[];
124
124
  modelValue: any;
125
125
  readonly: boolean;
126
126
  onUpdate: (value: unknown) => void;
127
- submit?: (() => Promise<boolean>) | undefined;
128
- validate?: ((formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, fields?: Set<string> | undefined) => Promise<boolean>) | undefined;
127
+ submit?: InjectedFormData<Schema, Type>["submit"];
128
+ validate?: InjectedFormData<Schema, Type>["validate"];
129
129
  };
130
130
  }>, {}, {}, "invalid" | "type" | "errors" | "component" | "hasProps" | "invalidLabel" | "is", import('vue').ComponentProvideOptions, true, {}, any>;
@@ -1,17 +1,17 @@
1
- import { Component, DeepReadonly, InjectionKey, PropType, Ref, SlotsType, readonly } from 'vue';
1
+ import { Component, DeepReadonly, InjectionKey, PropType, Ref, SlotsType } from 'vue';
2
2
  import { z } from 'zod';
3
3
  import { FormSchema, InjectedFormData, InjectedFormFieldsGroupData, InjectedFormWrapperData, Path } from './types';
4
4
  export declare function defineFormFieldsGroup<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldsGroupInjectionKey: InjectionKey<InjectedFormFieldsGroupData<Schema>>): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
5
  is: {
6
- type: PropType<string | Component>;
6
+ type: PropType<Component | string>;
7
7
  default: undefined;
8
8
  };
9
9
  names: {
10
- type: PropType<Path<z.TypeOf<Schema>>[] | Record<string, Path<z.TypeOf<Schema>>>>;
10
+ type: PropType<Path<z.infer<Schema>>[] | Record<string, Path<z.infer<Schema>>>>;
11
11
  required: true;
12
12
  };
13
13
  props: {
14
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
14
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
15
15
  default: () => {};
16
16
  };
17
17
  showValid: {
@@ -19,7 +19,7 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
19
19
  default: boolean;
20
20
  };
21
21
  defaultValues: {
22
- type: PropType<Record<Path<z.TypeOf<Schema>>, any>>;
22
+ type: PropType<Record<Path<z.infer<Schema>>, any>>;
23
23
  default: undefined;
24
24
  };
25
25
  readonly: {
@@ -44,15 +44,15 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
44
44
  invalid: import('vue').ComputedRef<boolean>;
45
45
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid" | "update:modelValue" | "update:formData")[], "invalid" | "valid" | "update:modelValue" | "update:formData", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
46
46
  is: {
47
- type: PropType<string | Component>;
47
+ type: PropType<Component | string>;
48
48
  default: undefined;
49
49
  };
50
50
  names: {
51
- type: PropType<Path<z.TypeOf<Schema>>[] | Record<string, Path<z.TypeOf<Schema>>>>;
51
+ type: PropType<Path<z.infer<Schema>>[] | Record<string, Path<z.infer<Schema>>>>;
52
52
  required: true;
53
53
  };
54
54
  props: {
55
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
55
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
56
56
  default: () => {};
57
57
  };
58
58
  showValid: {
@@ -60,7 +60,7 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
60
60
  default: boolean;
61
61
  };
62
62
  defaultValues: {
63
- type: PropType<Record<Path<z.TypeOf<Schema>>, any>>;
63
+ type: PropType<Record<Path<z.infer<Schema>>, any>>;
64
64
  default: undefined;
65
65
  };
66
66
  readonly: {
@@ -75,35 +75,35 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
75
75
  }>, {
76
76
  readonly: boolean;
77
77
  props: [{
78
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
78
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
79
79
  default: () => {};
80
80
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
81
- type: PropType<Partial<z.TypeOf<Schema> | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined) | undefined>>;
81
+ type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
82
82
  default: () => {};
83
83
  };
84
84
  is: string | Component;
85
85
  showValid: boolean;
86
86
  defaultValues: [{
87
- type: PropType<Record<Path<z.TypeOf<Schema>>, any>>;
87
+ type: PropType<Record<Path<z.infer<Schema>>, any>>;
88
88
  default: undefined;
89
89
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
90
- type: PropType<Record<Path<z.TypeOf<Schema>>, any>>;
90
+ type: PropType<Record<Path<z.infer<Schema>>, any>>;
91
91
  default: undefined;
92
92
  };
93
93
  }, SlotsType<{
94
94
  [key: string]: any;
95
95
  default: {
96
- errors?: Record<Path<z.TypeOf<Schema>>, z.inferFormattedError<Schema, string>> | undefined;
97
- formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined;
98
- formErrors?: DeepReadonly<z.inferFormattedError<Schema, string>> | undefined;
96
+ errors?: Record<Path<z.infer<Schema>>, z.inferFormattedError<Schema>>;
97
+ formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
98
+ formErrors?: DeepReadonly<z.inferFormattedError<Schema>>;
99
99
  invalid: boolean;
100
100
  invalids: Record<string, boolean>;
101
- invalidLabels?: Record<string, string[]> | undefined;
101
+ invalidLabels?: Record<string, string[]>;
102
102
  modelValue: Record<string, any>;
103
103
  onUpdate: (value: Record<string, any>) => void;
104
104
  onUpdateField: (name: string, value: any) => void;
105
105
  readonly: boolean;
106
- submit?: (() => Promise<boolean>) | undefined;
107
- validate?: ((formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, fields?: Set<string> | undefined) => Promise<boolean>) | undefined;
106
+ submit?: InjectedFormData<Schema, Type>["submit"];
107
+ validate?: InjectedFormData<Schema, Type>["validate"];
108
108
  };
109
109
  }>, {}, {}, "invalid" | "errors" | "component" | "hasProps" | "is" | "invalidLabels", import('vue').ComponentProvideOptions, true, {}, any>;
@@ -32,9 +32,9 @@ export declare function defineFormTemplate<Schema extends FormSchema, Type = und
32
32
  formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
33
33
  invalid: boolean;
34
34
  status?: FormStatus;
35
- submit?: InjectedFormData<Schema, Type>['submit'];
36
- validate?: InjectedFormData<Schema, Type>['validate'];
37
- clear?: InjectedFormData<Schema, Type>['clear'];
38
- reset?: InjectedFormData<Schema, Type>['reset'];
35
+ submit?: InjectedFormData<Schema, Type>["submit"];
36
+ validate?: InjectedFormData<Schema, Type>["validate"];
37
+ clear?: InjectedFormData<Schema, Type>["clear"];
38
+ reset?: InjectedFormData<Schema, Type>["reset"];
39
39
  };
40
40
  }>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -12,14 +12,14 @@ export declare function defineFormWrapper<Schema extends FormSchema, Type = unde
12
12
  };
13
13
  }>, {
14
14
  errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>> | undefined, DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>> | undefined;
15
- fields: Ref<Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>, Map<string, string> | (Map<string, string> & Omit<Map<string, string>, keyof Map<any, any>>)>;
15
+ fields: Ref<Map<string, string>, Map<string, string>>;
16
16
  fieldsErrors: Ref<Map<string, z.inferFormattedError<Schema, string>>, Map<string, z.inferFormattedError<Schema, string>>>;
17
17
  formData: Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined> | undefined;
18
18
  invalid: import('vue').ComputedRef<boolean>;
19
19
  clear: (() => void) | undefined;
20
20
  reset: (() => void) | undefined;
21
21
  submit: (() => Promise<boolean>) | undefined;
22
- validate: ((formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, fields?: Set<string> | undefined) => Promise<boolean>) | undefined;
22
+ validate: ((formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, fields?: Set<string>) => Promise<boolean>) | undefined;
23
23
  validateWrapper: () => Promise<boolean>;
24
24
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid")[], "invalid" | "valid", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
25
25
  name: {
@@ -42,10 +42,10 @@ export declare function defineFormWrapper<Schema extends FormSchema, Type = unde
42
42
  formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
43
43
  formErrors?: DeepReadonly<z.inferFormattedError<Schema>>;
44
44
  invalid: boolean;
45
- clear?: InjectedFormData<Schema, Type>['clear'];
46
- reset?: InjectedFormData<Schema, Type>['reset'];
47
- submit?: InjectedFormData<Schema, Type>['submit'];
48
- validate?: InjectedFormData<Schema, Type>['validate'];
45
+ clear?: InjectedFormData<Schema, Type>["clear"];
46
+ reset?: InjectedFormData<Schema, Type>["reset"];
47
+ submit?: InjectedFormData<Schema, Type>["submit"];
48
+ validate?: InjectedFormData<Schema, Type>["validate"];
49
49
  validateWrapper?: () => Promise<boolean>;
50
50
  };
51
51
  }>, {}, {}, "invalid" | "reset" | "clear" | "submit" | "errors" | "tag" | "validate" | "formData" | "fields" | "fieldsErrors" | "validateWrapper", import('vue').ComponentProvideOptions, true, {}, any>;