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