• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Input parameter for creating a radio box.
18 *
19 * @interface RadioOptions
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 8
22 */
23/**
24 * Input parameter for creating a radio box.
25 *
26 * @interface RadioOptions
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @since 9
29 * @form
30 */
31/**
32 * Input parameter for creating a radio box.
33 *
34 * @interface RadioOptions
35 * @syscap SystemCapability.ArkUI.ArkUI.Full
36 * @crossplatform
37 * @since 10
38 * @form
39 */
40declare interface RadioOptions {
41  /**
42   * Radio group name.
43   *
44   * @type { string }
45   * @syscap SystemCapability.ArkUI.ArkUI.Full
46   * @since 8
47   */
48  /**
49   * Radio group name.
50   *
51   * @type { string }
52   * @syscap SystemCapability.ArkUI.ArkUI.Full
53   * @since 9
54   * @form
55   */
56  /**
57   * Radio group name.
58   *
59   * @type { string }
60   * @syscap SystemCapability.ArkUI.ArkUI.Full
61   * @crossplatform
62   * @since 10
63   * @form
64   */
65  group: string;
66
67  /**
68   * Radio name.
69   *
70   * @type { string }
71   * @syscap SystemCapability.ArkUI.ArkUI.Full
72   * @since 8
73   */
74  /**
75   * Radio name.
76   *
77   * @type { string }
78   * @syscap SystemCapability.ArkUI.ArkUI.Full
79   * @since 9
80   * @form
81   */
82  /**
83   * Radio name.
84   *
85   * @type { string }
86   * @syscap SystemCapability.ArkUI.ArkUI.Full
87   * @crossplatform
88   * @since 10
89   * @form
90   */
91  value: string;
92}
93
94/**
95 * Set radio Style.
96 *
97 * @interface RadioStyle
98 * @syscap SystemCapability.ArkUI.ArkUI.Full
99 * @crossplatform
100 * @since 10
101 */
102declare interface RadioStyle {
103  /**
104   * Set the background color when the radio box is checked.
105   *
106   * @type { ?ResourceColor } checkedBackgroundColor - the background color when the radio box is checked.
107   * @default #007DFF
108   * @syscap SystemCapability.ArkUI.ArkUI.Full
109   * @crossplatform
110   * @since 10
111   */
112  checkedBackgroundColor?: ResourceColor;
113
114  /**
115   * Set the bolder color when the radio box is unchecked.
116   *
117   * @type { ?ResourceColor } uncheckedBorderColor - the bolder color when the radio box is unchecked.
118   * @default #182431
119   * @syscap SystemCapability.ArkUI.ArkUI.Full
120   * @crossplatform
121   * @since 10
122   */
123  uncheckedBorderColor?: ResourceColor;
124
125  /**
126   * Set the indicator color when the radio box is checked.
127   *
128   * @type { ?ResourceColor } indicatorColor - the indicator color when the radio box is checked.
129   * @default #FFFFFF
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @crossplatform
132   * @since 10
133   */
134  indicatorColor?: ResourceColor;
135}
136
137/**
138 * Provides an interface for creating a radio box.
139 *
140 * @interface RadioInterface
141 * @syscap SystemCapability.ArkUI.ArkUI.Full
142 * @since 8
143 */
144/**
145 * Provides an interface for creating a radio box.
146 *
147 * @interface RadioInterface
148 * @syscap SystemCapability.ArkUI.ArkUI.Full
149 * @since 9
150 * @form
151 */
152/**
153 * Provides an interface for creating a radio box.
154 *
155 * @interface RadioInterface
156 * @syscap SystemCapability.ArkUI.ArkUI.Full
157 * @crossplatform
158 * @since 10
159 * @form
160 */
161interface RadioInterface {
162  /**
163   * Called when a radio box is created.
164   *
165   * @param { RadioOptions } options
166   * @returns { RadioAttribute }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @since 8
169   */
170  /**
171   * Called when a radio box is created.
172   *
173   * @param { RadioOptions } options
174   * @returns { RadioAttribute }
175   * @syscap SystemCapability.ArkUI.ArkUI.Full
176   * @since 9
177   * @form
178   */
179  /**
180   * Called when a radio box is created.
181   *
182   * @param { RadioOptions } options
183   * @returns { RadioAttribute }
184   * @syscap SystemCapability.ArkUI.ArkUI.Full
185   * @crossplatform
186   * @since 10
187   * @form
188   */
189  (options: RadioOptions): RadioAttribute;
190}
191
192/**
193 * Provides methods for radio method component.
194 *
195 * @extends CommonMethod
196 * @syscap SystemCapability.ArkUI.ArkUI.Full
197 * @since 8
198 */
199/**
200 * Provides methods for radio method component.
201 *
202 * @extends CommonMethod
203 * @syscap SystemCapability.ArkUI.ArkUI.Full
204 * @since 9
205 * @form
206 */
207/**
208 * Provides methods for radio method component.
209 *
210 * @extends CommonMethod
211 * @syscap SystemCapability.ArkUI.ArkUI.Full
212 * @crossplatform
213 * @since 10
214 * @form
215 */
216declare class RadioAttribute extends CommonMethod<RadioAttribute> {
217  /**
218   * Called when the radio box is selected.
219   *
220   * @param { boolean } value
221   * @returns { RadioAttribute }
222   * @syscap SystemCapability.ArkUI.ArkUI.Full
223   * @since 8
224   */
225  /**
226   * Called when the radio box is selected.
227   *
228   * @param { boolean } value
229   * @returns { RadioAttribute }
230   * @syscap SystemCapability.ArkUI.ArkUI.Full
231   * @since 9
232   * @form
233   */
234  /**
235   * Called when the radio box is selected.
236   *
237   * @param { boolean } value
238   * @returns { RadioAttribute }
239   * @syscap SystemCapability.ArkUI.ArkUI.Full
240   * @crossplatform
241   * @since 10
242   * @form
243   */
244  checked(value: boolean): RadioAttribute;
245
246  /**
247   * Called when the radio box selection status changes.
248   *
249   * @param { function } callback
250   * @returns { RadioAttribute }
251   * @syscap SystemCapability.ArkUI.ArkUI.Full
252   * @since 8
253   */
254  /**
255   * Called when the radio box selection status changes.
256   *
257   * @param { function } callback
258   * @returns { RadioAttribute }
259   * @syscap SystemCapability.ArkUI.ArkUI.Full
260   * @since 9
261   * @form
262   */
263  /**
264   * Called when the radio box selection status changes.
265   *
266   * @param { function } callback
267   * @returns { RadioAttribute }
268   * @syscap SystemCapability.ArkUI.ArkUI.Full
269   * @crossplatform
270   * @since 10
271   * @form
272   */
273  onChange(callback: (isChecked: boolean) => void): RadioAttribute;
274
275  /**
276   * Set the radio style.
277   *
278   * @param { RadioStyle } value - the radio style.
279   * @returns { RadioAttribute }
280   * @syscap SystemCapability.ArkUI.ArkUI.Full
281   * @crossplatform
282   * @since 10
283   */
284  radioStyle(value?: RadioStyle): RadioAttribute;
285}
286
287/**
288 * Defines Radio Component.
289 *
290 * @syscap SystemCapability.ArkUI.ArkUI.Full
291 * @since 8
292 */
293/**
294 * Defines Radio Component.
295 *
296 * @syscap SystemCapability.ArkUI.ArkUI.Full
297 * @since 9
298 * @form
299 */
300/**
301 * Defines Radio Component.
302 *
303 * @syscap SystemCapability.ArkUI.ArkUI.Full
304 * @crossplatform
305 * @since 10
306 * @form
307 */
308declare const Radio: RadioInterface;
309
310/**
311 * Defines Radio Component instance.
312 *
313 * @syscap SystemCapability.ArkUI.ArkUI.Full
314 * @since 8
315 */
316/**
317 * Defines Radio Component instance.
318 *
319 * @syscap SystemCapability.ArkUI.ArkUI.Full
320 * @since 9
321 * @form
322 */
323/**
324 * Defines Radio Component instance.
325 *
326 * @syscap SystemCapability.ArkUI.ArkUI.Full
327 * @crossplatform
328 * @since 10
329 * @form
330 */
331declare const RadioInstance: RadioAttribute;
332