• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.app.form.formInfo (formInfo)
2
3The **formInfo** module provides types and enums related to the widget information and state.
4
5> **NOTE**
6>
7> 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.
8
9## Modules to Import
10
11```ts
12import formInfo from '@ohos.app.form.formInfo';
13```
14
15## FormInfo
16
17Describes widget information.
18
19**System capability**: SystemCapability.Ability.Form
20
21| Name       | Type                | Readable   | Writable   | Description                                                        |
22| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
23| bundleName  | string               | Yes   | No    | Name of the bundle to which the widget belongs.                  |
24| moduleName  | string               | Yes   | No    | Name of the module to which the widget belongs.                     |
25| abilityName | string               | Yes   | No    | Name of the ability to which the widget belongs.                      |
26| name        | string               | Yes   | No    | Widget name.                                |
27| description | string               | Yes   | No    | Description of the widget.  |
28| type        | [FormType](#formtype)             | Yes   | No    | Type of the widget. Currently, only JS widgets are supported.|
29| jsComponentName      | string               | Yes   | No    | Name of the component used in the JS widget.              |
30| colorMode  | [ColorMode](#colormode) | Yes   | No    | Color mode of the widget.                                      |
31| isDefault    | boolean      | Yes   | No    | Whether the widget is the default one.                             |
32| updateEnabled  | boolean               | Yes   | No    | Whether the widget is updatable.                   |
33| formVisibleNotify  | boolean        | Yes   | No    | Whether to send a notification when the widget is visible.           |
34| scheduledUpdateTime        | string               | Yes   | No    | Time when the widget was updated.    |
35| formConfigAbility | string               | Yes   | No    | Configuration ability of the widget, that is, the ability corresponding to the option in the selection box displayed when the widget is long pressed.  |
36| updateDuration        | number       | Yes   | No    | Update period of the widget.|
37| defaultDimension  | number | Yes   | No    | Default dimension of the widget.                                      |
38| supportDimensions    | Array<number>      | Yes   | No    | Dimensions supported by the widget. For details, see [FormDimension](#formdimension).  |
39| customizeData    | {[key: string]: [value: string]}      | Yes   | No    | Custom data of the widget.        |
40
41## FormType
42
43Enumerates the widget types.
44
45**System capability**: SystemCapability.Ability.Form
46
47| Name       | Value  | Description        |
48| ----------- | ---- | ------------ |
49| JS      | 1    | JS widget.  |
50| eTS     | 2    | ArkTS widget.|
51
52## ColorMode
53
54Enumerates the color modes supported by the widget.
55
56**System capability**: SystemCapability.Ability.Form
57
58| Name       | Value  | Description        |
59| ----------- | ---- | ------------ |
60| MODE_AUTO   | -1    | Auto mode.  |
61| MODE_DARK    | 0   | Dark mode.  |
62| MODE_LIGHT     | 1   | Light mode.  |
63
64## FormStateInfo
65
66Describes the widget state information.
67
68**System capability**: SystemCapability.Ability.Form
69
70| Name       | Type                | Readable   | Writable   | Description                                                        |
71| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
72| formState  | [FormState](#formstate)               | Yes   | No    | Widget state.                         |
73| want  | Want               | Yes   | No    | Want text.   |
74
75##  FormState
76
77Enumerates the widget states.
78
79**System capability**: SystemCapability.Ability.Form
80
81| Name       | Value  | Description        |
82| ----------- | ---- | ------------ |
83| UNKNOWN    | -1    | Unknown state.  |
84| DEFAULT     | 0   | Default state.  |
85| READY      | 1   | Ready state.  |
86
87##  FormParam
88
89Enumerates the widget parameters.
90
91**System capability**: SystemCapability.Ability.Form
92
93| Name       | Value  | Description        |
94| ----------- | ---- | ------------ |
95| IDENTITY_KEY     | "ohos.extra.param.key.form_identity"    | Widget ID.  |
96| DIMENSION_KEY      | "ohos.extra.param.key.form_dimension"  | Widget dimension.  |
97| NAME_KEY       | "ohos.extra.param.key.form_name"   | Widget name.  |
98| MODULE_NAME_KEY        | "ohos.extra.param.key.module_name"   | Name of the module to which the widget belongs.  |
99| WIDTH_KEY        | "ohos.extra.param.key.form_width"   | Widget width.  |
100| HEIGHT_KEY         | "ohos.extra.param.key.form_height"   | Widget height.  |
101| TEMPORARY_KEY          | "ohos.extra.param.key.form_temporary"   | Temporary widget.  |
102| ABILITY_NAME_KEY   | "ohos.extra.param.key.ability_name"   | Ability name. |
103| DEVICE_ID_KEY    | "ohos.extra.param.key.device_id"   | Device ID.  |
104| BUNDLE_NAME_KEY    | "ohos.extra.param.key.bundle_name"   | Key that specifies the target bundle name.|
105
106##  FormDimension
107
108Enumerates the widget dimensions.
109
110**System capability**: SystemCapability.Ability.Form
111
112| Name       | Value  | Description        |
113| ----------- | ---- | ------------ |
114| Dimension_1_2      | 1   | 1 x 2.  |
115| Dimension_2_2      | 2   | 2 x 2.  |
116| Dimension_2_4      | 3   | 2 x 4.  |
117| Dimension_4_4      | 4   | 4 x 4.  |
118| Dimension_2_1      | 5   | 2 x 1.  |
119
120
121## FormInfoFilter
122
123Defines the widget information filter. Only the widget information that meets the filter is returned.
124
125**System capability**: SystemCapability.Ability.Form
126
127| Name       | Type  | Description        |
128| ----------- | ---- | ------------ |
129| moduleName    | string    | Optional. Only the information about the widget whose **moduleName** is the same as the provided value is returned.<br>If this parameter is not set, **moduleName** is not used for filtering.  |
130
131## VisibilityType
132
133Enumerates the visibility types of the widget.
134
135**System capability**: SystemCapability.Ability.Form
136
137| Name       |  Value  | Description        |
138| ----------- | ---- | ------------ |
139| FORM_VISIBLE | 1   | The widget is visible.|
140| FORM_INVISIBLE   | 2   | The widget is invisible.|
141