vee-validate 4.14.7 → 4.15.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/README.md +178 -178
- package/dist/vee-validate.cjs +15 -4503
- package/dist/vee-validate.d.ts +38 -21
- package/dist/vee-validate.iife.js +15 -4503
- package/dist/vee-validate.iife.prod.js.mjs +3 -3
- package/dist/vee-validate.mjs +21 -18
- package/package.json +1 -1
package/dist/vee-validate.d.ts
CHANGED
|
@@ -59,24 +59,41 @@ type AnyIsEqual<T1, T2> = T1 extends T2 ? (IsEqual<T1, T2> extends true ? true :
|
|
|
59
59
|
*/
|
|
60
60
|
type TupleKeys<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
|
|
61
61
|
/**
|
|
62
|
-
* Helper type
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* Helper type to construct tuple key paths and recurse into its elements.
|
|
63
|
+
*
|
|
64
|
+
* See {@link Path}
|
|
65
|
+
*/
|
|
66
|
+
type PathInternalTuple<TValue extends ReadonlyArray<any>, TraversedTypes> = {
|
|
67
|
+
[Key in TupleKeys<TValue> & string]: `[${Key}]` | `[${Key}]${PathInternal<TValue[Key], TraversedTypes, false>}`;
|
|
68
|
+
}[TupleKeys<TValue> & string];
|
|
69
|
+
/**
|
|
70
|
+
* Helper type to construct array key paths and recurse into its elements.
|
|
71
|
+
*
|
|
72
|
+
* See {@link Path}
|
|
73
|
+
*/
|
|
74
|
+
type PathInternalArray<TValue extends ReadonlyArray<any>, TraversedTypes> = `[${ArrayKey}]` | `[${ArrayKey}]${PathInternal<TValue[ArrayKey], TraversedTypes, false>}`;
|
|
75
|
+
/**
|
|
76
|
+
* Helper type to construct object key paths and recurse into its nested values.
|
|
65
77
|
*
|
|
66
78
|
* See {@link Path}
|
|
67
79
|
*/
|
|
68
|
-
type
|
|
80
|
+
type PathInternalObject<TValue, TraversedTypes, First extends boolean> = {
|
|
81
|
+
[Key in keyof TValue & string]: First extends true ? `${Key}` | `${Key}${PathInternal<TValue[Key], TraversedTypes, false>}` : `.${Key}` | `.${Key}${PathInternal<TValue[Key], TraversedTypes, false>}`;
|
|
82
|
+
}[keyof TValue & string];
|
|
83
|
+
/**
|
|
84
|
+
* Helper type to construct nested any object key paths.
|
|
85
|
+
*
|
|
86
|
+
* See {@link Path}
|
|
87
|
+
*/
|
|
88
|
+
type PathInternalAny = `.${string}` | `[${string}]` | `[${string}].${string}`;
|
|
69
89
|
/**
|
|
70
90
|
* Helper type for recursively constructing paths through a type.
|
|
71
|
-
*
|
|
91
|
+
*
|
|
92
|
+
* This obscures internal type params TraversedTypes and First from ed contract.
|
|
72
93
|
*
|
|
73
94
|
* See {@link Path}
|
|
74
95
|
*/
|
|
75
|
-
type PathInternal<
|
|
76
|
-
[K in TupleKeys<T>]-?: PathImpl<K & string, T[K], TraversedTypes>;
|
|
77
|
-
}[TupleKeys<T>] : PathImpl<ArrayKey, V, TraversedTypes> : {
|
|
78
|
-
[K in keyof T]-?: PathImpl<K & string, T[K], TraversedTypes>;
|
|
79
|
-
}[keyof T];
|
|
96
|
+
type PathInternal<TValue, TraversedTypes, First extends boolean> = TValue extends Primitive | BrowserNativeObject ? IsAny<TValue> extends true ? PathInternalAny : never : TValue extends ReadonlyArray<any> ? true extends AnyIsEqual<TraversedTypes, TValue> ? never : IsTuple<TValue> extends true ? PathInternalTuple<TValue, TraversedTypes | TValue> : PathInternalArray<TValue, TraversedTypes | TValue> : TValue extends Record<string, any> ? PathInternalObject<TValue, TraversedTypes | TValue, First> : '';
|
|
80
97
|
/**
|
|
81
98
|
* Helper type for recursively constructing paths through a type.
|
|
82
99
|
* This actually constructs the strings and recurses into nested
|
|
@@ -125,7 +142,7 @@ type PathValue<T, P extends Path<T> | ArrayPath<T>> = T extends any ? P extends
|
|
|
125
142
|
* Path<{foo: {bar: string}}> = 'foo' | 'foo.bar'
|
|
126
143
|
* ```
|
|
127
144
|
*/
|
|
128
|
-
type Path<T> = T extends any ? PathInternal<T> : never;
|
|
145
|
+
type Path<T> = T extends any ? PathInternal<T, T, true> & string : never;
|
|
129
146
|
|
|
130
147
|
type GenericObject = Record<string, any>;
|
|
131
148
|
type MaybeArray<T> = T | T[];
|
|
@@ -305,8 +322,8 @@ interface FormState<TValues> {
|
|
|
305
322
|
touched: Partial<Record<Path<TValues>, boolean>>;
|
|
306
323
|
submitCount: number;
|
|
307
324
|
}
|
|
308
|
-
type FormErrors<TValues extends GenericObject> = Partial<Record<Path<TValues
|
|
309
|
-
type FormErrorBag<TValues extends GenericObject> = Partial<Record<Path<TValues
|
|
325
|
+
type FormErrors<TValues extends GenericObject> = Partial<Record<Path<TValues> | '', string | undefined>>;
|
|
326
|
+
type FormErrorBag<TValues extends GenericObject> = Partial<Record<Path<TValues> | '', string[]>>;
|
|
310
327
|
interface ResetFormOpts {
|
|
311
328
|
force: boolean;
|
|
312
329
|
}
|
|
@@ -957,7 +974,7 @@ declare const Form: {
|
|
|
957
974
|
default: boolean;
|
|
958
975
|
};
|
|
959
976
|
onSubmit: {
|
|
960
|
-
type: PropType<SubmissionHandler
|
|
977
|
+
type: PropType<SubmissionHandler<GenericObject>>;
|
|
961
978
|
default: any;
|
|
962
979
|
};
|
|
963
980
|
onInvalidSubmit: {
|
|
@@ -1006,7 +1023,7 @@ declare const Form: {
|
|
|
1006
1023
|
default: boolean;
|
|
1007
1024
|
};
|
|
1008
1025
|
onSubmit: {
|
|
1009
|
-
type: PropType<SubmissionHandler
|
|
1026
|
+
type: PropType<SubmissionHandler<GenericObject>>;
|
|
1010
1027
|
default: any;
|
|
1011
1028
|
};
|
|
1012
1029
|
onInvalidSubmit: {
|
|
@@ -1023,7 +1040,7 @@ declare const Form: {
|
|
|
1023
1040
|
};
|
|
1024
1041
|
}>>, {
|
|
1025
1042
|
name: string;
|
|
1026
|
-
onSubmit: SubmissionHandler
|
|
1043
|
+
onSubmit: SubmissionHandler<GenericObject>;
|
|
1027
1044
|
as: string;
|
|
1028
1045
|
initialValues: Record<string, any>;
|
|
1029
1046
|
validateOnMount: boolean;
|
|
@@ -1065,7 +1082,7 @@ declare const Form: {
|
|
|
1065
1082
|
default: boolean;
|
|
1066
1083
|
};
|
|
1067
1084
|
onSubmit: {
|
|
1068
|
-
type: PropType<SubmissionHandler
|
|
1085
|
+
type: PropType<SubmissionHandler<GenericObject>>;
|
|
1069
1086
|
default: any;
|
|
1070
1087
|
};
|
|
1071
1088
|
onInvalidSubmit: {
|
|
@@ -1090,7 +1107,7 @@ declare const Form: {
|
|
|
1090
1107
|
}>[];
|
|
1091
1108
|
}, {}, {}, {}, {
|
|
1092
1109
|
name: string;
|
|
1093
|
-
onSubmit: SubmissionHandler
|
|
1110
|
+
onSubmit: SubmissionHandler<GenericObject>;
|
|
1094
1111
|
as: string;
|
|
1095
1112
|
initialValues: Record<string, any>;
|
|
1096
1113
|
validateOnMount: boolean;
|
|
@@ -1129,7 +1146,7 @@ declare const Form: {
|
|
|
1129
1146
|
default: boolean;
|
|
1130
1147
|
};
|
|
1131
1148
|
onSubmit: {
|
|
1132
|
-
type: PropType<SubmissionHandler
|
|
1149
|
+
type: PropType<SubmissionHandler<GenericObject>>;
|
|
1133
1150
|
default: any;
|
|
1134
1151
|
};
|
|
1135
1152
|
onInvalidSubmit: {
|
|
@@ -1154,7 +1171,7 @@ declare const Form: {
|
|
|
1154
1171
|
}>[];
|
|
1155
1172
|
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {
|
|
1156
1173
|
name: string;
|
|
1157
|
-
onSubmit: SubmissionHandler
|
|
1174
|
+
onSubmit: SubmissionHandler<GenericObject>;
|
|
1158
1175
|
as: string;
|
|
1159
1176
|
initialValues: Record<string, any>;
|
|
1160
1177
|
validateOnMount: boolean;
|
|
@@ -1421,7 +1438,7 @@ declare function useFormValues<TValues extends Record<string, any> = Record<stri
|
|
|
1421
1438
|
/**
|
|
1422
1439
|
* Gives access to all form errors
|
|
1423
1440
|
*/
|
|
1424
|
-
declare function useFormErrors<TValues extends Record<string, unknown> = Record<string, unknown>>(): vue.ComputedRef<Partial<Record<Path<TValues>, string>>>;
|
|
1441
|
+
declare function useFormErrors<TValues extends Record<string, unknown> = Record<string, unknown>>(): vue.ComputedRef<Partial<Record<"" | Path<TValues>, string>>>;
|
|
1425
1442
|
|
|
1426
1443
|
/**
|
|
1427
1444
|
* Gives access to a single field error
|