提交 01be8dd7 编写于 作者: L li-yaoyao777

Merge branch 'master' of gitee.com:openharmony/docs into 0425

...@@ -384,7 +384,7 @@ zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md @gongjunsong @ge- ...@@ -384,7 +384,7 @@ zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md @gongjunsong @ge-
zh-cn/application-dev/reference/apis/js-apis-lightweightset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-lightweightset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-linkedlist.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-linkedlist.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-list.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-list.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-logs.md @huaweimaxuchu @ningningW @niulihua @tomatodevboy zh-cn/application-dev/reference/apis/js-apis-logs.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-media.md @liuyuehua1 @zengyawen @xxb-wzy @currydavids zh-cn/application-dev/reference/apis/js-apis-media.md @liuyuehua1 @zengyawen @xxb-wzy @currydavids
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @panqinxu @zengyawen @bubble_mao @jinhaihw
zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy
...@@ -456,7 +456,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @hellohyh001 @nin ...@@ -456,7 +456,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @hellohyh001 @nin
zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785 zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785
zh-cn/application-dev/reference/apis/js-apis-testRunner.md @inter515 @littlejerry1 @RayShih @inter515 @jiyong zh-cn/application-dev/reference/apis/js-apis-testRunner.md @inter515 @littlejerry1 @RayShih @inter515 @jiyong
zh-cn/application-dev/reference/apis/js-apis-thermal.md @aqxyjay @zengyawen @aqxyjay @alien0208 zh-cn/application-dev/reference/apis/js-apis-thermal.md @aqxyjay @zengyawen @aqxyjay @alien0208
zh-cn/application-dev/reference/apis/js-apis-timer.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy zh-cn/application-dev/reference/apis/js-apis-timer.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-touchevent.md @mayunteng_1 @ningningW @cococoler @alien0208 zh-cn/application-dev/reference/apis/js-apis-touchevent.md @mayunteng_1 @ningningW @cococoler @alien0208
zh-cn/application-dev/reference/apis/js-apis-treemap.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-treemap.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-treeset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-treeset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
......
...@@ -24,6 +24,8 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O ...@@ -24,6 +24,8 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks. All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines: Then, equip yourself for developing the key features, with the following guidelines:
- [Web](web/web-component-overview.md)
- [Notification](notification/Readme-EN.md) - [Notification](notification/Readme-EN.md)
- [Window Manager](windowmanager/Readme-EN.md) - [Window Manager](windowmanager/Readme-EN.md)
- [WebGL](webgl/Readme-EN.md) - [WebGL](webgl/Readme-EN.md)
...@@ -32,6 +34,7 @@ Then, equip yourself for developing the key features, with the following guideli ...@@ -32,6 +34,7 @@ Then, equip yourself for developing the key features, with the following guideli
- [Connectivity](connectivity/Readme-EN.md) - [Connectivity](connectivity/Readme-EN.md)
- [Telephony Service](telephony/Readme-EN.md) - [Telephony Service](telephony/Readme-EN.md)
- [Data Management](database/Readme-EN.md) - [Data Management](database/Readme-EN.md)
- [File Management](file-management/Readme-EN.md)
- [Task Management](task-management/Readme-EN.md) - [Task Management](task-management/Readme-EN.md)
- [Device Management](device/Readme-EN.md) - [Device Management](device/Readme-EN.md)
- [Device Usage Statistics](device-usage-statistics/Readme-EN.md) - [Device Usage Statistics](device-usage-statistics/Readme-EN.md)
...@@ -40,7 +43,6 @@ Then, equip yourself for developing the key features, with the following guideli ...@@ -40,7 +43,6 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/Readme-EN.md) - [Application Test](application-test/Readme-EN.md)
- [IDL Specifications and User Guide](IDL/idl-guidelines.md) - [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/Readme-EN.md) - [Using Native APIs in Application Projects](napi/Readme-EN.md)
- [File Management](file-management/medialibrary-overview.md)
### Tools ### Tools
...@@ -70,3 +72,5 @@ They are organized as follows: ...@@ -70,3 +72,5 @@ They are organized as follows:
### Readme ### Readme
For details about the principles and basic information of each subsystem, see the README file in [docs/en/readme](../readme). For details about the principles and basic information of each subsystem, see the README file in [docs/en/readme](../readme).
<!--no_check-->
\ No newline at end of file
...@@ -4,7 +4,7 @@ The application development documents provide reference for you to develop appli ...@@ -4,7 +4,7 @@ The application development documents provide reference for you to develop appli
The documents are carefully organized as follows: The documents are carefully organized as follows:
### Getting Started ## Getting Started
[Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development. [Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development.
...@@ -12,7 +12,7 @@ Browse the documents on the instructions for quickly building your first applica ...@@ -12,7 +12,7 @@ Browse the documents on the instructions for quickly building your first applica
Check out the development fundamentals, which comprise descriptions of the package structure configuration file for OpenHarmony applications and the instructions for use of resource files. Check out the development fundamentals, which comprise descriptions of the package structure configuration file for OpenHarmony applications and the instructions for use of resource files.
### Development ## Development
To facilitate your application development, we provide development guidelines for key features. To facilitate your application development, we provide development guidelines for key features.
...@@ -24,14 +24,17 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O ...@@ -24,14 +24,17 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks. All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines: Then, equip yourself for developing the key features, with the following guidelines:
- [Web](web/web-component-overview.md)
- [Notification](notification/notification-overview.md) - [Notification](notification/notification-overview.md)
- [Window Manager](windowmanager/window-overview.md) - [Window Manager](windowmanager/window-overview.md)
- [WebGL](webgl/webgl-overview.md) - [WebGL](webgl/webgl-overview.md)
- [Media](media/audio-overview.md) - [Media](media/media-application-overview.md)
- [Security](security/userauth-overview.md) - [Security](security/userauth-overview.md)
- [Connectivity](connectivity/ipc-rpc-overview.md) - [Connectivity](connectivity/ipc-rpc-overview.md)
- [Telephony Service](telephony/telephony-overview.md) - [Telephony Service](telephony/telephony-overview.md)
- [Data Management](database/database-mdds-overview.md) - [Data Management](database/data-mgmt-overview.md)
- [File Management](file-management/file-management-overview.md)
- [Task Management](task-management/background-task-overview.md) - [Task Management](task-management/background-task-overview.md)
- [Device](device/usb-overview.md) - [Device](device/usb-overview.md)
- [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md) - [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md)
...@@ -40,32 +43,29 @@ Then, equip yourself for developing the key features, with the following guideli ...@@ -40,32 +43,29 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/arkxtest-guidelines.md) - [Application Test](application-test/arkxtest-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md) - [Using Native APIs in Application Projects](napi/napi-guidelines.md)
- [File Management](file-management/medialibrary-overview.md)
### Tools ## Tools
DevEco Studio is a high-performance integrated development environment (IDE) recommended for developing OpenHarmony applications. DevEco Studio is a high-performance integrated development environment (IDE) recommended for developing OpenHarmony applications.
[Here](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421) you can learn everything about DevEco Studio, including how to use this tool to create a project and sign, debug, and run an application. [Here](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421) you can learn everything about DevEco Studio, including how to use this tool to create a project and sign, debug, and run an application.
### Hands-On Tutorials ## Hands-On Tutorials
To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
### API References ## API References
API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively. API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively.
They are organized as follows: They are organized as follows:
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md) - [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md)
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md) - [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md) - [JS and TS APIs](reference/apis/development-intro.md)
- [JS and TS APIs](reference/apis/js-apis-ability-dataUriUtils.md)
- Native APIs - Native APIs
- [Standard Library](reference/native-lib/third_party_libc/musl.md) - [Standard Library](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md) - [Node_API](reference/native-lib/third_party_napi/napi.md)
<!--no_check-->
\ No newline at end of file
...@@ -189,7 +189,7 @@ The following steps describe how to use the text drawing and display feature of ...@@ -189,7 +189,7 @@ The following steps describe how to use the text drawing and display feature of
OH_Drawing_CreateFontCollection()); OH_Drawing_CreateFontCollection());
OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle);
// Set the text content. // Set the text content.
const char* text = "OpenHarmony\n"; const char* text = "Hello World\n";
OH_Drawing_TypographyHandlerAddText(handler, text); OH_Drawing_TypographyHandlerAddText(handler, text);
OH_Drawing_TypographyHandlerPopTextStyle(handler); OH_Drawing_TypographyHandlerPopTextStyle(handler);
OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler); OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
The **BundleStatusCallback** module provides callbacks for bundle status changes. The changes can be obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md). The **BundleStatusCallback** module provides callbacks for bundle status changes. The changes can be obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## BundleStatusCallback<sup>(deprecated)<sup> ## BundleStatusCallback<sup>(deprecated)<sup>
> This API is deprecated since API version 9. You are advised to use [bundleMonitor](js-apis-bundleMonitor.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleMonitor](js-apis-bundleMonitor.md) instead.
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
......
...@@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
......
...@@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
......
...@@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Return value** **Return value**
...@@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
...@@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework
**System API** **System API**
This is a system API and cannot be called by third-party applications. This is a system API.
**Parameters** **Parameters**
......
...@@ -24,7 +24,7 @@ Sets the disposed status for an application. This API uses a promise to return t ...@@ -24,7 +24,7 @@ Sets the disposed status for an application. This API uses a promise to return t
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -75,7 +75,7 @@ Sets the disposed status for an application. This API uses an asynchronous callb ...@@ -75,7 +75,7 @@ Sets the disposed status for an application. This API uses an asynchronous callb
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -122,7 +122,7 @@ Obtains the disposed status of an application. This API uses a promise to return ...@@ -122,7 +122,7 @@ Obtains the disposed status of an application. This API uses a promise to return
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -171,7 +171,7 @@ Obtains the disposed status of an application. This API uses an asynchronous cal ...@@ -171,7 +171,7 @@ Obtains the disposed status of an application. This API uses an asynchronous cal
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -216,7 +216,7 @@ Deletes the disposed status for an application. This API uses a promise to retur ...@@ -216,7 +216,7 @@ Deletes the disposed status for an application. This API uses a promise to retur
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -265,7 +265,7 @@ Deletes the disposed status for an application. This API uses an asynchronous ca ...@@ -265,7 +265,7 @@ Deletes the disposed status for an application. This API uses an asynchronous ca
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
......
# @ohos.arkui.drawableDescriptor (DrawableDescriptor)
The **DrawableDescriptor** module provides APIs for obtaining **pixelMap** objects, including the foreground, background, mask, and layered icons.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer.
## Modules to Import
```js
import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawableDescriptor';
```
## DrawableDescriptor.constructor
constructor()
Creates a **DrawableDescriptor** or **LayeredDrawableDescriptor** object. The globalization API [getDrawableDescriptor](js-apis-resource-manager.md##getdrawabledescriptor) or [getDrawableDescriptorByName](js-apis-resource-manager.md##getdrawabledescriptorbyname) is required for object construction.
**System API**: This is a system API.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### DrawableDescriptor
Creates a **DrawableDescriptor** object when the passed resource ID or name belongs to a common image.
### LayeredDrawableDescriptor
Creates a **LayeredDrawableDescriptor** object when the passed resource ID or name belongs to a JSON file that contains foreground and background resources.
**Example**
```js
@Entry
@Component
struct Index {
private resManager = getContext().resourceManager
let drawable1 = resManager.getDrawableDescriptor($r('app.media.icon').id)
let drawable2 = resManager.getDrawableDescriptorByName(icon)
let layeredDrawable1 = resManager.getDrawableDescriptor($r('app.media.file').id)
let layeredDrawable1 = resManager.getDrawableDescriptor(file)
}
```
## DrawableDescriptor.getPixelMap
getPixelMap(): image.PixelMap;
Obtains this **pixelMap** object.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.|
**Example**
```js
@State pixmap: PixelMap = drawable1.getPixelMap();
```
## LayeredDrawableDescriptor.getPixelMap
getPixelMap(): image.PixelMap;
Obtains the **pixelMap** object where the foreground, background, and mask are blended and cropped.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.|
**Example**
```js
@State pixmap: PixelMap = layeredDrawable1.getPixelMap();
```
## LayeredDrawableDescriptor.getForeground
getForeground(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the foreground.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getForeground();
```
## LayeredDrawableDescriptor.getBackground
getBackground(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the background.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getBackground();
```
## LayeredDrawableDescriptor.getMask
getMask(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the mask.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getMask();
```
<!--no_check-->
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
The **BundleInstaller** module provides APIs for you to install, uninstall, and recover bundles on devices. The **BundleInstaller** module provides APIs for you to install, uninstall, and recover bundles on devices.
> **NOTE** > **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. > 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.
## BundleInstaller.install<sup>(deprecated)<sup> ## BundleInstaller.install<sup>(deprecated)<sup>
...@@ -22,7 +22,7 @@ ohos.permission.INSTALL_BUNDLE ...@@ -22,7 +22,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -72,7 +72,7 @@ ohos.permission.INSTALL_BUNDLE ...@@ -72,7 +72,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -121,7 +121,7 @@ ohos.permission.INSTALL_BUNDLE ...@@ -121,7 +121,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -162,7 +162,7 @@ Describes the parameters required for bundle installation, recovery, or uninstal ...@@ -162,7 +162,7 @@ Describes the parameters required for bundle installation, recovery, or uninstal
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------- | ------- | ---- | ---- | ------------------ | | ----------- | ------- | ---- | ---- | ------------------ |
...@@ -176,12 +176,12 @@ Describes the bundle installation or uninstall status. ...@@ -176,12 +176,12 @@ Describes the bundle installation or uninstall status.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | | ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ |
| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode)| | status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode)|
| statusMessage | string | Yes | No | Installation or uninstall status message. <br>**SUCCESS**: install_succeed<br>**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).<br>**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.<br>**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.<br>**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)<br>**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.<br>**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)<br>**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)<br>**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.<br>**STATUS_ABILITY_NOT_FOUND**: Ability not found.<br>**STATUS_BMS_SERVICE_ERROR**: BMS service error.<br>**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.<br>**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.<br>**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.<br>**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission. | | statusMessage | string | Yes | No | Installation or uninstall status message. <br>**SUCCESS**: install_succeed<br>**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).<br>**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.<br>**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.<br>**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)<br>**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.<br>**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)<br>**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)<br>**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.<br>**STATUS_ABILITY_NOT_FOUND**: Ability not found.<br>**STATUS_BMS_SERVICE_ERROR**: BMS service error.<br>**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.<br>**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.<br>**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.<br>**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission.|
## Obtaining the Sandbox Path ## Obtaining the Sandbox Path
For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-inner-application-uiAbilityContext.md#abilitycontext). The following describes how to obtain the sandbox path. For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-inner-application-uiAbilityContext.md#abilitycontext). The following describes how to obtain the sandbox path.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
The **LauncherAbilityInfo** module provides information about the launcher ability, which is obtained through [innerBundleManager.getLauncherAbilityInfos](js-apis-Bundle-InnerBundleManager.md). The **LauncherAbilityInfo** module provides information about the launcher ability, which is obtained through [innerBundleManager.getLauncherAbilityInfos](js-apis-Bundle-InnerBundleManager.md).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## LauncherAbilityInfo<sup>(deprecated)<sup> ## LauncherAbilityInfo<sup>(deprecated)<sup>
...@@ -12,7 +12,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili ...@@ -12,7 +12,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- | | --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- |
......
...@@ -12,11 +12,11 @@ The **PermissionDef** module provides permission details defined in the configur ...@@ -12,11 +12,11 @@ The **PermissionDef** module provides permission details defined in the configur
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------------- | ------ | ---- | ---- | -------------- | | -------------- | ------ | ---- | ---- | -------------- |
| permissionName | string | Yes | No | Name of the permission. | | permissionName | string | Yes | No | Name of the permission. |
| grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.| | grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.|
| labelId | number | Yes | No | ID of the permission label. | | labelId | number | Yes | No | ID of the permission label. |
| descriptionId | number | Yes | No | ID of the permission description. | | descriptionId | number | Yes | No | ID of the permission description. |
...@@ -12,11 +12,10 @@ The **RemoteAbilityInfo** module provides information about a remote ability. ...@@ -12,11 +12,10 @@ The **RemoteAbilityInfo** module provides information about a remote ability.
**System capability**: SystemCapability.BundleManager.DistributedBundleFramework **System capability**: SystemCapability.BundleManager.DistributedBundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | | ----------- | -------------------------------------------- | ---- | ---- | ----------------------- |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. | | elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. |
| label | string | Yes | No | Ability name. | | label | string | Yes | No | Ability name. |
| icon | string | Yes | No | Icon of the ability.| | icon | string | Yes | No | Icon of the ability.|
...@@ -10,7 +10,7 @@ The **LauncherAbilityInfo** module defines the ability information of the home s ...@@ -10,7 +10,7 @@ The **LauncherAbilityInfo** module defines the ability information of the home s
**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher **System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ | | --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ |
......
...@@ -98,12 +98,12 @@ Enumerates the types of Extension abilities. ...@@ -98,12 +98,12 @@ Enumerates the types of Extension abilities.
| Name| Value| Description| | Name| Value| Description|
|:----------------:|:---:|-----| |:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md): provides APIs for widget development.| | FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md): provides APIs for widget development.|
| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md): enables applications to execute non-real-time tasks when the system is idle.| | WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md): enables applications to execute non-real-time tasks when the system is idle.|
| INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.| | INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.|
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.| | SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.|
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.| | ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.|
| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md): enables applications to read and write data.| | DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md): enables applications to read and write data.|
| FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved.| | FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved.|
| STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md): provides APIs for processing static events, such as the startup event.| | STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md): provides APIs for processing static events, such as the startup event.|
| WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved.| | WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved.|
...@@ -113,6 +113,7 @@ Enumerates the types of Extension abilities. ...@@ -113,6 +113,7 @@ Enumerates the types of Extension abilities.
| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.| | THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.|
| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.| | PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.|
| PRINT<sup>10+</sup> | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.| | PRINT<sup>10+</sup> | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
| DRIVER<sup>10+</sup> | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.| | UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
...@@ -187,7 +188,7 @@ Enumerates the display orientations of the ability. This attribute applies only ...@@ -187,7 +188,7 @@ Enumerates the display orientations of the ability. This attribute applies only
| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.| | AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.|
| LOCKED |12|Locked.| | LOCKED |12|Locked.|
### CompatiblePolicy ### CompatiblePolicy<sup>10+</sup>
Defines the version compatibility type of the shared library. Defines the version compatibility type of the shared library.
...@@ -3069,3 +3070,167 @@ try { ...@@ -3069,3 +3070,167 @@ try {
hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message);
} }
``` ```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void;
Obtains the provision configuration file information based on the given bundle name. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name.|
| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
try {
bundleManager.getAppProvisionInfo(bundleName, (err, data) => {
if (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
} else {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data));
}
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
}
```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void;
Obtains the provision configuration file information based on the given bundle name and user ID. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name.|
| userId | number | Yes| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).|
| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
let userId = 100;
try {
bundleManager.getAppProvisionInfo(bundleName, userId, (err, data) => {
if (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
} else {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data));
}
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
}
```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>;
Obtains the provision configuration file information based on the given bundle name and user ID. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes| Bundle name.|
| userId | number | No| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).|
**Return value**
| Type | Description |
| ------------------------------------------------------------ | ----------------------------------- |
| Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Promise used to return the provision configuration file obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
let userId = 100;
try {
bundleManager.getAppProvisionInfo(bundleName).then((data) => {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data));
}).catch(err => {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
}
try {
bundleManager.getAppProvisionInfo(bundleName, userId).then((data) => {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data));
}).catch(err => {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
}
```
<!--no_check-->
\ No newline at end of file
...@@ -24,7 +24,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). ...@@ -24,7 +24,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md).
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
| Name | Template | Readable| Writable| Description | | Name | Template | Readable| Writable| Description |
| ---------- | ------ | ---- | ---- | -------------------------- | | ---------- | ------ | ---- | ---- | -------------------------- |
...@@ -39,7 +39,7 @@ Subscribes to bundle installation, uninstall, and update events. ...@@ -39,7 +39,7 @@ Subscribes to bundle installation, uninstall, and update events.
**Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE **Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
...@@ -72,7 +72,7 @@ Unsubscribes from bundle installation, uninstall, and update events. ...@@ -72,7 +72,7 @@ Unsubscribes from bundle installation, uninstall, and update events.
**Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE **Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
......
...@@ -109,7 +109,7 @@ Obtains the default application based on a system-defined application type or a ...@@ -109,7 +109,7 @@ Obtains the default application based on a system-defined application type or a
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -165,7 +165,7 @@ Obtains the default application of a user based on a system-defined application ...@@ -165,7 +165,7 @@ Obtains the default application of a user based on a system-defined application
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -217,7 +217,7 @@ Obtains the default application based on a system-defined application type or a ...@@ -217,7 +217,7 @@ Obtains the default application based on a system-defined application type or a
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -266,7 +266,7 @@ Sets the default application based on a system-defined application type or a fil ...@@ -266,7 +266,7 @@ Sets the default application based on a system-defined application type or a fil
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -338,7 +338,7 @@ Sets the default application for a user based on a system-defined application ty ...@@ -338,7 +338,7 @@ Sets the default application for a user based on a system-defined application ty
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -399,7 +399,7 @@ Sets the default application based on a system-defined application type or a fil ...@@ -399,7 +399,7 @@ Sets the default application based on a system-defined application type or a fil
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -458,7 +458,7 @@ Resets the default application based on a system-defined application type or a f ...@@ -458,7 +458,7 @@ Resets the default application based on a system-defined application type or a f
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -508,7 +508,7 @@ Resets the default application for a user based on a system-defined application ...@@ -508,7 +508,7 @@ Resets the default application for a user based on a system-defined application
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
...@@ -559,7 +559,7 @@ Resets the default application based on a system-defined application type or a f ...@@ -559,7 +559,7 @@ Resets the default application based on a system-defined application type or a f
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API.
**Parameters** **Parameters**
......
...@@ -291,6 +291,63 @@ try { ...@@ -291,6 +291,63 @@ try {
} }
``` ```
## display.on('privateModeChange')<sup>10+</sup>
on(type: 'privateModeChange', callback: Callback&lt;boolean&gt;): void
Subscribes to privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at 'privateModeChange', indicating the event of display privacy mode changes.|
| callback | Callback&lt;boolean&gt; | Yes | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.|
**Example**
```js
let callback = (data) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data));
};
try {
display.on("privateModeChange", callback);
} catch (exception) {
console.error('Failed to register callback. Code: ' + JSON.stringify(exception));
}
```
## display.off('privateModeChange')<sup>10+</sup>
off(type: 'privateModeChange', callback?: Callback&lt;boolean&gt;): void
Unsubscribes from privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'privateModeChange'**, indicating the event of display private mode changes.|
| callback | Callback&lt;boolean&gt; | No | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.|
**Example**
```js
try {
display.off("privateModeChange");
} catch (exception) {
console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception));
}
```
## display.getDefaultDisplay<sup>(deprecated)</sup> ## display.getDefaultDisplay<sup>(deprecated)</sup>
getDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void getDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void
......
...@@ -80,9 +80,9 @@ image.createPixelMap(color, opts, (error, pixelmap) => { ...@@ -80,9 +80,9 @@ image.createPixelMap(color, opts, (error, pixelmap) => {
## PixelMap<sup>7+</sup> ## PixelMap<sup>7+</sup>
Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object. Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object. Currently, the maximum size of a serialized pixel map is 128 MB. A larger size will cause a display failure. The size is calculated as follows: Width * Height * Number of bytes occupied by each pixel.
### Attributes ### Attributes
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -950,7 +950,7 @@ Creates an **ImageSource** instance based on the URI. ...@@ -950,7 +950,7 @@ Creates an **ImageSource** instance based on the URI.
```js ```js
// Stage model // Stage model
const context = getContext(this); const context = getContext(this);
const path = context.getCacheDir() + "/test.jpg"; const path = context.cacheDir() + "/test.jpg";
const imageSourceApi = image.createImageSource(path); const imageSourceApi = image.createImageSource(path);
``` ```
...@@ -2227,7 +2227,7 @@ Creates an **ImageCreator** instance by specifying the image width, height, form ...@@ -2227,7 +2227,7 @@ Creates an **ImageCreator** instance by specifying the image width, height, form
| Type | Description | | Type | Description |
| ------------------------------ | --------------------------------------- | | ------------------------------ | --------------------------------------- |
| [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.| | [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.|
**Example** **Example**
...@@ -2729,7 +2729,7 @@ Describes image properties. ...@@ -2729,7 +2729,7 @@ Describes image properties.
## PropertyKey<sup>7+</sup> ## PropertyKey<sup>7+</sup>
Describes the exchangeable image file format (EXIF) information of an image. Describes the exchangeable image file format (EXIF) data of an image.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
......
...@@ -14,16 +14,19 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; ...@@ -14,16 +14,19 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype';
## Attributes ## Attributes
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name| Type| Readable| Writable| Mandatory| Description| | Name| Type| Readable| Writable| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- |
| label | string | Yes| No| No| Label of the input method subtype.| | label | string | Yes| No| No| Label of the input method subtype.|
| name | string | Yes| No| Yes| Name of the input method subtype.| | labelId<sup>10+</sup> | string | Yes| No| No| Label ID of the input method subtype.|
| name | string | Yes| No| Yes| Bundle name of the input method.|
| id | string | Yes| No| Yes| ID of the input method subtype.| | id | string | Yes| No| Yes| ID of the input method subtype.|
| mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).| | mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).|
| locale | string | Yes| No| Yes| Locale of the input method subtype.| | locale | string | Yes| No| Yes| Locale of the input method subtype.|
| language | string | Yes| No| Yes| Language of the input method subtype.| | language | string | Yes| No| Yes| Language of the input method subtype.|
| icon | string | Yes| No| No| Icon of the input method subtype.| | icon | string | Yes| No| No| Icon of the input method subtype.|
| iconId | number | Yes| No| No| Icon ID of the input method subtype.| | iconId | number | Yes| No| No| Icon ID of the input method subtype.|
| extra | object | Yes| Yes| Yes| Extra information of the input method subtype.| | extra | object | Yes| Yes| No| Extra information of the input method subtype.<br>**NOTE**<br>This parameter is optional since API version 10.|
# @ohos.inputMethod (Input Method Framework) # @ohos.inputMethod (Input Method Framework)
The **inputMethod** module provides an input method framework, which can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more. The **inputMethod** module is oriented to common foreground applications (third-party applications and system applications such as Notes, Messaging, and Settings). It provides input method control and management capabilities, including displaying or hiding the soft keyboard, switching between input methods, and obtaining the list of all input methods.
> **NOTE** > **NOTE**
> >
...@@ -33,10 +33,11 @@ Describes the input method application attributes. ...@@ -33,10 +33,11 @@ Describes the input method application attributes.
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| name<sup>9+</sup> | string | Yes| No| Internal name of the input method. Mandatory.| | name<sup>9+</sup> | string | Yes| No| Internal name of the input method. Mandatory.|
| id<sup>9+</sup> | string | Yes| No| Unique ID of the input method. Mandatory.| | id<sup>9+</sup> | string | Yes| No| Unique ID of the input method. Mandatory.|
| label<sup>9+</sup> | string | Yes| No| External display name of the input method. Optional.| | label<sup>9+</sup> | string | Yes| No| External name of the input method. Optional.|
| labelId<sup>10+</sup> | string | Yes| No| External ID of the input method. Optional.|
| icon<sup>9+</sup> | string | Yes| No| Icon of the input method. Optional.| | icon<sup>9+</sup> | string | Yes| No| Icon of the input method. Optional.|
| iconId<sup>9+</sup> | number | Yes| No| Icon ID of the input method. Optional.| | iconId<sup>9+</sup> | number | Yes| No| Icon ID of the input method. Optional.|
| extra<sup>9+</sup> | object | Yes| Yes| Extra information about the input method. Mandatory.| | extra<sup>9+</sup> | object | Yes| Yes| Extra information about the input method. Optional.<br>**NOTE**<br>This parameter is optional since API version 10.|
| packageName<sup>(deprecated)</sup> | string | Yes| No| Name of the input method package. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **name**.| | packageName<sup>(deprecated)</sup> | string | Yes| No| Name of the input method package. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **name**.|
| methodId<sup>(deprecated)</sup> | string | Yes| No| Unique ID of the input method. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **id**.| | methodId<sup>(deprecated)</sup> | string | Yes| No| Unique ID of the input method. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **id**.|
...@@ -231,7 +232,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb ...@@ -231,7 +232,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
Switches to another subtype of the current input method. This API uses an asynchronous callback to return the result. Switches to another subtype of the current input method. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) **Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) <br>**NOTE**<br>Since API version 10, this permission is not required if the caller is the current input method.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -239,7 +240,7 @@ Switches to another subtype of the current input method. This API uses an asynch ...@@ -239,7 +240,7 @@ Switches to another subtype of the current input method. This API uses an asynch
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| | target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -256,9 +257,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -256,9 +257,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
try { try {
inputMethod.switchCurrentInputMethodSubtype({ inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard", id: "ServiceExtAbility",
label: "ServiceExtAbility", label: "",
name: "", name: "com.example.kikakeyboard",
mode: "upper", mode: "upper",
locale: "", locale: "",
language: "", language: "",
...@@ -287,7 +288,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean& ...@@ -287,7 +288,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean&
Switches to another subtype of the current input method. This API uses a promise to return the result. Switches to another subtype of the current input method. This API uses a promise to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) **Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) <br>**NOTE**<br>Since API version 10, this permission is not required if the caller is the current input method.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -295,7 +296,7 @@ Switches to another subtype of the current input method. This API uses a promise ...@@ -295,7 +296,7 @@ Switches to another subtype of the current input method. This API uses a promise
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value** **Return value**
...@@ -317,9 +318,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -317,9 +318,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
try { try {
inputMethod.switchCurrentInputMethodSubtype({ inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard", id: "ServiceExtAbility",
label: "ServiceExtAbility", label: "",
name: "", name: "com.example.kikakeyboard",
mode: "upper", mode: "upper",
locale: "", locale: "",
language: "", language: "",
...@@ -352,7 +353,7 @@ Obtains the current input method subtype. ...@@ -352,7 +353,7 @@ Obtains the current input method subtype.
| Type | Description | | Type | Description |
| -------------------------------------------- | ------------------------ | | -------------------------------------------- | ------------------------ |
| [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype) | Current input method subtype.| | [InputMethodSubtype](./js-apis-inputmethod-subtype.md) | Current input method subtype.|
**Example** **Example**
...@@ -375,7 +376,7 @@ Switches to a specified subtype of a specified input method. This API uses an as ...@@ -375,7 +376,7 @@ Switches to a specified subtype of a specified input method. This API uses an as
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -391,25 +392,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -391,25 +392,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
let im = inputMethod.getCurrentInputMethod(); let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = { let imSubType = inputMethod.getCurrentInputMethodSubtype();
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
try { try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => {
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}, (err,result) => {
if (err !== undefined) { if (err !== undefined) {
console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err)); console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
return; return;
...@@ -440,7 +425,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro ...@@ -440,7 +425,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value** **Return value**
...@@ -461,25 +446,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ...@@ -461,25 +446,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js ```js
let im = inputMethod.getCurrentInputMethod(); let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = { let imSubType = inputMethod.getCurrentInputMethodSubtype();
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
try { try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType).then((result) => {
id: im.packageName,
label: im.methodId,
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}).then((result) => {
if (result) { if (result) {
console.info('Succeeded in switching currentInputMethodAndSubtype.'); console.info('Succeeded in switching currentInputMethodAndSubtype.');
} else { } else {
...@@ -886,7 +855,7 @@ inputMethodController.off('selectByRange'); ...@@ -886,7 +855,7 @@ inputMethodController.off('selectByRange');
on(type: 'selectByMovement', callback: Callback&lt;Movement&gt;): void on(type: 'selectByMovement', callback: Callback&lt;Movement&gt;): void
Enables listening for the selection-by-cursor-movement event. This API uses an asynchronous callback to return the result. Enables listening for the select-by-cursor-movement event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -894,7 +863,7 @@ Enables listening for the selection-by-cursor-movement event. This API uses an a ...@@ -894,7 +863,7 @@ Enables listening for the selection-by-cursor-movement event. This API uses an a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the selection-by-cursor-movement event.| | type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the select-by-cursor-movement event.|
| callback | Callback&lt;[Movement](./js-apis-inputmethod-InputMethodCommon.md#movement)&gt; | Yes | Callback used to return the range of the text to be selected.<br>Your application needs to select the text in the returned range in the text box.| | callback | Callback&lt;[Movement](./js-apis-inputmethod-InputMethodCommon.md#movement)&gt; | Yes | Callback used to return the range of the text to be selected.<br>Your application needs to select the text in the returned range in the text box.|
**Example** **Example**
...@@ -909,7 +878,7 @@ inputMethodController.on('selectByMovement', (movement) => { ...@@ -909,7 +878,7 @@ inputMethodController.on('selectByMovement', (movement) => {
off(type: 'selectByMovement'): void off(type: 'selectByMovement'): void
Disables listening for the selection-by-cursor-movement event. Disables listening for the select-by-cursor-movement event.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -917,7 +886,7 @@ Disables listening for the selection-by-cursor-movement event. ...@@ -917,7 +886,7 @@ Disables listening for the selection-by-cursor-movement event.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the selection-by-cursor-movement event.| | type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the select-by-cursor-movement event.|
**Example** **Example**
...@@ -942,7 +911,7 @@ Enables listening for the input method and subtype change event. This API uses a ...@@ -942,7 +911,7 @@ Enables listening for the input method and subtype change event. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.| | type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | Yes| Callback used to return the input method attributes and subtype.| | callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | Yes| Callback used to return the input method attributes and subtype.|
**Example** **Example**
...@@ -965,7 +934,7 @@ Disables listening for the input method and subtype change event. This API uses ...@@ -965,7 +934,7 @@ Disables listening for the input method and subtype change event. This API uses
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.| | type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | No| Callback used to return the input method attributes and subtype.| | callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | No| Callback used to return the input method attributes and subtype.|
**Example** **Example**
...@@ -986,7 +955,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous ...@@ -986,7 +955,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.| | inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.|
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes| Callback used to return all subtypes of the specified input method.| | callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes| Callback used to return all subtypes of the specified input method.|
**Error codes** **Error codes**
...@@ -1038,7 +1007,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret ...@@ -1038,7 +1007,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret
| Type | Description | | Type | Description |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the specified input method.| | Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the specified input method.|
**Error codes** **Error codes**
...@@ -1082,7 +1051,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac ...@@ -1082,7 +1051,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes | Callback used to return all subtypes of the current input method.| | callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes | Callback used to return all subtypes of the current input method.|
**Error codes** **Error codes**
...@@ -1121,7 +1090,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the ...@@ -1121,7 +1090,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the
| Type | Description | | Type | Description |
| ----------------------------------------------------------- | ---------------------- | | ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the current input method.| | Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the current input method.|
**Error codes** **Error codes**
......
# @ohos.inputMethodEngine (Input Method Service) # @ohos.inputMethodEngine (Input Method Service)
The **inputMethodEngine** module streamlines the interactions between input methods and applications. By calling APIs of this module, applications can be bound to input method services to accept text input, request the keyboard to display or hide, listen for the input method status, and much more. The **inputMethodEngine** module is oriented to input method applications (including system and third-party input method applications). With the APIs of this module, input method applications are able to create soft keyboard windows, insert or delete characters, select text, and listen for physical keyboard events.
> **NOTE** > **NOTE**
> >
...@@ -56,15 +56,15 @@ Provides the constant values of function keys, edit boxes, and the cursor. ...@@ -56,15 +56,15 @@ Provides the constant values of function keys, edit boxes, and the cursor.
getInputMethodAbility(): InputMethodAbility getInputMethodAbility(): InputMethodAbility
Obtains an **InputMethodEngine** instance. Obtains an [InputMethodAbility](#inputmethodability) instance for the input method. The input method can use the obtained instance to subscribe to a soft keyboard display/hide request event, create/destroy an input method panel, and the like.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------------------------- | ------------ | | ----------------------------------------- | ------------------ |
| [InputMethodAbility](#inputmethodability) | **InputMethodEngine** instance obtained.| | [InputMethodAbility](#inputmethodability) | **InputMethodAbility** instance.|
**Example** **Example**
...@@ -76,15 +76,15 @@ let InputMethodAbility = inputMethodEngine.getInputMethodAbility(); ...@@ -76,15 +76,15 @@ let InputMethodAbility = inputMethodEngine.getInputMethodAbility();
getKeyboardDelegate(): KeyboardDelegate getKeyboardDelegate(): KeyboardDelegate
Obtains a **KeyboardDelegate** instance. Obtains a [KeyboardDelegate](#keyboarddelegate) instance for the input method. The input method can use the obtained instance to subscribe to a physical keyboard event, text selection change event, and more.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------- | ---------------- | | ------------------------------------- | ------------------------ |
| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance obtained.| | [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance.|
**Example** **Example**
...@@ -96,7 +96,7 @@ let KeyboardDelegate = inputMethodEngine.getKeyboardDelegate(); ...@@ -96,7 +96,7 @@ let KeyboardDelegate = inputMethodEngine.getKeyboardDelegate();
getInputMethodEngine(): InputMethodEngine getInputMethodEngine(): InputMethodEngine
Obtains an **InputMethodEngine** instance. Obtains an [InputMethodEngine](#inputmethodengine-1) instance for the input method. The input method can use the obtained instance to subscribe to a soft keyboard display/hide request event.
> **NOTE** > **NOTE**
> >
...@@ -106,9 +106,9 @@ Obtains an **InputMethodEngine** instance. ...@@ -106,9 +106,9 @@ Obtains an **InputMethodEngine** instance.
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------------------------- | ------------ | | ----------------------------------------- | ------------------ |
| [InputMethodEngine](#inputmethodengine-1) | **InputMethodEngine** instance obtained.| | [InputMethodEngine](#inputmethodengine-1) | **InputMethodAbility** instance.|
**Example** **Example**
...@@ -120,7 +120,7 @@ let InputMethodEngine = inputMethodEngine.getInputMethodEngine(); ...@@ -120,7 +120,7 @@ let InputMethodEngine = inputMethodEngine.getInputMethodEngine();
createKeyboardDelegate(): KeyboardDelegate createKeyboardDelegate(): KeyboardDelegate
Obtains a **KeyboardDelegate** instance. Obtains a [KeyboardDelegate](#keyboarddelegate) instance for the input method. The input method can use the obtained instance to subscribe to a physical keyboard event, text selection change event, and more.
> **NOTE** > **NOTE**
> >
...@@ -130,9 +130,9 @@ Obtains a **KeyboardDelegate** instance. ...@@ -130,9 +130,9 @@ Obtains a **KeyboardDelegate** instance.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------- | ---------------- | | ------------------------------------- | ------------------------ |
| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance obtained.| | [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance.|
**Example** **Example**
...@@ -157,7 +157,7 @@ Enables listening for the input method binding event. This API uses an asynchron ...@@ -157,7 +157,7 @@ Enables listening for the input method binding event. This API uses an asynchron
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'inputStart'** indicates the input method binding event.| | type | string | Yes | Listening type.<br>The value **'inputStart'** indicates the input method binding event.|
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | Yes| Callback used to return the **KeyboardController** and **TextInputClient** instances.| | callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclientdeprecated)) => void | Yes| Callback used to return the **KeyboardController** and **TextInputClient** instances.|
**Example** **Example**
...@@ -181,7 +181,7 @@ Cancels listening for the input method binding event. ...@@ -181,7 +181,7 @@ Cancels listening for the input method binding event.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------ | | -------- | -------------------- | ---- | ------------------------ |
| type | string | Yes | Listening type.<br>The value **'inputStart'** indicates the input method binding event.| | type | string | Yes | Listening type.<br>The value **'inputStart'** indicates the input method binding event.|
| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | No| Callback used to return the **KeyboardController** and **TextInputClient** instances.| | callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclientdeprecated)) => void | No| Callback used to return the **KeyboardController** and **TextInputClient** instances.|
**Example** **Example**
...@@ -195,7 +195,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textIn ...@@ -195,7 +195,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textIn
on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
Enables listening for a keyboard event. This API uses an asynchronous callback to return the result. Enables listening for a keyboard visibility event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -221,7 +221,7 @@ inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => { ...@@ -221,7 +221,7 @@ inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => {
off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
Disables listening for a keyboard event. This API uses an asynchronous callback to return the result. Disables listening for a keyboard visibility event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework **System capability**: SystemCapability.MiscServices.InputMethodFramework
...@@ -478,6 +478,186 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => { ...@@ -478,6 +478,186 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => {
}); });
``` ```
### createPanel<sup>10+</sup>
createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\<Panel>): void
Creates an input method panel. This API can be called only by input method applications and system applications with the system_core permission. Only one SOFT_KEYBOARD panel and one STATUS_BAR panel can be created for a single input method application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ----------- | ---- | ------------------------ |
| ctx | [BaseContext](./js-apis-inner-application-baseContext.md) | Yes | Context of the current input method.|
| info | [PanelInfo](#panelinfo10) | Yes | Information about the input method panel.|
| callback | AsyncCallback\<[Panel](#panel10)> | Yes | Callback used to return the result. If the operation is successful, the created input method panel is returned. |
**Error codes**
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
**Example**
```js
let panelInfo: inputMethodEngine.PanelInfo = {
panelType: SOFT_KEYBOARD,
panelFlag: FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
if (err !== undefined) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
return;
}
console.log('Succeed in creating panel.');
})
} catch(err) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
}
```
### createPanel<sup>10+</sup>
createPanel(ctx: BaseContext, info: PanelInfo): Promise\<Panel>
Creates an input method panel. This API can be called only by input method applications and system applications with the system_core permission. Only one SOFT_KEYBOARD panel and one STATUS_BAR panel can be created for a single input method application. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ----------- | ---- | ------------------------ |
| ctx | [BaseContext](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md) | Yes | Context of the current input method.|
| info | [PanelInfo](#panelinfo10) | Yes | Information about the input method panel.|
**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------------ |
| Promise\<[Panel](#panel10)> | Promise used to return the result. If the operation is successful, the created input method panel is returned. |
**Error codes**
| Error Code ID | Error Message |
| ---------- | ----------------------------- |
| 12800004 | not an input method extension |
**Example**
```js
let panelInfo: inputMethodEngine.PanelInfo = {
panelType: SOFT_KEYBOARD,
panelFlag: FLG_FIXED
}
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo).then((panel) => {
console.log('Succeed in creating panel.');
}).catch((err) => {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
})
```
### destroyPanel<sup>10+</sup>
destroyPanel(panel: Panel, callback: AsyncCallback\<void>): void;
Destroys an input method panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ----------- | ---- | ------------------------ |
| panel | [Panel](#panel10) | Yes | Input method panel to destroy.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
**Example**
```js
let panelInfo: inputMethodEngine.PanelInfo = {
panelType: SOFT_KEYBOARD,
panelFlag: FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
if (err !== undefined) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
return;
}
globalThis.inputMethodPanel = panel;
console.log('Succeed in creating panel.');
})
} catch(err) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
}
try {
inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel, (err) => {
if(err !== undefined) {
console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
return;
}
console.log('Succeed in destroying panel.');
})
} catch(err) {
console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
}
```
### destroyPanel<sup>10+</sup>
destroyPanel(panel: Panel): Promise\<void>;
Destroys an input method panel. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------| ----------- | ---- | ------------------------ |
| panel | [Panel](#panel10) | Yes | Input method panel to destroy. |
**Return value**
| Type | Description |
| ------- | -------------------------------------------------------------------- |
| Promise\<void> | Promise that returns no value.|
**Example**
```js
let panelInfo: inputMethodEngine.PanelInfo = {
panelType: SOFT_KEYBOARD,
panelFlag: FLG_FIXED
}
try {
inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => {
if (err !== undefined) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
return;
}
globalThis.inputMethodPanel = panel;
console.log('Succeed in creating panel.');
})
} catch(err) {
console.log('Failed to create panel, err: ' + JSON.stringify(err));
}
try {
inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel).then(() => {
console.log('Succeed in destroying panel.');
}).catch((err) => {
console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
});
} catch (err) {
console.log('Failed to destroy panel, err: ' + JSON.stringify(err));
}
```
## KeyboardDelegate ## KeyboardDelegate
In the following API examples, you must first use **[getKeyboardDelegate](#inputmethodenginegetkeyboarddelegate9)** to obtain a **KeyboardDelegate** instance, and then call the APIs using the obtained instance. In the following API examples, you must first use **[getKeyboardDelegate](#inputmethodenginegetkeyboarddelegate9)** to obtain a **KeyboardDelegate** instance, and then call the APIs using the obtained instance.
...@@ -684,6 +864,455 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => { ...@@ -684,6 +864,455 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => {
}); });
``` ```
## Panel<sup>10+</sup>
In the following API examples, you must first use **[createPanel](#createpanel10)** to obtain a **Panel** instance, and then call the APIs using the obtained instance.
### setUiContent<sup>10+</sup>
setUiContent(path: string, callback: AsyncCallback\<void>): void
Loads content from a page to this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
try {
panel.setUiContent('pages/page2/page2', (err) => {
if (err) {
console.error('Failed to set the content. err:' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the content.');
});
} catch (exception) {
console.error('Failed to set the content. err:' + JSON.stringify(exception));
}
```
### setUiContent<sup>10+</sup>
setUiContent(path: string): Promise\<void>
Loads content from a page to this panel. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise\<void> | Promise that returns no value. |
**Example**
```js
try {
let promise = panel.setUiContent('pages/page2/page2');
promise.then(() => {
console.info('Succeeded in setting the content.');
}).catch((err) =>{
console.error('Failed to set the content. err: ' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to set the content. err: ' + JSON.stringify(exception));
}
```
### setUiContent<sup>10+</sup>
setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback\<void>): void
Loads content from a page linked to LocalStorage to this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | Yes | Storage unit that provides storage for mutable and immutable state variables in the application.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
let storage = new LocalStorage();
storage.setOrCreate('storageSimpleProp',121);
try {
panel.setUiContent('pages/page2/page2', storage, (err) => {
if (err) {
console.error('Failed to set the content. err:' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the content.');
});
} catch (exception) {
console.error('Failed to set the content. err:' + JSON.stringify(exception));
}
```
### setUiContent<sup>10+</sup>
setUiContent(path: string, storage: LocalStorage): Promise\<void>
Loads content from a page linked to LocalStorage to this panel. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| path | string | Yes | Path of the page from which the content will be loaded.|
| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | Yes | Storage unit that provides storage for mutable and immutable state variables in the application.|
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise\<void> | Promise that returns no value. |
**Example**
```js
let storage = new LocalStorage();
storage.setOrCreate('storageSimpleProp',121);
try {
let promise = panel.setUiContent('pages/page2/page2');
promise.then(() => {
console.info('Succeeded in setting the content.');
}).catch((err) =>{
console.error('Failed to set the content. err: ' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to set the content. err: ' + JSON.stringify(exception));
}
```
### resize<sup>10+</sup>
resize(width: number, height: number, callback: AsyncCallback\<void>): void
Resizes this panel. This API uses an asynchronous callback to return the result.
The panel width cannot exceed the screen width, and the panel height cannot be higher than half of the screen height.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| width | number | Yes | Target width of the panel, in pixels.|
| height | number | Yes | Target height of the panel, in pixels.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
try {
panel.resize(500, 1000, (err) => {
if (err) {
console.error('Failed to change the panel size. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in changing the panel size.');
});
} catch (exception) {
console.error('Failed to change the panel size. Cause:' + JSON.stringify(exception));
}
```
### resize<sup>10+</sup>
resize(width: number, height: number): Promise\<void>;
Resizes this panel. This API uses a promise to return the result.
The panel width cannot exceed the screen width, and the panel height cannot be higher than half of the screen height.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| width | number | Yes | Target width of the panel, in pixels.|
| height | number | Yes | Target height of the panel, in pixels.|
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise<void> | Promise that returns no value. |
**Example**
```js
try {
let promise = panel.resize(500, 1000);
promise.then(() => {
console.info('Succeeded in changing the panel size.');
}).catch((err) =>{
console.error('Failed to change the panel size. err: ' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to change the panel size. err: ' + JSON.stringify(exception));
}
```
### moveTo<sup>10+</sup>
moveTo(x: number, y: number, callback: AsyncCallback\<void>): void
Moves this panel to the specified position. This API uses an asynchronous callback to return the result.
This API does not work on panels in the FLG_FIXED state.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| x | number | Yes | Distance to move along the x-axis, in px. A positive value indicates moving rightwards.|
| y | number | Yes | Distance to move along the y-axis, in pixels. A positive value indicates moving downwards.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
try {
panel.moveTo(300, 300, (err) =>{
if (err) {
console.error('Failed to move the panel. err:' + JSON.stringify(err));
return;
}
console.info('Succeeded in moving the panel.');
});
} catch (exception) {
console.error('Failed to move the panel. err:' + JSON.stringify(exception));
}
```
### moveTo<sup>10+</sup>
moveTo(x: number, y: number): Promise\<void>
Moves this panel to the specified position. This API uses a promise to return the result.
This API does not work on panels in the FLG_FIXED state.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| x | number | Yes | Distance to move along the x-axis, in pixels. A positive value indicates moving rightwards.|
| y | number | Yes | Distance to move along the y-axis, in pixels. A positive value indicates moving downwards.|
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise<void> | Promise that returns no value. |
**Example**
```js
try {
let promise = windowClass.moveTo(300, 300);
promise.then(() => {
console.info('Succeeded in moving the panel.');
}).catch((err) =>{
console.error('Failed to move the panel. Cause: ' + JSON.stringify(err));
});
} catch (exception) {
console.error('Failed to move the panel. Cause:' + JSON.stringify(exception));
}
```
### show<sup>10+</sup>
show(callback: AsyncCallback\<void>): void
Displays this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
panel.show((err) => {
if (err) {
console.error('Failed to show the panel. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in showing the panel.');
});
```
### show<sup>10+</sup>
show(): Promise\<void>
Displays this panel. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise\<void> | Promise that returns no value. |
**Example**
```js
let promise = panel.show();
promise.then(() => {
console.info('Succeeded in showing the panel.');
}).catch((err) =>{
console.error('Failed to show the panel. err: ' + JSON.stringify(err));
});
```
### hide<sup>10+</sup>
hide(callback: AsyncCallback\<void>): void
Hides this panel. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
```js
panel.hide((err) => {
if (err) {
console.error('Failed to hide the panel. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in hiding the panel.');
});
```
### hide<sup>10+</sup>
hide(): Promise\<void>
Hides this panel. This API uses a promise to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Return value**
| Type | Description |
| ------- | ------------------------------ |
| Promise\<void> | Promise that returns no value. |
**Example**
```js
let promise = panel.hide();
promise.then(() => {
console.info('Succeeded in hiding the panel.');
}).catch((err) =>{
console.error('Failed to hide the panel. err: ' + JSON.stringify(err));
});
```
### on<sup>10+</sup>
on(type: 'show' | 'hide', callback: () => void): void
Enables listening for a panel visibility event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | 'show'\|'hide' | Yes| Listening type.<br>- The value **'show'** indicates the panel display event.<br>- The value **'hide'** indicates the panel hiding event.|
| callback | () => void | Yes | Callback used to return the result.|
**Example**
```js
panel.on('show', () => {
console.info('Panel is showing.');
});
```
### off<sup>10+</sup>
off(type: 'show' | 'hide', callback?: () => void): void
Disables listening for a panel visibility event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| type | 'show'/'hide' | Yes| Listening type.<br>- The value **'show'** indicates the panel display event.<br>- The value **'hide'** indicates the panel hiding event.|
| callback | () => void | No | Callback used to return the result.|
**Example**
```js
panel.off('show');
```
### changeFlag<sup>10+</sup>
changeFlag(flag: PanelFlag): void
Changes the panel state type. This API only works for SOFT_KEYBOARD panels.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------- |
| flag | [PanelFlag](#panelflag10) | Yes| State type of the panel to switch to.|
**Example**
```js
let panelFlag = inputMethodEngine.getInputMethodAbility().PanelFlag.FLG_FIXED;
panel.changeFlag(panelFlag);
```
## KeyboardController ## KeyboardController
In the following API examples, you must first use **[on('inputStart')](#oninputstart9)** to obtain a **KeyboardController** instance, and then call the APIs using the obtained instance. In the following API examples, you must first use **[on('inputStart')](#oninputstart9)** to obtain a **KeyboardController** instance, and then call the APIs using the obtained instance.
...@@ -1752,6 +2381,39 @@ Describes the attribute of a key. ...@@ -1752,6 +2381,39 @@ Describes the attribute of a key.
| keyCode | number | Yes | No | Key value.| | keyCode | number | Yes | No | Key value.|
| keyAction | number | Yes | No | Key status.| | keyAction | number | Yes | No | Key status.|
## PanelFlag<sup>10+</sup>
Enumerates the state types of the input method panel.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name | Value| Description |
| ------------ | -- | ------------------ |
| FLG_FIXED | 0 | Fixed state type.|
| FLG_FLOATING | 1 | Floating state type.|
## PanelType<sup>10+</sup>
Enumerates the types of the input method panel.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name | Value| Description |
| ------------ | -- | ------------------ |
| SOFT_KEYBOARD | 0 | Soft keyboard type.|
| STATUS_BAR | 1 | Status bar type.|
## PanelInfo<sup>10+</sup>
**System capability**: SystemCapability.MiscServices.InputMethodFramework
Describes the attributes of the input method panel.
| Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------ |
| type | number | Yes | Yes | Type of the panel.|
| flag | number | Yes | Yes | State type of the panel.|
## TextInputClient<sup>(deprecated)</sup> ## TextInputClient<sup>(deprecated)</sup>
> **NOTE** > **NOTE**
...@@ -2250,3 +2912,4 @@ textInputClient.getEditorAttribute().then((editorAttribute) => { ...@@ -2250,3 +2912,4 @@ textInputClient.getEditorAttribute().then((editorAttribute) => {
console.error('Failed to getEditorAttribute: ' + JSON.stringify(err)); console.error('Failed to getEditorAttribute: ' + JSON.stringify(err));
}); });
``` ```
<!--no_check-->
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
The **bundle.installer** module provides APIs for you to install, uninstall, and recover bundles on devices. The **bundle.installer** module provides APIs for you to install, uninstall, and recover bundles on devices.
> **NOTE** > **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -150,6 +150,64 @@ try { ...@@ -150,6 +150,64 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message); console.error('getBundleInstaller failed. Cause: ' + error.message);
} }
``` ```
## BundleInstaller.install
install(hapFilePaths: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
Installs a bundle. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| hapFilePaths | Array&lt;string&gt; | Yes | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
| 17700015 | Failed to install the HAPs because they have different configuration information. |
| 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700018 | Failed to install because the dependent module does not exist. |
| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
| 17700041 | Failed to install because enterprise device management disallow install. |
**Example**
```ts
import installer from '@ohos.bundle.installer';
let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
try {
installer.getBundleInstaller().then(data => {
data.install(hapFilePaths, err => {
if (err) {
console.error('install failed:' + err.message);
} else {
console.info('install successfully.');
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## BundleInstaller.install ## BundleInstaller.install
...@@ -210,9 +268,9 @@ try { ...@@ -210,9 +268,9 @@ try {
installer.getBundleInstaller().then(data => { installer.getBundleInstaller().then(data => {
data.install(hapFilePaths, installParam) data.install(hapFilePaths, installParam)
.then((data) => { .then((data) => {
console.info('install success: ' + JSON.stringify(data)); console.info('install successfully: ' + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.error('install failed:' + err.message); console.error('install failed:' + error.message);
}); });
}).catch(error => { }).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message); console.error('getBundleInstaller failed. Cause: ' + error.message);
...@@ -248,7 +306,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -248,7 +306,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700004 | The specified user ID is not found. | | 17700001 | The specified bundle name is not found. |
| 17700004 | The specified user ID is not found. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | | 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
...@@ -280,11 +339,11 @@ try { ...@@ -280,11 +339,11 @@ try {
} }
``` ```
## BundleInstaller.uninstall<sup>10+</sup> ## BundleInstaller.uninstall
uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : void ; uninstall(bundleName: string, callback: AsyncCallback&lt;void&gt;): void;
Uninstalls a shared bundle. This API uses an asynchronous callback to return the result. Uninstalls a bundle. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -294,10 +353,10 @@ Uninstalls a shared bundle. This API uses an asynchronous callback to return the ...@@ -294,10 +353,10 @@ Uninstalls a shared bundle. This API uses an asynchronous callback to return the
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall. | | bundleName | string | Yes | Name of the target bundle. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -305,21 +364,19 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -305,21 +364,19 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700001 | The specified bundle name is not found. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700037 | The version of shared bundle is dependent on other applications. | | 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
| 17700038 | The specified shared bundle does not exist. |
**Example** **Example**
```ts ```ts
import installer from '@ohos.bundle.installer'; import installer from '@ohos.bundle.installer';
let uninstallParam = { let bundleName = 'com.ohos.demo';
bundleName : "com.ohos.demo",
};
try { try {
installer.getBundleInstaller().then(data => { installer.getBundleInstaller().then(data => {
data.uninstall(uninstallParam, err => { data.uninstall(bundleName, err => {
if (err) { if (err) {
console.error('uninstall failed:' + err.message); console.error('uninstall failed:' + err.message);
} else { } else {
...@@ -333,12 +390,11 @@ try { ...@@ -333,12 +390,11 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message); console.error('getBundleInstaller failed. Cause: ' + error.message);
} }
``` ```
## BundleInstaller.uninstall
## BundleInstaller.uninstall<sup>10+</sup> uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
uninstall(uninstallParam: UninstallParam) : Promise\<void>;
Uninstalls a shared bundle. This API uses a promise to return the result. Uninstalls a bundle. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -348,14 +404,15 @@ Uninstalls a shared bundle. This API uses a promise to return the result. ...@@ -348,14 +404,15 @@ Uninstalls a shared bundle. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- | | ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall.| | bundleName | string | Yes | Name of the target bundle. |
| installParam | [InstallParam](#installparam) | No | Parameters required for the uninstall. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------- | -------------------------------------- | | --------------- | -------------------------------------- |
| Promise\<void\> | Promise that returns no value.| | Promise\<void\> | Promise that returns no value.|
**Error codes** **Error codes**
...@@ -364,26 +421,28 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -364,26 +421,28 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700001 | The specified bundle name is not found. |
| 17700004 | The specified userId is not existed. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700037 | The version of shared bundle is dependent on other applications. | | 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
| 17700038 | The specified shared bundle does not exist. |
**Example** **Example**
```ts ```ts
import installer from '@ohos.bundle.installer'; import installer from '@ohos.bundle.installer';
let uninstallParam = { let bundleName = 'com.ohos.demo';
bundleName : "com.ohos.demo", let installParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
}; };
try { try {
installer.getBundleInstaller().then(data => { installer.getBundleInstaller().then(data => {
data.uninstall(uninstallParam, err => { data.uninstall(bundleName, installParam)
if (err) { .then((data) => {
console.error('uninstall failed:' + err.message); console.info('uninstall successfully: ' + JSON.stringify(data));
} else { }).catch((error) => {
console.info('uninstall successfully.'); console.error('uninstall failed:' + error.message);
}
}); });
}).catch(error => { }).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message); console.error('getBundleInstaller failed. Cause: ' + error.message);
...@@ -397,7 +456,7 @@ try { ...@@ -397,7 +456,7 @@ try {
recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void; recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void;
Recovers a bundle. This API uses an asynchronous callback to return the result. Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -410,7 +469,7 @@ Recovers a bundle. This API uses an asynchronous callback to return the result. ...@@ -410,7 +469,7 @@ Recovers a bundle. This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| bundleName | string | Yes | Name of the target bundle. | | bundleName | string | Yes | Name of the target bundle. |
| installParam | [InstallParam](#installparam) | Yes | Parameters required for the recovering. | | installParam | [InstallParam](#installparam) | Yes | Parameters required for the recovery. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.|
**Error codes** **Error codes**
...@@ -419,6 +478,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -419,6 +478,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 17700001 | The specified bundle name is not found. |
| 17700004 | The specified user ID is not found. | | 17700004 | The specified user ID is not found. |
**Example** **Example**
...@@ -449,6 +509,229 @@ try { ...@@ -449,6 +509,229 @@ try {
} }
``` ```
## BundleInstaller.recover
recover(bundleName: string, callback: AsyncCallback&lt;void&gt;): void;
Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| bundleName | string | Yes | Name of the target bundle. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 17700001 | The specified bundle name is not found. |
**Example**
```ts
import installer from '@ohos.bundle.installer';
let bundleName = 'com.ohos.demo';
try {
installer.getBundleInstaller().then(data => {
data.recover(bundleName, err => {
if (err) {
console.error('recover failed:' + err.message);
} else {
console.info('recover successfully.');
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## BundleInstaller.recover
recover(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
Rolls back a bundle to the initial installation state. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Name of the target bundle. |
| installParam | [InstallParam](#installparam) | No | Parameters required for the recovery. |
**Return value**
| Type | Description |
| --------------- | -------------------------------------- |
| Promise\<void\> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 17700001 | The specified bundle name is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
```ts
import installer from '@ohos.bundle.installer';
let bundleName = 'com.ohos.demo';
let installParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
try {
installer.getBundleInstaller().then(data => {
data.recover(bundleName, installParam)
.then((data) => {
console.info('recover successfully: ' + JSON.stringify(data));
}).catch((error) => {
console.error('recover failed:' + error.message);
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## BundleInstaller.uninstall<sup>10+</sup>
uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : void ;
Uninstalls a shared bundle. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- |
| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700037 | The version of shared bundle is dependent on other applications. |
| 17700038 | The specified shared bundle does not exist. |
**Example**
```ts
import installer from '@ohos.bundle.installer';
let uninstallParam = {
bundleName : "com.ohos.demo",
};
try {
installer.getBundleInstaller().then(data => {
data.uninstall(uninstallParam, err => {
if (err) {
console.error('uninstall failed:' + err.message);
} else {
console.info('uninstall successfully.');
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## BundleInstaller.uninstall<sup>10+</sup>
uninstall(uninstallParam: UninstallParam) : Promise\<void>;
Uninstalls a shared bundle. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- |
| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall.|
**Return value**
| Type | Description |
| ------------- | -------------------------------------- |
| Promise\<void\> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700037 | The version of shared bundle is dependent on other applications. |
| 17700038 | The specified shared bundle does not exist. |
**Example**
```ts
import installer from '@ohos.bundle.installer';
let uninstallParam = {
bundleName : "com.ohos.demo",
};
try {
installer.getBundleInstaller().then(data => {
data.uninstall(uninstallParam, err => {
if (err) {
console.error('uninstall failed:' + err.message);
} else {
console.info('uninstall successfully.');
}
});
}).catch(error => {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
}
```
## HashParam ## HashParam
Defines the hash parameters for bundle installation and uninstall. Defines the hash parameters for bundle installation and uninstall.
...@@ -477,7 +760,7 @@ Defines the parameters that need to be specified for bundle installation, uninst ...@@ -477,7 +760,7 @@ Defines the parameters that need to be specified for bundle installation, uninst
| isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.| | isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.|
| hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. | | hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. |
| crowdtestDeadline| number | No |End date of crowdtesting.| | crowdtestDeadline| number | No |End date of crowdtesting.|
| sharedBundleDirPaths | Array\<String> | No|Paths of the shared bundle files.| | sharedBundleDirPaths<sup>10+</sup> | Array\<String> | No|Paths of the shared bundle files.|
## UninstallParam<sup>10+</sup> ## UninstallParam<sup>10+</sup>
......
...@@ -29,7 +29,7 @@ Obtains the launcher ability information based on the given bundle name and user ...@@ -29,7 +29,7 @@ Obtains the launcher ability information based on the given bundle name and user
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.| | bundleName | string | Yes | Bundle name.|
| userId | number | Yes | User ID.| | userId | number | Yes | User ID.|
**Return value** **Return value**
...@@ -45,7 +45,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -45,7 +45,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**Example** **Example**
...@@ -55,12 +55,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; ...@@ -55,12 +55,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try { try {
launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100, (errData, data) => { launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100, (errData, data) => {
if (errData !== null) { if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
} }
console.log("data is " + JSON.stringify(data));
}) })
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
...@@ -80,7 +81,7 @@ Obtains the launcher ability information based on the given bundle name and user ...@@ -80,7 +81,7 @@ Obtains the launcher ability information based on the given bundle name and user
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.| | bundleName | string | Yes | Bundle name.|
| userId | number | Yes | User ID.| | userId | number | Yes | User ID.|
**Return value** **Return value**
...@@ -96,7 +97,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -96,7 +97,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**Example** **Example**
...@@ -107,10 +108,10 @@ try { ...@@ -107,10 +108,10 @@ try {
launcherBundleManager.getLauncherAbilityInfo("com.example.demo", 100).then(data => { launcherBundleManager.getLauncherAbilityInfo("com.example.demo", 100).then(data => {
console.log("data is " + JSON.stringify(data)); console.log("data is " + JSON.stringify(data));
}).catch (errData => { }).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}) })
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
...@@ -144,7 +145,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -144,7 +145,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
Example Example
...@@ -154,12 +155,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; ...@@ -154,12 +155,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try { try {
launcherBundleManager.getAllLauncherAbilityInfo(100, (errData, data) => { launcherBundleManager.getAllLauncherAbilityInfo(100, (errData, data) => {
if (errData !== null) { if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
} }
console.log("data is " + JSON.stringify(data));
}); });
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
## launcherBundlemanager.getAllLauncherAbilityInfo<sup>9+</sup> ## launcherBundlemanager.getAllLauncherAbilityInfo<sup>9+</sup>
...@@ -192,7 +194,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -192,7 +194,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**Example** **Example**
...@@ -203,10 +205,10 @@ try { ...@@ -203,10 +205,10 @@ try {
launcherBundleManager.getAllLauncherAbilityInfo(100).then(data => { launcherBundleManager.getAllLauncherAbilityInfo(100).then(data => {
console.log("data is " + JSON.stringify(data)); console.log("data is " + JSON.stringify(data));
}).catch (errData => { }).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}); });
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
...@@ -224,7 +226,7 @@ Obtains the shortcut information of the current user based on the given bundle n ...@@ -224,7 +226,7 @@ Obtains the shortcut information of the current user based on the given bundle n
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.| | bundleName | string | Yes | Bundle name.|
**Return value** **Return value**
...@@ -248,12 +250,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; ...@@ -248,12 +250,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try { try {
launcherBundleManager.getShortcutInfo("com.example.demo", (errData, data) => { launcherBundleManager.getShortcutInfo("com.example.demo", (errData, data) => {
if (errData !== null) { if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
} }
console.log("data is " + JSON.stringify(data));
}); });
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
...@@ -271,7 +274,7 @@ Obtains the shortcut information of the current user based on the given bundle n ...@@ -271,7 +274,7 @@ Obtains the shortcut information of the current user based on the given bundle n
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.| | bundleName | string | Yes | Bundle name.|
**Return value** **Return value**
...@@ -296,9 +299,9 @@ try { ...@@ -296,9 +299,9 @@ try {
launcherBundleManager.getShortcutInfo("com.example.demo").then(data => { launcherBundleManager.getShortcutInfo("com.example.demo").then(data => {
console.log("data is " + JSON.stringify(data)); console.log("data is " + JSON.stringify(data));
}).catch (errData => { }).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}); });
} catch (errData) { } catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`); console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} }
``` ```
...@@ -239,7 +239,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -239,7 +239,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700032 | he specified bundle does not contain any overlay module. | | 17700032 | The specified bundle does not contain any overlay module. |
| 17700033 | The specified module is not an overlay module. | | 17700033 | The specified module is not an overlay module. |
**Example** **Example**
...@@ -415,7 +415,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -415,7 +415,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700032 | The specified bundle does not contain any overlay module. | | 17700032 | The specified bundle does not contain any overlay module. |
| 17700033 | The specified module is not an overlay module. | | 17700033 | The specified module is not an overlay module. |
...@@ -462,7 +462,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -462,7 +462,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700032 | The specified bundle does not contain any overlay module. | | 17700032 | The specified bundle does not contain any overlay module. |
| 17700033 | The specified module is not an overlay module. | | 17700033 | The specified module is not an overlay module. |
...@@ -511,7 +511,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -511,7 +511,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700032 | The specified bundle does not contain any overlay module. | | 17700032 | The specified bundle does not contain any overlay module. |
| 17700033 | The specified module is not an overlay module. | | 17700033 | The specified module is not an overlay module. |
...@@ -557,7 +557,7 @@ Obtains the information about modules with the overlay feature in another applic ...@@ -557,7 +557,7 @@ Obtains the information about modules with the overlay feature in another applic
| Type | Description | | Type | Description |
| ------------------------- | ------------------ | | ------------------------- | ------------------ |
| Promise\<Array\<OverlayModuleInfo>> | Promise used to return the array of overlay module information obtained.| | Promise\<Array\<OverlayModuleInfo>> | Promise used to return the result, which is an array of **OverlayModuleInfo** objects.|
**Error codes** **Error codes**
...@@ -565,7 +565,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -565,7 +565,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700034 | The specified module is an overlay module. | | 17700034 | The specified module is an overlay module. |
| 17700035 | The specified bundle is an overlay bundle. | | 17700035 | The specified bundle is an overlay bundle. |
...@@ -612,7 +612,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -612,7 +612,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700034 | The specified module is an overlay module. | | 17700034 | The specified module is an overlay module. |
| 17700035 | The specified bundle is an overlay bundle. | | 17700035 | The specified bundle is an overlay bundle. |
...@@ -661,7 +661,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc ...@@ -661,7 +661,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message | | ID| Error Message |
| ------ | -------------------------------------- | | ------ | -------------------------------------- |
| 17700001 | The specified bundleName is not found | | 17700001 | The specified bundleName is not found. |
| 17700002 | The specified module name is not found. | | 17700002 | The specified module name is not found. |
| 17700034 | The specified module is an overlay module. | | 17700034 | The specified module is an overlay module. |
| 17700035 | The specified bundle is an overlay bundle. | | 17700035 | The specified bundle is an overlay bundle. |
......
...@@ -28,15 +28,6 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -28,15 +28,6 @@ Since API version 9, this API is supported in ArkTS widgets.
| max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.<br>- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.<br>Default value: **100**| | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.<br>- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.<br>Default value: **100**|
| type<sup>8+</sup> | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).<br>Default value: **DataPanelType.Circle**| | type<sup>8+</sup> | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).<br>Default value: **DataPanelType.Circle**|
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description |
| ----------- | ------- | -------------------------------------------- |
| closeEffect | boolean | Whether to disable the rotation effect for the component.<br>Default value: **false**|
## DataPanelType ## DataPanelType
...@@ -48,6 +39,50 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -48,6 +39,50 @@ Since API version 9, this API is supported in ArkTS widgets.
| Circle | Circle data panel.| | Circle | Circle data panel.|
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type| Mandatory| Description|
| ------------- | ------- | ---- | -------- |
| closeEffect | boolean | Yes| Whether to disable the rotation effect for the component.<br>Default value: **false**.|
| valueColors<sup>10+</sup> | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | Yes| Array of data segment colors. A value of the **ResourceColor** type indicates a solid color, and A value of the **LinearGradient** type indicates a color gradient.|
| trackBackgroundColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Yes| Background color.|
| strokeWidth<sup>10+</sup> | [Length](ts-types.md#Length) | Yes| Stroke width of the border.|
| trackShadow<sup>10+</sup> | [DataPanelShadowOption](#datapanelshadowoption10) | Yes| Shadow style. If this attribute is not set, the shadow effect is disabled.|
## DataPanelShadowOption<sup>10+</sup>
| Name | Type| Mandatory| Description|
| ------------- | ------- | ---- | -------- |
| radius | number \| [Resource](ts-types.md#resource)| No| Shadow blur radius.<br>Default value: **5vp**|
| colors | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | No| Array of shadow colors for data segments.<br>Default value: same as the value of **valueColors**.|
| offsetX | number \| [Resource](ts-types.md#resource)| No| Offset on the x-axis.<br>Default value: **5vp**|
| offsetY | number \| [Resource](ts-types.md#resource)| No| Offset on the y-axis.<br>Default value: **5vp**|
## LinearGradient<sup>10+</sup>
Describes the linear gradient.
LinearGradient(colorStops: ColorStop[])
| Name | Type| Mandatory| Description|
| ------------- | ------- | ---- | -------- |
| colorStops | [ColorStop](#colorstop10)[] | Yes| Gradient colors and color stops.|
## ColorStop<sup>10+</sup>
Describes the gradient color stop.
| Name | Type| Mandatory| Description|
| ------------- | ------- | ---- | -------- |
| color | [ResourceColor](ts-types.md#resourcecolor) | Yes| Color value.|
| offset | [Length](ts-types.md#Length) | Yes| Gradient color stop (proportion value between 0 and 1).|
## Example ## Example
```ts ```ts
......
...@@ -4,7 +4,7 @@ The **\<DatePicker>** component allows users to select a date from the given ran ...@@ -4,7 +4,7 @@ The **\<DatePicker>** component allows users to select a date from the given ran
> **NOTE** > **NOTE**
> >
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## Child Components ## Child Components
...@@ -20,33 +20,45 @@ Creates a date picker in the given date range. ...@@ -20,33 +20,45 @@ Creates a date picker in the given date range.
**Parameters** **Parameters**
| Name| Type| Mandatory | Description| | Name | Type| Mandatory | Description |
| -------- | -------- | ------------- | -------- | | -------- | ---- | ---- | -------------------------------------- |
| start | Date | No | Start date of the picker.<br>Default value: **Date('1970-1-1')**| | start | Date | No | Start date of the picker.<br>Default value: **Date('1970-1-1')** |
| end | Date | No | End date of the picker.<br>Default value: **Date('2100-12-31')**| | end | Date | No | End date of the picker.<br>Default value: **Date('2100-12-31')**|
| selected | Date | No | Date of the selected item.<br>Default value: current system date | | selected | Date | No | Date of the selected item.<br>Default value: current system date |
## Attributes ## Attributes
| Name | Type | Description | In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| ------| -------------- | -------- |
| lunar | boolean | Whether to display the lunar calendar.<br>- **true**: Display the lunar calendar.<br>- **false**: Do not display the lunar calendar.<br>Default value: **false**| | Name | Type | Description |
| -------------------------------- | ---------------------------------------- | ---------------------------------------- |
| lunar | boolean | Whether to display the lunar calendar.<br>- **true**: Display the lunar calendar.<br>- **false**: Do not display the lunar calendar.<br>Default value: **false**|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width for the top and bottom items. |
| textStyle<sup>10+</sup> | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items. |
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width of the selected item. |
## PickerTextStyle<sup>10+</sup>
| Name | Type | Mandatory | Description |
| ----- | ---------------------------------------- | ---- | ------------------------- |
| color | [ResourceColor](ts-types.md#resourcecolor) | No | Font color. |
| font | [Font](ts-types.md#font) | No | Text style. Only the font size and font width are supported.|
## Events ## Events
| Name| Description| In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| -------- | -------- |
| Name | Description |
| ---------------------------------------- | ----------- |
| onChange(callback: (value: DatePickerResult) =&gt; void) | Triggered when a date is selected.| | onChange(callback: (value: DatePickerResult) =&gt; void) | Triggered when a date is selected.|
## DatePickerResult ## DatePickerResult
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----- | ------ | --------------------------- |
| year | number | Year of the selected date.| | year | number | Year of the selected date. |
| month | number | Month of the selected date. The value ranges from 0 to 11. The value **0** indicates January, and **11** indicates December.| | month | number | Month of the selected date. The value ranges from 0 to 11. The value **0** indicates January, and **11** indicates December.|
| day | number | Day of the selected date.| | day | number | Day of the selected date. |
## Example ## Example
...@@ -63,7 +75,7 @@ struct DatePickerExample { ...@@ -63,7 +75,7 @@ struct DatePickerExample {
build() { build() {
Column() { Column() {
Button('Switch Calendar') Button('Switch Calendar')
.margin({ top: 30 }) .margin({ top: 30, bottom: 30 })
.onClick(() => { .onClick(() => {
this.isLunar = !this.isLunar this.isLunar = !this.isLunar
}) })
......
...@@ -19,7 +19,7 @@ Not supported ...@@ -19,7 +19,7 @@ Not supported
## APIs ## APIs
Image(src: string | PixelMap | Resource) Image(src: PixelMap | ResourceStr | DrawableDescriptor)
Obtains an image from the specified source for subsequent rendering and display. Obtains an image from the specified source for subsequent rendering and display.
...@@ -27,34 +27,35 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -27,34 +27,35 @@ Since API version 9, this API is supported in ArkTS widgets.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name | Type | Mandatory | 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.<br>When using an image referenced using a relative path, for example, **Image("common/test.jpg")**, the **\<Image>** 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.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.<br/>\- Strings with the **datashare://** path prefix are supported, which are used to access the image path provided by a Data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).<br/>\- 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. Ensure that the application has the read permission to the files in the specified path.<br/>- ArkTS widgets do not support the **http://**, **datashare://**, or **file://data/storage** path prefixes.<br>- ArkTS widgets do not support the [PixelMap](../apis/js-apis-image.md#pixelmap7) type.| | src | [PixelMap](../apis/js-apis-image.md#pixelmap7) \|ResourceStr\| [DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor) | Yes | Image source. Both local and online images are supported.<br>When using an image referenced using a relative path, for example, **Image("common/test.jpg")**, the **\<Image>** 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.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.<br/>\- Strings with the **datashare://** path prefix are supported, which are used to access the image path provided by a Data ability.<br/>\- 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. Ensure that the application has the read permission to the files in the specified path.<br/>\- [DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor) objects are supported.<br/>**NOTE**<br/>- ArkTS widgets support GIF images, but the images are played only once when they are displayed.<br/>- ArkTS widgets do not support the **http://**, **datashare://**, or **file://data/storage** path prefixes.<br>- ArkTS widgets do not support the [PixelMap](../apis/js-apis-image.md#pixelmap7) type.|
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description | | Name | Type | Description |
| --------------------- | ------------------------------------------------------- | ------------------------------------------------------------ | | ------------------------ | ---------------------------------------- | ---------------------------------------- |
| alt | string \| [Resource](ts-types.md#resource)| Placeholder image displayed during loading. Local images are supported.<br>Since API version 9, this API is supported in ArkTS widgets.| | alt | string \| [Resource](ts-types.md#resource)| Placeholder image displayed during loading. Local images are supported.<br>Since API version 9, this API is supported in ArkTS widgets.|
| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Image scale mode.<br>Default value: **ImageFit.Cover**<br>Since API version 9, this API is supported in ArkTS widgets.| | objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Image scale mode.<br>Default value: **ImageFit.Cover**<br>Since API version 9, this API is supported in ArkTS widgets.|
| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.<br>Default value: **ImageRepeat.NoRepeat**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.| | objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.<br>Default value: **ImageRepeat.NoRepeat**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.|
| interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.<br>Default value: **ImageInterpolation.None**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.<br>This attribute is not applicable to **PixelMap** objects.| | interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.<br>Default value: **ImageInterpolation.None**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.<br>This attribute is not applicable to **PixelMap** objects.|
| renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.<br>Default value: **ImageRenderMode.Original**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.| | renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.<br>Default value: **ImageRenderMode.Original**<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to SVG images.|
| sourceSize | {<br>width: number,<br>height: number<br>} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects or SVG images.| | sourceSize | {<br>width: number,<br>height: number<br>} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>This attribute is not applicable to **PixelMap** objects or SVG images.|
| matchTextDirection | boolean | 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.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | matchTextDirection | boolean | 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.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.<br>Since API version 9, this API is supported in ArkTS widgets.| | fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.<br>Since API version 9, this API is supported in ArkTS widgets.|
| autoResize | boolean | 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.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.| | autoResize | boolean | 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.<br>Default value: **true**<br>Since API version 9, this API is supported in ArkTS widgets.|
| syncLoad<sup>8+</sup> | boolean | 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.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | syncLoad<sup>8+</sup> | boolean | 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.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether the image can be copied. (SVG images cannot be copied.)<br>When **copyOption** is set to a value other than **CopyOptions.None**, the image can be copied in various manners, such as long pressing, right-clicking, or pressing Ctrl+C.<br>Default value: **CopyOptions.None**<br>This API is supported in ArkTS widgets.| | copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether the image can be copied. (SVG images cannot be copied.)<br>When **copyOption** is set to a value other than **CopyOptions.None**, the image can be copied in various manners, such as long pressing, right-clicking, or pressing Ctrl+C.<br>Default value: **CopyOptions.None**<br>This API is supported in ArkTS widgets.|
| colorFilter<sup>9+</sup> | [ColorFilter](ts-types.md#colorfilter9) | Color filter of the image.<br>This API is supported in ArkTS widgets.| | colorFilter<sup>9+</sup> | [ColorFilter](ts-types.md#colorfilter9) | Color filter of the image.<br>This API is supported in ArkTS widgets. |
| draggable<sup>9+</sup> | boolean | Whether the image is draggable. This attribute cannot be used together with the [onDragStart](ts-universal-events-drag-drop.md) event.<br>Default value: **false**<br>This API is supported in ArkTS widgets.| | draggable<sup>9+</sup> | boolean | Whether the image is draggable. This attribute cannot be used together with the [onDragStart](ts-universal-events-drag-drop.md) event.<br>Default value: **false**<br>This API is supported in ArkTS widgets.|
> **NOTE** > **NOTE**
> >
> To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**. > To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**.
>
> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, and **animate**. > For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, and **animate**.
### ImageInterpolation ### ImageInterpolation
...@@ -81,11 +82,11 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -81,11 +82,11 @@ Since API version 9, this API is supported in ArkTS widgets.
In addition to the [universal events](ts-universal-events-click.md), the following events are supported. In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------------------------------------- | ---------------------------------------- |
| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,<br> componentHeight: number, loadingStatus: number }) =&gt; void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.<br>- **width**: width of the image, in pixels.<br>- **height**: height of the image, in pixels.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>- **loadingStatus**: image loading status. The value **1** means that the image is successfully loaded, and **0** means the opposite.<br>Since API version 9, this API is supported in ArkTS widgets. | | onComplete(callback: (event?: { width: number, height: number, componentWidth: number,<br> componentHeight: number, loadingStatus: number }) =&gt; void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.<br>- **width**: width of the image, in pixels.<br>- **height**: height of the image, in pixels.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>- **loadingStatus**: image loading status.<br>Since API version 9, this API is supported in ArkTS widgets.<br>**NOTE**<br>The value **1** means that the image is successfully loaded, and **0** means the opposite.|
| onError(callback: (event?: { componentWidth: number, componentHeight: number , message<sup>9+</sup>: string }) =&gt; void) | Triggered when an exception occurs during image loading.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>Since API version 9, this API is supported in ArkTS widgets. | | onError(callback: (event?: { componentWidth: number, componentHeight: number , message<sup>9+</sup>: string }) =&gt; void) | Triggered when an exception occurs during image loading.<br>- **componentWidth**: width of the container component, in pixels.<br>- **componentHeight**: height of the container component, in pixels.<br>Since API version 9, this API is supported in ArkTS widgets.|
| onFinish(event: () =&gt; 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.<br>Since API version 9, this API is supported in ArkTS widgets. | | onFinish(event: () =&gt; 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.<br>Since API version 9, this API is supported in ArkTS widgets.|
## Example ## Example
...@@ -163,7 +164,7 @@ struct ImageExample1 { ...@@ -163,7 +164,7 @@ struct ImageExample1 {
### Loading Online Images ### Loading Online Images
The default network timeout period is 5 minutes for loading online images. When using an online image, you are advised to use **alt** to configure the placeholder image displayed during loading. If more flexible network configuration is required, use the [HTTP](../../connectivity/http-request.md) module in the SDK to send a network request, and then decode the returned data into a **PixelMap** in the **\<Image>** component. For details about image development, see [Image Development](../../media/image.md). The code snippet is as follows: The default network timeout period is 5 minutes for loading online images. When using an online image, you are advised to use **alt** to configure the placeholder image displayed during loading. If more flexible network configuration is required, you can use the [HTTP](../../connectivity/http-request.md) tool provided in the SDK to send a network request, and then decode the returned data into **PixelMap** objects in the **\<Image>** component. For details about image development, see [Image Processing](../../media/image-overview.md). The code snippet is as follows:
```tsx ```tsx
// @ts-nocheck // @ts-nocheck
...@@ -371,7 +372,7 @@ import context from '@ohos.app.ability.common'; ...@@ -371,7 +372,7 @@ import context from '@ohos.app.ability.common';
struct LoadImageExample { struct LoadImageExample {
@State resourcesPath: string = '' @State resourcesPath: string = ''
@State sandboxPath: string = '' @State sandboxPath: string = ''
context: context.UIAbility = getContext(this) as context.UIAbilityContext context: context.UIAbilityContext = getContext(this) as context.UIAbilityContext
build() { build() {
Column() { Column() {
...@@ -398,6 +399,12 @@ struct LoadImageExample { ...@@ -398,6 +399,12 @@ struct LoadImageExample {
Image(this.resourcesPath) Image(this.resourcesPath)
.width(100) .width(100)
.height(100) .height(100)
.colorFilter([
0.30, 0.59, 0.11, 0, 0,
0.30, 0.59, 0.11, 0, 0,
0.30, 0.59, 0.11, 0, 0,
0, 0, 0, 1.0, 0
])
Text(`Sandbox image path: ${this.sandboxPath}`) Text(`Sandbox image path: ${this.sandboxPath}`)
.fontSize(20) .fontSize(20)
.margin({ bottom: 10 }) .margin({ bottom: 10 })
...@@ -409,3 +416,4 @@ struct LoadImageExample { ...@@ -409,3 +416,4 @@ struct LoadImageExample {
} }
} }
``` ```
<!--no_check-->
\ No newline at end of file
...@@ -22,7 +22,9 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -22,7 +22,9 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description | | Name | Type | Description |
| -------- | ------------------------- | ---------------------------------------------------------------- | | -------- | ------------------------- | ---------------------------------------------------------------- |
| fontSize | [Length](ts-types.md#length) | Font size that applies to all texts in the menu. When **Length** is of the number type, the unit is fp.| | fontSize<sup>deprecated</sup> | [Length](ts-types.md#length) | Font size of the menu text. When **Length** is of the number type, the unit is fp.<br>This API is deprecated since API version 10. You are advised to use **font** instead.|
| font<sup>10+</sup> | [Font](ts-types.md#font) | Font style of the menu text.|
| fontColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu text.|
## Example ## Example
......
...@@ -22,22 +22,26 @@ MenuItem(value?: MenuItemOptions| CustomBuilder) ...@@ -22,22 +22,26 @@ MenuItem(value?: MenuItemOptions| CustomBuilder)
## MenuItemOptions ## MenuItemOptions
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ---------------------------------------- | ---- | -------------------------------------- | | --------- | ------------------------------------------- | ---- | -------------------------------------- |
| startIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the left of the menu item. | | startIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the left of the menu item. |
| content | [ResourceStr](ts-types.md#resourcestr) | Yes | Content of the menu item. | | content | [ResourceStr](ts-types.md#resourcestr) | No | Content of the menu item. |
| endIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the right of the menu item. | | endIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the right of the menu item. |
| labelInfo | [ResourceStr](ts-types.md#resourcestr) | No | Information about the ending label, for example, shortcut **Ctrl+C**. | | labelInfo | [ResourceStr](ts-types.md#resourcestr) | No | Information about the ending label, for example, shortcut **Ctrl+C**.|
| builder | [CustomBuilder](ts-types.md#custombuilder8) | No | Builder for a level-2 menu. | | builder | [CustomBuilder](ts-types.md#custombuilder8) | No | Builder for a level-2 menu. |
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type| Description | | Name | Type | Description |
| ---------- | -------- | ---------------------------------------- | | ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| selected | boolean | Whether the menu item is selected.<br>Default value: **false** | | selected | boolean | Whether the menu item is selected.<br>Default value: **false** |
| selectIcon | boolean | Whether to display the icon of the menu item being selected.| | selectIcon | boolean \| [ResourceStr](ts-types.md#resourcestr)<sup>10+</sup> | Whether to display the selected icon for a menu item is selected.<br>Default value: **false**<br>**true**: When a menu item is selected, the default tick icon is displayed.<br>**false**: When a menu item is selected, no icon is displayed.<br>**ResourceStr**: When a menu item is selected, the specified icon is displayed.|
| contentFont<sup>10+</sup> | [Font](ts-types.md#font) | Font style of the menu item content. |
| contentFontColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu item content. |
| labelFont<sup>10+</sup> | [Font](ts-types.md#font) | Font style of the menu item label. |
| labelFontColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu item label. |
## Events ## Events
......
...@@ -5,6 +5,8 @@ The **\<QRCode>** component is used to display a QR code. ...@@ -5,6 +5,8 @@ The **\<QRCode>** component is used to display a QR code.
> **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.
>
> The number of pixels of the **\<QRCode>** component is subject to the content. If the component size is not large enough, the content may fail to be displayed. In this case, you need to resize the component.
## Child Components ## Child Components
...@@ -22,7 +24,7 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -22,7 +24,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string | Yes| Content of the QR code.| | value | string | Yes| Content of the QR code. A maximum of 256 characters are supported. If the number of characters exceeds 256, the first 256 characters are used.|
## Attributes ## Attributes
......
...@@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex ...@@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------------------- | ---------------------------------------- | ---- | -------------- | | ----------------------- | ---------------------------------------- | ---- | -------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. | | placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. It is not displayed once there is any input. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input. | | text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,<br>so as to prevent display errors when the component is updated. |
| controller<sup>8+</sup> | [TextAreaController](#textareacontroller8) | No | Text area controller.| | controller<sup>8+</sup> | [TextAreaController](#textareacontroller8) | No | Text area controller.|
...@@ -29,30 +29,31 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex ...@@ -29,30 +29,31 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name | Type | Description | | Name | Type | Description |
| ------------------------ | ---------------------------------------- | ---------------------------------------- | | ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. |
| placeholderFont | [Font](ts-types.md#font) | Placeholder text style. | | placeholderFont | [Font](ts-types.md#font) | Placeholder text style, including the font size, font width, font family, and font style. Currently, only the default font family is supported.|
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.<br>Default value: **TextAlign.Start**| | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.<br>Default value: **TextAlign.Start**|
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) => void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.| | inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) => void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
| copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | copyOption<sup>9+</sup> | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.<br>If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
> **NOTE** > **NOTE**
> >
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 16 vp, left: 8 vp } > The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: <br>{<br> top: 8 vp,<br> right: 16 vp,<br> bottom: 8 vp,<br> left: 16 vp<br> }
## Events ## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported. In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onChange(callback: (value: string) =&gt; void) | Triggered when the input in the text box changes.<br>- **value**: text entered. | | onChange(callback: (value: string) =&gt; void) | Triggered when the input in the text box changes.<br>- **value**: text entered. |
| onCopy<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be copied.| | onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>10+</sup> | Triggered when the input status changes. When the cursor is placed in the text box, it is in the editing state. Otherwise, it is in the non-editing state. If the value of **isEditing** is **true**, text input is in progress. |
| onCut<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be cut.| | onCopy<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be copied. |
| onPaste<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be pasted.| | onCut<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be cut. |
| onPaste<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>- **value**: text to be pasted. |
## TextAreaController<sup>8+</sup> ## TextAreaController<sup>8+</sup>
...@@ -102,6 +103,7 @@ struct TextAreaExample { ...@@ -102,6 +103,7 @@ struct TextAreaExample {
build() { build() {
Column() { Column() {
TextArea({ TextArea({
text: this.text,
placeholder: 'The text area can hold an unlimited amount of text. input your word...', placeholder: 'The text area can hold an unlimited amount of text. input your word...',
controller: this.controller controller: this.controller
}) })
......
...@@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te ...@@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------------------- | ---------------------------------------- | ---- | --------------- | | ----------------------- | ---------------------------------------- | ---- | --------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. | | placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input. | | text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,<br>so as to prevent display errors when the component is updated. |
| controller<sup>8+</sup> | [TextInputController](#textinputcontroller8) | No | Text input controller.| | controller<sup>8+</sup> | [TextInputController](#textinputcontroller8) | No | Text input controller.|
...@@ -34,7 +34,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -34,7 +34,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| type | [InputType](#inputtype) | Input box type.<br>Default value: **InputType.Normal** | | type | [InputType](#inputtype) | Input box type.<br>Default value: **InputType.Normal** |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.| | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.|
| placeholderFont | [Font](ts-types.md#font) | Placeholder text font.| | placeholderFont | [Font](ts-types.md#font) | Placeholder text font.|
| enterKeyType | [EnterKeyType](#enterkeytype) | Type of the Enter key. Only the default value is supported.<br>Default value: **EnterKeyType.Done**| | enterKeyType | [EnterKeyType](#enterkeytype) | Type of the Enter key. Currently, only the default value is supported.<br>Default value: **EnterKeyType.Done**|
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| maxLength | number | Maximum number of characters in the text input. | | maxLength | number | Maximum number of characters in the text input. |
| inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) =&gt; void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.| | inputFilter<sup>8+</sup> | {<br>value: [ResourceStr](ts-types.md#resourcestr),<br>error?: (value: string) =&gt; void<br>} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.<br>- **value**: regular expression to set.<br>- **error**: filtered-out content to return when regular expression matching fails.|
...@@ -43,12 +43,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -43,12 +43,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| style<sup>9+</sup> | [TextInputStyle](#textinputstyle9) | Text input style.<br>Default value: **TextInputStyle.Default**| | style<sup>9+</sup> | [TextInputStyle](#textinputstyle9) | Text input style.<br>Default value: **TextInputStyle.Default**|
| textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.<br>Default value: **TextAlign.Start** | | textAlign<sup>9+</sup> | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.<br>Default value: **TextAlign.Start** |
| selectedBackgroundColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected text.| | selectedBackgroundColor<sup>10+</sup> | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected text.|
| caretStyle<sup>10+</sup> | {<br>caretWidth: [Length](ts-types.md#length)<br>} | Caret style. | | caretStyle<sup>10+</sup> | {<br>width: [Length](ts-types.md#length)<br>} | Caret style. |
| caretPosition<sup>10+</sup> | number | Caret position.| | caretPosition<sup>10+</sup> | number | Caret position.|
> **NOTE** > **NOTE**
> >
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: <br>{<br> top: 8 vp,<br> right: 16 vp,<br> bottom: 16 vp,<br> left: 8 vp<br> } > The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 8 vp, left: 16 vp }
## EnterKeyType ## EnterKeyType
...@@ -65,8 +65,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -65,8 +65,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Description | | Name | Description |
| ------------------ | ------------- | | ------------------ | ------------- |
| Normal | Normal input mode.<br>The value can contain digits, letters, underscores (_), spaces, and special characters.| | Normal | Normal input mode.<br>The value can contain digits, letters, underscores (_), spaces, and special characters.|
| Password | Password input mode. | | Password | Password input mode. The value can contain digits, letters, underscores (_), spaces, and special characters. An eye icon is used to show or hide the password, and the password is hidden behind dots by default.|
| Email | Email address input mode.| | Email | Email address input mode. The value can contain digits, letters, underscores (_), and at signs (@). Only one at sign (@) is allowed.|
| Number | Digit input mode. | | Number | Digit input mode. |
| PhoneNumber<sup>9+</sup> | Phone number input mode.<br>The value can contain digits, plus signs (+), hyphens (-), asterisks (*), and number signs (#). The length is not limited.| | PhoneNumber<sup>9+</sup> | Phone number input mode.<br>The value can contain digits, plus signs (+), hyphens (-), asterisks (*), and number signs (#). The length is not limited.|
...@@ -81,15 +81,15 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ...@@ -81,15 +81,15 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
In addition to the [universal events](ts-universal-events-click.md), the following events are supported. In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onChange(callback: (value: string) =&gt; void) | Triggered when the input changes.<br>**value**: text content.| | onChange(callback: (value: string) =&gt; void) | Triggered when the input changes.<br>**value**: text content.<br>This event is triggered when any of the following conditions is met:<br>1. Keyboard input is received.<br>2. Paste and cut is performed.<br>3. Ctrl+V is pressed. |
| onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.<br>**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).| | onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.<br>**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype). |
| onEditChanged(callback: (isEditing: boolean) =&gt; void)<sup>(deprecated)</sup> | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.| | onEditChanged(callback: (isEditing: boolean) =&gt; void)<sup>(deprecated)</sup> | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended. |
| onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>8+</sup> | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. | | onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>8+</sup> | Triggered when the input status changes. When the cursor is placed in the text box, it is in the editing state. Otherwise, it is in the non-editing state. If the value of **isEditing** is **true**, text input is in progress. |
| onCopy(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be copied.| | onCopy(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be copied. |
| onCut(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be cut.| | onCut(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be cut. |
| onPaste(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be pasted.| | onPaste(callback:(value: string) =&gt; void)<sup>8+</sup> | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br>**value**: text to be pasted. |
## TextInputController<sup>8+</sup> ## TextInputController<sup>8+</sup>
...@@ -135,7 +135,7 @@ struct TextInputExample { ...@@ -135,7 +135,7 @@ struct TextInputExample {
build() { build() {
Column() { Column() {
TextInput({ placeholder: 'input your word...', controller: this.controller }) TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller })
.placeholderColor(Color.Grey) .placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 }) .placeholderFont({ size: 14, weight: 400 })
.caretColor(Color.Blue) .caretColor(Color.Blue)
...@@ -144,6 +144,9 @@ struct TextInputExample { ...@@ -144,6 +144,9 @@ struct TextInputExample {
.margin(20) .margin(20)
.fontSize(14) .fontSize(14)
.fontColor(Color.Black) .fontColor(Color.Black)
.inputFilter('[a-z]', (e) => {
console.log(JSON.stringify(e))
})
.onChange((value: string) => { .onChange((value: string) => {
this.text = value this.text = value
}) })
......
...@@ -14,7 +14,7 @@ Not supported ...@@ -14,7 +14,7 @@ Not supported
## APIs ## APIs
TextPicker(options?: {range: string[]|Resource, selected?: number, value?: string}) TextPicker(options?: {range: string[]|Resource|TextPickerRangeContent[], selected?: number, value?: string})
Creates a text picker based on the selection range specified by **range**. Creates a text picker based on the selection range specified by **range**.
...@@ -22,15 +22,27 @@ Creates a text picker based on the selection range specified by **range**. ...@@ -22,15 +22,27 @@ Creates a text picker based on the selection range specified by **range**.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | string[] \| [Resource](ts-types.md#resource)| Yes| Data selection range of the picker.| | range | string[] \| [Resource](ts-types.md#resource)\|[TextPickerRangeContent](#textpickerrangecontent10)[]<sup>10+</sup> | Yes| Data selection range of the picker. This parameter cannot be set to an empty array. If set to an empty array, it will not be displayed. If it is dynamically changed to an empty array, the current value remains displayed.|
| selected | number | No| Index of the default item in the range.<br>Default value: **0**| | selected | number | No| Index of the default item in the range.<br>Default value: **0**|
| value | string | No| Value of the default item in the range. The priority of this parameter is lower than that of **selected**.<br>Default value: value of the first item| | value | string | No| Value of the default item in the range. The priority of this parameter is lower than that of **selected**.<br>Default value: value of the first item<br>**NOTE**\<br>This parameter works only for a text list. It does not work for an image list or a list consisting of text and images.|
## TextPickerRangeContent<sup>10+</sup>
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------------------------- | ---- | ---------- |
| icon | string \| [Resource](ts-types.md#resource) | Yes | Image resource.|
| text | string \| [Resource](ts-types.md#resource) | No | Text information.|
## Attributes ## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| defaultPickerItemHeight | number \| string | Height of each item in the picker.| | defaultPickerItemHeight | number \| string | Height of each item in the picker.|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width for the top and bottom items.|
| textStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items.|
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of the selected item.|
## Events ## Events
...@@ -38,7 +50,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi ...@@ -38,7 +50,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| onChange(callback: (value: string, index: number) =&gt; void) | Triggered when an item in the picker is selected.<br>- **value**: value of the selected item.<br>- **index**: index of the selected item.| | onChange(callback: (value: string, index: number) =&gt; void) | Triggered when an item in the picker is selected.<br>- **value**: value of the selected item.<br>**NOTE**<br>For a text list or a list consisting of text and images, **value** indicates the text value of the selected item. For an image list, **value** is empty.<br>- **index**: index of the selected item. |
## Example ## Example
......
# TimePicker # TimePicker
The **\<TimePicker>** component allows users to select a time from the given range. The **\<TimePicker>** component allows users to select a time (with the hour and minute) from the given range.
> **NOTE** > **NOTE**
> >
...@@ -20,20 +20,25 @@ Creates a time picker, which is in 24-hour format by default. ...@@ -20,20 +20,25 @@ Creates a time picker, which is in 24-hour format by default.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type| Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---- | ---- | ------------------------ |
| selected | Date | No| Time of the selected item.<br>Default value: current system time| | selected | Date | No | Time of the selected item.<br>Default value: current system time|
## Attributes ## Attributes
| Name| Type| Description| In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| -------- | -------- | -------- |
| useMilitaryTime | boolean | Whether to display time in 24-hour format. The value cannot be modified dynamically.<br>Default value: **false**|
| Name | Type | Description |
| -------------------------------- | ---------------------------------------- | ----------------------------------- |
| useMilitaryTime | boolean | Whether to display time in 24-hour format. The value cannot be modified dynamically.<br>Default value: **false**|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width for the top and bottom items. |
| textStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items. |
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of the selected item. |
## Events ## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name | Description | | Name | Description |
| ---------------------------------------- | ----------- | | ---------------------------------------- | ----------- |
| onChange(callback: (value: TimePickerResult ) =&gt; void) | Triggered when a time is selected.| | onChange(callback: (value: TimePickerResult ) =&gt; void) | Triggered when a time is selected.|
...@@ -48,9 +53,6 @@ Creates a time picker, which is in 24-hour format by default. ...@@ -48,9 +53,6 @@ Creates a time picker, which is in 24-hour format by default.
## Example ## Example
### Time Picker
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
......
...@@ -28,7 +28,7 @@ Since API version 9, this API is supported in ArkTS widgets. ...@@ -28,7 +28,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | ------------------------------------------------------------ | | ------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| span | number \| GridColColumnOption | No | Number of occupied columns. If it is set to **0**, the element is not involved in layout calculation, that is, the element is not rendered.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.| | span | number \| GridColColumnOption | No | Number of occupied columns. If it is set to **0**, the element is not involved in layout calculation, that is, the element is not rendered.<br>Default value: **1**<br>Since API version 9, this API is supported in ArkTS widgets.|
| offset | number \| GridColColumnOption | No | Number of offset columns relative to the previous child component of the grid<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.| | gridColOffset | number \| GridColColumnOption | No | Number of offset columns relative to the previous child component of the grid<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.|
| order | number \| GridColColumnOption | No | Sequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.| | order | number \| GridColColumnOption | No | Sequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.<br>Default value: **0**<br>Since API version 9, this API is supported in ArkTS widgets.|
## GridColColumnOption ## GridColColumnOption
......
...@@ -21,6 +21,11 @@ Shows a date picker dialog box. ...@@ -21,6 +21,11 @@ Shows a date picker dialog box.
| end | Date | No| Date('2100-12-31') | End date of the picker.| | end | Date | No| Date('2100-12-31') | End date of the picker.|
| selected | Date | No| Current system date| Selected date.| | selected | Date | No| Current system date| Selected date.|
| lunar | boolean | No| false | Whether to display the lunar calendar.| | lunar | boolean | No| false | Whether to display the lunar calendar.|
| showTime<sup>10+</sup> | boolean | No| false | Whether to display the time item.|
| useMilitaryTime<sup>10+</sup> | boolean | No| false | Whether to display time in 24-hour format.|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width for the top and bottom items.|
| textStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width of all items except the top, bottom, and selected items.|
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width of the selected item.|
| onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the OK button in the dialog box is clicked.| | onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the OK button in the dialog box is clicked.|
| onCancel | () => void | No| - | Callback invoked when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No| - | Callback invoked when the Cancel button in the dialog box is clicked.|
| onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the selected item in the picker changes.| | onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the selected item in the picker changes.|
......
...@@ -17,10 +17,13 @@ Shows a text picker in the given settings. ...@@ -17,10 +17,13 @@ Shows a text picker in the given settings.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | string[] \| [Resource](ts-types.md#resource) | Yes| Data selection range of the picker.| | range | string[] \| [Resource](ts-types.md#resource)\|[TextPickerRangeContent](ts-basic-components-textpicker.md#textpickerrangecontent10)[]<sup>10+</sup> | Yes| Data selection range of the picker. This parameter cannot be set to an empty array. If set to an empty array, it will not be displayed.|
| selected | number | No| Index of the selected item.<br>Default value: **0**| | selected | number | No| Index of the selected item.<br>Default value: **0**|
| value | string | No | Text of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead.| | value | string | No | Text of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead.|
| defaultPickerItemHeight | number \| string | No| Height of the picker item.| | defaultPickerItemHeight | number \| string | No| Height of the picker item.|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width for the top and bottom items.|
| textStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of all items except the top, bottom, and selected items.|
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of the selected item.|
| onAccept | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.| | onAccept | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.|
| onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.|
| onChange | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the selected item changes.| | onChange | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the selected item changes.|
...@@ -29,7 +32,7 @@ Shows a text picker in the given settings. ...@@ -29,7 +32,7 @@ Shows a text picker in the given settings.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| value | string | Text of the selected item.| | value | string | Text of the selected item.<br>**NOTE**<br>For a text list or a list consisting of text and images, **value** indicates the text value of the selected item.<br>For an image list, **value** is empty.|
| index | number | Index of the selected item in the range.| | index | number | Index of the selected item in the range.|
## Example ## Example
......
...@@ -19,6 +19,9 @@ Shows a time picker dialog box. ...@@ -19,6 +19,9 @@ Shows a time picker dialog box.
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| selected | Date | No| Selected time.<br>Default value: current system time| | selected | Date | No| Selected time.<br>Default value: current system time|
| useMilitaryTime | boolean | No| Whether to display time in 24-hour format. The 12-hour format is used by default.<br>Default value: **false**| | useMilitaryTime | boolean | No| Whether to display time in 24-hour format. The 12-hour format is used by default.<br>Default value: **false**|
| disappearTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width for the top and bottom items.|
| textStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of all items except the top, bottom, and selected items.|
| selectedTextStyle<sup>10+</sup> | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of the selected item.|
| onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.| | onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.|
| onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.|
| onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the selected time changes.| | onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the selected time changes.|
......
# Menu Control # Menu Control
A menu – a vertical list of items – can be bound to a component and displayed by long-pressing, clicking, or right-clicking the component. A context menu – a vertical list of items – can be bound to a component and displayed by long-pressing, clicking, or right-clicking the component.
> **NOTE** > **NOTE**
> >
...@@ -10,18 +10,37 @@ A menu – a vertical list of items – can be bound to a component and displaye ...@@ -10,18 +10,37 @@ A menu – a vertical list of items – can be bound to a component and displaye
## Attributes ## Attributes
| Name | Type | Description | | Name | Type | Description |
| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| bindMenu | Array<[MenuItem](#menuitem)&gt; \| [CustomBuilder](ts-types.md#custombuilder8) | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.| | bindMenu | content: Array<[MenuItem](#menuitem)&gt; \| [CustomBuilder](ts-types.md#custombuilder8),<br>options: [MenuOptions](#menuoptions10) | Menu bound to the component, which is displayed when you click the component. A menu item can be a combination of text and icons or a custom component.<br>**content**: array of menu item text and icons or custom components.<br>**options**: parameters of the context menu. Optional.|
| bindContextMenu<sup>8+</sup> | content: [CustomBuilder](ts-types.md#custombuilder8),<br>responseType: [ResponseType](ts-appendix-enums.md#responsetype8) | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported.| | bindContextMenu<sup>8+</sup> | content: [CustomBuilder](ts-types.md#custombuilder8),<br>responseType: [ResponseType](ts-appendix-enums.md#responsetype8)<br>options: [ContextMenuOptions](#contextmenuoptions10) | Context menu bound to the component, which is displayed when the user long-presses or right-clicks the component. Only custom menu items are supported.<br>**responseType**: how the context menu triggered, which can be long-press or right-click. Mandatory. <br>**options**: parameters of the context menu. Optional.|
## MenuItem ## MenuItem
| Name | Type | Description | | Name | Type | Mandatory| Description |
| ------ | ----------------------- | ----------- | | ------------------ | -------------------------------------- | ---- | ---------------------- |
| value | string | Menu item text. | | value | string | Yes | Menu item text. |
| action | () =&gt; void | Action triggered when a menu item is clicked.| | icon<sup>10+</sup> | [ResourceStr](ts-types.md#resourcestr) | No | Menu item icon. |
| action | () =&gt; void | Yes | Action triggered when a menu item is clicked.|
## MenuOptions<sup>10+</sup>
| Name | Type | Mandatory| Description |
| ------ | -------------------------------- | ---- | ------------------------------------------------------ |
| title | string | No | Menu title. |
| offset | [Position](ts-types.md#position8) | No | Offset for showing the context menu, which should not cause the menu to extend beyond the screen.|
| placement | [Placement](ts-appendix-enums.md#placement8) | No| Preferred position of the context menu. If the set position is insufficient for holding the component, it will be automatically adjusted.<br>Default value: **Placement.Bottom**|
| onAppear | () =&gt; void | No| Callback triggered when the menu is displayed.|
| onDisappear | () =&gt; void | No| Callback triggered when the menu is hidden.|
## ContextMenuOptions<sup>10+</sup>
| Name | Type | Mandatory| Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| offset | [Position](ts-types.md#position8) | No | Offset for showing the context menu, which should not cause the menu to extend beyond the screen. |
| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the context menu. If the set position is insufficient for holding the component, it will be automatically adjusted.<br>Default value: **Placement.Bottom**|
| onAppear | () =&gt; void | No | Callback triggered when the menu is displayed. |
| onDisappear | () =&gt; void | No | Callback triggered when the menu is hidden. |
## Example ## Example
......
...@@ -13,11 +13,56 @@ Shape clipping changes the visible portion of a component through clipping or ma ...@@ -13,11 +13,56 @@ Shape clipping changes the visible portion of a component through clipping or ma
| Name | Type | Description | | Name | Type | Description |
| -----| ------------------------------------------ | ------------------------------------ | | -----| ------------------------------------------ | ------------------------------------ |
| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | Clip mode. If the value is a shape, the component is clipped based on the specified shape. If the value is of the Boolean type, it specifies whether to clip the component based on the edge outline of the parent container.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.| | clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | Clip mode. If the value is a shape, the component is clipped based on the specified shape. If the value is of the Boolean type, it specifies whether to clip the component based on the edge outline of the parent container.<br>Default value: **false**<br>Since API version 9, this API is supported in ArkTS widgets.|
| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | Mask of the specified shape to add to the component.<br>Since API version 9, this API is supported in ArkTS widgets.| | mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md)\| [ProgressMask](##progressmask10) | Mask of the specified shape to add to the component.<br>Since API version 9, this API is supported in ArkTS widgets.<br>Since API version 10, this API supports the **ProgressMask** parameter.|
## ProgressMask<sup>10+</sup>
Implements a **ProgressMask** object to set the progress, maximum value, and color of the mask.
### constructor<sup>10+</sup>
constructor(value: number, total: number, color: ResourceColor)
Constructs a **ProgressMask** object.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------ | ---- | ------------------ |
| value | number | Yes | Current value of the progress mask.|
| total | number | Yes | Maximum value of the progress mask.|
| color | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask. |
### updateProgress<sup>10+</sup>
updateProgress(value: number): void
Updates the progress value of the progress mask.
**Parameters**
| Name| Type| Mandatory| Description |
| ------ | -------- | ---- | ------------------ |
| value | number | Yes | Current value of the progress mask.|
### updateColor<sup>10+</sup>
updateColor(value: ResourceColor): void
Updates the color of the progress mask.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------ | ---- | ---------------- |
| value | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask.|
## Example ## Example
### Example 1
```ts ```ts
// xxx.ets // xxx.ets
@Entry @Entry
...@@ -54,3 +99,61 @@ struct ClipAndMaskExample { ...@@ -54,3 +99,61 @@ struct ClipAndMaskExample {
``` ```
![clipAndMask](figures/clipAndMask.PNG) ![clipAndMask](figures/clipAndMask.PNG)
### Example 2
```ts
@Entry
@Component
struct ProgressMask {
@State progressflag1: boolean = true;
@State color: Color = 0x01006CDE;
@State value: number = 10.0;
@State progress: ProgressMask = new ProgressMask(10.0, 100.0, Color.Gray);
build() {
Column({ space: 15 }) {
Text('progress mask').fontSize(12).width('75%').fontColor('#DCDCDC')
// Add a 280px x 280px progress mask to the image.
Image($r('app.media.testImg'))
.width('500px').height('280px')
.mask(this.progress)
.animation({
duration: 2000, // Animation duration.
.curve(Curve.Linear) // Animation curve.
delay: 0, // Animation delay.
iterations: 1, // Number of playback times.
playMode: PlayMode.Normal // Animation playback mode.
}) // Animation configuration for the width and height attributes of the <Button> component.
// Update the progress value of the progress mask.
Button('updateProgress')
.onClick((event: ClickEvent) => {
this.value += 10;
this.progress.updateProgress(this.value);
}).width(200).height(50).margin(20)
// Update the color of the progress mask.
Button('updateColor')
.onClick((event: ClickEvent) => {
if (this.progressflag1) {
this.progress.updateColor(0x9fff0000);
} else {
this.progress.updateColor(0x9f0000ff);
}
this.progressflag1 = !this.progressflag1
}).width(200).height(50).margin(20)
// Restores the progress mask.
Button('click reset!')
.onClick((event: ClickEvent) => {
this.value = 0;
this.progress.updateProgress(this.value);
}).width(200).height(50).margin(20)
}
.width('100%')
.margin({ top: 15 })
}
}
```
![progressMask](figures/progressMask.PNG)
...@@ -9,13 +9,16 @@ Transformation attributes allow you to rotate, translate, scale, or transform a ...@@ -9,13 +9,16 @@ Transformation attributes allow you to rotate, translate, scale, or transform a
## Attributes ## Attributes
| Name | Type | Description | | Name | Type | Description |
| --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | --------- | ---------------------------------------- | ---------------------------------------- |
| rotate | {<br>x?: number,<br>y?: number,<br>z?: number,<br>angle: number \| string,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | Rotation axis. A positive angle indicates a clockwise rotation, and a negative angle indicates a counterclockwise rotation. The default value is **0**. **centerX** and **centerY** are used to set the rotation center point.<br>Default value:<br>{<br>x: 0,<br>y: 0,<br>z: 0,<br>angle: 0,<br>centerX: '50%',<br>centerY: '50%'<br>}<br>Since API version 9, this API is supported in ArkTS widgets.| | rotate | {<br>x?: number,<br>y?: number,<br>z?: number,<br>angle: number \| string,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | How the component rotates in the coordinate system (as shown below) with the upper left corner of the component as the coordinate origin. (x, y, z) specifies a vector as the axis of rotation.<br>- **angle**: rotation angle. A positive angle indicates a clockwise rotation, and a negative angle indicates a counterclockwise rotation. The value can be of the string type, for example, **'90deg'**.<br>- **centerX** and **centerY** are used to set the center of rotation.<br>The axis and center of rotation are set based on the coordinate system, which remains where it is when the component is moved.<br>Default value:<br>{<br>x: 0,<br>y: 0,<br>z: 0,<br>centerX: '50%',<br>centerY: '50%'<br>}<br>![coordinates](figures/coordinates.png)<br>Since API version 9, this API is supported in ArkTS widgets.|
| translate | {<br>x?: number \| string,<br>y?: number \| string,<br>z? : number \| string<br>} | Translation distance along the x-, y-, and z-axis. The translation direction is determined by the positive and negative values. The value cannot be a percentage.<br>Default value:<br>{<br>x: 0,<br>y: 0,<br>z: 0<br>}<br>Since API version 9, this API is supported in ArkTS widgets.| | translate | {<br>x?: number \| string,<br>y?: number \| string,<br>z? : number \| string<br>} | How the component is translated in the coordinate system (as shown below) with the upper left corner of the component as the coordinate origin. Values of **x**, **y**, and **z** indicate the translation distance along the respective axis. A positive value indicates a forward movement towards the respective axis, and a negative value indicates a backward movement towards the respective axis. The translation distance can be a number or a string (for example, **'10px'** or **'10%'**).<br>Default value:<br>{<br>x: 0,<br>y: 0,<br>z: 0<br>}<br>![coordinates](figures/coordinates.png)<br>Since API version 9, this API is supported in ArkTS widgets.|
| scale | {<br>x?: number,<br>y?: number,<br>z?: number,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | Scale ratio along the x-, y-, and z-axis. The default value is **1**. **centerX** and **centerY** are used to set the scale center point.<br>Default value:<br>{<br>x: 1,<br>y: 1,<br>z: 1,<br>centerX:'50%',<br>centerY:'50%'<br>}<br>Since API version 9, this API is supported in ArkTS widgets.| | scale | {<br>x?: number,<br>y?: number,<br>z?: number,<br>centerX?: number \| string,<br>centerY?: number \| string<br>} | Scale ratio along the x-, y-, and z-axis. The default value is **1**. **centerX** and **centerY** are used to set the scale center point.<br>Default value:<br>{<br>x: 1,<br>y: 1,<br>z: 1,<br>centerX:'50%',<br>centerY:'50%'<br>}<br>Since API version 9, this API is supported in ArkTS widgets.|
| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | Transformation matrix of the component. | | transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | Transformation matrix of the component. |
> **NOTE**
>
> If both the **rotate** and **scale** attributes are set for a component, the values of **centerX** and **centerY** conflict. In this case, the one that is set later in time prevails.
## Example ## Example
......
...@@ -151,7 +151,7 @@ For details about the stage model, see [Stage Model Development Overview](../app ...@@ -151,7 +151,7 @@ For details about the stage model, see [Stage Model Development Overview](../app
} }
``` ```
3. If a continuous task needs to be executed in the background for another application or on another device, you can create and run an ability in the background in Call mode. For details, see [Using Ability Call (Intra-Device)](../application-models/uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction) and [Using Ability Call (Inter-Device)](../application-models/hop-multi-device-collaboration.md#using-cross-device-ability-call). 3. If a continuous task needs to be executed in the background for another application or on another device, you can create and run an ability in the background in Call mode. For details, see [Using Ability Call (Intra-Device)](../application-models/uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction-for-system-applications-only) and [Using Ability Call (Inter-Device)](../application-models/hop-multi-device-collaboration.md#using-cross-device-call).
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
......
# Input Method Framework Subsystem – Input Method Framework Service Changelog
## @ohos.InputMethodSubtype Change of name, label, and id
Changed the **name**, **label**, and **id** attributes since API version 9.
**Change Impact**
Applications must be adapted to the following changes.
| Name| Before Change| After Change|
| -------- | -------- | -------- |
| label | (1) Value: ID of the input method subtype.| (1) Value: Label of the input method subtype.|
| name | (1) Description: Name of the input method subtype. (2) Value: Label of the input method subtype.| (1) Description: Bundle name of the input method; (2) Value: Bundle name of the input method.|
| id | (1) Value: Bundle name of the input method.| (1) Value: ID of the input method subtype.|
**Adaptation Guide**
Update the code to adapt to the preceding changes.
# Input Method Framework Subsystem – Input Method Framework Service Changelog
## @ohos.InputMethodSubtype Change of name, label, and id
Changed the **name**, **label**, and **id** attributes since API version 9.
**Change Impact**
Applications must be adapted to the following changes.
| Name| Before Change| After Change|
| -------- | -------- | -------- |
| label | (1) Value: ID of the input method subtype.| (1) Value: Label of the input method subtype.|
| name | (1) Description: Name of the input method subtype. (2) Value: Label of the input method subtype.| (1) Description: Bundle name of the input method; (2) Value: Bundle name of the input method.|
| id | (1) Value: Bundle name of the input method.| (1) Value: ID of the input method subtype.|
**Adaptation Guide**
Update the code to adapt to the preceding changes.
# Using OpenHarmony JS and TS Third-Party Components
## Overview
OpenHarmony JS and TS third-party components are delivered in the form of OpenHarmony npm packages. Developed based on the traditional npm components, OpenHarmony npm shared packages come with specially designed project structures and configuration files. Such a package enables multiple modules or projects to share code related to OpenHarmony UI and resources. You can go to the [official npm website](https://docs.npmjs.com/about-npm) to learn about the basic functions and mechanisms of npm.
## Searching for OpenHarmony JS and TS Third-Party Components
1. Find the [OpenHarmony-TPC/tpc_resource](https://gitee.com/openharmony-tpc/tpc_resource) project on the Gitee website. You can find a component based on the directory index.
2. Visit the [OpenHarmony website](https://www.openharmony.cn/mainPlay/tpc) and search for required third-party components by type, category, or keyword.
## Installing and Using OpenHarmony JS and TS Third-Party Components
During application development, you can import JS and TS third-party components in the form of source code or OpenHarmony npm packages. Perform the following steps to import and use an OpenHarmony npm package. For details about how to import and use the source code, see **README.md** of the corresponding third-party components.
1. Configure the OpenHarmony npm environment. For details, see [Installing the OpenHarmony npm Package](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage-en.md).
2. Under **Terminal** project, go to the **entry** directory and run the target component's command to install the component. For details about the command, see "Download and Installation" of the third-party component on the OpenHarmony website.
The following uses the installation of the [vCard component](https://growing.openharmony.cn/mainPlay/libraryMaps/vcard_595) as an example. Find the installation command in "Download and Installation" and then run the command.
![npm-usage1.png](npm-usage1.png)
![npm-usage2.png](npm-usage2.png)
3. Check for the **node_modules** file, which is automatically generated in the project folder. In this example, the downloaded third-party library is **@ohos\VCard** in the **node_modules** directory.
![npm-usage3.png](npm-usage3.png)
4. Check for the dependency configuration, which is automatically added to the **package.json** file:
```
"dependencies": {
"@ohos/vcard": "^2.0.5"
}
```
5. Import the component to the file that plans to use the component.
![npm-usage4.png](npm-usage4.png)
6. Use the APIs as you want.
![npm-usage5.png](npm-usage5.png)
# Using Third-Party JavaScript and TypeScript Components
## Overview
OpenHarmony uses a third-party JavaScript or TypeScript component in the form of a Harmony Archive (HAR), which is a static shared package that can contain JavaScript or TypeScript code, C++ libraries, resources, and configuration files. The HAR enables modules and projects to share code related to ArkUI components, resources, and more. Unlike a Harmony Ability Package (HAP), a HAR cannot be independently installed on a device. Instead, it can be referenced only as the dependency of an application module.
## Searching for a Third-Party JavaScript or TypeScript Component
1. Access the [OpenHarmony-TPC/tpc_resource](https://gitee.com/openharmony-tpc/tpc_resource) repository, and find the desired component based on the directory index.
2. Visit the [OpenHarmony website](https://growing.openharmony.cn/mainPlay/tpc) and search for required third-party components by type, category, or keyword.
## Installing and Using a Third-Party JavaScript or TypeScript Component
You can reference a third-party HAR from the ohpm repository or the local repository module.
**Referencing an HAR Installed in the ohpm Repository**
To reference an HAR in the ohpm repository, set the repository information of the third-party HAR. The default repository address on DevEco Studio is "https://repo.harmonyos.com/ohpm/". To use a custom repository address, ensure that the ohpm installation address on DevEco Studio is configured in **Environment Variables > System Variables > PATH**, and then run the following command in the **Terminal** window of DevEco Studio:
```
ohpm config set registry=your_registry1,your_registry2
```
Note: You can configure multiple repository addresses, separated by commas (,).
Then use either of the following methods to set the third-party HAR as a dependency:
- Method 1: In the **Terminal** window, run the following command to install the third-party HAR. DevEco Studio will automatically add the HAR as a dependency to the **oh-package.json5** file of the project.
```
ohpm install @ohos/lottie
```
- Method 2: Set the third-party HAR as a dependency in the **oh-package.json5** file of the project. The following is a configuration example:
```
"dependencies": { "@ohos/lottie": "^2.0.0"}
```
After the dependency is set, run the **ohpm install** command to install the HAR, which will be stored in the **oh_modules** directory of the project.
```
ohpm install
```
**Referencing Files and Resources of the Local Repository Module**
- Method 1: In the **Terminal** window, run the following command to install the third-party HAR. DevEco Studio will automatically add the HAR as a dependency to the **oh-package5.json** file of the project.
```
ohpm install ../library
```
- Method 2: Set the third-party HAR as a dependency in the **oh-package.json5** file of the project. The following is a configuration example:
```
"dependencies": {
"@ohos/library": "file:../library"
}
```
After the dependency is set, run the **ohpm install** command to install the HAR, which will be stored in the **oh_modules** directory of the project.
```
ohpm install
```
> **NOTE**
>
> Pay attention to the following points when referencing an HAR:
>- Only the dependencies declared in **dependencies** of the **oh-package.json5** file in the module and project are used as OpenHarmony dependencies and processed during compilation and building.
>- The **compileSdkVersion** of the referenced module cannot be earlier than that of the OpenHarmony ohpm third-party package on which the referenced module depends. You can view the version in the **src** > **main** > **module.json5** file of the referenced ohpm package in the **oh_modules** directory.
### Referencing an HAR HML Page
In a JavaScript project paradigm, component functions are configured in HML files. To reference an HML page in an HAR, first import the page through the **<element>** tag in the HML file of the project. The sample code is as follows:
```
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
```
In the preceding example, **@ohos/library** indicates the name of the HAR, and the path of the HML page is the relative path in the HAR.
You can then reference the HML page based on the set element name. The sample code is as follows:
```typescript
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
<div class="container">
<comp></comp>
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
```
### Referencing an HAR ArkTS Page
ArkTS is an extension of TypeScript. Therefore, the export and import syntax of ArkTS is the same as that of TypeScript. In the OpenHarmony ohpm module, use **export** to export an ArkTS page. The sample code is as follows:
```typescript
// library/src/main/ets/components/MainPage/MainPage.ets
@Entry
@Component
export struct MainPage {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
} .height('100%')
}
}
```
Import the exported ArkTS page in other modules. The following is an example:
```typescript
// entry/MainAbility/pages/index.ets
import { MainPage } from "@ohos/library"
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Column() {
MainPage()
Row() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('10%')
}
}
```
The procedure for referencing JavaScript/TypeScript methods in the HAR is the same as that for referencing ArkTS pages. In the OpenHarmony ohpm module, export the methods through **export**. The sample code is as follows:
```typescript
// library/index.js
export function func() {
return "[ohpm] func1";
}
```
On other JavaScript/TypeScript pages, use **import** to import the exported methods. The sample code is as follows:
```typescript
// entry/src/main/js/MainAbility/pages/index/index.js
import {func} from "@ohos/library"
export default {
data: {
title: ""
},
onInit() {
this.title = func();
}
}
```
Resources in an OpenHarmony ohpm module can be referenced in another OpenHarmony ohpm module and modules that depend on the OpenHarmony ohpm module. For example, you can add string resources (defined in **string.json**, **name: hello_ohpm** in this example) and image resources (**icon_ohpm.png** in this example) to **scr/main/resources** of the OpenHarmony ohpm module, and then reference the string and image resources in the entry module, as shown below:
Currently, referencing resources in **i18n** files is not supported for the JavaScript-based web-like development paradigm.
```typescript
// entry/src/main/ets/MainAbility/pages/index.ets
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Column() {
Row() {
Text($r("app.string.hello_ohpm")) // String resource.
.fontSize(40)
.fontWeight(FontWeight.Bold)
}
.width('50%')
Image($r("app.media.icon_ohpm")) // Image resource.
}
.height('100%')
}
}
```
During compilation and building of a HAP, DevEco Studio collects resource files from the HAP module and its dependent modules. If the resource files of different modules in the same qualifiers directory have the same name, DevEco Studio overwrites the resource files based on the following priorities (in descending order):
- AppScope (supported only by the stage model of API version 9)
- Modules in the HAP file
- Dependent OpenHarmony ohpm modules
# OpenHarmony Third-Party Components # OpenHarmony Third-Party Components
OpenHarmony third-party components are verified software that work with the OpenHarmony system to facilitate your development of OpenHarmony devices or applications. Depending on the programming language they use, these components are classified as JS and TS third-party components or C and C++ third-party components. JS and TS third-party components the JavaScript or TypeScript programming languages and are usually imported as source code or OpenHarmony npm packages. They are used in application development. C and C++ third-party components use the C and C++ programming languages and are usually imported as source code or OpenHarmony hpm packages. They are used as native APIs during application development or directly compiled in the OpenHarmony OS image during device development. OpenHarmony third-party components are verified software that work with the OpenHarmony system to facilitate your development of OpenHarmony devices or applications. Depending on the programming language they use, these components are classified as third-party JavaScript and TypeScript components or third-party C and C++ components. The third-party JavaScript and TypeScript components use the JavaScript or TypeScript programming language and are usually imported as source code or OpenHarmony HAR files. They are used in application development. The third-party C and C++ components use the C and C++ programming language and are usually imported as source code or OpenHarmony hpm packages. They are used as native APIs during application development or directly compiled in the OpenHarmony OS image during device development.
Currently, OpenHarmony provides UI, animation, image, multimedia, file, network, security, tool, and other third-party components. Currently, OpenHarmony provides UI, animation, image, multimedia, file, network, security, tool, and other third-party components.
...@@ -36,14 +36,4 @@ ...@@ -36,14 +36,4 @@
## 跨设备同步访问控制机制 ## 跨设备同步访问控制机制
数据跨设备同步时,数据管理基于设备等级和[数据安全标签](access-control-by-device-and-data-level.md#数据安全标签)进行访问控制。规则为,数据只允许向数据安全标签不高于设备安全等级的设备同步数据,具体访问控制矩阵如下: 数据跨设备同步时,数据管理基于设备等级和数据安全标签进行访问控制,具体可见[跨设备同步访问控制机制](access-control-by-device-and-data-level.md#跨设备同步访问控制机制)
|设备安全级别|可同步的数据安全标签|
|---|---|
|SL1|S1|
|SL2|S1~S2|
|SL3|S1~S3|
|SL4|S1~S4|
|SL5|S1~S4|
例如,对于类似rk3568、hi3516的开发板设备,设备安全等级为SL1,若创建数据安全标签为S1的数据库,则此数据库数据可以在这些设备间同步;若创建的数据库标签为S2-S4,则不能同步。
# 通知服务公共事件定义
通知服务面向应用发布如下系统公共事件,应用如需订阅系统公共事件,请参考公共事件[接口文档](../js-apis-commonEventManager.md)
## COMMON_EVENT_SLOT_CHANGE
表示通知渠道或通知开关发生变化。
- 常量值:"usual.event.SLOT_CHANGE"
- 订阅方需要的权限:ohos.permission.NOTIFICATION_CONTROLLER
通知设置里修改应用的渠道参数、渠道开关,或者开启、关闭通知使能开关时,都会触发通知服务发布这个系统公共事件。
与这个公共事件相关的接口:setSlotByBundle、setNotificationEnableSlot、setNotificationEnable,这些为系统API,一般都是通知设置应用调用,具体参看[通知接口文档](../js-apis-notificationManager.md)
...@@ -2513,7 +2513,7 @@ off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback ...@@ -2513,7 +2513,7 @@ off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | -------------------------------------- | | -------- | ------------------------------------ | ---- | -------------------------------------- |
| type | string | 是 | 通话结束时取消监听通话详情的变化。 | | type | string | 是 | 取消监听IMS注册状态的变化。 |
| slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 | | slotId | number | 是 | 卡槽ID。<br/>- 0:卡槽1<br/>- 1:卡槽2 |
| imsType | [ImsServiceType](#imsservicetype9) | 是 | IMS服务类型。 | | imsType | [ImsServiceType](#imsservicetype9) | 是 | IMS服务类型。 |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | 否 | 回调函数。 | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | 否 | 回调函数。 |
......
...@@ -30,7 +30,7 @@ Bad file path. ...@@ -30,7 +30,7 @@ Bad file path.
**错误描述** **错误描述**
在调用uploadFile或downloadFile接口时,文件路径不合法。 在调用uploadFile或downloadFile接口时,文件路径不合法或文件路径下文件已存在
**可能原因** **可能原因**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册