@volverjs/form-vue 1.0.0-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +412 -245
- package/dist/VvForm.d.ts +135 -0
- package/dist/VvFormField.d.ts +130 -0
- package/dist/VvFormFieldsGroup.d.ts +109 -0
- package/dist/VvFormTemplate.d.ts +40 -0
- package/dist/VvFormWrapper.d.ts +65 -0
- package/dist/{src/enums.d.ts → enums.d.ts} +1 -0
- package/dist/index.d.ts +972 -1
- package/dist/index.es.js +944 -593
- package/dist/index.umd.js +1 -1
- package/dist/types.d.ts +93 -0
- package/dist/utils.d.ts +3 -0
- package/package.json +61 -60
- package/src/VvForm.ts +359 -300
- package/src/VvFormField.ts +366 -334
- package/src/VvFormFieldsGroup.ts +381 -0
- package/src/VvFormTemplate.ts +185 -171
- package/src/VvFormWrapper.ts +198 -161
- package/src/enums.ts +27 -26
- package/src/index.ts +157 -134
- package/src/types.ts +162 -125
- package/src/utils.ts +121 -100
- package/dist/src/VvForm.d.ts +0 -202
- package/dist/src/VvFormField.d.ts +0 -116
- package/dist/src/VvFormTemplate.d.ts +0 -60
- package/dist/src/VvFormWrapper.d.ts +0 -107
- package/dist/src/index.d.ts +0 -1498
- package/dist/src/types.d.ts +0 -70
- package/dist/src/utils.d.ts +0 -3
- package/dist/test-playwright/VvForm.spec.d.ts +0 -1
- package/dist/test-playwright/VvFormField.spec.d.ts +0 -1
- package/dist/test-playwright/VvFormWrapper.spec.d.ts +0 -1
- package/dist/test-vitest/defaultObjectBySchema.test.d.ts +0 -1
- package/dist/test-vitest/useForm.test.d.ts +0 -1
package/dist/src/types.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { Component, DeepReadonly, Ref, WatchStopHandle } from 'vue';
|
|
2
|
-
import type { z, AnyZodObject, ZodEffects, inferFormattedError } from 'zod';
|
|
3
|
-
import type { IgnoredUpdater } from '@vueuse/core';
|
|
4
|
-
import type { FormFieldType, FormStatus } from './enums';
|
|
5
|
-
export type FormSchema = AnyZodObject | ZodEffects<AnyZodObject> | ZodEffects<ZodEffects<AnyZodObject>>;
|
|
6
|
-
export type FormFieldComponentOptions = {
|
|
7
|
-
lazyLoad?: boolean;
|
|
8
|
-
sideEffects?: (type: `${FormFieldType}`) => Promise<void> | void;
|
|
9
|
-
};
|
|
10
|
-
export type FormComponentOptions<Schema> = {
|
|
11
|
-
updateThrottle?: number;
|
|
12
|
-
continuosValidation?: boolean;
|
|
13
|
-
readonly?: boolean;
|
|
14
|
-
template?: Schema extends FormSchema ? FormTemplate<Schema> : never;
|
|
15
|
-
onUpdate?: Schema extends FormSchema ? (data: Partial<z.infer<Schema> | undefined>) => void : never;
|
|
16
|
-
onSubmit?: Schema extends FormSchema ? (data: z.infer<Schema>) => void : never;
|
|
17
|
-
onInvalid?: Schema extends FormSchema ? (error: inferFormattedError<Schema, string>) => void : never;
|
|
18
|
-
onValid?: Schema extends FormSchema ? (data: z.infer<Schema>) => void : never;
|
|
19
|
-
};
|
|
20
|
-
export type FormComposableOptions<Schema> = FormFieldComponentOptions & FormComponentOptions<Schema>;
|
|
21
|
-
type FormPluginOptionsSchema = {
|
|
22
|
-
schema?: FormSchema;
|
|
23
|
-
};
|
|
24
|
-
export type FormPluginOptions = FormPluginOptionsSchema & FormComposableOptions<FormPluginOptionsSchema['schema']>;
|
|
25
|
-
export type InjectedFormData<Schema extends FormSchema> = {
|
|
26
|
-
formData: Ref<Partial<z.infer<Schema>> | undefined>;
|
|
27
|
-
errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema>> | undefined>>;
|
|
28
|
-
submit: () => Promise<boolean>;
|
|
29
|
-
validate: () => Promise<boolean>;
|
|
30
|
-
ignoreUpdates: IgnoredUpdater;
|
|
31
|
-
stopUpdatesWatch: WatchStopHandle;
|
|
32
|
-
status: Readonly<Ref<FormStatus | undefined>>;
|
|
33
|
-
invalid: Readonly<Ref<boolean>>;
|
|
34
|
-
readonly: Ref<boolean>;
|
|
35
|
-
};
|
|
36
|
-
export type InjectedFormWrapperData<Schema extends FormSchema> = {
|
|
37
|
-
name: Ref<string>;
|
|
38
|
-
fields: Ref<Set<string>>;
|
|
39
|
-
errors: Ref<Map<string, z.inferFormattedError<Schema, string>>>;
|
|
40
|
-
};
|
|
41
|
-
export type InjectedFormFieldData<Schema extends FormSchema> = {
|
|
42
|
-
name: Ref<string>;
|
|
43
|
-
errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema>>>>;
|
|
44
|
-
};
|
|
45
|
-
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
46
|
-
type IsTuple<T extends readonly any[]> = number extends T['length'] ? false : true;
|
|
47
|
-
type TupleKeys<T extends readonly any[]> = Exclude<keyof T, keyof any[]>;
|
|
48
|
-
export type PathConcat<TKey extends string | number, TValue> = TValue extends Primitive ? `${TKey}` : `${TKey}` | `${TKey}.${Path<TValue>}`;
|
|
49
|
-
export type Path<T> = T extends readonly (infer V)[] ? IsTuple<T> extends true ? {
|
|
50
|
-
[K in TupleKeys<T>]-?: PathConcat<K & string, T[K]>;
|
|
51
|
-
}[TupleKeys<T>] : PathConcat<number, V> : {
|
|
52
|
-
[K in keyof T]-?: PathConcat<K & string, T[K]>;
|
|
53
|
-
}[keyof T];
|
|
54
|
-
export type PathValue<T, TPath extends Path<T> | Path<T>[]> = T extends any ? TPath extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? undefined extends T[K] ? PathValue<T[K], R> | undefined : PathValue<T[K], R> : never : K extends `${number}` ? T extends readonly (infer V)[] ? PathValue<V, R & Path<V>> : never : never : TPath extends keyof T ? T[TPath] : TPath extends `${number}` ? T extends readonly (infer V)[] ? V : never : never : never;
|
|
55
|
-
export type AnyBoolean<Schema extends FormSchema> = boolean | Ref<boolean> | ((data?: InjectedFormData<Schema>) => boolean | Ref<boolean>);
|
|
56
|
-
export type SimpleFormTemplateItem<Schema extends FormSchema> = Record<string, any> & {
|
|
57
|
-
vvIs?: string | Component;
|
|
58
|
-
vvName?: Path<z.infer<Schema>>;
|
|
59
|
-
vvSlots?: Record<string, any>;
|
|
60
|
-
vvChildren?: Array<SimpleFormTemplateItem<Schema> | ((data?: InjectedFormData<Schema>) => SimpleFormTemplateItem<Schema>)>;
|
|
61
|
-
vvIf?: AnyBoolean<Schema> | Path<z.infer<Schema>>;
|
|
62
|
-
vvElseIf?: AnyBoolean<Schema> | Path<z.infer<Schema>>;
|
|
63
|
-
vvType?: `${FormFieldType}`;
|
|
64
|
-
vvShowValid?: boolean;
|
|
65
|
-
vvContent?: string;
|
|
66
|
-
vvDefaultValue?: any;
|
|
67
|
-
};
|
|
68
|
-
export type FormTemplateItem<Schema extends FormSchema> = SimpleFormTemplateItem<Schema> | ((data?: InjectedFormData<Schema>) => SimpleFormTemplateItem<Schema>);
|
|
69
|
-
export type FormTemplate<Schema extends FormSchema> = FormTemplateItem<Schema>[] | ((data?: InjectedFormData<Schema>) => FormTemplateItem<Schema>[]);
|
|
70
|
-
export {};
|
package/dist/src/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|