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 * Defines the text data detector type. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 11 27 */ 28/** 29 * Defines the text data detector type. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 12 35 */ 36declare enum TextDataDetectorType { 37 /** 38 * Detector type phone number. 39 * 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @since 11 42 */ 43 /** 44 * Detector type phone number. 45 * 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @atomicservice 48 * @since 12 49 */ 50 PHONE_NUMBER = 0, 51 52 /** 53 * Detector type URL. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @since 11 57 */ 58 /** 59 * Detector type URL. 60 * 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @atomicservice 63 * @since 12 64 */ 65 URL = 1, 66 67 /** 68 * Detector type email. 69 * 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @since 11 72 */ 73 /** 74 * Detector type email. 75 * 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @atomicservice 78 * @since 12 79 */ 80 EMAIL = 2, 81 82 /** 83 * Detector type address. 84 * 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @since 11 87 */ 88 /** 89 * Detector type address. 90 * 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @atomicservice 93 * @since 12 94 */ 95 ADDRESS = 3, 96 97 /** 98 * Detector type datetime. 99 * 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @atomicservice 102 * @since 12 103 */ 104 DATE_TIME = 4, 105} 106 107/** 108 * Text data detector config. 109 * 110 * @interface TextDataDetectorConfig 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @since 11 113 */ 114/** 115 * Text data detector config. 116 * 117 * @interface TextDataDetectorConfig 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @atomicservice 120 * @since 12 121 */ 122declare interface TextDataDetectorConfig { 123 /** 124 * Text data detector types. 125 * 126 * @type { TextDataDetectorType[] } 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @since 11 129 */ 130 /** 131 * Text data detector types. 132 * 133 * @type { TextDataDetectorType[] } 134 * @syscap SystemCapability.ArkUI.ArkUI.Full 135 * @atomicservice 136 * @since 12 137 */ 138 types: TextDataDetectorType[] 139 140 /** 141 * Text data detect result callback. 142 * 143 * @type { ?function } 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @since 11 146 */ 147 /** 148 * Text data detect result callback. 149 * 150 * @type { ?function } 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @atomicservice 153 * @since 12 154 */ 155 onDetectResultUpdate?: (result: string) => void 156 157 /** 158 * The color of AI entity. 159 * 160 * @type { ?ResourceColor } 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @atomicservice 163 * @since 12 164 */ 165 color?: ResourceColor, 166 167 /** 168 * The decoration of AI entity. 169 * 170 * @type { ?DecorationStyleInterface } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @atomicservice 173 * @since 12 174 */ 175 decoration?: DecorationStyleInterface 176} 177 178/** 179 * Defines range of text type component. 180 * 181 * @interface TextRange 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @crossplatform 184 * @atomicservice 185 * @since 12 186 */ 187declare interface TextRange { 188 /** 189 * Start offset. 190 * 191 * @type { ?number } 192 * @default 0 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @crossplatform 195 * @atomicservice 196 * @since 12 197 */ 198 start?: number; 199 200 /** 201 * End offset. 202 * 203 * @type { ?number } 204 * @default text length 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @crossplatform 207 * @atomicservice 208 * @since 12 209 */ 210 end?: number; 211} 212 213/** 214 * Defines the inserted text value info. 215 * 216 * @interface InsertValue 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @crossplatform 219 * @atomicservice 220 * @since 12 221 */ 222declare interface InsertValue { 223 /** 224 * The location info where the value will be inserted. 225 * 226 * @type { number } 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @atomicservice 230 * @since 12 231 */ 232 insertOffset: number; 233 234 /** 235 * The inserted value. 236 * 237 * @type { string } 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @crossplatform 240 * @atomicservice 241 * @since 12 242 */ 243 insertValue: string; 244} 245 246/** 247 * Defines delete text direction. 248 * 249 * @enum { number } 250 * @syscap SystemCapability.ArkUI.ArkUI.Full 251 * @crossplatform 252 * @atomicservice 253 * @since 12 254 */ 255declare enum TextDeleteDirection { 256 /** 257 * Delete backward. 258 * 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @atomicservice 262 * @since 12 263 */ 264 BACKWARD = 0, 265 266 /** 267 * Delete forward. 268 * 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @crossplatform 271 * @atomicservice 272 * @since 12 273 */ 274 FORWARD = 1, 275} 276 277/** 278 * Defines menu type. 279 * 280 * @enum { number } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @crossplatform 283 * @atomicservice 284 * @since 13 285 */ 286declare enum MenuType { 287 /** 288 * Selection menu. 289 * 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @crossplatform 292 * @atomicservice 293 * @since 13 294 */ 295 SELECTION_MENU = 0, 296 297 /** 298 * Preview menu, only for image. 299 * 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @atomicservice 303 * @since 13 304 */ 305 PREVIEW_MENU = 1, 306} 307 308/** 309 * Provides an interface for deleting value from text. 310 * 311 * @interface DeleteValue 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @atomicservice 315 * @since 12 316 */ 317declare interface DeleteValue { 318 /** 319 * The location info where the value will be deleted. 320 * 321 * @type { number } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @crossplatform 324 * @atomicservice 325 * @since 12 326 */ 327 deleteOffset: number; 328 329 /** 330 * The deleted direction. 331 * 332 * @type { TextDeleteDirection } 333 * @syscap SystemCapability.ArkUI.ArkUI.Full 334 * @crossplatform 335 * @atomicservice 336 * @since 12 337 */ 338 direction: TextDeleteDirection; 339 340 /** 341 * The deleted value. 342 * 343 * @type { string } 344 * @syscap SystemCapability.ArkUI.ArkUI.Full 345 * @crossplatform 346 * @atomicservice 347 * @since 12 348 */ 349 deleteValue: string; 350} 351 352/** 353 * Callback after content changed. 354 * 355 * @typedef { function } OnDidChangeCallback 356 * @param { TextRange } rangeBefore - Range of content that had been replaced. 357 * @param { TextRange } rangeAfter - Range of content that newly added. 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @crossplatform 360 * @atomicservice 361 * @since 12 362 */ 363declare type OnDidChangeCallback = (rangeBefore: TextRange, rangeAfter: TextRange) => void; 364 365/** 366 * Callback when input sometimes has info of previewText. 367 * 368 * @typedef { function } EditableTextOnChangeCallback 369 * @param { string } value - Value of body text, without previewText value. 370 * @param { PreviewText } [previewText] - info of previewText, contains previewText value and start index. 371 * @syscap SystemCapability.ArkUI.ArkUI.Full 372 * @crossplatform 373 * @atomicservice 374 * @since 12 375 */ 376/** 377 * Callback when input sometimes has info of previewText. 378 * 379 * @typedef { function } EditableTextOnChangeCallback 380 * @param { string } value - Value of body text, without previewText value. 381 * @param { PreviewText } [previewText] - info of previewText, contains previewText value and start index. 382 * @param { TextChangeOptions } [options] - contains the selection range before and after the change, as well as the old content. 383 * @syscap SystemCapability.ArkUI.ArkUI.Full 384 * @crossplatform 385 * @atomicservice 386 * @since 15 387 */ 388declare type EditableTextOnChangeCallback = (value: string, previewText?: PreviewText, options?: TextChangeOptions) => void; 389 390/** 391 * Define the text selection controller. 392 * 393 * @interface TextBaseController 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @crossplatform 396 * @atomicservice 397 * @since 12 398 */ 399declare interface TextBaseController { 400 /** 401 * Set selection to select a range of content. 402 * 403 * @param { number } selectionStart - The start position of the selected text. 404 * @param { number } selectionEnd - The end position of the selected text. 405 * @param { SelectionOptions } [options] - Indicates the options of selection. 406 * @syscap SystemCapability.ArkUI.ArkUI.Full 407 * @crossplatform 408 * @atomicservice 409 * @since 12 410 */ 411 setSelection(selectionStart: number, selectionEnd: number, options?: SelectionOptions): void; 412 413 /** 414 * Close the select menu when menu is on. 415 * 416 * @syscap SystemCapability.ArkUI.ArkUI.Full 417 * @crossplatform 418 * @atomicservice 419 * @since 12 420 */ 421 closeSelectionMenu(): void; 422 423 /** 424 * Get LayoutManager. 425 * 426 * @returns { LayoutManager } - Return the LayoutManager. 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @atomicservice 430 * @since 12 431 */ 432 getLayoutManager(): LayoutManager; 433} 434 435/** 436 * Define the text extended editing controller. 437 * 438 * @extends TextBaseController 439 * @interface TextEditControllerEx 440 * @syscap SystemCapability.ArkUI.ArkUI.Full 441 * @crossplatform 442 * @atomicservice 443 * @since 12 444 */ 445declare interface TextEditControllerEx extends TextBaseController{ 446 /** 447 * Judge whether is in editing state 448 * 449 * @returns { boolean } - true means that the component is in editing state, false means is non in editing status 450 * @syscap SystemCapability.ArkUI.ArkUI.Full 451 * @crossplatform 452 * @atomicservice 453 * @since 12 454 */ 455 isEditing(): boolean; 456 457 /** 458 * Stop editing state. 459 * 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @crossplatform 462 * @atomicservice 463 * @since 12 464 */ 465 stopEditing(): void; 466 467 /** 468 * Set caret offset. 469 * 470 * @param { number } offset - caret offset. 471 * @returns { boolean } - Return true if the caret offset was successfully set, false otherwise. 472 * @syscap SystemCapability.ArkUI.ArkUI.Full 473 * @crossplatform 474 * @atomicservice 475 * @since 12 476 */ 477 setCaretOffset(offset: number): boolean; 478 479 /** 480 * Get caret offset from controller. 481 * 482 * @returns { number } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @crossplatform 485 * @atomicservice 486 * @since 12 487 */ 488 getCaretOffset(): number; 489 490 /** 491 * Get PreviewText. 492 * 493 * @returns { PreviewText } - Return the PreviewText. 494 * @syscap SystemCapability.ArkUI.ArkUI.Full 495 * @crossplatform 496 * @atomicservice 497 * @since 12 498 */ 499 getPreviewText?(): PreviewText; 500} 501 502/** 503 * The previewText. 504 * @interface PreviewText 505 * @syscap SystemCapability.ArkUI.ArkUI.Full 506 * @crossplatform 507 * @atomicservice 508 * @since 12 509 */ 510declare interface PreviewText { 511 /** 512 * Start offset of the previewText 513 * 514 * @type { number } 515 * @syscap SystemCapability.ArkUI.ArkUI.Full 516 * @crossplatform 517 * @atomicservice 518 * @since 12 519 */ 520 offset: number; 521 522 /** 523 * Value of the previewText. 524 * 525 * @type { string } 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @crossplatform 528 * @atomicservice 529 * @since 12 530 */ 531 value: string; 532} 533 534/** 535 * Define the StyledString controller. 536 * 537 * @interface StyledStringController 538 * @syscap SystemCapability.ArkUI.ArkUI.Full 539 * @crossplatform 540 * @atomicservice 541 * @since 12 542 */ 543declare interface StyledStringController { 544 /** 545 * Set the StyledString of the component. 546 * 547 * @param { StyledString } styledString - StyledString. 548 * @syscap SystemCapability.ArkUI.ArkUI.Full 549 * @crossplatform 550 * @atomicservice 551 * @since 12 552 */ 553 setStyledString(styledString: StyledString): void; 554 555 /** 556 * Get the StyledString of the component. 557 * 558 * @returns { MutableStyledString } 559 * @syscap SystemCapability.ArkUI.ArkUI.Full 560 * @crossplatform 561 * @atomicservice 562 * @since 12 563 */ 564 getStyledString(): MutableStyledString; 565} 566 567/** 568 * Define the StyledString changed listener. 569 * 570 * @interface StyledStringChangedListener 571 * @syscap SystemCapability.ArkUI.ArkUI.Full 572 * @crossplatform 573 * @atomicservice 574 * @since 12 575 */ 576declare interface StyledStringChangedListener { 577 /** 578 * Called before text changed. 579 * 580 * @type { ?Callback<StyledStringChangeValue, boolean> } 581 * @syscap SystemCapability.ArkUI.ArkUI.Full 582 * @crossplatform 583 * @atomicservice 584 * @since 12 585 */ 586 onWillChange?: Callback<StyledStringChangeValue, boolean>; 587 588 /** 589 * Called after text changed. 590 * 591 * @type { ?OnDidChangeCallback } 592 * @syscap SystemCapability.ArkUI.ArkUI.Full 593 * @crossplatform 594 * @atomicservice 595 * @since 12 596 */ 597 onDidChange?: OnDidChangeCallback; 598} 599 600/** 601 * Define the StyledString changed value. 602 * 603 * @interface StyledStringChangeValue 604 * @syscap SystemCapability.ArkUI.ArkUI.Full 605 * @crossplatform 606 * @atomicservice 607 * @since 12 608 */ 609interface StyledStringChangeValue { 610 /** 611 * Range of the content to be replaced. 612 * 613 * @type { TextRange } 614 * @syscap SystemCapability.ArkUI.ArkUI.Full 615 * @crossplatform 616 * @atomicservice 617 * @since 12 618 */ 619 range: TextRange; 620 621 /** 622 * StyledString to replace. 623 * 624 * @type { StyledString } 625 * @syscap SystemCapability.ArkUI.ArkUI.Full 626 * @crossplatform 627 * @atomicservice 628 * @since 12 629 */ 630 replacementString: StyledString; 631 632 /** 633 * Preview StyledString 634 * 635 * @type { ?StyledString } 636 * @syscap SystemCapability.ArkUI.ArkUI.Full 637 * @crossplatform 638 * @atomicservice 639 * @since 12 640 */ 641 previewText?: StyledString; 642} 643 644/** 645 * Define the LayoutManager for querying layout information. 646 * 647 * @interface LayoutManager 648 * @syscap SystemCapability.ArkUI.ArkUI.Full 649 * @crossplatform 650 * @atomicservice 651 * @since 12 652 */ 653declare interface LayoutManager { 654 /** 655 * Get the line count. 656 * 657 * @returns { number } The line count value returned to the caller. 658 * @syscap SystemCapability.ArkUI.ArkUI.Full 659 * @crossplatform 660 * @atomicservice 661 * @since 12 662 */ 663 getLineCount(): number; 664 665 /** 666 * Get the glyph position at coordinate. 667 * 668 * @param { number } x - the positionX of typography. 669 * @param { number } y - the positionY of typography. 670 * @returns { PositionWithAffinity } TextBlob object. 671 * @syscap SystemCapability.ArkUI.ArkUI.Full 672 * @crossplatform 673 * @atomicservice 674 * @since 12 675 */ 676 getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity; 677 678 /** 679 * Get LineMetrics. 680 * 681 * @param { number } lineNumber - the number of line. 682 * @returns { LineMetrics } The line Metrics. 683 * @syscap SystemCapability.ArkUI.ArkUI.Full 684 * @crossplatform 685 * @atomicservice 686 * @since 12 687 */ 688 getLineMetrics(lineNumber: number): LineMetrics; 689 690 /** 691 * Get the rects for range. 692 * @param { TextRange } range - The range to set. 693 * @param { RectWidthStyle } widthStyle - Width style to set. 694 * @param { RectHeightStyle } heightStyle - Height style to set. 695 * @returns { Array<TextBox> } The rects for range. 696 * @syscap SystemCapability.ArkUI.ArkUI.Full 697 * @crossplatform 698 * @atomicservice 699 * @since 14 700 */ 701 getRectsForRange(range: TextRange, widthStyle: RectWidthStyle, heightStyle: RectHeightStyle): Array<TextBox>; 702} 703 704/** 705 * Position and affinity. 706 * 707 * @typedef PositionWithAffinity 708 * @syscap SystemCapability.ArkUI.ArkUI.Full 709 * @crossplatform 710 * @atomicservice 711 * @since 12 712 */ 713interface PositionWithAffinity { 714 /** 715 * Position of text. 716 * 717 * @type { number } 718 * @syscap SystemCapability.ArkUI.ArkUI.Full 719 * @crossplatform 720 * @atomicservice 721 * @since 12 722 */ 723 position: number; 724 725 /** 726 * Affinity of text. 727 * 728 * @type { Affinity } 729 * @syscap SystemCapability.ArkUI.ArkUI.Full 730 * @crossplatform 731 * @atomicservice 732 * @since 12 733 */ 734 affinity: Affinity; 735} 736 737/** 738 * Define the Affinity type. 739 * 740 * @typedef { import('../api/@ohos.graphics.text').default.Affinity } Affinity 741 * @syscap SystemCapability.ArkUI.ArkUI.Full 742 * @crossplatform 743 * @atomicservice 744 * @since 12 745 */ 746declare type Affinity = import('../api/@ohos.graphics.text').default.Affinity; 747 748/** 749 * Define the LineMetrics type. 750 * 751 * @typedef { import('../api/@ohos.graphics.text').default.LineMetrics } LineMetrics 752 * @syscap SystemCapability.ArkUI.ArkUI.Full 753 * @crossplatform 754 * @atomicservice 755 * @since 12 756 */ 757declare type LineMetrics = import('../api/@ohos.graphics.text').default.LineMetrics; 758 759/** 760 * Define the RectWidthStyle type. 761 * 762 * @typedef { import('../api/@ohos.graphics.text').default.RectWidthStyle } RectWidthStyle 763 * @syscap SystemCapability.ArkUI.ArkUI.Full 764 * @crossplatform 765 * @atomicservice 766 * @since 14 767 */ 768declare type RectWidthStyle = import('../api/@ohos.graphics.text').default.RectWidthStyle; 769 770/** 771 * Define the RectHeightStyle type. 772 * 773 * @typedef { import('../api/@ohos.graphics.text').default.RectHeightStyle } RectHeightStyle 774 * @syscap SystemCapability.ArkUI.ArkUI.Full 775 * @crossplatform 776 * @atomicservice 777 * @since 14 778 */ 779declare type RectHeightStyle = import('../api/@ohos.graphics.text').default.RectHeightStyle; 780 781/** 782 * Define the TextBox type. 783 * 784 * @typedef { import('../api/@ohos.graphics.text').default.TextBox } TextBox 785 * @syscap SystemCapability.ArkUI.ArkUI.Full 786 * @crossplatform 787 * @atomicservice 788 * @since 14 789 */ 790declare type TextBox = import('../api/@ohos.graphics.text').default.TextBox; 791 792 793/** 794 * Defines the cursor style 795 * 796 * @interface CaretStyle 797 * @syscap SystemCapability.ArkUI.ArkUI.Full 798 * @crossplatform 799 * @since 10 800 */ 801/** 802 * Defines the cursor style 803 * 804 * @interface CaretStyle 805 * @syscap SystemCapability.ArkUI.ArkUI.Full 806 * @crossplatform 807 * @atomicservice 808 * @since 11 809 */ 810interface CaretStyle { 811 /** 812 * Set the cursor width 813 * 814 * @type { ?Length } 815 * @syscap SystemCapability.ArkUI.ArkUI.Full 816 * @crossplatform 817 * @since 10 818 */ 819 /** 820 * Set the cursor width 821 * 822 * @type { ?Length } 823 * @syscap SystemCapability.ArkUI.ArkUI.Full 824 * @crossplatform 825 * @atomicservice 826 * @since 11 827 */ 828 width?: Length, 829 830 /** 831 * Set the cursor color 832 * 833 * @type { ?ResourceColor } 834 * @syscap SystemCapability.ArkUI.ArkUI.Full 835 * @crossplatform 836 * @since 10 837 */ 838 /** 839 * Set the cursor color 840 * 841 * @type { ?ResourceColor } 842 * @syscap SystemCapability.ArkUI.ArkUI.Full 843 * @crossplatform 844 * @atomicservice 845 * @since 11 846 */ 847 color?: ResourceColor, 848} 849 850/** 851 * Defines the TextMenuItemId. 852 * 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @crossplatform 855 * @atomicservice 856 * @since 12 857 */ 858declare class TextMenuItemId { 859 /** 860 * Init a TextMenuItemId with id. 861 * 862 * @param { ResourceStr } id - The id of the TextMenuItemId. 863 * @returns { TextMenuItemId } - Returns the TextMenuItemId object. 864 * @static 865 * @syscap SystemCapability.ArkUI.ArkUI.Full 866 * @crossplatform 867 * @atomicservice 868 * @since 12 869 */ 870 static of(id: ResourceStr): TextMenuItemId; 871 872 /** 873 * Judge if two TextMenuItemId are equal. 874 * 875 * @param { TextMenuItemId } id - id TextMenuItemId. 876 * @returns { boolean } 877 * @syscap SystemCapability.ArkUI.ArkUI.Full 878 * @crossplatform 879 * @atomicservice 880 * @since 12 881 */ 882 equals(id: TextMenuItemId): boolean; 883 884 /** 885 * Indicates the TextMenuItemId to copy and delete the currently selected text. 886 * 887 * @type { TextMenuItemId } 888 * @readonly 889 * @static 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @atomicservice 892 * @since 12 893 */ 894 static readonly CUT: TextMenuItemId; 895 896 /** 897 * Indicates the TextMenuItemId to copy the currently selected text to the clipboard. 898 * 899 * @type { TextMenuItemId } 900 * @readonly 901 * @static 902 * @syscap SystemCapability.ArkUI.ArkUI.Full 903 * @atomicservice 904 * @since 12 905 */ 906 static readonly COPY: TextMenuItemId; 907 908 /** 909 * Indicates the TextMenuItemId to copy the current contents of the clipboard into the text view. 910 * 911 * @type { TextMenuItemId } 912 * @readonly 913 * @static 914 * @syscap SystemCapability.ArkUI.ArkUI.Full 915 * @atomicservice 916 * @since 12 917 */ 918 static readonly PASTE: TextMenuItemId; 919 920 /** 921 * Indicates the TextMenuItemId to select all text in a text view. 922 * 923 * @type { TextMenuItemId } 924 * @readonly 925 * @static 926 * @syscap SystemCapability.ArkUI.ArkUI.Full 927 * @atomicservice 928 * @since 12 929 */ 930 static readonly SELECT_ALL: TextMenuItemId; 931 932 /** 933 * Indicates the TextMenuItemId for collaboration service menu items. 934 * 935 * @type { TextMenuItemId } 936 * @readonly 937 * @static 938 * @syscap SystemCapability.ArkUI.ArkUI.Full 939 * @atomicservice 940 * @since 12 941 */ 942 static readonly COLLABORATION_SERVICE: TextMenuItemId; 943 944 /** 945 * Indicates the TextMenuItemId to recognize the text in the picture and input it into the text view. 946 * 947 * @type { TextMenuItemId } 948 * @readonly 949 * @static 950 * @syscap SystemCapability.ArkUI.ArkUI.Full 951 * @atomicservice 952 * @since 12 953 */ 954 static readonly CAMERA_INPUT: TextMenuItemId; 955 956 /** 957 * Indicates the TextMenuItemId to help with text creation by invoking large models. 958 * 959 * @type { TextMenuItemId } 960 * @readonly 961 * @static 962 * @syscap SystemCapability.ArkUI.ArkUI.Full 963 * @atomicservice 964 * @since 13 965 */ 966 static readonly AI_WRITER: TextMenuItemId; 967 968 /** 969 * Indicates the TextMenuItemId to translate the selected content. 970 * 971 * @type { TextMenuItemId } 972 * @readonly 973 * @static 974 * @syscap SystemCapability.ArkUI.ArkUI.Full 975 * @atomicservice 976 * @since 15 977 */ 978 static readonly TRANSLATE: TextMenuItemId; 979} 980 981/** 982 * TextMenuItem 983 * 984 * @interface TextMenuItem 985 * @syscap SystemCapability.ArkUI.ArkUI.Full 986 * @crossplatform 987 * @atomicservice 988 * @since 12 989 */ 990declare interface TextMenuItem { 991 /** 992 * Customize what the menu displays. 993 * 994 * @type { ResourceStr } 995 * @syscap SystemCapability.ArkUI.ArkUI.Full 996 * @crossplatform 997 * @atomicservice 998 * @since 12 999 */ 1000 content: ResourceStr; 1001 /** 1002 * Customize the icon before the menu displays content. 1003 * 1004 * @type { ?ResourceStr } 1005 * @syscap SystemCapability.ArkUI.ArkUI.Full 1006 * @crossplatform 1007 * @atomicservice 1008 * @since 12 1009 */ 1010 icon?: ResourceStr; 1011 /** 1012 * Distinguish clicked menu content by Id. 1013 * 1014 * @type { TextMenuItemId } 1015 * @syscap SystemCapability.ArkUI.ArkUI.Full 1016 * @crossplatform 1017 * @atomicservice 1018 * @since 12 1019 */ 1020 id: TextMenuItemId; 1021 /** 1022 * Customize what the menu item shortcut displays. 1023 * 1024 * @type { ?ResourceStr } 1025 * @syscap SystemCapability.ArkUI.ArkUI.Full 1026 * @crossplatform 1027 * @atomicservice 1028 * @since 15 1029 */ 1030 labelInfo?: ResourceStr; 1031} 1032 1033/** 1034 * EditMenuOptions 1035 * 1036 * @interface EditMenuOptions 1037 * @syscap SystemCapability.ArkUI.ArkUI.Full 1038 * @crossplatform 1039 * @atomicservice 1040 * @since 12 1041 */ 1042declare interface EditMenuOptions { 1043 /** 1044 * Passes the default menu, invokes before every display to generate a menu for triggering click events. 1045 * 1046 * @param { Array<TextMenuItem> } menuItems - current default menu array. 1047 * @returns { Array<TextMenuItem> } - Return the menu after operations. 1048 * @syscap SystemCapability.ArkUI.ArkUI.Full 1049 * @crossplatform 1050 * @atomicservice 1051 * @since 12 1052 */ 1053 onCreateMenu(menuItems: Array<TextMenuItem>): Array<TextMenuItem>; 1054 /** 1055 * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior. 1056 * 1057 * @param { TextMenuItem } menuItem - current default menu. 1058 * @param { TextRange } range - current selected range. 1059 * @returns { boolean } - Return True, the event is consumed, false otherwise. 1060 * @syscap SystemCapability.ArkUI.ArkUI.Full 1061 * @crossplatform 1062 * @atomicservice 1063 * @since 12 1064 */ 1065 onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean; 1066} 1067 1068/** 1069 * Defines the font decoration result. 1070 * 1071 * @interface DecorationStyleResult 1072 * @syscap SystemCapability.ArkUI.ArkUI.Full 1073 * @crossplatform 1074 * @atomicservice 1075 * @since 12 1076 */ 1077interface DecorationStyleResult { 1078 /** 1079 * Font decoration type. 1080 * 1081 * @type { TextDecorationType } 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @crossplatform 1084 * @atomicservice 1085 * @since 12 1086 */ 1087 type: TextDecorationType; 1088 1089 /** 1090 * Font decoration color. 1091 * 1092 * @type { ResourceColor } 1093 * @syscap SystemCapability.ArkUI.ArkUI.Full 1094 * @crossplatform 1095 * @atomicservice 1096 * @since 12 1097 */ 1098 color: ResourceColor; 1099 1100 /** 1101 * The style value of the decoration property object. 1102 * 1103 * @type { ?TextDecorationStyle } 1104 * @syscap SystemCapability.ArkUI.ArkUI.Full 1105 * @crossplatform 1106 * @atomicservice 1107 * @since 12 1108 */ 1109 style?: TextDecorationStyle; 1110} 1111 1112/** 1113 * Defines the options of font. 1114 * 1115 * @interface FontSettingOptions 1116 * @syscap SystemCapability.ArkUI.ArkUI.Full 1117 * @crossplatform 1118 * @form 1119 * @atomicservice 1120 * @since 12 1121 */ 1122declare interface FontSettingOptions { 1123 /** 1124 * Define weather VariableFontWeight is supported. 1125 * 1126 * @type { ?boolean } 1127 * @syscap SystemCapability.ArkUI.ArkUI.Full 1128 * @crossplatform 1129 * @form 1130 * @atomicservice 1131 * @since 12 1132 */ 1133 enableVariableFontWeight?: boolean; 1134} 1135 1136 /** 1137 * The TextChangeOptions. 1138 * @interface TextChangeOptions 1139 * @syscap SystemCapability.ArkUI.ArkUI.Full 1140 * @crossplatform 1141 * @atomicservice 1142 * @since 15 1143 */ 1144 declare interface TextChangeOptions { 1145 /** 1146 * The selected area before the change. 1147 * 1148 * @type { TextRange } 1149 * @syscap SystemCapability.ArkUI.ArkUI.Full 1150 * @crossplatform 1151 * @atomicservice 1152 * @since 15 1153 */ 1154 rangeBefore: TextRange; 1155 1156 /** 1157 * The selected area after the change. 1158 * 1159 * @type { TextRange } 1160 * @syscap SystemCapability.ArkUI.ArkUI.Full 1161 * @crossplatform 1162 * @atomicservice 1163 * @since 15 1164 */ 1165 rangeAfter: TextRange; 1166 1167 /** 1168 * The content before the change. 1169 * 1170 * @type { string } 1171 * @syscap SystemCapability.ArkUI.ArkUI.Full 1172 * @crossplatform 1173 * @atomicservice 1174 * @since 15 1175 */ 1176 oldContent: string; 1177 1178 /** 1179 * The info of PreviewText before the change. 1180 * 1181 * @type { PreviewText } 1182 * @syscap SystemCapability.ArkUI.ArkUI.Full 1183 * @crossplatform 1184 * @atomicservice 1185 * @since 15 1186 */ 1187 oldPreviewText: PreviewText; 1188} 1189 1190/** 1191 * Define the editableText Component changed value. 1192 * 1193 * @interface EditableTextChangeValue 1194 * @syscap SystemCapability.ArkUI.ArkUI.Full 1195 * @crossplatform 1196 * @atomicservice 1197 * @since 15 1198 */ 1199interface EditableTextChangeValue { 1200 /** 1201 * Value of body text, without previewText value. 1202 * 1203 * @type { string } 1204 * @syscap SystemCapability.ArkUI.ArkUI.Full 1205 * @crossplatform 1206 * @atomicservice 1207 * @since 15 1208 */ 1209 content: string; 1210 1211 /** 1212 * Info of previewText, contains previewText value and start index. 1213 * 1214 * @type { ?PreviewText } 1215 * @syscap SystemCapability.ArkUI.ArkUI.Full 1216 * @crossplatform 1217 * @atomicservice 1218 * @since 15 1219 */ 1220 previewText?: PreviewText; 1221 1222 /** 1223 * The TextChangeOptions. 1224 * 1225 * @type { TextChangeOptions } 1226 * @syscap SystemCapability.ArkUI.ArkUI.Full 1227 * @crossplatform 1228 * @atomicservice 1229 * @since 15 1230 */ 1231 options?: TextChangeOptions; 1232} 1233 1234/** 1235 * Defines keyboard appearance. 1236 * 1237 * @enum { number } 1238 * @syscap SystemCapability.ArkUI.ArkUI.Full 1239 * @atomicservice 1240 * @since 15 1241 */ 1242declare enum KeyboardAppearance { 1243 /** 1244 * Default appearance mode, don't adopt immersive styles 1245 * 1246 * @syscap SystemCapability.ArkUI.ArkUI.Full 1247 * @atomicservice 1248 * @since 15 1249 */ 1250 NONE_IMMERSIVE = 0, 1251 1252 /** 1253 * Immersive mode 1254 * 1255 * @syscap SystemCapability.ArkUI.ArkUI.Full 1256 * @atomicservice 1257 * @since 15 1258 */ 1259 IMMERSIVE = 1, 1260 1261 /** 1262 * Light immersive style 1263 * 1264 * @syscap SystemCapability.ArkUI.ArkUI.Full 1265 * @atomicservice 1266 * @since 15 1267 */ 1268 LIGHT_IMMERSIVE = 2, 1269 1270 /** 1271 * Dark immersive style 1272 * 1273 * @syscap SystemCapability.ArkUI.ArkUI.Full 1274 * @atomicservice 1275 * @since 15 1276 */ 1277 DARK_IMMERSIVE = 3, 1278} 1279