mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 04:39:09 +08:00
73 lines
1.8 KiB
TypeScript
73 lines
1.8 KiB
TypeScript
import { ElementUIComponent, ElementUIComponentSize } from './component'
|
|
|
|
export type FormItemLabelPosition = 'left' | 'right' | 'top'
|
|
|
|
export interface ValidateCallback {
|
|
/**
|
|
* The callback to tell the validation result
|
|
*
|
|
* @param isValid Whether the form is valid
|
|
*/
|
|
(isValid: boolean): void
|
|
}
|
|
|
|
export interface ValidateFieldCallback {
|
|
/**
|
|
* The callback to tell the field validation result
|
|
*
|
|
* @param errorMessage The error message. It will be empty if there is no error
|
|
*/
|
|
(errorMessage: string): void
|
|
}
|
|
|
|
/** Form Component */
|
|
export declare class ElForm extends ElementUIComponent {
|
|
/** Data of form component */
|
|
model: object
|
|
|
|
/** Validation rules of form */
|
|
rules: object
|
|
|
|
/** Whether the form is inline */
|
|
inline: boolean
|
|
|
|
/** Position of label */
|
|
labelPosition: FormItemLabelPosition
|
|
|
|
/** Width of label, and all form items will inherit from Form */
|
|
labelWidth: string
|
|
|
|
/** Suffix of the label */
|
|
labelSuffix: string
|
|
|
|
/** Whether to show the error message */
|
|
showMessage: boolean
|
|
|
|
/** Whether to display the error message inline with the form item */
|
|
inlineMessage: boolean
|
|
|
|
/** Whether to display an icon indicating the validation result */
|
|
statusIcon: boolean
|
|
|
|
/** Controls the size of components in this form */
|
|
size: ElementUIComponentSize
|
|
|
|
/**
|
|
* Validate the whole form
|
|
*
|
|
* @param callback A callback to tell the validation result
|
|
*/
|
|
validate (callback?: ValidateCallback): void
|
|
|
|
/**
|
|
* Validate a certain form item
|
|
*
|
|
* @param prop The property of `model` that is going to validate
|
|
* @param callback A callback to tell the field validation result
|
|
*/
|
|
validateField (prop: string, callback: ValidateFieldCallback): void
|
|
|
|
/** reset all the fields and remove validation result */
|
|
resetFields (): void
|
|
}
|