1 |
|
2 |
|
3 | import * as React from 'react';
|
4 | import { data } from '../checkbox';
|
5 | import CommonProps from '../util';
|
6 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
7 | defaultValue?: any;
|
8 | onChange?: any;
|
9 | }
|
10 |
|
11 | export interface GroupProps extends HTMLAttributesWeak, CommonProps {
|
12 | |
13 |
|
14 |
|
15 | prefix?: string;
|
16 |
|
17 | |
18 |
|
19 |
|
20 | className?: string;
|
21 |
|
22 | |
23 |
|
24 |
|
25 | style?: React.CSSProperties;
|
26 |
|
27 | |
28 |
|
29 |
|
30 | name?: string;
|
31 |
|
32 | |
33 |
|
34 |
|
35 | value?: string | number | boolean;
|
36 |
|
37 | |
38 |
|
39 |
|
40 | defaultValue?: string | number | boolean;
|
41 |
|
42 | |
43 |
|
44 |
|
45 | component?: React.ReactHTML | (() => void);
|
46 |
|
47 | /**
|
48 | * 选中值改变时的事件
|
49 | */
|
50 | onChange?: (value: string | number | boolean, e: any) => void;
|
51 |
|
52 | |
53 |
|
54 |
|
55 | disabled?: boolean;
|
56 |
|
57 | |
58 |
|
59 |
|
60 | shape?: 'button';
|
61 |
|
62 | |
63 |
|
64 |
|
65 | size?: 'large' | 'medium' | 'small';
|
66 |
|
67 | |
68 |
|
69 |
|
70 | dataSource?: Array<string> | Array<data> | Array<number>;
|
71 |
|
72 | |
73 |
|
74 |
|
75 | children?: Array<any> | React.ReactElement<any>;
|
76 |
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 | direction?: 'hoz' | 'ver';
|
83 |
|
84 | |
85 |
|
86 |
|
87 | isPreview?: boolean;
|
88 |
|
89 | |
90 |
|
91 |
|
92 | renderPreview?: (previewed: { label: string | React.ReactNode; value: string | number | boolean }, props: any) => React.ReactNode;
|
93 | itemDirection?: 'hoz' | 'ver';
|
94 | }
|
95 |
|
96 | export class Group extends React.Component<GroupProps, any> {}
|
97 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
98 | onChange?: any;
|
99 | onMouseEnter?: any;
|
100 | onMouseLeave?: any;
|
101 | }
|
102 |
|
103 | export interface RadioProps extends HTMLAttributesWeak, CommonProps {
|
104 | |
105 |
|
106 |
|
107 | className?: string;
|
108 |
|
109 | |
110 |
|
111 |
|
112 | id?: string;
|
113 |
|
114 | |
115 |
|
116 |
|
117 | style?: React.CSSProperties;
|
118 |
|
119 | |
120 |
|
121 |
|
122 | checked?: boolean;
|
123 |
|
124 | |
125 |
|
126 |
|
127 | defaultChecked?: boolean;
|
128 |
|
129 | |
130 |
|
131 |
|
132 | label?: React.ReactNode;
|
133 |
|
134 | |
135 |
|
136 |
|
137 | onChange?: (checked: boolean, e: any) => void;
|
138 |
|
139 | |
140 |
|
141 |
|
142 | onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
143 |
|
144 | |
145 |
|
146 |
|
147 | onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
148 |
|
149 | |
150 |
|
151 |
|
152 | disabled?: boolean;
|
153 |
|
154 | |
155 |
|
156 |
|
157 | value?: string | number | boolean;
|
158 |
|
159 | |
160 |
|
161 |
|
162 | name?: string;
|
163 |
|
164 | |
165 |
|
166 |
|
167 | isPreview?: boolean;
|
168 |
|
169 | |
170 |
|
171 |
|
172 | renderPreview?: (values: string | number | boolean, props: any) => React.ReactNode;
|
173 | }
|
174 |
|
175 | export default class Radio extends React.Component<RadioProps, any> {
|
176 | static Group: typeof Group;
|
177 | }
|