• 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 * @file
18 * @kit ArkUI
19 */
20
21/*** if arkts 1.2 */
22import { CommonMethod, ContentModifier, CommonConfiguration, Callback } from './common';
23import { CustomBuilder } from './builder';
24import { ResourceColor } from './units';
25/*** endif */
26
27/**
28 * Defines the IndicatorType of Radio component
29 *
30 * @enum { number }
31 * @syscap SystemCapability.ArkUI.ArkUI.Full
32 * @crossplatform
33 * @form
34 * @atomicservice
35 * @since arkts {'1.1':'12','1.2':'20'}
36 * @arkts 1.1&1.2
37 */
38declare enum RadioIndicatorType {
39  /**
40   * Tick shape.
41   *
42   * @syscap SystemCapability.ArkUI.ArkUI.Full
43   * @crossplatform
44   * @form
45   * @atomicservice
46   * @since arkts {'1.1':'12','1.2':'20'}
47   * @arkts 1.1&1.2
48   */
49  TICK = 0,
50  /**
51   * Dot shape.
52   *
53   * @syscap SystemCapability.ArkUI.ArkUI.Full
54   * @crossplatform
55   * @form
56   * @atomicservice
57   * @since arkts {'1.1':'12','1.2':'20'}
58   * @arkts 1.1&1.2
59   */
60  DOT = 1,
61    /**
62   * custom shape.
63   *
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @crossplatform
66   * @form
67   * @atomicservice
68   * @since arkts {'1.1':'12','1.2':'20'}
69   * @arkts 1.1&1.2
70   */
71  CUSTOM = 2,
72}
73
74/**
75 * Input parameter for creating a radio box.
76 *
77 * @interface RadioOptions
78 * @syscap SystemCapability.ArkUI.ArkUI.Full
79 * @since 8
80 */
81/**
82 * Input parameter for creating a radio box.
83 *
84 * @interface RadioOptions
85 * @syscap SystemCapability.ArkUI.ArkUI.Full
86 * @form
87 * @since 9
88 */
89/**
90 * Input parameter for creating a radio box.
91 *
92 * @interface RadioOptions
93 * @syscap SystemCapability.ArkUI.ArkUI.Full
94 * @crossplatform
95 * @form
96 * @since 10
97 */
98/**
99 * Input parameter for creating a radio box.
100 *
101 * @interface RadioOptions
102 * @syscap SystemCapability.ArkUI.ArkUI.Full
103 * @crossplatform
104 * @form
105 * @atomicservice
106 * @since arkts {'1.1':'11','1.2':'20'}
107 * @arkts 1.1&1.2
108 */
109declare interface RadioOptions {
110  /**
111   * Radio group name.
112   *
113   * @type { string }
114   * @syscap SystemCapability.ArkUI.ArkUI.Full
115   * @since 8
116   */
117  /**
118   * Radio group name.
119   *
120   * @type { string }
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @form
123   * @since 9
124   */
125  /**
126   * Radio group name.
127   *
128   * @type { string }
129   * @syscap SystemCapability.ArkUI.ArkUI.Full
130   * @crossplatform
131   * @form
132   * @since 10
133   */
134  /**
135   * Radio group name.
136   *
137   * @type { string }
138   * @syscap SystemCapability.ArkUI.ArkUI.Full
139   * @crossplatform
140   * @form
141   * @atomicservice
142   * @since arkts {'1.1':'11','1.2':'20'}
143   * @arkts 1.1&1.2
144   */
145  group: string;
146
147  /**
148   * Radio name.
149   *
150   * @type { string }
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @since 8
153   */
154  /**
155   * Radio name.
156   *
157   * @type { string }
158   * @syscap SystemCapability.ArkUI.ArkUI.Full
159   * @form
160   * @since 9
161   */
162  /**
163   * Radio name.
164   *
165   * @type { string }
166   * @syscap SystemCapability.ArkUI.ArkUI.Full
167   * @crossplatform
168   * @form
169   * @since 10
170   */
171  /**
172   * Radio name.
173   *
174   * @type { string }
175   * @syscap SystemCapability.ArkUI.ArkUI.Full
176   * @crossplatform
177   * @form
178   * @atomicservice
179   * @since arkts {'1.1':'11','1.2':'20'}
180   * @arkts 1.1&1.2
181   */
182  value: string;
183  /**
184   * Indicator Type.
185   *
186   * @type { ?RadioIndicatorType }
187   * @syscap SystemCapability.ArkUI.ArkUI.Full
188   * @crossplatform
189   * @form
190   * @atomicservice
191   * @since arkts {'1.1':'12','1.2':'20'}
192   * @arkts 1.1&1.2
193   */
194  indicatorType?: RadioIndicatorType;
195  /**
196   * builder for IndicatorType.CUSTOM
197   *
198   * @type { ?CustomBuilder }
199   * @syscap SystemCapability.ArkUI.ArkUI.Full
200   * @crossplatform
201   * @form
202   * @atomicservice
203   * @since arkts {'1.1':'12','1.2':'20'}
204   * @arkts 1.1&1.2
205   */
206  indicatorBuilder?: CustomBuilder;
207}
208
209/**
210 * Set radio Style.
211 *
212 * @interface RadioStyle
213 * @syscap SystemCapability.ArkUI.ArkUI.Full
214 * @crossplatform
215 * @since 10
216 */
217/**
218 * Set radio Style.
219 *
220 * @interface RadioStyle
221 * @syscap SystemCapability.ArkUI.ArkUI.Full
222 * @crossplatform
223 * @atomicservice
224 * @since arkts {'1.1':'11','1.2':'20'}
225 * @arkts 1.1&1.2
226 */
227declare interface RadioStyle {
228  /**
229   * Set the background color when the radio box is checked.
230   *
231   * @type { ?ResourceColor } checkedBackgroundColor - the background color when the radio box is checked.
232   * @default #007DFF
233   * @syscap SystemCapability.ArkUI.ArkUI.Full
234   * @crossplatform
235   * @since 10
236   */
237  /**
238   * Set the background color when the radio box is checked.
239   *
240   * @type { ?ResourceColor } checkedBackgroundColor - the background color when the radio box is checked.
241   * @default #007DFF
242   * @syscap SystemCapability.ArkUI.ArkUI.Full
243   * @crossplatform
244   * @atomicservice
245   * @since arkts {'1.1':'11','1.2':'20'}
246   * @arkts 1.1&1.2
247   */
248  checkedBackgroundColor?: ResourceColor;
249
250  /**
251   * Set the bolder color when the radio box is unchecked.
252   *
253   * @type { ?ResourceColor } uncheckedBorderColor - the bolder color when the radio box is unchecked.
254   * @default #182431
255   * @syscap SystemCapability.ArkUI.ArkUI.Full
256   * @crossplatform
257   * @since 10
258   */
259  /**
260   * Set the bolder color when the radio box is unchecked.
261   *
262   * @type { ?ResourceColor } uncheckedBorderColor - the bolder color when the radio box is unchecked.
263   * @default #182431
264   * @syscap SystemCapability.ArkUI.ArkUI.Full
265   * @crossplatform
266   * @atomicservice
267   * @since arkts {'1.1':'11','1.2':'20'}
268   * @arkts 1.1&1.2
269   */
270  uncheckedBorderColor?: ResourceColor;
271
272  /**
273   * Set the indicator color when the radio box is checked.
274   *
275   * @type { ?ResourceColor } indicatorColor - the indicator color when the radio box is checked.
276   * @default #FFFFFF
277   * @syscap SystemCapability.ArkUI.ArkUI.Full
278   * @crossplatform
279   * @since 10
280   */
281  /**
282   * Set the indicator color when the radio box is checked.
283   *
284   * @type { ?ResourceColor } indicatorColor - the indicator color when the radio box is checked.
285   * @default #FFFFFF
286   * @syscap SystemCapability.ArkUI.ArkUI.Full
287   * @crossplatform
288   * @atomicservice
289   * @since arkts {'1.1':'11','1.2':'20'}
290   * @arkts 1.1&1.2
291   */
292  indicatorColor?: ResourceColor;
293}
294
295/**
296 * Provides an interface for creating a radio box.
297 *
298 * @interface RadioInterface
299 * @syscap SystemCapability.ArkUI.ArkUI.Full
300 * @since 8
301 */
302/**
303 * Provides an interface for creating a radio box.
304 *
305 * @interface RadioInterface
306 * @syscap SystemCapability.ArkUI.ArkUI.Full
307 * @form
308 * @since 9
309 */
310/**
311 * Provides an interface for creating a radio box.
312 *
313 * @interface RadioInterface
314 * @syscap SystemCapability.ArkUI.ArkUI.Full
315 * @crossplatform
316 * @form
317 * @since 10
318 */
319/**
320 * Provides an interface for creating a radio box.
321 *
322 * @interface RadioInterface
323 * @syscap SystemCapability.ArkUI.ArkUI.Full
324 * @crossplatform
325 * @form
326 * @atomicservice
327 * @since arkts {'1.1':'11','1.2':'20'}
328 * @arkts 1.1&1.2
329 */
330interface RadioInterface {
331  /**
332   * Called when a radio box is created.
333   *
334   * @param { RadioOptions } options
335   * @returns { RadioAttribute }
336   * @syscap SystemCapability.ArkUI.ArkUI.Full
337   * @since 8
338   */
339  /**
340   * Called when a radio box is created.
341   *
342   * @param { RadioOptions } options
343   * @returns { RadioAttribute }
344   * @syscap SystemCapability.ArkUI.ArkUI.Full
345   * @form
346   * @since 9
347   */
348  /**
349   * Called when a radio box is created.
350   *
351   * @param { RadioOptions } options
352   * @returns { RadioAttribute }
353   * @syscap SystemCapability.ArkUI.ArkUI.Full
354   * @crossplatform
355   * @form
356   * @since 10
357   */
358  /**
359   * Called when a radio box is created.
360   *
361   * @param { RadioOptions } options
362   * @returns { RadioAttribute }
363   * @syscap SystemCapability.ArkUI.ArkUI.Full
364   * @crossplatform
365   * @form
366   * @atomicservice
367   * @since arkts {'1.1':'11','1.2':'20'}
368   * @arkts 1.1&1.2
369   */
370  (options: RadioOptions): RadioAttribute;
371}
372
373/**
374 * Callback of radio box selection status changes event.
375 *
376 * @typedef {function} OnRadioChangeCallback
377 * @syscap SystemCapability.ArkUI.ArkUI.Full
378 * @crossplatform
379 * @atomicservice
380 * @since arkts {'1.1':'18','1.2':'20'}
381 * @arkts 1.1&1.2
382 */
383declare type OnRadioChangeCallback = (isChecked: boolean) => void;
384
385/**
386 * Provides methods for radio method component.
387 *
388 * @extends CommonMethod<RadioAttribute>
389 * @syscap SystemCapability.ArkUI.ArkUI.Full
390 * @since 8
391 */
392/**
393 * Provides methods for radio method component.
394 *
395 * @extends CommonMethod<RadioAttribute>
396 * @syscap SystemCapability.ArkUI.ArkUI.Full
397 * @form
398 * @since 9
399 */
400/**
401 * Provides methods for radio method component.
402 *
403 * @extends CommonMethod<RadioAttribute>
404 * @syscap SystemCapability.ArkUI.ArkUI.Full
405 * @crossplatform
406 * @form
407 * @since 10
408 */
409/**
410 * Provides methods for radio method component.
411 *
412 * @extends CommonMethod<RadioAttribute>
413 * @syscap SystemCapability.ArkUI.ArkUI.Full
414 * @crossplatform
415 * @form
416 * @atomicservice
417 * @since arkts {'1.1':'11','1.2':'20'}
418 * @arkts 1.1&1.2
419 */
420declare class RadioAttribute extends CommonMethod<RadioAttribute> {
421  /**
422   * Called when the radio box is selected.
423   *
424   * @param { boolean } value
425   * @returns { RadioAttribute }
426   * @syscap SystemCapability.ArkUI.ArkUI.Full
427   * @since 8
428   */
429  /**
430   * Called when the radio box is selected.
431   *
432   * @param { boolean } value
433   * @returns { RadioAttribute }
434   * @syscap SystemCapability.ArkUI.ArkUI.Full
435   * @form
436   * @since 9
437   */
438  /**
439   * Called when the radio box is selected.
440   *
441   * @param { boolean } value
442   * @returns { RadioAttribute }
443   * @syscap SystemCapability.ArkUI.ArkUI.Full
444   * @crossplatform
445   * @form
446   * @since 10
447   */
448  /**
449   * Called when the radio box is selected.
450   *
451   * @param { boolean } value
452   * @returns { RadioAttribute }
453   * @syscap SystemCapability.ArkUI.ArkUI.Full
454   * @crossplatform
455   * @form
456   * @atomicservice
457   * @since arkts {'1.1':'11','1.2':'20'}
458   * @arkts 1.1&1.2
459   */
460  checked(value: boolean): RadioAttribute;
461
462  /**
463   * Called when the radio box is selected.
464   *
465   * @param { Optional<boolean> } isChecked
466   * @returns { RadioAttribute }
467   * @syscap SystemCapability.ArkUI.ArkUI.Full
468   * @crossplatform
469   * @form
470   * @atomicservice
471   * @since arkts {'1.1':'18','1.2':'20'}
472   * @arkts 1.1&1.2
473   */
474  checked(isChecked: Optional<boolean>): RadioAttribute;
475
476  /**
477   * Called when the radio box selection status changes.
478   *
479   * @param { function } callback
480   * @returns { RadioAttribute }
481   * @syscap SystemCapability.ArkUI.ArkUI.Full
482   * @since 8
483   */
484  /**
485   * Called when the radio box selection status changes.
486   *
487   * @param { function } callback
488   * @returns { RadioAttribute }
489   * @syscap SystemCapability.ArkUI.ArkUI.Full
490   * @form
491   * @since 9
492   */
493  /**
494   * Called when the radio box selection status changes.
495   *
496   * @param { function } callback
497   * @returns { RadioAttribute }
498   * @syscap SystemCapability.ArkUI.ArkUI.Full
499   * @crossplatform
500   * @form
501   * @since 10
502   */
503  /**
504   * Called when the radio box selection status changes.
505   *
506   * @param { function } callback
507   * @returns { RadioAttribute }
508   * @syscap SystemCapability.ArkUI.ArkUI.Full
509   * @crossplatform
510   * @form
511   * @atomicservice
512   * @since 11
513   */
514  onChange(callback: (isChecked: boolean) => void): RadioAttribute;
515
516  /**
517   * Called when the radio box selection status changes.
518   *
519   * @param { Optional<OnRadioChangeCallback> } callback
520   * @returns { RadioAttribute }
521   * @syscap SystemCapability.ArkUI.ArkUI.Full
522   * @crossplatform
523   * @form
524   * @atomicservice
525   * @since arkts {'1.1':'18','1.2':'20'}
526   * @arkts 1.1&1.2
527   */
528  onChange(callback: Optional<OnRadioChangeCallback>): RadioAttribute;
529
530  /**
531   * Set the radio style.
532   *
533   * @param { RadioStyle } value - the radio style.
534   * @returns { RadioAttribute }
535   * @syscap SystemCapability.ArkUI.ArkUI.Full
536   * @crossplatform
537   * @since 10
538   */
539  /**
540   * Set the radio style.
541   *
542   * @param { RadioStyle } value - the radio style.
543   * @returns { RadioAttribute }
544   * @syscap SystemCapability.ArkUI.ArkUI.Full
545   * @crossplatform
546   * @atomicservice
547   * @since arkts {'1.1':'11','1.2':'20'}
548   * @arkts 1.1&1.2
549   */
550  radioStyle(value?: RadioStyle): RadioAttribute;
551
552    /**
553   * Set the Configuration of radio.
554   *
555   * @param { ContentModifier<RadioConfiguration> } modifier - The contentModifier of radio.
556   * @returns { RadioAttribute }
557   * @syscap SystemCapability.ArkUI.ArkUI.Full
558   * @crossplatform
559   * @atomicservice
560   * @since arkts {'1.1':'12','1.2':'20'}
561   * @arkts 1.1&1.2
562   */
563  contentModifier(modifier: ContentModifier<RadioConfiguration>): RadioAttribute;
564
565    /**
566   * Set the Configuration of radio.
567   *
568   * @param { Optional<ContentModifier<RadioConfiguration>> } modifier - The contentModifier of radio.
569   * @returns { RadioAttribute }
570   * @syscap SystemCapability.ArkUI.ArkUI.Full
571   * @crossplatform
572   * @atomicservice
573   * @since arkts {'1.1':'18','1.2':'20'}
574   * @arkts 1.1&1.2
575   */
576  contentModifier(modifier: Optional<ContentModifier<RadioConfiguration>>): RadioAttribute;
577}
578
579/**
580 * RadioConfiguration used by radio Configuration
581 *
582 * @extends CommonConfiguration<RadioConfiguration>
583 * @interface RadioConfiguration
584 * @syscap SystemCapability.ArkUI.ArkUI.Full
585 * @crossplatform
586 * @atomicservice
587 * @since arkts {'1.1':'12','1.2':'20'}
588 * @arkts 1.1&1.2
589 */
590declare interface RadioConfiguration extends CommonConfiguration<RadioConfiguration> {
591    /**
592   * Radio name.
593   *
594   * @type { string }
595   * @syscap SystemCapability.ArkUI.ArkUI.Full
596   * @crossplatform
597   * @atomicservice
598   * @since arkts {'1.1':'12','1.2':'20'}
599   * @arkts 1.1&1.2
600   */
601  value: string;
602
603    /**
604   * Called when the radio box is selected.
605   *
606   * @type { boolean }
607   * @syscap SystemCapability.ArkUI.ArkUI.Full
608   * @crossplatform
609   * @atomicservice
610   * @since arkts {'1.1':'12','1.2':'20'}
611   * @arkts 1.1&1.2
612   */
613  checked: boolean;
614
615  /**
616   * Called when the radio box selection status changes.
617   *
618   * @type { Callback<boolean> }
619   * @syscap SystemCapability.ArkUI.ArkUI.Full
620   * @crossplatform
621   * @atomicservice
622   * @since arkts {'1.1':'12','1.2':'20'}
623   * @arkts 1.1&1.2
624   */
625  triggerChange: Callback<boolean>;
626}
627
628/**
629 * Defines Radio Component.
630 *
631 * @syscap SystemCapability.ArkUI.ArkUI.Full
632 * @since 8
633 */
634/**
635 * Defines Radio Component.
636 *
637 * @syscap SystemCapability.ArkUI.ArkUI.Full
638 * @form
639 * @since 9
640 */
641/**
642 * Defines Radio Component.
643 *
644 * @syscap SystemCapability.ArkUI.ArkUI.Full
645 * @crossplatform
646 * @form
647 * @since 10
648 */
649/**
650 * Defines Radio Component.
651 *
652 * @syscap SystemCapability.ArkUI.ArkUI.Full
653 * @crossplatform
654 * @form
655 * @atomicservice
656 * @since 11
657 */
658declare const Radio: RadioInterface;
659
660/**
661 * Defines Radio Component instance.
662 *
663 * @syscap SystemCapability.ArkUI.ArkUI.Full
664 * @since 8
665 */
666/**
667 * Defines Radio Component instance.
668 *
669 * @syscap SystemCapability.ArkUI.ArkUI.Full
670 * @form
671 * @since 9
672 */
673/**
674 * Defines Radio Component instance.
675 *
676 * @syscap SystemCapability.ArkUI.ArkUI.Full
677 * @crossplatform
678 * @form
679 * @since 10
680 */
681/**
682 * Defines Radio Component instance.
683 *
684 * @syscap SystemCapability.ArkUI.ArkUI.Full
685 * @crossplatform
686 * @form
687 * @atomicservice
688 * @since 11
689 */
690declare const RadioInstance: RadioAttribute;
691