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 * Define the contents of each selector item. 23 * 24 * @interface TextPickerRangeContent 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @crossplatform 27 * @since 10 28 */ 29/** 30 * Define the contents of each selector item. 31 * 32 * @interface TextPickerRangeContent 33 * @syscap SystemCapability.ArkUI.ArkUI.Full 34 * @crossplatform 35 * @atomicservice 36 * @since 11 37 */ 38declare interface TextPickerRangeContent { 39 /** 40 * Specifies the icon content. 41 * 42 * @type { string | Resource } 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @crossplatform 45 * @since 10 46 */ 47 /** 48 * Specifies the icon content. 49 * 50 * @type { string | Resource } 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @crossplatform 53 * @atomicservice 54 * @since 11 55 */ 56 icon: string | Resource; 57 58 /** 59 * Specifies the text content. 60 * 61 * @type { ?(string | Resource) } 62 * @syscap SystemCapability.ArkUI.ArkUI.Full 63 * @crossplatform 64 * @since 10 65 */ 66 /** 67 * Specifies the text content. 68 * 69 * @type { ?(string | Resource) } 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @crossplatform 72 * @atomicservice 73 * @since 11 74 */ 75 text?: string | Resource; 76} 77 78/** 79 * Define the contents of text cascade picker. 80 * 81 * @interface TextCascadePickerRangeContent 82 * @syscap SystemCapability.ArkUI.ArkUI.Full 83 * @since 10 84 */ 85/** 86 * Define the contents of text cascade picker. 87 * 88 * @interface TextCascadePickerRangeContent 89 * @syscap SystemCapability.ArkUI.ArkUI.Full 90 * @crossplatform 91 * @atomicservice 92 * @since 11 93 */ 94declare interface TextCascadePickerRangeContent { 95 /** 96 * Specifies the text content. 97 * 98 * @type { string | Resource } 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @since 10 101 */ 102 /** 103 * Specifies the text content. 104 * 105 * @type { string | Resource } 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @crossplatform 108 * @atomicservice 109 * @since 11 110 */ 111 text: string | Resource; 112 113 /** 114 * Defines the text cascade picker children. 115 * 116 * @type { ?TextCascadePickerRangeContent[] } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @since 10 119 */ 120 /** 121 * Defines the text cascade picker children. 122 * 123 * @type { ?TextCascadePickerRangeContent[] } 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @crossplatform 126 * @atomicservice 127 * @since 11 128 */ 129 children?: TextCascadePickerRangeContent[]; 130} 131 132/** 133 * Defines the options of TextPicker. 134 * 135 * @interface TextPickerOptions 136 * @syscap SystemCapability.ArkUI.ArkUI.Full 137 * @since 8 138 */ 139/** 140 * Defines the options of TextPicker. 141 * 142 * @interface TextPickerOptions 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @crossplatform 145 * @since 10 146 */ 147/** 148 * Defines the options of TextPicker. 149 * 150 * @interface TextPickerOptions 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @crossplatform 153 * @atomicservice 154 * @since 11 155 */ 156declare interface TextPickerOptions { 157 /** 158 * Specifies the range of the text selector. 159 * 160 * @type {string[] | Resource} 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @since 8 163 */ 164 /** 165 * Specifies the range of the selector. 166 * Support the display of pictures, text and pictures plus text, or multi column plain text. 167 * 168 * @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]} 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @crossplatform 171 * @since 10 172 */ 173 /** 174 * Specifies the range of the selector. 175 * Support the display of pictures, text and pictures plus text, or multi column plain text. 176 * 177 * @type {string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]} 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @atomicservice 181 * @since 11 182 */ 183 range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]; 184 185 /** 186 * Value of the current selection. 187 * 188 * @type { ?string } 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @since 8 191 */ 192 /** 193 * Value of the current selection. 194 * Only valid when only text is displayed. 195 * 196 * @type { ?(string | string[]) } 197 * @syscap SystemCapability.ArkUI.ArkUI.Full 198 * @crossplatform 199 * @since 10 200 */ 201 /** 202 * Value of the current selection. 203 * Only valid when only text is displayed. 204 * 205 * @type { ?(string | string[]) } 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @crossplatform 208 * @atomicservice 209 * @since 11 210 */ 211 value?: string | string[]; 212 213 /** 214 * Current selected subscript. 215 * 216 * @type { ?number } 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @since 8 219 */ 220 /** 221 * Current selected subscript. 222 * 223 * @type { ?(number | number[]) } 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @crossplatform 226 * @since 10 227 */ 228 /** 229 * Current selected subscript. 230 * 231 * @type { ?(number | number[]) } 232 * @syscap SystemCapability.ArkUI.ArkUI.Full 233 * @crossplatform 234 * @atomicservice 235 * @since 11 236 */ 237 selected?: number | number[]; 238 239 /** 240 * Defines the column width of the text picker. 241 * 242 * @type { ?LengthMetrics[] } 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @crossplatform 245 * @atomicservice 246 * @since 18 247 */ 248 columnWidths?: LengthMetrics[]; 249} 250 251/** 252 * TextPickerInterface 253 * 254 * @interface TextPickerInterface 255 * @syscap SystemCapability.ArkUI.ArkUI.Full 256 * @since 8 257 */ 258/** 259 * TextPickerInterface 260 * 261 * @interface TextPickerInterface 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @crossplatform 264 * @since 10 265 */ 266/** 267 * TextPickerInterface 268 * 269 * @interface TextPickerInterface 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @atomicservice 273 * @since 11 274 */ 275interface TextPickerInterface { 276 /** 277 * Defines the TextPicker constructor. 278 * 279 * @param { TextPickerOptions } options 280 * @returns { TextPickerAttribute } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @since 8 283 */ 284 /** 285 * Defines the TextPicker constructor. 286 * 287 * @param { TextPickerOptions } options 288 * @returns { TextPickerAttribute } 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @crossplatform 291 * @since 10 292 */ 293 /** 294 * Defines the TextPicker constructor. 295 * 296 * @param { TextPickerOptions } options 297 * @returns { TextPickerAttribute } 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @crossplatform 300 * @atomicservice 301 * @since 11 302 */ 303 (options?: TextPickerOptions): TextPickerAttribute; 304} 305 306/** 307 * Defines the struct of DividerOptions. 308 * 309 * @interface DividerOptions 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @crossplatform 312 * @atomicservice 313 * @since 12 314 */ 315declare interface DividerOptions { 316 /** 317 * The strokeWidth of Divider. 318 * 319 * @type { ?Dimension } 320 * @syscap SystemCapability.ArkUI.ArkUI.Full 321 * @crossplatform 322 * @atomicservice 323 * @since 12 324 */ 325 strokeWidth?: Dimension; 326 327 /** 328 * The color of Divider. 329 * 330 * @type { ?ResourceColor } 331 * @syscap SystemCapability.ArkUI.ArkUI.Full 332 * @crossplatform 333 * @atomicservice 334 * @since 12 335 */ 336 color?: ResourceColor; 337 338 /** 339 * The startMargin of Divider. 340 * 341 * @type { ?Dimension } 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @crossplatform 344 * @atomicservice 345 * @since 12 346 */ 347 startMargin?: Dimension; 348 349 /** 350 * The endMargin of Divider. 351 * 352 * @type { ?Dimension } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @atomicservice 356 * @since 12 357 */ 358 endMargin?: Dimension; 359} 360 361/** 362 * Provide an interface for the text style of the text picker. 363 * 364 * @extends PickerTextStyle 365 * @interface TextPickerTextStyle 366 * @syscap SystemCapability.ArkUI.ArkUI.Full 367 * @crossplatform 368 * @atomicservice 369 * @since 15 370 */ 371declare interface TextPickerTextStyle extends PickerTextStyle { 372 /** 373 * Defines the minimum font size of the text. 374 * 375 * @type { ?(number | string | Resource) } 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @crossplatform 378 * @atomicservice 379 * @since 15 380 */ 381 minFontSize?: number | string | Resource; 382 383 /** 384 * Defines the maximum font size of the text. 385 * 386 * @type { ?(number | string | Resource) } 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @atomicservice 390 * @since 15 391 */ 392 maxFontSize?: number | string | Resource; 393 394 /** 395 * Defines the overflow mode of the text. 396 * 397 * @type { ?TextOverflow } 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @crossplatform 400 * @atomicservice 401 * @since 15 402 */ 403 overflow?: TextOverflow; 404} 405 406/** 407 * Callback of the listened scroll stop event. 408 * 409 * @typedef {function} TextPickerScrollStopCallback 410 * @param { string | string[] } value - Value of the selected item. 411 * @param { number | number[] } index - Index of the selected item. 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @crossplatform 414 * @atomicservice 415 * @since 14 416 */ 417declare type TextPickerScrollStopCallback = (value: string | string[], index: number | number[]) => void; 418 419/** 420 * Callback of TextPicker item is selected event. 421 * 422 * @typedef {function} OnTextPickerChangeCallback 423 * @param { string | string[] } selectItem - Value of the selected item. 424 * @param { number | number[] } index - Index of the selected item. 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @crossplatform 427 * @atomicservice 428 * @since 18 429 */ 430declare type OnTextPickerChangeCallback = (selectItem: string | string[], index: number | number[]) => void; 431 432/** 433 * Callback of the listened onEnterSelectedArea event. 434 * 435 * @typedef {function} TextPickerEnterSelectedAreaCallback 436 * @param { string | string[] } value - Value of the selected item. 437 * @param { number | number[] } index - Index of the selected item. 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @crossplatform 440 * @atomicservice 441 * @since 18 442 */ 443declare type TextPickerEnterSelectedAreaCallback = (value: string | string[], index: number | number[]) => void; 444 445/** 446 * Style the text selector. 447 * 448 * @extends CommonMethod<TextPickerAttribute> 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @since 8 451 */ 452/** 453 * Style the text selector. 454 * 455 * @extends CommonMethod<TextPickerAttribute> 456 * @syscap SystemCapability.ArkUI.ArkUI.Full 457 * @crossplatform 458 * @since 10 459 */ 460/** 461 * Style the text selector. 462 * 463 * @extends CommonMethod<TextPickerAttribute> 464 * @syscap SystemCapability.ArkUI.ArkUI.Full 465 * @crossplatform 466 * @atomicservice 467 * @since 11 468 */ 469declare class TextPickerAttribute extends CommonMethod<TextPickerAttribute> { 470 /** 471 * Called when the default height of the selected element is set. 472 * 473 * @param { number | string } value 474 * @returns { TextPickerAttribute } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @since 8 477 */ 478 /** 479 * Called when the default height of the selected element is set. 480 * 481 * @param { number | string } value 482 * @returns { TextPickerAttribute } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @crossplatform 485 * @since 10 486 */ 487 /** 488 * Called when the default height of the selected element is set. 489 * 490 * @param { number | string } value 491 * @returns { TextPickerAttribute } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @atomicservice 495 * @since 11 496 */ 497 defaultPickerItemHeight(value: number | string): TextPickerAttribute; 498 499 /** 500 * Called when the default height of the selected element is set. 501 * 502 * @param { Optional<number | string> } height 503 * @returns { TextPickerAttribute } 504 * @syscap SystemCapability.ArkUI.ArkUI.Full 505 * @crossplatform 506 * @atomicservice 507 * @since 18 508 */ 509 defaultPickerItemHeight(height: Optional<number | string>): TextPickerAttribute; 510 511 /** 512 * Can scroll loop if true is set, on the contrary it can not. 513 * 514 * @param { boolean } value 515 * @returns { TextPickerAttribute } 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @since 10 518 */ 519 /** 520 * Can scroll loop if true is set, on the contrary it can not. 521 * 522 * @param { boolean } value 523 * @returns { TextPickerAttribute } 524 * @syscap SystemCapability.ArkUI.ArkUI.Full 525 * @crossplatform 526 * @atomicservice 527 * @since 11 528 */ 529 canLoop(value: boolean): TextPickerAttribute; 530 531 /** 532 * Can scroll loop if true is set, on the contrary it can not. 533 * 534 * @param { Optional<boolean> } isLoop 535 * @returns { TextPickerAttribute } 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @atomicservice 539 * @since 18 540 */ 541 canLoop(isLoop: Optional<boolean>): TextPickerAttribute; 542 543 /** 544 * Sets the text style of disappearing items 545 * 546 * @param { PickerTextStyle } value - indicates the text style of disappearing items. 547 * @returns { TextPickerAttribute } 548 * @syscap SystemCapability.ArkUI.ArkUI.Full 549 * @crossplatform 550 * @since 10 551 */ 552 /** 553 * Sets the text style of disappearing items 554 * 555 * @param { PickerTextStyle } value - indicates the text style of disappearing items. 556 * @returns { TextPickerAttribute } 557 * @syscap SystemCapability.ArkUI.ArkUI.Full 558 * @crossplatform 559 * @atomicservice 560 * @since 11 561 */ 562 disappearTextStyle(value: PickerTextStyle): TextPickerAttribute; 563 564 /** 565 * Sets the text style of disappearing items 566 * 567 * @param { Optional<PickerTextStyle> } style - indicates the text style of disappearing items. 568 * @returns { TextPickerAttribute } 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @atomicservice 572 * @since 18 573 */ 574 disappearTextStyle(style: Optional<PickerTextStyle>): TextPickerAttribute; 575 576 /** 577 * Sets the text style of normal items 578 * 579 * @param { PickerTextStyle } value - indicates the text style of normal items. 580 * @returns { TextPickerAttribute } 581 * @syscap SystemCapability.ArkUI.ArkUI.Full 582 * @crossplatform 583 * @since 10 584 */ 585 /** 586 * Sets the text style of normal items 587 * 588 * @param { PickerTextStyle } value - indicates the text style of normal items. 589 * @returns { TextPickerAttribute } 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @crossplatform 592 * @atomicservice 593 * @since 11 594 */ 595 textStyle(value: PickerTextStyle): TextPickerAttribute; 596 597 /** 598 * Sets the text style of normal items 599 * 600 * @param { Optional<PickerTextStyle> } style - indicates the text style of normal items. 601 * @returns { TextPickerAttribute } 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @atomicservice 605 * @since 18 606 */ 607 textStyle(style: Optional<PickerTextStyle>): TextPickerAttribute; 608 609 /** 610 * Sets the text style of selected items 611 * 612 * @param { PickerTextStyle } value - indicates the text style of selected items. 613 * @returns { TextPickerAttribute } 614 * @syscap SystemCapability.ArkUI.ArkUI.Full 615 * @crossplatform 616 * @since 10 617 */ 618 /** 619 * Sets the text style of selected items 620 * 621 * @param { PickerTextStyle } value - indicates the text style of selected items. 622 * @returns { TextPickerAttribute } 623 * @syscap SystemCapability.ArkUI.ArkUI.Full 624 * @crossplatform 625 * @atomicservice 626 * @since 11 627 */ 628 selectedTextStyle(value: PickerTextStyle): TextPickerAttribute; 629 630 /** 631 * Sets the text style of selected items 632 * 633 * @param { Optional<PickerTextStyle> } style - indicates the text style of selected items. 634 * @returns { TextPickerAttribute } 635 * @syscap SystemCapability.ArkUI.ArkUI.Full 636 * @crossplatform 637 * @atomicservice 638 * @since 18 639 */ 640 selectedTextStyle(style: Optional<PickerTextStyle>): TextPickerAttribute; 641 642 /** 643 * Defines whether to disable the text style animation. 644 * 645 * @param { boolean } disabled 646 * @returns { TextPickerAttribute } 647 * @syscap SystemCapability.ArkUI.ArkUI.Full 648 * @crossplatform 649 * @atomicservice 650 * @since 15 651 */ 652 disableTextStyleAnimation(disabled: boolean): TextPickerAttribute; 653 654 /** 655 * Defines to set the default text style for options. 656 * 657 * @param { TextPickerTextStyle } style 658 * @returns { TextPickerAttribute } 659 * @syscap SystemCapability.ArkUI.ArkUI.Full 660 * @crossplatform 661 * @atomicservice 662 * @since 15 663 */ 664 defaultTextStyle(style: TextPickerTextStyle): TextPickerAttribute; 665 666 /** 667 * Called when the pop-up value is returned. 668 * 669 * @param { function } callback 670 * @returns { TextPickerAttribute } 671 * @syscap SystemCapability.ArkUI.ArkUI.Full 672 * @since 8 673 * @deprecated since 10 674 */ 675 onAccept(callback: (value: string, index: number) => void): TextPickerAttribute; 676 677 /** 678 * Called when the Cancel button in the pop-up window is clicked. 679 * 680 * @param { function } callback 681 * @returns { TextPickerAttribute } 682 * @syscap SystemCapability.ArkUI.ArkUI.Full 683 * @since 8 684 * @deprecated since 10 685 */ 686 onCancel(callback: () => void): TextPickerAttribute; 687 688 /** 689 * Called when the OK button in the pop-up window is clicked. 690 * 691 * @param { function } callback - the callback of onChange. 692 * @returns { TextPickerAttribute } 693 * @syscap SystemCapability.ArkUI.ArkUI.Full 694 * @since 8 695 */ 696 /** 697 * This event is triggered when a TextPicker item is selected. 698 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 699 * 700 * @param { function } callback - the callback of onChange. 701 * @returns { TextPickerAttribute } 702 * @syscap SystemCapability.ArkUI.ArkUI.Full 703 * @crossplatform 704 * @since 10 705 */ 706 /** 707 * This event is triggered when a TextPicker item is selected. 708 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 709 * 710 * @param { function } callback - the callback of onChange. 711 * @returns { TextPickerAttribute } 712 * @syscap SystemCapability.ArkUI.ArkUI.Full 713 * @crossplatform 714 * @atomicservice 715 * @since 11 716 */ 717 onChange(callback: (value: string | string[], index: number | number[]) => void): TextPickerAttribute; 718 719 /** 720 * This event is triggered when a TextPicker item is selected. 721 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 722 * 723 * @param { Optional<OnTextPickerChangeCallback> } callback - the callback of onChange. 724 * @returns { TextPickerAttribute } 725 * @syscap SystemCapability.ArkUI.ArkUI.Full 726 * @crossplatform 727 * @atomicservice 728 * @since 18 729 */ 730 onChange(callback: Optional<OnTextPickerChangeCallback>): TextPickerAttribute; 731 732 /** 733 * This event is triggered when a TextPicker item is selected and scrolling has stopped. 734 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 735 * 736 * @param { TextPickerScrollStopCallback } callback - the callback of onScrollStop. 737 * @returns { TextPickerAttribute } 738 * @syscap SystemCapability.ArkUI.ArkUI.Full 739 * @crossplatform 740 * @atomicservice 741 * @since 14 742 */ 743 onScrollStop(callback: TextPickerScrollStopCallback): TextPickerAttribute; 744 745 /** 746 * This event is triggered when a TextPicker item is selected and scrolling has stopped. 747 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 748 * 749 * @param { Optional<TextPickerScrollStopCallback> } callback - the callback of onScrollStop. 750 * @returns { TextPickerAttribute } 751 * @syscap SystemCapability.ArkUI.ArkUI.Full 752 * @crossplatform 753 * @atomicservice 754 * @since 18 755 */ 756 onScrollStop(callback: Optional<TextPickerScrollStopCallback>): TextPickerAttribute; 757 758 /** 759 * This event is triggered when an item enters the selected area. 760 * Only valid when only text is displayed. When picture or picture plus text is displayed, the value is "". 761 * 762 * @param { TextPickerEnterSelectedAreaCallback } callback - the callback of onEnterSelectedArea. 763 * @returns { TextPickerAttribute } 764 * @syscap SystemCapability.ArkUI.ArkUI.Full 765 * @crossplatform 766 * @atomicservice 767 * @since 18 768 */ 769 onEnterSelectedArea(callback: TextPickerEnterSelectedAreaCallback): TextPickerAttribute; 770 771 /** 772 * Set the selected indices. 773 * The array size is the total number of columns. 774 * 775 * @param { number | number[] } value - the selected indices. 776 * @returns { TextPickerAttribute } 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @crossplatform 779 * @since 10 780 */ 781 /** 782 * Set the selected indices. 783 * The array size is the total number of columns. 784 * 785 * @param { number | number[] } value - the selected indices. 786 * @returns { TextPickerAttribute } 787 * @syscap SystemCapability.ArkUI.ArkUI.Full 788 * @crossplatform 789 * @atomicservice 790 * @since 11 791 */ 792 selectedIndex(value: number | number[]): TextPickerAttribute; 793 794 /** 795 * Set the selected indices. 796 * The array size is the total number of columns. 797 * 798 * @param { Optional<number | number[]> } index - the selected indices. 799 * @returns { TextPickerAttribute } 800 * @syscap SystemCapability.ArkUI.ArkUI.Full 801 * @crossplatform 802 * @atomicservice 803 * @since 18 804 */ 805 selectedIndex(index: Optional<number | number[]>): TextPickerAttribute; 806 807 /** 808 * Set the divider of TextPicker 809 * 810 * @param { DividerOptions | null } value 811 * @returns { TextPickerAttribute } 812 * @syscap SystemCapability.ArkUI.ArkUI.Full 813 * @crossplatform 814 * @atomicservice 815 * @since 12 816 */ 817 divider(value: DividerOptions | null): TextPickerAttribute; 818 819 /** 820 * Set the divider of TextPicker 821 * 822 * @param { Optional<DividerOptions | null> } textDivider 823 * @returns { TextPickerAttribute } 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @crossplatform 826 * @atomicservice 827 * @since 18 828 */ 829 divider(textDivider: Optional<DividerOptions | null>): TextPickerAttribute; 830 831 /** 832 * Called when set the height of gradient 833 * 834 * @param { Dimension } value - The value the gradient height 835 * @returns { TextPickerAttribute } 836 * @syscap SystemCapability.ArkUI.ArkUI.Full 837 * @crossplatform 838 * @atomicservice 839 * @since 12 840 */ 841 gradientHeight(value: Dimension): TextPickerAttribute; 842 843 /** 844 * Enable or disable haptic feedback. 845 * 846 * @param { Optional<boolean> } enable - Default value is true, set false to disable haptic feedback. 847 * @returns { TextPickerAttribute } 848 * @syscap SystemCapability.ArkUI.ArkUI.Full 849 * @atomicservice 850 * @since 18 851 */ 852 enableHapticFeedback(enable: Optional<boolean>): TextPickerAttribute; 853 854 /** 855 * Called when set the height of gradient 856 * 857 * @param { Optional<Dimension> } height - The value the gradient height 858 * @returns { TextPickerAttribute } 859 * @syscap SystemCapability.ArkUI.ArkUI.Full 860 * @crossplatform 861 * @atomicservice 862 * @since 18 863 */ 864 gradientHeight(height: Optional<Dimension>): TextPickerAttribute; 865 866 /** 867 * If the attribute is set, the crown rotation sensitivity can be changed. 868 * 869 * @param { Optional<CrownSensitivity> } sensitivity 870 * @returns { TextPickerAttribute } 871 * @syscap SystemCapability.ArkUI.ArkUI.Full 872 * @crossplatform 873 * @atomicservice 874 * @since 18 875 */ 876 digitalCrownSensitivity(sensitivity: Optional<CrownSensitivity>): TextPickerAttribute; 877} 878 879/** 880 * Defines the struct of TextPickerResult. 881 * 882 * @interface TextPickerResult 883 * @syscap SystemCapability.ArkUI.ArkUI.Full 884 * @since 8 885 */ 886/** 887 * Defines the struct of TextPickerResult. 888 * 889 * @interface TextPickerResult 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @crossplatform 892 * @since 10 893 */ 894/** 895 * Defines the struct of TextPickerResult. 896 * 897 * @interface TextPickerResult 898 * @syscap SystemCapability.ArkUI.ArkUI.Full 899 * @crossplatform 900 * @atomicservice 901 * @since 11 902 */ 903declare interface TextPickerResult { 904 /** 905 * The currently selected value. 906 * 907 * @type { string } 908 * @syscap SystemCapability.ArkUI.ArkUI.Full 909 * @since 8 910 */ 911 /** 912 * The currently selected value. 913 * Only valid when only text is displayed.When picture or picture plus text is displayed, the value of value is "". 914 * 915 * @type { string | string[] } 916 * @syscap SystemCapability.ArkUI.ArkUI.Full 917 * @crossplatform 918 * @since 10 919 */ 920 /** 921 * The currently selected value. 922 * Only valid when only text is displayed.When picture or picture plus text is displayed, the value of value is "". 923 * 924 * @type { string | string[] } 925 * @syscap SystemCapability.ArkUI.ArkUI.Full 926 * @crossplatform 927 * @atomicservice 928 * @since 11 929 */ 930 value: string | string[]; 931 932 /** 933 * The subscript of the current selection. 934 * 935 * @type { number } 936 * @syscap SystemCapability.ArkUI.ArkUI.Full 937 * @since 8 938 */ 939 /** 940 * The subscript of the current selection. 941 * 942 * @type { number | number[] } 943 * @syscap SystemCapability.ArkUI.ArkUI.Full 944 * @crossplatform 945 * @since 10 946 */ 947 /** 948 * The subscript of the current selection. 949 * 950 * @type { number | number[] } 951 * @syscap SystemCapability.ArkUI.ArkUI.Full 952 * @crossplatform 953 * @atomicservice 954 * @since 11 955 */ 956 index: number | number[]; 957} 958 959/** 960 * Defines the TextPickerDialogOptions for Text Picker Dialog. 961 * 962 * @extends TextPickerOptions 963 * @interface TextPickerDialogOptions 964 * @syscap SystemCapability.ArkUI.ArkUI.Full 965 * @since 8 966 */ 967/** 968 * Defines the TextPickerDialogOptions for Text Picker Dialog. 969 * 970 * @extends TextPickerOptions 971 * @interface TextPickerDialogOptions 972 * @syscap SystemCapability.ArkUI.ArkUI.Full 973 * @crossplatform 974 * @since 10 975 */ 976/** 977 * Defines the TextPickerDialogOptions for Text Picker Dialog. 978 * 979 * @extends TextPickerOptions 980 * @interface TextPickerDialogOptions 981 * @syscap SystemCapability.ArkUI.ArkUI.Full 982 * @crossplatform 983 * @atomicservice 984 * @since 11 985 */ 986declare interface TextPickerDialogOptions extends TextPickerOptions { 987 /** 988 * Called when the default height of the selected element is set. 989 * 990 * @type { ?(number | string) } 991 * @syscap SystemCapability.ArkUI.ArkUI.Full 992 * @since 8 993 */ 994 /** 995 * Called when the default height of the selected element is set. 996 * 997 * @type { ?(number | string) } 998 * @syscap SystemCapability.ArkUI.ArkUI.Full 999 * @crossplatform 1000 * @since 10 1001 */ 1002 /** 1003 * Called when the default height of the selected element is set. 1004 * 1005 * @type { ?(number | string) } 1006 * @syscap SystemCapability.ArkUI.ArkUI.Full 1007 * @crossplatform 1008 * @atomicservice 1009 * @since 11 1010 */ 1011 defaultPickerItemHeight?: number | string; 1012 1013 /** 1014 * Can scroll loop if true is set, on the contrary it can not. 1015 * 1016 * @type { ?boolean } 1017 * @default true 1018 * @syscap SystemCapability.ArkUI.ArkUI.Full 1019 * @since 10 1020 */ 1021 /** 1022 * Can scroll loop if true is set, on the contrary it can not. 1023 * 1024 * @type { ?boolean } 1025 * @default true 1026 * @syscap SystemCapability.ArkUI.ArkUI.Full 1027 * @crossplatform 1028 * @atomicservice 1029 * @since 11 1030 */ 1031 canLoop?: boolean; 1032 1033 /** 1034 * Text style of disappearing items 1035 * 1036 * @type { ?PickerTextStyle } 1037 * @syscap SystemCapability.ArkUI.ArkUI.Full 1038 * @crossplatform 1039 * @since 10 1040 */ 1041 /** 1042 * Text style of disappearing items 1043 * 1044 * @type { ?PickerTextStyle } 1045 * @syscap SystemCapability.ArkUI.ArkUI.Full 1046 * @crossplatform 1047 * @atomicservice 1048 * @since 11 1049 */ 1050 disappearTextStyle?: PickerTextStyle; 1051 1052 /** 1053 * Text style of normal items 1054 * 1055 * @type { ?PickerTextStyle } 1056 * @syscap SystemCapability.ArkUI.ArkUI.Full 1057 * @crossplatform 1058 * @since 10 1059 */ 1060 /** 1061 * Text style of normal items 1062 * 1063 * @type { ?PickerTextStyle } 1064 * @syscap SystemCapability.ArkUI.ArkUI.Full 1065 * @crossplatform 1066 * @atomicservice 1067 * @since 11 1068 */ 1069 textStyle?: PickerTextStyle; 1070 1071 /** 1072 * Style of accept button. 1073 * 1074 * @type { ?PickerDialogButtonStyle } 1075 * @syscap SystemCapability.ArkUI.ArkUI.Full 1076 * @crossplatform 1077 * @atomicservice 1078 * @since 12 1079 */ 1080 acceptButtonStyle?: PickerDialogButtonStyle; 1081 1082 /** 1083 * Style of cancel button. 1084 * 1085 * @type { ?PickerDialogButtonStyle } 1086 * @syscap SystemCapability.ArkUI.ArkUI.Full 1087 * @crossplatform 1088 * @atomicservice 1089 * @since 12 1090 */ 1091 cancelButtonStyle?: PickerDialogButtonStyle; 1092 1093 /** 1094 * Text style of selected items 1095 * 1096 * @type { ?PickerTextStyle } 1097 * @syscap SystemCapability.ArkUI.ArkUI.Full 1098 * @crossplatform 1099 * @since 10 1100 */ 1101 /** 1102 * Text style of selected items 1103 * 1104 * @type { ?PickerTextStyle } 1105 * @syscap SystemCapability.ArkUI.ArkUI.Full 1106 * @crossplatform 1107 * @atomicservice 1108 * @since 11 1109 */ 1110 selectedTextStyle?: PickerTextStyle; 1111 1112 /** 1113 * Defines whether to disable the text style animation. 1114 * 1115 * @type { ?boolean } 1116 * @syscap SystemCapability.ArkUI.ArkUI.Full 1117 * @crossplatform 1118 * @atomicservice 1119 * @since 15 1120 */ 1121 disableTextStyleAnimation?: boolean; 1122 1123 /** 1124 * Defines to set the default text style for options. 1125 * 1126 * @type { ?TextPickerTextStyle } 1127 * @syscap SystemCapability.ArkUI.ArkUI.Full 1128 * @crossplatform 1129 * @atomicservice 1130 * @since 15 1131 */ 1132 defaultTextStyle?: TextPickerTextStyle; 1133 1134 /** 1135 * Called when the OK button in the dialog is clicked. 1136 * 1137 * @type { ?function } 1138 * @syscap SystemCapability.ArkUI.ArkUI.Full 1139 * @since 8 1140 */ 1141 /** 1142 * Called when the OK button in the dialog is clicked. 1143 * 1144 * @type { ?function } 1145 * @syscap SystemCapability.ArkUI.ArkUI.Full 1146 * @crossplatform 1147 * @since 10 1148 */ 1149 /** 1150 * Called when the OK button in the dialog is clicked. 1151 * 1152 * @type { ?function } 1153 * @syscap SystemCapability.ArkUI.ArkUI.Full 1154 * @crossplatform 1155 * @atomicservice 1156 * @since 11 1157 */ 1158 onAccept?: (value: TextPickerResult) => void; 1159 1160 /** 1161 * Called when the Cancel button in the dialog is clicked. 1162 * 1163 * @type { ?function } 1164 * @syscap SystemCapability.ArkUI.ArkUI.Full 1165 * @since 8 1166 */ 1167 /** 1168 * Called when the Cancel button in the dialog is clicked. 1169 * 1170 * @type { ?function } 1171 * @syscap SystemCapability.ArkUI.ArkUI.Full 1172 * @crossplatform 1173 * @since 10 1174 */ 1175 /** 1176 * Called when the Cancel button in the dialog is clicked. 1177 * 1178 * @type { ?function } 1179 * @syscap SystemCapability.ArkUI.ArkUI.Full 1180 * @crossplatform 1181 * @atomicservice 1182 * @since 11 1183 */ 1184 onCancel?: () => void; 1185 1186 /** 1187 * This event is triggered when a TextPicker text is selected in dialog. 1188 * 1189 * @type { ?function } 1190 * @syscap SystemCapability.ArkUI.ArkUI.Full 1191 * @since 8 1192 */ 1193 /** 1194 * This event is triggered when a TextPicker text is selected in dialog. 1195 * 1196 * @type { ?function } 1197 * @syscap SystemCapability.ArkUI.ArkUI.Full 1198 * @crossplatform 1199 * @since 10 1200 */ 1201 /** 1202 * This event is triggered when a TextPicker text is selected in dialog. 1203 * 1204 * @type { ?function } 1205 * @syscap SystemCapability.ArkUI.ArkUI.Full 1206 * @crossplatform 1207 * @atomicservice 1208 * @since 11 1209 */ 1210 onChange?: (value: TextPickerResult) => void; 1211 1212 /** 1213 * This event is triggered when a TextPicker text is selected and scrolling has stopped in dialog. 1214 * 1215 * @type { ?Callback<TextPickerResult> } 1216 * @syscap SystemCapability.ArkUI.ArkUI.Full 1217 * @crossplatform 1218 * @atomicservice 1219 * @since 14 1220 */ 1221 onScrollStop?: Callback<TextPickerResult>; 1222 1223 /** 1224 * This event is triggered when an item enters the selected area in dialog. 1225 * 1226 * @type { ?Callback<TextPickerResult> } 1227 * @syscap SystemCapability.ArkUI.ArkUI.Full 1228 * @crossplatform 1229 * @atomicservice 1230 * @since 18 1231 */ 1232 onEnterSelectedArea?: Callback<TextPickerResult>; 1233 1234 /** 1235 * Mask Region of dialog. The size cannot exceed the main window. 1236 * 1237 * @type { ?Rectangle } 1238 * @syscap SystemCapability.ArkUI.ArkUI.Full 1239 * @crossplatform 1240 * @since 10 1241 */ 1242 /** 1243 * Mask Region of dialog. The size cannot exceed the main window. 1244 * 1245 * @type { ?Rectangle } 1246 * @syscap SystemCapability.ArkUI.ArkUI.Full 1247 * @crossplatform 1248 * @atomicservice 1249 * @since 11 1250 */ 1251 maskRect?: Rectangle; 1252 1253 /** 1254 * Defines the dialog alignment of the screen. 1255 * 1256 * @type { ?DialogAlignment } 1257 * @syscap SystemCapability.ArkUI.ArkUI.Full 1258 * @crossplatform 1259 * @since 10 1260 */ 1261 /** 1262 * Defines the dialog alignment of the screen. 1263 * 1264 * @type { ?DialogAlignment } 1265 * @syscap SystemCapability.ArkUI.ArkUI.Full 1266 * @crossplatform 1267 * @atomicservice 1268 * @since 11 1269 */ 1270 alignment?: DialogAlignment; 1271 1272 /** 1273 * Defines the dialog offset. 1274 * 1275 * @type { ?Offset } 1276 * @syscap SystemCapability.ArkUI.ArkUI.Full 1277 * @crossplatform 1278 * @since 10 1279 */ 1280 /** 1281 * Defines the dialog offset. 1282 * 1283 * @type { ?Offset } 1284 * @syscap SystemCapability.ArkUI.ArkUI.Full 1285 * @crossplatform 1286 * @atomicservice 1287 * @since 11 1288 */ 1289 offset?: Offset; 1290 1291 /** 1292 * Defines the textPickerDialog's background color 1293 * 1294 * @type { ?ResourceColor } 1295 * @default Color.Transparent 1296 * @syscap SystemCapability.ArkUI.ArkUI.Full 1297 * @crossplatform 1298 * @since 11 1299 */ 1300 /** 1301 * Defines the textPickerDialog's background color 1302 * 1303 * @type { ?ResourceColor } 1304 * @default Color.Transparent 1305 * @syscap SystemCapability.ArkUI.ArkUI.Full 1306 * @crossplatform 1307 * @atomicservice 1308 * @since 12 1309 */ 1310 backgroundColor?: ResourceColor; 1311 1312 /** 1313 * Defines the textPickerDialog's background blur Style 1314 * 1315 * @type { ?BlurStyle } 1316 * @default BlurStyle.COMPONENT_ULTRA_THICK 1317 * @syscap SystemCapability.ArkUI.ArkUI.Full 1318 * @crossplatform 1319 * @since 11 1320 */ 1321 /** 1322 * Defines the textPickerDialog's background blur Style 1323 * 1324 * @type { ?BlurStyle } 1325 * @default BlurStyle.COMPONENT_ULTRA_THICK 1326 * @syscap SystemCapability.ArkUI.ArkUI.Full 1327 * @crossplatform 1328 * @atomicservice 1329 * @since 12 1330 */ 1331 backgroundBlurStyle?: BlurStyle; 1332 1333 /** 1334 * Callback function when the dialog appears. 1335 * 1336 * @type { ?function } 1337 * @syscap SystemCapability.ArkUI.ArkUI.Full 1338 * @crossplatform 1339 * @atomicservice 1340 * @since 12 1341 */ 1342 onDidAppear?: () => void; 1343 1344 /** 1345 * Callback function when the dialog disappears. 1346 * 1347 * @type { ?function } 1348 * @syscap SystemCapability.ArkUI.ArkUI.Full 1349 * @crossplatform 1350 * @atomicservice 1351 * @since 12 1352 */ 1353 onDidDisappear?: () => void; 1354 1355 /** 1356 * Callback function before the dialog openAnimation starts. 1357 * 1358 * @type { ?function } 1359 * @syscap SystemCapability.ArkUI.ArkUI.Full 1360 * @crossplatform 1361 * @atomicservice 1362 * @since 12 1363 */ 1364 onWillAppear?: () => void; 1365 1366 /** 1367 * Callback function before the dialog closeAnimation starts. 1368 * 1369 * @type { ?function } 1370 * @syscap SystemCapability.ArkUI.ArkUI.Full 1371 * @crossplatform 1372 * @atomicservice 1373 * @since 12 1374 */ 1375 onWillDisappear?: () => void; 1376 1377 /** 1378 * Defines the dialog's shadow. 1379 * 1380 * @type { ?(ShadowOptions | ShadowStyle) } 1381 * @syscap SystemCapability.ArkUI.ArkUI.Full 1382 * @crossplatform 1383 * @atomicservice 1384 * @since 12 1385 */ 1386 shadow?: ShadowOptions | ShadowStyle; 1387 1388 /** 1389 * Defines whether to respond to the hover mode. 1390 * 1391 * @type { ?boolean } 1392 * @default false 1393 * @syscap SystemCapability.ArkUI.ArkUI.Full 1394 * @crossplatform 1395 * @atomicservice 1396 * @since 14 1397 */ 1398 enableHoverMode?: boolean; 1399 1400 /** 1401 * Defines the dialog's display area in hover mode. 1402 * 1403 * @type { ?HoverModeAreaType } 1404 * @default HoverModeAreaType.BOTTOM_SCREEN 1405 * @syscap SystemCapability.ArkUI.ArkUI.Full 1406 * @crossplatform 1407 * @atomicservice 1408 * @since 14 1409 */ 1410 hoverModeArea?: HoverModeAreaType; 1411 1412 /** 1413 * Enable or disable haptic feedback. 1414 * 1415 * @type { ?boolean } 1416 * @default true 1417 * @syscap SystemCapability.ArkUI.ArkUI.Full 1418 * @atomicservice 1419 * @since 18 1420 */ 1421 enableHapticFeedback?: boolean; 1422} 1423 1424/** 1425 * Defines TextPickerDialog which uses show method to show TextPicker dialog. 1426 * 1427 * @syscap SystemCapability.ArkUI.ArkUI.Full 1428 * @since 8 1429 */ 1430/** 1431 * Defines TextPickerDialog which uses show method to show TextPicker dialog. 1432 * 1433 * @syscap SystemCapability.ArkUI.ArkUI.Full 1434 * @crossplatform 1435 * @since 10 1436 */ 1437/** 1438 * Defines TextPickerDialog which uses show method to show TextPicker dialog. 1439 * 1440 * @syscap SystemCapability.ArkUI.ArkUI.Full 1441 * @crossplatform 1442 * @atomicservice 1443 * @since 11 1444 */ 1445declare class TextPickerDialog { 1446 /** 1447 * Invoking method display. 1448 * 1449 * @param { TextPickerDialogOptions } options 1450 * @syscap SystemCapability.ArkUI.ArkUI.Full 1451 * @since 8 1452 */ 1453 /** 1454 * Invoking method display. 1455 * 1456 * @param { TextPickerDialogOptions } options 1457 * @syscap SystemCapability.ArkUI.ArkUI.Full 1458 * @crossplatform 1459 * @since 10 1460 */ 1461 /** 1462 * Invoking method display. 1463 * 1464 * @param { TextPickerDialogOptions } options 1465 * @syscap SystemCapability.ArkUI.ArkUI.Full 1466 * @crossplatform 1467 * @atomicservice 1468 * @since 11 1469 * @deprecated since 18 1470 * @useinstead ohos.arkui.UIContext.UIContext#showTextPickerDialog 1471 */ 1472 static show(options?: TextPickerDialogOptions); 1473} 1474 1475/** 1476 * Defines TextPicker Component. 1477 * 1478 * @syscap SystemCapability.ArkUI.ArkUI.Full 1479 * @since 8 1480 */ 1481/** 1482 * Defines TextPicker Component. 1483 * 1484 * @syscap SystemCapability.ArkUI.ArkUI.Full 1485 * @crossplatform 1486 * @since 10 1487 */ 1488/** 1489 * Defines TextPicker Component. 1490 * 1491 * @syscap SystemCapability.ArkUI.ArkUI.Full 1492 * @crossplatform 1493 * @atomicservice 1494 * @since 11 1495 */ 1496declare const TextPicker: TextPickerInterface; 1497 1498/** 1499 * Defines TextPicker Component instance. 1500 * 1501 * @syscap SystemCapability.ArkUI.ArkUI.Full 1502 * @since 8 1503 */ 1504/** 1505 * Defines TextPicker Component instance. 1506 * 1507 * @syscap SystemCapability.ArkUI.ArkUI.Full 1508 * @crossplatform 1509 * @since 10 1510 */ 1511/** 1512 * Defines TextPicker Component instance. 1513 * 1514 * @syscap SystemCapability.ArkUI.ArkUI.Full 1515 * @crossplatform 1516 * @atomicservice 1517 * @since 11 1518 */ 1519declare const TextPickerInstance: TextPickerAttribute; 1520 1521