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