vee-validate 4.5.2 → 4.5.6
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/CHANGELOG.md +43 -0
- package/dist/vee-validate.d.ts +546 -146
- package/dist/vee-validate.esm.js +33 -14
- package/dist/vee-validate.js +34 -15
- package/dist/vee-validate.min.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.5.6](https://github.com/logaretm/vee-validate/compare/v4.5.5...v4.5.6) (2021-11-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* corrected the typing for the resetField function closes [#3568](https://github.com/logaretm/vee-validate/issues/3568) ([4e9460e](https://github.com/logaretm/vee-validate/commit/4e9460e3a4f51f4a78ddcdf17f7c3073f899404f))
|
|
12
|
+
* new devtools typings ([f288ca5](https://github.com/logaretm/vee-validate/commit/f288ca5a59d36f23ba7f6bdd210493588f744940))
|
|
13
|
+
* use watchEffect to compute form meta closes [#3580](https://github.com/logaretm/vee-validate/issues/3580) ([e8729dc](https://github.com/logaretm/vee-validate/commit/e8729dc72d2a027a666515360c9537a62a8d46ad))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [4.5.5](https://github.com/logaretm/vee-validate/compare/v4.5.4...v4.5.5) (2021-11-01)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* prevent toggle checkboxes when form resets closes [#3551](https://github.com/logaretm/vee-validate/issues/3551) ([cad12ba](https://github.com/logaretm/vee-validate/commit/cad12ba7502af7268029930a9176d8e160efeef6))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.5.4](https://github.com/logaretm/vee-validate/compare/v4.5.3...v4.5.4) (2021-10-20)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package vee-validate
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [4.5.3](https://github.com/logaretm/vee-validate/compare/v4.5.2...v4.5.3) (2021-10-17)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* added slot typings for components closes [#3534](https://github.com/logaretm/vee-validate/issues/3534) ([#3537](https://github.com/logaretm/vee-validate/issues/3537)) ([52a2a38](https://github.com/logaretm/vee-validate/commit/52a2a385ec6e65c7eaaed0a67615c45aba07de64))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
## [4.5.2](https://github.com/logaretm/vee-validate/compare/v4.5.1...v4.5.2) (2021-09-30)
|
|
7
50
|
|
|
8
51
|
|
package/dist/vee-validate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { DeepReadonly, Ref, ComputedRef, VNode, UnwrapRef, InjectionKey } from 'vue';
|
|
3
3
|
import { AnySchema, AnyObjectSchema, SchemaOf, BaseSchema } from 'yup';
|
|
4
4
|
|
|
5
5
|
interface FieldValidationMetaInfo {
|
|
@@ -84,7 +84,7 @@ interface PrivateFieldContext<TValue = unknown> {
|
|
|
84
84
|
checkedValue?: MaybeRef<TValue>;
|
|
85
85
|
uncheckedValue?: MaybeRef<TValue>;
|
|
86
86
|
checked?: Ref<boolean>;
|
|
87
|
-
resetField(state?: FieldState<TValue
|
|
87
|
+
resetField(state?: Partial<FieldState<TValue>>): void;
|
|
88
88
|
handleReset(): void;
|
|
89
89
|
validate(opts?: Partial<ValidationOptions$1>): Promise<ValidationResult>;
|
|
90
90
|
handleChange(e: Event | unknown, shouldValidate?: boolean): void;
|
|
@@ -204,76 +204,211 @@ declare type RuleExpression<TValue> = string | Record<string, unknown> | Generic
|
|
|
204
204
|
*/
|
|
205
205
|
declare function useField<TValue = unknown>(name: MaybeRef<string>, rules?: MaybeRef<RuleExpression<TValue>>, opts?: Partial<FieldOptions<TValue>>): FieldContext<TValue>;
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
207
|
+
interface FieldBindingObject<TValue = unknown> {
|
|
208
|
+
name: string;
|
|
209
|
+
onBlur: (e: Event) => unknown;
|
|
210
|
+
onInput: (e: Event) => unknown;
|
|
211
|
+
onChange: (e: Event) => unknown;
|
|
212
|
+
'onUpdate:modelValue'?: ((e: TValue) => unknown) | undefined;
|
|
213
|
+
value?: unknown;
|
|
214
|
+
checked?: boolean;
|
|
215
|
+
}
|
|
216
|
+
interface FieldSlotProps<TValue = unknown> extends Pick<FieldContext, 'validate' | 'resetField' | 'handleChange' | 'handleReset' | 'handleBlur' | 'setTouched' | 'setErrors'> {
|
|
217
|
+
field: FieldBindingObject<TValue>;
|
|
218
|
+
value: TValue;
|
|
219
|
+
meta: FieldMeta<TValue>;
|
|
220
|
+
errors: string[];
|
|
221
|
+
errorMessage: string | undefined;
|
|
222
|
+
handleInput: FieldContext['handleChange'];
|
|
223
|
+
}
|
|
224
|
+
declare const Field: {
|
|
225
|
+
new (...args: any[]): {
|
|
226
|
+
$: vue.ComponentInternalInstance;
|
|
227
|
+
$data: {};
|
|
228
|
+
$props: Partial<{
|
|
229
|
+
label: string;
|
|
230
|
+
as: string | Record<string, any>;
|
|
231
|
+
bails: boolean;
|
|
232
|
+
uncheckedValue: any;
|
|
233
|
+
validateOnInput: boolean;
|
|
234
|
+
validateOnChange: boolean;
|
|
235
|
+
validateOnBlur: boolean;
|
|
236
|
+
validateOnModelUpdate: boolean;
|
|
237
|
+
modelValue: any;
|
|
238
|
+
standalone: boolean;
|
|
239
|
+
validateOnMount: boolean;
|
|
240
|
+
rules: RuleExpression<unknown>;
|
|
241
|
+
modelModifiers: any;
|
|
242
|
+
"onUpdate:modelValue": (e: any) => unknown;
|
|
243
|
+
}> & Omit<Readonly<{
|
|
244
|
+
as?: unknown;
|
|
245
|
+
name?: unknown;
|
|
246
|
+
rules?: unknown;
|
|
247
|
+
validateOnMount?: unknown;
|
|
248
|
+
validateOnBlur?: unknown;
|
|
249
|
+
validateOnChange?: unknown;
|
|
250
|
+
validateOnInput?: unknown;
|
|
251
|
+
validateOnModelUpdate?: unknown;
|
|
252
|
+
bails?: unknown;
|
|
253
|
+
label?: unknown;
|
|
254
|
+
uncheckedValue?: unknown;
|
|
255
|
+
modelValue?: unknown;
|
|
256
|
+
modelModifiers?: unknown;
|
|
257
|
+
'onUpdate:modelValue'?: unknown;
|
|
258
|
+
standalone?: unknown;
|
|
259
|
+
} & {
|
|
260
|
+
name: string;
|
|
261
|
+
bails: boolean;
|
|
262
|
+
modelValue: any;
|
|
263
|
+
standalone: boolean;
|
|
264
|
+
validateOnMount: boolean;
|
|
265
|
+
modelModifiers: any;
|
|
266
|
+
} & {
|
|
267
|
+
label?: string;
|
|
268
|
+
as?: string | Record<string, any>;
|
|
269
|
+
uncheckedValue?: any;
|
|
270
|
+
validateOnInput?: boolean;
|
|
271
|
+
validateOnChange?: boolean;
|
|
272
|
+
validateOnBlur?: boolean;
|
|
273
|
+
validateOnModelUpdate?: boolean;
|
|
274
|
+
rules?: RuleExpression<unknown>;
|
|
275
|
+
"onUpdate:modelValue"?: (e: any) => unknown;
|
|
276
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, "label" | "as" | "bails" | "uncheckedValue" | "validateOnInput" | "validateOnChange" | "validateOnBlur" | "validateOnModelUpdate" | "modelValue" | "standalone" | "validateOnMount" | "rules" | "modelModifiers" | "onUpdate:modelValue">;
|
|
277
|
+
$attrs: {
|
|
278
|
+
[x: string]: unknown;
|
|
279
|
+
};
|
|
280
|
+
$refs: {
|
|
281
|
+
[x: string]: unknown;
|
|
282
|
+
};
|
|
283
|
+
$slots: Readonly<{
|
|
284
|
+
[name: string]: vue.Slot;
|
|
285
|
+
}>;
|
|
286
|
+
$root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
287
|
+
$parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
288
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
289
|
+
$el: any;
|
|
290
|
+
$options: vue.ComponentOptionsBase<Readonly<{
|
|
291
|
+
as?: unknown;
|
|
292
|
+
name?: unknown;
|
|
293
|
+
rules?: unknown;
|
|
294
|
+
validateOnMount?: unknown;
|
|
295
|
+
validateOnBlur?: unknown;
|
|
296
|
+
validateOnChange?: unknown;
|
|
297
|
+
validateOnInput?: unknown;
|
|
298
|
+
validateOnModelUpdate?: unknown;
|
|
299
|
+
bails?: unknown;
|
|
300
|
+
label?: unknown;
|
|
301
|
+
uncheckedValue?: unknown;
|
|
302
|
+
modelValue?: unknown;
|
|
303
|
+
modelModifiers?: unknown;
|
|
304
|
+
'onUpdate:modelValue'?: unknown;
|
|
305
|
+
standalone?: unknown;
|
|
306
|
+
} & {
|
|
307
|
+
name: string;
|
|
308
|
+
bails: boolean;
|
|
309
|
+
modelValue: any;
|
|
310
|
+
standalone: boolean;
|
|
311
|
+
validateOnMount: boolean;
|
|
312
|
+
modelModifiers: any;
|
|
313
|
+
} & {
|
|
314
|
+
label?: string;
|
|
315
|
+
as?: string | Record<string, any>;
|
|
316
|
+
uncheckedValue?: any;
|
|
317
|
+
validateOnInput?: boolean;
|
|
318
|
+
validateOnChange?: boolean;
|
|
319
|
+
validateOnBlur?: boolean;
|
|
320
|
+
validateOnModelUpdate?: boolean;
|
|
321
|
+
rules?: RuleExpression<unknown>;
|
|
322
|
+
"onUpdate:modelValue"?: (e: any) => unknown;
|
|
323
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
326
|
+
[key: string]: any;
|
|
327
|
+
}>[] | {
|
|
328
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
329
|
+
[key: string]: any;
|
|
330
|
+
}>[];
|
|
331
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
332
|
+
label: string;
|
|
333
|
+
as: string | Record<string, any>;
|
|
334
|
+
bails: boolean;
|
|
335
|
+
uncheckedValue: any;
|
|
336
|
+
validateOnInput: boolean;
|
|
337
|
+
validateOnChange: boolean;
|
|
338
|
+
validateOnBlur: boolean;
|
|
339
|
+
validateOnModelUpdate: boolean;
|
|
340
|
+
modelValue: any;
|
|
341
|
+
standalone: boolean;
|
|
342
|
+
validateOnMount: boolean;
|
|
343
|
+
rules: RuleExpression<unknown>;
|
|
344
|
+
modelModifiers: any;
|
|
345
|
+
"onUpdate:modelValue": (e: any) => unknown;
|
|
346
|
+
}> & {
|
|
347
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
348
|
+
created?: (() => void) | (() => void)[];
|
|
349
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
350
|
+
mounted?: (() => void) | (() => void)[];
|
|
351
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
352
|
+
updated?: (() => void) | (() => void)[];
|
|
353
|
+
activated?: (() => void) | (() => void)[];
|
|
354
|
+
deactivated?: (() => void) | (() => void)[];
|
|
355
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
356
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
357
|
+
destroyed?: (() => void) | (() => void)[];
|
|
358
|
+
unmounted?: (() => void) | (() => void)[];
|
|
359
|
+
renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
360
|
+
renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
361
|
+
errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
|
|
362
|
+
};
|
|
363
|
+
$forceUpdate: () => void;
|
|
364
|
+
$nextTick: typeof vue.nextTick;
|
|
365
|
+
$watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
|
|
366
|
+
} & Readonly<{
|
|
367
|
+
as?: unknown;
|
|
368
|
+
name?: unknown;
|
|
369
|
+
rules?: unknown;
|
|
370
|
+
validateOnMount?: unknown;
|
|
371
|
+
validateOnBlur?: unknown;
|
|
372
|
+
validateOnChange?: unknown;
|
|
373
|
+
validateOnInput?: unknown;
|
|
374
|
+
validateOnModelUpdate?: unknown;
|
|
375
|
+
bails?: unknown;
|
|
376
|
+
label?: unknown;
|
|
377
|
+
uncheckedValue?: unknown;
|
|
378
|
+
modelValue?: unknown;
|
|
379
|
+
modelModifiers?: unknown;
|
|
380
|
+
'onUpdate:modelValue'?: unknown;
|
|
381
|
+
standalone?: unknown;
|
|
382
|
+
} & {
|
|
383
|
+
name: string;
|
|
384
|
+
bails: boolean;
|
|
385
|
+
modelValue: any;
|
|
386
|
+
standalone: boolean;
|
|
387
|
+
validateOnMount: boolean;
|
|
388
|
+
modelModifiers: any;
|
|
389
|
+
} & {
|
|
390
|
+
label?: string;
|
|
391
|
+
as?: string | Record<string, any>;
|
|
392
|
+
uncheckedValue?: any;
|
|
393
|
+
validateOnInput?: boolean;
|
|
394
|
+
validateOnChange?: boolean;
|
|
395
|
+
validateOnBlur?: boolean;
|
|
396
|
+
validateOnModelUpdate?: boolean;
|
|
397
|
+
rules?: RuleExpression<unknown>;
|
|
398
|
+
"onUpdate:modelValue"?: (e: any) => unknown;
|
|
399
|
+
}> & vue.ShallowUnwrapRef<() => VNode<vue.RendererNode, vue.RendererElement, {
|
|
274
400
|
[key: string]: any;
|
|
275
|
-
}>
|
|
276
|
-
|
|
401
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
402
|
+
[key: string]: any;
|
|
403
|
+
}>[] | {
|
|
404
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
405
|
+
[key: string]: any;
|
|
406
|
+
}>[];
|
|
407
|
+
}> & {} & {} & vue.ComponentCustomProperties;
|
|
408
|
+
__isFragment?: never;
|
|
409
|
+
__isTeleport?: never;
|
|
410
|
+
__isSuspense?: never;
|
|
411
|
+
} & vue.ComponentOptionsBase<Readonly<{
|
|
277
412
|
as?: unknown;
|
|
278
413
|
name?: unknown;
|
|
279
414
|
rules?: unknown;
|
|
@@ -306,7 +441,15 @@ declare const Field: vue.DefineComponent<{
|
|
|
306
441
|
validateOnModelUpdate?: boolean;
|
|
307
442
|
rules?: RuleExpression<unknown>;
|
|
308
443
|
"onUpdate:modelValue"?: (e: any) => unknown;
|
|
309
|
-
}>, {
|
|
444
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
445
|
+
[key: string]: any;
|
|
446
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
447
|
+
[key: string]: any;
|
|
448
|
+
}>[] | {
|
|
449
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
450
|
+
[key: string]: any;
|
|
451
|
+
}>[];
|
|
452
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
310
453
|
label: string;
|
|
311
454
|
as: string | Record<string, any>;
|
|
312
455
|
bails: boolean;
|
|
@@ -321,50 +464,149 @@ declare const Field: vue.DefineComponent<{
|
|
|
321
464
|
rules: RuleExpression<unknown>;
|
|
322
465
|
modelModifiers: any;
|
|
323
466
|
"onUpdate:modelValue": (e: any) => unknown;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
as: {
|
|
328
|
-
type: StringConstructor;
|
|
329
|
-
default: string;
|
|
330
|
-
};
|
|
331
|
-
validationSchema: {
|
|
332
|
-
type: ObjectConstructor;
|
|
333
|
-
default: any;
|
|
334
|
-
};
|
|
335
|
-
initialValues: {
|
|
336
|
-
type: ObjectConstructor;
|
|
337
|
-
default: any;
|
|
338
|
-
};
|
|
339
|
-
initialErrors: {
|
|
340
|
-
type: ObjectConstructor;
|
|
341
|
-
default: any;
|
|
342
|
-
};
|
|
343
|
-
initialTouched: {
|
|
344
|
-
type: ObjectConstructor;
|
|
345
|
-
default: any;
|
|
467
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
|
|
468
|
+
$slots: {
|
|
469
|
+
default: (arg: FieldSlotProps<unknown>) => VNode[];
|
|
346
470
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
declare type FormSlotProps = UnwrapRef<Pick<FormContext, 'meta' | 'errors' | 'values' | 'isSubmitting' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'submitForm' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm'>> & {
|
|
474
|
+
handleSubmit: (evt: Event | SubmissionHandler, onSubmit?: SubmissionHandler) => Promise<unknown>;
|
|
475
|
+
};
|
|
476
|
+
declare const Form: {
|
|
477
|
+
new (...args: any[]): {
|
|
478
|
+
$: vue.ComponentInternalInstance;
|
|
479
|
+
$data: {};
|
|
480
|
+
$props: Partial<{
|
|
481
|
+
onSubmit: SubmissionHandler<GenericFormValues, unknown>;
|
|
482
|
+
as: string;
|
|
483
|
+
initialValues: Record<string, any>;
|
|
484
|
+
validateOnMount: boolean;
|
|
485
|
+
validationSchema: Record<string, any>;
|
|
486
|
+
initialErrors: Record<string, any>;
|
|
487
|
+
initialTouched: Record<string, any>;
|
|
488
|
+
onInvalidSubmit: InvalidSubmissionHandler<GenericFormValues>;
|
|
489
|
+
}> & Omit<Readonly<{
|
|
490
|
+
as?: unknown;
|
|
491
|
+
validationSchema?: unknown;
|
|
492
|
+
initialValues?: unknown;
|
|
493
|
+
initialErrors?: unknown;
|
|
494
|
+
initialTouched?: unknown;
|
|
495
|
+
validateOnMount?: unknown;
|
|
496
|
+
onSubmit?: unknown;
|
|
497
|
+
onInvalidSubmit?: unknown;
|
|
498
|
+
} & {
|
|
499
|
+
as: string;
|
|
500
|
+
validateOnMount: boolean;
|
|
501
|
+
} & {
|
|
502
|
+
onSubmit?: SubmissionHandler<GenericFormValues, unknown>;
|
|
503
|
+
initialValues?: Record<string, any>;
|
|
504
|
+
validationSchema?: Record<string, any>;
|
|
505
|
+
initialErrors?: Record<string, any>;
|
|
506
|
+
initialTouched?: Record<string, any>;
|
|
507
|
+
onInvalidSubmit?: InvalidSubmissionHandler<GenericFormValues>;
|
|
508
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, "onSubmit" | "as" | "initialValues" | "validateOnMount" | "validationSchema" | "initialErrors" | "initialTouched" | "onInvalidSubmit">;
|
|
509
|
+
$attrs: {
|
|
510
|
+
[x: string]: unknown;
|
|
511
|
+
};
|
|
512
|
+
$refs: {
|
|
513
|
+
[x: string]: unknown;
|
|
514
|
+
};
|
|
515
|
+
$slots: Readonly<{
|
|
516
|
+
[name: string]: vue.Slot;
|
|
517
|
+
}>;
|
|
518
|
+
$root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
519
|
+
$parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
520
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
521
|
+
$el: any;
|
|
522
|
+
$options: vue.ComponentOptionsBase<Readonly<{
|
|
523
|
+
as?: unknown;
|
|
524
|
+
validationSchema?: unknown;
|
|
525
|
+
initialValues?: unknown;
|
|
526
|
+
initialErrors?: unknown;
|
|
527
|
+
initialTouched?: unknown;
|
|
528
|
+
validateOnMount?: unknown;
|
|
529
|
+
onSubmit?: unknown;
|
|
530
|
+
onInvalidSubmit?: unknown;
|
|
531
|
+
} & {
|
|
532
|
+
as: string;
|
|
533
|
+
validateOnMount: boolean;
|
|
534
|
+
} & {
|
|
535
|
+
onSubmit?: SubmissionHandler<GenericFormValues, unknown>;
|
|
536
|
+
initialValues?: Record<string, any>;
|
|
537
|
+
validationSchema?: Record<string, any>;
|
|
538
|
+
initialErrors?: Record<string, any>;
|
|
539
|
+
initialTouched?: Record<string, any>;
|
|
540
|
+
onInvalidSubmit?: InvalidSubmissionHandler<GenericFormValues>;
|
|
541
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
542
|
+
[key: string]: any;
|
|
543
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
544
|
+
[key: string]: any;
|
|
545
|
+
}>[] | {
|
|
546
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
547
|
+
[key: string]: any;
|
|
548
|
+
}>[];
|
|
549
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
550
|
+
onSubmit: SubmissionHandler<GenericFormValues, unknown>;
|
|
551
|
+
as: string;
|
|
552
|
+
initialValues: Record<string, any>;
|
|
553
|
+
validateOnMount: boolean;
|
|
554
|
+
validationSchema: Record<string, any>;
|
|
555
|
+
initialErrors: Record<string, any>;
|
|
556
|
+
initialTouched: Record<string, any>;
|
|
557
|
+
onInvalidSubmit: InvalidSubmissionHandler<GenericFormValues>;
|
|
558
|
+
}> & {
|
|
559
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
560
|
+
created?: (() => void) | (() => void)[];
|
|
561
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
562
|
+
mounted?: (() => void) | (() => void)[];
|
|
563
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
564
|
+
updated?: (() => void) | (() => void)[];
|
|
565
|
+
activated?: (() => void) | (() => void)[];
|
|
566
|
+
deactivated?: (() => void) | (() => void)[];
|
|
567
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
568
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
569
|
+
destroyed?: (() => void) | (() => void)[];
|
|
570
|
+
unmounted?: (() => void) | (() => void)[];
|
|
571
|
+
renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
572
|
+
renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
573
|
+
errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
|
|
574
|
+
};
|
|
575
|
+
$forceUpdate: () => void;
|
|
576
|
+
$nextTick: typeof vue.nextTick;
|
|
577
|
+
$watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
|
|
578
|
+
} & Readonly<{
|
|
579
|
+
as?: unknown;
|
|
580
|
+
validationSchema?: unknown;
|
|
581
|
+
initialValues?: unknown;
|
|
582
|
+
initialErrors?: unknown;
|
|
583
|
+
initialTouched?: unknown;
|
|
584
|
+
validateOnMount?: unknown;
|
|
585
|
+
onSubmit?: unknown;
|
|
586
|
+
onInvalidSubmit?: unknown;
|
|
587
|
+
} & {
|
|
588
|
+
as: string;
|
|
589
|
+
validateOnMount: boolean;
|
|
590
|
+
} & {
|
|
591
|
+
onSubmit?: SubmissionHandler<GenericFormValues, unknown>;
|
|
592
|
+
initialValues?: Record<string, any>;
|
|
593
|
+
validationSchema?: Record<string, any>;
|
|
594
|
+
initialErrors?: Record<string, any>;
|
|
595
|
+
initialTouched?: Record<string, any>;
|
|
596
|
+
onInvalidSubmit?: InvalidSubmissionHandler<GenericFormValues>;
|
|
597
|
+
}> & vue.ShallowUnwrapRef<() => VNode<vue.RendererNode, vue.RendererElement, {
|
|
365
598
|
[key: string]: any;
|
|
366
|
-
}>
|
|
367
|
-
|
|
599
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
600
|
+
[key: string]: any;
|
|
601
|
+
}>[] | {
|
|
602
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
603
|
+
[key: string]: any;
|
|
604
|
+
}>[];
|
|
605
|
+
}> & {} & {} & vue.ComponentCustomProperties;
|
|
606
|
+
__isFragment?: never;
|
|
607
|
+
__isTeleport?: never;
|
|
608
|
+
__isSuspense?: never;
|
|
609
|
+
} & vue.ComponentOptionsBase<Readonly<{
|
|
368
610
|
as?: unknown;
|
|
369
611
|
validationSchema?: unknown;
|
|
370
612
|
initialValues?: unknown;
|
|
@@ -383,7 +625,15 @@ declare const Form: vue.DefineComponent<{
|
|
|
383
625
|
initialErrors?: Record<string, any>;
|
|
384
626
|
initialTouched?: Record<string, any>;
|
|
385
627
|
onInvalidSubmit?: InvalidSubmissionHandler<GenericFormValues>;
|
|
386
|
-
}>, {
|
|
628
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
629
|
+
[key: string]: any;
|
|
630
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
631
|
+
[key: string]: any;
|
|
632
|
+
}>[] | {
|
|
633
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
634
|
+
[key: string]: any;
|
|
635
|
+
}>[];
|
|
636
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
387
637
|
onSubmit: SubmissionHandler<GenericFormValues, unknown>;
|
|
388
638
|
as: string;
|
|
389
639
|
initialValues: Record<string, any>;
|
|
@@ -392,52 +642,202 @@ declare const Form: vue.DefineComponent<{
|
|
|
392
642
|
initialErrors: Record<string, any>;
|
|
393
643
|
initialTouched: Record<string, any>;
|
|
394
644
|
onInvalidSubmit: InvalidSubmissionHandler<GenericFormValues>;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
name: {
|
|
399
|
-
type: StringConstructor;
|
|
400
|
-
required: true;
|
|
645
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
|
|
646
|
+
$slots: {
|
|
647
|
+
default: (arg: FormSlotProps) => VNode[];
|
|
401
648
|
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
declare const FieldArray: {
|
|
652
|
+
new (...args: any[]): {
|
|
653
|
+
$: vue.ComponentInternalInstance;
|
|
654
|
+
$data: {};
|
|
655
|
+
$props: Partial<{}> & Omit<Readonly<{
|
|
656
|
+
name?: unknown;
|
|
657
|
+
} & {
|
|
658
|
+
name: string;
|
|
659
|
+
} & {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, never>;
|
|
660
|
+
$attrs: {
|
|
661
|
+
[x: string]: unknown;
|
|
662
|
+
};
|
|
663
|
+
$refs: {
|
|
664
|
+
[x: string]: unknown;
|
|
665
|
+
};
|
|
666
|
+
$slots: Readonly<{
|
|
667
|
+
[name: string]: vue.Slot;
|
|
668
|
+
}>;
|
|
669
|
+
$root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
670
|
+
$parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
671
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
672
|
+
$el: any;
|
|
673
|
+
$options: vue.ComponentOptionsBase<Readonly<{
|
|
674
|
+
name?: unknown;
|
|
675
|
+
} & {
|
|
676
|
+
name: string;
|
|
677
|
+
} & {}>, () => vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
678
|
+
[key: string]: any;
|
|
679
|
+
}>[] | {
|
|
680
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
681
|
+
[key: string]: any;
|
|
682
|
+
}>[];
|
|
683
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {}> & {
|
|
684
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
685
|
+
created?: (() => void) | (() => void)[];
|
|
686
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
687
|
+
mounted?: (() => void) | (() => void)[];
|
|
688
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
689
|
+
updated?: (() => void) | (() => void)[];
|
|
690
|
+
activated?: (() => void) | (() => void)[];
|
|
691
|
+
deactivated?: (() => void) | (() => void)[];
|
|
692
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
693
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
694
|
+
destroyed?: (() => void) | (() => void)[];
|
|
695
|
+
unmounted?: (() => void) | (() => void)[];
|
|
696
|
+
renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
697
|
+
renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
698
|
+
errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
|
|
699
|
+
};
|
|
700
|
+
$forceUpdate: () => void;
|
|
701
|
+
$nextTick: typeof vue.nextTick;
|
|
702
|
+
$watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
|
|
703
|
+
} & Readonly<{
|
|
704
|
+
name?: unknown;
|
|
705
|
+
} & {
|
|
706
|
+
name: string;
|
|
707
|
+
} & {}> & vue.ShallowUnwrapRef<() => vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
406
708
|
[key: string]: any;
|
|
407
|
-
}>[]
|
|
408
|
-
|
|
709
|
+
}>[] | {
|
|
710
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
711
|
+
[key: string]: any;
|
|
712
|
+
}>[];
|
|
713
|
+
}> & {} & {} & vue.ComponentCustomProperties;
|
|
714
|
+
__isFragment?: never;
|
|
715
|
+
__isTeleport?: never;
|
|
716
|
+
__isSuspense?: never;
|
|
717
|
+
} & vue.ComponentOptionsBase<Readonly<{
|
|
409
718
|
name?: unknown;
|
|
410
719
|
} & {
|
|
411
720
|
name: string;
|
|
412
|
-
} & {}>, {
|
|
413
|
-
|
|
414
|
-
declare const ErrorMessage: vue.DefineComponent<{
|
|
415
|
-
as: {
|
|
416
|
-
type: StringConstructor;
|
|
417
|
-
default: any;
|
|
418
|
-
};
|
|
419
|
-
name: {
|
|
420
|
-
type: StringConstructor;
|
|
421
|
-
required: true;
|
|
422
|
-
};
|
|
423
|
-
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
424
|
-
[key: string]: any;
|
|
425
|
-
}> | vue.Slot | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
721
|
+
} & {}>, () => vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
426
722
|
[key: string]: any;
|
|
427
723
|
}>[] | {
|
|
428
|
-
default: () =>
|
|
724
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
429
725
|
[key: string]: any;
|
|
430
726
|
}>[];
|
|
431
|
-
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps
|
|
727
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
|
|
728
|
+
$slots: {
|
|
729
|
+
default: (arg: UnwrapRef<FieldArrayContext>) => VNode[];
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
interface ErrorMessageSlotProps {
|
|
734
|
+
message: string | undefined;
|
|
735
|
+
}
|
|
736
|
+
declare const ErrorMessage: {
|
|
737
|
+
new (...args: any[]): {
|
|
738
|
+
$: vue.ComponentInternalInstance;
|
|
739
|
+
$data: {};
|
|
740
|
+
$props: Partial<{
|
|
741
|
+
as: string;
|
|
742
|
+
}> & Omit<Readonly<{
|
|
743
|
+
as?: unknown;
|
|
744
|
+
name?: unknown;
|
|
745
|
+
} & {
|
|
746
|
+
name: string;
|
|
747
|
+
} & {
|
|
748
|
+
as?: string;
|
|
749
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, "as">;
|
|
750
|
+
$attrs: {
|
|
751
|
+
[x: string]: unknown;
|
|
752
|
+
};
|
|
753
|
+
$refs: {
|
|
754
|
+
[x: string]: unknown;
|
|
755
|
+
};
|
|
756
|
+
$slots: Readonly<{
|
|
757
|
+
[name: string]: vue.Slot;
|
|
758
|
+
}>;
|
|
759
|
+
$root: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
760
|
+
$parent: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>;
|
|
761
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
762
|
+
$el: any;
|
|
763
|
+
$options: vue.ComponentOptionsBase<Readonly<{
|
|
764
|
+
as?: unknown;
|
|
765
|
+
name?: unknown;
|
|
766
|
+
} & {
|
|
767
|
+
name: string;
|
|
768
|
+
} & {
|
|
769
|
+
as?: string;
|
|
770
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
}>[] | {
|
|
775
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
776
|
+
[key: string]: any;
|
|
777
|
+
}>[];
|
|
778
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
779
|
+
as: string;
|
|
780
|
+
}> & {
|
|
781
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
782
|
+
created?: (() => void) | (() => void)[];
|
|
783
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
784
|
+
mounted?: (() => void) | (() => void)[];
|
|
785
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
786
|
+
updated?: (() => void) | (() => void)[];
|
|
787
|
+
activated?: (() => void) | (() => void)[];
|
|
788
|
+
deactivated?: (() => void) | (() => void)[];
|
|
789
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
790
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
791
|
+
destroyed?: (() => void) | (() => void)[];
|
|
792
|
+
unmounted?: (() => void) | (() => void)[];
|
|
793
|
+
renderTracked?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
794
|
+
renderTriggered?: ((e: vue.DebuggerEvent) => void) | ((e: vue.DebuggerEvent) => void)[];
|
|
795
|
+
errorCaptured?: ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void) | ((err: unknown, instance: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>, info: string) => boolean | void)[];
|
|
796
|
+
};
|
|
797
|
+
$forceUpdate: () => void;
|
|
798
|
+
$nextTick: typeof vue.nextTick;
|
|
799
|
+
$watch(source: string | Function, cb: Function, options?: vue.WatchOptions<boolean>): vue.WatchStopHandle;
|
|
800
|
+
} & Readonly<{
|
|
801
|
+
as?: unknown;
|
|
802
|
+
name?: unknown;
|
|
803
|
+
} & {
|
|
804
|
+
name: string;
|
|
805
|
+
} & {
|
|
806
|
+
as?: string;
|
|
807
|
+
}> & vue.ShallowUnwrapRef<() => VNode<vue.RendererNode, vue.RendererElement, {
|
|
808
|
+
[key: string]: any;
|
|
809
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
810
|
+
[key: string]: any;
|
|
811
|
+
}>[] | {
|
|
812
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
813
|
+
[key: string]: any;
|
|
814
|
+
}>[];
|
|
815
|
+
}> & {} & {} & vue.ComponentCustomProperties;
|
|
816
|
+
__isFragment?: never;
|
|
817
|
+
__isTeleport?: never;
|
|
818
|
+
__isSuspense?: never;
|
|
819
|
+
} & vue.ComponentOptionsBase<Readonly<{
|
|
432
820
|
as?: unknown;
|
|
433
821
|
name?: unknown;
|
|
434
822
|
} & {
|
|
435
823
|
name: string;
|
|
436
824
|
} & {
|
|
437
825
|
as?: string;
|
|
438
|
-
}>, {
|
|
826
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
827
|
+
[key: string]: any;
|
|
828
|
+
}> | vue.Slot | VNode<vue.RendererNode, vue.RendererElement, {
|
|
829
|
+
[key: string]: any;
|
|
830
|
+
}>[] | {
|
|
831
|
+
default: () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
832
|
+
[key: string]: any;
|
|
833
|
+
}>[];
|
|
834
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, {
|
|
439
835
|
as: string;
|
|
440
|
-
}
|
|
836
|
+
}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
|
|
837
|
+
$slots: {
|
|
838
|
+
default: (arg: ErrorMessageSlotProps) => VNode[];
|
|
839
|
+
};
|
|
840
|
+
});
|
|
441
841
|
|
|
442
842
|
interface FormOptions<TValues extends Record<string, any>> {
|
|
443
843
|
validationSchema?: MaybeRef<Record<keyof TValues, GenericValidateFunction | string | Record<string, any>> | SchemaOf<TValues> | undefined>;
|
|
@@ -527,4 +927,4 @@ declare function useSubmitForm<TValues extends Record<string, unknown> = Record<
|
|
|
527
927
|
declare const FormContextKey: InjectionKey<PrivateFormContext>;
|
|
528
928
|
declare const FieldContextKey: InjectionKey<PrivateFieldContext<unknown>>;
|
|
529
929
|
|
|
530
|
-
export { ErrorMessage, Field, FieldArray, FieldContext, FieldContextKey, Form, FormActions, FormContext, FormContextKey, FormState, FormValidationResult, SubmissionContext, SubmissionHandler, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate };
|
|
930
|
+
export { ErrorMessage, Field, FieldArray, FieldArrayContext, FieldContext, FieldContextKey, FieldEntry, FieldMeta, Form, FormActions, FormContext, FormContextKey, FormMeta, FormState, FormValidationResult, InvalidSubmissionContext, SubmissionContext, SubmissionHandler, ValidationResult, configure, defineRule, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useResetForm, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate };
|
package/dist/vee-validate.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vee-validate v4.5.
|
|
2
|
+
* vee-validate v4.5.6
|
|
3
3
|
* (c) 2021 Abdelrahman Awad
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import { inject, getCurrentInstance, warn as warn$1, ref, unref, computed, reactive, watch, onUnmounted, nextTick, onMounted, provide, isRef, onBeforeUnmount, defineComponent, toRef, resolveDynamicComponent, h, markRaw, readonly } from 'vue';
|
|
6
|
+
import { inject, getCurrentInstance, warn as warn$1, ref, unref, computed, reactive, watch, onUnmounted, nextTick, onMounted, provide, isRef, onBeforeUnmount, defineComponent, toRef, resolveDynamicComponent, h, watchEffect, markRaw, readonly } from 'vue';
|
|
7
7
|
import { setupDevtoolsPlugin } from '@vue/devtools-api';
|
|
8
8
|
|
|
9
9
|
function isCallable(fn) {
|
|
@@ -1558,7 +1558,7 @@ function useCheckboxField(name, rules, opts) {
|
|
|
1558
1558
|
return patchCheckboxApi(_useField(name, rules, opts));
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
|
-
const
|
|
1561
|
+
const FieldImpl = defineComponent({
|
|
1562
1562
|
name: 'Field',
|
|
1563
1563
|
inheritAttrs: false,
|
|
1564
1564
|
props: {
|
|
@@ -1760,11 +1760,15 @@ function resolveInitialValue(props, ctx) {
|
|
|
1760
1760
|
return isPropPresent(props, 'modelValue') ? props.modelValue : ctx.attrs.value;
|
|
1761
1761
|
}
|
|
1762
1762
|
return isPropPresent(props, 'modelValue') ? props.modelValue : undefined;
|
|
1763
|
-
}
|
|
1763
|
+
}
|
|
1764
|
+
const Field = FieldImpl;
|
|
1764
1765
|
|
|
1765
1766
|
let FORM_COUNTER = 0;
|
|
1766
1767
|
function useForm(opts) {
|
|
1767
1768
|
const formId = FORM_COUNTER++;
|
|
1769
|
+
// Prevents fields from double resetting their values, which causes checkboxes to toggle their initial value
|
|
1770
|
+
// TODO: This won't be needed if we centralize all the state inside the `form` for form inputs
|
|
1771
|
+
let RESET_LOCK = false;
|
|
1768
1772
|
// A lookup containing fields or field groups
|
|
1769
1773
|
const fieldsByPath = ref({});
|
|
1770
1774
|
// If the form is currently submitting
|
|
@@ -1886,15 +1890,15 @@ function useForm(opts) {
|
|
|
1886
1890
|
setInPath(formValues, field, clonedValue);
|
|
1887
1891
|
return;
|
|
1888
1892
|
}
|
|
1889
|
-
// Multiple checkboxes, and only one of them got updated
|
|
1890
1893
|
if (isFieldGroup(fieldInstance) && ((_a = fieldInstance[0]) === null || _a === void 0 ? void 0 : _a.type) === 'checkbox' && !Array.isArray(value)) {
|
|
1894
|
+
// Multiple checkboxes, and only one of them got updated
|
|
1891
1895
|
const newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field) || [], value, undefined));
|
|
1892
1896
|
setInPath(formValues, field, newValue);
|
|
1893
1897
|
return;
|
|
1894
1898
|
}
|
|
1895
1899
|
let newValue = value;
|
|
1896
1900
|
// Single Checkbox: toggles the field value unless the field is being reset then force it
|
|
1897
|
-
if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force) {
|
|
1901
|
+
if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force && !RESET_LOCK) {
|
|
1898
1902
|
newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field), value, unref(fieldInstance.uncheckedValue)));
|
|
1899
1903
|
}
|
|
1900
1904
|
setInPath(formValues, field, newValue);
|
|
@@ -1935,6 +1939,7 @@ function useForm(opts) {
|
|
|
1935
1939
|
* Resets all fields
|
|
1936
1940
|
*/
|
|
1937
1941
|
function resetForm(state) {
|
|
1942
|
+
RESET_LOCK = true;
|
|
1938
1943
|
// set initial values if provided
|
|
1939
1944
|
if (state === null || state === void 0 ? void 0 : state.values) {
|
|
1940
1945
|
setInitialValues(state.values);
|
|
@@ -1950,6 +1955,7 @@ function useForm(opts) {
|
|
|
1950
1955
|
if (!field) {
|
|
1951
1956
|
return;
|
|
1952
1957
|
}
|
|
1958
|
+
// avoid resetting the field values, because they should've been reset already.
|
|
1953
1959
|
applyFieldMutation(field, f => f.resetField());
|
|
1954
1960
|
});
|
|
1955
1961
|
if (state === null || state === void 0 ? void 0 : state.touched) {
|
|
@@ -1957,6 +1963,9 @@ function useForm(opts) {
|
|
|
1957
1963
|
}
|
|
1958
1964
|
setErrors((state === null || state === void 0 ? void 0 : state.errors) || {});
|
|
1959
1965
|
submitCount.value = (state === null || state === void 0 ? void 0 : state.submitCount) || 0;
|
|
1966
|
+
nextTick(() => {
|
|
1967
|
+
RESET_LOCK = false;
|
|
1968
|
+
});
|
|
1960
1969
|
}
|
|
1961
1970
|
function insertFieldAtPath(field, path) {
|
|
1962
1971
|
const rawField = markRaw(field);
|
|
@@ -2278,16 +2287,23 @@ function useFormMeta(fieldsByPath, currentValues, initialValues, errors) {
|
|
|
2278
2287
|
const isDirty = computed(() => {
|
|
2279
2288
|
return !es6(currentValues, unref(initialValues));
|
|
2280
2289
|
});
|
|
2281
|
-
|
|
2290
|
+
function calculateFlags() {
|
|
2282
2291
|
const fields = Object.values(fieldsByPath.value).flat(1).filter(Boolean);
|
|
2283
2292
|
return keysOf(MERGE_STRATEGIES).reduce((acc, flag) => {
|
|
2284
2293
|
const mergeMethod = MERGE_STRATEGIES[flag];
|
|
2285
2294
|
acc[flag] = fields[mergeMethod](field => field.meta[flag]);
|
|
2286
2295
|
return acc;
|
|
2287
2296
|
}, {});
|
|
2297
|
+
}
|
|
2298
|
+
const flags = reactive(calculateFlags());
|
|
2299
|
+
watchEffect(() => {
|
|
2300
|
+
const value = calculateFlags();
|
|
2301
|
+
flags.touched = value.touched;
|
|
2302
|
+
flags.valid = value.valid;
|
|
2303
|
+
flags.pending = value.pending;
|
|
2288
2304
|
});
|
|
2289
2305
|
return computed(() => {
|
|
2290
|
-
return Object.assign(Object.assign({ initialValues: unref(initialValues) }, flags
|
|
2306
|
+
return Object.assign(Object.assign({ initialValues: unref(initialValues) }, flags), { valid: flags.valid && !keysOf(errors.value).length, dirty: isDirty.value });
|
|
2291
2307
|
});
|
|
2292
2308
|
}
|
|
2293
2309
|
/**
|
|
@@ -2372,7 +2388,7 @@ function useErrorBag(initialErrors) {
|
|
|
2372
2388
|
};
|
|
2373
2389
|
}
|
|
2374
2390
|
|
|
2375
|
-
const
|
|
2391
|
+
const FormImpl = defineComponent({
|
|
2376
2392
|
name: 'Form',
|
|
2377
2393
|
inheritAttrs: false,
|
|
2378
2394
|
props: {
|
|
@@ -2484,7 +2500,8 @@ const Form = defineComponent({
|
|
|
2484
2500
|
return h(tag, Object.assign(Object.assign(Object.assign({}, formAttrs), ctx.attrs), { onSubmit, onReset: handleFormReset }), children);
|
|
2485
2501
|
};
|
|
2486
2502
|
},
|
|
2487
|
-
});
|
|
2503
|
+
});
|
|
2504
|
+
const Form = FormImpl;
|
|
2488
2505
|
|
|
2489
2506
|
let FIELD_ARRAY_COUNTER = 0;
|
|
2490
2507
|
function useFieldArray(arrayPath) {
|
|
@@ -2644,7 +2661,7 @@ function useFieldArray(arrayPath) {
|
|
|
2644
2661
|
};
|
|
2645
2662
|
}
|
|
2646
2663
|
|
|
2647
|
-
const
|
|
2664
|
+
const FieldArrayImpl = defineComponent({
|
|
2648
2665
|
name: 'FieldArray',
|
|
2649
2666
|
inheritAttrs: false,
|
|
2650
2667
|
props: {
|
|
@@ -2681,9 +2698,10 @@ const FieldArray = defineComponent({
|
|
|
2681
2698
|
return children;
|
|
2682
2699
|
};
|
|
2683
2700
|
},
|
|
2684
|
-
});
|
|
2701
|
+
});
|
|
2702
|
+
const FieldArray = FieldArrayImpl;
|
|
2685
2703
|
|
|
2686
|
-
const
|
|
2704
|
+
const ErrorMessageImpl = defineComponent({
|
|
2687
2705
|
name: 'ErrorMessage',
|
|
2688
2706
|
props: {
|
|
2689
2707
|
as: {
|
|
@@ -2726,7 +2744,8 @@ const ErrorMessage = defineComponent({
|
|
|
2726
2744
|
return h(tag, attrs, children);
|
|
2727
2745
|
};
|
|
2728
2746
|
},
|
|
2729
|
-
});
|
|
2747
|
+
});
|
|
2748
|
+
const ErrorMessage = ErrorMessageImpl;
|
|
2730
2749
|
|
|
2731
2750
|
function useResetForm() {
|
|
2732
2751
|
const form = injectWithSelf(FormContextKey);
|
package/dist/vee-validate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vee-validate v4.5.
|
|
2
|
+
* vee-validate v4.5.6
|
|
3
3
|
* (c) 2021 Abdelrahman Awad
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
|
8
8
|
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
|
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VeeValidate = {}, global.Vue));
|
|
10
|
-
}(this, (function (exports, vue) { 'use strict';
|
|
10
|
+
})(this, (function (exports, vue) { 'use strict';
|
|
11
11
|
|
|
12
12
|
function isCallable(fn) {
|
|
13
13
|
return typeof fn === 'function';
|
|
@@ -1174,7 +1174,7 @@
|
|
|
1174
1174
|
return patchCheckboxApi(_useField(name, rules, opts));
|
|
1175
1175
|
}
|
|
1176
1176
|
|
|
1177
|
-
const
|
|
1177
|
+
const FieldImpl = vue.defineComponent({
|
|
1178
1178
|
name: 'Field',
|
|
1179
1179
|
inheritAttrs: false,
|
|
1180
1180
|
props: {
|
|
@@ -1376,11 +1376,15 @@
|
|
|
1376
1376
|
return isPropPresent(props, 'modelValue') ? props.modelValue : ctx.attrs.value;
|
|
1377
1377
|
}
|
|
1378
1378
|
return isPropPresent(props, 'modelValue') ? props.modelValue : undefined;
|
|
1379
|
-
}
|
|
1379
|
+
}
|
|
1380
|
+
const Field = FieldImpl;
|
|
1380
1381
|
|
|
1381
1382
|
let FORM_COUNTER = 0;
|
|
1382
1383
|
function useForm(opts) {
|
|
1383
1384
|
const formId = FORM_COUNTER++;
|
|
1385
|
+
// Prevents fields from double resetting their values, which causes checkboxes to toggle their initial value
|
|
1386
|
+
// TODO: This won't be needed if we centralize all the state inside the `form` for form inputs
|
|
1387
|
+
let RESET_LOCK = false;
|
|
1384
1388
|
// A lookup containing fields or field groups
|
|
1385
1389
|
const fieldsByPath = vue.ref({});
|
|
1386
1390
|
// If the form is currently submitting
|
|
@@ -1502,15 +1506,15 @@
|
|
|
1502
1506
|
setInPath(formValues, field, clonedValue);
|
|
1503
1507
|
return;
|
|
1504
1508
|
}
|
|
1505
|
-
// Multiple checkboxes, and only one of them got updated
|
|
1506
1509
|
if (isFieldGroup(fieldInstance) && ((_a = fieldInstance[0]) === null || _a === void 0 ? void 0 : _a.type) === 'checkbox' && !Array.isArray(value)) {
|
|
1510
|
+
// Multiple checkboxes, and only one of them got updated
|
|
1507
1511
|
const newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field) || [], value, undefined));
|
|
1508
1512
|
setInPath(formValues, field, newValue);
|
|
1509
1513
|
return;
|
|
1510
1514
|
}
|
|
1511
1515
|
let newValue = value;
|
|
1512
1516
|
// Single Checkbox: toggles the field value unless the field is being reset then force it
|
|
1513
|
-
if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force) {
|
|
1517
|
+
if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force && !RESET_LOCK) {
|
|
1514
1518
|
newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field), value, vue.unref(fieldInstance.uncheckedValue)));
|
|
1515
1519
|
}
|
|
1516
1520
|
setInPath(formValues, field, newValue);
|
|
@@ -1551,6 +1555,7 @@
|
|
|
1551
1555
|
* Resets all fields
|
|
1552
1556
|
*/
|
|
1553
1557
|
function resetForm(state) {
|
|
1558
|
+
RESET_LOCK = true;
|
|
1554
1559
|
// set initial values if provided
|
|
1555
1560
|
if (state === null || state === void 0 ? void 0 : state.values) {
|
|
1556
1561
|
setInitialValues(state.values);
|
|
@@ -1566,6 +1571,7 @@
|
|
|
1566
1571
|
if (!field) {
|
|
1567
1572
|
return;
|
|
1568
1573
|
}
|
|
1574
|
+
// avoid resetting the field values, because they should've been reset already.
|
|
1569
1575
|
applyFieldMutation(field, f => f.resetField());
|
|
1570
1576
|
});
|
|
1571
1577
|
if (state === null || state === void 0 ? void 0 : state.touched) {
|
|
@@ -1573,6 +1579,9 @@
|
|
|
1573
1579
|
}
|
|
1574
1580
|
setErrors((state === null || state === void 0 ? void 0 : state.errors) || {});
|
|
1575
1581
|
submitCount.value = (state === null || state === void 0 ? void 0 : state.submitCount) || 0;
|
|
1582
|
+
vue.nextTick(() => {
|
|
1583
|
+
RESET_LOCK = false;
|
|
1584
|
+
});
|
|
1576
1585
|
}
|
|
1577
1586
|
function insertFieldAtPath(field, path) {
|
|
1578
1587
|
const rawField = vue.markRaw(field);
|
|
@@ -1888,16 +1897,23 @@
|
|
|
1888
1897
|
const isDirty = vue.computed(() => {
|
|
1889
1898
|
return !es6(currentValues, vue.unref(initialValues));
|
|
1890
1899
|
});
|
|
1891
|
-
|
|
1900
|
+
function calculateFlags() {
|
|
1892
1901
|
const fields = Object.values(fieldsByPath.value).flat(1).filter(Boolean);
|
|
1893
1902
|
return keysOf(MERGE_STRATEGIES).reduce((acc, flag) => {
|
|
1894
1903
|
const mergeMethod = MERGE_STRATEGIES[flag];
|
|
1895
1904
|
acc[flag] = fields[mergeMethod](field => field.meta[flag]);
|
|
1896
1905
|
return acc;
|
|
1897
1906
|
}, {});
|
|
1907
|
+
}
|
|
1908
|
+
const flags = vue.reactive(calculateFlags());
|
|
1909
|
+
vue.watchEffect(() => {
|
|
1910
|
+
const value = calculateFlags();
|
|
1911
|
+
flags.touched = value.touched;
|
|
1912
|
+
flags.valid = value.valid;
|
|
1913
|
+
flags.pending = value.pending;
|
|
1898
1914
|
});
|
|
1899
1915
|
return vue.computed(() => {
|
|
1900
|
-
return Object.assign(Object.assign({ initialValues: vue.unref(initialValues) }, flags
|
|
1916
|
+
return Object.assign(Object.assign({ initialValues: vue.unref(initialValues) }, flags), { valid: flags.valid && !keysOf(errors.value).length, dirty: isDirty.value });
|
|
1901
1917
|
});
|
|
1902
1918
|
}
|
|
1903
1919
|
/**
|
|
@@ -1982,7 +1998,7 @@
|
|
|
1982
1998
|
};
|
|
1983
1999
|
}
|
|
1984
2000
|
|
|
1985
|
-
const
|
|
2001
|
+
const FormImpl = vue.defineComponent({
|
|
1986
2002
|
name: 'Form',
|
|
1987
2003
|
inheritAttrs: false,
|
|
1988
2004
|
props: {
|
|
@@ -2094,7 +2110,8 @@
|
|
|
2094
2110
|
return vue.h(tag, Object.assign(Object.assign(Object.assign({}, formAttrs), ctx.attrs), { onSubmit, onReset: handleFormReset }), children);
|
|
2095
2111
|
};
|
|
2096
2112
|
},
|
|
2097
|
-
});
|
|
2113
|
+
});
|
|
2114
|
+
const Form = FormImpl;
|
|
2098
2115
|
|
|
2099
2116
|
let FIELD_ARRAY_COUNTER = 0;
|
|
2100
2117
|
function useFieldArray(arrayPath) {
|
|
@@ -2254,7 +2271,7 @@
|
|
|
2254
2271
|
};
|
|
2255
2272
|
}
|
|
2256
2273
|
|
|
2257
|
-
const
|
|
2274
|
+
const FieldArrayImpl = vue.defineComponent({
|
|
2258
2275
|
name: 'FieldArray',
|
|
2259
2276
|
inheritAttrs: false,
|
|
2260
2277
|
props: {
|
|
@@ -2291,9 +2308,10 @@
|
|
|
2291
2308
|
return children;
|
|
2292
2309
|
};
|
|
2293
2310
|
},
|
|
2294
|
-
});
|
|
2311
|
+
});
|
|
2312
|
+
const FieldArray = FieldArrayImpl;
|
|
2295
2313
|
|
|
2296
|
-
const
|
|
2314
|
+
const ErrorMessageImpl = vue.defineComponent({
|
|
2297
2315
|
name: 'ErrorMessage',
|
|
2298
2316
|
props: {
|
|
2299
2317
|
as: {
|
|
@@ -2336,7 +2354,8 @@
|
|
|
2336
2354
|
return vue.h(tag, attrs, children);
|
|
2337
2355
|
};
|
|
2338
2356
|
},
|
|
2339
|
-
});
|
|
2357
|
+
});
|
|
2358
|
+
const ErrorMessage = ErrorMessageImpl;
|
|
2340
2359
|
|
|
2341
2360
|
function useResetForm() {
|
|
2342
2361
|
const form = injectWithSelf(FormContextKey);
|
|
@@ -2613,4 +2632,4 @@
|
|
|
2613
2632
|
|
|
2614
2633
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2615
2634
|
|
|
2616
|
-
}))
|
|
2635
|
+
}));
|
package/dist/vee-validate.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vee-validate v4.5.
|
|
2
|
+
* vee-validate v4.5.6
|
|
3
3
|
* (c) 2021 Abdelrahman Awad
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidate={},e.Vue)}(this,(function(e,t){"use strict";function r(e){return"function"==typeof e}function n(e){return null==e}const a=e=>null!==e&&!!e&&"object"==typeof e&&!Array.isArray(e);function u(e){return Number(e)>=0}const i={};const o=Symbol("vee-validate-form"),l=Symbol("vee-validate-field-instance"),s=Symbol("Default empty value");function d(e){return r(e)&&!!e.__locatorRef}function c(e){return!!e&&r(e.validate)}function f(e){return"checkbox"===e||"radio"===e}function v(e){return/^\[.+\]$/i.test(e)}function m(e){return"SELECT"===e.tagName}function p(e,t){return function(e,t){const r=![!1,null,void 0,0].includes(t.multiple)&&!Number.isNaN(t.multiple);return"select"===e&&"multiple"in t&&r}(e,t)||function(e,t){return function(e){return["input","textarea","select"].includes(e)}(e)&&"file"===t.type}(e,t)}function h(e){return!!e&&(!!("undefined"!=typeof Event&&r(Event)&&e instanceof Event)||!(!e||!e.srcElement))}function y(e,t){return t in e&&e[t]!==s}function g(e){return v(e)?e.replace(/\[|\]/gi,""):e}function b(e,t,r){if(!e)return r;if(v(t))return e[g(t)];return(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce(((e,t)=>{return(a(n=e)||Array.isArray(n))&&t in e?e[t]:r;var n}),e)}function F(e,t,r){if(v(t))return void(e[g(t)]=r);const a=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=e;for(let e=0;e<a.length;e++){if(e===a.length-1)return void(i[a[e]]=r);a[e]in i&&!n(i[a[e]])||(i[a[e]]=u(a[e+1])?[]:{}),i=i[a[e]]}}function O(e,t){Array.isArray(e)&&u(t)?e.splice(Number(t),1):a(e)&&delete e[t]}function V(e,t){if(v(t))return void delete e[g(t)];const r=t.split(/\.|\[(\d+)\]/).filter(Boolean);let u=e;for(let e=0;e<r.length;e++){if(e===r.length-1){O(u,r[e]);break}if(!(r[e]in u)||n(u[r[e]]))break;u=u[r[e]]}const i=r.map(((t,n)=>b(e,r.slice(0,n).join("."))));for(let t=i.length-1;t>=0;t--)o=i[t],(Array.isArray(o)?0===o.length:a(o)&&0===Object.keys(o).length)&&(0!==t?O(i[t-1],r[t-1]):O(e,r[0]));var o}function A(e){return Object.keys(e)}function w(e,r){const n=t.getCurrentInstance();return(null==n?void 0:n.provides[e])||t.inject(e,r)}function j(e){t.warn(`[vee-validate]: ${e}`)}function E(e){return Array.isArray(e)?e[0]:e}function S(e,t,r){if(Array.isArray(e)){const r=[...e],n=r.indexOf(t);return n>=0?r.splice(n,1):r.push(t),r}return e===t?r:t}const k=(e,t,r)=>t.slots.default?"string"!=typeof e&&e?{default:()=>{var e,n;return null===(n=(e=t.slots).default)||void 0===n?void 0:n.call(e,r())}}:t.slots.default(r()):t.slots.default;function B(e){if(M(e))return e._value}function M(e){return"_value"in e}function I(e){if(!h(e))return e;const t=e.target;if(f(t.type)&&M(t))return B(t);if("file"===t.type&&t.files)return Array.from(t.files);if(m(r=t)&&r.multiple)return Array.from(t.options).filter((e=>e.selected&&!e.disabled)).map(B);var r;if(m(t)){const e=Array.from(t.options).find((e=>e.selected));return e?B(e):t.value}return t.value}function T(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?a(e)&&e._$$isNormalized?e:a(e)?Object.keys(e).reduce(((t,r)=>{const n=function(e){if(!0===e)return[];if(Array.isArray(e))return e;if(a(e))return e;return[e]}(e[r]);return!1!==e[r]&&(t[r]=C(n)),t}),t):"string"!=typeof e?t:e.split("|").reduce(((e,t)=>{const r=R(t);return r.name?(e[r.name]=C(r.params),e):e}),t):t}function C(e){const t=e=>"string"==typeof e&&"@"===e[0]?function(e){const t=t=>b(t,e)||t[e];return t.__locatorRef=e,t}(e.slice(1)):e;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce(((r,n)=>(r[n]=t(e[n]),r)),{})}const R=e=>{let t=[];const r=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:r,params:t}};let x=Object.assign({},{generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const P=()=>x,N=e=>{x=Object.assign(Object.assign({},x),e)};async function _(e,t,n={}){const a=null==n?void 0:n.bails,u={name:(null==n?void 0:n.name)||"{field}",rules:t,bails:null==a||a,formData:(null==n?void 0:n.values)||{}},i=await async function(e,t){if(c(e.rules))return async function(e,t,r){var n;return{errors:await t.validate(e,{abortEarly:null===(n=r.bails)||void 0===n||n}).then((()=>[])).catch((e=>{if("ValidationError"===e.name)return e.errors;throw e}))}}(t,e.rules,{bails:e.bails});if(r(e.rules)){const r={field:e.name,form:e.formData,value:t},n=await e.rules(t,r),a="string"!=typeof n&&n,u="string"==typeof n?n:D(r);return{errors:a?[]:[u]}}const n=Object.assign(Object.assign({},e),{rules:T(e.rules)}),a=[],u=Object.keys(n.rules),i=u.length;for(let r=0;r<i;r++){const i=u[r],o=await $(n,t,{name:i,params:n.rules[i]});if(o.error&&(a.push(o.error),e.bails))return{errors:a}}return{errors:a}}(u,e),o=i.errors;return{errors:o,valid:!o.length}}async function $(e,t,r){const n=(a=r.name,i[a]);var a;if(!n)throw new Error(`No such validator '${r.name}' exists.`);const u=function(e,t){const r=e=>d(e)?e(t):e;if(Array.isArray(e))return e.map(r);return Object.keys(e).reduce(((t,n)=>(t[n]=r(e[n]),t)),{})}(r.params,e.formData),o={field:e.name,value:t,form:e.formData,rule:Object.assign(Object.assign({},r),{params:u})},l=await n(t,u,o);return"string"==typeof l?{error:l}:{error:l?void 0:D(o)}}function D(e){const t=P().generateMessage;return t?t(e):"Field is invalid"}async function U(e,t,r){const n=A(e).map((async n=>{var a,u,i;const o=await _(b(t,n),e[n],{name:(null===(a=null==r?void 0:r.names)||void 0===a?void 0:a[n])||n,values:t,bails:null===(i=null===(u=null==r?void 0:r.bailsMap)||void 0===u?void 0:u[n])||void 0===i||i});return Object.assign(Object.assign({},o),{path:n})}));let a=!0;const u=await Promise.all(n),i={},o={};for(const e of u)i[e.path]={valid:e.valid,errors:e.errors},e.valid||(a=!1,o[e.path]=e.errors[0]);return{valid:a,results:i,errors:o}}function q(e,t,r){"object"==typeof r.value&&(r.value=z(r.value)),r.enumerable&&!r.get&&!r.set&&r.configurable&&r.writable&&"__proto__"!==t?e[t]=r.value:Object.defineProperty(e,t,r)}function z(e){if("object"!=typeof e)return e;var t,r,n,a=0,u=Object.prototype.toString.call(e);if("[object Object]"===u?n=Object.create(e.__proto__||null):"[object Array]"===u?n=Array(e.length):"[object Set]"===u?(n=new Set,e.forEach((function(e){n.add(z(e))}))):"[object Map]"===u?(n=new Map,e.forEach((function(e,t){n.set(z(t),z(e))}))):"[object Date]"===u?n=new Date(+e):"[object RegExp]"===u?n=new RegExp(e.source,e.flags):"[object DataView]"===u?n=new e.constructor(z(e.buffer)):"[object ArrayBuffer]"===u?n=e.slice(0):"Array]"===u.slice(-6)&&(n=new e.constructor(e)),n){for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)q(n,r[a],Object.getOwnPropertyDescriptor(e,r[a]));for(a=0,r=Object.getOwnPropertyNames(e);a<r.length;a++)Object.hasOwnProperty.call(n,t=r[a])&&n[t]===e[t]||q(n,t,Object.getOwnPropertyDescriptor(e,t))}return n||e}var L=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,a,u;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(a=n;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(a of t.entries())if(!r.has(a[0]))return!1;for(a of t.entries())if(!e(a[1],r.get(a[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(a of t.entries())if(!r.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(a=n;0!=a--;)if(t[a]!==r[a])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(u=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,u[a]))return!1;for(a=n;0!=a--;){var i=u[a];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r};let K=0;function G(e,r){const{value:n,initialValue:a,setInitialValue:u}=function(e,r,n){const a=n?w(o,void 0):void 0,u=t.ref(t.unref(r));function i(){return a?b(a.meta.value.initialValues,t.unref(e),t.unref(u)):t.unref(u)}function l(r){a?a.setFieldInitialValue(t.unref(e),r):u.value=r}const s=t.computed(i);if(!a){return{value:t.ref(i()),initialValue:s,setInitialValue:l}}const d=r?t.unref(r):b(a.values,t.unref(e),t.unref(s));a.stageInitialValue(t.unref(e),d);return{value:t.computed({get:()=>b(a.values,t.unref(e)),set(r){a.setFieldValue(t.unref(e),r)}}),initialValue:s,setInitialValue:l}}(e,r.modelValue,!r.standalone),{errorMessage:i,errors:l,setErrors:s}=function(e,r){const n=r?w(o,void 0):void 0;function a(e){return e?Array.isArray(e)?e:[e]:[]}if(!n){const e=t.ref([]);return{errors:e,errorMessage:t.computed((()=>e.value[0])),setErrors:t=>{e.value=a(t)}}}const u=t.computed((()=>n.errorBag.value[t.unref(e)]||[]));return{errors:u,errorMessage:t.computed((()=>u.value[0])),setErrors:r=>{n.setFieldErrorBag(t.unref(e),a(r))}}}(e,!r.standalone),d=function(e,r,n){const a=t.reactive({touched:!1,pending:!1,valid:!0,validated:!!t.unref(n).length,initialValue:t.computed((()=>t.unref(r))),dirty:t.computed((()=>!L(t.unref(e),t.unref(r))))});return t.watch(n,(e=>{a.valid=!e.length}),{immediate:!0,flush:"sync"}),a}(n,a,l);return{id:K>=Number.MAX_SAFE_INTEGER?0:++K,path:e,value:n,initialValue:a,meta:d,errors:l,errorMessage:i,setState:function(e){var t;"value"in e&&(n.value=e.value),"errors"in e&&s(e.errors),"touched"in e&&(d.touched=null!==(t=e.touched)&&void 0!==t?t:d.touched),"initialValue"in e&&u(e.initialValue)}}}function X(e,r,n){return f(null==n?void 0:n.type)?function(e,r,n){const a=(null==n?void 0:n.standalone)?void 0:w(o),u=null==n?void 0:n.checkedValue,i=null==n?void 0:n.uncheckedValue;function l(e){const r=e.handleChange,n=t.computed((()=>{const r=t.unref(e.value),n=t.unref(u);return Array.isArray(r)?r.includes(n):n===r}));function o(o,l=!0){var s,d;if(n.value===(null===(d=null===(s=o)||void 0===s?void 0:s.target)||void 0===d?void 0:d.checked))return;let c=I(o);a||(c=S(t.unref(e.value),t.unref(u),t.unref(i))),r(c,l)}return t.onBeforeUnmount((()=>{n.value&&o(t.unref(u),!1)})),Object.assign(Object.assign({},e),{checked:n,checkedValue:u,uncheckedValue:i,handleChange:o})}return l(H(e,r,n))}(e,r,n):H(e,r,n)}function H(e,n,a){const{initialValue:u,validateOnMount:i,bails:s,type:f,checkedValue:v,label:m,validateOnValueUpdate:p,uncheckedValue:h,standalone:y}=function(e,t){const r=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,rules:"",label:e,validateOnValueUpdate:!0,standalone:!1});if(!t)return r();const n="valueProp"in t?t.valueProp:t.checkedValue;return Object.assign(Object.assign(Object.assign({},r()),t||{}),{checkedValue:n})}(t.unref(e),a),g=y?void 0:w(o),{id:F,value:O,initialValue:V,meta:j,setState:E,errors:S,errorMessage:k}=G(e,{modelValue:u,standalone:y}),B=t.computed((()=>{let a=t.unref(n);const u=t.unref(null==g?void 0:g.schema);return u&&!c(u)&&(a=function(e,t){if(!e)return;return e[t]}(u,t.unref(e))||a),c(a)||r(a)?a:T(a)}));async function M(r){var n,a;return(null==g?void 0:g.validateSchema)?null!==(n=(await g.validateSchema(r)).results[t.unref(e)])&&void 0!==n?n:{valid:!0,errors:[]}:_(O.value,B.value,{name:t.unref(m)||t.unref(e),values:null!==(a=null==g?void 0:g.values)&&void 0!==a?a:{},bails:s})}async function C(){j.pending=!0,j.validated=!0;const e=await M("validated-only");return E({errors:e.errors}),j.pending=!1,e}async function R(){const e=await M("silent");return j.valid=e.valid,e}let x;function P(){x=t.watch(O,p?C:R,{deep:!0})}function N(e){var r;null==x||x();const n=e&&"value"in e?e.value:V.value;E({value:z(n),initialValue:z(n),touched:null!==(r=null==e?void 0:e.touched)&&void 0!==r&&r,errors:(null==e?void 0:e.errors)||[]}),j.pending=!1,j.validated=!1,R(),t.nextTick((()=>{P()}))}t.onMounted((()=>{if(i)return C();g&&g.validateSchema||R()})),P();const $={id:F,name:e,label:m,value:O,meta:j,errors:S,errorMessage:k,type:f,checkedValue:v,uncheckedValue:h,bails:s,resetField:N,handleReset:()=>N(),validate:function(e){return(null==e?void 0:e.mode)&&"force"!==(null==e?void 0:e.mode)?"validated-only"===(null==e?void 0:e.mode)?C():R():C()},handleChange:(e,t=!0)=>{const r=I(e);O.value=r,!p&&t&&C()},handleBlur:()=>{j.touched=!0},setState:E,setTouched:function(e){j.touched=e},setErrors:function(e){E({errors:Array.isArray(e)?e:[e]})},setValue:function(e){O.value=e}};if(t.provide(l,$),t.isRef(n)&&"function"!=typeof t.unref(n)&&t.watch(n,((e,t)=>{L(e,t)||(j.validated?C():R())}),{deep:!0}),!g)return $;g.register($),t.onBeforeUnmount((()=>{g.unregister($)}));const D=t.computed((()=>{const e=B.value;return!e||r(e)||c(e)?{}:Object.keys(e).reduce(((t,r)=>{const n=(a=e[r],Array.isArray(a)?a.filter(d):A(a).filter((e=>d(a[e]))).map((e=>a[e]))).map((e=>e.__locatorRef)).reduce(((e,t)=>{const r=b(g.values,t)||g.values[t];return void 0!==r&&(e[t]=r),e}),{});var a;return Object.assign(t,n),t}),{})}));return t.watch(D,((e,t)=>{if(!Object.keys(e).length)return;!L(e,t)&&(j.validated?C():R())})),$}const J=t.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>P().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:s},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1}},setup(e,r){const n=t.toRef(e,"rules"),a=t.toRef(e,"name"),u=t.toRef(e,"label"),i=t.toRef(e,"uncheckedValue"),o=y(e,"onUpdate:modelValue"),{errors:l,value:d,errorMessage:c,validate:v,handleChange:m,handleBlur:h,setTouched:g,resetField:b,handleReset:F,meta:O,checked:V,setErrors:A}=X(a,n,{validateOnMount:e.validateOnMount,bails:e.bails,standalone:e.standalone,type:r.attrs.type,initialValue:W(e,r),checkedValue:r.attrs.value,uncheckedValue:i,label:u,validateOnValueUpdate:!1}),w=o?function(e,t=!0){m(e,t),r.emit("update:modelValue",d.value)}:m,j=e=>{f(r.attrs.type)||(d.value=I(e))},E=o?function(e){j(e),r.emit("update:modelValue",d.value)}:j,S=t.computed((()=>{const{validateOnInput:t,validateOnChange:n,validateOnBlur:a,validateOnModelUpdate:u}=function(e){var t,r,n,a;const{validateOnInput:u,validateOnChange:i,validateOnBlur:o,validateOnModelUpdate:l}=P();return{validateOnInput:null!==(t=e.validateOnInput)&&void 0!==t?t:u,validateOnChange:null!==(r=e.validateOnChange)&&void 0!==r?r:i,validateOnBlur:null!==(n=e.validateOnBlur)&&void 0!==n?n:o,validateOnModelUpdate:null!==(a=e.validateOnModelUpdate)&&void 0!==a?a:l}}(e),i=[h,r.attrs.onBlur,a?v:void 0].filter(Boolean),o=[e=>w(e,t),r.attrs.onInput].filter(Boolean),l=[e=>w(e,n),r.attrs.onChange].filter(Boolean),s={name:e.name,onBlur:i,onInput:o,onChange:l};u&&(s["onUpdate:modelValue"]=[w]),f(r.attrs.type)&&V?s.checked=V.value:s.value=d.value;return p(Q(e,r),r.attrs)&&delete s.value,s})),B=t.toRef(e,"modelValue");function M(){return{field:S.value,value:d.value,meta:O,errors:l.value,errorMessage:c.value,validate:v,resetField:b,handleChange:w,handleInput:E,handleReset:F,handleBlur:h,setTouched:g,setErrors:A}}return t.watch(B,(t=>{t===s&&void 0===d.value||t!==function(e,t){if(t.number)return function(e){const t=parseFloat(e);return isNaN(t)?e:t}(e);return e}(d.value,e.modelModifiers)&&(d.value=t===s?void 0:t,v())})),r.expose({setErrors:A,setTouched:g,reset:b,validate:v,handleChange:m}),()=>{const n=t.resolveDynamicComponent(Q(e,r)),a=k(n,r,M);return n?t.h(n,Object.assign(Object.assign({},r.attrs),S.value),a):a}}});function Q(e,t){let r=e.as||"";return e.as||t.slots.default||(r="input"),r}function W(e,t){return f(t.attrs.type)?y(e,"modelValue")?e.modelValue:void 0:y(e,"modelValue")?e.modelValue:t.attrs.value}let Y=0;function Z(e){const r=Y++,n=t.ref({}),a=t.ref(!1),u=t.ref(0),i={},l=t.reactive(z(t.unref(null==e?void 0:e.initialValues)||{})),{errorBag:s,setErrorBag:d,setFieldErrorBag:f}=function(e){const r=t.ref({});function n(e){return Array.isArray(e)?e:e?[e]:[]}function a(e,t){t?r.value[e]=n(t):delete r.value[e]}function u(e){r.value=A(e).reduce(((t,r)=>{const a=e[r];return a&&(t[r]=n(a)),t}),{})}e&&u(e);return{errorBag:r,setErrorBag:u,setFieldErrorBag:a}}(null==e?void 0:e.initialErrors),v=t.computed((()=>A(s.value).reduce(((e,t)=>{const r=s.value[t];return r&&r.length&&(e[t]=r[0]),e}),{})));function m(e){const t=n.value[e];return Array.isArray(t)?t[0]:t}function p(e){return!!n.value[e]}const y=t.computed((()=>A(n.value).reduce(((e,r)=>{const n=m(r);return n&&(e[r]=t.unref(n.label||n.name)||""),e}),{}))),g=t.computed((()=>A(n.value).reduce(((e,t)=>{var r;const n=m(t);return n&&(e[t]=null===(r=n.bails)||void 0===r||r),e}),{}))),O=Object.assign({},(null==e?void 0:e.initialErrors)||{}),{initialValues:w,originalInitialValues:j,setInitialValues:E}=function(e,r,n){const a=t.ref(z(t.unref(n))||{}),u=t.ref(z(t.unref(n))||{});function i(t,n=!1){a.value=z(t),u.value=z(t),n&&A(e.value).forEach((t=>{const n=e.value[t],u=Array.isArray(n)?n.some((e=>e.meta.touched)):null==n?void 0:n.meta.touched;if(!n||u)return;const i=b(a.value,t);F(r,t,z(i))}))}t.isRef(n)&&t.watch(n,(e=>{i(e,!0)}),{deep:!0});return{initialValues:a,originalInitialValues:u,setInitialValues:i}}(n,l,null==e?void 0:e.initialValues),k=function(e,r,n,a){const u={touched:"some",pending:"some",valid:"every"},i=t.computed((()=>!L(r,t.unref(n)))),o=t.computed((()=>{const t=Object.values(e.value).flat(1).filter(Boolean);return A(u).reduce(((e,r)=>{const n=u[r];return e[r]=t[n]((e=>e.meta[r])),e}),{})}));return t.computed((()=>Object.assign(Object.assign({initialValues:t.unref(n)},o.value),{valid:o.value.valid&&!A(a.value).length,dirty:i.value})))}(n,l,w,v),B=null==e?void 0:e.validationSchema,M={formId:r,fieldsByPath:n,values:l,errorBag:s,errors:v,schema:B,submitCount:u,meta:k,isSubmitting:a,fieldArraysLookup:i,validateSchema:t.unref(B)?async function(e){const t=await J(),r=M.fieldsByPath.value||{},n=A(M.errorBag.value);return[...new Set([...A(t.results),...A(r),...n])].reduce(((n,a)=>{const u=r[a],i=(t.results[a]||{errors:[]}).errors,o={errors:i,valid:!i.length};if(n.results[a]=o,o.valid||(n.errors[a]=o.errors[0]),!u)return C(a,i),n;if(T(u,(e=>e.meta.valid=o.valid)),"silent"===e)return n;const l=Array.isArray(u)?u.some((e=>e.meta.validated)):u.meta.validated;return"validated-only"!==e||l?(T(u,(e=>e.setState({errors:o.errors}))),n):n}),{valid:t.valid,results:{},errors:{}})}:void 0,validate:K,register:function(e){const r=t.unref(e.name);D(e,r),t.isRef(e.name)&&t.watch(e.name,(async(r,n)=>{await t.nextTick(),q(e,n),D(e,r),(v.value[n]||v.value[r])&&G(r),await t.nextTick(),p(n)||V(l,n)}));const n=t.unref(e.errorMessage);n&&(null==O?void 0:O[r])!==n&&G(r);delete O[r]},unregister:function(e){const r=t.unref(e.name);q(e,r),t.nextTick((()=>{p(r)||(C(r,void 0),V(l,r))}))},setFieldErrorBag:f,validateField:G,setFieldValue:x,setValues:P,setErrors:R,setFieldError:C,setFieldTouched:N,setTouched:_,resetForm:$,handleSubmit:X,stageInitialValue:function(e,t){F(l,e,t),H(e,t)},unsetInitialValue:function(e){V(w.value,e)},setFieldInitialValue:H};function I(e){return Array.isArray(e)}function T(e,t){return Array.isArray(e)?e.forEach(t):t(e)}function C(e,t){f(e,t)}function R(e){d(e)}function x(e,r,{force:a}={force:!1}){var u;const i=n.value[e],o=z(r);if(!i)return void F(l,e,o);if(I(i)&&"checkbox"===(null===(u=i[0])||void 0===u?void 0:u.type)&&!Array.isArray(r)){const t=z(S(b(l,e)||[],r,void 0));return void F(l,e,t)}let s=r;I(i)||"checkbox"!==i.type||a||(s=z(S(b(l,e),r,t.unref(i.uncheckedValue)))),F(l,e,s)}function P(e){A(l).forEach((e=>{delete l[e]})),A(e).forEach((t=>{x(t,e[t])})),Object.values(i).forEach((e=>e&&e.reset()))}function N(e,t){const r=n.value[e];r&&T(r,(e=>e.setTouched(t)))}function _(e){A(e).forEach((t=>{N(t,!!e[t])}))}function $(e){(null==e?void 0:e.values)?(E(e.values),P(null==e?void 0:e.values)):(E(j.value),P(j.value)),Object.values(n.value).forEach((e=>{e&&T(e,(e=>e.resetField()))})),(null==e?void 0:e.touched)&&_(e.touched),R((null==e?void 0:e.errors)||{}),u.value=(null==e?void 0:e.submitCount)||0}function D(e,r){const a=t.markRaw(e),u=r;if(!n.value[u])return void(n.value[u]=a);const i=n.value[u];i&&!Array.isArray(i)&&(n.value[u]=[i]),n.value[u]=[...n.value[u],a]}function q(e,t){const r=t,a=n.value[r];if(a)if(I(a)||e.id!==a.id){if(I(a)){const t=a.findIndex((t=>t.id===e.id));if(-1===t)return;if(a.splice(t,1),1===a.length)return void(n.value[r]=a[0]);a.length||delete n.value[r]}}else delete n.value[r]}async function K(e){if(M.validateSchema)return M.validateSchema((null==e?void 0:e.mode)||"force");const r=await Promise.all(Object.values(n.value).map((r=>{const n=Array.isArray(r)?r[0]:r;return n?n.validate(e).then((e=>({key:t.unref(n.name),valid:e.valid,errors:e.errors}))):Promise.resolve({key:"",valid:!0,errors:[]})}))),a={},u={};for(const e of r)a[e.key]={valid:e.valid,errors:e.errors},e.errors.length&&(u[e.key]=e.errors[0]);return{valid:r.every((e=>e.valid)),results:a,errors:u}}async function G(e){const r=n.value[e];return r?Array.isArray(r)?r.map((e=>e.validate()))[0]:r.validate():(t.warn(`field with name ${e} was not found`),Promise.resolve({errors:[],valid:!0}))}function X(e,t){return function(r){return r instanceof Event&&(r.preventDefault(),r.stopPropagation()),_(A(n.value).reduce(((e,t)=>(e[t]=!0,e)),{})),a.value=!0,u.value++,K().then((n=>{if(n.valid&&"function"==typeof e)return e(z(l),{evt:r,setErrors:R,setFieldError:C,setTouched:_,setFieldTouched:N,setValues:P,setFieldValue:x,resetForm:$});n.valid||"function"!=typeof t||t({values:z(l),evt:r,errors:n.errors,results:n.results})})).then((e=>(a.value=!1,e)),(e=>{throw a.value=!1,e}))}}function H(e,t){F(w.value,e,z(t))}const J=function(e,t=0){let r=null,n=[];return function(...a){return r&&window.clearTimeout(r),r=window.setTimeout((()=>{const t=e(...a);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}((async function(){const e=t.unref(B);if(!e)return{valid:!0,results:{},errors:{}};const r=c(e)?await async function(e,t){const r=await e.validate(t,{abortEarly:!1}).then((()=>[])).catch((e=>{if("ValidationError"!==e.name)throw e;return e.inner||[]})),n={},a={};for(const e of r){const t=e.errors;n[e.path]={valid:!t.length,errors:t},t.length&&(a[e.path]=t[0])}return{valid:!r.length,results:n,errors:a}}(e,l):await U(e,l,{names:y.value,bailsMap:g.value});return r}),5);const Q=X(((e,{evt:t})=>{(function(e){return h(e)&&e.target&&"submit"in e.target})(t)&&t.target.submit()}));return t.onMounted((()=>{(null==e?void 0:e.initialErrors)&&R(e.initialErrors),(null==e?void 0:e.initialTouched)&&_(e.initialTouched),(null==e?void 0:e.validateOnMount)?K():M.validateSchema&&M.validateSchema("silent")})),t.isRef(B)&&t.watch(B,(()=>{var e;null===(e=M.validateSchema)||void 0===e||e.call(M,"validated-only")})),t.provide(o,M),{errors:v,meta:k,values:l,isSubmitting:a,submitCount:u,validate:K,validateField:G,handleReset:()=>$(),resetForm:$,handleSubmit:X,submitForm:Q,setFieldError:C,setErrors:R,setFieldValue:x,setValues:P,setFieldTouched:N,setTouched:_}}const ee=t.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:String,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0}},setup(e,r){const n=t.toRef(e,"initialValues"),a=t.toRef(e,"validationSchema"),{errors:u,values:i,meta:o,isSubmitting:l,submitCount:s,validate:d,validateField:c,handleReset:f,resetForm:v,handleSubmit:m,submitForm:p,setErrors:y,setFieldError:g,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V}=Z({validationSchema:a.value?a:void 0,initialValues:n,initialErrors:e.initialErrors,initialTouched:e.initialTouched,validateOnMount:e.validateOnMount}),A=e.onSubmit?m(e.onSubmit,e.onInvalidSubmit):p;function w(e){h(e)&&e.preventDefault(),f(),"function"==typeof r.attrs.onReset&&r.attrs.onReset()}function j(t,r){return m("function"!=typeof t||r?r:t,e.onInvalidSubmit)(t)}function E(){return{meta:o.value,errors:u.value,values:i,isSubmitting:l.value,submitCount:s.value,validate:d,validateField:c,handleSubmit:j,handleReset:f,submitForm:p,setErrors:y,setFieldError:g,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V,resetForm:v}}return r.expose({setFieldError:g,setErrors:y,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V,resetForm:v,validate:d,validateField:c}),function(){const n="form"===e.as?e.as:t.resolveDynamicComponent(e.as),a=k(n,r,E);if(!e.as)return a;const u="form"===e.as?{novalidate:!0}:{};return t.h(n,Object.assign(Object.assign(Object.assign({},u),r.attrs),{onSubmit:A,onReset:w}),a)}}});let te=0;function re(e){const r=te++,a=w(o,void 0),u=t.ref([]),i=()=>{},l={fields:t.readonly(u),remove:i,push:i,swap:i,insert:i,update:i,replace:i,prepend:i};if(!a)return j("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"),l;if(!t.unref(e))return j("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"),l;let s=0;function d(){const r=b(null==a?void 0:a.values,t.unref(e),[]);u.value=r.map(f),c()}function c(){const e=u.value.length;for(let t=0;t<e;t++){const r=u.value[t];r.isFirst=0===t,r.isLast=t===e-1}}function f(r){const n=s++;return{key:n,value:t.computed((()=>{const i=b(null==a?void 0:a.values,t.unref(e),[]),o=u.value.findIndex((e=>e.key===n));return-1===o?r:i[o]})),isFirst:!1,isLast:!1}}return d(),a.fieldArraysLookup[r]={reset:d},t.onBeforeUnmount((()=>{delete a.fieldArraysLookup[r]})),{fields:t.readonly(u),remove:function(r){const n=t.unref(e),i=b(null==a?void 0:a.values,n);if(!i||!Array.isArray(i))return;const o=[...i];o.splice(r,1),null==a||a.unsetInitialValue(n+`[${r}]`),null==a||a.setFieldValue(n,o),u.value.splice(r,1),c()},push:function(r){const i=t.unref(e),o=b(null==a?void 0:a.values,i),l=n(o)?[]:o;if(!Array.isArray(l))return;const s=[...l];s.push(r),null==a||a.stageInitialValue(i+`[${s.length-1}]`,r),null==a||a.setFieldValue(i,s),u.value.push(f(r)),c()},swap:function(r,n){const i=t.unref(e),o=b(null==a?void 0:a.values,i);if(!Array.isArray(o)||!o[r]||!o[n])return;const l=[...o],s=[...u.value],d=l[r];l[r]=l[n],l[n]=d;const f=s[r];s[r]=s[n],s[n]=f,null==a||a.setFieldValue(i,l),u.value=s,c()},insert:function(r,n){const i=t.unref(e),o=b(null==a?void 0:a.values,i);if(!Array.isArray(o)||o.length<r)return;const l=[...o],s=[...u.value];l.splice(r,0,n),s.splice(r,0,f(n)),null==a||a.setFieldValue(i,l),u.value=s,c()},update:function(r,n){const u=t.unref(e),i=b(null==a?void 0:a.values,u);!Array.isArray(i)||i.length-1<r||null==a||a.setFieldValue(`${u}[${r}]`,n)},replace:function(r){const n=t.unref(e);null==a||a.setFieldValue(n,r),d()},prepend:function(r){const i=t.unref(e),o=b(null==a?void 0:a.values,i),l=n(o)?[]:o;if(!Array.isArray(l))return;const s=[r,...l];null==a||a.stageInitialValue(i+`[${s.length-1}]`,r),null==a||a.setFieldValue(i,s),u.value.unshift(f(r)),c()}}}const ne=t.defineComponent({name:"FieldArray",inheritAttrs:!1,props:{name:{type:String,required:!0}},setup(e,r){const{push:n,remove:a,swap:u,insert:i,replace:o,update:l,prepend:s,fields:d}=re(t.toRef(e,"name"));function c(){return{fields:d.value,push:n,remove:a,swap:u,insert:i,update:l,replace:o,prepend:s}}return r.expose({push:n,remove:a,swap:u,insert:i,update:l,replace:o,prepend:s}),()=>k(void 0,r,c)}}),ae=t.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(e,r){const n=t.inject(o,void 0),a=t.computed((()=>null==n?void 0:n.errors.value[e.name]));function u(){return{message:a.value}}return()=>{if(!a.value)return;const n=e.as?t.resolveDynamicComponent(e.as):e.as,i=k(n,r,u),o=Object.assign({role:"alert"},r.attrs);return n||!Array.isArray(i)&&i||!(null==i?void 0:i.length)?!Array.isArray(i)&&i||(null==i?void 0:i.length)?t.h(n,o,i):t.h(n||"span",o,a.value):i}}});e.ErrorMessage=ae,e.Field=J,e.FieldArray=ne,e.FieldContextKey=l,e.Form=ee,e.FormContextKey=o,e.configure=N,e.defineRule=function(e,t){!function(e,t){if(r(t))return;throw new Error(`Extension Error: The validator '${e}' must be a function.`)}(e,t),i[e]=t},e.useField=X,e.useFieldArray=re,e.useFieldError=function(e){const r=w(o),n=e?void 0:t.inject(l);return t.computed((()=>e?null==r?void 0:r.errors.value[t.unref(e)]:null==n?void 0:n.errorMessage.value))},e.useFieldValue=function(e){const r=w(o),n=e?void 0:t.inject(l);return t.computed((()=>e?b(null==r?void 0:r.values,t.unref(e)):t.unref(null==n?void 0:n.value)))},e.useForm=Z,e.useFormErrors=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.errors.value)||{}))},e.useFormValues=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.values)||{}))},e.useIsFieldDirty=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.dirty:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFieldTouched=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.touched:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFieldValid=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.valid:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFormDirty=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.dirty)&&void 0!==t&&t}))},e.useIsFormTouched=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.touched)&&void 0!==t&&t}))},e.useIsFormValid=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.valid)&&void 0!==t&&t}))},e.useIsSubmitting=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.isSubmitting.value)&&void 0!==t&&t}))},e.useResetForm=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(t){if(e)return e.resetForm(t)}},e.useSubmitCount=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.submitCount.value)&&void 0!==t?t:0}))},e.useSubmitForm=function(e){const t=w(o);t||j("No vee-validate <Form /> or `useForm` was detected in the component tree");const r=t?t.handleSubmit(e):void 0;return function(e){if(r)return r(e)}},e.useValidateField=function(e){const r=w(o);let n=e?void 0:t.inject(l);return function(){return e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.validate():(j(`field with name ${t.unref(e)} was not found`),Promise.resolve({errors:[],valid:!0}))}},e.useValidateForm=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(){return e?e.validate():Promise.resolve({results:{},errors:{},valid:!0})}},e.validate=_,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VeeValidate={},e.Vue)}(this,(function(e,t){"use strict";function r(e){return"function"==typeof e}function n(e){return null==e}const a=e=>null!==e&&!!e&&"object"==typeof e&&!Array.isArray(e);function i(e){return Number(e)>=0}const u={};const o=Symbol("vee-validate-form"),l=Symbol("vee-validate-field-instance"),s=Symbol("Default empty value");function d(e){return r(e)&&!!e.__locatorRef}function c(e){return!!e&&r(e.validate)}function f(e){return"checkbox"===e||"radio"===e}function v(e){return/^\[.+\]$/i.test(e)}function m(e){return"SELECT"===e.tagName}function p(e,t){return function(e,t){const r=![!1,null,void 0,0].includes(t.multiple)&&!Number.isNaN(t.multiple);return"select"===e&&"multiple"in t&&r}(e,t)||function(e,t){return function(e){return["input","textarea","select"].includes(e)}(e)&&"file"===t.type}(e,t)}function h(e){return!!e&&(!!("undefined"!=typeof Event&&r(Event)&&e instanceof Event)||!(!e||!e.srcElement))}function y(e,t){return t in e&&e[t]!==s}function g(e){return v(e)?e.replace(/\[|\]/gi,""):e}function b(e,t,r){if(!e)return r;if(v(t))return e[g(t)];return(t||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce(((e,t)=>{return(a(n=e)||Array.isArray(n))&&t in e?e[t]:r;var n}),e)}function F(e,t,r){if(v(t))return void(e[g(t)]=r);const a=t.split(/\.|\[(\d+)\]/).filter(Boolean);let u=e;for(let e=0;e<a.length;e++){if(e===a.length-1)return void(u[a[e]]=r);a[e]in u&&!n(u[a[e]])||(u[a[e]]=i(a[e+1])?[]:{}),u=u[a[e]]}}function O(e,t){Array.isArray(e)&&i(t)?e.splice(Number(t),1):a(e)&&delete e[t]}function V(e,t){if(v(t))return void delete e[g(t)];const r=t.split(/\.|\[(\d+)\]/).filter(Boolean);let i=e;for(let e=0;e<r.length;e++){if(e===r.length-1){O(i,r[e]);break}if(!(r[e]in i)||n(i[r[e]]))break;i=i[r[e]]}const u=r.map(((t,n)=>b(e,r.slice(0,n).join("."))));for(let t=u.length-1;t>=0;t--)o=u[t],(Array.isArray(o)?0===o.length:a(o)&&0===Object.keys(o).length)&&(0!==t?O(u[t-1],r[t-1]):O(e,r[0]));var o}function A(e){return Object.keys(e)}function w(e,r){const n=t.getCurrentInstance();return(null==n?void 0:n.provides[e])||t.inject(e,r)}function j(e){t.warn(`[vee-validate]: ${e}`)}function E(e){return Array.isArray(e)?e[0]:e}function S(e,t,r){if(Array.isArray(e)){const r=[...e],n=r.indexOf(t);return n>=0?r.splice(n,1):r.push(t),r}return e===t?r:t}const k=(e,t,r)=>t.slots.default?"string"!=typeof e&&e?{default:()=>{var e,n;return null===(n=(e=t.slots).default)||void 0===n?void 0:n.call(e,r())}}:t.slots.default(r()):t.slots.default;function B(e){if(M(e))return e._value}function M(e){return"_value"in e}function I(e){if(!h(e))return e;const t=e.target;if(f(t.type)&&M(t))return B(t);if("file"===t.type&&t.files)return Array.from(t.files);if(m(r=t)&&r.multiple)return Array.from(t.options).filter((e=>e.selected&&!e.disabled)).map(B);var r;if(m(t)){const e=Array.from(t.options).find((e=>e.selected));return e?B(e):t.value}return t.value}function T(e){const t={};return Object.defineProperty(t,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),e?a(e)&&e._$$isNormalized?e:a(e)?Object.keys(e).reduce(((t,r)=>{const n=function(e){if(!0===e)return[];if(Array.isArray(e))return e;if(a(e))return e;return[e]}(e[r]);return!1!==e[r]&&(t[r]=C(n)),t}),t):"string"!=typeof e?t:e.split("|").reduce(((e,t)=>{const r=R(t);return r.name?(e[r.name]=C(r.params),e):e}),t):t}function C(e){const t=e=>"string"==typeof e&&"@"===e[0]?function(e){const t=t=>b(t,e)||t[e];return t.__locatorRef=e,t}(e.slice(1)):e;return Array.isArray(e)?e.map(t):e instanceof RegExp?[e]:Object.keys(e).reduce(((r,n)=>(r[n]=t(e[n]),r)),{})}const R=e=>{let t=[];const r=e.split(":")[0];return e.includes(":")&&(t=e.split(":").slice(1).join(":").split(",")),{name:r,params:t}};let x=Object.assign({},{generateMessage:({field:e})=>`${e} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const P=()=>x,N=e=>{x=Object.assign(Object.assign({},x),e)};async function _(e,t,n={}){const a=null==n?void 0:n.bails,i={name:(null==n?void 0:n.name)||"{field}",rules:t,bails:null==a||a,formData:(null==n?void 0:n.values)||{}},u=await async function(e,t){if(c(e.rules))return async function(e,t,r){var n;return{errors:await t.validate(e,{abortEarly:null===(n=r.bails)||void 0===n||n}).then((()=>[])).catch((e=>{if("ValidationError"===e.name)return e.errors;throw e}))}}(t,e.rules,{bails:e.bails});if(r(e.rules)){const r={field:e.name,form:e.formData,value:t},n=await e.rules(t,r),a="string"!=typeof n&&n,i="string"==typeof n?n:D(r);return{errors:a?[]:[i]}}const n=Object.assign(Object.assign({},e),{rules:T(e.rules)}),a=[],i=Object.keys(n.rules),u=i.length;for(let r=0;r<u;r++){const u=i[r],o=await $(n,t,{name:u,params:n.rules[u]});if(o.error&&(a.push(o.error),e.bails))return{errors:a}}return{errors:a}}(i,e),o=u.errors;return{errors:o,valid:!o.length}}async function $(e,t,r){const n=(a=r.name,u[a]);var a;if(!n)throw new Error(`No such validator '${r.name}' exists.`);const i=function(e,t){const r=e=>d(e)?e(t):e;if(Array.isArray(e))return e.map(r);return Object.keys(e).reduce(((t,n)=>(t[n]=r(e[n]),t)),{})}(r.params,e.formData),o={field:e.name,value:t,form:e.formData,rule:Object.assign(Object.assign({},r),{params:i})},l=await n(t,i,o);return"string"==typeof l?{error:l}:{error:l?void 0:D(o)}}function D(e){const t=P().generateMessage;return t?t(e):"Field is invalid"}async function U(e,t,r){const n=A(e).map((async n=>{var a,i,u;const o=await _(b(t,n),e[n],{name:(null===(a=null==r?void 0:r.names)||void 0===a?void 0:a[n])||n,values:t,bails:null===(u=null===(i=null==r?void 0:r.bailsMap)||void 0===i?void 0:i[n])||void 0===u||u});return Object.assign(Object.assign({},o),{path:n})}));let a=!0;const i=await Promise.all(n),u={},o={};for(const e of i)u[e.path]={valid:e.valid,errors:e.errors},e.valid||(a=!1,o[e.path]=e.errors[0]);return{valid:a,results:u,errors:o}}function q(e,t,r){"object"==typeof r.value&&(r.value=z(r.value)),r.enumerable&&!r.get&&!r.set&&r.configurable&&r.writable&&"__proto__"!==t?e[t]=r.value:Object.defineProperty(e,t,r)}function z(e){if("object"!=typeof e)return e;var t,r,n,a=0,i=Object.prototype.toString.call(e);if("[object Object]"===i?n=Object.create(e.__proto__||null):"[object Array]"===i?n=Array(e.length):"[object Set]"===i?(n=new Set,e.forEach((function(e){n.add(z(e))}))):"[object Map]"===i?(n=new Map,e.forEach((function(e,t){n.set(z(t),z(e))}))):"[object Date]"===i?n=new Date(+e):"[object RegExp]"===i?n=new RegExp(e.source,e.flags):"[object DataView]"===i?n=new e.constructor(z(e.buffer)):"[object ArrayBuffer]"===i?n=e.slice(0):"Array]"===i.slice(-6)&&(n=new e.constructor(e)),n){for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)q(n,r[a],Object.getOwnPropertyDescriptor(e,r[a]));for(a=0,r=Object.getOwnPropertyNames(e);a<r.length;a++)Object.hasOwnProperty.call(n,t=r[a])&&n[t]===e[t]||q(n,t,Object.getOwnPropertyDescriptor(e,t))}return n||e}var L=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,a,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(a=n;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(a of t.entries())if(!r.has(a[0]))return!1;for(a of t.entries())if(!e(a[1],r.get(a[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(a of t.entries())if(!r.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(a=n;0!=a--;)if(t[a]!==r[a])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=n;0!=a--;){var u=i[a];if(!e(t[u],r[u]))return!1}return!0}return t!=t&&r!=r};let K=0;function G(e,r){const{value:n,initialValue:a,setInitialValue:i}=function(e,r,n){const a=n?w(o,void 0):void 0,i=t.ref(t.unref(r));function u(){return a?b(a.meta.value.initialValues,t.unref(e),t.unref(i)):t.unref(i)}function l(r){a?a.setFieldInitialValue(t.unref(e),r):i.value=r}const s=t.computed(u);if(!a){return{value:t.ref(u()),initialValue:s,setInitialValue:l}}const d=r?t.unref(r):b(a.values,t.unref(e),t.unref(s));a.stageInitialValue(t.unref(e),d);return{value:t.computed({get:()=>b(a.values,t.unref(e)),set(r){a.setFieldValue(t.unref(e),r)}}),initialValue:s,setInitialValue:l}}(e,r.modelValue,!r.standalone),{errorMessage:u,errors:l,setErrors:s}=function(e,r){const n=r?w(o,void 0):void 0;function a(e){return e?Array.isArray(e)?e:[e]:[]}if(!n){const e=t.ref([]);return{errors:e,errorMessage:t.computed((()=>e.value[0])),setErrors:t=>{e.value=a(t)}}}const i=t.computed((()=>n.errorBag.value[t.unref(e)]||[]));return{errors:i,errorMessage:t.computed((()=>i.value[0])),setErrors:r=>{n.setFieldErrorBag(t.unref(e),a(r))}}}(e,!r.standalone),d=function(e,r,n){const a=t.reactive({touched:!1,pending:!1,valid:!0,validated:!!t.unref(n).length,initialValue:t.computed((()=>t.unref(r))),dirty:t.computed((()=>!L(t.unref(e),t.unref(r))))});return t.watch(n,(e=>{a.valid=!e.length}),{immediate:!0,flush:"sync"}),a}(n,a,l);return{id:K>=Number.MAX_SAFE_INTEGER?0:++K,path:e,value:n,initialValue:a,meta:d,errors:l,errorMessage:u,setState:function(e){var t;"value"in e&&(n.value=e.value),"errors"in e&&s(e.errors),"touched"in e&&(d.touched=null!==(t=e.touched)&&void 0!==t?t:d.touched),"initialValue"in e&&i(e.initialValue)}}}function X(e,r,n){return f(null==n?void 0:n.type)?function(e,r,n){const a=(null==n?void 0:n.standalone)?void 0:w(o),i=null==n?void 0:n.checkedValue,u=null==n?void 0:n.uncheckedValue;function l(e){const r=e.handleChange,n=t.computed((()=>{const r=t.unref(e.value),n=t.unref(i);return Array.isArray(r)?r.includes(n):n===r}));function o(o,l=!0){var s,d;if(n.value===(null===(d=null===(s=o)||void 0===s?void 0:s.target)||void 0===d?void 0:d.checked))return;let c=I(o);a||(c=S(t.unref(e.value),t.unref(i),t.unref(u))),r(c,l)}return t.onBeforeUnmount((()=>{n.value&&o(t.unref(i),!1)})),Object.assign(Object.assign({},e),{checked:n,checkedValue:i,uncheckedValue:u,handleChange:o})}return l(H(e,r,n))}(e,r,n):H(e,r,n)}function H(e,n,a){const{initialValue:i,validateOnMount:u,bails:s,type:f,checkedValue:v,label:m,validateOnValueUpdate:p,uncheckedValue:h,standalone:y}=function(e,t){const r=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,rules:"",label:e,validateOnValueUpdate:!0,standalone:!1});if(!t)return r();const n="valueProp"in t?t.valueProp:t.checkedValue;return Object.assign(Object.assign(Object.assign({},r()),t||{}),{checkedValue:n})}(t.unref(e),a),g=y?void 0:w(o),{id:F,value:O,initialValue:V,meta:j,setState:E,errors:S,errorMessage:k}=G(e,{modelValue:i,standalone:y}),B=t.computed((()=>{let a=t.unref(n);const i=t.unref(null==g?void 0:g.schema);return i&&!c(i)&&(a=function(e,t){if(!e)return;return e[t]}(i,t.unref(e))||a),c(a)||r(a)?a:T(a)}));async function M(r){var n,a;return(null==g?void 0:g.validateSchema)?null!==(n=(await g.validateSchema(r)).results[t.unref(e)])&&void 0!==n?n:{valid:!0,errors:[]}:_(O.value,B.value,{name:t.unref(m)||t.unref(e),values:null!==(a=null==g?void 0:g.values)&&void 0!==a?a:{},bails:s})}async function C(){j.pending=!0,j.validated=!0;const e=await M("validated-only");return E({errors:e.errors}),j.pending=!1,e}async function R(){const e=await M("silent");return j.valid=e.valid,e}let x;function P(){x=t.watch(O,p?C:R,{deep:!0})}function N(e){var r;null==x||x();const n=e&&"value"in e?e.value:V.value;E({value:z(n),initialValue:z(n),touched:null!==(r=null==e?void 0:e.touched)&&void 0!==r&&r,errors:(null==e?void 0:e.errors)||[]}),j.pending=!1,j.validated=!1,R(),t.nextTick((()=>{P()}))}t.onMounted((()=>{if(u)return C();g&&g.validateSchema||R()})),P();const $={id:F,name:e,label:m,value:O,meta:j,errors:S,errorMessage:k,type:f,checkedValue:v,uncheckedValue:h,bails:s,resetField:N,handleReset:()=>N(),validate:function(e){return(null==e?void 0:e.mode)&&"force"!==(null==e?void 0:e.mode)?"validated-only"===(null==e?void 0:e.mode)?C():R():C()},handleChange:(e,t=!0)=>{const r=I(e);O.value=r,!p&&t&&C()},handleBlur:()=>{j.touched=!0},setState:E,setTouched:function(e){j.touched=e},setErrors:function(e){E({errors:Array.isArray(e)?e:[e]})},setValue:function(e){O.value=e}};if(t.provide(l,$),t.isRef(n)&&"function"!=typeof t.unref(n)&&t.watch(n,((e,t)=>{L(e,t)||(j.validated?C():R())}),{deep:!0}),!g)return $;g.register($),t.onBeforeUnmount((()=>{g.unregister($)}));const D=t.computed((()=>{const e=B.value;return!e||r(e)||c(e)?{}:Object.keys(e).reduce(((t,r)=>{const n=(a=e[r],Array.isArray(a)?a.filter(d):A(a).filter((e=>d(a[e]))).map((e=>a[e]))).map((e=>e.__locatorRef)).reduce(((e,t)=>{const r=b(g.values,t)||g.values[t];return void 0!==r&&(e[t]=r),e}),{});var a;return Object.assign(t,n),t}),{})}));return t.watch(D,((e,t)=>{if(!Object.keys(e).length)return;!L(e,t)&&(j.validated?C():R())})),$}function J(e,t){let r=e.as||"";return e.as||t.slots.default||(r="input"),r}function Q(e,t){return f(t.attrs.type)?y(e,"modelValue")?e.modelValue:void 0:y(e,"modelValue")?e.modelValue:t.attrs.value}const W=t.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>P().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:s},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1}},setup(e,r){const n=t.toRef(e,"rules"),a=t.toRef(e,"name"),i=t.toRef(e,"label"),u=t.toRef(e,"uncheckedValue"),o=y(e,"onUpdate:modelValue"),{errors:l,value:d,errorMessage:c,validate:v,handleChange:m,handleBlur:h,setTouched:g,resetField:b,handleReset:F,meta:O,checked:V,setErrors:A}=X(a,n,{validateOnMount:e.validateOnMount,bails:e.bails,standalone:e.standalone,type:r.attrs.type,initialValue:Q(e,r),checkedValue:r.attrs.value,uncheckedValue:u,label:i,validateOnValueUpdate:!1}),w=o?function(e,t=!0){m(e,t),r.emit("update:modelValue",d.value)}:m,j=e=>{f(r.attrs.type)||(d.value=I(e))},E=o?function(e){j(e),r.emit("update:modelValue",d.value)}:j,S=t.computed((()=>{const{validateOnInput:t,validateOnChange:n,validateOnBlur:a,validateOnModelUpdate:i}=function(e){var t,r,n,a;const{validateOnInput:i,validateOnChange:u,validateOnBlur:o,validateOnModelUpdate:l}=P();return{validateOnInput:null!==(t=e.validateOnInput)&&void 0!==t?t:i,validateOnChange:null!==(r=e.validateOnChange)&&void 0!==r?r:u,validateOnBlur:null!==(n=e.validateOnBlur)&&void 0!==n?n:o,validateOnModelUpdate:null!==(a=e.validateOnModelUpdate)&&void 0!==a?a:l}}(e),u=[h,r.attrs.onBlur,a?v:void 0].filter(Boolean),o=[e=>w(e,t),r.attrs.onInput].filter(Boolean),l=[e=>w(e,n),r.attrs.onChange].filter(Boolean),s={name:e.name,onBlur:u,onInput:o,onChange:l};i&&(s["onUpdate:modelValue"]=[w]),f(r.attrs.type)&&V?s.checked=V.value:s.value=d.value;return p(J(e,r),r.attrs)&&delete s.value,s})),B=t.toRef(e,"modelValue");function M(){return{field:S.value,value:d.value,meta:O,errors:l.value,errorMessage:c.value,validate:v,resetField:b,handleChange:w,handleInput:E,handleReset:F,handleBlur:h,setTouched:g,setErrors:A}}return t.watch(B,(t=>{t===s&&void 0===d.value||t!==function(e,t){if(t.number)return function(e){const t=parseFloat(e);return isNaN(t)?e:t}(e);return e}(d.value,e.modelModifiers)&&(d.value=t===s?void 0:t,v())})),r.expose({setErrors:A,setTouched:g,reset:b,validate:v,handleChange:m}),()=>{const n=t.resolveDynamicComponent(J(e,r)),a=k(n,r,M);return n?t.h(n,Object.assign(Object.assign({},r.attrs),S.value),a):a}}});let Y=0;function Z(e){const r=Y++;let n=!1;const a=t.ref({}),i=t.ref(!1),u=t.ref(0),l={},s=t.reactive(z(t.unref(null==e?void 0:e.initialValues)||{})),{errorBag:d,setErrorBag:f,setFieldErrorBag:v}=function(e){const r=t.ref({});function n(e){return Array.isArray(e)?e:e?[e]:[]}function a(e,t){t?r.value[e]=n(t):delete r.value[e]}function i(e){r.value=A(e).reduce(((t,r)=>{const a=e[r];return a&&(t[r]=n(a)),t}),{})}e&&i(e);return{errorBag:r,setErrorBag:i,setFieldErrorBag:a}}(null==e?void 0:e.initialErrors),m=t.computed((()=>A(d.value).reduce(((e,t)=>{const r=d.value[t];return r&&r.length&&(e[t]=r[0]),e}),{})));function p(e){const t=a.value[e];return Array.isArray(t)?t[0]:t}function y(e){return!!a.value[e]}const g=t.computed((()=>A(a.value).reduce(((e,r)=>{const n=p(r);return n&&(e[r]=t.unref(n.label||n.name)||""),e}),{}))),O=t.computed((()=>A(a.value).reduce(((e,t)=>{var r;const n=p(t);return n&&(e[t]=null===(r=n.bails)||void 0===r||r),e}),{}))),w=Object.assign({},(null==e?void 0:e.initialErrors)||{}),{initialValues:j,originalInitialValues:E,setInitialValues:k}=function(e,r,n){const a=t.ref(z(t.unref(n))||{}),i=t.ref(z(t.unref(n))||{});function u(t,n=!1){a.value=z(t),i.value=z(t),n&&A(e.value).forEach((t=>{const n=e.value[t],i=Array.isArray(n)?n.some((e=>e.meta.touched)):null==n?void 0:n.meta.touched;if(!n||i)return;const u=b(a.value,t);F(r,t,z(u))}))}t.isRef(n)&&t.watch(n,(e=>{u(e,!0)}),{deep:!0});return{initialValues:a,originalInitialValues:i,setInitialValues:u}}(a,s,null==e?void 0:e.initialValues),B=function(e,r,n,a){const i={touched:"some",pending:"some",valid:"every"},u=t.computed((()=>!L(r,t.unref(n))));function o(){const t=Object.values(e.value).flat(1).filter(Boolean);return A(i).reduce(((e,r)=>{const n=i[r];return e[r]=t[n]((e=>e.meta[r])),e}),{})}const l=t.reactive(o());return t.watchEffect((()=>{const e=o();l.touched=e.touched,l.valid=e.valid,l.pending=e.pending})),t.computed((()=>Object.assign(Object.assign({initialValues:t.unref(n)},l),{valid:l.valid&&!A(a.value).length,dirty:u.value})))}(a,s,j,m),M=null==e?void 0:e.validationSchema,I={formId:r,fieldsByPath:a,values:s,errorBag:d,errors:m,schema:M,submitCount:u,meta:B,isSubmitting:i,fieldArraysLookup:l,validateSchema:t.unref(M)?async function(e){const t=await Q(),r=I.fieldsByPath.value||{},n=A(I.errorBag.value);return[...new Set([...A(t.results),...A(r),...n])].reduce(((n,a)=>{const i=r[a],u=(t.results[a]||{errors:[]}).errors,o={errors:u,valid:!u.length};if(n.results[a]=o,o.valid||(n.errors[a]=o.errors[0]),!i)return R(a,u),n;if(C(i,(e=>e.meta.valid=o.valid)),"silent"===e)return n;const l=Array.isArray(i)?i.some((e=>e.meta.validated)):i.meta.validated;return"validated-only"!==e||l?(C(i,(e=>e.setState({errors:o.errors}))),n):n}),{valid:t.valid,results:{},errors:{}})}:void 0,validate:G,register:function(e){const r=t.unref(e.name);q(e,r),t.isRef(e.name)&&t.watch(e.name,(async(r,n)=>{await t.nextTick(),K(e,n),q(e,r),(m.value[n]||m.value[r])&&X(r),await t.nextTick(),y(n)||V(s,n)}));const n=t.unref(e.errorMessage);n&&(null==w?void 0:w[r])!==n&&X(r);delete w[r]},unregister:function(e){const r=t.unref(e.name);K(e,r),t.nextTick((()=>{y(r)||(R(r,void 0),V(s,r))}))},setFieldErrorBag:v,validateField:X,setFieldValue:P,setValues:N,setErrors:x,setFieldError:R,setFieldTouched:_,setTouched:$,resetForm:D,handleSubmit:H,stageInitialValue:function(e,t){F(s,e,t),J(e,t)},unsetInitialValue:function(e){V(j.value,e)},setFieldInitialValue:J};function T(e){return Array.isArray(e)}function C(e,t){return Array.isArray(e)?e.forEach(t):t(e)}function R(e,t){v(e,t)}function x(e){f(e)}function P(e,r,{force:i}={force:!1}){var u;const o=a.value[e],l=z(r);if(!o)return void F(s,e,l);if(T(o)&&"checkbox"===(null===(u=o[0])||void 0===u?void 0:u.type)&&!Array.isArray(r)){const t=z(S(b(s,e)||[],r,void 0));return void F(s,e,t)}let d=r;T(o)||"checkbox"!==o.type||i||n||(d=z(S(b(s,e),r,t.unref(o.uncheckedValue)))),F(s,e,d)}function N(e){A(s).forEach((e=>{delete s[e]})),A(e).forEach((t=>{P(t,e[t])})),Object.values(l).forEach((e=>e&&e.reset()))}function _(e,t){const r=a.value[e];r&&C(r,(e=>e.setTouched(t)))}function $(e){A(e).forEach((t=>{_(t,!!e[t])}))}function D(e){n=!0,(null==e?void 0:e.values)?(k(e.values),N(null==e?void 0:e.values)):(k(E.value),N(E.value)),Object.values(a.value).forEach((e=>{e&&C(e,(e=>e.resetField()))})),(null==e?void 0:e.touched)&&$(e.touched),x((null==e?void 0:e.errors)||{}),u.value=(null==e?void 0:e.submitCount)||0,t.nextTick((()=>{n=!1}))}function q(e,r){const n=t.markRaw(e),i=r;if(!a.value[i])return void(a.value[i]=n);const u=a.value[i];u&&!Array.isArray(u)&&(a.value[i]=[u]),a.value[i]=[...a.value[i],n]}function K(e,t){const r=t,n=a.value[r];if(n)if(T(n)||e.id!==n.id){if(T(n)){const t=n.findIndex((t=>t.id===e.id));if(-1===t)return;if(n.splice(t,1),1===n.length)return void(a.value[r]=n[0]);n.length||delete a.value[r]}}else delete a.value[r]}async function G(e){if(I.validateSchema)return I.validateSchema((null==e?void 0:e.mode)||"force");const r=await Promise.all(Object.values(a.value).map((r=>{const n=Array.isArray(r)?r[0]:r;return n?n.validate(e).then((e=>({key:t.unref(n.name),valid:e.valid,errors:e.errors}))):Promise.resolve({key:"",valid:!0,errors:[]})}))),n={},i={};for(const e of r)n[e.key]={valid:e.valid,errors:e.errors},e.errors.length&&(i[e.key]=e.errors[0]);return{valid:r.every((e=>e.valid)),results:n,errors:i}}async function X(e){const r=a.value[e];return r?Array.isArray(r)?r.map((e=>e.validate()))[0]:r.validate():(t.warn(`field with name ${e} was not found`),Promise.resolve({errors:[],valid:!0}))}function H(e,t){return function(r){return r instanceof Event&&(r.preventDefault(),r.stopPropagation()),$(A(a.value).reduce(((e,t)=>(e[t]=!0,e)),{})),i.value=!0,u.value++,G().then((n=>{if(n.valid&&"function"==typeof e)return e(z(s),{evt:r,setErrors:x,setFieldError:R,setTouched:$,setFieldTouched:_,setValues:N,setFieldValue:P,resetForm:D});n.valid||"function"!=typeof t||t({values:z(s),evt:r,errors:n.errors,results:n.results})})).then((e=>(i.value=!1,e)),(e=>{throw i.value=!1,e}))}}function J(e,t){F(j.value,e,z(t))}const Q=function(e,t=0){let r=null,n=[];return function(...a){return r&&window.clearTimeout(r),r=window.setTimeout((()=>{const t=e(...a);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}((async function(){const e=t.unref(M);if(!e)return{valid:!0,results:{},errors:{}};const r=c(e)?await async function(e,t){const r=await e.validate(t,{abortEarly:!1}).then((()=>[])).catch((e=>{if("ValidationError"!==e.name)throw e;return e.inner||[]})),n={},a={};for(const e of r){const t=e.errors;n[e.path]={valid:!t.length,errors:t},t.length&&(a[e.path]=t[0])}return{valid:!r.length,results:n,errors:a}}(e,s):await U(e,s,{names:g.value,bailsMap:O.value});return r}),5);const W=H(((e,{evt:t})=>{(function(e){return h(e)&&e.target&&"submit"in e.target})(t)&&t.target.submit()}));return t.onMounted((()=>{(null==e?void 0:e.initialErrors)&&x(e.initialErrors),(null==e?void 0:e.initialTouched)&&$(e.initialTouched),(null==e?void 0:e.validateOnMount)?G():I.validateSchema&&I.validateSchema("silent")})),t.isRef(M)&&t.watch(M,(()=>{var e;null===(e=I.validateSchema)||void 0===e||e.call(I,"validated-only")})),t.provide(o,I),{errors:m,meta:B,values:s,isSubmitting:i,submitCount:u,validate:G,validateField:X,handleReset:()=>D(),resetForm:D,handleSubmit:H,submitForm:W,setFieldError:R,setErrors:x,setFieldValue:P,setValues:N,setFieldTouched:_,setTouched:$}}const ee=t.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:String,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0}},setup(e,r){const n=t.toRef(e,"initialValues"),a=t.toRef(e,"validationSchema"),{errors:i,values:u,meta:o,isSubmitting:l,submitCount:s,validate:d,validateField:c,handleReset:f,resetForm:v,handleSubmit:m,submitForm:p,setErrors:y,setFieldError:g,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V}=Z({validationSchema:a.value?a:void 0,initialValues:n,initialErrors:e.initialErrors,initialTouched:e.initialTouched,validateOnMount:e.validateOnMount}),A=e.onSubmit?m(e.onSubmit,e.onInvalidSubmit):p;function w(e){h(e)&&e.preventDefault(),f(),"function"==typeof r.attrs.onReset&&r.attrs.onReset()}function j(t,r){return m("function"!=typeof t||r?r:t,e.onInvalidSubmit)(t)}function E(){return{meta:o.value,errors:i.value,values:u,isSubmitting:l.value,submitCount:s.value,validate:d,validateField:c,handleSubmit:j,handleReset:f,submitForm:p,setErrors:y,setFieldError:g,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V,resetForm:v}}return r.expose({setFieldError:g,setErrors:y,setFieldValue:b,setValues:F,setFieldTouched:O,setTouched:V,resetForm:v,validate:d,validateField:c}),function(){const n="form"===e.as?e.as:t.resolveDynamicComponent(e.as),a=k(n,r,E);if(!e.as)return a;const i="form"===e.as?{novalidate:!0}:{};return t.h(n,Object.assign(Object.assign(Object.assign({},i),r.attrs),{onSubmit:A,onReset:w}),a)}}}),te=ee;let re=0;function ne(e){const r=re++,a=w(o,void 0),i=t.ref([]),u=()=>{},l={fields:t.readonly(i),remove:u,push:u,swap:u,insert:u,update:u,replace:u,prepend:u};if(!a)return j("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"),l;if(!t.unref(e))return j("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"),l;let s=0;function d(){const r=b(null==a?void 0:a.values,t.unref(e),[]);i.value=r.map(f),c()}function c(){const e=i.value.length;for(let t=0;t<e;t++){const r=i.value[t];r.isFirst=0===t,r.isLast=t===e-1}}function f(r){const n=s++;return{key:n,value:t.computed((()=>{const u=b(null==a?void 0:a.values,t.unref(e),[]),o=i.value.findIndex((e=>e.key===n));return-1===o?r:u[o]})),isFirst:!1,isLast:!1}}return d(),a.fieldArraysLookup[r]={reset:d},t.onBeforeUnmount((()=>{delete a.fieldArraysLookup[r]})),{fields:t.readonly(i),remove:function(r){const n=t.unref(e),u=b(null==a?void 0:a.values,n);if(!u||!Array.isArray(u))return;const o=[...u];o.splice(r,1),null==a||a.unsetInitialValue(n+`[${r}]`),null==a||a.setFieldValue(n,o),i.value.splice(r,1),c()},push:function(r){const u=t.unref(e),o=b(null==a?void 0:a.values,u),l=n(o)?[]:o;if(!Array.isArray(l))return;const s=[...l];s.push(r),null==a||a.stageInitialValue(u+`[${s.length-1}]`,r),null==a||a.setFieldValue(u,s),i.value.push(f(r)),c()},swap:function(r,n){const u=t.unref(e),o=b(null==a?void 0:a.values,u);if(!Array.isArray(o)||!o[r]||!o[n])return;const l=[...o],s=[...i.value],d=l[r];l[r]=l[n],l[n]=d;const f=s[r];s[r]=s[n],s[n]=f,null==a||a.setFieldValue(u,l),i.value=s,c()},insert:function(r,n){const u=t.unref(e),o=b(null==a?void 0:a.values,u);if(!Array.isArray(o)||o.length<r)return;const l=[...o],s=[...i.value];l.splice(r,0,n),s.splice(r,0,f(n)),null==a||a.setFieldValue(u,l),i.value=s,c()},update:function(r,n){const i=t.unref(e),u=b(null==a?void 0:a.values,i);!Array.isArray(u)||u.length-1<r||null==a||a.setFieldValue(`${i}[${r}]`,n)},replace:function(r){const n=t.unref(e);null==a||a.setFieldValue(n,r),d()},prepend:function(r){const u=t.unref(e),o=b(null==a?void 0:a.values,u),l=n(o)?[]:o;if(!Array.isArray(l))return;const s=[r,...l];null==a||a.stageInitialValue(u+`[${s.length-1}]`,r),null==a||a.setFieldValue(u,s),i.value.unshift(f(r)),c()}}}const ae=t.defineComponent({name:"FieldArray",inheritAttrs:!1,props:{name:{type:String,required:!0}},setup(e,r){const{push:n,remove:a,swap:i,insert:u,replace:o,update:l,prepend:s,fields:d}=ne(t.toRef(e,"name"));function c(){return{fields:d.value,push:n,remove:a,swap:i,insert:u,update:l,replace:o,prepend:s}}return r.expose({push:n,remove:a,swap:i,insert:u,update:l,replace:o,prepend:s}),()=>k(void 0,r,c)}}),ie=t.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(e,r){const n=t.inject(o,void 0),a=t.computed((()=>null==n?void 0:n.errors.value[e.name]));function i(){return{message:a.value}}return()=>{if(!a.value)return;const n=e.as?t.resolveDynamicComponent(e.as):e.as,u=k(n,r,i),o=Object.assign({role:"alert"},r.attrs);return n||!Array.isArray(u)&&u||!(null==u?void 0:u.length)?!Array.isArray(u)&&u||(null==u?void 0:u.length)?t.h(n,o,u):t.h(n||"span",o,a.value):u}}});e.ErrorMessage=ie,e.Field=W,e.FieldArray=ae,e.FieldContextKey=l,e.Form=te,e.FormContextKey=o,e.configure=N,e.defineRule=function(e,t){!function(e,t){if(r(t))return;throw new Error(`Extension Error: The validator '${e}' must be a function.`)}(e,t),u[e]=t},e.useField=X,e.useFieldArray=ne,e.useFieldError=function(e){const r=w(o),n=e?void 0:t.inject(l);return t.computed((()=>e?null==r?void 0:r.errors.value[t.unref(e)]:null==n?void 0:n.errorMessage.value))},e.useFieldValue=function(e){const r=w(o),n=e?void 0:t.inject(l);return t.computed((()=>e?b(null==r?void 0:r.values,t.unref(e)):t.unref(null==n?void 0:n.value)))},e.useForm=Z,e.useFormErrors=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.errors.value)||{}))},e.useFormValues=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>(null==e?void 0:e.values)||{}))},e.useIsFieldDirty=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.dirty:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFieldTouched=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.touched:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFieldValid=function(e){const r=w(o);let n=e?void 0:t.inject(l);return t.computed((()=>(e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.meta.valid:(j(`field with name ${t.unref(e)} was not found`),!1))))},e.useIsFormDirty=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.dirty)&&void 0!==t&&t}))},e.useIsFormTouched=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.touched)&&void 0!==t&&t}))},e.useIsFormValid=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.meta.value.valid)&&void 0!==t&&t}))},e.useIsSubmitting=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.isSubmitting.value)&&void 0!==t&&t}))},e.useResetForm=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(t){if(e)return e.resetForm(t)}},e.useSubmitCount=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),t.computed((()=>{var t;return null!==(t=null==e?void 0:e.submitCount.value)&&void 0!==t?t:0}))},e.useSubmitForm=function(e){const t=w(o);t||j("No vee-validate <Form /> or `useForm` was detected in the component tree");const r=t?t.handleSubmit(e):void 0;return function(e){if(r)return r(e)}},e.useValidateField=function(e){const r=w(o);let n=e?void 0:t.inject(l);return function(){return e&&(n=E(null==r?void 0:r.fieldsByPath.value[t.unref(e)])),n?n.validate():(j(`field with name ${t.unref(e)} was not found`),Promise.resolve({errors:[],valid:!0}))}},e.useValidateForm=function(){const e=w(o);return e||j("No vee-validate <Form /> or `useForm` was detected in the component tree"),function(){return e?e.validate():Promise.resolve({results:{},errors:{},valid:!0})}},e.validate=_,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vee-validate",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.6",
|
|
4
4
|
"description": "Form Validation for Vue.js",
|
|
5
5
|
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@vue/devtools-api": "^6.0.0-beta.15"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "3a435ea1eea20d88103d30ba1efd393f92e668fd"
|
|
37
37
|
}
|