保誠-保戶業務員媒合平台
jack
2025-01-06 e0c6891acc471f9adf2e29b2a5bed3f8337a92b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
   * @param invalidFields fields that fail validation
   */
  (isValid: boolean, invalidFields: object): 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
 
  /** Whether the form is disabled */
  disabled: 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
 
  /** Whether to trigger validation when the `rules` prop is changed */
  validateOnRuleChange: 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 (): Promise<boolean>
  /**
   * Validate certain form items
   *
   * @param props The property of `model` or array of prop which is going to validate
   * @param callback A callback to tell the field validation result
   */
  validateField (props: string | string[], callback?: ValidateFieldCallback): void
 
  /** reset all the fields and remove validation result */
  resetFields (): void
 
  /** clear validation message for certain fields */
  clearValidate (props?: string | string[]): void
}