fix: update form validation typings #526
parent
b1465635e9
commit
89875fde06
|
@ -186,6 +186,8 @@ declare interface FieldDecoratorOptions {
|
||||||
preserve?: boolean;
|
preserve?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ValidateCallback = (errors: Error[], values: any) => void;
|
||||||
|
|
||||||
export interface WrappedFormUtils {
|
export interface WrappedFormUtils {
|
||||||
/**
|
/**
|
||||||
* Two-way binding for form, single file template can be bound using the directive v-decorator.
|
* Two-way binding for form, single file template can be bound using the directive v-decorator.
|
||||||
|
@ -240,7 +242,7 @@ export interface WrappedFormUtils {
|
||||||
* If you don't specify a parameter, all the fields will be reset.
|
* If you don't specify a parameter, all the fields will be reset.
|
||||||
* @type Function (Function([names: string[]]))
|
* @type Function (Function([names: string[]]))
|
||||||
*/
|
*/
|
||||||
resetFields(names: string[]): void;
|
resetFields(names?: string[]): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value and error state of fields
|
* Set value and error state of fields
|
||||||
|
@ -259,24 +261,25 @@ export interface WrappedFormUtils {
|
||||||
* If you don't specify the parameter of fieldNames, you will validate all fields.
|
* If you don't specify the parameter of fieldNames, you will validate all fields.
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
validateFields(
|
validateFields(fieldNames: string[], options: ValidateFieldOptions, callback: ValidateCallback): void;
|
||||||
fieldNames: string[],
|
validateFields(fieldNames: string[], callback: ValidateCallback): void;
|
||||||
options: ValidateFieldOptions,
|
validateFields(options: ValidateFieldOptions, callback: ValidateCallback): void;
|
||||||
callback: (erros: Error[], values: any) => any,
|
validateFields(callback: ValidateCallback): void;
|
||||||
): void;
|
validateFields(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is similar to validateFields, but after validation, if the target field is not in visible area of form,
|
* This function is similar to validateFields, but after validation, if the target field is not in visible area of form,
|
||||||
* form will be automatically scrolled to the target field area.
|
* form will be automatically scrolled to the target field area.
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
validateFieldsAndScroll(
|
validateFieldsAndScroll(fieldNames?: string[], options?: Object, callback?: ValidateCallback): void;
|
||||||
fieldNames: string[],
|
validateFieldsAndScroll(fieldNames?: string[], callback?: ValidateCallback): void;
|
||||||
options: ValidateFieldOptions,
|
validateFieldsAndScroll(options?: Object, callback?: ValidateCallback): void;
|
||||||
callback: (erros: Error[], values: any) => any,
|
validateFieldsAndScroll(callback?: ValidateCallback): void;
|
||||||
): void;
|
validateFieldsAndScroll(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface IformCreateOption {
|
export interface IformCreateOption {
|
||||||
/**
|
/**
|
||||||
* Only supports the use of Form.create({})(CustomizedForm). declare props on form(like vue props)
|
* Only supports the use of Form.create({})(CustomizedForm). declare props on form(like vue props)
|
||||||
|
|
Loading…
Reference in New Issue