diff --git a/CODEOWNERS b/CODEOWNERS index c07dcbcb07683ecb03d698d85d0c99d91107d5e9..0cc5520e8da6a6006fb978bdb1c9c9058fab86ef 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -256,12 +256,12 @@ zh-cn/application-dev/reference/apis/js-apis-hidebug.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-hilog.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-hitracechain.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md @zengyawen -zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @sun-yue14 -zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @sun-yue14 +zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @ge-yafang -zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @sun-yue14 -zh-cn/application-dev/reference/apis/js-apis-system-time.md @sun-yue14 -zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @sun-yue14 +zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-system-time.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-timer.md @HelloCrease zh-cn/application-dev/reference/apis/js-apis-battery-info.md @sun-yue14 zh-cn/application-dev/reference/apis/js-apis-brightness.md @sun-yue14 diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index 5f1daa3d0ca5b492e4c5c9b8ce057f3b46966451..724e8d767f52bf38a43530f57550eaf8825f7271 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -3,13 +3,10 @@ Lightweight storage provides applications with data processing capability and allows applications to perform lightweight data storage and query. Data is stored in key-value (KV) pairs. Keys are of the string type, and values can be of the number, string, or Boolean type. -> **NOTE**
+> **NOTE** > -> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> - The APIs of this module are no longer maintained since API Version 9. You are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). -> -> - The APIs of this module can be used only in the FA model. +> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md index 06d2731b53f9e803be6cb72a60f63076f595c4f8..424273bb6749b2884edd63882135912715150b36 100644 --- a/en/application-dev/reference/apis/js-apis-i18n.md +++ b/en/application-dev/reference/apis/js-apis-i18n.md @@ -2,10 +2,10 @@ This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. -The [Intl](intl-guidelines.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities. +The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities. > **NOTE** -> +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -26,16 +26,16 @@ Obtains the localized script for the specified language. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------------ | ------- | ---- | ---------------- | -| language | string | Yes | Specified language. | -| locale | string | Yes | Locale ID. | -| sentenceCase | boolean | No | Whether to use sentence case for the localized script.| +| Name | Type | Mandatory | Description | +| ------------ | ------- | --------- | ---------------------------------------- | +| language | string | Yes | Specified language. | +| locale | string | Yes | Locale ID. | +| sentenceCase | boolean | No | Whether to use sentence case for the localized script. | **Return Value** -| Type | Description | -| ------ | ------------- | -| string | Localized script for the specified language.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Localized script for the specified language. | **Example** ``` @@ -53,16 +53,16 @@ Obtains the localized script for the specified country. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------------ | ------- | ---- | ----------------------------- | -| country | string | Yes | Specified country. | -| locale | string | Yes | Locale ID. | -| sentenceCase | boolean | No | Whether to use sentence case for the localized script.| +| Name | Type | Mandatory | Description | +| ------------ | ------- | --------- | ---------------------------------------- | +| country | string | Yes | Specified country. | +| locale | string | Yes | Locale ID. | +| sentenceCase | boolean | No | Whether to use sentence case for the localized script. | **Return Value** -| Type | Description | -| ------ | ------------------------------------------ | -| string | Localized script for the specified country.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Localized script for the specified country. | **Example** ``` @@ -85,9 +85,9 @@ Checks whether the localized script for the specified language is displayed from | locale | string | Locale ID. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise.| +| boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise. | **Example** ``` @@ -105,9 +105,9 @@ Obtains the system language. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------- | -| string | System language ID.| +| Type | Description | +| ------ | ------------------- | +| string | System language ID. | **Example** ``` @@ -130,14 +130,14 @@ Sets the system language. Currently, this API does not support real-time updatin **System API**: This is a system API and cannot be called by third-party applications. **Parameters** -| Name | Type | Description | -| -------- | ------ | ----- | -| language | string | Language ID.| +| Name | Type | Description | +| -------- | ------ | ------------ | +| language | string | Language ID. | **Return Value** -| Type | Description | -| ------- | ------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ``` @@ -156,9 +156,9 @@ Obtains the list of system languages. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------------------- | ------------ | -| Array<string> | List of the IDs of system languages.| +| Type | Description | +| ------------------- | ------------------------------------ | +| Array<string> | List of the IDs of system languages. | **Example** ``` @@ -177,14 +177,14 @@ Obtains the list of countries and regions supported for the specified language. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Description | -| -------- | ------ | ----- | -| language | string | Language ID.| +| Name | Type | Description | +| -------- | ------ | ------------ | +| language | string | Language ID. | **Return Value** -| Type | Description | -| ------------------- | ------------ | -| Array<string> | List of the IDs of the countries and regions supported for the specified language.| +| Type | Description | +| ------------------- | ---------------------------------------- | +| Array<string> | List of the IDs of the countries and regions supported for the specified language. | **Example** ``` @@ -201,9 +201,9 @@ Obtains the system region. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------- | -| string | System region ID.| +| Type | Description | +| ------ | ----------------- | +| string | System region ID. | **Example** ``` @@ -224,14 +224,14 @@ Sets the system region. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Description | -| ------ | ------ | ----- | -| region | string | Region ID.| +| Name | Type | Description | +| ------ | ------ | ----------- | +| region | string | Region ID. | **Return Value** -| Type | Description | -| ------- | ------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ``` @@ -248,9 +248,9 @@ Obtains the system locale. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------- | -| string | System locale ID.| +| Type | Description | +| ------ | ----------------- | +| string | System locale ID. | **Example** ``` @@ -271,14 +271,14 @@ Sets the system locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Description | -| ------ | ------ | --------------- | -| locale | string | System locale ID, for example, **zh-CN**.| +| Name | Type | Description | +| ------ | ------ | ---------------------------------------- | +| locale | string | System locale ID, for example, **zh-CN**. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| +| boolean | Returns **true** if the operation is successful; returns **false** otherwise. | **Example** ``` @@ -297,15 +297,15 @@ Checks whether the system language matches the specified region. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------ | ---- | ------------- | -| language | string | Yes | Valid language ID, for example, **zh**.| -| region | string | No | Valid region ID, for example, **CN**. | +| Name | Type | Mandatory | Description | +| -------- | ------ | --------- | --------------------------------------- | +| language | string | Yes | Valid language ID, for example, **zh**. | +| region | string | No | Valid region ID, for example, **CN**. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise.| +| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise. | **Example** ``` @@ -322,15 +322,15 @@ Obtains a **Calendar** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------------------- | -| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. | -| type | string | No | Valid calendar type. Currently, the valid types are as follows: **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic\_civil**, **islamic\_tbla**, **islamic\_umalqura**, **japanese**, and **persian**. If this parameter is left unspecified, the default calendar type of the specified locale is used.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. | +| type | string | No | Valid calendar type. Currently, the valid types are as follows: **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic\_civil**, **islamic\_tbla**, **islamic\_umalqura**, **japanese**, and **persian**. If this parameter is left unspecified, the default calendar type of the specified locale is used. | **Return Value** -| Type | Description | -| ---------------------- | ----- | -| [Calendar](#calendar8) | **Calendar** object.| +| Type | Description | +| ---------------------- | -------------------- | +| [Calendar](#calendar8) | **Calendar** object. | **Example** ``` @@ -350,9 +350,9 @@ Sets the date for this **Calendar** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ---- | ---- | ----------------- | -| date | Date | Yes | Date to be set for the **Calendar** object.| +| Name | Type | Mandatory | Description | +| ---- | ---- | --------- | ---------------------------------------- | +| date | Date | Yes | Date to be set for the **Calendar** object. | **Example** ``` @@ -371,9 +371,9 @@ Sets the date and time for this **Calendar** object. The value is represented by **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------------------------------- | +| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch. | **Example** ``` @@ -391,14 +391,14 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ------ | -| year | number | Yes | Year to set. | -| month | number | Yes | Month to set. | -| date | number | Yes | Day to set. | -| hour | number | No | Hour to set.| -| minute | number | No | Minute to set.| -| second | number | No | Second to set. | +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | -------------- | +| year | number | Yes | Year to set. | +| month | number | Yes | Month to set. | +| date | number | Yes | Day to set. | +| hour | number | No | Hour to set. | +| minute | number | No | Minute to set. | +| second | number | No | Second to set. | **Example** ``` @@ -416,9 +416,9 @@ Sets the time zone of this **Calendar** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------ | ---- | ------------------------- | -| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**.| +| Name | Type | Mandatory | Description | +| -------- | ------ | --------- | ---------------------------------------- | +| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**. | **Example** ``` @@ -436,9 +436,9 @@ Obtains the time zone of this **Calendar** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ---------- | -| string | Time zone of the **Calendar** object.| +| Type | Description | +| ------ | ------------------------------------- | +| string | Time zone of the **Calendar** object. | **Example** ``` @@ -457,9 +457,9 @@ Obtains the start day of a week for this **Calendar** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | --------------------- | -| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday. | **Example** ``` @@ -477,9 +477,9 @@ Sets the start day of a week for this **Calendar** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | --------------------- | -| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday. | **Example** ``` @@ -497,9 +497,9 @@ Obtains the minimum number of days in the first week of a year. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------------ | -| number | Minimum number of days in the first week of a year.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Minimum number of days in the first week of a year. | **Example** ``` @@ -517,9 +517,9 @@ Sets the minimum number of days in the first week of a year. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ------------ | -| value | number | No | Minimum number of days in the first week of a year.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| value | number | No | Minimum number of days in the first week of a year. | **Example** ``` @@ -537,14 +537,14 @@ Obtains the value of the specified field in the **Calendar** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ---------------------------------------- | -| field | string | Yes | Value of the specified field in the **Calendar** object. Currently, a valid field can be any of the following: **era**, **year**, **month**, **week\_of\_year**, **week\_of\_month**, **date**, **day\_of\_year**, **day\_of\_week**, **day\_of\_week\_in\_month**, **hour**, **hour\_of\_day**, **minute**, **second**, **millisecond**, **zone\_offset**, **dst\_offset**, **year\_woy**, **dow\_local**, **extended\_year**, **julian\_day**, **milliseconds\_in\_day**, **is\_leap\_month**.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| field | string | Yes | Value of the specified field in the **Calendar** object. Currently, a valid field can be any of the following: **era**, **year**, **month**, **week\_of\_year**, **week\_of\_month**, **date**, **day\_of\_year**, **day\_of\_week**, **day\_of\_week\_in\_month**, **hour**, **hour\_of\_day**, **minute**, **second**, **millisecond**, **zone\_offset**, **dst\_offset**, **year\_woy**, **dow\_local**, **extended\_year**, **julian\_day**, **milliseconds\_in\_day**, **is\_leap\_month**. | **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**.| +| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**. | **Example** ``` @@ -563,14 +563,14 @@ Obtains the name of the **Calendar** object displayed for the specified locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------------------- | -| locale | string | Yes | Locale for which the name of the **Calendar** object is displayed. For example, if **locale** is **en-US**, the name of the Buddhist calendar will be **Buddhist Calendar**.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | Yes | Locale for which the name of the **Calendar** object is displayed. For example, if **locale** is **en-US**, the name of the Buddhist calendar will be **Buddhist Calendar**. | **Return Value** -| Type | Description | -| ------ | ------------------- | -| string | Name of the **Calendar** object displayed for the specified locale.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Name of the **Calendar** object displayed for the specified locale. | **Example** ``` @@ -588,14 +588,14 @@ Checks whether the specified date in this **Calendar** object is a weekend. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ---- | ---- | ---------------------------------------- | -| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend.| +| Name | Type | Mandatory | Description | +| ---- | ---- | --------- | ---------------------------------------- | +| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend. | **Return Value** -| Type | Description | -| ------- | ----------------------------------- | -| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday. | **Example** ``` @@ -619,10 +619,10 @@ Creates a **PhoneNumberFormat** object. **System capability**: SystemCapability.Global.I18n Parameters -| Name | Type | Mandatory | Description | -| ------- | ---------------------------------------- | ---- | ---------------- | -| country | string | Yes | Country or region to which the phone number to be formatted belongs.| -| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. | +| Name | Type | Mandatory | Description | +| ------- | ---------------------------------------- | --------- | ---------------------------------------- | +| country | string | Yes | Country or region to which the phone number to be formatted belongs. | +| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. | **Example** ``` @@ -639,14 +639,14 @@ Checks whether the format of the specified phone number is valid. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------- | -| number | string | Yes | Phone number to be checked.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | --------------------------- | +| number | string | Yes | Phone number to be checked. | **Return Value** -| Type | Description | -| ------- | ------------------------------------- | -| boolean | Returns **true** if the phone number format is valid; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the phone number format is valid; returns **false** otherwise. | **Example** ``` @@ -664,14 +664,14 @@ Formats a phone number. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------- | -| number | string | Yes | Phone number to be formatted.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ----------------------------- | +| number | string | Yes | Phone number to be formatted. | **Return Value** -| Type | Description | -| ------ | ---------- | -| string | Formatted phone number.| +| Type | Description | +| ------ | ----------------------- | +| string | Formatted phone number. | **Example** ``` @@ -688,15 +688,15 @@ Obtains the home location of a phone number. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------- | -| number | string | Yes | Phone number.| -| locale | string | Yes | Locale ID.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------- | +| number | string | Yes | Phone number. | +| locale | string | Yes | Locale ID. | **Return value** -| Type | Description | -| ------ | ---------- | -| string | Home location of the phone number.| +| Type | Description | +| ------ | ---------------------------------- | +| string | Home location of the phone number. | **Example** ```js @@ -711,9 +711,9 @@ Defines the options for this PhoneNumberFormat object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ---- | ------ | ---- | ---- | ---------------------------------------- | -| type | string | Yes | Yes | Format type of a phone number. The value can be **E164**, **INTERNATIONAL**, **NATIONAL**, or **RFC3966**.| +| Name | Type | Readable | Writable | Description | +| ---- | ------ | -------- | -------- | ---------------------------------------- | +| type | string | Yes | Yes | Format type of a phone number. The value can be **E164**, **INTERNATIONAL**, **NATIONAL**, or **RFC3966**. | ## UnitInfo8+ @@ -722,10 +722,10 @@ Defines the measurement unit information. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ------------- | ------ | ---- | ---- | ---------------------------------------- | -| unit | string | Yes | Yes | Name of the measurement unit, for example, **meter**, **inch**, or **cup**.| -| measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**, **US**, or **UK**.| +| Name | Type | Readable | Writable | Description | +| ------------- | ------ | -------- | -------- | ---------------------------------------- | +| unit | string | Yes | Yes | Name of the measurement unit, for example, **meter**, **inch**, or **cup**. | +| measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**, **US**, or **UK**. | ## Util8+ @@ -740,18 +740,18 @@ Converts one measurement unit into another and formats the unit based on the spe **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------- | ---- | ---------------------------------------- | -| fromUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted. | -| toUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted to. | -| value | number | Yes | Value of the measurement unit to be converted. | -| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. | -| style | string | No | Style used for formatting. The value can be **long**, **short**, or **medium**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | --------- | ---------------------------------------- | +| fromUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted. | +| toUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted to. | +| value | number | Yes | Value of the measurement unit to be converted. | +| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. | +| style | string | No | Style used for formatting. The value can be **long**, **short**, or **medium**. | **Return Value** -| Type | Description | -| ------ | ----------------------- | -| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**. | **Example** ``` @@ -767,14 +767,14 @@ Obtains the sequence of the year, month, and day in the specified locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------- | ---- | ---------------------------------------- | -| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. | +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. | **Return value** -| Type | Description | -| ------ | ----------------------- | -| string | Sequence of the year, month, and day.| +| Type | Description | +| ------ | ------------------------------------- | +| string | Sequence of the year, month, and day. | **Example** ``` @@ -790,14 +790,14 @@ Creates an **IndexUtil** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------- | -| locale | string | No | A string containing locale information, including the language, optional script, and region.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | No | A string containing locale information, including the language, optional script, and region. | **Return Value** -| Type | Description | -| ------------------------ | --------------------- | -| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.| +| Type | Description | +| ------------------------ | ---------------------------------------- | +| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale. | **Example** ``` @@ -817,9 +817,9 @@ Obtains the index list for this **locale** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------------------- | ------------------ | -| Array<string> | Index list for this **locale** object.| +| Type | Description | +| ------------------- | -------------------------------------- | +| Array<string> | Index list for this **locale** object. | **Example** ``` @@ -837,9 +837,9 @@ Adds the index of the new **locale** object to the index list. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------- | -| locale | string | Yes | A string containing locale information, including the language, optional script, and region.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | Yes | A string containing locale information, including the language, optional script, and region. | **Example** ``` @@ -857,14 +857,14 @@ Obtains the index of a text object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| text | string | Yes | **text** object whose index is to be obtained.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------------------------------- | +| text | string | Yes | **text** object whose index is to be obtained. | **Return Value** -| Type | Description | -| ------ | ----------- | -| string | Index of the **text** object.| +| Type | Description | +| ------ | ----------------------------- | +| string | Index of the **text** object. | **Example** ``` @@ -885,14 +885,14 @@ Checks whether the input character string is composed of digits. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | -| ------- | ------------------------------------ | -| boolean | Returns **true** if the input character is a digit; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the input character is a digit; returns **false** otherwise. | **Example** ``` @@ -909,14 +909,14 @@ Checks whether the input character is a space. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | -| ------- | -------------------------------------- | -| boolean | Returns **true** if the input character is a space; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the input character is a space; returns **false** otherwise. | **Example** ``` @@ -933,14 +933,14 @@ Checks whether the input character is a white space. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | -| ------- | -------------------------------------- | -| boolean | Returns **true** if the input character is a white space; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the input character is a white space; returns **false** otherwise. | **Example** ``` @@ -957,14 +957,14 @@ Checks whether the input character is of the right to left (RTL) language. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise.| +| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise. | **Example** ``` @@ -981,14 +981,14 @@ Checks whether the input character is an ideographic character. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise.| +| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise. | **Example** ``` @@ -1005,14 +1005,14 @@ Checks whether the input character is a letter. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | -| ------- | ------------------------------------ | -| boolean | Returns **true** if the input character is a letter; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the input character is a letter; returns **false** otherwise. | **Example** ``` @@ -1029,14 +1029,14 @@ Checks whether the input character is a lowercase letter. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise.| +| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise. | **Example** ``` @@ -1053,14 +1053,14 @@ Checks whether the input character is an uppercase letter. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise.| +| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise. | **Example** ``` @@ -1077,14 +1077,14 @@ Obtains the type of the input character string. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----- | -| char | string | Yes | Input character.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------- | +| char | string | Yes | Input character. | **Return Value** -| Type | Description | -| ------ | ----------- | -| string | Type of the input character.| +| Type | Description | +| ------ | ---------------------------- | +| string | Type of the input character. | **Example** ``` @@ -1101,14 +1101,14 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------------------- | -| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. The [BreakIterator](#breakiterator8) object segments text according to the rules of the specified locale.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. The [BreakIterator](#breakiterator8) object segments text according to the rules of the specified locale. | **Return Value** -| Type | Description | -| -------------------------------- | ----------- | -| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.| +| Type | Description | +| -------------------------------- | ---------------------------------------- | +| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation. | **Example** ``` @@ -1128,9 +1128,9 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ----------------------- | -| text | string | Yes | Text to be processed by the **BreakIterator** object.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------------------------------- | +| text | string | Yes | Text to be processed by the **BreakIterator** object. | **Example** ``` @@ -1148,9 +1148,9 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ---------------------- | -| string | Text being processed by the **BreakIterator** object.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Text being processed by the **BreakIterator** object. | **Example** ``` @@ -1169,9 +1169,9 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | --------------------------- | -| number | Position of the **BreakIterator** object in the text being processed.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Position of the **BreakIterator** object in the text being processed. | **Example** ``` @@ -1190,9 +1190,9 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ----------------- | -| number | Offset to the first text boundary of the processed text.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Offset to the first text boundary of the processed text. | **Example** ``` @@ -1211,9 +1211,9 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------------------ | -| number | Offset of the last text boundary of the processed text.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Offset of the last text boundary of the processed text. | **Example** ``` @@ -1232,14 +1232,14 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ---------------------------------------- | -| index | number | No | Number of text boundaries by which the [BreakIterator](#breakiterator8) object is moved. A positive value indicates that the text boundary is moved backward, and a negative value indicates the opposite. If no index is specified, the index will be treated as **1**.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| index | number | No | Number of text boundaries by which the [BreakIterator](#breakiterator8) object is moved. A positive value indicates that the text boundary is moved backward, and a negative value indicates the opposite. If no index is specified, the index will be treated as **1**. | **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.| +| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries. | **Example** ``` @@ -1260,9 +1260,9 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.| +| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries. | **Example** ``` @@ -1283,14 +1283,14 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---------------------------------------- | -| offset | number | Yes | Offset to the position before the text boundary to which the [BreakIterator](#breakiterator8) object is moved.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ---------------------------------------- | +| offset | number | Yes | Offset to the position before the text boundary to which the [BreakIterator](#breakiterator8) object is moved. | **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text.| +| number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text. | **Example** ``` @@ -1311,14 +1311,14 @@ Checks whether the position specified by the offset is a text boundary. If **tru **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ----------- | -| offset | number | Yes | Position to check.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------------ | +| offset | number | Yes | Position to check. | **Return Value** -| Type | Description | -| ------- | ------------------------------- | -| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise. | **Example** ``` @@ -1338,9 +1338,9 @@ Checks whether the 24-hour clock is used. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise.| +| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise. | **Example** ``` @@ -1359,14 +1359,14 @@ Sets the 24-hour clock. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------- | ---- | ---------------------------------------- | -| option | boolean | Yes | Whether to enable the 24-hour clock. The value **true** means to enable the 24-hour clock, and the value **false** means the opposite.| +| Name | Type | Mandatory | Description | +| ------ | ------- | --------- | ---------------------------------------- | +| option | boolean | Yes | Whether to enable the 24-hour clock. The value **true** means to enable the 24-hour clock, and the value **false** means the opposite. | **Return Value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise. | **Example** ``` @@ -1386,15 +1386,15 @@ Adds a preferred language to the specified position on the preferred language li **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------ | ---- | ---------- | -| language | string | Yes | Preferred language to add. | -| index | number | No | Position to which the preferred language is added.| +| Name | Type | Mandatory | Description | +| -------- | ------ | --------- | ---------------------------------------- | +| language | string | Yes | Preferred language to add. | +| index | number | No | Position to which the preferred language is added. | **Return Value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise. | **Example** ``` @@ -1416,14 +1416,14 @@ Deletes a preferred language from the specified position on the preferred langua **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | --------------------- | -| index | number | Yes | Position of the preferred language to delete.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| index | number | Yes | Position of the preferred language to delete. | **Return Value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise. | **Example** ``` @@ -1442,9 +1442,9 @@ Obtains the list of preferred languages. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------------------- | --------- | -| Array<string> | List of preferred languages.| +| Type | Description | +| ------------------- | ---------------------------- | +| Array<string> | List of preferred languages. | **Example** ``` @@ -1461,9 +1461,9 @@ Obtains the first language in the preferred language list. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | -------------- | -| string | First language in the preferred language list.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | First language in the preferred language list. | **Example** ``` @@ -1480,14 +1480,14 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ----- | -| zondID | string | No | Time zone ID.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------- | +| zondID | string | No | Time zone ID. | **Return Value** -| Type | Description | -| -------- | ------------ | -| TimeZone | **TimeZone** object corresponding to the time zone ID.| +| Type | Description | +| -------- | ---------------------------------------- | +| TimeZone | **TimeZone** object corresponding to the time zone ID. | **Example** ``` @@ -1507,9 +1507,9 @@ Obtains the ID of the specified **TimeZone** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------------ | -| string | Time zone ID corresponding to the **TimeZone** object.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Time zone ID corresponding to the **TimeZone** object. | **Example** ``` @@ -1527,15 +1527,15 @@ Obtains the representation of a **TimeZone** object in the specified locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------- | ---- | -------------------- | -| locale | string | No | System locale ID. | -| isDST | boolean | No | Whether to consider DST when obtaining the representation of the **TimeZone** object.| +| Name | Type | Mandatory | Description | +| ------ | ------- | --------- | ---------------------------------------- | +| locale | string | No | System locale ID. | +| isDST | boolean | No | Whether to consider DST when obtaining the representation of the **TimeZone** object. | **Return Value** -| Type | Description | -| ------ | ------------- | -| string | Representation of the **TimeZone** object in the specified locale.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Representation of the **TimeZone** object in the specified locale. | **Example** ``` @@ -1553,9 +1553,9 @@ Obtains the offset between the time zone represented by a **TimeZone** object an **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ------------------- | -| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone. | **Example** ``` @@ -1573,9 +1573,9 @@ Obtains the offset between the time zone represented by a **TimeZone** object an **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ----------------------- | -| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point.| +| Type | Description | +| ------ | ---------------------------------------- | +| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point. | **Example** ``` @@ -1592,9 +1592,9 @@ Obtains the list of time zone IDs supported by the system. **System capability**: SystemCapability.Global.I18n **Return value** -| Type | Description | -| ------------------- | ----------- | -| Array<string> | List of time zone IDs supported by the system.| +| Type | Description | +| ------------------- | ---------------------------------------- | +| Array<string> | List of time zone IDs supported by the system. | **Example** ```ts @@ -1611,9 +1611,9 @@ Obtains the list of time zone city IDs supported by the system. **System capability**: SystemCapability.Global.I18n **Return value** -| Type | Description | -| ------------------- | ------------- | -| Array<string> | List of time zone city IDs supported by the system.| +| Type | Description | +| ------------------- | ---------------------------------------- | +| Array<string> | List of time zone city IDs supported by the system. | **Example** ```ts @@ -1630,15 +1630,15 @@ Obtains the localized display of a time zone city in the specified locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ------ | -| cityID | string | Yes | Time zone city ID.| -| locale | string | Yes | Locale ID. | +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------------ | +| cityID | string | Yes | Time zone city ID. | +| locale | string | Yes | Locale ID. | **Return value** -| Type | Description | -| ------ | ------------------ | -| string | Localized display of the time zone city in the specified locale.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | Localized display of the time zone city in the specified locale. | **Example** ```ts @@ -1655,14 +1655,14 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ------ | -| cityID | string | Yes | Time zone city ID.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------------ | +| cityID | string | Yes | Time zone city ID. | **Return value** -| Type | Description | -| -------- | ----------- | -| TimeZone | **TimeZone** object corresponding to the specified time zone city ID.| +| Type | Description | +| -------- | ---------------------------------------- | +| TimeZone | **TimeZone** object corresponding to the specified time zone city ID. | **Example** ```ts @@ -1683,14 +1683,14 @@ This is a system API. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------- | ---- | ------------------------------- | -| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite.| +| Name | Type | Mandatory | Description | +| ---- | ------- | --------- | ---------------------------------------- | +| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite. | **Return value** -| Type | Description | -| ------- | ----------------------------------- | -| boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite.| +| Type | Description | +| ------- | ---------------------------------------- | +| boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite. | **Example** ```ts @@ -1707,9 +1707,9 @@ Checks whether the local digit switch is turned on. **System capability**: SystemCapability.Global.I18n **Return value** -| Type | Description | +| Type | Description | | ------- | ---------------------------------------- | -| boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite.| +| boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite. | **Example** ```ts @@ -1729,9 +1729,9 @@ Obtains a list of IDs supported by the **Transliterator** object. **System capability**: SystemCapability.Global.I18n **Return value** -| Type | Description | -| -------- | ---------- | -| string[] | List of IDs supported by the **Transliterator** object.| +| Type | Description | +| -------- | ---------------------------------------- | +| string[] | List of IDs supported by the **Transliterator** object. | **Example** ```ts @@ -1748,14 +1748,14 @@ Creates a **Transliterator** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | -------- | -| id | string | Yes | ID supported by the **Transliterator** object.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------------------------------- | +| id | string | Yes | ID supported by the **Transliterator** object. | **Return value** -| Type | Description | -| ---------------------------------- | ----- | -| [Transliterator](#transliterator9) | **Transliterator** object.| +| Type | Description | +| ---------------------------------- | -------------------------- | +| [Transliterator](#transliterator9) | **Transliterator** object. | **Example** ```ts @@ -1772,14 +1772,14 @@ Converts the input string from the source format to the target format. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------ | -| text | string | Yes | Input string.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ------------- | +| text | string | Yes | Input string. | **Return value** -| Type | Description | -| ------ | -------- | -| string | Target string.| +| Type | Description | +| ------ | -------------- | +| string | Target string. | **Example** ```ts diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index b335be1b5cf4826da51120cd2156a64a7cd55bff..f031c80ed8130305078ad3acb7d1801568b56199 100644 --- a/en/application-dev/reference/apis/js-apis-intl.md +++ b/en/application-dev/reference/apis/js-apis-intl.md @@ -2,10 +2,10 @@ This module provides basic I18N capabilities, such as time and date formatting, number formatting, and string sorting, through the standard I18N APIs defined in ECMA 402. -The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities through supplementary APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. +The [I18N](js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary APIs that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. > **NOTE** -> +> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -23,18 +23,18 @@ import Intl from '@ohos.intl'; **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| --------------- | ------- | ---- | ---- | ---------------------------------------- | -| language | string | Yes | No | Language associated with the locale, for example, **zh**. | -| script | string | Yes | No | Script type of the language, for example, **Hans**. | -| region | string | Yes | No | Region associated with the locale, for example, **CN**. | -| baseName | string | Yes | No | Basic key information about the locale, which consists of the language, script, and region, for example, **zh-Hans-CN**. | -| caseFirst | string | Yes | No | Whether case is taken into account for the locale's collation rules. The value can be **upper**, **lower**, or **false**.| -| calendar | string | Yes | No | Calendar for the locale. The value can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, **islamicc**.| -| collation | string | Yes | No | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**.| -| hourCycle | string | Yes | No | Time system for the locale. The value can be any of the following: **h12**, **h23**, **h11**, **h24**.| -| numberingSystem | string | Yes | No | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.| -| numeric | boolean | Yes | No | Whether to apply special collation rules for numeric characters. | +| Name | Type | Readable | Writable | Description | +| --------------- | ------- | -------- | -------- | ---------------------------------------- | +| language | string | Yes | No | Language associated with the locale, for example, **zh**. | +| script | string | Yes | No | Script type of the language, for example, **Hans**. | +| region | string | Yes | No | Region associated with the locale, for example, **CN**. | +| baseName | string | Yes | No | Basic key information about the locale, which consists of the language, script, and region, for example, **zh-Hans-CN**. | +| caseFirst | string | Yes | No | Whether case is taken into account for the locale's collation rules. The value can be **upper**, **lower**, or **false**. | +| calendar | string | Yes | No | Calendar for the locale. The value can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, **islamicc**. | +| collation | string | Yes | No | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**. | +| hourCycle | string | Yes | No | Time system for the locale. The value can be any of the following: **h12**, **h23**, **h11**, **h24**. | +| numberingSystem | string | Yes | No | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**. | +| numeric | boolean | Yes | No | Whether to apply special collation rules for numeric characters. | ### constructor8+ @@ -60,10 +60,10 @@ Creates a Locale object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------- | ---- | ---------------------------- | -| locale | string | Yes | A string containing locale information, including the language, optional script, and region.| -| options | LocaleOptions | No | Options for creating the **Locale** object. | +| Name | Type | Mandatory | Description | +| ------- | ------------- | --------- | ---------------------------------------- | +| locale | string | Yes | A string containing locale information, including the language, optional script, and region. | +| options | LocaleOptions | No | Options for creating the **Locale** object. | **Example** ```js @@ -80,9 +80,9 @@ Converts locale information to a string. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------ | ----------- | -| string | String containing locale information.| +| Type | Description | +| ------ | ------------------------------------- | +| string | String containing locale information. | **Example** ```js @@ -100,9 +100,9 @@ Maximizes information of the **Locale** object. If the script and locale informa **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ----------------- | ---------- | -| [Locale](#locale) | **Locale** object with the maximized information.| +| Type | Description | +| ----------------- | ---------------------------------------- | +| [Locale](#locale) | **Locale** object with the maximized information. | **Example** ```js @@ -120,9 +120,9 @@ Minimizes information of the **Locale** object. If the script and locale informa **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ----------------- | ---------- | -| [Locale](#locale) | **Locale** object with the minimized information.| +| Type | Description | +| ----------------- | ---------------------------------------- | +| [Locale](#locale) | **Locale** object with the minimized information. | **Example** ```js @@ -137,14 +137,14 @@ Represents the locale options. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| --------------- | ------- | ---- | ---- | ---------------------------------------- | -| calendar | string | Yes | Yes | Calendar for the locale. The calue can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, **islamicc**.| -| collation | string | Yes | Yes | Collation rule. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **emoji**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**,**search**, **searchjl**, **standard**, **stroke**, **trad**, **unihan**, **zhuyin**.| -| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**.| -| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.| -| numeric | boolean | Yes | Yes | Whether to use the 12-hour clock. | -| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**.| +| Name | Type | Readable | Writable | Description | +| --------------- | ------- | -------- | -------- | ---------------------------------------- | +| calendar | string | Yes | Yes | Calendar for the locale. The calue can be any of the following: **buddhist**, **chinese**, **coptic**, **dangi**, **ethioaa**, **ethiopic**, **gregory**, **hebrew**, **indian**, **islamic**, **islamic-umalqura**, **islamic-tbla**, **islamic-civil**, **islamic-rgsa**, **iso8601**, **japanese**, **persian**, **roc**, **islamicc**. | +| collation | string | Yes | Yes | Collation rule. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **emoji**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**,**search**, **searchjl**, **standard**, **stroke**, **trad**, **unihan**, **zhuyin**. | +| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**. | +| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**. | +| numeric | boolean | Yes | Yes | Whether to use the 12-hour clock. | +| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**. | ## DateTimeFormat @@ -173,10 +173,10 @@ Creates a **DateTimeOptions** object for the specified locale. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------------------------------- | ---- | ---------------------------- | -| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options | [DateTimeOptions](#datetimeoptions) | No | Options for creating a **DateTimeFormat** object. | +| Name | Type | Mandatory | Description | +| ------- | ----------------------------------- | --------- | ---------------------------------------- | +| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region. | +| options | [DateTimeOptions](#datetimeoptions) | No | Options for creating a **DateTimeFormat** object. | **Example** ```js @@ -199,14 +199,14 @@ Formats the specified date and time. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ---- | ---- | ------- | -| date | Date | Yes | Date and time to be formatted.| +| Name | Type | Mandatory | Description | +| ---- | ---- | --------- | ------------------------------ | +| date | Date | Yes | Date and time to be formatted. | **Return Value** -| Type | Description | -| ------ | ------------ | -| string | A string containing the formatted date and time.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | A string containing the formatted date and time. | **Example** ```js @@ -225,15 +225,15 @@ Formats the specified date range. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| --------- | ---- | ---- | -------- | -| startDate | Date | Yes | Start date and time to be formatted.| -| endDate | Date | Yes | End date and time to be formatted.| +| Name | Type | Mandatory | Description | +| --------- | ---- | --------- | ------------------------------------ | +| startDate | Date | Yes | Start date and time to be formatted. | +| endDate | Date | Yes | End date and time to be formatted. | **Return Value** -| Type | Description | -| ------ | -------------- | -| string | A string containing the formatted date and time range.| +| Type | Description | +| ------ | ---------------------------------------- | +| string | A string containing the formatted date and time range. | **Example** ```js @@ -253,9 +253,9 @@ Obtains the formatting options for **DateTimeFormat** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ----------------------------------- | ----------------------------- | -| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects.| +| Type | Description | +| ----------------------------------- | ---------------------------------------- | +| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects. | **Example** ```js @@ -270,27 +270,27 @@ Provides the options for the **DateTimeFormat** object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| --------------- | ------- | ---- | ---- | ---------------------------------------- | -| locale | string | Yes | No | Locale, for example, **zh-Hans-CN**. | -| dateStyle | string | Yes | Yes | Date display format. The value can be **long**, **short**, **medium**, or **full**.| -| timeStyle | string | Yes | Yes | Time display format. The value can be **long**, **short**, **medium**, or **full**.| -| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**.| -| timeZone | string | Yes | Yes | Time zone represented by a valid IANA time zone ID. | -| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.| -| hour12 | boolean | Yes | Yes | Whether to use the 12-hour clock. | -| weekday | string | Yes | Yes | Workday display format. The value can be **long**, **short**, or **narrow**.| -| era | string | Yes | Yes | Era display format. The value can be **long**, **short**, or **narrow**.| -| year | string | Yes | Yes | Year display format. The value can be **numeric** or **2-digit**. | -| month | string | Yes | Yes | Month display format. The value can be any of the following: **numeric**, **2-digit**, **long**, **short**, **narrow**.| -| day | string | Yes | Yes | Day display format. The value can be **numeric** or **2-digit**. | -| hour | string | Yes | Yes | Hour display format. The value can be **numeric** or **2-digit**. | -| minute | string | Yes | Yes | Minute display format. The value can be **numeric** or **2-digit**. | -| second | string | Yes | Yes | Seconds display format. The value can be **numeric** or **2-digit**. | -| timeZoneName | string | Yes | Yes | Localized representation of a time zone name. | -| dayPeriod | string | Yes | Yes | Time period display format. The value can be **long**, **short**, or **narrow**.| -| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.| -| formatMatcher | string | Yes | Yes | Format matching algorithm. The value can be **basic** or **best fit**.| +| Name | Type | Readable | Writable | Description | +| --------------- | ------- | -------- | -------- | ---------------------------------------- | +| locale | string | Yes | No | Locale, for example, **zh-Hans-CN**. | +| dateStyle | string | Yes | Yes | Date display format. The value can be **long**, **short**, **medium**, or **full**. | +| timeStyle | string | Yes | Yes | Time display format. The value can be **long**, **short**, **medium**, or **full**. | +| hourCycle | string | Yes | Yes | Time system for the locale. The value can be any of the following: **h11**, **h12**, **h23**, **h24**. | +| timeZone | string | Yes | Yes | Time zone represented by a valid IANA time zone ID. | +| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**. | +| hour12 | boolean | Yes | Yes | Whether to use the 12-hour clock. | +| weekday | string | Yes | Yes | Workday display format. The value can be **long**, **short**, or **narrow**. | +| era | string | Yes | Yes | Era display format. The value can be **long**, **short**, or **narrow**. | +| year | string | Yes | Yes | Year display format. The value can be **numeric** or **2-digit**. | +| month | string | Yes | Yes | Month display format. The value can be any of the following: **numeric**, **2-digit**, **long**, **short**, **narrow**. | +| day | string | Yes | Yes | Day display format. The value can be **numeric** or **2-digit**. | +| hour | string | Yes | Yes | Hour display format. The value can be **numeric** or **2-digit**. | +| minute | string | Yes | Yes | Minute display format. The value can be **numeric** or **2-digit**. | +| second | string | Yes | Yes | Seconds display format. The value can be **numeric** or **2-digit**. | +| timeZoneName | string | Yes | Yes | Localized representation of a time zone name. | +| dayPeriod | string | Yes | Yes | Time period display format. The value can be **long**, **short**, or **narrow**. | +| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**. | +| formatMatcher | string | Yes | Yes | Format matching algorithm. The value can be **basic** or **best fit**. | ## NumberFormat @@ -319,10 +319,10 @@ Creates a **NumberFormat** object for the specified locale. **System capability**: SystemCapability.Global.I18n Parameters -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------- | -| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options | [NumberOptions](#numberoptions) | No | Options for creating a **NumberFormat** object. | +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | --------- | ---------------------------------------- | +| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region. | +| options | [NumberOptions](#numberoptions) | No | Options for creating a **NumberFormat** object. | **Example** ```js @@ -339,14 +339,14 @@ Formats a number. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ---- | -| number | number | Yes | Number to be formatted.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ----------------------- | +| number | number | Yes | Number to be formatted. | **Return Value** -| Type | Description | -| ------ | ---------- | -| string | Formatted number.| +| Type | Description | +| ------ | ----------------- | +| string | Formatted number. | **Example** @@ -365,9 +365,9 @@ Obtains the options of the **NumberFormat** object. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ------------------------------- | --------------------------- | -| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects.| +| Type | Description | +| ------------------------------- | ---------------------------------------- | +| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects. | **Example** @@ -383,27 +383,27 @@ Provides the device capability. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ------------------------ | ------- | ---- | ---- | ---------------------------------------- | -| locale | string | Yes | No | Locale, for example, **zh-Hans-CN**. | -| currency | string | Yes | Yes | Currency unit, for example, **EUR**, **CNY**, or **USD**. | -| currencySign | string | Yes | Yes | Currency unit symbol. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.| -| currencyDisplay | string | Yes | Yes | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.| -| unit | string | Yes | Yes | Unit name, for example, **meter**, **inch**, or **hectare**. | -| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **medium**.| -| unitUsage8+ | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.| -| signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.| -| compactDisplay | string | Yes | Yes | Compact display format. The value can be **long** or **short**. | -| notation | string | Yes | Yes | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**.| -| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.| -| style | string | Yes | Yes | Number display format. The value can be **decimal**, **currency**, **percent**, or **unit**.| -| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**.| -| useGrouping | boolean | Yes | Yes | Whether to use grouping for display. | -| minimumIntegerDigits | number | Yes | Yes | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**. | -| minimumFractionDigits | number | Yes | Yes | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**. | -| maximumFractionDigits | number | Yes | Yes | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**. | -| minimumSignificantDigits | number | Yes | Yes | Minimum number of the least significant digits. The value ranges from **1** to **21**. | -| maximumSignificantDigits | number | Yes | Yes | Maximum number of the least significant digits. The value ranges from **1** to **21**. | +| Name | Type | Readable | Writable | Description | +| ------------------------ | ------- | -------- | -------- | ---------------------------------------- | +| locale | string | Yes | No | Locale, for example, **zh-Hans-CN**. | +| currency | string | Yes | Yes | Currency unit, for example, **EUR**, **CNY**, or **USD**. | +| currencySign | string | Yes | Yes | Currency unit symbol. The value can be **symbol**, **narrowSymbol**, **code**, or **name**. | +| currencyDisplay | string | Yes | Yes | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**. | +| unit | string | Yes | Yes | Unit name, for example, **meter**, **inch**, or **hectare**. | +| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **medium**. | +| unitUsage8+ | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**. | +| signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**. | +| compactDisplay | string | Yes | Yes | Compact display format. The value can be **long** or **short**. | +| notation | string | Yes | Yes | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**. | +| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**. | +| style | string | Yes | Yes | Number display format. The value can be **decimal**, **currency**, **percent**, or **unit**. | +| numberingSystem | string | Yes | Yes | Numbering system for the locale. The value can be any of the following: **adlm**, **ahom**, **arab**, **arabext**, **bali**, **beng**, **bhks**, **brah**, **cakm**, **cham**, **deva**, **diak**, **fullwide**, **gong**, **gonm**, **gujr**, **guru**, **hanidec**, **hmng**, **hmnp**, **java**, **kali**, **khmr**, **knda**, **lana**, **lanatham**, **laoo**, **latn**, **lepc**, **limb**, **mathbold**, **mathdbl**, **mathmono**, **mathsanb**, **mathsans**, **mlym**, **modi**, **mong**, **mroo**, **mtei**, **mymr**, **mymrshan**, **mymrtlng**, **newa**, **nkoo**, **olck**, **orya**, **osma**, **rohg**, **saur**, **segment**, **shrd**, **sind**, **sinh**, **sora**, **sund**, **takr**, **talu**, **tamldec**, **telu**, **thai**, **tibt**, **tirh**, **vaii**, **wara**, **wcho**. | +| useGrouping | boolean | Yes | Yes | Whether to use grouping for display. | +| minimumIntegerDigits | number | Yes | Yes | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**. | +| minimumFractionDigits | number | Yes | Yes | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**. | +| maximumFractionDigits | number | Yes | Yes | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**. | +| minimumSignificantDigits | number | Yes | Yes | Minimum number of the least significant digits. The value ranges from **1** to **21**. | +| maximumSignificantDigits | number | Yes | Yes | Maximum number of the least significant digits. The value ranges from **1** to **21**. | ## Collator8+ @@ -433,10 +433,10 @@ Creates a Collator object. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------------------------------- | ---- | ---------------------------- | -| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options | [CollatorOptions](#collatoroptions) | No | Options for creating a **Collator** object. | +| Name | Type | Mandatory | Description | +| ------- | ----------------------------------- | --------- | ---------------------------------------- | +| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region. | +| options | [CollatorOptions](#collatoroptions) | No | Options for creating a **Collator** object. | **Example** ```js @@ -453,15 +453,15 @@ Compares two strings based on the sorting policy of the **Collator** object. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | ------------ | -| first | string | Yes | First string to compare. | -| second | string | Yes | Second string to compare.| +| Name | Type | Mandatory | Description | +| ------ | ------ | --------- | ------------------------- | +| first | string | Yes | First string to compare. | +| second | string | Yes | Second string to compare. | **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string.| +| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string. | **Example** ```js @@ -479,9 +479,9 @@ Returns properties reflecting the locale and collation options of a **Collator** **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ----------------------------------- | ----------------- | -| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object.| +| Type | Description | +| ----------------------------------- | -------------------------------------- | +| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object. | **Example** ```js @@ -496,15 +496,15 @@ Represents the properties of a **Collator** object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ----------------- | ------- | ---- | ---- | ---------------------------------------- | -| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.| -| usage | string | Yes | Yes | Whether the comparison is for sorting or for searching. The value can be **sort** or **search**. | -| sensitivity | string | Yes | Yes | Differences in the strings that lead to non-zero return values. The value can be **base**, **accent**, **case**, or **variant**.| -| ignorePunctuation | boolean | Yes | Yes | Whether punctuation is ignored. The value can be **true** or **false**. | -| collation | string | Yes | Yes | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**.| -| numeric | boolean | Yes | Yes | Whether numeric collation is used. The value can be **true** or **false**. | -| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**.| +| Name | Type | Readable | Writable | Description | +| ----------------- | ------- | -------- | -------- | ---------------------------------------- | +| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**. | +| usage | string | Yes | Yes | Whether the comparison is for sorting or for searching. The value can be **sort** or **search**. | +| sensitivity | string | Yes | Yes | Differences in the strings that lead to non-zero return values. The value can be **base**, **accent**, **case**, or **variant**. | +| ignorePunctuation | boolean | Yes | Yes | Whether punctuation is ignored. The value can be **true** or **false**. | +| collation | string | Yes | Yes | Rule for sorting regions. The value can be any of the following: **big5han**, **compat**, **dict**, **direct**, **ducet**, **eor**, **gb2312**, **phonebk**, **phonetic**, **pinyin**, **reformed**, **searchjl**, **stroke**, **trad**, **unihan**, **zhuyin**. | +| numeric | boolean | Yes | Yes | Whether numeric collation is used. The value can be **true** or **false**. | +| caseFirst | string | Yes | Yes | Whether upper case or lower case is sorted first. The value can be **upper**, **lower**, or **false**. | ## PluralRules8+ @@ -533,10 +533,10 @@ Create a **PluralRules** object. **System capability**: SystemCapability.Global.I18n Parameters -| Name | Type | Mandatory | Description | -| ------- | ---------------------------------------- | ---- | ---------------------------- | -| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options | [PluralRulesOptions](#pluralrulesoptions) | No | Options for creating a **PluralRules** object. | +| Name | Type | Mandatory | Description | +| ------- | ---------------------------------------- | --------- | ---------------------------------------- | +| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region. | +| options | [PluralRulesOptions](#pluralrulesoptions) | No | Options for creating a **PluralRules** object. | **Example** ```js @@ -553,14 +553,14 @@ Obtains a string that represents the singular-plural type of the specified numbe **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| n | number | Yes | Number for which the singular-plural type is to be obtained.| +| Name | Type | Mandatory | Description | +| ---- | ------ | --------- | ---------------------------------------- | +| n | number | Yes | Number for which the singular-plural type is to be obtained. | **Return Value** -| Type | Description | +| Type | Description | | ------ | ---------------------------------------- | -| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.| +| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**. | **Example** ```js @@ -575,15 +575,15 @@ Represents the properties of a **PluralRules** object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ------------------------ | ------ | ---- | ---- | ---------------------------------------- | -| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.| -| type | string | Yes | Yes | Sorting type. The value can be **cardinal** or **ordinal**. | -| minimumIntegerDigits | number | Yes | Yes | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**. | -| minimumFractionDigits | number | Yes | Yes | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**. | -| maximumFractionDigits | number | Yes | Yes | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**. | -| minimumSignificantDigits | number | Yes | Yes | Minimum number of the least significant digits. The value ranges from **1** to **21**. | -| maximumSignificantDigits | number | Yes | Yes | Maximum number of the least significant digits. The value ranges from **1** to **21**. | +| Name | Type | Readable | Writable | Description | +| ------------------------ | ------ | -------- | -------- | ---------------------------------------- | +| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**. | +| type | string | Yes | Yes | Sorting type. The value can be **cardinal** or **ordinal**. | +| minimumIntegerDigits | number | Yes | Yes | Minimum number of digits allowed in the integer part of a number. The value ranges from **1** to **21**. | +| minimumFractionDigits | number | Yes | Yes | Minimum number of digits in the fraction part of a number. The value ranges from **0** to **20**. | +| maximumFractionDigits | number | Yes | Yes | Maximum number of digits in the fraction part of a number. The value ranges from **1** to **21**. | +| minimumSignificantDigits | number | Yes | Yes | Minimum number of the least significant digits. The value ranges from **1** to **21**. | +| maximumSignificantDigits | number | Yes | Yes | Maximum number of the least significant digits. The value ranges from **1** to **21**. | ## RelativeTimeFormat8+ @@ -612,10 +612,10 @@ Creates a **RelativeTimeFormat** object. **System capability**: SystemCapability.Global.I18n Parameters -| Name | Type | Mandatory | Description | -| ------- | ---------------------------------------- | ---- | ---------------------------- | -| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions) | No | Options for creating a **RelativeTimeFormat** object. | +| Name | Type | Mandatory | Description | +| ------- | ---------------------------------------- | --------- | ---------------------------------------- | +| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region. | +| options | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions) | No | Options for creating a **RelativeTimeFormat** object. | **Example** ```js @@ -632,15 +632,15 @@ Formats the value and unit based on the specified locale and formatting options. **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ---------------------------------------- | -| value | number | Yes | Value to format. | -| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| value | number | Yes | Value to format. | +| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**. | **Return Value** -| Type | Description | -| ------ | ---------- | -| string | Relative time after formatting.| +| Type | Description | +| ------ | ------------------------------- | +| string | Relative time after formatting. | **Example** ```js @@ -658,15 +658,15 @@ Returns an array of RelativeTimeFormat objects in parts for locale-aware formatt **System capability**: SystemCapability.Global.I18n **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ---------------------------------------- | -| value | number | Yes | Value to format. | -| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.| +| Name | Type | Mandatory | Description | +| ----- | ------ | --------- | ---------------------------------------- | +| value | number | Yes | Value to format. | +| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**. | **Return Value** -| Type | Description | -| ------------------- | --------------------------- | -| Array<object> | An array of **RelativeTimeFormat** objects in parts.| +| Type | Description | +| ------------------- | ---------------------------------------- | +| Array<object> | An array of **RelativeTimeFormat** objects in parts. | **Example** ```js @@ -684,9 +684,9 @@ Obtains the formatting options for **RelativeTimeFormat** objects. **System capability**: SystemCapability.Global.I18n **Return Value** -| Type | Description | -| ---------------------------------------- | --------------------------------- | -| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects.| +| Type | Description | +| ---------------------------------------- | ---------------------------------------- | +| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects. | **Example** ```js @@ -701,11 +701,11 @@ Represents the properties of a **RelativeTimeFormat** object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| ------------- | ------ | ---- | ---- | ---------------------------------------- | -| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**.| -| numeric | string | Yes | Yes | Format of the output message. The value can be **always** or **auto**. | -| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**.| +| Name | Type | Readable | Writable | Description | +| ------------- | ------ | -------- | -------- | ---------------------------------------- | +| localeMatcher | string | Yes | Yes | Locale matching algorithm. The value can be **lookup** or **best fit**. | +| numeric | string | Yes | Yes | Format of the output message. The value can be **always** or **auto**. | +| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**. | ## RelativeTimeFormatResolvedOptions8+ @@ -714,9 +714,9 @@ Represents the properties of a **RelativeTimeFormat** object. **System capability**: SystemCapability.Global.I18n -| Name | Type | Readable | Writable | Description | -| --------------- | ------ | ---- | ---- | ---------------------------------------- | -| locale | string | Yes | Yes | A string containing locale information, including the language, optional script, and region. | -| numeric | string | Yes | Yes | Format of the output message. The value can be **always** or **auto**. | -| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**.| -| numberingSystem | string | Yes | Yes | Numbering system. | +| Name | Type | Readable | Writable | Description | +| --------------- | ------ | -------- | -------- | ---------------------------------------- | +| locale | string | Yes | Yes | A string containing locale information, including the language, optional script, and region. | +| numeric | string | Yes | Yes | Format of the output message. The value can be **always** or **auto**. | +| style | string | Yes | Yes | Length of an internationalized message. The value can be **long**, **short**, or **narrow**. | +| numberingSystem | string | Yes | Yes | Numbering system. | diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index 4026b305b254548a1b3ce815b4298cf6e858129f..58ebced38d920c204749c1829ddf12950b5acbfc 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -1,21 +1,481 @@ # Settings -> **NOTE**
-> The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - - -This module provides APIs for setting data items. +The **settings** module provides APIs for setting data items. +> **NOTE** +> +> The initial APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Modules to Import -```typescript +```js import settings from '@ohos.settings'; ``` +## date + +Provides data items for setting the time and date formats. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| DATE_FORMAT | string | Yes | Yes | Date format.
The value can be **mm/dd/yyyy**, **dd/mm/yyyy**, or **yyyy/mm/dd**, where **mm** indicates the month, **dd** indicates the day, and **yyyy** indicates the year.| +| TIME_FORMAT | string | Yes | Yes | Time format.
**12**: 12-hour format.
**24**: 24-hour format.| +| AUTO_GAIN_TIME | string | Yes | Yes | Whether the date, time, and time zone are automatically obtained from the Network Identity and Time Zone (NITZ).
The value **true** means that the date, time, and time zone are automatically obtained from NITZ; and **false** means the opposite.| +| AUTO_GAIN_TIME_ZONE | string | Yes | Yes | Whether the time zone is automatically obtained from NITZ.
The value **true** means that the time zone is automatically obtained from NITZ; and **false** means the opposite.| + +## display + +Provides data items for setting the display effects. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ----------------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| FONT_SCALE | string | Yes | Yes | Scale factor of the font. The value is a floating point number. | +| SCREEN_BRIGHTNESS_STATUS | string | Yes | Yes | Screen brightness. The value ranges from 0 to 255. | +| AUTO_SCREEN_BRIGHTNESS | string | Yes | Yes | Whether automatic screen brightness adjustment is enabled.
**AUTO_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is enabled.
**MANUAL_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is disabled.| +| AUTO_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is enabled. | +| MANUAL_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is disabled. | +| SCREEN_OFF_TIMEOUT | string | Yes | Yes | Waiting time for the device to enter the sleep state when not in use (unit: ms). | +| DEFAULT_SCREEN_ROTATION | string | Yes | Yes | Rotation angle. This attribute is valid only when screen auto-rotation is disabled.
**0**: The screen rotates by 0 degrees.
**1**: The screen rotates by 90 degrees.
**2**: The screen rotates by 180 degrees.
**3**: The screen rotates by 270 degrees.| +| ANIMATOR_DURATION_SCALE | string | Yes | Yes | Scale factor for the animation duration. This affects the start delay and duration of all such animations.
If the value is **0**, the animation ends immediately. The default value is **1**.| +| TRANSITION_ANIMATION_SCALE | string | Yes | Yes | Scale factor for transition animations.
The value **0** indicates that the transition animations are disabled. | +| WINDOW_ANIMATION_SCALE | string | Yes | Yes | Scale factor for normal window animations.
The value **0** indicates that window animations are disabled. | +| DISPLAY_INVERSION_STATUS | string | Yes | Yes | Whether display color inversion is enabled.
**1**: Display color inversion is enabled.
**0**: Display color inversion is disabled.| + +## general + +Provides data items for setting the general information about the device. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| -------------------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| SETUP_WIZARD_FINISHED | string | Yes | Yes | Whether the startup wizard is running.
If the value is **0**, the startup wizard is not running.
If the value is not **0**, the startup wizard is running.| +| END_BUTTON_ACTION | string | Yes | Yes | Action after the call end button is pressed if the user is not in a call.
**0**: Nothing happens.
**1**: The home screen is displayed.
**2**: The device enters sleep mode and the screen is locked.
**3**: The home screen is displayed. If the focus is already on the home screen, the device will enter sleep mode.| +| ACCELEROMETER_ROTATION_STATUS | string | Yes | Yes | Whether the accelerometer is used to change screen orientation, that is, whether to enable auto-rotation.
**1**: The accelerometer is used.
**0**: The accelerometer is not used.| +| AIRPLANE_MODE_STATUS | string | Yes | Yes | Whether airplane mode is enabled.
**1**: Airplane mode is enabled.
**0**: Airplane mode is disabled.| +| DEVICE_PROVISION_STATUS | string | Yes | Yes | Whether the device is preconfigured.
On a multi-user device with a single system user, the screen may be locked when the value is **true**. In addition, other features cannot be started on the system user unless they are marked to display on the lock screen.| +| HDC_STATUS | string | Yes | Yes | Whether the hard disk controller (HDC) on the USB device is enabled.
**true**: HDC is enabled.
**false**: HDC is disabled.| +| BOOT_COUNTING | string | Yes | Yes | Number of boot operations after the device is powered on. | +| CONTACT_METADATA_SYNC_STATUS | string | Yes | Yes | Whether contacts metadata synchronization is enabled.
**true**: Contacts metadata synchronization is enabled.
**false**: Contacts metadata synchronization is disabled.| +| DEVELOPMENT_SETTINGS_STATUS | string | Yes | Yes | Whether developer options are enabled.
**true**: Developer options are enabled.
**false**: Developer options are disabled.| +| DEVICE_NAME | string | Yes | Yes | Device name. | +| USB_STORAGE_STATUS | string | Yes | Yes | Whether USB mass storage is enabled.
**true**: USB mass storage is enabled.
**false**: USB mass storage is disabled.| +| DEBUGGER_WAITING | string | Yes | Yes | Whether the device waits for the debugger when starting an application to debug.
**1**: The device waits for the debugger.
**0**: The device does not wait for the debugger. In this case, the application runs normally.| +| DEBUG_APP_PACKAGE | string | Yes | Yes | Bundle name of the application to be debugged. | +| ACCESSIBILITY_STATUS | string | Yes | Yes | Whether accessibility is enabled.
**1**: Accessibility is enabled.
**0**: Accessibility is disabled.| +| ACTIVATED_ACCESSIBILITY_SERVICES | string | Yes | Yes | List of activated accessibility features. | +| GEOLOCATION_ORIGINS_ALLOWED | string | Yes | Yes | Default geographic location that can be used by the browser. Multiple geographic locations are separated by spaces. | +| SKIP_USE_HINTS | string | Yes | Yes | Whether the application should attempt to skip all introductory hints at the first startup. This feature is intended for temporary or experienced users.
**1**: The application attempts to skip all introductory hints at the first startup.
**0**: The application does not skip all introductory hints at the first startup.| +| TOUCH_EXPLORATION_STATUS | string | Yes | Yes | Whether touch exploration is enabled.
**1**: Touch exploration is enabled.
**0**: Touch exploration is disabled.| + +## input + +Provides data items for setting input methods. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ------------------------------------ | ------ | ---- | ---- | ------------------------------------------------------------ | +| DEFAULT_INPUT_METHOD | string | Yes | Yes | Default input method and its ID. | +| ACTIVATED_INPUT_METHOD_SUB_MODE | string | Yes | Yes | Type and ID of the default input method keyboard. | +| ACTIVATED_INPUT_METHODS | string | Yes | Yes | List of activated input methods.
The list is a string that contains the IDs and keyboard types of activated input methods. The IDs are separated by colons (:), and keyboard types are separated by semicolons (;). An example format is **ima0:keyboardType0;keyboardType1;ima1:ima2:keyboardTypes0,** where **ima** indicates the ID of an input method, and **keyboardType** indicates the keyboard type.| +| SELECTOR_VISIBILITY_FOR_INPUT_METHOD | string | Yes | Yes | Whether the input method selector is visible.
**1**: The input method selector is visible.
**0**: The input method selector is invisible.| +| AUTO_CAPS_TEXT_INPUT | string | Yes | Yes | Whether automatic capitalization is enabled for the text editor.
**0**: Automatic capitalization is disabled.
**1**: Automatic capitalization is enabled.| +| AUTO_PUNCTUATE_TEXT_INPUT | string | Yes | Yes | Whether automatic punctuation is enabled for the text editor. Automatic punctuation enables the text editor to convert two spaces into a period (.) and a space.
**0**: Automatic punctuation is disabled.
**1**: Automatic punctuation is enabled.| +| AUTO_REPLACE_TEXT_INPUT | string | Yes | Yes | Whether autocorrect is enabled for the text editor. Autocorrect enables the text editor to correct typos.
**0**: Autocorrect is disabled.
**1**: Autocorrect is enabled | +| SHOW_PASSWORD_TEXT_INPUT | string | Yes | Yes | Whether password presentation is enabled in the text editor. Password presentation enables the text editor to show password characters when the user types them.
**0**: Password presentation is disabled.
**1**: Password presentation is enabled.| + +## network + +Provides data items for setting network information. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ------------------------ | ------ | ---- | ---- | ------------------------------------------------------------ | +| DATA_ROAMING_STATUS | string | Yes | Yes | Whether data roaming is enabled.
**true**: Data roaming is enabled.
**false**: Data roaming is disabled.| +| HTTP_PROXY_CFG | string | Yes | Yes | Host name and port number of the global HTTP proxy. The host name and port number are separated by a colon (:).| +| NETWORK_PREFERENCE_USAGE | string | Yes | Yes | User preferences for the network to use. | + +## phone + +Provides data items for setting the modes of answering incoming and outgoing calls. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ------------------ | ------ | ---- | ---- | ------------------------------------------------------------ | +| RTT_CALLING_STATUS | string | Yes | Yes | Whether the real-time text (RTT) feature is enabled. If this feature is enabled, incoming and outgoing calls are answered as RTT calls when supported by the device and carrier.
**1**: RTT is enabled.
**0**: RTT is disabled.| + +## sound + +Provides data items for setting the sound effects. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ---------------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| VIBRATE_WHILE_RINGING | string | Yes | Yes | Whether the device vibrates when it is ringing for an incoming call. This attribute is applicable to the phone and settings applications and affects only the scenario where the device rings for an incoming call. It does not affect any other application or scenario.| +| DEFAULT_ALARM_ALERT | string | Yes | Yes | Storage area of the system default alarms and alerts. | +| DTMF_TONE_TYPE_WHILE_DIALING | string | Yes | Yes | Type of the dual tone multi-frequency (DTMF) tone played while dialing.
**0**: normal short tone.
**1**: long tone.| +| DTMF_TONE_WHILE_DIALING | string | Yes | Yes | Whether the DTMF tone is played when dialing.
**1**: DTMF tone is played when dialing.
**0**: DTMF tone is not played when dialing.| +| AFFECTED_MODE_RINGER_STREAMS | string | Yes | Yes | Which audio streams are affected by changes on the ringing mode and Do Not Disturb (DND) mode. If you want a specific audio stream to be affected by changes of the ringing mode and DDN mode, set the corresponding bit to **1**.| +| AFFECTED_MUTE_STREAMS | string | Yes | Yes | Audio streams affected by the mute mode. If you want a specific audio stream to remain muted in mute mode, set the corresponding bit to **1**.| +| DEFAULT_NOTIFICATION_SOUND | string | Yes | Yes | Storage area of the system default notification tone. | +| DEFAULT_RINGTONE | string | Yes | Yes | Storage area of the system default ringtone. | +| SOUND_EFFECTS_STATUS | string | Yes | Yes | Whether the sound feature is available.
**0**: The feature is not available.
**1**: The feature is available. | +| VIBRATE_STATUS | string | Yes | Yes | Whether the device vibrates for an event. This attribute is used inside the system.
**1**: The device vibrates for an event.
**0**: The device does not vibrate for an event.| +| HAPTIC_FEEDBACK_STATUS | string | Yes | Yes | Whether haptic feedback is enabled.
**true**: Haptic feedback is enabled.
**false**: Haptic feedback is disabled.| + +## TTS + +Provides data items for setting text-to-speech (TTS) information. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| ------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| DEFAULT_TTS_PITCH | string | Yes | Yes | Default pitch of the TTS engine.
100 = 1x. If the value is set to **200**, the frequency is twice the normal sound frequency.| +| DEFAULT_TTS_RATE | string | Yes | Yes | Default voice rate of the TTS engine.
100 = 1x. | +| DEFAULT_TTS_SYNTH | string | Yes | Yes | Default TTS engine. | +| ENABLED_TTS_PLUGINS | string | Yes | Yes | List of activated plug-in packages used for TTS. Multiple plug-in packages are separated by spaces. | + + +## wireless + +Provides data items for setting wireless network information. + +### Attributes + +**System capability**: SystemCapability.Applications.settings.Core + +| Name | Type | Readable| Writable| Description | +| --------------------------------- | ------ | ---- | ---- | ------------------------------------------------------------ | +| BLUETOOTH_DISCOVER_ABILITY_STATUS | string | Yes | Yes | Whether the device can be discovered or connected by other devices through Bluetooth.
**0**: The device cannot be discovered or connected.
**1**: The device can be connected but cannot be discovered.
**2**: The device can be discovered and connected.| +| BLUETOOTH_DISCOVER_TIMEOUT | string | Yes | Yes | Duration for discovering a device through Bluetooth, in seconds.
After the duration expires, the device cannot be discovered through Bluetooth.| +| AIRPLANE_MODE_RADIOS | string | Yes | Yes | List of radio signals to be disabled when airplane mode is enabled.
Multiple radio signals are separated by commas (,). The list can include the following: **BLUETOOTH_RADIO**, **CELL_RADIO**, **NFC_RADIO**, and **WIFI_RADIO**.| +| BLUETOOTH_RADIO | string | Yes | No | A value of **AIRPLANE_MODE_RADIOS** to indicate that Bluetooth is disabled in airplane mode.| +| CELL_RADIO | string | Yes | No | A value of **AIRPLANE_MODE_RADIOS** to indicate that cellular radio is disabled in airplane mode.| +| NFC_RADIO | string | Yes | No | A value of **AIRPLANE_MODE_RADIOS** to indicate that NFC is disabled in airplane mode.| +| WIFI_RADIO | string | Yes | No | A value of **AIRPLANE_MODE_RADIOS** to indicate that Wi-Fi is disabled in airplane mode.| +| BLUETOOTH_STATUS | string | Yes | Yes | Whether Bluetooth is available.
**true**: Bluetooth is available.
**false**: Bluetooth is unavailable.| +| OWNER_LOCKDOWN_WIFI_CFG | string | Yes | Yes | Whether the Wi-Fi configuration created by the application of the device owner should be locked down.
**true**: The Wi-Fi configuration should be locked down.
**false**: The Wi-Fi configuration should not be locked down.| +| WIFI_DHCP_MAX_RETRY_COUNT | string | Yes | Yes | Maximum number of attempts to obtain an IP address from the DHCP server. | +| WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT | string | Yes | Yes | Maximum duration to hold a wake lock when waiting for the mobile data connection to establish after the Wi-Fi connection is disconnected. | +| WIFI_STATUS | string | Yes | Yes | Whether Wi-Fi is available.
**true**: Wi-Fi is available.
**false**: Wi-Fi is unavailable.| +| WIFI_WATCHDOG_STATUS | string | Yes | Yes | Whether Wi-Fi watchdog is available.
**true**: Wi-Fi watchdog is available.
**false**: Wi-Fi watchdog is unavailable.| + +## setting.getURI + +getURI(name: string, callback: AsyncCallback\): void + +Obtains the URI of a data item. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ------------------------------------------------------------ | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| callback | AsyncCallback\ | Yes | Callback used to obtain the URI of the data item. | + +**Example** + +```js +settings.getURI(settings.display.SCREEN_BRIGHTNESS_STATUS, (uri) => { + console.log(`callback:uri -> ${JSON.stringify(uri)}`) +}) +``` + +## setting.getURI + +getURI(name: string): Promise\ + +Obtains the URI of a data item. This API uses a promise to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------------ | +| Promise\ | Promise used to return the URI of the data item.| + +**Example** + +```js +settings.getURI(settings.display.SCREEN_BRIGHTNESS_STATUS).then((uri) => { + console.log(`promise:uri -> ${JSON.stringify(uri)}`) +}) +``` + +## setting.getValue + +getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\): void + +Obtains the value of a data item in the database. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| callback | AsyncCallback\ | Yes | Callback used to return the value of the data item. | + +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); +let helper = featureAbility.acquireDataAbilityHelper(uri); +settings.getValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, (err, value) => { + if (err) { + console.error(`Failed to get the setting. ${err.message} `); + return; + } + console.log(`callback:value -> ${JSON.stringify(value)}`) +}); +``` + +## setting.getValue + +getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise\ + +Obtains the value of a data item in the database. This API uses a promise to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| + +**Return value** + +| Type | Description | +| ---------------- | ----------------------------------- | +| Promise\ | Promise used to return the value of the data item.| + +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); +let helper = featureAbility.acquireDataAbilityHelper(uri); +settings.getValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS).then((value) => { + console.log(`promise:value -> ${JSON.stringify(value)}`) +}); +``` + +## settings.setValue + +setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback\): void + +Sets the value for a data item. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| value | object | Yes | Value of the data item. The value range varies by service. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. | + +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update the value of the data item.) +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); +let helper = featureAbility.acquireDataAbilityHelper(uri); +settings.setValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '100', (status) => { + console.log('Callback return whether value is set.'); +}); +``` + +## settings.setValue + +setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise\ + +Sets the value for a data item. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| value | object | Yes | Value of the data item. The value range varies by service. | + +**Return value** +| Type | Description | +| ----------------- | -------------------------------------------------- | +| Promise\ | Promise used to return the result. Returns **true** if the operation is successful; returns **false** otherwise.| -## settings.getUriSync +**Example** + +```js +import featureAbility from '@ohos.ability.featureAbility'; + +// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValue API will update the value of the data item.) +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); +let helper = featureAbility.acquireDataAbilityHelper(uri); +settings.setValue(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '100').then((status) => { + console.log('Callback return whether value is set.'); +}); +``` + +## settings.enableAirplaneMode + +enableAirplaneMode(enable: boolean, callback: AsyncCallback\): void + +Enables or disables airplane mode. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ----------------------------------------------- | +| enable | boolean | Yes | Whether airplane mode is enabled. **true** means that airplane mode is enabled, and **false** means the opposite.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +let isEnabled = true; +settings.enableAirplaneMode(isEnabled, (err) => { + if (err) { + console.log('Failed to enable AirplaneMode.'); + return; + } + console.log('Return true if enable.'); +}) +``` + +## settings.enableAirplaneMode + +enableAirplaneMode(enable: boolean): Promise\ + +Enables or disables airplane mode. This API uses a promise to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------- | ---- | ----------------------------------------------- | +| enable | boolean | Yes | Whether airplane mode is enabled. **true** means that airplane mode is enabled, and **false** means the opposite.| + +**Return value** + +| Type | Description | +| -------------- | ------------------------- | +| Promise\ | Promise that returns no value.| + +**Example** + +```js +let isEnabled = true; +settingsenableAirplaneMode(isEnabled).then((err) => { + if (err) { + console.log('Failed to enable AirplaneMode.'); + return; + } + console.log('Return true if enable.'); +}); +``` + +## settings.canShowFloating + +canShowFloating(callback: AsyncCallback\): void + +Checks whether the application can be displayed in a floating window. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the result.
Returns **true** if the application can be displayed in a floating window; returns **false** otherwise.| + +**Example** + +```js +settings.canShowFloating((status) => { + console.log('Checks whether a specified application can show as float window.'); +}); +``` + +## settings.canShowFloating + +canShowFloating(): Promise\ + +Checks whether the application can be displayed in a floating window. This API uses a promise to return the result. + +**System capability**: SystemCapability.Applications.settings.Core + +**Return value** + +| Type | Description | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the result.
Returns **true** if the application can be displayed in a floating window; returns **false** otherwise.| + +**Example** + +```js +settings.canShowFloating().then((status) => { + console.log('Checks whether a specified application can show as float window.'); +}); +``` + +## settings.getUriSync8+ getUriSync(name: string): string @@ -25,93 +485,89 @@ Obtains the URI of a data item. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the target data item. Data items can be classified as follows:
  • Existing data items in the database, for example:
    • Brightness: 'settings.screen.brightness'
    • Time format: 'settings.time.format'
  • Custom data items
| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------ | ------------- | | string | URI of the data item.| **Example** -```typescript - // Obtain the URI of a data item. - let urivar = settings.getUriSync('settings.screen.brightness'); +```js +// Obtain the URI of a data item. +let urivar = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); ``` - -## settings.getValueSync +## settings.getValueSync8+ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string -Obtains the value of a data item. +Obtains the value of a data item. Unlike **getValue**, this API returns the result synchronously. **System capability**: SystemCapability.Applications.settings.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| -| name | string | Yes| Name of the target data item. Data items can be classified as follows:
  • Existing data items in the database, for example:
    • Brightness: 'settings.screen.brightness'
    • Time format: 'settings.time.format'
  • Custom data items
| -| defValue | string | Yes| Default value This parameter is user-defined. If it is not found in the database, the default value is returned.| + +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this attribute as needed.| **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------ | ---------------- | | string | Value of the data item.| **Example** -```typescript - import featureAbility from '@ohos.ability.featureAbility'; +```js +import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the value of 'settings.screen.brightness' (this data item already exists in the database). -let brightness = 'settings.screen.brightness'; -let uri = settings.getUriSync(brightness); +// Obtain the value of SCREEN_BRIGHTNESS_STATUS (this data item already exists in the database). +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); let helper = featureAbility.acquireDataAbilityHelper(uri); -let value = settings.getValueSync(helper, brightness, '10'); +let value = settings.getValueSync(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '10'); ``` - -## settings.setValueSync +## settings.setValueSync8+ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean -Sets the value of a data item. +Sets the value for a data item. Unlike **setValue**, this API returns the result synchronously. If the specified data item exists in the database, the **setValueSync** method updates the value of the data item. If the data item does not exist in the database, the **setValueSync** method inserts the data item into the database. -**Required permissions**: ohos.permission.WRITE_SYSTEM_SETTING +**Required permissions**: ohos.permission.MANAGE_SECUER_SETTINGS (available only to system applications) **System capability**: SystemCapability.Applications.settings.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| -| name | string | Yes| Name of the target data item. Data items can be classified as follows:
  • Existing data items in the database, for example:
    • Brightness: 'settings.screen.brightness'
    • Time format: 'settings.time.format'
  • Custom data items
| -| value | string | Yes| Value of the data item.| +| Name | Type | Mandatory| Description | +| ----------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | +| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes | **DataAbilityHelper** class. | +| name | string | Yes | Name of the target data item. Data items can be classified as follows:
- Existing data items in the database
- Custom data items| +| value | string | Yes | Value of the data item. The value range varies by service. | **Return value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ------- | ------------------------------------------------------------ | | boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.| **Example** -```typescript - import featureAbility from '@ohos.ability.featureAbility'; +```js +import featureAbility from '@ohos.ability.featureAbility'; -// Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync - method will update the value of the data item.) -let brightness = 'settings.screen.brightness'; -let uri = settings.getUriSync(brightness); +// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValueSync API will update the value of the data item.) +let uri = settings.getUriSync(settings.display.SCREEN_BRIGHTNESS_STATUS); let helper = featureAbility.acquireDataAbilityHelper(uri); -let ret = settings.setValueSync(helper, brightness, '100'); -``` \ No newline at end of file +let ret = settings.setValueSync(helper, settings.display.SCREEN_BRIGHTNESS_STATUS, '100'); +``` diff --git a/en/application-dev/reference/arkui-js/js-components-svg.md b/en/application-dev/reference/arkui-js/js-components-svg.md index 1ac5d3f287246d41e586a71069c892774e3533a3..505d287be94fd38c8a059aa7ec44b4f0164ca789 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg.md +++ b/en/application-dev/reference/arkui-js/js-components-svg.md @@ -4,9 +4,9 @@ The **\** component is a basic container. It can be used as the root node o > **NOTE** -> - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -> -> - The width and height must be defined for the **** parent component or **** component. Otherwise, the component is not drawn. +> - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> +> - The width and height must be defined for the **** parent component or **** component. Otherwise, the component is not drawn. ## Required Permissions @@ -15,21 +15,21 @@ None ## Child Components -The following are supported: [\](js-components-svg.md), [\](js-components-svg-rect.md), [\](js-components-svg-circle.md), [\](../arkui-js/js-components-svg-ellipse.md), [\](js-components-svg-path.md), [\](../arkui-js/js-components-svg-polygon.md), [\](js-components-svg-polyline.md), [\](js-components-svg-text.md), [\](js-components-svg-animate.md), and [\](js-components-svg-animateTransform.md). +The following are supported: [\](js-components-svg.md), [\](js-components-svg-rect.md), [\](js-components-svg-circle.md), [\](../arkui-js/js-components-svg-ellipse.md), [\](js-components-svg-path.md), [\](../arkui-js/js-components-svg-polygon.md), [\](js-components-svg-polyline.md), [\](js-components-svg-text.md), [\](js-components-svg-animate.md), and [\](js-components-svg-animatetransform.md). ## Attributes The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components. -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| id | string | - | No| Unique ID of the component.| -| width | <length>\|<percentage> | - | No| Component width.| -| height | <length>\|<percentage> | - | No| Component height.| -| x | <length>\|<percentage> | - | No| X-coordinate of the current **\** component. The settings do not work for the root **\** node. | -| y | <length>\|<percentage> | | No| Y-coordinate of the current **\** component. The settings do not work for the root **\** node. | -| viewBox | string | - | No| View box of the current **\** component. The supported format is \. The four parameters indicate **min-x**, **min-y**, **width**, and **height**, respectively. The width and height of the view box are different from those of the **\** component. The view box is scaled in center-aligned mode. | +| Name | Type | Default Value | Mandatory | Description | +| ------- | ---------------------------------- | ------------- | --------- | ---------------------------------------- | +| id | string | - | No | Unique ID of the component. | +| width | <length>\|<percentage> | - | No | Component width. | +| height | <length>\|<percentage> | - | No | Component height. | +| x | <length>\|<percentage> | - | No | X-coordinate of the current **\** component. The settings do not work for the root **\** node. | +| y | <length>\|<percentage> | | No | Y-coordinate of the current **\** component. The settings do not work for the root **\** node. | +| viewBox | string | - | No | View box of the current **\** component. The supported format is \. The four parameters indicate **min-x**, **min-y**, **width**, and **height**, respectively. The width and height of the view box are different from those of the **\** component. The view box is scaled in center-aligned mode. | ## Example diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md index fa391ed8fc8e82744d8f4d5fccf91bbb808db44e..3336ccfb465a74b7a938f16998ee74e3546c6d2d 100644 --- a/en/application-dev/reference/arkui-ts/Readme-EN.md +++ b/en/application-dev/reference/arkui-ts/Readme-EN.md @@ -1,4 +1,4 @@ -# TypeScript-based Declarative Development Paradigm +# eTS-based Declarative Development Paradigm - Universal Component Information - Universal Events @@ -120,12 +120,13 @@ - Canvas Components - [Canvas](ts-components-canvas-canvas.md) - [CanvasRenderingContext2D](ts-canvasrenderingcontext2d.md) - - [OffscreenCanvasRenderingConxt2D](ts-offscreencanvasrenderingcontext2d.md) - - [Lottie](ts-components-canvas-lottie.md) - - [Path2D](ts-components-canvas-path2d.md) - [CanvasGradient](ts-components-canvas-canvasgradient.md) - [ImageBitmap](ts-components-canvas-imagebitmap.md) - [ImageData](ts-components-canvas-imagedata.md) + - [OffscreenCanvasRenderingContext2D](ts-offscreencanvasrenderingcontext2d.md) + - [Path2D](ts-components-canvas-path2d.md) + - [Lottie](ts-components-canvas-lottie.md) + - Animation - [AnimatorProperty](ts-animatorproperty.md) - [Explicit Animation](ts-explicit-animation.md) @@ -136,8 +137,9 @@ - [Motion Path Animation](ts-motion-path-animation.md) - [Matrix Transformation](ts-matrix-transformation.md) - [Interpolation Calculation](ts-interpolation-calculation.md) + - Global UI Methods - - Pop-up Window + - Dialog Box - [Alert Dialog Box](ts-methods-alert-dialog-box.md) - [Action Sheet](ts-methods-action-sheet.md) - [Custom Dialog Box](ts-methods-custom-dialog-box.md) diff --git a/en/application-dev/reference/arkui-ts/figures/NestedScroll.gif b/en/application-dev/reference/arkui-ts/figures/NestedScroll.gif new file mode 100644 index 0000000000000000000000000000000000000000..4d8b706114c0bca1218f13085c7890d46c96ab28 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/NestedScroll.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/badge.png b/en/application-dev/reference/arkui-ts/figures/badge.png new file mode 100644 index 0000000000000000000000000000000000000000..0041374b52a2be5a93f620dabed0cba74990ee6f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/badge.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/defaultFocus.png b/en/application-dev/reference/arkui-ts/figures/defaultFocus.png new file mode 100644 index 0000000000000000000000000000000000000000..7d0187576fd77ab563034561f5b862bf232ac51d Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/defaultFocus.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image1_0000001184628104.png b/en/application-dev/reference/arkui-ts/figures/en-us_image1_0000001184628104.png new file mode 100644 index 0000000000000000000000000000000000000000..5986356fa4f5c8e40057ce4e6e1e16307b228b62 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image1_0000001184628104.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image2_0000001184628104.png b/en/application-dev/reference/arkui-ts/figures/en-us_image2_0000001184628104.png new file mode 100644 index 0000000000000000000000000000000000000000..b1adc0e02a67216e458df85cb263353c577e0a33 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image2_0000001184628104.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif new file mode 100644 index 0000000000000000000000000000000000000000..24702d37d233b9f10a83e4e36b8c8ff23393014f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264372.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264372.png new file mode 100644 index 0000000000000000000000000000000000000000..3a47b72b0963c84b20b208c0806f7813c7ce652b Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264372.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582848.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582848.png new file mode 100644 index 0000000000000000000000000000000000000000..a5c155b70174d682f3536fa2b23381e1ce9c9361 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582848.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001185033226.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001185033226.png new file mode 100644 index 0000000000000000000000000000000000000000..7a49afcaad7ffb5266b63835f50f42f720665a31 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001185033226.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872492.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872492.png new file mode 100644 index 0000000000000000000000000000000000000000..c564bb26b539f1e48acbdb7f2aeeca8df4e4e798 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872492.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872498.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872498.png new file mode 100644 index 0000000000000000000000000000000000000000..6c136313fe0c8774d1209a398d16ecc4b58c2bcd Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872498.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872526.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872526.png new file mode 100644 index 0000000000000000000000000000000000000000..3e7218eb57566d86457a9fbd4a8ed0f0dd490c3f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193872526.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032458.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032458.png new file mode 100644 index 0000000000000000000000000000000000000000..a07986a04b7477eec14c81d08e442d7b332dab83 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032458.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032462.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032462.png new file mode 100644 index 0000000000000000000000000000000000000000..3d93b0a0a8f5d0b527d407e450a4a13a1de991ab Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032462.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032480.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032480.png new file mode 100644 index 0000000000000000000000000000000000000000..5c0a336a56d0e5a186bd235cd25f9f5e5e7e644f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032480.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032666.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032666.png new file mode 100644 index 0000000000000000000000000000000000000000..2b9bc96da366d53da784c92620a69f602f7bff14 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194032666.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192434.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192434.png new file mode 100644 index 0000000000000000000000000000000000000000..f5cd637e5bf9db13e3334ca00413e3a91412c813 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192434.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192436.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192436.png new file mode 100644 index 0000000000000000000000000000000000000000..27556ea43f7c2ecc65b9425e243ea593f02b08ec Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192436.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192440.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192440.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5c5649cc0716abc024aa3656924a456216a4c2 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194192440.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352434.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352434.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b942fee8437b1197ef3e9f40c98187a76f8c44 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352434.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352436.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352436.png new file mode 100644 index 0000000000000000000000000000000000000000..00097d258d585ec8ad981703c5b265679e867133 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352436.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352442.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352442.png new file mode 100644 index 0000000000000000000000000000000000000000..1b1cedac00a77279faa829636bc85028fb5ec711 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194352442.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png new file mode 100644 index 0000000000000000000000000000000000000000..5855095851b92058f270d69a46546db43ec974b8 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001231374559.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001231374559.png new file mode 100644 index 0000000000000000000000000000000000000000..9eb00739d606ea0b53542eba7c43f6cbb82c73c5 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001231374559.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712439.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712439.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b942fee8437b1197ef3e9f40c98187a76f8c44 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712439.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712471.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712471.png new file mode 100644 index 0000000000000000000000000000000000000000..81710c1186a0c0448d70a443db66c09a4e46d395 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238712471.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832389.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832389.png new file mode 100644 index 0000000000000000000000000000000000000000..5c75654b85d596a346fa5d793ca84991fe859a86 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832389.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832413.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832413.png new file mode 100644 index 0000000000000000000000000000000000000000..defc3c9eb037c06b894ee2e30563facb8c8375ab Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238832413.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952377.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952377.png new file mode 100644 index 0000000000000000000000000000000000000000..abc9a5667500a749dbceee88aef4caebf5d9df18 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952377.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952387.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952387.png new file mode 100644 index 0000000000000000000000000000000000000000..241fe8546ea2acfdb7baf2c5e66a8af2f0d7b593 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238952387.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001251092975.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001251092975.png new file mode 100644 index 0000000000000000000000000000000000000000..05e44b9914ea290f512ed0c2cbc3502b584cd0af Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001251092975.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777771.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777771.png new file mode 100644 index 0000000000000000000000000000000000000000..06cbacf1470de12c79c2020aa8c6be95506e58b5 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777771.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777772.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777772.png new file mode 100644 index 0000000000000000000000000000000000000000..9c68b723dd3966886d384028663d4a7d6633c027 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777772.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777773.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777773.png new file mode 100644 index 0000000000000000000000000000000000000000..7dbcbb2d5710b17866b9d5b034437b91a700a3f9 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777773.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png new file mode 100644 index 0000000000000000000000000000000000000000..60f430b646b45a3e3b16a9bb024e4a14e48bf4d3 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png new file mode 100644 index 0000000000000000000000000000000000000000..60f430b646b45a3e3b16a9bb024e4a14e48bf4d3 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777778.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777778.png new file mode 100644 index 0000000000000000000000000000000000000000..19e99b9ef490fff79e64e33192c97c1a39c6edf9 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777778.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png new file mode 100644 index 0000000000000000000000000000000000000000..4558b332925757d97d70ee57182c260804629346 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777780.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777780.png new file mode 100644 index 0000000000000000000000000000000000000000..9b35e8e0fc4bb514584813b79e8889cfe65649a7 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777780.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777781.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777781.png new file mode 100644 index 0000000000000000000000000000000000000000..9e0a95f73b1aec44e6bccd6750a1c9f2815178ee Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777781.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_1501929990650.jpg b/en/application-dev/reference/arkui-ts/figures/en-us_image_1501929990650.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ca0ec86c6c71b6c6daa60bf3ee43795f33568c64 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_1501929990650.jpg differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png new file mode 100644 index 0000000000000000000000000000000000000000..e9a7b0e3baa6d48739c2a3cfbc7b5b46600f9c70 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_visible_area_change.gif b/en/application-dev/reference/arkui-ts/figures/en-us_visible_area_change.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b82bc987ff6d8bbe42f00e73148b35c445fa8c8 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_visible_area_change.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/focus.png b/en/application-dev/reference/arkui-ts/figures/focus.png new file mode 100644 index 0000000000000000000000000000000000000000..217dcfbca0de33adef4ffa0d90fd167192845c3c Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/focus.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/focusOnTouch.png b/en/application-dev/reference/arkui-ts/figures/focusOnTouch.png new file mode 100644 index 0000000000000000000000000000000000000000..afc9d772307fd103ac57f11211f0c188e82f46b2 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/focusOnTouch.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/grid-autofill.png b/en/application-dev/reference/arkui-ts/figures/grid-autofill.png new file mode 100644 index 0000000000000000000000000000000000000000..c45eee033be4548744fd84bbcb5ba29d17868e69 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/grid-autofill.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/gridrow.png b/en/application-dev/reference/arkui-ts/figures/gridrow.png new file mode 100644 index 0000000000000000000000000000000000000000..ec3c488eed555b83c695c233db992e69c4af639a Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gridrow.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus1.png b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus1.png new file mode 100644 index 0000000000000000000000000000000000000000..12eeaab8f9f0f2b4aa9cb619b0fd07776dc18bd9 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus1.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus2.png b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus2.png new file mode 100644 index 0000000000000000000000000000000000000000..f1cc053a757c9020a0f53fcb3a5076eed7df5c8a Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus2.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus3.png b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus3.png new file mode 100644 index 0000000000000000000000000000000000000000..115c022b24345fe60008367665feae57ec9fc18f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/groupDefaultFocus3.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/image-effect.png b/en/application-dev/reference/arkui-ts/figures/image-effect.png new file mode 100644 index 0000000000000000000000000000000000000000..fc2c9b7d49f7d698aac11d2ede6b0cc58222c7ca Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/image-effect.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/loadingProgress.png b/en/application-dev/reference/arkui-ts/figures/loadingProgress.png deleted file mode 100644 index afc52b1a469c858e3029282e193b684114803db0..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/loadingProgress.png and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/patternlock.gif b/en/application-dev/reference/arkui-ts/figures/patternlock.gif new file mode 100644 index 0000000000000000000000000000000000000000..5fb034ddcf247a1fecaaeb33e27d103bd8225a91 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/patternlock.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/popup.gif b/en/application-dev/reference/arkui-ts/figures/popup.gif new file mode 100644 index 0000000000000000000000000000000000000000..b32a43bd8fc4ae6416b8402c61e1d8e3b9e694ef Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/popup.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/relativecontainer.png b/en/application-dev/reference/arkui-ts/figures/relativecontainer.png new file mode 100644 index 0000000000000000000000000000000000000000..ebe9c3c7f6ba5ba6756b61f757894cc3f69014bf Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/relativecontainer.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/requestFocus1.png b/en/application-dev/reference/arkui-ts/figures/requestFocus1.png new file mode 100644 index 0000000000000000000000000000000000000000..0a0d6cedda78aa62c8d8305686cb651940d9ad52 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/requestFocus1.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/requestFocus2.png b/en/application-dev/reference/arkui-ts/figures/requestFocus2.png new file mode 100644 index 0000000000000000000000000000000000000000..240db2460748f04d64fa7198b749ee95a8a16a48 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/requestFocus2.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/requestFocus3.png b/en/application-dev/reference/arkui-ts/figures/requestFocus3.png new file mode 100644 index 0000000000000000000000000000000000000000..7aa241956ef0e9c2edfdbb683f8e3d1306ac7349 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/requestFocus3.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/richText.png b/en/application-dev/reference/arkui-ts/figures/richText.png new file mode 100644 index 0000000000000000000000000000000000000000..65826de750d037a394178b66805a9d1ffdad374e Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/richText.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/textExp1.png b/en/application-dev/reference/arkui-ts/figures/textExp1.png new file mode 100644 index 0000000000000000000000000000000000000000..15d8410388040337f52a039f946d20f3cc0504fc Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/textExp1.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/textExp2.png b/en/application-dev/reference/arkui-ts/figures/textExp2.png new file mode 100644 index 0000000000000000000000000000000000000000..f6d1aa365e071f3064e25fe45afa4ce4efcddb65 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/textExp2.png differ diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md index a5e319adf7338b080bffc01d944805768a5b4f5a..0c147f8a790adf574ba2fa56ee3ede6521727031 100644 --- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -1,20 +1,27 @@ # Property Animator -You can create a property animator to animate the universal attributes of a component. +You can create a property animator to animate certain universal attributes of a component, including **width**, **height**, **backgroundColor**, **opacity**, **scale**, **rotate**, and **translate**. > **NOTE** > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +animation(value: {duration?: number, tempo?: number, curve?: string | Curve, delay?:number, iterations: number, playMode?: PlayMode, onFinish?: () => void}) +Applies a property animator to the component to animate its attributes over time. -| Name | Type | Default Value | Description | -| ---------- | ---------------------------------------- | --------------- | ----------------------- | -| duration | number | 1000 | Animation duration, in ms. The default duration is 1000 ms. | -| curve | [Curve](ts-appendix-enums.md#curve) | Curve.Linear | Animation curve. The default curve is linear. | -| delay | number | 0 | Delay of animation playback, in ms. By default, the playback is not delayed. | -| iterations | number | 1 | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. | -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | PlayMode.Normal | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.| +**Parameters** + + +| Name | Type | Mandatory | Description | +| ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | +| duration | number | No | Animation duration, in ms.
Default value: **1000**| +| tempo | number | No | Animation playback speed. A greater value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**| +| curve | string \| [Curve](ts-appendix-enums.md#curve) | No | Animation curve.
Default value: **Curve.Linear** | +| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.
Default value: **0** | +| iterations | number | No | Number of times that the animation is played. The value **-1** indicates that the animation is played for an unlimited number of times.
Default value: **1**| +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**| +| onFinish | () => void | No | Callback invoked when the animation playback is complete. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md index 178b4f1763fa27e1bbf0f75d46c3c5029cbfcbe6..72ca6bde7e8b739fd58c057a36c095276bf1542e 100644 --- a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -54,14 +54,14 @@ ## MouseButton -| Name | Description | -| ------- | ---------------- | -| Left | Left button on the mouse. | -| Right | Right button on the mouse. | -| Middle | Middle button on the mouse. | -| Back | Back button on the left of the mouse.| -| Forward | Forward button on the left of the mouse.| -| None | No button. | +| Name | Description | +| ------- | ---------------------------------------- | +| Left | Left button on the mouse. | +| Right | Right button on the mouse. | +| Middle | Middle button on the mouse. | +| Back | Back button on the left of the mouse. | +| Forward | Forward button on the left of the mouse. | +| None | No button. | ## MouseAction diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md index 20057bc1c5350b88435782baf7c86c7d576ef652..618dd77ec6f2e7935aa90e4bd2edf17fd9b6eb29 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md @@ -1,54 +1,66 @@ # CheckboxGroup -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - The **\** component is used to select or deselect all check boxes in a group. -## Required Permissions - -None +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components -None +Not supported ## APIs -CheckboxGroup( group?: string ) +CheckboxGroup(options?: { group?: string }) Creates a check box group so that you can select or deselect all check boxes in the group at the same time. Check boxes and the check box group that share the group name belong to the same group. -- Parameters - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | group | string | No| - | Group name.| +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| group | string | No| Group name.| ## Attributes -| Name| Type| Default Value| Description| + +| Name| Type| Default Value | Description| | -------- | -------- | -------- | -------- | -| selectAll | bool | false | Whether to select all.| -| selectedColor | Color | - | Color of the selected check box.| +| selectAll | boolean | false | Whether to select all. | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor8) | - | Color of the selected check box.| ## Events -| Name| Description| -| -------- | -------- | -| onChange (callback: (names: Array<string>, status: SelectStatus) => void ) |Triggered when the selection status of the check box group or any check box wherein changes.
- **names**: names of all selected check boxes in the group.
- **status**: selection status.| +## onChange + +onChange (callback: (event: CheckboxGroupResult ) => void ) -- SelectStatus enums - | Name | Description| - | ----- | -------------------- | - | All | All check boxes in the group are selected.| - | Part | Some check boxes in the group are selected.| - | None | None of the check boxes in the group are selected.| +Triggered when the selection status of the check box group or any check box wherein changes. + +| Name | Type | Mandatory | Description | +| ----- | ------------------- | --------- | ----------------------------------- | +| event | CheckboxGroupResult | Yes | Callback used to return the result. | + +## CheckboxGroupResult +| Name | Type | Description | +| ------ | ------ | ------- | +| name | Array<string> | Names of all the selected check boxes in the group.| +| status | SelectStatus | Selected status.| + +## SelectStatus + +| Name | Description| +| ----- | -------------------- | +| All | All check boxes in the group are selected.| +| Part | Some check boxes in the group are selected.| +| None | None of the check boxes in the group are selected.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct CheckboxExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md index a3f94c3873ee27c1df3dabe2b15d769227672003..291b5d3273c6f71649c679b962232780b7b0b68e 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md @@ -1,50 +1,54 @@ # Gauge +The **\** component is used to display data in a ring chart. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - -Data gauge chart widget, which is used to display data in a ring chart. - - -## Required Permissions - -None +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components -None +Not supported ## APIs -Gauge(value:{value: number, min?: number, max?: number}) +Gauge(options:{value: number, min?: number, max?: number}) -- Parameter - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | value | number | Yes | - | Current data value. | - | min | number | No | 0 | Minimum value of the current data segment. | - | max | number | No | 100 | Maximum value of the current data segment. | +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | number | Yes| Current data value.| +| min | number | No| Minimum value of the current data segment.
Default value: **0**| +| max | number | No| Maximum value of the current data segment.
Default value: **100**| ## Attributes -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| value | number | 0 | Sets the value of the current data chart. | -| startAngle | Angle | -150 | Set the start angle. Clock 0 indicates 0 degree, and the clockwise direction indicates the positive angle. | -| endAngle | Angle | 150 | Sets the end angle position. The clock 0 point is 0 degree, and the clockwise direction is the positive angle. | -| colors | Color \| Array<ColorStop> | - | Set the color of the chart. You can set the pure color or segmental gradient color. | -| strokeWidth | Length | - | Sets the ring thickness of a ring chart. | +| Name| Type| Description| +| -------- | -------- | -------- | +| value | number | Value of the chart.
Default value: **0**| +| startAngle | number | Start angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **-150**| +| endAngle | number | End angle of the chart. The value 0 indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **150**| +| colors | Array<ColorStop> | Colors of the chart. Colors can be set for individual segments.| +| strokeWidth | [Length](ts-types.md#length) | Stroke width of the chart.| + +## ColorStop + +Describes a gradient stop. + +| Name | Type | Description | +| --------- | -------------------- | ------------------------------------------------------------ | +| ColorStop | [[ResourceColor](ts-types.md#resourcecolor8), number] | Type of the gradient stop. The first parameter specifies the color, and the second parameter specifies the offset, which ranges from 0 to 1.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct GaugeExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index ad9af15417c6964f9de052985b1f54e88b6f8400..b88b175789c9aa37e06ff27c24072a68ecb4badf 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -1,26 +1,14 @@ # Image -The **\** component is used to render and display local and online images. +The **\** component is used to render and display images. -> **NOTE** +> **NOTE** > -> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions -To use online images, you need to add the **ohos.permission.INTERNET** permission to the corresponding abilities in the **config.json** (for the FA model) or **module.json5** file (for the stage model). - -``` -"abilities": [ - { - ... - "permissions": ["ohos.permission.INTERNET"], - ... - } -] -``` - +To use online images, the application must have the **ohos.permission.INTERNET** permission. For details about how to apply for a permission, see [Declaring Permissions](../../security/accesstoken-guidelines.md). ## Child Components @@ -31,37 +19,38 @@ Not supported Image(src: string | PixelMap | Resource) -Obtains an image from the specified source for subsequent rendering and display. - **Parameters** -| Name | Type | Mandatory | Default Value | Description | -| ---- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | -| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | - | Image source. Both local and online images are supported.
When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.
- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. \ The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.
\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability.| +| Name| Type | Mandatory| Default Value| Description | +| ------ | ------------------------------------------------------------ | ---- | ------ | ------------------------------------------------------------ | +| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7)\| [Resource](ts-types.md#resource) | Yes | - | Image source. Both local and online images are supported.
When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.
- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.
\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability.
\- Strings with the `file:///data/storage` prefix are supported, which are used to read image resources in the` files` folder in the installation directory of the application. Using such strings requires read permission on the files in the installation directory. | ## Attributes - -| Name | Type | Default Value | Description | -| --------------------- | ------------------------------------------------------- | ------------------------ | ------------------------------------------------------------ | -| alt | string \| [Resource](ts-types.md#resource) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. | -| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Cover | Image scale type. | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.
**NOTE**
This attribute is not applicable to SVG images. | -| interpolation | ImageInterpolation | None | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.
**NOTE**
> This attribute is not applicable to SVG images.
> This attribute is not applicable to **PixelMap** objects. | -| renderMode | ImageRenderMode | Original | Rendering mode of the image.
**NOTE**
This attribute is not applicable to SVG images. | -| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects. | -| matchTextDirection | boolean | false | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.| -| fitOriginalSize | boolean | true | Whether to fit the component to the original size of the image source when the component size is not set.| -| fillColor | [ResourceColor](ts-types.md#resourcecolor8) | - | Fill color. This parameter is valid only for SVG images. Once set, the fill color will replace that of the SVG image.| -| autoResize | boolean | true | Whether to resize the image source used for drawing based on the size of the display area during image decoding. This resizing can help reduce the memory usage.| -| syncLoad8+ | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | +| Name | Type | Default Value | Description | +| --------------------- | ---------------------------------------- | -------- | ---------------------------------------- | +| alt | string \| [Resource](ts-types.md#resource) | - | Placeholder image displayed during loading. Only local images are supported. | +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Cover | Image scale mode. | +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.
> **NOTE**
> This attribute is not applicable to SVG images.| +| interpolation | ImageInterpolation | None | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.
> **NOTE**
> This attribute is not applicable to SVG images or **PixelMap** objects. | +| renderMode | ImageRenderMode | Original | Rendering mode of the image.
> **NOTE**
> This attribute is not applicable to SVG images.| +| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size. If the value is of the number type, the unit px is used.
> **NOTE**
> This attribute is not applicable to **PixelMap** objects.| +| matchTextDirection | boolean | false | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context. | +| fitOriginalSize | boolean | true | Whether to fit the component to the original size of the image source when the component size is not set. | +| fillColor | [ResourceColor](ts-types.md#resourcecolor8) | - | Fill color of the image. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image. | +| autoResize | boolean | true | Whether to resize the image source used for drawing based on the size of the display area during image decoding. This resizing can help reduce the memory usage.| +| syncLoad8+ | boolean | false | Whether to load the image synchronously. By default, the image is loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | + +> **NOTE** +> +> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, **animate**, **animateMotion**, and **animateTransform**. ## ImageInterpolation -| Name | Description | -| ------ | ------------------------- | -| None | Interpolation image data is not used. | -| High | The interpolation image data is used at the high level, which may affect the image rendering speed.| +| Name | Description | +| ------ | ------------------------ | +| None | Interpolation image data is not used. | +| High | The interpolation image data is used at the high level. The use of the interpolation image data may affect the image rendering speed.| | Medium | The interpolation image data is used at the medium level. | | Low | The interpolation image data is used at the low level. | @@ -74,12 +63,11 @@ Obtains an image from the specified source for subsequent rendering and display. ## Events - -| Name | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status. | -| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels. | -| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered. | +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The loaded image is returned. | +| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | Triggered when an exception occurs during image loading. | +| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.| ## Example @@ -281,3 +269,53 @@ struct ImageExample3 { ``` ![en-us_image_0000001256858397](figures/en-us_image_0000001256858397.gif) + +### Rendering Sandbox Images + +``` +import fileio from '@ohos.fileio'; +import image from '@ohos.multimedia.image'; + +const EMPTY_PATH = 'file://'; + +@Entry +@Component +struct LoadImageExample { + @State fileContent: string = ''; + @State path: string = EMPTY_PATH; + @State accountInfoHeadPic: any = ''; + + build() { + Column() { + Button ('Read Sandbox Image') + .margin({ bottom: 10 }) + .onClick(() => { + try { + this.path = EMPTY_PATH; + let context = getContext(this); + let path = context.getApplicationContext().filesDir + '/icon.png'; + console.log(`Read the sandbox image=========>${path}`); + let fd = fileio.openSync(path, 0o100, 0o666); + console.log(`create file========>${fd}`); + let srcPath = context.bundleCodeDir + '/entry/resource/base/media/icon.png'; + fileio.copyFileSync(srcPath, path); + console.log(`error:=============>${e.message}`); + } + }) + Button ('Read Image') + .margin({ bottom: 10 }) + .onClick(() => { + this.path = EMPTY_PATH; + this.path += getContext(this.bundleCodeDir + '/entry/resource/base/media/icon.png'); + }) + Text(`Image path: ${this.path}`) + .fontSize(20) + .margin({ bottom: 10 }) + Image(this.path) + .width(100) + .height(100) + } + .width('100%').height('100%') + } +} +``` diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md index 6c80d5cd13ecebefa967428034e6e68bbe00fe2d..424dfa4ce2af05f60aafa7ba28d13a4f8de3b9cb 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md @@ -1,18 +1,15 @@ # ImageAnimator - The **\** component enables images to be played frame by frame. The list of images to be played can be configured, and the duration of each image can be configured. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - ## Required Permissions None - ## Child Components Not supported @@ -25,17 +22,16 @@ ImageAnimator() ## Attributes -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| images | Array<{
src: string,
width?: number \| string,
height?: number \| string,
top?: number \| string,
left?: number \| string,
duration?: number
}> | [] | Yes| Image frame information. The information of each frame includes the image path, image size, image position, and image playback duration. The detailed description is as follows:
**src**: image path. The image format can be SVG, PNG, or JPG.
**width**: image width.
**height**: image height.
**top**: vertical coordinate of the image relative to the upper left corner of the component.
**left**: horizontal coordinate of the image relative to the upper left corner of the component.
**duration**: playback duration of the image, in ms. | -| state | [AnimationStatus](ts-appendix-enums.md#animationstatus) | Initial | No| Playback status of the animation. The default status is **Initial**.| -| duration | number | 1000 | No| Playback duration, in ms. The default duration is 1000 ms. When the duration is **0**, no image is played. The value change takes effect only at the beginning of the next cycle. When a separate duration is set in **images**, the setting of this attribute is invalid.| -| reverse | boolean | false | No| Playback sequence. The value **false** indicates that images are played from the first one to the last one, and **true** indicates that images are played from the last one to the first one.| -| fixedSize | boolean | true | No| Whether the image size is the same as the component size.
**true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid.
**false**: The width, height, top, and left attributes of each image must be set separately.| -| preDecode | number | 0 | No| Whether to enable pre-decoding. The default value **0** indicates that pre-decoding is disabled. The value **2** indicates that two images following the currently playing frame will be cached in advance to improve performance.| -| fillMode | [FillMode](ts-appendix-enums.md#fillmode) | Forwards | No| Status before and after the animation starts. For details about the options, see **FillMode**.| -| iterations | number | 1 | No| Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times.| - +| Name | Type | Default Value | Mandatory | Description | +| ---------- | ----------------------- | -------- | -------- | -------- | +| images | Array<{
src: string,
width?: number \| string,
height?: number \| string,
top?: number \| string,
left?: number \| string,
duration?: number
}> | [] | No | Image frame information. The information of each frame includes the image path, image size, image position, and image playback duration. The detailed description is as follows:
**src**: image path. The image format can be SVG, PNG, or JPG.
**width**: image width.
**height**: image height.
**top**: vertical coordinate of the image relative to the upper left corner of the component.
**left**: horizontal coordinate of the image relative to the upper left corner of the component.
**duration**: playback duration of the image, in ms. | +| state | [AnimationStatus](ts-appendix-enums.md#animationstatus) | Initial | No | Playback status of the animation. | +| duration | number | 1000 | No | Playback duration, in ms. The default duration is 1000 ms. When the duration is **0**, no image is played. The value change takes effect only at the beginning of the next cycle. When a separate duration is set in **images**, the setting of this attribute is invalid. | +| reverse | boolean | false | No | Playback sequence. The value **false** indicates that images are played from the first one to the last one, and **true** indicates that images are played from the last one to the first one. | +| fixedSize | boolean | true | No | Whether the image size is the same as the component size.
**true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid.
**false**: The width, height, top, and left attributes of each image must be set separately. | +| preDecode | number | 0 | No | Whether to enable pre-decoding. The default value **0** indicates that pre-decoding is disabled. The value **2** indicates that two images following the currently playing frame will be cached in advance to improve performance. | +| fillMode | [FillMode](ts-appendix-enums.md#fillmode) | Forwards | No | Status before and after the animation starts. For details about the options, see **FillMode**. | +| iterations | number | 1 | No | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. | ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md index 9f7c56e96f21ed242fe4764cd8bebab46e80005a..a92a770f5d252e130adfa13ad44ac9f2a4f68434 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md @@ -1,33 +1,32 @@ # LoadingProgress -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - -The **\** component is used to display the loading progress. +The **\** component is used to create a loading animation. -## Required Permissions +> **NOTE** +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -None ## Child Components -None +Not supported + ## APIs LoadingProgress() -Creates a **LoadingProgress** instance. +Creates a **\** component. ## Attributes -| Name | Type | Default Value | Description | -| ----- | ----- | ------------- | ---------------------------------------- | -| color | Color | - | Foreground color of the loading progress bar. | +| Name| Type| Description| +| -------- | -------- | -------- | +| color | [ResourceColor](ts-types.md#resourcecolor8) | Foreground color of the **\** component.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct LoadingProgressExample { @@ -41,4 +40,4 @@ struct LoadingProgressExample { } ``` -![zh-cn_image_0000001198839004](figures/loadingProgress.png) \ No newline at end of file +![en-us_image_000000111864201](figures/en-us_image_000000111864201.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md index dc89934a2760b1c67f84ca216530d0c3a58752e9..3f50f29acd0356a7001470670cfd8666241e349e 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md @@ -1,14 +1,13 @@ # Marquee +The **\** component is used to display a scrolling piece of text. The text is scrolled only when its width exceeds the width of the **\** component. + > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -The **\** component is used to display a scrolling piece of text. The text is scrolled only when its width exceeds the width of the **\** component. - - ## Required Permissions None @@ -23,23 +22,28 @@ Not supported Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) -- Parameters - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | start | boolean | Yes| - | Whether to start scrolling.| - | step | number | No| 6 | Scrolling step.| - | loop | number | No| -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.| - | fromStart | boolean | No| true | Whether the text scrolls from the start.| - | src | string | Yes| - | Text to scroll.| +**Parameters** +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| start | boolean | Yes| - | Whether to start scrolling.| +| step | number | No| 6 | Scrolling step.| +| loop | number | No| -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.| +| fromStart | boolean | No| true | Whether the text scrolls from the start.| +| src | string | Yes| - | Text to scroll.| + +## Attributes +| Name | Type| Default Value | Description | +| ---------- | -------- | ------------------------------------ | ------------------------------------ | +| allowScale | boolean | false | Whether to allow text to scale. | ## Events | Name| Description| | -------- | -------- | -| onStart(callback: () => void) | Triggered when the marquee starts scrolling.| -| onBounce(callback: () => void) | Triggered when the marquee has reached the end.| -| onFinish(callback: () => void) | Triggered when the marquee has finished scrolling.| +| onStart(event: () => void) | Triggered when the marquee starts scrolling.| +| onBounce(event: () => void) | Triggered when the marquee has reached the end.| +| onFinish(event: () => void) | Triggered when the marquee has finished scrolling.| ## Example @@ -84,7 +88,7 @@ struct MarqueeExample { Button('start') .onClick(() => { this.start = true - }) + }) .width(200) .height(60) .margin({bottom:20}) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md index b4d89bd97a63514d77f168827d73e1f800de6c1d..e3df10507ce4a8077942bfc43d12ea59611da8ad 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md @@ -1,18 +1,12 @@ # Navigation +The **\** component typically functions as the root container of a page and displays the page title, toolbar, and menu based on the attribute settings. -> **NOTE**
+> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -The **<Navigation>** component typically functions as the root container of a page and displays the page title, toolbar, and menu based on the attribute settings. - - -## Required Permissions - -None - - ## Child Components Supported @@ -24,56 +18,58 @@ Navigation() Creates a component that can automatically display the navigation bar, title, and toolbar based on the attribute settings. - ## Attributes -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| title | string \| [CustomBuilder](../../ui/ts-types.md) | - | Page title. | -| subtitle | string | - | Subtitle of the page. | -| menus | Array<NavigationMenuItem> \| [CustomBuilder](../../ui/ts-types.md) | - | Menu in the upper right corner of the page. | -| titleMode | NavigationTitleMode | NavigationTitleMode.Free | Display mode of the page title bar. | -| toolBar | {
items:[
Object
] }
\| [CustomBuilder](../../ui/ts-types.md) | - | Content of the toolbar.
**items**: all items on the toolbar. | -| hideToolBar | boolean | false | Whether to hide the toolbar.
**true**: Hide the toolbar.
**false**: Show the toolbar. | -| hideTitleBar | boolean | false | Whether to hide the title bar. | -| hideBackButton | boolean | false | Whether to hide the back button. | - -- NavigationMenuItem attributes - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | value | string | Yes | - | Text of an option on the menu bar. | - | icon | string | No | - | Icon path of an option on the menu bar. | - | action | () => void | No | - | Callback invoked when an option is selected. | - -- Object attributes - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | value | string | Yes | - | Text of an option on the toolbar. | - | icon | string | No | - | Icon path of an option on the toolbar. | - | action | () => void | No | - | Callback invoked when an option is selected. | - -- NavigationTitleMode enums - | Name | Description | - | -------- | -------- | - | Free | When the content is a scrollable component, the title shrinks as the content scrolls up (the subtitle fades out with its size remaining unchanged) and restores as the content scrolls down. | - | Mini | The mode is fixed at mini mode (icon + main title and subtitle). | - | Full | The mode is fixed at full mode (main title and subtitle). | - - > **NOTE** - > Currently, only the scrollable component **<List>** is supported. +| Name | Type | Description | +| -------------- | ---------------------------------------- | ---------------------------------------- | +| title | string \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Page title. | +| subtitle | string | Subtitle of the page. | +| menus | Array8+ | Menu in the upper right corner of the page. | +| titleMode | NavigationTitleMode | Display mode of the page title bar.
Default value: **NavigationTitleMode.Free**| +| toolBar | object \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Content of the toolbar.
**items**: all items on the toolbar. | +| hideToolBar | boolean | Whether to hide the toolbar.
Default value: **false**
**true**: Hide the toolbar.
**false**: Show the toolbar.| +| hideTitleBar | boolean | Whether to hide the title bar.
Default value: **false** | +| hideBackButton | boolean | Whether to hide the back button.
Default value: **false** | + +## NavigationMenuItem + +| Name | Type | Mandatory| Description | +| ------ | ----------------------- | ---- | ------------------------------ | +| value | string | Yes | Text of a menu item. | +| icon | string | No | Icon path of a menu item.| +| action | () => void | No | Callback invoked when a menu item is selected. | + +## object + +| Name | Type | Mandatory| Description | +| ------ | ----------------------- | ---- | ------------------------------ | +| value | string | Yes | Text of an option on the toolbar. | +| icon | string | No | Icon path of an option on the toolbar.| +| action | () => void | No | Callback invoked when an option is selected. | + +## NavigationTitleMode + +| Name | Description | +| ---- | ---------------------------------------- | +| Free | When the content is a scrollable component, the main title shrinks as the content scrolls down (the subtitle fades out with its size remaining unchanged) and restores when the content scrolls up to the top.| +| Mini | The icon, main title, and subtitle are in mini mode. | +| Full | The main title and subtitle are in full mode. | + +> **NOTE** +> +> Currently, the scrollable component can only be **\**. ## Events -| Name | Description | -| -------- | -------- | -| onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void) | Triggered when **titleMode** is set to **NavigationTitleMode.Free** and the title bar mode changes as content scrolls. | +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void) | Triggered when **titleMode** is set to **NavigationTitleMode.Free** and the title bar mode changes as content scrolls.| ## Example - -``` +```ts // Example 01 @Entry @Component @@ -161,8 +157,7 @@ struct NavigationExample { ![en-us_image_0000001256978359](figures/en-us_image_0000001256978359.gif) - -``` +```ts // Example 02 @Entry @Component diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 9310f9df68a9a7a7157bf0ebe736c2e458b65efb..662ffc7437edc402aea5cfb476c77aeb512cbb92 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -1,17 +1,10 @@ # Progress +The **\** component is used to provide a progress indicator that displays the progress of content loading or an operation. -> **NOTE** +> **NOTE** > -> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - - -The **\** component is used to provide a progress bar that displays the progress of content loading or an operation. - - -## Required Permissions - -None +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components @@ -21,40 +14,50 @@ Not supported ## APIs -Progress(value: {value: number, total?: number, type?: ProgressType}) +Progress(options: {value: number, total?: number, style?: ProgressStyle, type?: ProgressType}) -Creates a progress bar. +Creates a progress indicator. -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | value | number | Yes | - | Current progress. | - | total | number | No | 100 | Total progress. | - | type | ProgressType | No | ProgressType.Linear | Type of the progress bar. | - - -- ProgressType enums - | Name | Description | - | -------- | -------- | - | Linear | Linear type. | - | Ring8+ | Ring type without scale. The ring fills up as the progress increases. | - | Eclipse | Eclipse type, which visualizes the progress in a way similar to the moon waxing from new to full. | - | ScaleRing8+ | Ring type with scale, which is similar to the clock scale style. | - | Capsule8+ | Capsule type. At both ends, the progress bar changes from an arc to a straight line and from a straight line to an arc. In the middle part of the capsule, the progress bar moves to the right. | +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | number | Yes| Current progress.| +| total | number | No| Total progress.
Default value: **100**| +| type8+ | ProgressType | No| Type of the progress indicator.
Default value: **ProgressType.Linear**| +| styledeprecated | ProgressStyle | No| Style the progress indicator.
This parameter is deprecated since API version 8. You are advised to use **type** instead.
Default value: **ProgressStyle.Linear**| + +## ProgressType + +| Name| Description| +| -------- | -------- | +| Linear | Linear type.| +| Ring8+ | Indeterminate ring type. The ring fills up as the progress increases.| +| Eclipse | Eclipse type, which visualizes the progress in a way similar to the moon waxing from new to full.| +| ScaleRing8+ | Determinate ring type, which is similar to the clock scale.| +| Capsule8+ | Capsule type. At both ends, the progress indicator works in a same manner as the eclipse type. In the middle part of the capsule, the progress indicator works in a same manner as the linear type.| + +## ProgressStyle + +| Name | Description | +| --------- | ------------------------------------------------------------ | +| Linear | Linear type. | +| Ring | Indeterminate ring type. The ring fills up as the progress increases. | +| Eclipse | Eclipse type, which visualizes the progress in a way similar to the moon waxing from new to full.| +| ScaleRing | Determinate ring type, which is similar to the clock scale. | +| Capsule | Capsule type. At both ends, the progress indicator works in a same manner as the eclipse type. In the middle part of the capsule, the progress indicator works in a same manner as the linear type.| ## Attributes -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| value | number | - | Current progress. | -| color | Color | - | Background color of the progress bar. | -| style8+ | {
strokeWidth? : Length,
scaleCount? : number,
scaleWidth? : Length
} | - | Component style.
- **strokeWidth**: width of the progress bar.
- **scaleCount**: scale count of the circular progress bar.
- **scaleWidth**: scale width of the circular progress bar.
If the scale thickness is greater than the progress bar width, the default scale thickness is used. | +| Name| Type| Description| +| -------- | -------- | -------- | +| value | number | Current progress.| +| color | [ResourceColor](ts-types.md#resourcecolor8) | Background color of the progress indicator.| +| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | Component style.
- **strokeWidth**: stroke width of the progress indicator.
- **scaleCount**: number of divisions on the determinate ring-type process indicator.
- **scaleWidth**: scale bar width of the determinate ring-type process indicator. If it is greater than the progress indicator width, the default value is used instead.| ## Example - ```ts // xxx.ets @Entry diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md b/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md index 2b1970cdfde2fd84412f62bab07d4535763a2ccc..30b4d541419de2d1d1efe70511f6e990b3bd2fe0 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md @@ -1,50 +1,45 @@ # Radio -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - - The **\** component allows users to select from a set of mutually exclusive options. - -## Required Permissions - -None +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components -None +Not supported ## APIs Radio(options: {value: string, group: string}) -- Parameters - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | value | string | Yes| - | Value of the current radio button.| - | group | string | Yes| - | Name of the group to which the radio button belongs. Only one radio button in a given group can be selected at a time.| +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | string | Yes| Value of the current radio button.| +| group | string | Yes| Name of the group to which the radio button belongs. Only one radio button in a given group can be selected at a time.| ## Attributes -| Name| Type| Default Value| Description| -| -------- | -------- | -------- | -------- | -| checked | boolean | false | Whether the radio button is selected.| - +| Name| Type| Description| +| -------- | -------- | -------- | +| checked | boolean | Whether the radio button is selected.
Default value: **false**| ## Events -| Name| Description| +| Name| Description| | -------- | -------- | -| onChange(callback: (value: boolean) => void) | Triggered when the selected state of the radio button changes.
-The value **true** means that the radio button is selected.
-The value **false** means that the radio button is not selected.| +| onChange(callback: (isChecked: boolean) => void) | Triggered when the selected state of the radio button changes.
- If **isChecked** is **true**, the radio button is selected.
- If **isChecked** is **false**, the radio button is not selected.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct RadioExample { @@ -55,8 +50,8 @@ struct RadioExample { Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true) .height(50) .width(50) - .onChange((value: boolean) => { - console.log('Radio1 status is ' + value) + .onChange((isChecked: boolean) => { + console.log('Radio1 status is ' + isChecked) }) } Column() { @@ -64,8 +59,8 @@ struct RadioExample { Radio({ value: 'Radio2', group: 'radioGroup' }).checked(false) .height(50) .width(50) - .onChange((value: boolean) => { - console.log('Radio2 status is ' + value) + .onChange((isChecked: boolean) => { + console.log('Radio2 status is ' + isChecked) }) } Column() { @@ -73,8 +68,8 @@ struct RadioExample { Radio({ value: 'Radio3', group: 'radioGroup' }).checked(false) .height(50) .width(50) - .onChange((value: boolean) => { - console.log('Radio3 status is ' + value) + .onChange((isChecked: boolean) => { + console.log('Radio3 status is ' + isChecked) }) } }.padding({ top: 30 }) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md index f2f11f2a9e9aa56cdcdc8cecca1895144c1dd27c..eeccffc2c70a13cfd51e29dc68c86a7269074e85 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md @@ -6,10 +6,6 @@ The **\** component parses and displays HTML text. > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions - -None - ## Child Components Not supported @@ -20,64 +16,67 @@ RichText(content:string) **Parameters** -| Name| Type | Mandatory | Default Value | Description | -| -------- | -------- | -------- | -------- | -------- | -| content | string | Yes| - | Text string in HTML format. | +| Name| Type| Mandatory | Description| +| ------- | -------- | ------------- | -------- | +| content | string | Yes | String in HTML format.| ## Events -| Name | Description| +| Name| Description| | -------- | -------- | -| onStart(callback: () => void) => void | Triggered when web page loading starts. | -| onComplete(callback: () => void) => void | Triggered when web page loading is completed. | +| onStart(callback: () => void) | Triggered when web page loading starts. | +| onComplete(callback: () => void) | Triggered when web page loading is completed.| ## Supported Tags -| Name | Description | Example | +| Name| Description| Example| | -------- | -------- | -------- | -| \

--\

| Defines six levels of headings in the HTML document. \

defines the most important heading, and \

defines the least important heading. | \

This is an H1 heading\

\

This is an H2 heading\

| -| \

\

| Defines a paragraph. | \

This is a paragraph\

| -| \
| Inserts a newline character. | \

This is a paragraph\
This is a new paragraph\

| -| \
| Defines a thematic break (such as a shift of topic) on an HTML page and creates a horizontal line. | \

This is a paragraph\

\
\

This is a paragraph\

| -| \
\
| Defines a generic container that is generally used to group block-level elements. It allows you to apply CSS styles to multiple elements at the same time. | \
\

This is the heading in a div element\

\
| -| \\ | Displays text in italic style. | \This is in italic style\ | -| \\ | Defines text that should be styled differently or have a non-textual annotation, such as misspelt words or a proper name in Chinese text. It is recommended that you avoid using the \ tag where it could be confused with a hyperlink. | \

\This is an underlined paragraph\\

| -| \ | Used to embed CSS within an HTML document. | \ | -| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**. | \

This is a heading\

\

This is a paragraph\

| -| \ | Used to embed or reference a client-side script, such as JavaScript. | \ | +| \

--\

| Defines six levels of headings in the HTML document. \

defines the most important heading, and \

defines the least important heading.| \

This is an H1 heading\

\

This is an H2 heading\

| +| \

\

| Defines a paragraph.| \

This is a paragraph\

| +| \
| Inserts a newline character.| \

This is a paragraph\
This is a new paragraph\

| +| \
| Defines a thematic break (such as a shift of topic) on an HTML page and creates a horizontal line.| \

This is a paragraph\

\
\

This is a paragraph\

| +| \
\
| Defines a generic container that is generally used to group block-level elements. It allows you to apply CSS styles to multiple elements at the same time.| \
\

This is the heading in a div element\

\
| +| \\ | Displays text in italic style.| \This is in italic style\| +| \\ | Defines text that should be styled differently or have a non-textual annotation, such as misspelt words or a proper name in Chinese text. It is recommended that you avoid using the \ tag where it could be confused with a hyperlink.| \

\This is an underlined paragraph\\

| +| \ | Used to embed CSS within an HTML document.| \ | +| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**.| \

This is a heading\

\

This is a paragraph\

| +| \ | Used to embed or reference a client-side script, such as JavaScript.| \ | ## Example You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer. + ```ts // xxx.ets @Entry @Component struct RichTextExample { - @State data: string = "

h1 heading

" + - "

h1 italic

" + - "

h1 underlined

" + - "

h2 heading

" + - "

h3 heading

" + - "

Regular paragraph


" + - "
" + - "

Font size: 35px; line height: 45px

" + - "

" + - "

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

" + @State data: string = '

h1 heading

' + + '

h1 italic

' + + '

h1 underlined

' + + '

h2 heading

' + + '

h3 heading

' + + '

Regular paragraph


' + + '
' + + '

Font size: 35px; line height: 45px

' + + '

' + + '

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

'; build() { - Flex({direction: FlexDirection.Column,alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center }){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center }) { RichText(this.data) - .onStart(()=>{ - console.info("RichText onStart") - }) - .onComplete(()=>{ - console.info("RichText onComplete") - }) + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) } } } ``` + + ![richText](figures/richText.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md b/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md index d10e25435cdea46e882f125c7da59d2497dda4e4..592b3127032690451b96dd5211f8fc2a1971cddf 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md @@ -6,10 +6,6 @@ The **\** is used together with scrollable components, such as **\
  • > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions - -None - ## Child Components @@ -22,20 +18,20 @@ ScrollBar(value: { scroller: Scroller, direction?: ScrollBarDirection, state?: B **Parameters** -| Name| Type| Mandatory| Default Value| Description| +| Name| Type| Mandatory| Default Value | Description| | -------- | -------- | -------- | -------- | -------- | | scroller | [Scroller](ts-container-scroll.md#scroller) | Yes| - | Scroller, which can be bound to scrollable components.| -| direction | ScrollBarDirection | No| ScrollBarDirection.Vertical | Scrollbar direction in which scrollable components scroll.| -| state | [BarState](ts-appendix-enums.md#barstate) | No| BarState.Auto | Scrollbar state.| +| direction | ScrollBarDirection | No| ScrollBarDirection.Vertical | Scrollbar direction in which scrollable components scroll. | +| state | [BarState](ts-appendix-enums.md#barstate) | No| BarState.Auto | Scrollbar state. | > **NOTE** > -> The **<\ScrollBar>** component defines the behavior style of the scrollable area, and its subnodes define the behavior style of the scrollbar. +> The **\** component defines the behavior style of the scrollable area, and its subnodes define the behavior style of the scrollbar. > - > This component is bound to a scrollable component through **scroller**, and can be used to scroll the scrollable component only when their directions are the same. The **\** component can be bound to only one scrollable component, and vice versa. ## ScrollBarDirection + | Name| Description| | -------- | -------- | | Vertical | Vertical scrollbar.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md index 8330e5fafe2a3a13b11dd764418362b9eb9dfb72..0927b8a3af7b5a72ea02203815c7b8dcb53104a7 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -6,10 +6,6 @@ The **\** component provides an input area for users to search. > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions - -None - ## Child Components Not supported @@ -20,32 +16,31 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------- | ---- | ---------------------------------------- | -| value | string | No | Text input in the search text box. | -| placeholder | string | No | Text displayed when there is no input. | -| icon | string | No | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png.| -| controller | SearchController | No | Controller. | - +| Name | Type | Mandatory| Description | +| ----------- | ---------------- | ---- | ------------------------------------------------------------ | +| value | string | No | Text input in the search text box. | +| placeholder | string | No | Text displayed when there is no input. | +| icon | string | No | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png.| +| controller | SearchController | No | Controller. | ## Attributes -| Name | Type | Description | -| ----------------------- | ---------------------------------------- | --------------------- | -| searchButton | string | Text on the search button located next to the search text box. By default, there is no search button.| -| placeholderColor | [ResourceColor](ts-types.md#resourcecolor8) | Placeholder text color. | -| placeholderFont | [Font](ts-types.md#font) | Placeholder text style. | -| textFont | [Font](ts-types.md#font) | Text font for the search text box. | +| Name | Type | Description | +| ----------------------- | ------------------------------------------------ | ---------------------------------------------- | +| searchButton | string | Text on the search button located next to the search text box. By default, there is no search button. | +| placeholderColor | [ResourceColor](ts-types.md#resourcecolor8) | Placeholder text color. | +| placeholderFont | [Font](ts-types.md#font) | Placeholder text style. | +| textFont | [Font](ts-types.md#font) | Text font for the search text box. | ## Events -| Name | Description | -| ------------------------------------------- | ------------------------------------------------------------ | -| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or touch the search button on a soft keyboard.
    - **value**: current text input. | -| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.
    - **value**: current text input. | -| onCopy(callback: (value: string) => void) | Triggered when data is copied to the pasteboard.
    - **value**: text copied. | -| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.
    - **value**: text cut. | -| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.
    - **value**: text pasted. | +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or touch the search button on a soft keyboard.
    -**value**: current text input.| +| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.
    -**value**: current text input. | +| onCopy(callback: (value: string) => void) | Triggered when data is copied to the pasteboard.
    -**value**: text copied. | +| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.
    -**value**: text cut. | +| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.
    -**value**: text pasted. | ## SearchController @@ -63,11 +58,9 @@ Sets the position of the caret. **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ----------------- | -| value | number | Yes | Length from the start of the character string to the position where the caret is located.| - - +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | ---------------------------------- | +| value | number | Yes | Length from the start of the character string to the position where the caret is located.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-select.md b/en/application-dev/reference/arkui-ts/ts-basic-components-select.md index 415a1bd3d96af1ff879af2b779c3a5481ffe3d85..b89aef6a1d8c9301531f744205d75b635b4eea52 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-select.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-select.md @@ -1,52 +1,51 @@ # Select -> ![](public_sys-resources/icon-note.gif) **NOTE** This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - The **** component provides a drop-down list box that allows users to select among multiple options. -## Required Permissions - -None +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components -None +Not supported ## APIs -Select(options: Array\\) +Select(options: Array\) -- SelectOption parameters +**SelectOption** - | Name| Type| Mandatory| Default Value| Description| - | ------ | ----------------------------------------------- | ---- | ------ | -------------- | - | value | [ResourceStr](../../ui/ts-types.md) | Yes| - | Value of an option in the drop-down list box.| - | icon | [ResourceStr](../../ui/ts-types.md) | No| - | Icon of an option in the drop-down list box.| +| Name| Type | Mandatory| Description | +| ------ | ----------------------------------- | ---- | -------------- | +| value | [ResourceStr](ts-types.md#resourcestr8) | Yes | Value of an option in the drop-down list box.| +| icon | [ResourceStr](ts-types.md#resourcestr8) | No | Icon of an option in the drop-down list box.| ## Attributes -| Name| Type| Default Value| Description| -| ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- | -| selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.| -| value | string | - | Text of the drop-down button.| -| font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button.| -| fontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the drop-down button.| -| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of the selected option in the drop-down list box.| -| selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box.| -| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the selected option in the drop-down list box.| -| optionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of an option in the drop-down list box.| -| optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box.| -| optionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of an option in the drop-down list box.| +| Name | Type | Description | +| ----------------------- | ------------------------------------- | --------------------------------------------- | +| selected | number | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.| +| value | string | Text of the drop-down button. | +| font | [Font](ts-types.md#font) | Text font of the drop-down button. | +| fontColor | [ResourceColor](ts-types.md#resourcecolor8) | Text color of the drop-down button. | +| selectedOptionBgColor | [ResourceColor](ts-types.md#resourcecolor8) | Background color of the selected option in the drop-down list box. | +| selectedOptionFont | [Font](ts-types.md#font) | Text font of the selected option in the drop-down list box. | +| selectedOptionFontColor | [ResourceColor](ts-types.md#resourcecolor8) | Text color of the selected option in the drop-down list box. | +| optionBgColor | [ResourceColor](ts-types.md#resourcecolor8) | Background color of an option in the drop-down list box. | +| optionFont | [Font](ts-types.md#font) | Text font of an option in the drop-down list box. | +| optionFontColor | [ResourceColor](ts-types.md#resourcecolor8) | Text color of an option in the drop-down list box. | ## Events -| Name| Description| -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected. **index** indicates the index of the selected option. **value** indicates the value of the selected option.| +| Name | Description | +| ---------------------------------------------------------- | ------------------------------------------------------------ | +| onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected.
    **index**: index of the selected option.
    **value**: value of the selected option. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct SelectExample { @@ -61,7 +60,7 @@ struct SelectExample { .font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal }) .selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) .optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) - .onSelecte((index:number)=>{ + .onSelect((index:number)=>{ console.info("Select:" + index) }) } diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md index 93131f59b3a1b1f0a723edf9b152d2975b8d9f0d..faa086718761c2bd909cd3b4162747686185bb7c 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -1,17 +1,10 @@ # Slider +The **\** component is used to quickly adjust settings, such as the volume and brightness. -> **NOTE** +> **NOTE** > -> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - - -The *\** component is used to quickly adjust settings, such as the volume and brightness. - - -## Required Permissions - -None +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components @@ -21,59 +14,64 @@ Not supported ## APIs -Slider(value:{value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis}) +Slider(options?:{value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis, reverse?: boolean}) + +**Parameters** -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | ---------------------- | --------------------------------------- | --------- | ------------------ | ---------------------------------------- | - | value | number | No | 0 | Current progress. | - | min | number | No | 0 | Minimum value. | - | max | number | No | 100 | Maximum value. | - | step | number | No | 1 | Step of the slider. When the corresponding step is set, the slider slides intermittently. | - | style | SliderStyle | No | SliderStyle.OutSet | Style of the slider. | - | direction8+ | [Axis](ts-appendix-enums.md#axis-enums) | No | Axis.Horizontal | Whether the slider moves horizontally or vertically. | - | reverse8+ | boolean | No | false | Whether the slider values are reversed. | +| Name | Type | Mandatory| Description | +| ---------------------- | --------------------------------- | ---- | ------------------------------------------------------------ | +| value | number | No | Current progress.
    Default value: **0** | +| min | number | No | Minimum value.
    Default value: **0** | +| max | number | No | Maximum value.
    Default value: **100** | +| step | number | No | Step of the slider.
    Default value: **1** | +| style | SliderStyle | No | Style of the slider.
    Default value: **SliderStyle.OutSet** | +| direction8+ | [Axis](ts-appendix-enums.md#axis) | No | Whether the slider moves horizontally or vertically.
    Default value: **Axis.Horizontal**| +| reverse8+ | boolean | No | Whether the slider values are reversed.
    **NOTE**
    The value **false** indicates that the values increase from left to right for a horizontal slider and from top to bottom for a vertical slider. The value **true** indicates that the values increase from right to left for a horizontal slider and from bottom to top for a vertical slider.
    Default value: **false**| -- SliderStyle enums - | Name | Description | - | ------ | --------------------------------- | - | OutSet | The slider is on the slider rail. | - | InSet | The slider is in the slider rail. | +## SliderStyle +| Name | Description | +| ------ | ------- | +| OutSet | The slider is on the slider rail.| +| InSet | The slider is in the slider rail.| ## Attributes Touch target configuration is not supported. -| Name | Type | Default Value | Description | -| ------------- | ------- | ------------- | ---------------------------------------- | -| blockColor | Color | - | Color of the slider. | -| trackColor | Color | - | Background color of the slider. | -| selectedColor | Color | - | Color of the slider rail that has been slid. | -| showSteps | boolean | false | Whether to display the current step. | -| showTips | boolean | false | Whether to display a bubble to indicate the percentage when sliding. | +| Name | Type | Description | +| ------------- | ------- | ----------------- | +| blockColor | [ResourceColor](ts-types.md#resourcecolor8) | Color of the slider. | +| trackColor | [ResourceColor](ts-types.md#resourcecolor8) | Background color of the slider. | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor8) | Color of the slider rail that has been slid. | +| showSteps | boolean | Whether to display the current step.
    Default value: **false**| +| showTips | boolean | Whether to display a bubble to indicate the percentage when sliding.
    Default value: **false**| +| trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.| +| maxLabel | string | Maximum label.| +| minLabel | string | Minimum label.| ## Events -Among all the universal events, only **OnAppear** and **OnDisAppear** are supported. +In addition to the **OnAppear** and **OnDisAppear** universal events, the following events are supported. -| Name | Description | -| ---------------------------------------- | ---------------------------------------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Callback invoked when the slider slides.
    **value**: current progress.
    **mode**: dragging state. | +| Name | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider slides.
    **value**: current progress. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the required precision.
    **mode**: dragging state.| -- SliderChangeMode enums - | Name | Value | Description | - | ------ | ----- | ----------------------------------- | - | Begin | 0 | The user starts to drag the slider. | - | Moving | 1 | The user is dragging the slider. | - | End | 2 | The user stops dragging the slider. | +## SliderChangeMode +| Name | Value | Description | +| ------ | ---- | --------- | +| Begin | 0 | The user starts to drag the slider.| +| Moving | 1 | The user is dragging the slider. | +| End | 2 | The user stops dragging the slider.| +| Click | 3 | The user moves the slider by touching the slider rail.| ## Example - -``` +```ts +// xxx.ets @Entry @Component struct SliderExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md index 4303717b6c8c2fa62761c6e3a41ead8a191f0eb5..0c157992c0e310acc7d6366689acde4b356e1389 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md @@ -1,55 +1,53 @@ # Span +The **\** component is used to display inline text in the **\** component. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - - -The **<Span>** component is used to display a paragraph of textual information. It can be used only as a child component in the **<Text>** component. - - -## Required Permissions - -None +> **NOTE** +> +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components -None +Not supported ## APIs -Span(content: string) +Span(value: string | Resource) + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | string \| [Resource](ts-types.md#resource) | Yes| Plain text.| -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | content | string | Yes | - | Text content. | ## Attributes -In addition to the text style attributes, the attributes below are supported. +In addition to the [universal text style](ts-universal-attributes-text-style.md) attributes, the following attributes are supported. -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| decoration | {
    type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype-enums),
    color?: Color
    } | {
    type: TextDecorationType.None
    } | Style and color of the text decorative line. | -| textCase | [TextCase](ts-appendix-enums.md#textcase-enums) | Normal | Text case. | +| Name| Type| Description| +| -------- | -------- | -------- | +| decoration | {
    type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
    color?: [ResourceColor](ts-types.md#resourcecolor)
    } | Style and color of the text decorative line.
    Default value: {
    type: TextDecorationType.None
    color: Color.Black
    } | +| letterSpacing | number \| string | Letter spacing. | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
    Default value: **Normal** | ## Events -Among all the universal events, only the click event is supported. +Among all the [universal events](ts-universal-attributes-click.md), only the click event is supported. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> As the **<Span>** component does not have size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid. +> **NOTE** +> +> As the **\** component does not include size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid. ## Example - -``` +```ts +// xxx.ets @Entry @Component struct SpanExample { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md index 3d1fe4f26d33d749f2004b23e7df010ea475556d..354cd00042b8ba46a1cf9a68effc32f792c9f48a 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -2,16 +2,11 @@ The **\** component is used to display a piece of textual information. -> **NOTE** +> **NOTE**
    > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions - -None - - ## Child Components This component can contain the [\](ts-basic-components-span.md) child component. @@ -22,34 +17,38 @@ This component can contain the [\](ts-basic-components-span.md) child comp Text(content?: string | Resource) **Parameters** + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| content | string \| [Resource](ts-types.md#resource) | No| Text content. The content and style set for the **\** component do not take effect when it contains the **\** child component.
    Default value: ' ' | - +| content | string \| [Resource](ts-types.md#resource) | No| Text content. The content and style set for the **\** component do not take effect when it contains the **\** child component.
    Default value: **' '**| ## Attributes - -| Name| Type| Description| -| -------- | -------- | -------- | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Text alignment mode of multiple lines of text.
    Default value: **TextAlign.Start** | -| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
    Default value: **{overflow: TextOverflow.Clip}**
    **NOTE**
    Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters. | -| maxLines | number | Maximum number of lines in the text.
    Default value: **Infinity** | -| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. 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 of the number type, the unit fp is used. | -| decoration | {
    type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
    color?: [ResourceColor](ts-types.md#resourcecolor8)
    } | Style and color of the text decorative line.
    Default value: **{
    type: TextDecorationType.None,
    color: Color.Black
    }** | -| baselineOffset | number \| string | Offset of the text baseline. | -| letterSpacing | number \| string | Letter spacing. | -| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size. | -| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size. | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
    Default value: **TextCase.Normal** | - -> **NOTE** +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ----------------------- | ----------------------------------- | ------------------------------------------- | +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment mode of the text.
    Default value: **TextAlign.Start**| +| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
    Default value: **{overflow: TextOverflow.Clip}**
    **NOTE**
    Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.
    This attribute must be used with `maxLines` to take effect.| +| maxLines | number | Maximum number of lines in the text.
    Default value: **Infinity**
    **NOTE**
    By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.| +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. 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 of the number type, the unit fp is used.| +| decoration | {
    type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
    color?: [ResourceColor](ts-types.md#resourcecolor)
    } | Style and color of the text decorative line.
    Default value: **{
    type: TextDecorationType.None,
    color: Color.Black
    }** | +| baselineOffset | number \| string | Baseline offset of the text. The default value is **0**. | +| letterSpacing | number \| string | Letter spacing. | +| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size. | +| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size. | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
    Default value: **TextCase.Normal**| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
    Default value: **CopyOptions.None**| + +> **NOTE**
    > > The **\** component cannot contain both the text and the child component **\**. If both of them exist, only the content in **\** is displayed. ## Example +### Example 1 +Examples of using **textAlign**, **textOverflow**, **maxLines**, and **lineHeight** ```ts // xxx.ets @Entry @@ -57,77 +56,184 @@ Text(content?: string | Resource) struct TextExample1 { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { - Text('lineHeight').fontSize(9).fontColor(0xCCCCCC) - Text('This is the text with the line height set This is the text with the line height set This is the text with the line height set.') - .lineHeight(25).fontSize(12).border({ width: 1 }).padding(10) + // Set the horizontal alignment mode for the text. + // Single-line text + Text('textAlign').fontSize(9).fontColor(0xCCCCCC) + Text('TextAlign set to Center.') + .textAlign(TextAlign.Center) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('TextAlign set to Start.') + .textAlign(TextAlign.Start) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('TextAlign set to End.') + .textAlign(TextAlign.End) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + + // Multi-line text + Text('This is the text content with textAlign set to Center.') + .textAlign(TextAlign.Center) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with textAlign set to Start.') + .textAlign(TextAlign.Start) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with textAlign set to End.') + .textAlign(TextAlign.End) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') - Text('TextOverflow').fontSize(9).fontColor(0xCCCCCC) - Text('This is the setting of textOverflow to none text content This is the setting of textOverflow to none text content.') + + // Set the display mode when the text is too long. + Text('TextOverflow+maxLines').fontSize(9).fontColor(0xCCCCCC) + // Clip the text when the value of maxLines is exceeded. + Text('This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content. This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content.') .textOverflow({ overflow: TextOverflow.None }) - .fontSize(12).border({ width: 1 }).padding(10) - Text('This is the setting of textOverflow to Clip text content This is the setting of textOverflow to Clip text content.') - .textOverflow({ overflow: TextOverflow.Clip }) - .maxLines(1).fontSize(12).border({ width: 1 }).padding(10) - Text('This is set textOverflow to Ellipsis text content This is set textOverflow to Ellipsis text content.'.split('').join('\u200B')) + .maxLines(1) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + + // Show an ellipsis (...) when the value of maxLines is exceeded. + Text('This is set textOverflow to Ellipsis text content This is set textOverflow to Ellipsis text content.'.split('') + .join('\u200B')) .textOverflow({ overflow: TextOverflow.Ellipsis }) - .maxLines(1).fontSize(12).border({ width: 1 }).padding(10) + .maxLines(1) + .fontSize(12) + .border({ width: 1 }) + .padding(10) - Text('decoration').fontSize(9).fontColor(0xCCCCCC) - Text('This is the text content with the decoration set to Underline and the color set to Red.') - .decoration({ type: TextDecorationType.Underline, color: Color.Red }) - .fontSize(12).border({ width: 1 }).padding(10) - Text('This is the text content with the decoration set to LineThrough and the color set to Red.') - .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }) + Text('lineHeight').fontSize(9).fontColor(0xCCCCCC) + Text('This is the text with the line height set. This is the text with the line height set.') .fontSize(12).border({ width: 1 }).padding(10) - Text('This is the text content with the decoration set to Overline and the color set to Red.') - .decoration({ type: TextDecorationType.Overline, color: Color.Red }) + Text('This is the text with the line height set. This is the text with the line height set.') .fontSize(12).border({ width: 1 }).padding(10) + .lineHeight(20) }.height(600).width(350).padding({ left: 35, right: 35, top: 35 }) } } ``` +![textExp1](figures/textExp1.png) -![en-us_image_0000001257138337](figures/en-us_image_0000001257138337.gif) - +### Example 2 +Example of using **decoration**, **baselineOffset**, **letterSpacing**, and **textCase**: ```ts -// xxx.ets @Entry @Component struct TextExample2 { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { + Text('decoration').fontSize(9).fontColor(0xCCCCCC) + Text('This is the text content with the decoration set to LineThrough and the color set to Red.') + .decoration({ + type: TextDecorationType.LineThrough, + color: Color.Red + }) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + + + Text('This is the text content with the decoration set to Overline and the color set to Red.') + .decoration({ + type: TextDecorationType.Overline, + color: Color.Red + }) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + + + Text('This is the text content with the decoration set to Underline and the color set to Red.') + .decoration({ + type: TextDecorationType.Underline, + color: Color.Red + }) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + + // Set the text baseline offset. + Text('baselineOffset').fontSize(9).fontColor(0xCCCCCC) + Text('This is the text content with baselineOffset 0.') + .baselineOffset(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with baselineOffset 30.') + .baselineOffset(30) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with baselineOffset -20.') + .baselineOffset(-20) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + + // Set the letter spacing. + Text('letterSpacing').fontSize(9).fontColor(0xCCCCCC) + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with letterSpacing 3.') + .letterSpacing(3) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('This is the text content with letterSpacing -1.') + .letterSpacing(-1) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + Text('textCase').fontSize(9).fontColor(0xCCCCCC) Text('This is the text content with textCase set to Normal.') .textCase(TextCase.Normal) - .fontSize(12).border({ width: 1 }).padding(10).width('100%') + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + // Display the text in lowercase. Text('This is the text content with textCase set to LowerCase.') .textCase(TextCase.LowerCase) - .fontSize(12).border({ width: 1 }).padding(10).width('100%') + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + // Display the text in uppercase. Text('This is the text content with textCase set to UpperCase.') .textCase(TextCase.UpperCase) .fontSize(12).border({ width: 1 }).padding(10) - Text('textAlign').fontSize(9).fontColor(0xCCCCCC) - Text('This is the text content with textAlign set to Center.') - .textAlign(TextAlign.Center) - .fontSize(12).border({ width: 1 }).padding(10).width('100%') - Text('This is the text content with textAlign set to Start.') - .textAlign(TextAlign.Start) - .fontSize(12).border({ width: 1 }).padding(10).width('100%') - Text('This is the text content with textAlign set to End.') - .textAlign(TextAlign.End) - .fontSize(12).border({ width: 1 }).padding(10).width('100%') - - Text('baselineOffset').fontSize(9).fontColor(0xCCCCCC) - Text('This is the text content with baselineOffset set to 10.') - .baselineOffset(10).fontSize(12).border({ width: 1 }).padding(10).width('100%') - Text('This is the text content with baselineOffset set to 30.') - .baselineOffset(30).fontSize(12).border({ width: 1 }).padding(10).width('100%') - Text('This is the text content with baselineOffset set to -10.') - .baselineOffset(-10).fontSize(12).border({ width: 1 }).padding(10).width('100%') }.height(700).width(350).padding({ left: 35, right: 35, top: 35 }) } } ``` - -![en-us_image_0000001257058391](figures/en-us_image_0000001257058391.gif) +![textExp1](figures/textExp2.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index d8d736c178dac82c82ce3021f1131fd827478884..4fb29a66fa03d646552e2461c22defe5d9587ec0 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -1,15 +1,10 @@ # TextArea -The **\