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