/* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit ArkUI */ /*** if arkts 1.2 */ import { CancelButtonSymbolOptions, CancelButtonOptions } from "./search"; import { Callback, CommonMethod, TextContentControllerBase, SelectionOptions, InputCounterOptions, TextDecorationOptions, Optional } from "./common"; import { CustomBuilder } from './builder'; import { BarState, LineBreakStrategy, TextAlign, FontStyle, FontWeight, WordBreak, TextOverflow, CopyOptions, TextHeightAdaptivePolicy, TextContentStyle, EllipsisMode } from './enums'; import { Resource, ResourceStr, ResourceColor, Dimension, Font, Length } from './units'; import { InsertValue, DeleteValue, CaretStyle, EditableTextOnChangeCallback, EditMenuOptions, AutoCapitalizationMode,EditableTextChangeValue,KeyboardAppearance } from "./textCommon"; import { KeyboardOptions, PasteEvent } from "./richEditor"; /*** endif */ /** * Declare the type of input box * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Declare the type of input box * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Declare the type of input box * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare enum InputType { /** * Basic input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Basic input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Basic input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Normal, /** * Pure digital input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Pure digital input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Pure digital input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Number, /** * Phone number entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Phone number entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Phone number entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ PhoneNumber, /** * E-mail address input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * E-mail address input mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * E-mail address input mode. * *

NOTE: *
This mode accepts only digits, letters, underscores (_), dots (.), * and the following special characters: ! # $ % & ' " * + - / = ? ^ ` { | } ~ @ (which can only appear once) *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Email, /** * Password entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Password entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Password entry mode. * *

NOTE: *
An eye icon is used to show or hide the password. *
By default, the entered characters are temporarily shown before being obscured by dots; * they are directly obscured by dots since API version 12 on certain devices. *
The password input mode does not support underlines. *
If Password Vault is enabled, autofill is available for the username and password. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Password, /** * Number Password entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Number Password entry mode. * *

NOTE: *
An eye icon is used to show or hide the password. *
By default, the entered characters are temporarily shown before being obscured by dots; * they are directly obscured by dots since API version 12 on certain devices. *
The password input mode does not support underlines. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ NUMBER_PASSWORD = 8, /** * Screen Lock Password entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ SCREEN_LOCK_PASSWORD = 9, /** * UserName entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 11 */ /** * UserName entry mode. * *

NOTE: *
If Password Vault is enabled, autofill is available for the username and password. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ USER_NAME = 10, /** * NewPassword entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 11 */ /** * NewPassword entry mode. * *

NOTE: *
An eye icon is used to show or hide the password. *
By default, the entered characters are temporarily shown before being obscured by dots; * they are directly obscured by dots since API version 12 on certain devices. *
If Password Vault is enabled, a new password can be automatically generated. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ NEW_PASSWORD = 11, /** * Number decimal entry mode. * *

NOTE: *
The value can contain digits and one decimal point. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ NUMBER_DECIMAL = 12, /** * URL entry mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ URL = 13, /** * One time code mode. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 20 */ ONE_TIME_CODE = 14, } /** * Declare the type of input content * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare enum ContentType { /** * User name content type. * Password Vault, when enabled, can automatically save and fill in usernames. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ USER_NAME = 0, /** * Password content type. * Password Vault, when enabled, can automatically save and fill in passwords. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PASSWORD = 1, /** * New password content type. * Password Vault, when enabled, can automatically generate a new password. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ NEW_PASSWORD = 2, /** * Full street address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in full street addresses. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ FULL_STREET_ADDRESS = 3, /** * House number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in house numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ HOUSE_NUMBER = 4, /** * District address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in districts and counties. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ DISTRICT_ADDRESS = 5, /** * City address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in cities. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ CITY_ADDRESS = 6, /** * Province address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in provinces. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PROVINCE_ADDRESS = 7, /** * Country address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in countries. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ COUNTRY_ADDRESS = 8, /** * Person full name content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in full names. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PERSON_FULL_NAME = 9, /** * Person last name content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in last names. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PERSON_LAST_NAME = 10, /** * Person first name content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in first names. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PERSON_FIRST_NAME = 11, /** * Phone number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in phone numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PHONE_NUMBER = 12, /** * Phone country code content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in country codes. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PHONE_COUNTRY_CODE = 13, /** * Full phone number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in phone numbers with country codes. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ FULL_PHONE_NUMBER = 14, /** * Email address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in email addresses. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ EMAIL_ADDRESS = 15, /** * Bank card number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in bank card numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ BANK_CARD_NUMBER = 16, /** * ID card number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in ID card numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ ID_CARD_NUMBER = 17, /** * Nickname content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in nicknames. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ NICKNAME = 23, /** * Detail info without street content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in address information without street addresses. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ DETAIL_INFO_WITHOUT_STREET = 24, /** * Format address content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in standard addresses. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ FORMAT_ADDRESS = 25, /** * Passport number content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in passport numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ PASSPORT_NUMBER = 26, /** * Passport validity content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in passport validity periods. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ VALIDITY = 27, /** * Place of issue content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in the place of issue for passports. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ ISSUE_AT = 28, /** * Invoice organization content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in invoice titles. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ ORGANIZATION = 29, /** * Invoice tax id content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in tax IDs. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ TAX_ID = 30, /** * Address city and state content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in locations. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ ADDRESS_CITY_AND_STATE = 31, /** * Airline flight number content type. * Currently not supported for automatic saving and auto-filling. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ FLIGHT_NUMBER = 32, /** * License number for drivers content type. * Currently not supported for automatic saving and auto-filling. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ LICENSE_NUMBER = 33, /** * License file number for drivers content type. * Currently not supported for automatic saving and auto-filling. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ LICENSE_FILE_NUMBER = 34, /** * License plate for vehicles content type. * The scenario-based autofill feature, when enabled, * can automatically save and fill in license plate numbers. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ LICENSE_PLATE = 35, /** * Engine number for vehicles content type. * Currently not supported for automatic saving and auto-filling. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ ENGINE_NUMBER = 36, /** * License chassis number for vehicles content type. * Currently not supported for automatic saving and auto-filling. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ LICENSE_CHASSIS_NUMBER = 37 } /** * Declare the type of soft keyboard. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Declare the type of soft keyboard. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Declare the type of soft keyboard. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare enum EnterKeyType { /** * Go. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Go. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Go. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Go = 2, /** * Search. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Search. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Search. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Search = 3, /** * Send. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Send. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Send. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Send = 4, /** * Next. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Next. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Next. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Next = 5, /** * Done. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Done. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Done. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Done = 6, /** * Showed as 'previous' pattern. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Showed as 'previous' pattern. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ PREVIOUS = 7, /** * Showed as 'new line' pattern. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Showed as 'new line' pattern. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ NEW_LINE = 8, } /** * Defines the underline color width property. * * @interface UnderlineColor * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface UnderlineColor { /** * Typing underline color width property. * *

NOTE: *
If no value is specified or if the value specified is undefined, * null, or invalid, the default value is used. *

* * @type { ?(ResourceColor | undefined) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ typing?: ResourceColor | undefined; /** * Normal underline color width property. * *

NOTE: *
If no value is specified or if the value specified is undefined, * null, or invalid, the default value is used. *

* * @type { ?(ResourceColor | undefined) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ normal?: ResourceColor | undefined; /** * Error underline color width property. * *

NOTE: *
If no value is specified or if the value specified is undefined, * null, or invalid, the default value is used. *
This option changes the color used in the showCounter attribute * when the maximum number of characters is reached. *

* * @type { ?(ResourceColor | undefined) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ error?: ResourceColor | undefined; /** * Disable underline color width property. * *

NOTE: *
If no value is specified or if the value specified is undefined, * null, or invalid, the default value is used. *

* * @type { ?(ResourceColor | undefined) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ disable?: ResourceColor | undefined; } /** * Provides the method of keeping TextInput editable state when submitted. * * @interface SubmitEvent * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare interface SubmitEvent { /** * Keeps TextInput editable state when submitted * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ keepEditableState(): void; /** * Sets the current value of TextInput. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ text: string; } /** * Provides the method of switching the cursor position. * * @extends TextContentControllerBase * @since 8 */ /** * Provides the method of switching the cursor position. * * @extends TextContentControllerBase * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Provides the method of switching the cursor position. * * @extends TextContentControllerBase * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class TextInputController extends TextContentControllerBase { /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * constructor. * A constructor used to create a TextInputController object. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ constructor(); /** * Called when the position of the insertion cursor is set. * * @param { number } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the position of the insertion cursor is set. * * @param { number } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the position of the insertion cursor is set. * *

NOTE: *
If the value is less than 0, the value 0 is used. *
If the value exceeds the text length, the caret is placed at the end of the text. *

* * @param { number } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ caretPosition(value: number): void; /** * Text selection is achieved by specifying the start and end positions of the text. * * @param { number } selectionStart - The start position of the selected text. * @param { number } selectionEnd - The end position of the selected text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Text selection is achieved by specifying the start and end positions of the text. * * @param { number } selectionStart - The start position of the selected text. * @param { number } selectionEnd - The end position of the selected text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Text selection is achieved by specifying the start and end positions of the text. * *

NOTE: *
If selectionStart or selectionEnd is set to undefined, the value 0 will be used. *
If selectionMenuHidden is set to true or a 2-in-1 device is used, * calling setTextSelection does not display the context menu even when options is set to MenuPolicy.SHOW. *
If the selected text contains an emoji, * the emoji is selected when its start position is within the text selection range. *

* * @param { number } selectionStart - The start position of the selected text.The start position of text in the text box is 0. * @param { number } selectionEnd - The end position of the selected text. * @param { SelectionOptions } [options] - Indicates the options of the text selection.Default value is MenuPolicy.DEFAULT. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ setTextSelection(selectionStart: number, selectionEnd: number, options?: SelectionOptions): void; /** * Exit edit state. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Exit edit state. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ stopEditing(): void; } /** * Defines the options of TextInput. * * @interface TextInputOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the options of TextInput. * * @interface TextInputOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the options of TextInput. * * @interface TextInputOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare interface TextInputOptions { /** * The place holder text string. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * The place holder text string. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The place holder text string. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ placeholder?: ResourceStr; /** * Sets the current value of TextInput. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Sets the current value of TextInput. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the current value of TextInput. * *

NOTE: *
You are advised to bind the state variable to the text in real time through the onChange event, * so as to prevent display errors when the component is updated. *
Since API version 10, this parameter supports two-way binding through $$. *
Since API version 18, this parameter supports two-way binding through !!. *

* * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ text?: ResourceStr; /** * Called when the position of the insertion cursor is set. * * @type { ?TextInputController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the position of the insertion cursor is set. * * @type { ?TextInputController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the position of the insertion cursor is set. * * @type { ?TextInputController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ controller?: TextInputController; } /** * Text input style. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text input style. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Text input style. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare enum TextInputStyle { /** * Text input default style. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text input default style. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Text input default style. * *

NOTE: *
The caret width is fixed at 1.5 vp, * and the caret height is subject to the background height and font size of the selected text. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Default, /** * Text input inline style. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text input inline style. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Text input inline style. * *

NOTE: *
The background height of the selected text is the same as the height of the text box. *
This style is used in scenarios where editing and non-editing states are obvious, * for example, renaming in the file list view. *
The showError attribute is not supported for this style. *
This style does not allow for text dragging and dropping. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Inline } /** * Provides a single-line text input component interface. * * @interface TextInputInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Provides a single-line text input component interface. * * @interface TextInputInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Provides a single-line text input component interface. * * @interface TextInputInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ interface TextInputInterface { /** * Called when writing a single line of text. * * @param { TextInputOptions } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when writing a single line of text. * * @param { TextInputOptions } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when writing a single line of text. * * @param { TextInputOptions } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ (value?: TextInputOptions): TextInputAttribute; } /** * PasswordIcon object. * * @interface PasswordIcon * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * PasswordIcon object. * * @interface PasswordIcon * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ interface PasswordIcon { /** * Define the on icon source of PasswordIcon. * * @type { ?(string | Resource) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the on icon source of PasswordIcon. * *

NOTE: *
Icon that can be used to hide the password in password input mode. *
The string type can be used to load network images and local images. *

* * @type { ?(string | Resource) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ onIconSrc?: string | Resource; /** * Define the off icon source of PasswordIcon. * * @type { ?(string | Resource) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the off icon source of PasswordIcon. * *

NOTE: *
Icon that can be used to show the password in password input mode. *
The string type can be used to load network images and local images. *

* * @type { ?(string | Resource) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ offIconSrc?: string | Resource; } /** * Defines a TextInput callback when onSubmit. * * Anonymous Object Rectification. * @typedef { function } OnSubmitCallback * @param { EnterKeyType } enterKey - Input method Enter key type. * @param { SubmitEvent } event - The event submitted. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnSubmitCallback = (enterKey: EnterKeyType, event: SubmitEvent) => void; /** * Defines a TextInput callback when onTextSelectionChange. * * Anonymous Object Rectification. * @typedef { function } OnTextSelectionChangeCallback * @param { number } selectionStart - The starting position of the selected text, the starting position of the text is 0. * @param { number } selectionEnd - The end location of the selected text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnTextSelectionChangeCallback = (selectionStart: number, selectionEnd: number) => void; /** * Defines a TextInput callback when onContentScroll. * * Anonymous Object Rectification. * @typedef { function } OnContentScrollCallback * @param { number } totalOffsetX - The text is offset in px on the horizontal axis of the content area. * @param { number } totalOffsetY - The text is offset in px on the vertical axis of the content area. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnContentScrollCallback = (totalOffsetX: number, totalOffsetY: number) => void; /** * Defines a TextInput callback when onPaste. * * Anonymous Object Rectification. * @typedef { function } OnPasteCallback * @param { string } content - The text content of the paste. * @param { PasteEvent } event - User-defined paste event. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnPasteCallback = (content: string, event: PasteEvent) => void; /** * Defines the TextInput attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the TextInput attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the TextInput attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class TextInputAttribute extends CommonMethod { /** * Called when the input type is set. * * @param { InputType } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the input type is set. * * @param { InputType } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the input type is set. * * @param { InputType } value - Default value is InputType.Normal. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ type(value: InputType): TextInputAttribute; /** * Called when the content type is set. * * @param { ContentType } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ contentType(value: ContentType): TextInputAttribute; /** * Called when the color of the placeholder is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the color of the placeholder is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the color of the placeholder is set. * * @param { ResourceColor } value - Default value follows the theme.The default value on wearable devices is '#99ffffff'. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ placeholderColor(value: ResourceColor): TextInputAttribute; /** * Called when the overflow mode of the font is set. * *

NOTE: *
This attribute is only available for the inline input style. *
Text is clipped at the transition between words. *
To clip text in the middle of a word, set wordBreak to WordBreak.BREAK_ALL. *
TextOverflow.None produces the same effect as TextOverflow.Clip. *
Default value in non-editing state in the inline input style: TextOverflow.Ellipsis. *
Default value in editing state in the inline input style: TextOverflow.Clip. *
The TextInput component does not support the TextOverflow.MARQUEE mode. *
If TextOverflow.MARQUEE is set, the component automatically switches to TextOverflow.Ellipsis * for the non-editing state in the inline input style and TextOverflow.Clip * for the non-inline input style and the editing state in the inline input style. *

* * @param { TextOverflow } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ textOverflow(value: TextOverflow): TextInputAttribute; /** * Specify the indentation of the first line in a text-block. * * @param { Dimension } value - The length of text indent.Default value is 0. * @returns { TextInputAttribute } The attribute of the text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ textIndent(value: Dimension): TextInputAttribute; /** * Called when the font property of the placeholder is set. * * @param { Font } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font property of the placeholder is set. * * @param { Font } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font property of the placeholder is set. * *

NOTE: *
The 'HarmonyOS Sans' font and registered custom fonts are supported. *
The default value on wearable devices is 18fp. *

* * @param { Font } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ placeholderFont(value?: Font): TextInputAttribute; /** * Called when the type of soft keyboard input button is set. * * @param { EnterKeyType } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the type of soft keyboard input button is set. * * @param { EnterKeyType } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the type of soft keyboard input button is set. * * @param { EnterKeyType } value - Default value is EnterKeyType.Done. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ enterKeyType(value: EnterKeyType): TextInputAttribute; /** * Called when the color of the insertion cursor is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the color of the insertion cursor is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the color of the insertion cursor is set. * *

NOTE: *
Since API version 12, this API can be used to set the text handle color, which is the same as the caret color. *

* * @param { ResourceColor } value - Default value is '#007DFF'. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ caretColor(value: ResourceColor): TextInputAttribute; /** * Called when judging whether the text editing change finished. * *

NOTE: *
This API is deprecated since API version 8. *
You are advised to use onEditChange instead. *

* * @param { function } callback - The value true indicates that the text box is in the editing state. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 8 * @useinstead onEditChange */ onEditChanged(callback: (isEditing: boolean) => void): TextInputAttribute; /** * Called when judging whether the text editing change finished. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when judging whether the text editing change finished. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when judging whether the text editing change finished. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when judging whether the text editing change finished. * * Anonymous Object Rectification. * *

NOTE: *
The text box is in the editing state when it has the caret placed in it, * and is in the non-editing state otherwise. *
It returns true if the input operation is currently in progress. *

* * @param { Callback } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onEditChange(callback: Callback): TextInputAttribute; /** * Called when submitted. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when submitted. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when submitted. * * @param { function } callback - callback of the listened event. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when submitted. * * Anonymous Object Rectification. * @param { OnSubmitCallback } callback - Callback of the listened event. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onSubmit(callback: OnSubmitCallback): TextInputAttribute; /** * Called when the input of the input box changes. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the input of the input box changes. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the input of the input box changes. * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when the input of the input box changes. * *

NOTE: *
In this callback, if cursor operations are performed, you need to adjust the cursor logic * based on the previewText parameter to ensure it works seamlessly within the preview display scenario. *

* * @param { EditableTextOnChangeCallback } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onChange(callback: EditableTextOnChangeCallback): TextInputAttribute; /** * Called when the text selection changes. * * @param { function } callback - callback of the listened event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the text selection changes. * * @param { function } callback - callback of the listened event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when the text selection changes. * * Anonymous Object Rectification. * @param { OnTextSelectionChangeCallback } callback - Callback of the listened event. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onTextSelectionChange(callback: OnTextSelectionChangeCallback): TextInputAttribute; /** * Called when the content scrolls. * * @param { function } callback - callback of the listened event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the content scrolls. * * @param { function } callback - callback of the listened event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when the content scrolls. * * Anonymous Object Rectification. * @param { OnContentScrollCallback } callback - Callback of the listened event. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onContentScroll(callback: OnContentScrollCallback): TextInputAttribute; /** * Called when the input of maximum text length is set. * * @param { number } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the input of maximum text length is set. * * @param { number } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the input of maximum text length is set. * *

NOTE: *
If this attribute is not set or is set to an invalid value, the default value is used. *
If a decimal number is specified, the integer part is used. *

* * @param { number } value - Default value is Infinity, indicating that there is no upper limit on the number of characters that can be entered. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ maxLength(value: number): TextInputAttribute; /** * Called when the font color is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font color is set. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font color is set. * * @param { ResourceColor } value - The default value on wearable devices is '#dbffffff'. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontColor(value: ResourceColor): TextInputAttribute; /** * Called when the font size is set. * * @param { Length } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font size is set. * * @param { Length } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font size is set. * *

NOTE: *
If fontSize is of the number type, the unit fp is used. *
The default font size is 16 fp. *
The value cannot be a percentage. *
The default value on wearable devices is 18fp. *

* * @param { Length } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontSize(value: Length): TextInputAttribute; /** * Called when the font style of a font is set. * * @param { FontStyle } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font style of a font is set. * * @param { FontStyle } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font style of a font is set. * * @param { FontStyle } value - Default value is FontStyle.Normal. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontStyle(value: FontStyle): TextInputAttribute; /** * Called when the font weight is set. * * @param { number | FontWeight | string } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font weight is set. * * @param { number | FontWeight | string } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font weight is set. * *

NOTE: *
If the value is too large, the text may be clipped depending on the font. *
For the number type, the value range is [100, 900], at an interval of 100. *
The default value is 400. *
A larger value indicates a heavier font weight. *
For the string type, only strings that represent a number, for example, "400", * and the following enumerated values of FontWeight are supported: "bold", "bolder", "lighter", "regular", and "medium". *

* * @param { number | FontWeight | string } value - Default value is FontWeight.Normal. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when the font weight is set. * * @param { number | FontWeight | ResourceStr } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.1&1.2 */ fontWeight(value: number | FontWeight | ResourceStr): TextInputAttribute; /** * Called when the font list of text is set. * * @param { ResourceStr } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the font list of text is set. * * @param { ResourceStr } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the font list of text is set. * *

NOTE: *
Default font: 'HarmonyOS Sans' *
The 'HarmonyOS Sans' font and registered custom fonts are supported for applications. *
Only the 'HarmonyOS Sans' font is supported for widgets. *

* * @param { ResourceStr } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontFamily(value: ResourceStr): TextInputAttribute; /** * Called when the inputFilter of text is set. * * @param { ResourceStr } value * @param { function } error * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the inputFilter of text is set. * * @param { ResourceStr } value * @param { function } error * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the inputFilter of text is set. * * @param { ResourceStr } value * @param { function } error * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when the inputFilter of text is set. * * Anonymous Object Rectification. * *

NOTE: *
Only inputs that comply with the regular expression can be displayed. *
Other inputs are filtered out. *
The specified regular expression can match single characters, but not strings. *
Since API version 11, if inputFilter is set and the entered characters are not null, * the filtering effect attached to the text box type (specified through the type attribute) does not take effect. *

* * @param { ResourceStr } value * @param { Callback } [error] * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ inputFilter(value: ResourceStr, error?: Callback): TextInputAttribute; /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when using the Clipboard menu. * * Anonymous Object Rectification. * @param { Callback } callback - Callback used to return the copied text content. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onCopy(callback: Callback): TextInputAttribute; /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when using the Clipboard menu. * * Anonymous Object Rectification. * @param { Callback } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onCut(callback: Callback): TextInputAttribute; /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when using the Clipboard menu * * @param { function } callback * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when using the Clipboard menu * * @param { function } callback * Executed when a paste operation is performed. * { string } value - The text content to be pasted. * { PasteEvent } event - The user-defined paste event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when using the Clipboard menu. * * Anonymous Object Rectification. * @param { OnPasteCallback } callback - Executed when a paste operation is performed. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onPaste(callback: OnPasteCallback): TextInputAttribute; /** * Called when the copy option is set. * * @param { CopyOptions } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when the copy option is set. * * @param { CopyOptions } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the copy option is set. * *

NOTE: *
If this attribute is set to CopyOptions.None, the text can only be pasted; * all other actions, such as copying, cutting, and sharing, are disabled. *
Dragging is not allowed when CopyOptions.None is set. *

* * @param { CopyOptions } value - Default value is CopyOptions.LocalDevice. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ copyOption(value: CopyOptions): TextInputAttribute; /** * Called when the password show/hide icon is set. * * @param { boolean } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when the password show/hide icon is set. * * @param { boolean } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the password show/hide icon is set. * *

NOTE: *
This API has effect only when the input type is set to Password, * NEWPASSWORD, or NUMBERPASSWORD mode. It does not work in other modes. *
When in password mode, there may be inconsistency between the backend state of the text box * and the frontend application's state management variables. *
This can cause issues with the icon at the end of the password text box. *
To avoid such issues, use the onSecurityStateChange callback to sync the states. *

* * @param { boolean } value - Default value is false. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ showPasswordIcon(value: boolean): TextInputAttribute; /** * Called when the text align is set. * * @param { TextAlign } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when the text align is set. * * @param { TextAlign } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the text align is set. * *

NOTE: *
Available options are TextAlign.Start, TextAlign.Center, and TextAlign.End. *
To set vertical alignment for the text, use the align attribute. *
The align attribute alone does not control the horizontal position of the text. *
In other words, Alignment.TopStart, Alignment.Top, and Alignment.TopEnd produce the same effect, top-aligning the text; * Alignment.Start, Alignment.Center, and Alignment.End produce the same effect, centered-aligning the text vertically; * Alignment.BottomStart, Alignment.Bottom, and Alignment.BottomEnd produce the same effect, bottom-aligning the text. *

* * @param { TextAlign } value - Default value is TextAlign.Start. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ textAlign(value: TextAlign): TextInputAttribute; /** * Text input style * * @param { TextInputStyle | TextContentStyle } value - Text input style * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Text input style * * @param { TextInputStyle | TextContentStyle } value - Text input style * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Text input style * *

NOTE: *
The inline input style only supports InputType.Normal. *

* * @param { TextInputStyle | TextContentStyle } value - Text input style.Default value is TextInputStyle.Default. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ style(value: TextInputStyle | TextContentStyle): TextInputAttribute; /** * Define the caret style of the text input * * @param { CaretStyle } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Define the caret style of the text input * * @param { CaretStyle } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ caretStyle(value: CaretStyle): TextInputAttribute; /** * Define the text selected background color of the text input. * * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Define the text selected background color of the text input. * *

NOTE: *
If the opacity is not set, a 20% opacity will be used. *

* * @param { ResourceColor } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ selectedBackgroundColor(value: ResourceColor): TextInputAttribute; /** * Define the caret position of the text input. * * @param { number } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Define the caret position of the text input. * * @param { number } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ caretPosition(value: number): TextInputAttribute; /** * Sets whether request keyboard or not when on focus. * * @param { boolean } value * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets whether request keyboard or not when on focus. * Sets whether to enable the input method when the TextInput component obtains focus in a way other than clicking. * *

NOTE: *
Since API version 10, the TextInput component brings up the keyboard by default when it obtains focus. *

* * @param { boolean } value - Default value is true. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ enableKeyboardOnFocus(value: boolean): TextInputAttribute; /** * Define the password icon of the text input. * * @param { PasswordIcon } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the password icon of the text input. * *

NOTE: *
Images in JPG, PNG, BMP, HEIC, and WEBP formats are supported. *
By default, the system-provided icon is used. *
The icon size is fixed at 24 vp (or 28 vp on wearable devices), regardless of the source image size. *

* * @param { PasswordIcon } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ passwordIcon(value: PasswordIcon): TextInputAttribute; /** * Define the show error of the text input. * * @param { string | undefined } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the show error of the text input. * * @param { string | undefined } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Define the show error of the text input. * *

NOTE: *
On wearable devices, the error message is displayed at a font size of 13 fp and center-aligned. *
If the data type is ResourceStr and the input content does not comply with specifications, the error message is displayed. *
If the error message does not fit in one line, an ellipsis (…) is displayed to represent clipped text. *
If the data type is undefined, no error message is displayed. *
By default, no error message is displayed. *

* * @param { ResourceStr | undefined } [value] * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ showError(value?: ResourceStr | undefined): TextInputAttribute; /** * Define the show unit of the text input. * * @param { CustomBuilder } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the show unit of the text input. * *

NOTE: *
This attribute effective only when showUnderline is set to true. *

* * @param { CustomBuilder } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ showUnit(value: CustomBuilder): TextInputAttribute; /** * Define the show underline of the text input. * * @param { boolean } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define the show underline of the text input. * *

NOTE: *
By default, the underline comes in the color of '#33182431', thickness of 1 px, and text box size of 48 vp. *
The underline is only available for the InputType.Normal type. *

* * @param { boolean } value - Default value is false. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ showUnderline(value: boolean): TextInputAttribute; /** * Define the underline color of the text input. * *

NOTE: *
The underline color changes with the underline mode. *
If the underline color is only set for the normal state, you can directly enter a value of the ResourceColor type. *
If the value specified is undefined, null, or invalid, all underlines are restored to the default value. *
Default value: underline color configured for the theme, which is #33182431 by default. *

* * @param { ResourceColor | UnderlineColor | undefined } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ underlineColor(value: ResourceColor | UnderlineColor | undefined): TextInputAttribute; /** * Controls whether the selection menu pops up. * * @param { boolean } value * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Controls whether the selection menu pops up. * *

NOTE: *
true: *
The system text selection menu does not appear under the following circumstances: * clicking the text box cursor, long-pressing the text box, double-tapping the text box, * triple-tapping the text box, or right-clicking the text box. *
false: *
The system text selection menu appears under the following circumstances: * clicking the text box cursor, long-pressing the text box, double-tapping the text box, * triple-tapping the text box, or right-clicking the text box. *

* * @param { boolean } value - Default value is false. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ selectionMenuHidden(value: boolean): TextInputAttribute; /** * Define bar state of the text input. * * @param { BarState } value * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define bar state of the text input. * * @param { BarState } value - Default value is BarState.Auto. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ barState(value: BarState): TextInputAttribute; /** * Define max lines of the text input. * * @param { number } value * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define max lines of the text input. * Value range: (0, +∞) * * @param { number } value - Default value is 3. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ maxLines(value: number): TextInputAttribute; /** * Set the text inline style word break type. * *

NOTE: *
This attribute is effective for the inline input style, * but does not apply to the placeholder text. *
The component does not support the clip attribute. *
Therefore, setting this attribute does not affect text clipping. *

* * @param { WordBreak } value - The word break type.Default value is WordBreak.BREAK_WORD. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ wordBreak(value: WordBreak): TextInputAttribute; /** * Set the text line break strategy type. * *

NOTE: *
This attribute takes effect when wordBreak is not set to breakAll. *
Hyphens are not supported. *
This attribute does not take effect for the non-inline input style. *

* * @param { LineBreakStrategy } strategy - The text line break strategy type.Default value is LineBreakStrategy.GREEDY. * @returns { TextInputAttribute } The attribute of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ lineBreakStrategy(strategy: LineBreakStrategy): TextInputAttribute; /** * Define custom keyboard of the text input. * * @param { CustomBuilder } value * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define custom keyboard of the text input. * * @param { CustomBuilder } value * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Define custom keyboard of the text input. * *

NOTE: *
When a custom keyboard is set, activating the text box opens the specified custom component, * instead of the system input method. *
The custom keyboard's height can be set through the height attribute of the custom component's root node, * and its width is fixed at the default value. *
The custom keyboard is presented by overlaying the original screen, * which is not compressed or lifted if avoid mode is not enabled or avoidance is not needed for the text box. *
The custom keyboard cannot obtain the focus, but it blocks gesture events. *
By default, the custom keyboard is closed when the input component loses the focus. *
You can also use the TextInputController.stopEditing API to close the keyboard. *
When a custom keyboard is set, the text box does not support camera input, even when the device supports. *
When setting a custom keyboard, you can bind the onKeyPrelme event to prevent input from the physical keyboard. *

* * @param { CustomBuilder } value - Set up a custom keyboard of TextInput * @param { KeyboardOptions } [options] - Indicates the custom keyboard options of TextInput * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ customKeyboard(value: CustomBuilder, options?: KeyboardOptions): TextInputAttribute; /** * Show the counter when the number of characters entered exceeds the threshold through InputCounterOptions. * *

NOTE: *
options can be set only when value is set to true, in which case a character counter is displayed below the text box. *
This attribute must be used together with maxLength. *
The character counter is displayed in this format: Number of characters entered/Character limit. *
It is visible when the number of characters entered is greater than the character limit multiplied by the threshold percentage value. *
If options is not set, the text box border and character counter subscript turn red * when the number of characters entered exceeds the limit. *
If value is set to true and options is set, the text box border and character counter subscript turn red * and the text box shakes when the number of characters entered reaches the limit, * provided that the value of thresholdPercentage is valid. *
If highlightBorder is set to false, the text box border does not turn red. *
By default, highlightBorder is set to true. *
The character counter is not displayed for text boxes in inline or password input style. *

* * @param { boolean } value - Set showcounter of the text input. * @param { InputCounterOptions } options - Set the percentage of counter. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ showCounter(value: boolean, options?: InputCounterOptions): TextInputAttribute; /** * Set the cancel button style * * @param { object } value - indicates the style of the cancel button. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Set the cancel button style * * @param { object } value - indicates the style of the cancel button. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ /** * Set the cancel button style. * * Anonymous Object Rectification. * *

NOTE: *
This attribute is not available for the inline input style. *
The default value is 28fp on wearable devices. *

* * @param { CancelButtonOptions } options - Indicates the style of the cancel button.Default value is { style: CancelButtonStyle.INPUT }. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ cancelButton(options: CancelButtonOptions): TextInputAttribute; /** * Set the cancel button style * *

NOTE: *
This attribute is not available for the inline input style. *

* * @param { CancelButtonSymbolOptions } symbolOptions - indicates the style of the cancel button.Default value is { style: CancelButtonStyle.INPUT }. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ cancelButton(symbolOptions: CancelButtonSymbolOptions): TextInputAttribute; /** * Set the cancel button style * * @param { CancelButtonOptions | CancelButtonSymbolOptions } symbolOptions - indicates the style of the cancel button. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ cancelButton(symbolOptions: CancelButtonOptions | CancelButtonSymbolOptions): TextInputAttribute; /** * Sets selection when on focus. * * @param { boolean } value - Sets selection or not. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Sets selection when on focus. * *

NOTE: *
This attribute is not available for the inline input style. *

* * @param { boolean } value - Sets selection or not.Default value is false. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ selectAll(value: boolean): TextInputAttribute; /** * Called when the minimum font size of the font is set. * *

NOTE: *
For the string type, numeric string values with optional units, * for example, "10" or "10fp", are supported. *
For the setting to take effect, this attribute must be used together with maxFontSize * and maxLines (when the component is in editing state in the inline input style), or layout constraint settings. *
When the adaptive font size is used, the fontSize settings do not take effect. *

* * @param { number | string | Resource } value - The unit is fp. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ minFontSize(value: number | string | Resource): TextInputAttribute; /** * Called when the maximum font size of the font is set. * *

NOTE: *
For the string type, numeric string values with optional units, * for example, "10" or "10fp", are supported. *
For the setting to take effect, this attribute must be used together with minFontSize * and maxLines (when the component is in editing state in the inline input style), or layout constraint settings. *
When the adaptive font size is used, the fontSize settings do not take effect. *

* * @param { number | string | Resource } value - The unit is fp. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ maxFontSize(value: number | string | Resource): TextInputAttribute; /** * Called when the minimum font scale of the font is set. * * @param { Optional } scale * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ /** * Called when the minimum font scale of the font is set. * * @param { Optional } scale * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.1&1.2 */ minFontScale(scale: Optional): TextInputAttribute; /** * Called when the maximum font scale of the font is set. * * @param { Optional } scale * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ /** * Called when the maximum font scale of the font is set. * * @param { Optional } scale * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.1&1.2 */ maxFontScale(scale: Optional): TextInputAttribute; /** * Called when the height adaptive policy is set. * *

NOTE: *

    *
  • When this attribute is set to TextHeightAdaptivePolicy.MAX_LINES_FIRST, * the maxLines attribute takes precedence for adjusting the text height. *
    If the maxLines setting results in a layout beyond the layout constraints, * the text will shrink to a font size between minFontSize and maxFontSize to allow for more content to be shown.
  • *
  • If this attribute is set to TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST, * the minFontSize attribute takes precedence for adjusting the text height. *
    If the text can fit in one line with the minFontSize setting, * the text will enlarge to the largest possible font size between minFontSize and maxFontSize.
  • *
  • TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST produces the same effect as TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST.
  • *
*
When the component is in the non-inline input style, the three values of TextHeightAdaptivePolicy have the same effect, * that is, the text will shrink to a font size between minFontSize and maxFontSize to allow for more content to be shown. *
If the text box is in inline input style, * the font size in the editing state is different from that in the non-editing state. *

* * @param { TextHeightAdaptivePolicy } value - The height adaptive policy.Default value is TextHeightAdaptivePolicy.MAX_LINES_FIRST. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ heightAdaptivePolicy(value: TextHeightAdaptivePolicy): TextInputAttribute; /** * Sets whether enable auto fill or not. * * @param { boolean } value - Indicates the flag whether autofill is enabled. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 11 */ /** * Sets whether enable auto fill or not. * * @param { boolean } value - Indicates the flag whether autofill is enabled.Default value is rue.True: enable, false: disable. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ enableAutoFill(value: boolean): TextInputAttribute; /** * Called when the text decoration of the text is set. * *

NOTE: *
This attribute does not take effect for the password input mode. *

* * @param { TextDecorationOptions } value - Default value is { type: TextDecorationType.None, color: Color.Black, style: TextDecorationStyle.SOLID }. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ decoration(value: TextDecorationOptions): TextInputAttribute; /** * Called when the distance between text fonts is set. * *

NOTE: *
If the value specified is a percentage or 0, the default value is used. *
For the string type, numeric string values with optional units, * for example, "10" or "10fp", are supported. *
If the value specified is a negative value, the text is compressed. *
A negative value too small may result in the text being compressed to 0 * and no content being displayed. *

* * @param { number | string | Resource } value - The unit is fp. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ letterSpacing(value: number | string | Resource): TextInputAttribute; /** * Called when the line height of the font is set. * *

NOTE: *
If the value is less than or equal to 0, the line height is not limited and the font size is adaptive. *
If the value is of the number type, the unit fp is used. *
For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. *

* * @param { number | string | Resource } value * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ lineHeight(value: number | string | Resource): TextInputAttribute; /** * Define the password rules of the text input. * * @param { string } value - Indicates the password rules. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 11 */ /** * Define the password rules of the text input. * *

NOTE: *
When autofill is used, these rules are transparently transmitted to Password Vault for generating a new password. *

* * @param { string } value - Indicates the password rules. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ passwordRules(value: string): TextInputAttribute; /** * Set font feature. * *

NOTE: *
This attribute is not available when type is set to an enum value that indicates the password input mode, * such as Password, NEW_PASSWORD, or NUMBER_PASSWORD. *

* * @param { string } value - The fontFeature. * normal | , * where = [ | on | off ], like: "ss01" 0 * the values of reference to doc of TextInput component * number of can be single or multiple, and separated by comma ','. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ fontFeature(value: string): TextInputAttribute; /** * Define the password visible mode of the text input. * *

NOTE: *
This API has effect only when the input type is set to Password, NEWPASSWORD, or NUMBERPASSWORD mode. *
It does not work in other modes. *
When in password mode, there may be inconsistency between the backend state of the text box * and the frontend application's state management variables. *
This can cause issues with the icon at the end of the password text box. *
To avoid such issues, use the onSecurityStateChange callback to sync the states. *

* * @param { boolean } visible - Indicates the password visible mode. Default value is false. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ showPassword(visible: boolean): TextInputAttribute; /** * Called when changing the password visible mode of the text input. * * @param { Callback } callback - callback of the password visible mode change event. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onSecurityStateChange(callback: Callback): TextInputAttribute; /** * Get text value information when about to input. * *

NOTE: *
It returns true if the text is inserted; returns false otherwise. *
This callback is not triggered for pre-edit or candidate word operations. *
It is available only for system input methods. *

* * @param { Callback } callback - The triggered function when text content is about to insert. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onWillInsert(callback: Callback): TextInputAttribute; /** * Get text value information when completed input. * *

NOTE: *
It is available only for system input methods. *

* * @param { Callback } callback - The triggered function when text content has been inserted. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onDidInsert(callback: Callback): TextInputAttribute; /** * Get text value information when about to delete. * *

NOTE: *
It returns true if the text is deleted; returns false otherwise. *
This callback is not called for text preview. *
It is available only for system input methods. *

* * @param { Callback } callback - The triggered function when text content is about to delete. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onWillDelete(callback: Callback): TextInputAttribute; /** * Get text value information when the deletion has been completed * *

NOTE: *
It is available only for system input methods. *

* * @param { Callback } callback - The triggered function when text content has been deleted. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onDidDelete(callback: Callback): TextInputAttribute; /** * Called before the text input component attach the InputMethod. * * @param { Callback } callback - The triggered function before attach the InputMethod. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ onWillAttachIME(callback: Callback): TextInputAttribute; /** * Set the custom text menu. * Sets the extended options of the custom context menu on selection, * including the text content, icon, and callback. * * @param { EditMenuOptions } editMenu - Customize text menu options. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ editMenuOptions(editMenu: EditMenuOptions): TextInputAttribute; /** * Define the preview text mode of the text input. * *

NOTE: *
Preview text is in a temporary state and does not support text interception. *
As such, it does not trigger onWillInsert, onDidInsert, onWillDelete, or onDidDelete callbacks. *

* * @param { boolean } enable - Indicates the preview text mode.Default value is true. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ enablePreviewText(enable: boolean): TextInputAttribute; /** * Enable or disable haptic feedback. * * @param { boolean } isEnabled - Default value is true, set false to disable haptic feedback. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'13','1.2':'20'} * @arkts 1.1&1.2 */ enableHapticFeedback(isEnabled: boolean): TextInputAttribute; /** * Set text mode of automatic case mode switching. * * @param { AutoCapitalizationMode } mode - Automatic case mode switching. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.1&1.2 */ autoCapitalizationMode(mode: AutoCapitalizationMode): TextInputAttribute; /** * Set the text with half leading. * * @param { Optional } halfLeading * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ halfLeading(halfLeading: Optional): TextInputAttribute; /** * Set the ellipsis mode. * * @param { Optional } mode - The ellipsis mode. * @returns { TextInputAttribute } The attribute of TextInput. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ ellipsisMode(mode: Optional): TextInputAttribute; /** * Set whether stop backPressed callback event or not. * * @param { Optional } isStopped - Default value is true, set false to trigger the latest callback event. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ stopBackPress(isStopped: Optional): TextInputAttribute; /** * Get text value information when about to change. * * @param { Callback } callback - The triggered function when text content is about to change. * @returns { TextInputAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ onWillChange(callback: Callback): TextInputAttribute; /** * Set the keyboard appearance. * * @param { Optional } appearance - Default value is KeyboardAppearance.NONE_IMMERSIVE * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ keyboardAppearance(appearance: Optional): TextInputAttribute; /** * Set the stroke width. * * @param { Optional } width - indicates the stroke width. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ strokeWidth(width: Optional): TextInputAttribute; /** * Set the stroke color. * * @param { Optional } color - indicates the stroke color. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ strokeColor(color: Optional): TextInputAttribute; /** * Sets whether enable auto fill animation effect or not. * * @param { Optional } enabled - Indicates the flag whether auto fill animation effect is enabled. * @returns { TextInputAttribute } Returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 20 */ enableAutoFillAnimation(enabled: Optional): TextInputAttribute; /** * Whether to enable automatic spacing between Chinese and Latin characters. * * @param { Optional } enabled - The default value is false, indicates the flag whether to enable automatic spacing. * @returns { TextInputAttribute } returns the instance of the TextInputAttribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ enableAutoSpacing(enabled: Optional): TextInputAttribute; } /** * Defines TextInput Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines TextInput Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines TextInput Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ declare const TextInput: TextInputInterface; /** * Defines TextInput Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines TextInput Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines TextInput Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ declare const TextInputInstance: TextInputAttribute;