提交 9f6bc3ca 编写于 作者: W wusongqing

Added English formerror and forminfo APIs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 ec434260
master E0523 OpenHarmony-3.2-Beta1 OpenHarmony-3.2-Beta2 OpenHarmony-3.2-Beta3 OpenHarmony-3.2-Beta4 OpenHarmony-3.2-Beta5 OpenHarmony-3.2-Release OpenHarmony-4.0-Beta1 OpenHarmony-4.0-Beta2 OpenHarmony_filemanager_develop_20220505 OpenHarmony_filemanager_develop_20220614 TR4270 bak_OpenHarmony-4.0-Beta1_20230529 docs-modify feature_IDL_20220811 monthly_20220614 monthly_20220816 monthly_20221018 monthly_20230815 revert-merge-17651-master revert-merge-19334-OpenHarmony-4.0-Beta1 revert-merge-19586-master revert-merge-20613-master revert-merge-21757-OpenHarmony-4.0-Beta2 revert-merge-21765-OpenHarmony-4.0-Beta2 revert-merge-23766-master revert-merge-5580-master weekly_20220406 weekly_20220412 weekly_20220419 weekly_20220426 weekly_20220503 weekly_20220510 weekly_20220524 weekly_20220531 weekly_20220607 weekly_20220614 weekly_20220621 weekly_20220628 weekly_20220705 weekly_20220712 weekly_20220719 weekly_20220726 weekly_20220802 weekly_20220809 weekly_20220816 weekly_20220823 weekly_20220830 weekly_20220906 weekly_20220913 weekly_20220920 weekly_20220927 weekly_20221004 weekly_20221011 weekly_20221018 weekly_20221025 weekly_20221101 weekly_20221108 weekly_20221115 weekly_20221122 weekly_20221129 weekly_20221206 weekly_20221213 weekly_20221220 weekly_20221227 weekly_20230103 weekly_20230110 weekly_20230117 weekly_20230124 weekly_20230131 weekly_20230207 weekly_20230214 weekly_20230221 weekly_20230228 weekly_20230307 weekly_20230314 weekly_20230321 weekly_20230328 weekly_20230404 weekly_20230411 weekly_20230418 weekly_20230425 weekly_20230502 weekly_20230509 weekly_20230516 weekly_20230523 weekly_20230530 weekly_20230606 weekly_20230613 weekly_20230619 weekly_20230626 weekly_20230627 weekly_20230704 weekly_20230712 weekly_20230725 weekly_20230801 weekly_20230808 weekly_20230815 weekly_20230822 weekly_20230829 weekly_20230905 OpenHarmony-v4.0-Beta2 OpenHarmony-v4.0-Beta1 OpenHarmony-v3.2.3-Release OpenHarmony-v3.2.2-Release OpenHarmony-v3.2.1-Release OpenHarmony-v3.2-Release OpenHarmony-v3.2-Beta5 OpenHarmony-v3.2-Beta4 OpenHarmony-v3.2-Beta3 OpenHarmony-v3.2-Beta2 OpenHarmony-v3.2-Beta1
无相关合并请求
# FormInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
Provides widget information.
## Modules to Import
```
import formInfo from '@ohos.application.formInfo';
```
## Required Permissions
None.
## FormInfo
Describes widget information.
**System capability**
SystemCapability.Ability.Form
| Name | Readable/Writable| Type | Description |
| ----------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | Read only | string | Name of the bundle to which the widget belongs. |
| moduleName | Read only | string | Name of the module to which the widget belongs. |
| abilityName | Read only | string | Name of the ability to which the widget belongs. |
| name | Read only | string | Widget name. |
| description | Read only | string | Description of the widget. |
| type | Read only | [FormType](#formtype) | Widget type. Currently, only JS widgets are supported.|
| jsComponentName | Read only | string | Component name of the JS widget. |
| colorMode | Read only | [ColorMode](#colormode) | Color mode of the widget. |
| isDefault | Read only | boolean | Whether the widget is the default one. |
| updateEnabled | Read only | boolean | Whether the widget is updatable. |
| formVisibleNotify | Read only | string | Whether to send a notification when the widget is visible. |
| relatedBundleName | Read only | string | Name of the associated bundle to which the widget belongs. |
| scheduledUpdateTime | Read only | string | Time when the widget was updated. |
| formConfigAbility | Read only | string | Configuration ability of the widget. |
| updateDuration | Read only | string | Widget update period.|
| defaultDimension | Read only | number | Default dimension of the widget. |
| supportDimensions | Read only | Array&lt;number&gt; | Dimensions supported by the widget. |
| customizeData | Read only | {[key: string]: [value: string]} | Custom data of the widget. |
## FormType
Enumerates the widget types.
**System capability**
SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| JS | 1 | JS widget. |
## ColorMode
Enumerates the color modes supported by the widget.
**System capability**
SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| MODE_AUTO | -1 | Automatic mode. |
| MODE_DARK | 0 | Dark mode. |
| MODE_LIGHT | 1 | Light mode. |
## FormStateInfo
Describes the widget state information.
**System capability**
SystemCapability.Ability.Form
| Name | Readable/Writable| Type | Description |
| ----------- | -------- | -------------------- | ------------------------------------------------------------ |
| formState | Read only | [FormState](#formstate) | Widget state. |
| want | Read only | Want | Want text. |
## FormState
Enumerates the widget states.
**System capability**
SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| UNKNOWN | -1 | Unknown state. |
| DEFAULT | 0 | Default state. |
| READY | 1 | Ready state. |
## FormParam
Enumerates the widget parameters.
**System capability**
SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| IDENTITY_KEY | "ohos.extra.param.key.form_identity" | ID of a widget. |
| DIMENSION_KEY | "ohos.extra.param.key.form_dimension" | Widget dimension. |
| NAME_KEY | "ohos.extra.param.key.form_name" | Widget name. |
| MODULE_NAME_KEY | "ohos.extra.param.key.module_name" | Name of the module to which the widget belongs. |
| WIDTH_KEY | "ohos.extra.param.key.form_width" | Widget width. |
| HEIGHT_KEY | "ohos.extra.param.key.form_height" | Widget height. |
| TEMPORARY_KEY | "ohos.extra.param.key.form_temporary" | Temporary widget. |
# FormError
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
Provides widget-related error codes.
## Modules to Import
```
import formError from '@ohos.application.formError';
```
## Required Permissions
None.
## enum FormError
Enumerates the available error codes.
**System capability**
SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| ERR_COMMON | 1 | Default error code. |
| ERR_PERMISSION_DENY | 2 | No permission to perform the operation. |
| ERR_GET_INFO_FAILED | 4 | Failed to query widget information. |
| ERR_GET_BUNDLE_FAILED | 5 | Failed to query the bundle information. |
| ERR_GET_LAYOUT_FAILED | 6 | Failed to query the layout information. |
| ERR_ADD_INVALID_PARAM | 7 | Invalid parameter. |
| ERR_CFG_NOT_MATCH_ID | 8 | The widget ID does not match. |
| ERR_NOT_EXIST_ID | 9 | The widget ID does not exist. |
| ERR_BIND_PROVIDER_FAILED | 10 | Failed to bind to the widget provider. |
| ERR_MAX_SYSTEM_FORMS | 11 | The number of system widgets exceeds the upper limit. |
| ERR_MAX_INSTANCES_PER_FORM | 12 | The number of instances per widget exceeds the upper limit. |
| ERR_OPERATION_FORM_NOT_SELF | 13 | The application is not allowed to operate widgets applied by other applications. |
| ERR_PROVIDER_DEL_FAIL | 14 | The widget provider failed to delete the widget. |
| ERR_MAX_FORMS_PER_CLIENT | 15 | The number of widgets applied for by the widget host exceeds the upper limit. |
| ERR_MAX_SYSTEM_TEMP_FORMS | 16 | The number of temporary widgets exceeds the upper limit. |
| ERR_FORM_NO_SUCH_MODULE | 17 | The module does not exist. |
| ERR_FORM_NO_SUCH_ABILITY | 18 | The ability component does not exist. |
| ERR_FORM_NO_SUCH_DIMENSION | 19 | The widget dimension does not exist. |
| ERR_FORM_FA_NOT_INSTALLED | 20 | The FA where the widget is located is not installed. |
| ERR_SYSTEM_RESPONSES_FAILED | 30 | The system service failed to respond. |
| ERR_FORM_DUPLICATE_ADDED | 31 | The widget has been added. |
| ERR_IN_RECOVERY | 36 | Failed to overwrite the widget data. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部