|
5 | 5 | import { CheckboxGroup } from './checkbox-group';
|
6 | 6 | import { AntdComponent, AntdProps } from '../component';
|
7 | 7 |
|
| 8 | +export interface CheckboxChangeEvent { |
| 9 | + target: CheckboxProps & { checked: boolean }; |
| 10 | + stopPropagation: () => void; |
| 11 | + preventDefault: () => void; |
| 12 | + nativeEvent: MouseEvent; |
| 13 | +} |
| 14 | + |
| 15 | +export interface CheckboxProps { |
| 16 | + prefixCls?: string; |
| 17 | + name?: string; |
| 18 | + id?: string; |
| 19 | + type?: string; |
| 20 | + |
| 21 | + /** |
| 22 | + * Specifies the initial state: whether or not the checkbox is selected. |
| 23 | + * @default false |
| 24 | + * @type boolean |
| 25 | + */ |
| 26 | + defaultChecked?: boolean; |
| 27 | + |
| 28 | + /** |
| 29 | + * Specifies whether the checkbox is selected. |
| 30 | + * @default false |
| 31 | + * @type boolean |
| 32 | + */ |
| 33 | + checked?: boolean; |
| 34 | + |
| 35 | + /** |
| 36 | + * Disable checkbox |
| 37 | + * @default false |
| 38 | + * @type boolean |
| 39 | + */ |
| 40 | + disabled?: boolean; |
| 41 | + tabindex?: string | number; |
| 42 | + readonly?: boolean; |
| 43 | + |
| 44 | + /** |
| 45 | + * get focus when component mounted |
| 46 | + * @default false |
| 47 | + * @type boolean |
| 48 | + */ |
| 49 | + autofocus?: boolean; |
| 50 | + value?: any; |
| 51 | +} |
| 52 | + |
8 | 53 | export declare class Checkbox extends AntdComponent {
|
9 | 54 | static Group: typeof CheckboxGroup;
|
10 | 55 |
|
11 |
| - $props: AntdProps & { |
12 |
| - /** |
13 |
| - * get focus when component mounted |
14 |
| - * @default false |
15 |
| - * @type boolean |
16 |
| - */ |
17 |
| - autofocus?: boolean; |
18 |
| - |
19 |
| - /** |
20 |
| - * Specifies whether the checkbox is selected. |
21 |
| - * @default false |
22 |
| - * @type boolean |
23 |
| - */ |
24 |
| - checked?: boolean; |
25 |
| - |
26 |
| - /** |
27 |
| - * Specifies the initial state: whether or not the checkbox is selected. |
28 |
| - * @default false |
29 |
| - * @type boolean |
30 |
| - */ |
31 |
| - defaultChecked?: boolean; |
32 |
| - |
33 |
| - /** |
34 |
| - * Disable checkbox |
35 |
| - * @default false |
36 |
| - * @type boolean |
37 |
| - */ |
38 |
| - disabled?: boolean; |
39 |
| - |
40 |
| - /** |
41 |
| - * indeterminate checked state of checkbox |
42 |
| - * @default false |
43 |
| - * @type boolean |
44 |
| - */ |
45 |
| - indeterminate?: boolean; |
46 |
| - |
47 |
| - /** |
48 |
| - * remove focus |
49 |
| - */ |
50 |
| - blur(): void; |
51 |
| - |
52 |
| - /** |
53 |
| - * get focus |
54 |
| - */ |
55 |
| - focus(): void; |
56 |
| - |
57 |
| - /** |
58 |
| - * The callback function that is triggered when the state changes. |
59 |
| - * @param event |
60 |
| - */ |
61 |
| - onChange?: (e?: Event) => void; |
62 |
| - }; |
| 56 | + $props: Omit<AntdProps, 'onChange'> & |
| 57 | + CheckboxProps & { |
| 58 | + /** |
| 59 | + * indeterminate checked state of checkbox |
| 60 | + * @default false |
| 61 | + * @type boolean |
| 62 | + */ |
| 63 | + indeterminate?: boolean; |
| 64 | + |
| 65 | + /** |
| 66 | + * remove focus |
| 67 | + */ |
| 68 | + onBlur?: (e: FocusEvent) => void; |
| 69 | + |
| 70 | + /** |
| 71 | + * get focus |
| 72 | + */ |
| 73 | + onFocus?: (e: FocusEvent) => void; |
| 74 | + |
| 75 | + /** |
| 76 | + * The callback function that is triggered when the state changes. |
| 77 | + * @param event |
| 78 | + */ |
| 79 | + onChange?: (e: CheckboxChangeEvent) => void; |
| 80 | + }; |
63 | 81 | }
|
0 commit comments