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