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