@volverjs/form-vue 0.0.10-beta.6 → 0.0.10-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -169
- package/dist/VvForm.d.ts +22 -6
- package/dist/VvFormField.d.ts +13 -4
- package/dist/index.d.ts +76 -17
- package/dist/index.es.js +235 -216
- package/dist/index.umd.js +1 -1
- package/dist/types.d.ts +10 -4
- package/package.json +11 -11
- package/src/VvForm.ts +15 -7
- package/src/VvFormField.ts +8 -5
- package/src/VvFormTemplate.ts +27 -9
- package/src/index.ts +27 -7
- package/src/types.d.ts +10 -4
package/dist/VvFormField.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Component, type InjectionKey, type PropType, type Ref, type ConcreteComponent } from 'vue';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import { FormFieldType } from './enums';
|
|
4
|
-
import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData,
|
|
5
|
-
export declare const defineFormField: <Schema extends FormSchema>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?:
|
|
4
|
+
import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormFieldComponentOptions, Path, FormSchema } from './types';
|
|
5
|
+
export declare const defineFormField: <Schema extends FormSchema>(formProvideKey: InjectionKey<InjectedFormData<Schema>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?: FormFieldComponentOptions) => import("vue").DefineComponent<{
|
|
6
6
|
type: {
|
|
7
7
|
type: PropType<"number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetimeLocal" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom">;
|
|
8
8
|
validator: (value: FormFieldType) => boolean;
|
|
@@ -25,9 +25,13 @@ export declare const defineFormField: <Schema extends FormSchema>(formProvideKey
|
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
27
|
defaultValue: {
|
|
28
|
-
type: (ObjectConstructor |
|
|
28
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
29
29
|
default: undefined;
|
|
30
30
|
};
|
|
31
|
+
lazyload: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
31
35
|
}, {
|
|
32
36
|
component: import("vue").ComputedRef<{
|
|
33
37
|
new (...args: any[]): any;
|
|
@@ -60,9 +64,13 @@ export declare const defineFormField: <Schema extends FormSchema>(formProvideKey
|
|
|
60
64
|
default: boolean;
|
|
61
65
|
};
|
|
62
66
|
defaultValue: {
|
|
63
|
-
type: (ObjectConstructor |
|
|
67
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
64
68
|
default: undefined;
|
|
65
69
|
};
|
|
70
|
+
lazyload: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
66
74
|
}>> & {
|
|
67
75
|
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
68
76
|
onValid?: ((...args: any[]) => any) | undefined;
|
|
@@ -80,4 +88,5 @@ export declare const defineFormField: <Schema extends FormSchema>(formProvideKey
|
|
|
80
88
|
is: Component;
|
|
81
89
|
showValid: boolean;
|
|
82
90
|
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
91
|
+
lazyload: boolean;
|
|
83
92
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,19 +4,26 @@ import { defineForm } from './VvForm';
|
|
|
4
4
|
import { defineFormWrapper } from './VvFormWrapper';
|
|
5
5
|
import { defineFormTemplate } from './VvFormTemplate';
|
|
6
6
|
import type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormComposableOptions, FormPluginOptions, FormTemplateItem, Path, PathValue, FormSchema } from './types';
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const pluginInjectionKey: InjectionKey<FormPluginOptions>;
|
|
8
|
+
export declare const createForm: (options: FormPluginOptions) => Plugin & Partial<ReturnType<typeof useForm>>;
|
|
9
|
+
export declare const useForm: <Schema extends FormSchema>(schema: Schema, options?: FormComposableOptions) => {
|
|
8
10
|
VvForm: {
|
|
9
11
|
new (...args: any[]): {
|
|
10
12
|
$: import("vue").ComponentInternalInstance;
|
|
11
13
|
$data: {};
|
|
12
14
|
$props: Partial<{
|
|
13
15
|
modelValue: Record<string, any>;
|
|
16
|
+
updateThrottle: number;
|
|
14
17
|
continuosValidation: boolean;
|
|
15
18
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
16
19
|
modelValue: {
|
|
17
20
|
type: ObjectConstructor;
|
|
18
21
|
default: () => {};
|
|
19
22
|
};
|
|
23
|
+
updateThrottle: {
|
|
24
|
+
type: NumberConstructor;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
20
27
|
continuosValidation: {
|
|
21
28
|
type: BooleanConstructor;
|
|
22
29
|
default: boolean;
|
|
@@ -26,7 +33,7 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
26
33
|
onValid?: ((...args: any[]) => any) | undefined;
|
|
27
34
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
28
35
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
29
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "continuosValidation">;
|
|
36
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "updateThrottle" | "continuosValidation">;
|
|
30
37
|
$attrs: {
|
|
31
38
|
[x: string]: unknown;
|
|
32
39
|
};
|
|
@@ -45,6 +52,10 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
45
52
|
type: ObjectConstructor;
|
|
46
53
|
default: () => {};
|
|
47
54
|
};
|
|
55
|
+
updateThrottle: {
|
|
56
|
+
type: NumberConstructor;
|
|
57
|
+
default: number;
|
|
58
|
+
};
|
|
48
59
|
continuosValidation: {
|
|
49
60
|
type: BooleanConstructor;
|
|
50
61
|
default: boolean;
|
|
@@ -62,6 +73,7 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
62
73
|
invalid: import("vue").ComputedRef<boolean>;
|
|
63
74
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "submit" | "update:modelValue")[], string, {
|
|
64
75
|
modelValue: Record<string, any>;
|
|
76
|
+
updateThrottle: number;
|
|
65
77
|
continuosValidation: boolean;
|
|
66
78
|
}, {}, string> & {
|
|
67
79
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -88,6 +100,10 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
88
100
|
type: ObjectConstructor;
|
|
89
101
|
default: () => {};
|
|
90
102
|
};
|
|
103
|
+
updateThrottle: {
|
|
104
|
+
type: NumberConstructor;
|
|
105
|
+
default: number;
|
|
106
|
+
};
|
|
91
107
|
continuosValidation: {
|
|
92
108
|
type: BooleanConstructor;
|
|
93
109
|
default: boolean;
|
|
@@ -112,6 +128,10 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
112
128
|
type: ObjectConstructor;
|
|
113
129
|
default: () => {};
|
|
114
130
|
};
|
|
131
|
+
updateThrottle: {
|
|
132
|
+
type: NumberConstructor;
|
|
133
|
+
default: number;
|
|
134
|
+
};
|
|
115
135
|
continuosValidation: {
|
|
116
136
|
type: BooleanConstructor;
|
|
117
137
|
default: boolean;
|
|
@@ -129,6 +149,7 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
129
149
|
invalid: import("vue").ComputedRef<boolean>;
|
|
130
150
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "submit" | "update:modelValue")[], "invalid" | "valid" | "submit" | "update:modelValue", {
|
|
131
151
|
modelValue: Record<string, any>;
|
|
152
|
+
updateThrottle: number;
|
|
132
153
|
continuosValidation: boolean;
|
|
133
154
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
134
155
|
$slots: {
|
|
@@ -296,9 +317,13 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
296
317
|
default: boolean;
|
|
297
318
|
};
|
|
298
319
|
defaultValue: {
|
|
299
|
-
type: (ObjectConstructor |
|
|
320
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
300
321
|
default: undefined;
|
|
301
322
|
};
|
|
323
|
+
lazyload: {
|
|
324
|
+
type: BooleanConstructor;
|
|
325
|
+
default: boolean;
|
|
326
|
+
};
|
|
302
327
|
}, {
|
|
303
328
|
component: import("vue").ComputedRef<{
|
|
304
329
|
new (...args: any[]): any;
|
|
@@ -331,9 +356,13 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
331
356
|
default: boolean;
|
|
332
357
|
};
|
|
333
358
|
defaultValue: {
|
|
334
|
-
type: (ObjectConstructor |
|
|
359
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
335
360
|
default: undefined;
|
|
336
361
|
};
|
|
362
|
+
lazyload: {
|
|
363
|
+
type: BooleanConstructor;
|
|
364
|
+
default: boolean;
|
|
365
|
+
};
|
|
337
366
|
}>> & {
|
|
338
367
|
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
339
368
|
onValid?: ((...args: any[]) => any) | undefined;
|
|
@@ -351,6 +380,7 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
351
380
|
is: import("vue").Component;
|
|
352
381
|
showValid: boolean;
|
|
353
382
|
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
383
|
+
lazyload: boolean;
|
|
354
384
|
}>;
|
|
355
385
|
VvFormTemplate: (import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | {
|
|
356
386
|
new (...args: any[]): any;
|
|
@@ -375,21 +405,34 @@ export declare const formFactory: <Schema extends FormSchema>(schema: Schema, op
|
|
|
375
405
|
status: import("vue").Ref<import("./enums").FormStatus | undefined>;
|
|
376
406
|
formData: import("vue").Ref<Partial<import("zod").TypeOf<Schema> | undefined>>;
|
|
377
407
|
};
|
|
378
|
-
export
|
|
379
|
-
export
|
|
380
|
-
|
|
408
|
+
export { FormFieldType } from './enums';
|
|
409
|
+
export { defaultObjectBySchema } from './utils';
|
|
410
|
+
type FormComponent = ReturnType<typeof defineForm>;
|
|
411
|
+
type FormWrapperComponent = ReturnType<typeof defineFormWrapper>;
|
|
412
|
+
type FormFieldComponent = ReturnType<typeof defineFormField>;
|
|
413
|
+
type FormTemplateComponent = ReturnType<typeof defineFormTemplate>;
|
|
414
|
+
export type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormComposableOptions, FormPluginOptions, FormComponent, FormWrapperComponent, FormFieldComponent, FormTemplateComponent, FormTemplateItem, Path, PathValue, };
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated Use `useForm()` instead
|
|
417
|
+
*/
|
|
418
|
+
export declare const formFactory: <Schema extends FormSchema>(schema: Schema, options?: FormComposableOptions) => {
|
|
381
419
|
VvForm: {
|
|
382
420
|
new (...args: any[]): {
|
|
383
421
|
$: import("vue").ComponentInternalInstance;
|
|
384
422
|
$data: {};
|
|
385
423
|
$props: Partial<{
|
|
386
424
|
modelValue: Record<string, any>;
|
|
425
|
+
updateThrottle: number;
|
|
387
426
|
continuosValidation: boolean;
|
|
388
427
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
389
428
|
modelValue: {
|
|
390
429
|
type: ObjectConstructor;
|
|
391
430
|
default: () => {};
|
|
392
431
|
};
|
|
432
|
+
updateThrottle: {
|
|
433
|
+
type: NumberConstructor;
|
|
434
|
+
default: number;
|
|
435
|
+
};
|
|
393
436
|
continuosValidation: {
|
|
394
437
|
type: BooleanConstructor;
|
|
395
438
|
default: boolean;
|
|
@@ -399,7 +442,7 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
399
442
|
onValid?: ((...args: any[]) => any) | undefined;
|
|
400
443
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
401
444
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
402
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "continuosValidation">;
|
|
445
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "updateThrottle" | "continuosValidation">;
|
|
403
446
|
$attrs: {
|
|
404
447
|
[x: string]: unknown;
|
|
405
448
|
};
|
|
@@ -418,6 +461,10 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
418
461
|
type: ObjectConstructor;
|
|
419
462
|
default: () => {};
|
|
420
463
|
};
|
|
464
|
+
updateThrottle: {
|
|
465
|
+
type: NumberConstructor;
|
|
466
|
+
default: number;
|
|
467
|
+
};
|
|
421
468
|
continuosValidation: {
|
|
422
469
|
type: BooleanConstructor;
|
|
423
470
|
default: boolean;
|
|
@@ -435,6 +482,7 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
435
482
|
invalid: import("vue").ComputedRef<boolean>;
|
|
436
483
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "submit" | "update:modelValue")[], string, {
|
|
437
484
|
modelValue: Record<string, any>;
|
|
485
|
+
updateThrottle: number;
|
|
438
486
|
continuosValidation: boolean;
|
|
439
487
|
}, {}, string> & {
|
|
440
488
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -461,6 +509,10 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
461
509
|
type: ObjectConstructor;
|
|
462
510
|
default: () => {};
|
|
463
511
|
};
|
|
512
|
+
updateThrottle: {
|
|
513
|
+
type: NumberConstructor;
|
|
514
|
+
default: number;
|
|
515
|
+
};
|
|
464
516
|
continuosValidation: {
|
|
465
517
|
type: BooleanConstructor;
|
|
466
518
|
default: boolean;
|
|
@@ -485,6 +537,10 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
485
537
|
type: ObjectConstructor;
|
|
486
538
|
default: () => {};
|
|
487
539
|
};
|
|
540
|
+
updateThrottle: {
|
|
541
|
+
type: NumberConstructor;
|
|
542
|
+
default: number;
|
|
543
|
+
};
|
|
488
544
|
continuosValidation: {
|
|
489
545
|
type: BooleanConstructor;
|
|
490
546
|
default: boolean;
|
|
@@ -502,6 +558,7 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
502
558
|
invalid: import("vue").ComputedRef<boolean>;
|
|
503
559
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("invalid" | "valid" | "submit" | "update:modelValue")[], "invalid" | "valid" | "submit" | "update:modelValue", {
|
|
504
560
|
modelValue: Record<string, any>;
|
|
561
|
+
updateThrottle: number;
|
|
505
562
|
continuosValidation: boolean;
|
|
506
563
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
507
564
|
$slots: {
|
|
@@ -669,9 +726,13 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
669
726
|
default: boolean;
|
|
670
727
|
};
|
|
671
728
|
defaultValue: {
|
|
672
|
-
type: (ObjectConstructor |
|
|
729
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
673
730
|
default: undefined;
|
|
674
731
|
};
|
|
732
|
+
lazyload: {
|
|
733
|
+
type: BooleanConstructor;
|
|
734
|
+
default: boolean;
|
|
735
|
+
};
|
|
675
736
|
}, {
|
|
676
737
|
component: import("vue").ComputedRef<{
|
|
677
738
|
new (...args: any[]): any;
|
|
@@ -704,9 +765,13 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
704
765
|
default: boolean;
|
|
705
766
|
};
|
|
706
767
|
defaultValue: {
|
|
707
|
-
type: (ObjectConstructor |
|
|
768
|
+
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor | ArrayConstructor)[];
|
|
708
769
|
default: undefined;
|
|
709
770
|
};
|
|
771
|
+
lazyload: {
|
|
772
|
+
type: BooleanConstructor;
|
|
773
|
+
default: boolean;
|
|
774
|
+
};
|
|
710
775
|
}>> & {
|
|
711
776
|
onInvalid?: ((...args: any[]) => any) | undefined;
|
|
712
777
|
onValid?: ((...args: any[]) => any) | undefined;
|
|
@@ -724,6 +789,7 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
724
789
|
is: import("vue").Component;
|
|
725
790
|
showValid: boolean;
|
|
726
791
|
defaultValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
792
|
+
lazyload: boolean;
|
|
727
793
|
}>;
|
|
728
794
|
VvFormTemplate: (import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any> | {
|
|
729
795
|
new (...args: any[]): any;
|
|
@@ -748,10 +814,3 @@ export declare const useForm: <Schema extends FormSchema>(schema: Schema, option
|
|
|
748
814
|
status: import("vue").Ref<import("./enums").FormStatus | undefined>;
|
|
749
815
|
formData: import("vue").Ref<Partial<import("zod").TypeOf<Schema> | undefined>>;
|
|
750
816
|
};
|
|
751
|
-
export { FormFieldType } from './enums';
|
|
752
|
-
export { defaultObjectBySchema } from './utils';
|
|
753
|
-
type FormComponent = ReturnType<typeof defineForm>;
|
|
754
|
-
type FormWrapperComponent = ReturnType<typeof defineFormWrapper>;
|
|
755
|
-
type FormFieldComponent = ReturnType<typeof defineFormField>;
|
|
756
|
-
type FormTemplateComponent = ReturnType<typeof defineFormTemplate>;
|
|
757
|
-
export type { InjectedFormData, InjectedFormWrapperData, InjectedFormFieldData, FormComposableOptions, FormPluginOptions, FormComponent, FormWrapperComponent, FormFieldComponent, FormTemplateComponent, FormTemplateItem, Path, PathValue, };
|