From 9f6bc3ca452ad2cf40e51a705a799576e9fbdcf8 Mon Sep 17 00:00:00 2001 From: wusongqing Date: Tue, 29 Mar 2022 20:16:49 +0800 Subject: [PATCH] Added English formerror and forminfo APIs Signed-off-by: wusongqing --- .../reference/apis/js-apis-formInfo.md | 116 ++++++++++++++++++ .../reference/apis/js-apis-formerror.md | 49 ++++++++ 2 files changed, 165 insertions(+) create mode 100644 en/application-dev/reference/apis/js-apis-formInfo.md create mode 100644 en/application-dev/reference/apis/js-apis-formerror.md diff --git a/en/application-dev/reference/apis/js-apis-formInfo.md b/en/application-dev/reference/apis/js-apis-formInfo.md new file mode 100644 index 0000000000..1091770862 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-formInfo.md @@ -0,0 +1,116 @@ +# 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<number> | 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. | diff --git a/en/application-dev/reference/apis/js-apis-formerror.md b/en/application-dev/reference/apis/js-apis-formerror.md new file mode 100644 index 0000000000..37eecd8530 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-formerror.md @@ -0,0 +1,49 @@ +# 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. | -- GitLab