1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21/*** if arkts 1.2 */ 22import { CommonMethod, ShadowOptions,Optional,Callback} from "./common"; 23import { CustomBuilder } from './builder' 24import { EllipsisMode, TextCase, LineBreakStrategy, TextAlign, FontStyle, FontWeight, WordBreak, TextOverflow, CopyOptions, TextHeightAdaptivePolicy, TextSelectableMode} from './enums'; 25import { Resource, ResourceColor, Font, Length, LengthMetrics } from './units'; 26import { TextDataDetectorConfig, LayoutManager, FontSettingOptions, EditMenuOptions } from "./textCommon"; 27import { DecorationStyleInterface, StyledString } from "./styledString"; 28import { SelectionMenuOptions } from './richEditor' 29/*** endif */ 30 31/** 32 * Text overflow options. 33 * 34 * Anonymous Object Rectification. 35 * @interface TextOverflowOptions 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @crossplatform 38 * @form 39 * @atomicservice 40 * @since arkts {'1.1':'18', '1.2':'20'} 41 * @arkts 1.1&1.2 42 */ 43declare interface TextOverflowOptions { 44 /** 45 * Text overflow option. 46 * 47 * @type { TextOverflow } 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @since 7 50 */ 51 /** 52 * Text overflow option. 53 * 54 * @type { TextOverflow } 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @form 57 * @since 9 58 */ 59 /** 60 * Text overflow option. 61 * 62 * @type { TextOverflow } 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @crossplatform 65 * @form 66 * @since 10 67 */ 68 /** 69 * Text overflow option. 70 * 71 * @type { TextOverflow } 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @crossplatform 74 * @form 75 * @atomicservice 76 * @since 11 77 */ 78 /** 79 * Text overflow option. 80 * 81 * Anonymous Object Rectification. 82 * @type { TextOverflow } 83 * @default TextOverflow.Clip 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @crossplatform 86 * @form 87 * @atomicservice 88 * @since arkts {'1.1':'18', '1.2':'20'} 89 * @arkts 1.1&1.2 90 */ 91 overflow: TextOverflow; 92} 93 94/** 95 * Provides an interface for writing texts. 96 * 97 * @interface TextInterface 98 * @syscap SystemCapability.ArkUI.ArkUI.Full 99 * @since 7 100 */ 101/** 102 * Provides an interface for writing texts. 103 * 104 * @interface TextInterface 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @form 107 * @since 9 108 */ 109/** 110 * Provides an interface for writing texts. 111 * 112 * @interface TextInterface 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @crossplatform 115 * @form 116 * @since 10 117 */ 118/** 119 * Provides an interface for writing texts. 120 * 121 * @interface TextInterface 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @crossplatform 124 * @form 125 * @atomicservice 126 * @since arkts {'1.1':'11', '1.2':'20'} 127 * @arkts 1.1&1.2 128 */ 129interface TextInterface { 130 /** 131 * Called when writing text. 132 * 133 * @param { string | Resource } content 134 * @returns { TextAttribute } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @since 7 137 */ 138 /** 139 * Called when writing text. 140 * 141 * @param { string | Resource } content 142 * @returns { TextAttribute } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @form 145 * @since 9 146 */ 147 /** 148 * Called when writing text. 149 * 150 * @param { string | Resource } content 151 * @returns { TextAttribute } 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @crossplatform 154 * @form 155 * @since 10 156 */ 157 /** 158 * Called when writing text. 159 * 160 * @param { string | Resource } content 161 * This parameter does not take effect if the component contains a Span child component and does not have any styled string configured. 162 * In this case, the span content is displayed, and the style of the component does not take effect. 163 * Default value: ' ' 164 * @param { TextOptions } value 165 * @returns { TextAttribute } 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @crossplatform 168 * @form 169 * @atomicservice 170 * @since arkts {'1.1':'11', '1.2':'20'} 171 * @arkts 1.1&1.2 172 */ 173 (content?: string | Resource, value?: TextOptions): TextAttribute; 174 } 175 176/** 177 * @extends CommonMethod<TextAttribute> 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @since 7 180 */ 181/** 182 * @extends CommonMethod<TextAttribute> 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @form 185 * @since 9 186 */ 187/** 188 * @extends CommonMethod<TextAttribute> 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @form 192 * @since 10 193 */ 194/** 195 * @extends CommonMethod<TextAttribute> 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @crossplatform 198 * @form 199 * @atomicservice 200 * @since arkts {'1.1':'11', '1.2':'20'} 201 * @arkts 1.1&1.2 202 */ 203declare class TextAttribute extends CommonMethod<TextAttribute> { 204 /** 205 * Called when the font is set. 206 * 207 * @param { Font } value - the text font size and weight and family and style. 208 * @returns { TextAttribute } The attribute of the text. 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @since 10 211 */ 212 /** 213 * Called when the font is set. 214 * Sets the text style, covering the font size, font width, font family, and font style. 215 * 216 * @param { Font } value - the text font size and weight and family and style. 217 * @returns { TextAttribute } The attribute of the text. 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @crossplatform 220 * @atomicservice 221 * @since 11 222 */ 223 font(value: Font): TextAttribute; 224 225 /** 226 * Called when the font is set. 227 * 228 * <p><strong>NOTE</strong>: 229 * <br>It is only effective for the Text component, not for its child components. 230 * </p> 231 * 232 * @param { Font } fontValue - the text font size and weight and family and style. 233 * @param { FontSettingOptions } options - font setting options. 234 * @returns { TextAttribute } The attribute of the text. 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @crossplatform 237 * @form 238 * @atomicservice 239 * @since arkts {'1.1':'12', '1.2':'20'} 240 * @arkts 1.1&1.2 241 */ 242 font(fontValue: Font, options?: FontSettingOptions): TextAttribute; 243 244 /** 245 * Called when the font color is set. 246 * 247 * @param { ResourceColor } value 248 * @returns { TextAttribute } 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @since 7 251 */ 252 /** 253 * Called when the font color is set. 254 * 255 * @param { ResourceColor } value 256 * @returns { TextAttribute } 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @form 259 * @since 9 260 */ 261 /** 262 * Called when the font color is set. 263 * 264 * @param { ResourceColor } value 265 * @returns { TextAttribute } 266 * @syscap SystemCapability.ArkUI.ArkUI.Full 267 * @crossplatform 268 * @form 269 * @since 10 270 */ 271 /** 272 * Called when the font color is set. 273 * 274 * @param { ResourceColor } value - Default value is '#e6182431'.The default value on wearable devices is '#c5ffffff'. 275 * @returns { TextAttribute } 276 * @syscap SystemCapability.ArkUI.ArkUI.Full 277 * @crossplatform 278 * @form 279 * @atomicservice 280 * @since arkts {'1.1':'11', '1.2':'20'} 281 * @arkts 1.1&1.2 282 */ 283 fontColor(value: ResourceColor): TextAttribute; 284 285 /** 286 * Called when the font size is set. 287 * 288 * @param { number | string | Resource } value 289 * @returns { TextAttribute } 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @since 7 292 */ 293 /** 294 * Called when the font size is set. 295 * 296 * @param { number | string | Resource } value 297 * @returns { TextAttribute } 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @form 300 * @since 9 301 */ 302 /** 303 * Called when the font size is set. 304 * 305 * @param { number | string | Resource } value 306 * @returns { TextAttribute } 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @form 310 * @since 10 311 */ 312 /** 313 * Called when the font size is set. 314 * 315 * <p><strong>NOTE</strong>: 316 * <br>If fontSize is of the number type, the unit fp is used. 317 * </p> 318 * 319 * @param { number | string | Resource } value - Default value is 16fp.The default value on wearable devices is 15fp. 320 * @returns { TextAttribute } 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @crossplatform 323 * @form 324 * @atomicservice 325 * @since arkts {'1.1':'11', '1.2':'20'} 326 * @arkts 1.1&1.2 327 */ 328 fontSize(value: number | string | Resource): TextAttribute; 329 330 /** 331 * Called when the minimum font size of the font is set. 332 * 333 * @param { number | string | Resource } value 334 * @returns { TextAttribute } 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @since 7 337 */ 338 /** 339 * Called when the minimum font size of the font is set. 340 * 341 * @param { number | string | Resource } value 342 * @returns { TextAttribute } 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @form 345 * @since 9 346 */ 347 /** 348 * Called when the minimum font size of the font is set. 349 * 350 * @param { number | string | Resource } value 351 * @returns { TextAttribute } 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @crossplatform 354 * @form 355 * @since 10 356 */ 357 /** 358 * Called when the minimum font size of the font is set. 359 * 360 * <p><strong>NOTE</strong>: 361 * <br>For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. 362 * <br>For the setting to take effect, this attribute must be used together with maxFontSize and maxLines, 363 * or layout constraint settings. 364 * <br>When the adaptive font size is used, the fontSize settings do not take effect. 365 * <br>If the value of minFontSize is less than or equal to 0, font size adaptation does not take effect. 366 * <br>In this case, the actual font size is determined by the value of fontSize. 367 * <br>If fontSize is not specified, the default value is used. 368 * <br>Since API version 18, this attribute takes effect on child components and styled strings, 369 * and the adaptive font size is applied to parts where the font size is not set. 370 * </p> 371 * 372 * @param { number | string | Resource } value - The unit is fp. 373 * @returns { TextAttribute } 374 * @syscap SystemCapability.ArkUI.ArkUI.Full 375 * @crossplatform 376 * @form 377 * @atomicservice 378 * @since arkts {'1.1':'11', '1.2':'20'} 379 * @arkts 1.1&1.2 380 */ 381 minFontSize(value: number | string | Resource): TextAttribute; 382 383 /** 384 * Called when the maximum font size of the font is set. 385 * 386 * @param { number | string | Resource } value 387 * @returns { TextAttribute } 388 * @syscap SystemCapability.ArkUI.ArkUI.Full 389 * @since 7 390 */ 391 /** 392 * Called when the maximum font size of the font is set. 393 * 394 * @param { number | string | Resource } value 395 * @returns { TextAttribute } 396 * @syscap SystemCapability.ArkUI.ArkUI.Full 397 * @form 398 * @since 9 399 */ 400 /** 401 * Called when the maximum font size of the font is set. 402 * 403 * @param { number | string | Resource } value 404 * @returns { TextAttribute } 405 * @syscap SystemCapability.ArkUI.ArkUI.Full 406 * @crossplatform 407 * @form 408 * @since 10 409 */ 410 /** 411 * Called when the maximum font size of the font is set. 412 * 413 * <p><strong>NOTE</strong>: 414 * <br>For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. 415 * <br>For the setting to take effect, this attribute must be used together with minFontSize and maxLines, 416 * or layout constraint settings. 417 * <br>When the adaptive font size is used, the fontSize settings do not take effect. 418 * <br>If the value of maxFontSize is less than or equal to 0, font size adaptation does not take effect. 419 * <br>In this case, the actual font size is determined by the value of fontSize. 420 * <br>If fontSize is not specified, the default value is used. 421 * <br>Since API version 18, this attribute takes effect on child components and styled strings, 422 * and the adaptive font size is applied to parts where the font size is not set. 423 * </p> 424 * 425 * @param { number | string | Resource } value - The unit is fp. 426 * @returns { TextAttribute } 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @form 430 * @atomicservice 431 * @since arkts {'1.1':'11', '1.2':'20'} 432 * @arkts 1.1&1.2 433 */ 434 maxFontSize(value: number | string | Resource): TextAttribute; 435 436 /** 437 * Called when the minimum font scale of the font is set. 438 * Value range: [0, 1] 439 * 440 * <p><strong>NOTE</strong>: 441 * <br>A value less than 0 is handled as 0. 442 * <br>A value greater than 1 is handled as 1. 443 * <br>Abnormal values are ineffective by default. 444 * </p> 445 * 446 * @param { number | Resource } scale 447 * @returns { TextAttribute } 448 * @syscap SystemCapability.ArkUI.ArkUI.Full 449 * @atomicservice 450 * @since 12 451 */ 452 /** 453 * Called when the minimum font scale of the font is set. 454 * Value range: [0, 1] 455 * 456 * <p><strong>NOTE</strong>: 457 * <br>A value less than 0 is handled as 0. 458 * <br>A value greater than 1 is handled as 1. 459 * <br>Abnormal values are ineffective by default. 460 * </p> 461 * 462 * @param { number | Resource } scale 463 * @returns { TextAttribute } 464 * @syscap SystemCapability.ArkUI.ArkUI.Full 465 * @crossplatform 466 * @atomicservice 467 * @since 20 468 * @arkts 1.1&1.2 469 */ 470 minFontScale(scale: number | Resource): TextAttribute; 471 472 /** 473 * Called when the maximum font scale of the font is set. 474 * Value range: [1, +∞) 475 * 476 * <p><strong>NOTE</strong>: 477 * <br>A value less than 1 is handled as 1. 478 * <br>Abnormal values are ineffective by default. 479 * </p> 480 * 481 * @param { number | Resource } scale 482 * @returns { TextAttribute } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @atomicservice 485 * @since 12 486 */ 487 /** 488 * Called when the maximum font scale of the font is set. 489 * Value range: [1, +∞) 490 * 491 * <p><strong>NOTE</strong>: 492 * <br>A value less than 1 is handled as 1. 493 * <br>Abnormal values are ineffective by default. 494 * </p> 495 * 496 * @param { number | Resource } scale 497 * @returns { TextAttribute } 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @crossplatform 500 * @atomicservice 501 * @since 20 502 * @arkts 1.1&1.2 503 */ 504 maxFontScale(scale: number | Resource): TextAttribute; 505 506 /** 507 * Called when the font style of a font is set. 508 * 509 * @param { FontStyle } value 510 * @returns { TextAttribute } 511 * @syscap SystemCapability.ArkUI.ArkUI.Full 512 * @since 7 513 */ 514 /** 515 * Called when the font style of a font is set. 516 * 517 * @param { FontStyle } value 518 * @returns { TextAttribute } 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @form 521 * @since 9 522 */ 523 /** 524 * Called when the font style of a font is set. 525 * 526 * @param { FontStyle } value 527 * @returns { TextAttribute } 528 * @syscap SystemCapability.ArkUI.ArkUI.Full 529 * @crossplatform 530 * @form 531 * @since 10 532 */ 533 /** 534 * Called when the font style of a font is set. 535 * 536 * @param { FontStyle } value - Default value is FontStyle.Normal. 537 * @returns { TextAttribute } 538 * @syscap SystemCapability.ArkUI.ArkUI.Full 539 * @crossplatform 540 * @form 541 * @atomicservice 542 * @since arkts {'1.1':'11', '1.2':'20'} 543 * @arkts 1.1&1.2 544 */ 545 fontStyle(value: FontStyle): TextAttribute; 546 547 /** 548 * Called when the font weight is set. 549 * 550 * @param { number | FontWeight | string } value 551 * @returns { TextAttribute } 552 * @syscap SystemCapability.ArkUI.ArkUI.Full 553 * @since 7 554 */ 555 /** 556 * Called when the font weight is set. 557 * 558 * @param { number | FontWeight | string } value 559 * @returns { TextAttribute } 560 * @syscap SystemCapability.ArkUI.ArkUI.Full 561 * @form 562 * @since 9 563 */ 564 /** 565 * Called when the font weight is set. 566 * 567 * @param { number | FontWeight | string } value 568 * @returns { TextAttribute } 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @form 572 * @since 10 573 */ 574 /** 575 * Called when the font weight is set. 576 * 577 * <p><strong>NOTE</strong>: 578 * <br>If the value is too large, the text may be clipped depending on the font. 579 * <br>For the number type, the value range is [100, 900], at an interval of 100. 580 * <br>The default value is 400. 581 * <br>A larger value indicates a heavier font weight. 582 * <br>For the string type, only strings that represent a number, for example, "400", 583 * and the following enumerated values of FontWeight are supported: "bold", "bolder", "lighter", "regular", and "medium". 584 * </p> 585 * 586 * @param { number | FontWeight | string } value - Default value is FontWeight.Normal.The default value on wearable devices is FontWeight.Regular. 587 * @returns { TextAttribute } 588 * @syscap SystemCapability.ArkUI.ArkUI.Full 589 * @crossplatform 590 * @form 591 * @atomicservice 592 * @since 11 593 */ 594 /** 595 * Called when the font weight is set. 596 * 597 * @param { number | FontWeight | ResourceStr } value 598 * @returns { TextAttribute } 599 * @syscap SystemCapability.ArkUI.ArkUI.Full 600 * @crossplatform 601 * @form 602 * @atomicservice 603 * @since 20 604 */ 605 fontWeight(value: number | FontWeight | ResourceStr): TextAttribute; 606 607 /** 608 * Called when the font weight is set. 609 * 610 * @param { number | FontWeight | string } weight 611 * @param { FontSettingOptions } options - font setting options. 612 * @returns { TextAttribute } 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @form 616 * @atomicservice 617 * @arkts 1.2 618 * @since 20 619 */ 620 fontWeight(weight: number | FontWeight | string, options?: FontSettingOptions): TextAttribute; 621 622 /** 623 * Called when the font weight is set. 624 * 625 * <p><strong>NOTE</strong>: 626 * <br>It is only effective for the Text component, not for its child components. 627 * <br>For the number type, the value ranges from 100 to 900, at an interval of 100. 628 * <br>A larger value indicates a heavier font weight. 629 * <br>The default value is 400. 630 * <br>For the string type, only strings that represent a number, for example, "400", 631 * and the following enumerated values of FontWeight are supported: "bold", "bolder", "lighter", "regular", and "medium". 632 * </p> 633 * 634 * @param { number | FontWeight | string } weight 635 * @param { FontSettingOptions } options - font setting options. 636 * @returns { TextAttribute } 637 * @syscap SystemCapability.ArkUI.ArkUI.Full 638 * @crossplatform 639 * @form 640 * @atomicservice 641 * @since 12 642 */ 643 /** 644 * Called when the font weight is set. 645 * 646 * @param { number | FontWeight | ResourceStr } weight 647 * @param { FontSettingOptions } options - font setting options. 648 * @returns { TextAttribute } 649 * @syscap SystemCapability.ArkUI.ArkUI.Full 650 * @crossplatform 651 * @form 652 * @atomicservice 653 * @since 20 654 */ 655 fontWeight(weight: number | FontWeight | ResourceStr, options?: FontSettingOptions): TextAttribute; 656 657 /** 658 * Set font line spacing. 659 * 660 * <p><strong>NOTE</strong>: 661 * <br>If the value specified is less than or equal to 0, the default value 0 is used. 662 * </p> 663 * 664 * @param { LengthMetrics } value - Default value is 0. 665 * @returns { TextAttribute } 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @atomicservice 669 * @since arkts {'1.1':'12', '1.2':'20'} 670 * @arkts 1.1&1.2 671 */ 672 lineSpacing(value: LengthMetrics): TextAttribute; 673 674 /** 675 * Set font line spacing with options. 676 * 677 * @param { LengthMetrics } value 678 * @param { LineSpacingOptions } options 679 * @returns { TextAttribute } 680 * @syscap SystemCapability.ArkUI.ArkUI.Full 681 * @crossplatform 682 * @atomicservice 683 * @since 20 684 */ 685 lineSpacing(value: LengthMetrics, options?: LineSpacingOptions): TextAttribute; 686 687 /** 688 * Called when the horizontal center mode of the font is set. 689 * 690 * @param { TextAlign } value 691 * @returns { TextAttribute } 692 * @syscap SystemCapability.ArkUI.ArkUI.Full 693 * @since 7 694 */ 695 /** 696 * Called when the horizontal center mode of the font is set. 697 * 698 * @param { TextAlign } value 699 * @returns { TextAttribute } 700 * @syscap SystemCapability.ArkUI.ArkUI.Full 701 * @form 702 * @since 9 703 */ 704 /** 705 * Called when the horizontal center mode of the font is set. 706 * 707 * @param { TextAlign } value 708 * @returns { TextAttribute } 709 * @syscap SystemCapability.ArkUI.ArkUI.Full 710 * @crossplatform 711 * @form 712 * @since 10 713 */ 714 /** 715 * Called when the horizontal center mode of the font is set. 716 * 717 * <p><strong>NOTE</strong>: 718 * <br>The text takes up the full width of the Text component. 719 * <br>To set vertical alignment for the text, use the align attribute. 720 * <br>The align attribute alone does not control the horizontal position of the text. 721 * <br>In other words, Alignment.TopStart, Alignment.Top, and Alignment.TopEnd produce the same effect, 722 * top-aligning the text; Alignment.Start, Alignment.Center, and Alignment.End produce the same effect, 723 * centered-aligning the text vertically; Alignment.BottomStart, Alignment.Bottom, 724 * and Alignment.BottomEnd produce the same effect, bottom-aligning the text. 725 * <br>When textAlign is set to TextAlign.JUSTIFY, you must set the wordBreak attribute, 726 * and the text in the last line is horizontally aligned with the start edge. 727 * </p> 728 * 729 * @param { TextAlign } value - Default value is TextAlign.Start.The default value on wearable devices is TextAlign.Center. 730 * @returns { TextAttribute } 731 * @syscap SystemCapability.ArkUI.ArkUI.Full 732 * @crossplatform 733 * @form 734 * @atomicservice 735 * @since arkts {'1.1':'11', '1.2':'20'} 736 * @arkts 1.1&1.2 737 */ 738 textAlign(value: TextAlign): TextAttribute; 739 740 /** 741 * Set the vertical align of the text. 742 * 743 * @param { Optional<TextVerticalAlign> } textVerticalAlign - The default value is BASELINE. 744 * @returns { TextAttribute } returns the instance of the TextAttribute. 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 20 749 */ 750 textVerticalAlign(textVerticalAlign: Optional<TextVerticalAlign>): TextAttribute; 751 752 /** 753 * Called when the vertical center mode of the font is set. 754 * 755 * @param { number | string | Resource } value 756 * @returns { TextAttribute } 757 * @syscap SystemCapability.ArkUI.ArkUI.Full 758 * @since 7 759 */ 760 /** 761 * Called when the vertical center mode of the font is set. 762 * 763 * @param { number | string | Resource } value 764 * @returns { TextAttribute } 765 * @syscap SystemCapability.ArkUI.ArkUI.Full 766 * @form 767 * @since 9 768 */ 769 /** 770 * Called when the vertical center mode of the font is set. 771 * 772 * @param { number | string | Resource } value 773 * @returns { TextAttribute } 774 * @syscap SystemCapability.ArkUI.ArkUI.Full 775 * @crossplatform 776 * @form 777 * @since 10 778 */ 779 /** 780 * Called when the vertical center mode of the font is set. 781 * 782 * <p><strong>NOTE</strong>: 783 * <br>If the value is less than or equal to 0, the line height is not limited and the font size is adaptive. 784 * <br>If the value is of the number type, the unit fp is used. 785 * <br>For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. 786 * </p> 787 * 788 * @param { number | string | Resource } value 789 * @returns { TextAttribute } 790 * @syscap SystemCapability.ArkUI.ArkUI.Full 791 * @crossplatform 792 * @form 793 * @atomicservice 794 * @since arkts {'1.1':'11', '1.2':'20'} 795 * @arkts 1.1&1.2 796 */ 797 lineHeight(value: number | string | Resource): TextAttribute; 798 799 /** 800 * Called when the overflow mode of the font is set. 801 * 802 * @param { object } value 803 * @returns { TextAttribute } 804 * @syscap SystemCapability.ArkUI.ArkUI.Full 805 * @since 7 806 */ 807 /** 808 * Called when the overflow mode of the font is set. 809 * 810 * @param { object } value 811 * @returns { TextAttribute } 812 * @syscap SystemCapability.ArkUI.ArkUI.Full 813 * @form 814 * @since 9 815 */ 816 /** 817 * Called when the overflow mode of the font is set. 818 * 819 * @param { object } value 820 * @returns { TextAttribute } 821 * @syscap SystemCapability.ArkUI.ArkUI.Full 822 * @crossplatform 823 * @form 824 * @since 10 825 */ 826 /** 827 * Called when the overflow mode of the font is set. 828 * 829 * @param { object } value 830 * @returns { TextAttribute } 831 * @syscap SystemCapability.ArkUI.ArkUI.Full 832 * @crossplatform 833 * @form 834 * @atomicservice 835 * @since 11 836 */ 837 /** 838 * Called when the overflow mode of the font is set. 839 * 840 * Anonymous Object Rectification. 841 * 842 * <p><strong>NOTE</strong>: 843 * <br>Text is clipped at the transition between words. 844 * <br>To clip text in the middle of a word, add \u200B between characters. 845 * <br>Since API version 11, preferably set the wordBreak attribute to WordBreak.BREAK_ALL to achieve the same purpose. 846 * <br>If overflow is set to TextOverflow.None, TextOverflow.Clip, or TextOverflow.Ellipsis, 847 * this attribute must be used with maxLines for the settings to take effect. 848 * <br>TextOverflow.None produces the same effect as TextOverflow.Clip. 849 * <br>If overflow is set to TextOverflow.MARQUEE, the text scrolls in a line, and neither maxLines nor copyOption takes effect. 850 * <br>The textAlign attribute takes effect only when the text is not scrollable. 851 * <br>With overflow set to TextOverflow.MARQUEE, the clip attribute is set to true by default. 852 * <br>TextOverflow.MARQUEE is not available for CustomSpan of the styled string. 853 * <br>Since API version 12, TextOverflow.MARQUEE is available for the ImageSpan component, 854 * where the text and images are displayed in scrolling mode in a line. 855 * </p> 856 * 857 * @param { TextOverflowOptions } options - Text overflow options. 858 * @returns { TextAttribute } 859 * @syscap SystemCapability.ArkUI.ArkUI.Full 860 * @crossplatform 861 * @form 862 * @atomicservice 863 * @since arkts {'1.1':'18', '1.2':'20'} 864 * @arkts 1.1&1.2 865 */ 866 textOverflow(options: TextOverflowOptions): TextAttribute; 867 868 /** 869 * Called when the font list of text is set. 870 * 871 * @param { string | Resource } value 872 * @returns { TextAttribute } 873 * @syscap SystemCapability.ArkUI.ArkUI.Full 874 * @since 7 875 */ 876 /** 877 * Called when the font list of text is set. 878 * 879 * @param { string | Resource } value 880 * @returns { TextAttribute } 881 * @syscap SystemCapability.ArkUI.ArkUI.Full 882 * @form 883 * @since 9 884 */ 885 /** 886 * Called when the font list of text is set. 887 * 888 * @param { string | Resource } value 889 * @returns { TextAttribute } 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @crossplatform 892 * @form 893 * @since 10 894 */ 895 /** 896 * Called when the font list of text is set. 897 * 898 * <p><strong>NOTE</strong>: 899 * <br>Default font: 'HarmonyOS Sans' 900 * <br>The 'HarmonyOS Sans' font and registered custom fonts are supported for applications. 901 * <br>Only the 'HarmonyOS Sans' font is supported for widgets. 902 * </p> 903 * 904 * @param { string | Resource } value 905 * @returns { TextAttribute } 906 * @syscap SystemCapability.ArkUI.ArkUI.Full 907 * @crossplatform 908 * @form 909 * @atomicservice 910 * @since arkts {'1.1':'11', '1.2':'20'} 911 * @arkts 1.1&1.2 912 */ 913 fontFamily(value: string | Resource): TextAttribute; 914 915 /** 916 * Called when the maximum number of lines of text is set. 917 * 918 * @param { number } value 919 * @returns { TextAttribute } 920 * @syscap SystemCapability.ArkUI.ArkUI.Full 921 * @since 7 922 */ 923 /** 924 * Called when the maximum number of lines of text is set. 925 * 926 * @param { number } value 927 * @returns { TextAttribute } 928 * @syscap SystemCapability.ArkUI.ArkUI.Full 929 * @form 930 * @since 9 931 */ 932 /** 933 * Called when the maximum number of lines of text is set. 934 * 935 * @param { number } value 936 * @returns { TextAttribute } 937 * @syscap SystemCapability.ArkUI.ArkUI.Full 938 * @crossplatform 939 * @form 940 * @since 10 941 */ 942 /** 943 * Called when the maximum number of lines of text is set. 944 * 945 * <p><strong>NOTE</strong>: 946 * <br>By default, text is automatically folded. 947 * <br>If this attribute is specified, the text will not exceed the specified number of lines. 948 * <br>If there is extra text, you can use textOverflow to specify how it is displayed. 949 * </p> 950 * 951 * @param { number } value 952 * @returns { TextAttribute } 953 * @syscap SystemCapability.ArkUI.ArkUI.Full 954 * @crossplatform 955 * @form 956 * @atomicservice 957 * @since arkts {'1.1':'11', '1.2':'20'} 958 * @arkts 1.1&1.2 959 */ 960 maxLines(value: number): TextAttribute; 961 962 /** 963 * Called when the text decoration of the text is set. 964 * 965 * @param { object } value 966 * @returns { TextAttribute } 967 * @syscap SystemCapability.ArkUI.ArkUI.Full 968 * @since 7 969 */ 970 /** 971 * Called when the text decoration of the text is set. 972 * 973 * @param { object } value 974 * @returns { TextAttribute } 975 * @syscap SystemCapability.ArkUI.ArkUI.Full 976 * @form 977 * @since 9 978 */ 979 /** 980 * Called when the text decoration of the text is set. 981 * 982 * @param { object } value 983 * @returns { TextAttribute } 984 * @syscap SystemCapability.ArkUI.ArkUI.Full 985 * @crossplatform 986 * @form 987 * @since 10 988 */ 989 /** 990 * Called when the text decoration of the text is set. 991 * 992 * @param { object } value 993 * @returns { TextAttribute } 994 * @syscap SystemCapability.ArkUI.ArkUI.Full 995 * @crossplatform 996 * @form 997 * @atomicservice 998 * @since 11 999 */ 1000 /** 1001 * Called when the text decoration of the text is set. 1002 * 1003 * <p><strong>NOTE</strong>: 1004 * <br>The style parameter cannot be used in widgets. 1005 * </p> 1006 * 1007 * @param { DecorationStyleInterface } value - Default value is { type: TextDecorationType.None, color: Color.Black, style: TextDecorationStyle.SOLID }. 1008 * @returns { TextAttribute } 1009 * @syscap SystemCapability.ArkUI.ArkUI.Full 1010 * @crossplatform 1011 * @form 1012 * @atomicservice 1013 * @since arkts {'1.1':'12', '1.2':'20'} 1014 * @arkts 1.1&1.2 1015 */ 1016 decoration(value: DecorationStyleInterface): TextAttribute; 1017 1018 /** 1019 * Called when the distance between text fonts is set. 1020 * 1021 * @param { number | string } value 1022 * @returns { TextAttribute } 1023 * @syscap SystemCapability.ArkUI.ArkUI.Full 1024 * @since 7 1025 */ 1026 /** 1027 * Called when the distance between text fonts is set. 1028 * 1029 * @param { number | string } value 1030 * @returns { TextAttribute } 1031 * @syscap SystemCapability.ArkUI.ArkUI.Full 1032 * @form 1033 * @since 9 1034 */ 1035 /** 1036 * Called when the distance between text fonts is set. 1037 * 1038 * @param { number | string } value 1039 * @returns { TextAttribute } 1040 * @syscap SystemCapability.ArkUI.ArkUI.Full 1041 * @crossplatform 1042 * @form 1043 * @since 10 1044 */ 1045 /** 1046 * Called when the distance between text fonts is set. 1047 * 1048 * <p><strong>NOTE</strong>: 1049 * <br>If the value specified is a percentage or 0, the default value is used. 1050 * <br>For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. 1051 * <br>If the value specified is a negative value, the text is compressed. 1052 * <br>A negative value too small may result in the text being compressed to 0 and no content being displayed. 1053 * </p> 1054 * 1055 * @param { number | string } value - The unit is fp. 1056 * @returns { TextAttribute } 1057 * @syscap SystemCapability.ArkUI.ArkUI.Full 1058 * @crossplatform 1059 * @form 1060 * @atomicservice 1061 * @since 11 1062 */ 1063 /** 1064 * Called when the distance between text fonts is set. 1065 * 1066 * @param { number | ResourceStr } value 1067 * @returns { TextAttribute } 1068 * @syscap SystemCapability.ArkUI.ArkUI.Full 1069 * @crossplatform 1070 * @form 1071 * @atomicservice 1072 * @since 20 1073 */ 1074 letterSpacing(value: number | ResourceStr): TextAttribute; 1075 1076 /** 1077 * Called when the distance between text fonts is set. 1078 * 1079 * @param { number | string } value 1080 * @returns { TextAttribute } 1081 * @syscap SystemCapability.ArkUI.ArkUI.Full 1082 * @crossplatform 1083 * @form 1084 * @atomicservice 1085 * @since 20 1086 * @arkts 1.2 1087 */ 1088 letterSpacing(value: number | string): TextAttribute; 1089 1090 /** 1091 * Called when the type of letter in the text font is set. 1092 * 1093 * @param { TextCase } value 1094 * @returns { TextAttribute } 1095 * @syscap SystemCapability.ArkUI.ArkUI.Full 1096 * @since 7 1097 */ 1098 /** 1099 * Called when the type of letter in the text font is set. 1100 * 1101 * @param { TextCase } value 1102 * @returns { TextAttribute } 1103 * @syscap SystemCapability.ArkUI.ArkUI.Full 1104 * @form 1105 * @since 9 1106 */ 1107 /** 1108 * Called when the type of letter in the text font is set. 1109 * 1110 * @param { TextCase } value 1111 * @returns { TextAttribute } 1112 * @syscap SystemCapability.ArkUI.ArkUI.Full 1113 * @crossplatform 1114 * @form 1115 * @since 10 1116 */ 1117 /** 1118 * Called when the type of letter in the text font is set. 1119 * 1120 * @param { TextCase } value - Default value is TextCase.Normal. 1121 * @returns { TextAttribute } 1122 * @syscap SystemCapability.ArkUI.ArkUI.Full 1123 * @crossplatform 1124 * @form 1125 * @atomicservice 1126 * @since arkts {'1.1':'11', '1.2':'20'} 1127 * @arkts 1.1&1.2 1128 */ 1129 textCase(value: TextCase): TextAttribute; 1130 1131 /** 1132 * Called when the baseline offset is set. 1133 * 1134 * @param { number | string } value 1135 * @returns { TextAttribute } 1136 * @syscap SystemCapability.ArkUI.ArkUI.Full 1137 * @since 7 1138 */ 1139 /** 1140 * Called when the baseline offset is set. 1141 * 1142 * @param { number | string } value 1143 * @returns { TextAttribute } 1144 * @syscap SystemCapability.ArkUI.ArkUI.Full 1145 * @form 1146 * @since 9 1147 */ 1148 /** 1149 * Called when the baseline offset is set. 1150 * 1151 * @param { number | string } value 1152 * @returns { TextAttribute } 1153 * @syscap SystemCapability.ArkUI.ArkUI.Full 1154 * @crossplatform 1155 * @form 1156 * @since 10 1157 */ 1158 /** 1159 * Called when the baseline offset is set. 1160 * 1161 * <p><strong>NOTE</strong>: 1162 * <br>If the value specified is a percentage, the default value is used. 1163 * <br>Positive values shift the content upwards, while negative values shift it downwards. 1164 * </p> 1165 * 1166 * @param { number | string } value - Default value is 0. 1167 * @returns { TextAttribute } 1168 * @syscap SystemCapability.ArkUI.ArkUI.Full 1169 * @crossplatform 1170 * @form 1171 * @atomicservice 1172 * @since 11 1173 */ 1174 /** 1175 * Called when the baseline offset is set. 1176 * 1177 * @param { number | ResourceStr } value 1178 * @returns { TextAttribute } 1179 * @syscap SystemCapability.ArkUI.ArkUI.Full 1180 * @crossplatform 1181 * @form 1182 * @atomicservice 1183 * @since 20 1184 */ 1185 baselineOffset(value: number | ResourceStr): TextAttribute; 1186 1187 /** 1188 * Called when the baseline offset is set. 1189 * 1190 * @param { number | string } value 1191 * @returns { TextAttribute } 1192 * @syscap SystemCapability.ArkUI.ArkUI.Full 1193 * @crossplatform 1194 * @form 1195 * @atomicservice 1196 * @since 20 1197 * @arkts 1.2 1198 */ 1199 baselineOffset(value: number | string): TextAttribute; 1200 1201 /** 1202 * Allow replication. 1203 * 1204 * @param { CopyOptions } value 1205 * @returns { TextAttribute } 1206 * @syscap SystemCapability.ArkUI.ArkUI.Full 1207 * @form 1208 * @since 9 1209 */ 1210 /** 1211 * Allow replication. 1212 * 1213 * @param { CopyOptions } value 1214 * @returns { TextAttribute } 1215 * @syscap SystemCapability.ArkUI.ArkUI.Full 1216 * @crossplatform 1217 * @form 1218 * @since 10 1219 */ 1220 /** 1221 * Allow replication. 1222 * 1223 * <p><strong>NOTE</strong>: 1224 * <br>If this attribute is set to CopyOptions.InApp or CopyOptions.LocalDevice, 1225 * a long press on the text will display a context menu that offers the copy and select-all options. 1226 * <br>Because widgets do not have the long press event, the context menu will not be displayed when users long press text. 1227 * </p> 1228 * 1229 * @param { CopyOptions } value - Default value is CopyOptions.None. 1230 * @returns { TextAttribute } 1231 * @syscap SystemCapability.ArkUI.ArkUI.Full 1232 * @crossplatform 1233 * @form 1234 * @atomicservice 1235 * @since arkts {'1.1':'11', '1.2':'20'} 1236 * @arkts 1.1&1.2 1237 */ 1238 copyOption(value: CopyOptions): TextAttribute; 1239 1240 /** 1241 * Enable the selectable area can be dragged. 1242 * 1243 * @param { boolean } value 1244 * @returns { TextAttribute } 1245 * @syscap SystemCapability.ArkUI.ArkUI.Full 1246 * @since 9 1247 */ 1248 /** 1249 * Enable the selectable area can be dragged. 1250 * 1251 * @param { boolean } value 1252 * @returns { TextAttribute } 1253 * @syscap SystemCapability.ArkUI.ArkUI.Full 1254 * @atomicservice 1255 * @since 11 1256 */ 1257 /** 1258 * Enable the selectable area can be dragged. 1259 * 1260 * <p><strong>NOTE</strong>: 1261 * <br>This attribute cannot be used together with the onDragStart event. 1262 * <br>It must be used together with CopyOptions. 1263 * <br>When it is set to true and copyOptions is set to CopyOptions.InApp or CopyOptions.LocalDevice, 1264 * the selected text can be dragged and copied to the text box. 1265 * </p> 1266 * 1267 * @param { boolean } value - Default value is false. 1268 * @returns { TextAttribute } 1269 * @syscap SystemCapability.ArkUI.ArkUI.Full 1270 * @crossplatform 1271 * @atomicservice 1272 * @since arkts {'1.1':'18', '1.2':'20'} 1273 * @arkts 1.1&1.2 1274 */ 1275 draggable(value: boolean): TextAttribute; 1276 1277 /** 1278 * Called when the text shadow is set. 1279 * 1280 * @param { ShadowOptions } value - The shadow options. 1281 * @returns { TextAttribute } 1282 * @syscap SystemCapability.ArkUI.ArkUI.Full 1283 * @crossplatform 1284 * @form 1285 * @since 10 1286 */ 1287 /** 1288 * Called when the text shadow is set. 1289 * 1290 * <p><strong>NOTE</strong>: 1291 * <br>This API does not work with the fill attribute or coloring strategy. 1292 * </p> 1293 * 1294 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 1295 * @returns { TextAttribute } 1296 * @syscap SystemCapability.ArkUI.ArkUI.Full 1297 * @crossplatform 1298 * @form 1299 * @atomicservice 1300 * @since arkts {'1.1':'11', '1.2':'20'} 1301 * @arkts 1.1&1.2 1302 */ 1303 textShadow(value: ShadowOptions | Array<ShadowOptions>): TextAttribute; 1304 1305 /** 1306 * Called when the height adaptive policy is set. 1307 * 1308 * @param { TextHeightAdaptivePolicy } value - The height adaptive policy. 1309 * @returns { TextAttribute } 1310 * @syscap SystemCapability.ArkUI.ArkUI.Full 1311 * @crossplatform 1312 * @since 10 1313 */ 1314 /** 1315 * Called when the height adaptive policy is set. 1316 * 1317 * <p><strong>NOTE</strong>: 1318 * <ul> 1319 * <li>When this attribute is set to TextHeightAdaptivePolicy.MAX_LINES_FIRST, 1320 * the maxLines attribute takes precedence for adjusting the text height. 1321 * <br>If the maxLines setting results in a layout beyond the layout constraints, 1322 * the text will shrink to a font size between minFontSize and maxFontSize to allow for more content to be shown.</li> 1323 * <li>If this attribute is set to TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST, 1324 * the minFontSize attribute takes precedence for adjusting the text height. 1325 * <br>If the text fits on one line at minFontSize,the system attempts to increase the font size within the range of minFontSize 1326 * and maxFontSize to display the text as large as possible on one line. 1327 * <br>If the text cannot fit into a single line even at minFontSize, it sticks with minFontSize.</li> 1328 * <li>If this attribute is set to TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST, 1329 * the layout constraints take precedence for adjusting the text height. 1330 * <br>If the resultant layout is beyond the layout constraints, 1331 * the text will shrink to a font size between minFontSize and maxFontSize to respect the layout constraints. 1332 * <br>If the text still extends beyond the layout constraints after shrinking to minFontSize, 1333 * the lines that exceed the constraints are deleted.</li> 1334 * </ul> 1335 * </p> 1336 * 1337 * @param { TextHeightAdaptivePolicy } value - The height adaptive policy.Default value is TextHeightAdaptivePolicy.MAX_LINES_FIRST. 1338 * @returns { TextAttribute } 1339 * @syscap SystemCapability.ArkUI.ArkUI.Full 1340 * @crossplatform 1341 * @atomicservice 1342 * @since arkts {'1.1':'11', '1.2':'20'} 1343 * @arkts 1.1&1.2 1344 */ 1345 heightAdaptivePolicy(value: TextHeightAdaptivePolicy): TextAttribute; 1346 1347 /** 1348 * Specify the indentation of the first line in a text-block. 1349 * 1350 * @param { Length } value - The length of text indent. 1351 * @returns { TextAttribute } The attribute of the text. 1352 * @syscap SystemCapability.ArkUI.ArkUI.Full 1353 * @crossplatform 1354 * @since 10 1355 */ 1356 /** 1357 * Specify the indentation of the first line in a text-block. 1358 * 1359 * @param { Length } value - The length of text indent.Default value is 0. 1360 * @returns { TextAttribute } The attribute of the text. 1361 * @syscap SystemCapability.ArkUI.ArkUI.Full 1362 * @crossplatform 1363 * @atomicservice 1364 * @since arkts {'1.1':'11', '1.2':'20'} 1365 * @arkts 1.1&1.2 1366 */ 1367 textIndent(value: Length): TextAttribute; 1368 1369 /** 1370 * Set the word break type. 1371 * 1372 * <p><strong>NOTE</strong>: 1373 * <br>When used with {overflow: TextOverflow.Ellipsis} and maxLines, WordBreak.BREAK_ALL can insert line breaks 1374 * between letters when overflow occurs and display excess content with an ellipsis (...). 1375 * </p> 1376 * 1377 * @param { WordBreak } value - The word break type.Default value is WordBreak.BREAK_WORD. 1378 * @returns { TextAttribute } The attribute of the text. 1379 * @syscap SystemCapability.ArkUI.ArkUI.Full 1380 * @crossplatform 1381 * @atomicservice 1382 * @since arkts {'1.1':'11', '1.2':'20'} 1383 * @arkts 1.1&1.2 1384 */ 1385 wordBreak(value: WordBreak): TextAttribute; 1386 1387 /** 1388 * Set the text line break strategy type. 1389 * 1390 * <p><strong>NOTE</strong>: 1391 * <br>This attribute takes effect when wordBreak is not set to breakAll. 1392 * <br>Hyphens are not supported. 1393 * </p> 1394 * 1395 * @param { LineBreakStrategy } strategy - The text line break strategy type.Default value is LineBreakStrategy.GREEDY. 1396 * @returns { TextAttribute } The attribute of the text. 1397 * @syscap SystemCapability.ArkUI.ArkUI.Full 1398 * @crossplatform 1399 * @atomicservice 1400 * @since arkts {'1.1':'12', '1.2':'20'} 1401 * @arkts 1.1&1.2 1402 */ 1403 lineBreakStrategy(strategy: LineBreakStrategy): TextAttribute; 1404 1405 /** 1406 * Called when using the Clipboard menu 1407 * Currently, only text can be copied. 1408 * 1409 * @param { function } callback - callback of the listened event. 1410 * @returns { TextAttribute } The attribute of the text. 1411 * @syscap SystemCapability.ArkUI.ArkUI.Full 1412 * @crossplatform 1413 * @atomicservice 1414 * @since arkts {'1.1':'11', '1.2':'20'} 1415 * @arkts 1.1&1.2 1416 */ 1417 onCopy(callback: (value: string) => void): TextAttribute; 1418 1419 /** 1420 * Text selection is achieved by specifying the start and end positions of the text. 1421 * 1422 * <p><strong>NOTE</strong>: 1423 * <br>The selected text is highlighted, and a selection handle is displayed together with a menu of available actions. 1424 * <br>When copyOption is set to CopyOptions.None, the selection attribute is not effective. 1425 * <br>When overflow is set to TextOverflow.MARQUEE, the selection attribute is not effective. 1426 * <br>If the value of selectionStart is greater than or equal to that of selectionEnd, no text will be selected. 1427 * <br>The value range is [0, textSize], where textSize indicates the maximum number of characters in the text content. 1428 * <br>If the value is less than 0, the value 0 will be used. 1429 * <br>If the value is greater than textSize, textSize will be used. 1430 * <br>If the value of selectionStart or selectionEnd falls within the invisible area, no text will be selected. 1431 * <br>If clipping is disabled, the text selection outside of the parent component takes effect. 1432 * </p> 1433 * 1434 * @param { number } selectionStart - The start position of the selected text.Default value is -1. 1435 * @param { number } selectionEnd - The end position of the selected text.Default value is -1. 1436 * @returns { TextAttribute } The attribute of the text. 1437 * @syscap SystemCapability.ArkUI.ArkUI.Full 1438 * @crossplatform 1439 * @atomicservice 1440 * @since arkts {'1.1':'11', '1.2':'20'} 1441 * @arkts 1.1&1.2 1442 */ 1443 selection(selectionStart: number, selectionEnd: number): TextAttribute; 1444 1445 /** 1446 * Set the caret color for the selected text. 1447 * 1448 * @param { ResourceColor } color - The color of the selected text caret. 1449 * @returns { TextAttribute } 1450 * @syscap SystemCapability.ArkUI.ArkUI.Full 1451 * @crossplatform 1452 * @atomicservice 1453 * @since arkts {'1.1':'14', '1.2':'20'} 1454 * @arkts 1.1&1.2 1455 */ 1456 caretColor(color: ResourceColor): TextAttribute; 1457 1458 /** 1459 * Set the selected background color of the text. 1460 * 1461 * @param { ResourceColor } color - The color of the selected text background. 1462 * @returns { TextAttribute } 1463 * @syscap SystemCapability.ArkUI.ArkUI.Full 1464 * @crossplatform 1465 * @atomicservice 1466 * @since arkts {'1.1':'14', '1.2':'20'} 1467 * @arkts 1.1&1.2 1468 */ 1469 selectedBackgroundColor(color: ResourceColor): TextAttribute; 1470 1471 /** 1472 * Set the shader style of the text, such as lineargradient or radialgradient. 1473 * 1474 * @param { ShaderStyle } shader - The shader style of the text. 1475 * @returns { TextAttribute } 1476 * @syscap SystemCapability.ArkUI.ArkUI.Full 1477 * @crossplatform 1478 * @atomicservice 1479 * @since 20 1480 */ 1481 shaderStyle(shader: ShaderStyle): TextAttribute; 1482 1483 /** 1484 * Set the ellipsis mode. 1485 * 1486 * @param { EllipsisMode } value - The ellipsis mode. 1487 * @returns { TextAttribute } The attribute of the text. 1488 * @syscap SystemCapability.ArkUI.ArkUI.Full 1489 * @crossplatform 1490 * @since 11 1491 */ 1492 /** 1493 * Set the ellipsis mode. 1494 * 1495 * <p><strong>NOTE</strong>: 1496 * <br>For the settings to work, overflow must be set to TextOverflow.Ellipsis and maxLines must be specified. 1497 * <br>Setting ellipsisMode alone does not take effect. 1498 * <br>EllipsisMode.START and EllipsisMode.CENTER take effect only when text overflows in a single line. 1499 * </p> 1500 * 1501 * @param { EllipsisMode } value - The ellipsis mode.Default value is EllipsisMode.END. 1502 * @returns { TextAttribute } The attribute of the text. 1503 * @syscap SystemCapability.ArkUI.ArkUI.Full 1504 * @crossplatform 1505 * @atomicservice 1506 * @since arkts {'1.1':'12', '1.2':'20'} 1507 * @arkts 1.1&1.2 1508 */ 1509 ellipsisMode(value: EllipsisMode): TextAttribute; 1510 1511 /** 1512 * Enable data detector. 1513 * 1514 * @param { boolean } enable - Enable data detector. 1515 * @returns { TextAttribute } The attribute of the text. 1516 * @syscap SystemCapability.ArkUI.ArkUI.Full 1517 * @since 11 1518 */ 1519 /** 1520 * Enable data detector. 1521 * 1522 * <p><strong>NOTE</strong>: 1523 * <br>This API only works on devices that provide text recognition. 1524 * <br>When enableDataDetector is set to true, and the dataDetectorConfig attribute is not set, 1525 * all types of entities are recognized by default, 1526 * and the color and decoration of the recognized entities will be changed to the following styles: 1527 * <code> 1528 * color: '#ff007dff', 1529 * decoration:{ 1530 * type: TextDecorationType.Underline, 1531 * color: '#ff007dff', 1532 * style: TextDecorationStyle.SOLID 1533 * } 1534 * </code> 1535 * <br>Touching and right-clicking an entity with the mouse will pop up the corresponding entity operation menu based on the type of entity, 1536 * while left-clicking an entity with the mouse will directly respond to the first option of the menu. 1537 * <br>This API does not work when overflow is set to TextOverflow.MARQUEE. 1538 * <br>When copyOption is set to CopyOptions.None, the menu displayed after an entity is clicked does not provide the text selection, 1539 * copy, translation, or sharing functionality. 1540 * <br>When copyOption is not set to CopyOptions.None, and textSelectable is set to TextSelectableMode.UNSELECTABLE, 1541 * the entity still has the copy functionality but does not have the text selection feature. 1542 * </p> 1543 * 1544 * @param { boolean } enable - Enable data detector.Default value is false. 1545 * @returns { TextAttribute } The attribute of the text. 1546 * @syscap SystemCapability.ArkUI.ArkUI.Full 1547 * @atomicservice 1548 * @since arkts {'1.1':'12', '1.2':'20'} 1549 * @arkts 1.1&1.2 1550 */ 1551 enableDataDetector(enable: boolean): TextAttribute; 1552 1553 /** 1554 * Data detector with config. 1555 * 1556 * @param { TextDataDetectorConfig } config - The config of text data detector. 1557 * @returns { TextAttribute } The attribute of the text. 1558 * @syscap SystemCapability.ArkUI.ArkUI.Full 1559 * @since 11 1560 */ 1561 /** 1562 * Data detector with config. 1563 * 1564 * <p><strong>NOTE</strong>: 1565 * <br>This API must be used together with enableDataDetector. 1566 * <br>It takes effect only when enableDataDetector is set to true. 1567 * <br>When entities A and B overlap, the following rules are followed: 1568 * <ol> 1569 * <li>If A is a subset of B (A ⊂ B), then B is retained; otherwise, A is retained.</li> 1570 * <li>If A is not a subset of B (A ⊄ B) and B is not a subset of A (B ⊄ A), 1571 * and if the starting point of A is earlier than that of B (A.start < B.start), 1572 * then A is retained; otherwise, B is retained.</li> 1573 * </ol> 1574 * </p> 1575 * 1576 * @param { TextDataDetectorConfig } config - The config of text data detector. 1577 * @returns { TextAttribute } The attribute of the text. 1578 * @syscap SystemCapability.ArkUI.ArkUI.Full 1579 * @atomicservice 1580 * @since arkts {'1.1':'12', '1.2':'20'} 1581 * @arkts 1.1&1.2 1582 */ 1583 dataDetectorConfig(config: TextDataDetectorConfig): TextAttribute; 1584 1585 /** 1586 * Bind to the selection menu. 1587 * 1588 * @param { TextSpanType } spanType - Indicates the type of selection menu. 1589 * @param { CustomBuilder } content - Indicates the content of selection menu. 1590 * @param { TextResponseType } responseType - Indicates response type of selection menu. 1591 * @param { SelectionMenuOptions } [options] - Indicates the options of selection menu. 1592 * @returns { TextAttribute } 1593 * @syscap SystemCapability.ArkUI.ArkUI.Full 1594 * @crossplatform 1595 * @since 11 1596 */ 1597 /** 1598 * Bind to the selection menu. 1599 * 1600 * <p><strong>NOTE</strong>: 1601 * <br>The duration required for a long-press gesture is 600 ms for bindSelectionMenu and 800 ms for bindContextMenu. 1602 * <br>When both bindSelectionMenu and bindContextMenu are set and both are configured to be triggered by a long-press gesture, 1603 * bindSelectionMenu is triggered first. 1604 * <br>If the custom menu is too long, embed a Scroll component to prevent the keyboard from being blocked. 1605 * </p> 1606 * 1607 * @param { TextSpanType } spanType - Indicates the type of selection menu.Default value is TextSpanType.TEXT. 1608 * @param { CustomBuilder } content - Indicates the content of selection menu. 1609 * @param { TextResponseType } responseType - Indicates response type of selection menu.Default value is TextResponseType.LONG_PRESS. 1610 * @param { SelectionMenuOptions } [options] - Indicates the options of selection menu. 1611 * @returns { TextAttribute } 1612 * @syscap SystemCapability.ArkUI.ArkUI.Full 1613 * @crossplatform 1614 * @atomicservice 1615 * @since arkts {'1.1':'12', '1.2':'20'} 1616 * @arkts 1.1&1.2 1617 */ 1618 bindSelectionMenu(spanType: TextSpanType, content: CustomBuilder, responseType: TextResponseType, 1619 options?: SelectionMenuOptions): TextAttribute; 1620 1621 /** 1622 * Called when the text selection changes. 1623 * 1624 * @param { function } callback - callback of the listened event. 1625 * @returns { TextAttribute } returns the instance of the TextAttribute. 1626 * @syscap SystemCapability.ArkUI.ArkUI.Full 1627 * @crossplatform 1628 * @since 11 1629 */ 1630 /** 1631 * Called when the text selection changes. 1632 * 1633 * @param { function } callback - callback of the listened event. 1634 * @returns { TextAttribute } returns the instance of the TextAttribute. 1635 * @syscap SystemCapability.ArkUI.ArkUI.Full 1636 * @crossplatform 1637 * @atomicservice 1638 * @since arkts {'1.1':'12', '1.2':'20'} 1639 * @arkts 1.1&1.2 1640 */ 1641 onTextSelectionChange(callback: (selectionStart: number, selectionEnd: number) => void): TextAttribute; 1642 1643 /** 1644 * Set font feature. 1645 * 1646 * @param { string } value - The fontFeature. 1647 * normal | <feature-tag-value>, 1648 * where <feature-tag-value> = <string> [ <integer> | on | off ], like: "ss01" 0 1649 * the values of <feature-tag-value> reference to doc of text component 1650 * number of <feature-tag-value> can be single or multiple, and separated by comma ','. 1651 * @returns { TextAttribute } 1652 * @syscap SystemCapability.ArkUI.ArkUI.Full 1653 * @crossplatform 1654 * @form 1655 * @atomicservice 1656 * @since arkts {'1.1':'12', '1.2':'20'} 1657 * @arkts 1.1&1.2 1658 */ 1659 fontFeature(value: string): TextAttribute; 1660 1661 /** 1662 * Set the marquee options. 1663 * 1664 * @param { Optional<TextMarqueeOptions> } options 1665 * @returns { TextAttribute } 1666 * @syscap SystemCapability.ArkUI.ArkUI.Full 1667 * @crossplatform 1668 * @atomicservice 1669 * @since arkts {'1.1':'18', '1.2':'20'} 1670 * @arkts 1.1&1.2 1671 */ 1672 marqueeOptions(options: Optional<TextMarqueeOptions>): TextAttribute; 1673 1674 /** 1675 * Called when the text marquee state changes. 1676 * 1677 * @param { Callback<MarqueeState> } callback - callback of the marquee state change event. 1678 * @returns { TextAttribute } returns the instance of the TextAttribute. 1679 * @syscap SystemCapability.ArkUI.ArkUI.Full 1680 * @crossplatform 1681 * @atomicservice 1682 * @since arkts {'1.1':'18', '1.2':'20'} 1683 * @arkts 1.1&1.2 1684 */ 1685 onMarqueeStateChange(callback: Callback<MarqueeState>): TextAttribute; 1686 1687 /** 1688 * Whether to support sensitive privacy information 1689 * 1690 * <p><strong>NOTE</strong>: 1691 * <br>The value true means to enable privacy mode, in which case text is obscured as hyphens (-). 1692 * <br>If this parameter is set to null, privacy mode is disabled. 1693 * <br>Enabling privacy mode requires widget framework support. 1694 * </p> 1695 * 1696 * @param { boolean } supported - Whether to support sensitive privacy information.Default value is false. 1697 * @returns { TextAttribute } 1698 * @syscap SystemCapability.ArkUI.ArkUI.Full 1699 * @form 1700 * @atomicservice 1701 * @since arkts {'1.1':'12', '1.2':'20'} 1702 * @arkts 1.1&1.2 1703 */ 1704 privacySensitive(supported: boolean): TextAttribute; 1705 1706 /** 1707 * set text selectable and focusable 1708 * 1709 * @param { TextSelectableMode } mode - Default value is TextSelectableMode.SELECTABLE_UNFOCUSABLE. 1710 * @returns { TextAttribute } 1711 * @syscap SystemCapability.ArkUI.ArkUI.Full 1712 * @crossplatform 1713 * @atomicservice 1714 * @since arkts {'1.1':'12', '1.2':'20'} 1715 * @arkts 1.1&1.2 1716 */ 1717 textSelectable(mode: TextSelectableMode): TextAttribute; 1718 1719 /** 1720 * Set the custom text menu. 1721 * Sets the extended options of the custom context menu on selection, 1722 * including the text content, icon, and callback. 1723 * 1724 * @param { EditMenuOptions } editMenu - Customize text menu options. 1725 * @returns { TextAttribute } 1726 * @syscap SystemCapability.ArkUI.ArkUI.Full 1727 * @crossplatform 1728 * @atomicservice 1729 * @since arkts {'1.1':'12', '1.2':'20'} 1730 * @arkts 1.1&1.2 1731 */ 1732 editMenuOptions(editMenu: EditMenuOptions): TextAttribute; 1733 1734 /** 1735 * Set the text with half leading. 1736 * 1737 * <p><strong>NOTE</strong>: 1738 * <br>The halfLeading settings configured within the component take precedence over those in module.json5. 1739 * <br>The value true means that half leading is enabled, and false means the opposite. 1740 * </p> 1741 * 1742 * @param { boolean } halfLeading - Default value is false. 1743 * @returns { TextAttribute } 1744 * @syscap SystemCapability.ArkUI.ArkUI.Full 1745 * @crossplatform 1746 * @atomicservice 1747 * @since arkts {'1.1':'12', '1.2':'20'} 1748 * @arkts 1.1&1.2 1749 */ 1750 halfLeading(halfLeading: boolean): TextAttribute; 1751 1752 /** 1753 * Enable or disable haptic feedback. 1754 * 1755 * @param { boolean } isEnabled - Default value is true, set false to disable haptic feedback. 1756 * @returns { TextAttribute } returns the instance of the TextAttribute. 1757 * @syscap SystemCapability.ArkUI.ArkUI.Full 1758 * @crossplatform 1759 * @atomicservice 1760 * @since arkts {'1.1':'13', '1.2':'20'} 1761 * @arkts 1.1&1.2 1762 */ 1763 enableHapticFeedback(isEnabled: boolean): TextAttribute; 1764 1765 /** 1766 * Set whether to optimize the trailing spaces at the end of each line during text layout. 1767 * 1768 * @param { Optional<boolean> } optimize - Default value is false, set true to optimize the trailing spaces at the end of each line. 1769 * @returns { TextAttribute } returns the instance of the TextAttribute. 1770 * @syscap SystemCapability.ArkUI.ArkUI.Full 1771 * @crossplatform 1772 * @atomicservice 1773 * @since 20 1774 */ 1775 optimizeTrailingSpace(optimize: Optional<boolean>): TextAttribute; 1776 1777 /** 1778 * Whether to enable automatic spacing between Chinese and Latin characters. 1779 * 1780 * @param { Optional<boolean> } enabled - The default value is false, indicates the flag whether to enable automatic spacing. 1781 * @returns { TextAttribute } returns the instance of the TextAttribute. 1782 * @syscap SystemCapability.ArkUI.ArkUI.Full 1783 * @crossplatform 1784 * @atomicservice 1785 * @since 20 1786 */ 1787 enableAutoSpacing(enabled: Optional<boolean>): TextAttribute; 1788 1789 /** 1790 * Set text transition. 1791 * 1792 * @param { Optional<ContentTransition> } transition - The transition of text. 1793 * @returns { TextAttribute } returns the instance of the TextAttribute. 1794 * @syscap SystemCapability.ArkUI.ArkUI.Full 1795 * @atomicservice 1796 * @since 20 1797 */ 1798 contentTransition(transition: Optional<ContentTransition>): TextAttribute; 1799} 1800 1801/** 1802 * Defines Text Component instance. 1803 * 1804 * @syscap SystemCapability.ArkUI.ArkUI.Full 1805 * @since 7 1806 */ 1807/** 1808 * Defines Text Component instance. 1809 * 1810 * @syscap SystemCapability.ArkUI.ArkUI.Full 1811 * @form 1812 * @since 9 1813 */ 1814/** 1815 * Defines Text Component instance. 1816 * 1817 * @syscap SystemCapability.ArkUI.ArkUI.Full 1818 * @crossplatform 1819 * @form 1820 * @since 10 1821 */ 1822/** 1823 * Defines Text Component instance. 1824 * 1825 * @syscap SystemCapability.ArkUI.ArkUI.Full 1826 * @crossplatform 1827 * @form 1828 * @atomicservice 1829 * @since 11 1830 */ 1831declare const TextInstance: TextAttribute; 1832 1833/** 1834 * Defines Text Component. 1835 * 1836 * @syscap SystemCapability.ArkUI.ArkUI.Full 1837 * @since 7 1838 */ 1839/** 1840 * Defines Text Component. 1841 * 1842 * @syscap SystemCapability.ArkUI.ArkUI.Full 1843 * @form 1844 * @since 9 1845 */ 1846/** 1847 * Defines Text Component. 1848 * 1849 * @syscap SystemCapability.ArkUI.ArkUI.Full 1850 * @crossplatform 1851 * @form 1852 * @since 10 1853 */ 1854/** 1855 * Defines Text Component. 1856 * 1857 * @syscap SystemCapability.ArkUI.ArkUI.Full 1858 * @crossplatform 1859 * @form 1860 * @atomicservice 1861 * @since 11 1862 */ 1863declare const Text: TextInterface; 1864 1865/** 1866 * Defines span type. 1867 * 1868 * @enum { number } 1869 * @syscap SystemCapability.ArkUI.ArkUI.Full 1870 * @crossplatform 1871 * @since 11 1872 */ 1873/** 1874 * Defines span type. 1875 * 1876 * <p><strong>NOTE</strong>: 1877 * <br>The order for menu type matching is as follows. 1878 * <br>When the user interacts with text, the system follows this order to decides which type of menu to display. 1879 * <ol> 1880 * <li>Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.LONG_PRESS.</li> 1881 * <li>Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.DEFAULT.</li> 1882 * <li>Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.LONG_PRESS.</li> 1883 * <li>Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.DEFAULT.</li> 1884 * </ol> 1885 * </p> 1886 * 1887 * @enum { number } 1888 * @syscap SystemCapability.ArkUI.ArkUI.Full 1889 * @crossplatform 1890 * @atomicservice 1891 * @since arkts {'1.1':'12', '1.2':'20'} 1892 * @arkts 1.1&1.2 1893 */ 1894declare enum TextSpanType { 1895 /** 1896 * Only contains text. 1897 * 1898 * @syscap SystemCapability.ArkUI.ArkUI.Full 1899 * @crossplatform 1900 * @since 11 1901 */ 1902 /** 1903 * Only contains text. 1904 * 1905 * @syscap SystemCapability.ArkUI.ArkUI.Full 1906 * @crossplatform 1907 * @atomicservice 1908 * @since arkts {'1.1':'12', '1.2':'20'} 1909 * @arkts 1.1&1.2 1910 */ 1911 TEXT = 0, 1912 1913 /** 1914 * Only contains image. 1915 * 1916 * @syscap SystemCapability.ArkUI.ArkUI.Full 1917 * @crossplatform 1918 * @since 11 1919 */ 1920 /** 1921 * Only contains image. 1922 * 1923 * @syscap SystemCapability.ArkUI.ArkUI.Full 1924 * @crossplatform 1925 * @atomicservice 1926 * @since arkts {'1.1':'12', '1.2':'20'} 1927 * @arkts 1.1&1.2 1928 */ 1929 IMAGE = 1, 1930 1931 /** 1932 * Contains both text and image. 1933 * 1934 * @syscap SystemCapability.ArkUI.ArkUI.Full 1935 * @crossplatform 1936 * @since 11 1937 */ 1938 /** 1939 * Contains both text and image. 1940 * 1941 * @syscap SystemCapability.ArkUI.ArkUI.Full 1942 * @crossplatform 1943 * @atomicservice 1944 * @since arkts {'1.1':'12', '1.2':'20'} 1945 * @arkts 1.1&1.2 1946 */ 1947 MIXED = 2, 1948 1949 /** 1950 * When no other types are explicitly specified, this type will be matched. 1951 * When this type is registered but TEXT, IMAGE, or MIXED types are not registered, 1952 * this type will be triggered and displayed for those registered types. 1953 * 1954 * @syscap SystemCapability.ArkUI.ArkUI.Full 1955 * @crossplatform 1956 * @atomicservice 1957 * @since arkts {'1.1':'15', '1.2':'20'} 1958 * @arkts 1.1&1.2 1959 */ 1960 DEFAULT = 3, 1961} 1962 1963/** 1964 * ResponseType for contextMenu 1965 * 1966 * @enum { number } 1967 * @syscap SystemCapability.ArkUI.ArkUI.Full 1968 * @crossplatform 1969 * @since 11 1970 */ 1971/** 1972 * ResponseType for contextMenu 1973 * 1974 * <p><strong>NOTE</strong>: 1975 * <br>The order for menu type matching is as follows. When the user interacts with text, 1976 * the system follows this order to decides which type of menu to display. 1977 * <ol> 1978 * <li>Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.LONG_PRESS.</li> 1979 * <li>Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.DEFAULT.</li> 1980 * <li>Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.LONG_PRESS.</li> 1981 * <li>Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.DEFAULT.</li> 1982 * </ol> 1983 * </p> 1984 * 1985 * @enum { number } 1986 * @syscap SystemCapability.ArkUI.ArkUI.Full 1987 * @crossplatform 1988 * @atomicservice 1989 * @since arkts {'1.1':'12', '1.2':'20'} 1990 * @arkts 1.1&1.2 1991 */ 1992declare enum TextResponseType { 1993 /** 1994 * Right click. 1995 * 1996 * @syscap SystemCapability.ArkUI.ArkUI.Full 1997 * @crossplatform 1998 * @since 11 1999 */ 2000 /** 2001 * Right click. 2002 * 2003 * @syscap SystemCapability.ArkUI.ArkUI.Full 2004 * @crossplatform 2005 * @atomicservice 2006 * @since arkts {'1.1':'12', '1.2':'20'} 2007 * @arkts 1.1&1.2 2008 */ 2009 RIGHT_CLICK = 0, 2010 2011 /** 2012 * Long press. 2013 * 2014 * @syscap SystemCapability.ArkUI.ArkUI.Full 2015 * @crossplatform 2016 * @since 11 2017 */ 2018 /** 2019 * Long press. 2020 * 2021 * @syscap SystemCapability.ArkUI.ArkUI.Full 2022 * @crossplatform 2023 * @atomicservice 2024 * @since arkts {'1.1':'12', '1.2':'20'} 2025 * @arkts 1.1&1.2 2026 */ 2027 LONG_PRESS = 1, 2028 2029 /** 2030 * Selected by mouse. 2031 * 2032 * @syscap SystemCapability.ArkUI.ArkUI.Full 2033 * @crossplatform 2034 * @since 11 2035 */ 2036 /** 2037 * Selected by mouse. 2038 * 2039 * @syscap SystemCapability.ArkUI.ArkUI.Full 2040 * @crossplatform 2041 * @atomicservice 2042 * @since arkts {'1.1':'12', '1.2':'20'} 2043 * @arkts 1.1&1.2 2044 */ 2045 SELECT = 2, 2046 2047 /** 2048 * When no other types are explicitly specified, this type will be matched. 2049 * When this type is registered but RIGHT_CLICK, LONG_PRESS, or SELECT types are not registered, 2050 * this type will be triggered and displayed for right-click, long press, and mouse selection actions. 2051 * 2052 * @syscap SystemCapability.ArkUI.ArkUI.Full 2053 * @crossplatform 2054 * @atomicservice 2055 * @since arkts {'1.1':'15', '1.2':'20'} 2056 * @arkts 1.1&1.2 2057 */ 2058 DEFAULT = 3, 2059} 2060 2061/** 2062 * Defines marquee state. 2063 * 2064 * @enum { number } 2065 * @syscap SystemCapability.ArkUI.ArkUI.Full 2066 * @crossplatform 2067 * @atomicservice 2068 * @since arkts {'1.1':'18', '1.2':'20'} 2069 * @arkts 1.1&1.2 2070 */ 2071declare enum MarqueeState { 2072 /** 2073 * The marquee started. 2074 * 2075 * @syscap SystemCapability.ArkUI.ArkUI.Full 2076 * @crossplatform 2077 * @atomicservice 2078 * @since arkts {'1.1':'18', '1.2':'20'} 2079 * @arkts 1.1&1.2 2080 */ 2081 START = 0, 2082 2083 /** 2084 * The marquee a round finished and start next round. 2085 * 2086 * @syscap SystemCapability.ArkUI.ArkUI.Full 2087 * @crossplatform 2088 * @atomicservice 2089 * @since arkts {'1.1':'18', '1.2':'20'} 2090 * @arkts 1.1&1.2 2091 */ 2092 BOUNCE = 1, 2093 2094 /** 2095 * The marquee all finished. 2096 * 2097 * @syscap SystemCapability.ArkUI.ArkUI.Full 2098 * @crossplatform 2099 * @atomicservice 2100 * @since arkts {'1.1':'18', '1.2':'20'} 2101 * @arkts 1.1&1.2 2102 */ 2103 FINISH = 2, 2104} 2105 2106/** 2107 * Defines marquee start policy. 2108 * 2109 * @enum { number } 2110 * @syscap SystemCapability.ArkUI.ArkUI.Full 2111 * @crossplatform 2112 * @atomicservice 2113 * @since arkts {'1.1':'18', '1.2':'20'} 2114 * @arkts 1.1&1.2 2115 */ 2116declare enum MarqueeStartPolicy { 2117 /** 2118 * Start marquee in any case. This is the default policy. 2119 * 2120 * @syscap SystemCapability.ArkUI.ArkUI.Full 2121 * @crossplatform 2122 * @atomicservice 2123 * @since arkts {'1.1':'18', '1.2':'20'} 2124 * @arkts 1.1&1.2 2125 */ 2126 DEFAULT = 0, 2127 2128 /** 2129 * Start marquee only when get focus. 2130 * 2131 * @syscap SystemCapability.ArkUI.ArkUI.Full 2132 * @crossplatform 2133 * @atomicservice 2134 * @since arkts {'1.1':'18', '1.2':'20'} 2135 * @arkts 1.1&1.2 2136 */ 2137 ON_FOCUS = 1, 2138} 2139 2140/** 2141 * Defines the options of Text. 2142 * 2143 * @interface TextOptions 2144 * @syscap SystemCapability.ArkUI.ArkUI.Full 2145 * @crossplatform 2146 * @since 11 2147 */ 2148/** 2149 * Defines the options of Text. 2150 * 2151 * @interface TextOptions 2152 * @syscap SystemCapability.ArkUI.ArkUI.Full 2153 * @crossplatform 2154 * @atomicservice 2155 * @since arkts {'1.1':'12', '1.2':'20'} 2156 * @arkts 1.1&1.2 2157 */ 2158declare interface TextOptions { 2159 /** 2160 * Text controller. 2161 * 2162 * @type { TextController } 2163 * @syscap SystemCapability.ArkUI.ArkUI.Full 2164 * @crossplatform 2165 * @since 11 2166 */ 2167 /** 2168 * Text controller. 2169 * 2170 * @type { TextController } 2171 * @syscap SystemCapability.ArkUI.ArkUI.Full 2172 * @crossplatform 2173 * @atomicservice 2174 * @since arkts {'1.1':'12', '1.2':'20'} 2175 * @arkts 1.1&1.2 2176 */ 2177 controller: TextController; 2178} 2179 2180/** 2181 * Defines the marquee options. 2182 * 2183 * @interface TextMarqueeOptions 2184 * @syscap SystemCapability.ArkUI.ArkUI.Full 2185 * @crossplatform 2186 * @atomicservice 2187 * @since arkts {'1.1':'18', '1.2':'20'} 2188 * @arkts 1.1&1.2 2189 */ 2190declare interface TextMarqueeOptions { 2191 /** 2192 * Is need start marquee. 2193 * 2194 * @type { boolean } 2195 * @syscap SystemCapability.ArkUI.ArkUI.Full 2196 * @crossplatform 2197 * @atomicservice 2198 * @since arkts {'1.1':'18', '1.2':'20'} 2199 * @arkts 1.1&1.2 2200 */ 2201 start: boolean; 2202 2203 /** 2204 * The step size of the marquee. 2205 * 2206 * @type { ?number } 2207 * @syscap SystemCapability.ArkUI.ArkUI.Full 2208 * @crossplatform 2209 * @atomicservice 2210 * @since arkts {'1.1':'18', '1.2':'20'} 2211 * @arkts 1.1&1.2 2212 */ 2213 step?: number; 2214 2215 /** 2216 * The rounds of the marquee. 2217 * 2218 * @type { ?number } 2219 * @syscap SystemCapability.ArkUI.ArkUI.Full 2220 * @crossplatform 2221 * @atomicservice 2222 * @since arkts {'1.1':'18', '1.2':'20'} 2223 * @arkts 1.1&1.2 2224 */ 2225 loop?: number; 2226 2227 /** 2228 * The running direction of the marquee. 2229 * 2230 * @type { ?boolean } 2231 * @syscap SystemCapability.ArkUI.ArkUI.Full 2232 * @crossplatform 2233 * @atomicservice 2234 * @since arkts {'1.1':'18', '1.2':'20'} 2235 * @arkts 1.1&1.2 2236 */ 2237 fromStart?: boolean; 2238 2239 /** 2240 * The waiting time between each round of the marquee. 2241 * 2242 * @type { ?number } 2243 * @syscap SystemCapability.ArkUI.ArkUI.Full 2244 * @crossplatform 2245 * @atomicservice 2246 * @since arkts {'1.1':'18', '1.2':'20'} 2247 * @arkts 1.1&1.2 2248 */ 2249 delay?: number; 2250 2251 /** 2252 * Set whether the text is faded out. 2253 * 2254 * @type { ?boolean } 2255 * @syscap SystemCapability.ArkUI.ArkUI.Full 2256 * @crossplatform 2257 * @atomicservice 2258 * @since arkts {'1.1':'18', '1.2':'20'} 2259 * @arkts 1.1&1.2 2260 */ 2261 fadeout?: boolean; 2262 2263 /** 2264 * The start policy for marquee. 2265 * 2266 * @type { ?MarqueeStartPolicy } 2267 * @syscap SystemCapability.ArkUI.ArkUI.Full 2268 * @crossplatform 2269 * @atomicservice 2270 * @since arkts {'1.1':'18', '1.2':'20'} 2271 * @arkts 1.1&1.2 2272 */ 2273 marqueeStartPolicy?: MarqueeStartPolicy; 2274} 2275 2276/** 2277 * Defines the controller of Text. 2278 * 2279 * @syscap SystemCapability.ArkUI.ArkUI.Full 2280 * @crossplatform 2281 * @since 11 2282 */ 2283/** 2284 * Defines the controller of Text. 2285 * 2286 * @syscap SystemCapability.ArkUI.ArkUI.Full 2287 * @crossplatform 2288 * @atomicservice 2289 * @since arkts {'1.1':'12', '1.2':'20'} 2290 * @arkts 1.1&1.2 2291 */ 2292declare class TextController { 2293 /** 2294 * Close the select menu when menu is on. 2295 * 2296 * @syscap SystemCapability.ArkUI.ArkUI.Full 2297 * @crossplatform 2298 * @since 11 2299 */ 2300 /** 2301 * Close the select menu when menu is on. 2302 * 2303 * @syscap SystemCapability.ArkUI.ArkUI.Full 2304 * @crossplatform 2305 * @atomicservice 2306 * @since arkts {'1.1':'12', '1.2':'20'} 2307 * @arkts 1.1&1.2 2308 */ 2309 closeSelectionMenu(): void; 2310 2311 /** 2312 * Update the styles of StyledString by setStyledString. 2313 * 2314 * <p><strong>NOTE</strong>: 2315 * <br>The child class MutableStyledString of StyledString can also serve as the argument. 2316 * </p> 2317 * 2318 * @param { StyledString } value 2319 * @syscap SystemCapability.ArkUI.ArkUI.Full 2320 * @crossplatform 2321 * @atomicservice 2322 * @since arkts {'1.1':'12', '1.2':'20'} 2323 * @arkts 1.1&1.2 2324 */ 2325 setStyledString(value: StyledString): void; 2326 2327 /** 2328 * Get LayoutManager. 2329 * 2330 * @returns { LayoutManager } - Return the LayoutManager. 2331 * @syscap SystemCapability.ArkUI.ArkUI.Full 2332 * @crossplatform 2333 * @atomicservice 2334 * @since arkts {'1.1':'12', '1.2':'20'} 2335 * @arkts 1.1&1.2 2336 */ 2337 getLayoutManager(): LayoutManager; 2338} 2339