openharmony 鸿蒙 js-apis-app-form-formInfo

2025-06-12 浏览 (1)

@ohos.app.form.formInfo (formInfo)

The formInfo module provides types and enums related to the widget information and state.

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.

Modules to Import

import { formInfo } from '@kit.FormKit';

formInfo.FormInfo

Defines the widget information.

System capability: SystemCapability.Ability.Form

NameTypeReadableWritableDescription
bundleNamestringYesNoName of the bundle to which the widget belongs.
Atomic service API: This API can be used in atomic services since API version 11.
moduleNamestringYesNoName of the module to which the widget belongs.
Atomic service API: This API can be used in atomic services since API version 11.
abilityNamestringYesNoName of the ability to which the widget belongs.
Atomic service API: This API can be used in atomic services since API version 11.
namestringYesNoName of an application or atomic service.
Atomic service API: This API can be used in atomic services since API version 11.
displayName11+stringYesNoWidget name.
Atomic service API: This API can be used in atomic services since API version 11.
displayNameId11+numberYesNoID of the widget name displayed during widget preview.
Atomic service API: This API can be used in atomic services since API version 11.
descriptionstringYesNoDescription of the widget.
Atomic service API: This API can be used in atomic services since API version 11.
descriptionId10+numberYesNoID of the widget description.
Atomic service API: This API can be used in atomic services since API version 11.
typeFormTypeYesNoType of the widget. Currently, JS and ArkTS widgets are supported.
Atomic service API: This API can be used in atomic services since API version 11.
jsComponentNamestringYesNoName of the component used in the JS widget.
Atomic service API: This API can be used in atomic services since API version 11.
colorModeColorModeYesNoColor mode of the widget.
Atomic service API: This API can be used in atomic services since API version 11.
isDefaultbooleanYesNoWhether the widget is the default one.
Atomic service API: This API can be used in atomic services since API version 11.
updateEnabledbooleanYesNoWhether the widget is updatable.
Atomic service API: This API can be used in atomic services since API version 11.
formVisibleNotifybooleanYesNoWhether to send a notification when the widget is visible.
Atomic service API: This API can be used in atomic services since API version 11.
scheduledUpdateTimestringYesNoTime when the widget was updated.
Atomic service API: This API can be used in atomic services since API version 11.
formConfigAbilitystringYesNoConfiguration ability of the widget, that is, the ability corresponding to the option in the selection box displayed when the widget is long pressed.
Atomic service API: This API can be used in atomic services since API version 11.
updateDurationnumberYesNoUpdate period of the widget.
Atomic service API: This API can be used in atomic services since API version 11.
defaultDimensionnumberYesNoWidget specifications.
Atomic service API: This API can be used in atomic services since API version 11.
supportDimensionsArray<number>YesNoDimensions supported by the widget. For details, see FormDimension.
Atomic service API: This API can be used in atomic services since API version 11.
customizeDataRecord<string, string>YesNoCustom data of the widget.
Atomic service API: This API can be used in atomic services since API version 11.
isDynamic10+booleanYesNoWhether the widget is a dynamic widget.
ArkTS widgets are classified into dynamic and static widgets. JS widgets are all dynamic widgets.
Atomic service API: This API can be used in atomic services since API version 11.
transparencyEnabled11+booleanYesNoWhether the widget supports the setting of the background transparency.
For ArkTS widgets, the support for the background transparency setting depends on user configurations. For JS widgets, the background transparency setting is not supported.
Atomic service API: This API can be used in atomic services since API version 11.
supportedShapes12+Array<number>YesNoShapes supported by the widget. For details about the available shapes, see FormShape12+.
Atomic service API: This API can be used in atomic services since API version 12.
previewImages18+Array<number>YesNoResource IDs of the preview images of the widget.
Atomic service API: This API can be used in atomic services since API version 18.
enableBlurBackground18+booleanYesNoWhether the widget uses a blur background.
Atomic service API: This API can be used in atomic services since API version 18.
renderingMode18+RenderingModeYesNoWidget rendering mode.
Atomic service API: This API can be used in atomic services since API version 18.

formInfo.FormType

Enumerates the widget types.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameValueDescription
JS1JS widget.
eTS2ArkTS widget.

formInfo.ColorMode

Enumerates the color modes supported by the widget.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameValueDescription
MODE_AUTO-1Auto mode.
MODE_DARK0Dark mode.
MODE_LIGHT1Light mode.

formInfo.FormStateInfo

Describes the widget state information.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameTypeReadableWritableDescription
formStateFormStateYesNoWidget state.
wantWantYesNoWant text.

formInfo.FormState

Enumerates the widget states.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameValueDescription
UNKNOWN-1Unknown state.
DEFAULT0Default state.
READY1Ready state.

formInfo.FormParam

Enumerates the widget parameters.

System capability: SystemCapability.Ability.Form

NameValueDescription
IDENTITY_KEY'ohos.extra.param.key.form_identity'Widget ID.
Atomic service API: This API can be used in atomic services since API version 11.
DIMENSION_KEY'ohos.extra.param.key.form_dimension'Widget dimension.
Atomic service API: This API can be used in atomic services since API version 11.
NAME_KEY'ohos.extra.param.key.form_name'Widget name.
Atomic service API: This API can be used in atomic services since API version 11.
MODULE_NAME_KEY'ohos.extra.param.key.module_name'Name of the module to which the widget belongs.
Atomic service API: This API can be used in atomic services since API version 11.
WIDTH_KEY'ohos.extra.param.key.form_width'Widget width.
Atomic service API: This API can be used in atomic services since API version 11.
HEIGHT_KEY'ohos.extra.param.key.form_height'Widget height.
Atomic service API: This API can be used in atomic services since API version 11.
TEMPORARY_KEY'ohos.extra.param.key.form_temporary'Temporary widget.
Atomic service API: This API can be used in atomic services since API version 11.
ABILITY_NAME_KEY'ohos.extra.param.key.ability_name'Ability name.
Atomic service API: This API can be used in atomic services since API version 11.
BUNDLE_NAME_KEY'ohos.extra.param.key.bundle_name'Bundle name.
Atomic service API: This API can be used in atomic services since API version 11.
LAUNCH_REASON_KEY10+'ohos.extra.param.key.form_launch_reason'Reason for creating the widget.
Atomic service API: This API can be used in atomic services since API version 11.
PARAM_FORM_CUSTOMIZE_KEY10+'ohos.extra.param.key.form_customize'Custom data.
Atomic service API: This API can be used in atomic services since API version 11.
FORM_RENDERING_MODE_KEY11+'ohos.extra.param.key.form_rendering_mode'Widget rendering mode.
Atomic service API: This API can be used in atomic services since API version 12.
HOST_BG_INVERSE_COLOR_KEY12+'ohos.extra.param.key.host_bg_inverse_color'Inverse background color of the widget client.
Atomic service API: This API can be used in atomic services since API version 12.
FORM_LOCATION_KEY12+'ohos.extra.param.key.form_location'Widget location.
OTHER -1 (other locations)
DESKTOP 0 (desktop)
FORM_CENTER 1 (widget center of the desktop)
FORM_MANAGER 2 (widget manager of the desktop)
NEGATIVE_SCREEN 3 (minus-one screen)
FORM_CENTER_NEGATIVE_SCREEN 4 (widget center of the minus-one screen)
FORM_MANAGER_NEGATIVE_SCREEN 5 (widget manager of the minus-one screen)
SCREEN_LOCK 6 (lock screen)
AI_SUGGESTION 7 (Celia suggestions area)
FORM_PERMISSION_NAME_KEY12+'ohos.extra.param.key.permission_name'Name of the permission.
Atomic service API: This API can be used in atomic services since API version 12.
FORM_PERMISSION_GRANTED_KEY12+'ohos.extra.param.key.permission_granted'Whether the permission is granted.
Atomic service API: This API can be used in atomic services since API version 12.

formInfo.FormDimension

Enumerates the widget dimensions.

System capability: SystemCapability.Ability.Form

NameValueDescription
Dimension_1_211 x 2.
Atomic service API: This API can be used in atomic services since API version 11.
Dimension_2_222 x 2.
Atomic service API: This API can be used in atomic services since API version 11.
Dimension_2_432 x 4.
Atomic service API: This API can be used in atomic services since API version 11.
Dimension_4_444 x 4.
Atomic service API: This API can be used in atomic services since API version 11.
Dimension_2_152 x 1.
Atomic service API: This API can be used in atomic services since API version 11.
DIMENSION_1_111+61 x 1.
Atomic service API: This API can be used in atomic services since API version 11.
DIMENSION_6_412+76 x 4.
Atomic service API: This API can be used in atomic services since API version 12.
DIMENSION_2_318+82 x 3.
Atomic service API: This API can be used for wearable devices in atomic services since API version 18.
DIMENSION_3_318+93 x 3.
Atomic service API: This API can be used for wearable devices in atomic services since API version 18.

formInfo.FormShape12+

Enumerates the widget shapes.

System capability: SystemCapability.Ability.Form

NameValueDescription
RECT1Rectangle.
Atomic service API: This API can be used in atomic services since API version 12.
CIRCLE2Circle.
Atomic service API: This API can be used in atomic services since API version 12.

formInfo.FormInfoFilter

Defines the widget information filter. Only the widget information that meets the filter is returned.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameTypeMandatoryDescription
moduleNamestringNoOnly the information about the widget whose moduleName is the same as the provided value is returned.
If this parameter is not set, moduleName is not used for filtering.

formInfo.VisibilityType

Enumerates the visibility types of the widget.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameValueDescription
UNKNOWN10+0The visibility type of the widget is unknown.
FORM_VISIBLE1The widget is visible.
FORM_INVISIBLE2The widget is invisible.

formInfo.LaunchReason10+

Enumerates the reasons for creating a widget.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameValueDescription
FORM_DEFAULT1The widget is created by default.
FORM_SHARE2The widget is created for sharing.

formInfo.RenderingMode18+

Enumerates the rendering modes supported by the widget.

Atomic service API: This API can be used in atomic services since API version 18.

System capability: SystemCapability.Ability.Form

NameValueDescription
AUTO_COLOR0Auto mode.
FULL_COLOR1Full-color mode.
SINGLE_COLOR2Single-color mode.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Form Kit

harmony 鸿蒙Form Error Codes

harmony 鸿蒙@ohos.app.form.formAgent (FormAgent) (System API)

harmony 鸿蒙@ohos.app.form.formBindingData (formBindingData)

harmony 鸿蒙@ohos.app.form.FormEditExtensionAbility (FormEditExtensionAbility)

harmony 鸿蒙@ohos.app.form.FormExtensionAbility (FormExtensionAbility) (System API)

harmony 鸿蒙@ohos.app.form.FormExtensionAbility (FormExtensionAbility)

harmony 鸿蒙@ohos.app.form.formHost (formHost) (System API)

harmony 鸿蒙@ohos.app.form.formInfo (formInfo) (System API)

harmony 鸿蒙@ohos.app.form.formObserver (formObserver) (System API)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/Zcj43F