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

2022-12-22 浏览 (818)

@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 '@ohos.app.form.formInfo';

FormInfo

Describes widget information.

System capability: SystemCapability.Ability.Form

NameTypeReadableWritableDescription
bundleNamestringYesNoName of the bundle to which the widget belongs.
moduleNamestringYesNoName of the module to which the widget belongs.
abilityNamestringYesNoName of the ability to which the widget belongs.
namestringYesNoWidget name.
descriptionstringYesNoDescription of the widget.
descriptionId10+numberYesNoID of the widget description.
typeFormTypeYesNoType of the widget. Currently, JS and ArkTS widgets are supported.
jsComponentNamestringYesNoName of the component used in the JS widget.
colorModeColorModeYesNoColor mode of the widget.
isDefaultbooleanYesNoWhether the widget is the default one.
updateEnabledbooleanYesNoWhether the widget is updatable.
formVisibleNotifybooleanYesNoWhether to send a notification when the widget is visible.
scheduledUpdateTimestringYesNoTime when the widget was updated.
formConfigAbilitystringYesNoConfiguration ability of the widget, that is, the ability corresponding to the option in the selection box displayed when the widget is long pressed.
updateDurationnumberYesNoUpdate period of the widget.
defaultDimensionnumberYesNoDefault dimension of the widget.
supportDimensionsArray<number>YesNoDimensions supported by the widget. For details, see FormDimension.
customizeData{[key: string]: [value: string]}YesNoCustom data of the widget.
isDynamic10+booleanYesNoWhether the widget is a dynamic widget.
ArkTS widgets are classified into dynamic and static widgets. JS widgets are all dynamic widgets.
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.

FormType

Enumerates the widget types.

System capability: SystemCapability.Ability.Form

NameValueDescription
JS1JS widget.
eTS2ArkTS widget.

ColorMode

Enumerates the color modes supported by the widget.

System capability: SystemCapability.Ability.Form

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

FormStateInfo

Describes the widget state information.

System capability: SystemCapability.Ability.Form

NameTypeReadableWritableDescription
formStateFormStateYesNoWidget state.
wantWantYesNoWant text.

FormState

Enumerates the widget states.

System capability: SystemCapability.Ability.Form

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

FormParam

Enumerates the widget parameters.

System capability: SystemCapability.Ability.Form

NameValueDescription
IDENTITY_KEY'ohos.extra.param.key.form_identity'Widget ID.
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.
ABILITY_NAME_KEY'ohos.extra.param.key.ability_name'Ability name.
DEVICE_ID_KEY'ohos.extra.param.key.device_id'Device ID.
System API: This is a system API and cannot be called by third-party applications.
BUNDLE_NAME_KEY'ohos.extra.param.key.bundle_name'Key that specifies the target bundle name.
LAUNCH_REASON_KEY10+'ohos.extra.param.key.form_launch_reason'Reason for creating the widget.
PARAM_FORM_CUSTOMIZE_KEY10+'ohos.extra.param.key.form_customize'Custom data.

FormDimension

Enumerates the widget dimensions.

System capability: SystemCapability.Ability.Form

NameValueDescription
Dimension_1_211 x 2.
Dimension_2_222 x 2.
Dimension_2_432 x 4.
Dimension_4_444 x 4.
Dimension_2_152 x 1.

FormInfoFilter

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

System capability: SystemCapability.Ability.Form

NameTypeMandatoryDescription
moduleNamestringNoOptional. Only 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.

VisibilityType

Enumerates the visibility types of the widget.

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.

RunningFormInfo10+

Defines the information about the widget host.

System capability: SystemCapability.Ability.Form

System API: This is a system API and cannot be called by third-party applications.

NameTypeReadableWritableDescription
formIdstringYesNoWidget ID.
bundleName10+stringYesNoName of the bundle to which the widget provider belongs.
hostBundleNamestringYesNoName of the bundle to which the widget host belongs.
visibilityTypeVisibilityTypeYesNoVisibility types of the widget.
moduleName10+stringYesNoName of the module to which the widget belongs.
abilityName10+stringYesNoName of the ability to which the widget belongs.
formName10+stringYesNoWidget name.
dimensionnumberYesNoWidget specifications.

formProviderFilter10+

Defines the information about the widget provider.

System capability: SystemCapability.Ability.Form

System API: This is a system API and cannot be called by third-party applications.

NameTypeReadableWritableDescription
bundleNamestringYesNoName of the bundle to which the widget provider belongs.
Model restriction: This API can be used only in the stage model.
formNamestringYesNoWidget name.
Model restriction: This API can be used only in the stage model.
moduleNamestringYesNoName of the module to which the widget belongs.
Model restriction: This API can be used only in the stage model.
abilityNamestringYesNoName of the ability to which the widget belongs.
Model restriction: This API can be used only in the stage model.

LaunchReason10+

Enumerates the reasons for creating a widget.

System capability: SystemCapability.Ability.Form

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

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

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