API Documentation
API Documentation
Classes
Component Variables
Other Variables
Other Functions
Use Functions
Type Aliases
ArrayFieldPath
Ƭ ArrayFieldPath<T
, L
>: T
extends NestedValueType
| NativeObjectType
? never
: T
extends infer U[] ? U
extends ObjectType
? L
| Join
<Join
<L
, `${number}`>, ArrayFieldPath
<U
>> : L
: T
extends ObjectType
? { [key: string]
: any
; } extends T
? string
: { [K in keyof T]: Join<Join<L, K>, ArrayFieldPath<T[K]>> }[keyof T
] : never
Type parameters
Name | Type |
---|---|
T | extends ObjectType |
L | extends string = "" |
Defined in
ArrayItem
Ƭ ArrayItem<T
>: T
extends infer U[] ? U
: never
Type parameters
Name |
---|
T |
Defined in
ArrayPathToString
Ƭ ArrayPathToString<T
>: T
extends `${number}` ? 0
: T
Type parameters
Name |
---|
T |
Defined in
AutoPath
Ƭ AutoPath<T
, L
>: T
extends NestedValueType
| NativeObjectType
? L
: T
extends infer U[] ? U
extends ObjectType
? Join
<L
, `${number}`> | Join
<Join
<L
, `${number}`>, AutoPath
<U
>> : Join
<L
, `${number}`> : T
extends ObjectType
? { [key: string]
: any
; } extends T
? string
: { [K in keyof T]: Join<L, K> | Join<Join<L, K>, AutoPath<T[K]>> }[keyof T
] : L
Type parameters
Name | Type |
---|---|
T | extends ObjectType |
L | extends string = "" |
Defined in
DeepPartial
Ƭ DeepPartial<T
>: T
extends NativeObjectType
| NestedValueType
? T
: T
extends infer U[] ? U
extends ObjectType
? DeepPartial
<U
>[] : U
[] : { [K in keyof T]?: DeepPartial<T[K]> }
Type parameters
Name | Type |
---|---|
T | extends ObjectType |
Defined in
DisposablePromise
Ƭ DisposablePromise<T
>: Object
Type parameters
Name | Type |
---|---|
T | any |
Type declaration
Name | Type |
---|---|
dispose? | () => void |
promise | Promise <T > |
Defined in
FieldArrayScope
Ƭ FieldArrayScope<V
>: Object
Type parameters
Name | Type |
---|---|
V | any |
Type declaration
Name | Type |
---|---|
append | (v : V ) => void |
fields | { id : string ; name : string }[] |
insert | (id : string , v : V ) => void |
move | (from : string , to : string ) => void |
prepend | (v : V ) => void |
remove | (id : string ) => void |
replace | (values : V []) => void |
swap | (from : string , to : string ) => void |
update | (id : string , v : V ) => void |
Defined in
packages/vfm/src/fieldArray.ts:118
FieldError
Ƭ FieldError: Object
Type declaration
Name | Type |
---|---|
message | string |
type? | string |
Defined in
FieldPath
Ƭ FieldPath<T
, L
>: T
extends NestedValueType
| NativeObjectType
? L
: T
extends infer U[] ? U
extends ObjectType
? Join
<Join
<L
, `${number}`>, FieldPath
<U
>> : Join
<L
, `${number}`> : T
extends ObjectType
? { [key: string]
: any
; } extends T
? string
: { [K in keyof T]: Join<Join<L, K>, FieldPath<T[K]>> }[keyof T
] : L
Type parameters
Name | Type |
---|---|
T | extends ObjectType |
L | extends string = "" |
Defined in
FieldProps
Ƭ FieldProps<T
, N
>: Object
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
N | extends string = string |
Type declaration
Name | Type |
---|---|
onBlur | () => void |
onChange? | (v : KeyPathValue <T , N > | Event ) => void |
onFocus | () => void |
onInput? | (v : KeyPathValue <T , N > | Event ) => void |
ref | (el : InputLikeRef | null ) => void |
value | KeyPathValue <T , N > |
Defined in
FieldRule
Ƭ FieldRule<V
, Deps
>: Object
Type parameters
Name | Type |
---|---|
V | any |
Deps | any |
Type declaration
Name | Type |
---|---|
alpha? | boolean |
alphaNum? | boolean |
debounce? | number |
decimal? | boolean |
email? | boolean |
integer? | boolean |
ipAddress? | boolean |
macAddress? | boolean |
max? | number |
maxLength? | number |
message? | string |
min? | number |
minLength? | number |
numeric? | boolean |
pattern? | RegExp |
required? | boolean |
requiredLength? | boolean |
type? | string |
validator? | Validator <V , Deps > |
Defined in
FieldScope
Ƭ FieldScope<T
, N
>: Object
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
N | extends string = string |
Type declaration
Name | Type |
---|---|
field | FieldProps <T , N > |
Defined in
FieldState
Ƭ FieldState: Object
Type declaration
Name | Type |
---|---|
error | FieldError | null |
isChanged | boolean |
isDirty | boolean |
isError | boolean |
isTouched | boolean |
isValidating | boolean |
Defined in
FieldValues
Ƭ FieldValues<T
, P
>: P
extends true
? UnpackNestedValue
<DeepPartial
<T
>> : UnpackNestedValue
<T
>
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
P | extends boolean = false |
Defined in
FormErrors
Ƭ FormErrors<T
>: T
extends NestedValueType
| NativeObjectType
? FieldError
| null
| undefined
: T
extends infer U[] ? { [key: number]
: FormErrors
<U
>; } : T
extends ObjectType
? { [K in keyof T]?: FormErrors<T[K]> } : FieldError
| null
| undefined
Type parameters
Name |
---|
T |
Defined in
FormState
Ƭ FormState<T
, VFK
>: Object
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
VFK | extends string = string |
Type declaration
Name | Type |
---|---|
defaultValues | FieldValues <T , true > |
error | FieldError | null |
fieldError | FieldError | null |
fieldErrors | FormErrors <T > |
isChanged | boolean |
isDirty | boolean |
isError | boolean |
isFieldError | boolean |
isFieldValidating | boolean |
isSubmitted | boolean |
isSubmitting | boolean |
isTouched | boolean |
isValidating | boolean |
isVirtualError | boolean |
isVirtualValidating | boolean |
submitCount | number |
values | FieldValues <T > |
virtualError | FieldError | null |
virtualErrors | Partial <Record <VFK , FieldError | null >> |
Defined in
FormType
Ƭ FormType: Record
<string
, any
>
Defined in
GetFormType
Ƭ GetFormType<T
>: T
extends Form
<infer U> ? U
: never
Type parameters
Name |
---|
T |
Defined in
InputLikeRef
Ƭ InputLikeRef: Element
| Component
| { focus?
: () => void
}
Defined in
InternalKeyPathValue
Ƭ InternalKeyPathValue<V
, Path
>: Path
extends ""
? V
: V
extends ObjectType
? V
extends NestedValueType
| NativeObjectType
? never
: Path
extends `${infer Key}.${infer Rest}` ? KeyPathValue
<V
[Key
], Rest
> : V
[Path
] extends NestedValue
<infer U> ? U
: V
extends infer U[] ? U
| undefined
: V
[Path
] : never
Type parameters
Name | Type |
---|---|
V | V |
Path | extends string |
Defined in
Join
Ƭ Join<K
, P
>: K
extends string
| number
? P
extends string
| number
? ""
extends K
? P
: `${K}${"" extends P ? "" : "."}${P}` : ""
: ""
Type parameters
Name |
---|
K |
P |
Defined in
KeyPathValue
Ƭ KeyPathValue<V
, Path
>: string
extends Path
? any
: InternalKeyPathValue
<V
, NormalizePath
<Path
>>
Type parameters
Name | Type |
---|---|
V | extends ObjectType |
Path | extends string |
Defined in
NativeObjectType
Ƭ NativeObjectType: Date
| Blob
| File
| FileList
| Function
| RegExp
Defined in
NestedValue
Ƭ NestedValue<T
>: { [$NestedValue]
: never
} & T
Type parameters
Name | Type |
---|---|
T | extends ObjectType |
Defined in
NestedValueType
Ƭ NestedValueType: Object
Type declaration
Name | Type |
---|---|
[$NestedValue] | never |
Defined in
NormalizePath
Ƭ NormalizePath<T
>: T
extends `${infer A}.${infer B}` ? `${ArrayPathToString<A>}.${NormalizePath<B>}` : ArrayPathToString
<T
>
Type parameters
Name | Type |
---|---|
T | extends string |
Defined in
ObjectType
Ƭ ObjectType: Record
<string
, any
>
Defined in
UnpackFieldState
Ƭ UnpackFieldState<T
>: T
extends NestedValueType
? FieldState
: T
extends NativeObjectType
? FieldState
: T
extends infer A[] ? UnpackFieldState
<A
>[] : T
extends ObjectType
? { [K in keyof T]: UnpackFieldState<T[K]> } : FieldState
Type parameters
Name |
---|
T |
Defined in
UnpackNestedValue
Ƭ UnpackNestedValue<T
>: T
extends NestedValue
<infer U> ? U
: T
extends NativeObjectType
? T
: T
extends infer A[] ? UnpackNestedValue
<A
>[] : T
extends ObjectType
? { [K in keyof T]: UnpackNestedValue<T[K]> } : T
Type parameters
Name |
---|
T |
Defined in
UseFieldProps
Ƭ UseFieldProps<T
, N
, Deps
, Transform
>: Object
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
N | extends FieldPath <T > = FieldPath <T > |
Deps | any |
Transform | KeyPathValue <T , N > |
Type declaration
Name | Type |
---|---|
changeType? | "ONINPUT" | "ONCHANGE" |
debounce? | number |
defaultValue? | KeyPathValue <T , N > |
deps? | () => Deps |
form? | Form <T > |
isEqual? | (v : KeyPathValue <T , N >, d : KeyPathValue <T , N >) => boolean |
name | Ref <N > | N |
rules? | Ref <FieldRule <Transform , Deps >[]> | FieldRule <Transform , Deps >[] |
touchType? | Ref <"FOCUS" | "BLUR" > | "FOCUS" | "BLUR" |
transform? | (v : KeyPathValue <T , N >) => Transform |
value? | KeyPathValue <T , N > |
Defined in
packages/vfm/src/uses/useField.ts:24
UseVirtualFieldProps
Ƭ UseVirtualFieldProps<T
, VFK
, N
, V
>: Object
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
VFK | extends string = string |
N | extends VFK = VFK |
V | any |
Type declaration
Name | Type |
---|---|
debounce? | number |
form? | Form <T , VFK > |
name | Ref <N > | N |
rules? | Ref <VirtualFieldRule []> | VirtualFieldRule [] |
value | () => V |
Defined in
packages/vfm/src/uses/useVirtualField.ts:7
ValidateFunc
Ƭ ValidateFunc<V
, Deps
, Rules
>: (v
: V
, deps
: Deps
| undefined
, rules
: Rules
) => DisposablePromise
<FieldError
| null
>
Type parameters
Name | Type |
---|---|
V | V |
Deps | Deps |
Rules | FieldRule <V , Deps >[] |
Type declaration
▸ (v
, deps
, rules
): DisposablePromise
<FieldError
| null
>
Parameters
Name | Type |
---|---|
v | V |
deps | Deps | undefined |
rules | Rules |
Returns
DisposablePromise
<FieldError
| null
>
Defined in
Validator
Ƭ Validator<V
, Deps
>: (value
: V
| undefined
, deps?
: Deps
) => string
| Promise
<string
> | DisposablePromise
<string
>
Type parameters
Name | Type |
---|---|
V | any |
Deps | any |
Type declaration
▸ (value
, deps?
): string
| Promise
<string
> | DisposablePromise
<string
>
Parameters
Name | Type |
---|---|
value | V | undefined |
deps? | Deps |
Returns
string
| Promise
<string
> | DisposablePromise
<string
>
Defined in
VirtualFieldRule
Ƭ VirtualFieldRule<V
>: Object
Type parameters
Name | Type |
---|---|
V | any |
Type declaration
Name | Type |
---|---|
alpha? | boolean |
alphaNum? | boolean |
debounce? | number |
decimal? | boolean |
email? | boolean |
integer? | boolean |
ipAddress? | boolean |
macAddress? | boolean |
max? | number |
maxLength? | number |
message? | string |
min? | number |
minLength? | number |
numeric? | boolean |
pattern? | RegExp |
required? | boolean |
requiredLength? | boolean |
type? | string |
validator? | VirtualFieldValidator <V > |
Defined in
VirtualFieldState
Ƭ VirtualFieldState: Object
Type declaration
Name | Type |
---|---|
error | FieldError | null |
isError | boolean |
isValidating | boolean |
Defined in
VirtualFieldValidator
Ƭ VirtualFieldValidator<V
>: (value
: V
) => string
| Promise
<string
> | DisposablePromise
<string
>
Type parameters
Name | Type |
---|---|
V | any |
Type declaration
▸ (value
): string
| Promise
<string
> | DisposablePromise
<string
>
Parameters
Name | Type |
---|---|
value | V |
Returns
string
| Promise
<string
> | DisposablePromise
<string
>
Defined in
VirtualValidateFunc
Ƭ VirtualValidateFunc<V
, Rules
>: (v
: V
, rules
: Rules
) => DisposablePromise
<FieldError
| null
>
Type parameters
Name | Type |
---|---|
V | V |
Rules | VirtualFieldRule <V >[] |
Type declaration
▸ (v
, rules
): DisposablePromise
<FieldError
| null
>
Parameters
Name | Type |
---|---|
v | V |
rules | Rules |
Returns
DisposablePromise
<FieldError
| null
>
Defined in
Component Variables
Field
• Const
Field: DefineComponent
<{}, {}, any
, ComputedOptions
, MethodOptions
, ComponentOptionsMixin
, ComponentOptionsMixin
, {}, string
, PublicProps
, Readonly
<ExtractPropTypes
<{}>>, {}> = FieldComponent
Defined in
packages/vfm/src/components/Field/index.ts:7
FieldArray
• Const
FieldArray: DefineComponent
<{}, {}, any
, ComputedOptions
, MethodOptions
, ComponentOptionsMixin
, ComponentOptionsMixin
, {}, string
, PublicProps
, Readonly
<ExtractPropTypes
<{}>>, {}> = FieldArrayComponent
Defined in
packages/vfm/src/components/index.ts:22
FormProvider
• Const
FormProvider: DefineComponent
<{}, {}, any
, ComputedOptions
, MethodOptions
, ComponentOptionsMixin
, ComponentOptionsMixin
, {}, string
, PublicProps
, Readonly
<ExtractPropTypes
<{}>>, {}> = FormProviderComponent
Defined in
packages/vfm/src/components/index.ts:27
VirtualField
• Const
VirtualField: DefineComponent
<{}, {}, any
, ComputedOptions
, MethodOptions
, ComponentOptionsMixin
, ComponentOptionsMixin
, {}, string
, PublicProps
, Readonly
<ExtractPropTypes
<{}>>, {}> = VirtualFieldComponent
Defined in
packages/vfm/src/components/index.ts:17
Other Variables
FormContextKey
• Const
FormContextKey: InjectionKey
<Form
<FormType
, string
>>
Defined in
validators
• Const
validators: Object
Type declaration
Name | Type |
---|---|
alpha | Validator <any , any > |
alphaNum | Validator <any , any > |
decimal | Validator <any , any > |
email | Validator <any , any > |
integer | Validator <any , any > |
ipAddress | Validator <any , any > |
macAddress | Validator <any , any > |
numeric | Validator <any , any > |
Defined in
packages/vfm/src/validators/index.ts:10
Other Functions
createFieldArray
▸ createFieldArray<T
, N
>(form
, path
): Object
Type parameters
Name | Type |
---|---|
T | extends FormType |
N | extends string |
Parameters
Name | Type |
---|---|
form | Form <T , string > |
path | N |
Returns
Object
Name | Type |
---|---|
append | (v : ArrayItem <KeyPathValue <T , N >>) => void |
fields | Ref <{ id : string ; name : string }[]> |
insert | (id : string , v : ArrayItem <KeyPathValue <T , N >>) => void |
move | (from : string , to : string ) => void |
onCleanup | () => void |
prepend | (v : ArrayItem <KeyPathValue <T , N >>) => void |
remove | (id : string ) => void |
replace | (values : KeyPathValue <T , N >) => void |
swap | (from : string , to : string ) => void |
update | (id : string , v : ArrayItem <KeyPathValue <T , N >>) => void |
get fieldsValue() | { id : string ; name : string }[] |
createForm
▸ createForm<T
, VFK
>(args
): Form
<T
, VFK
>
Type parameters
Name | Type |
---|---|
T | extends FormType = FormType |
VFK | extends string = string |
Parameters
Name | Type |
---|---|
args | Object |
args.defaultValues? | UnpackNestedValue <DeepPartial <T >> |
args.initValues | UnpackNestedValue <T > |
args.readonly? | boolean |
args.touchType? | "FOCUS" | "BLUR" |
Returns
Form
<T
, VFK
>
Use Functions
useField
▸ useField<T
, N
, Deps
, Transform
>(props
): [FieldProps
<T
, N
>, Ref
<KeyPathValue
<T
, N
>>, { mounted
: Ref
<Boolean
> }]
Type parameters
Name | Type |
---|---|
T | extends FormType |
N | extends string |
Deps | any |
Transform | KeyPathValue <T , N > |
Parameters
Name | Type |
---|---|
props | UseFieldProps <T , N , Deps , Transform > |
Returns
[FieldProps
<T
, N
>, Ref
<KeyPathValue
<T
, N
>>, { mounted
: Ref
<Boolean
> }]
useFieldArray
▸ useFieldArray<T
, N
>(args
): Object
Type parameters
Name | Type |
---|---|
T | extends FormType |
N | extends string |
Parameters
Name | Type |
---|---|
args | Object |
args.form? | Form <T , string > |
args.path | N |
Returns
Object
Name | Type |
---|---|
append | (v : ArrayItem <KeyPathValue <T , N >>) => void |
fields | Ref <{ id : string ; name : string }[]> |
fieldsValue | { id : string ; name : string }[] |
insert | (id : string , v : ArrayItem <KeyPathValue <T , N >>) => void |
move | (from : string , to : string ) => void |
prepend | (v : ArrayItem <KeyPathValue <T , N >>) => void |
remove | (id : string ) => void |
replace | (values : KeyPathValue <T , N >) => void |
swap | (from : string , to : string ) => void |
update | (id : string , v : ArrayItem <KeyPathValue <T , N >>) => void |
useForm
▸ useForm<F
, VFK
>(formGetter?
): Form
<F
, VFK
>
Type parameters
Name | Type |
---|---|
F | extends FormType = FormType |
VFK | extends string = string |
Parameters
Name | Type |
---|---|
formGetter? | () => Form <F , VFK > |
Returns
Form
<F
, VFK
>
useProvideForm
▸ useProvideForm(form
): void
Parameters
Name | Type |
---|---|
form | Form <FormType , string > |
Returns
void
useVirtualField
▸ useVirtualField<T
, N
>(props
): Object
Type parameters
Name | Type |
---|---|
T | extends FormType |
N | extends string |
Parameters
Name | Type |
---|---|
props | UseVirtualFieldProps <T , N , N , any > |
Returns
Object
Name | Type |
---|---|
mounted | Ref <Boolean > |