• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# FormInfo
2
3> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
4> 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.
5
6Provides widget information.
7
8## Modules to Import
9
10```
11import formInfo from '@ohos.application.formInfo';
12```
13
14## Required Permissions
15
16None.
17
18## FormInfo
19
20Describes widget information.
21
22**System capability**
23
24SystemCapability.Ability.Form
25
26| Name       | Readable/Writable| Type                | Description                                                        |
27| ----------- | -------- | -------------------- | ------------------------------------------------------------ |
28| bundleName  | Read only    | string               | Name of the bundle to which the widget belongs.                          |
29| moduleName  | Read only    | string               | Name of the module to which the widget belongs.                      |
30| abilityName | Read only    | string               | Name of the ability to which the widget belongs.                      |
31| name        | Read only    | string               | Widget name.                                |
32| description | Read only    | string               | Description of the widget.  |
33| type        | Read only    | [FormType](#formtype)             | Widget type. Currently, only JS widgets are supported.|
34| jsComponentName      | Read only    | string               | Component name of the JS widget.              |
35| colorMode  | Read only    | [ColorMode](#colormode) | Color mode of the widget.                                      |
36| isDefault    | Read only    | boolean      | Whether the widget is the default one.                             |
37| updateEnabled  | Read only    | boolean               | Whether the widget is updatable.                   |
38| formVisibleNotify  | Read only    | string               | Whether to send a notification when the widget is visible.           |
39| relatedBundleName | Read only    | string               | Name of the associated bundle to which the widget belongs.                  |
40| scheduledUpdateTime        | Read only    | string               | Time when the widget was updated.    |
41| formConfigAbility | Read only    | string               | Configuration ability of the widget.  |
42| updateDuration        | Read only    | string             | Widget update period.|
43| defaultDimension  | Read only    | number | Default dimension of the widget.                                      |
44| supportDimensions    | Read only    | Array<number>      | Dimensions supported by the widget.                |
45| customizeData    | Read only    | {[key: string]: [value: string]}      | Custom data of the widget.         |
46
47## FormType
48
49Enumerates the widget types.
50
51**System capability**
52
53SystemCapability.Ability.Form
54
55| Name       | Value  | Description        |
56| ----------- | ---- | ------------ |
57| JS      | 1    | JS widget.  |
58
59## ColorMode
60
61Enumerates the color modes supported by the widget.
62
63**System capability**
64
65SystemCapability.Ability.Form
66
67| Name       | Value  | Description        |
68| ----------- | ---- | ------------ |
69| MODE_AUTO   | -1    | Automatic mode.  |
70| MODE_DARK    | 0   | Dark mode.  |
71| MODE_LIGHT     | 1   | Light mode.  |
72
73## FormStateInfo
74
75Describes the widget state information.
76
77**System capability**
78
79SystemCapability.Ability.Form
80
81| Name       | Readable/Writable| Type                | Description                                                        |
82| ----------- | -------- | -------------------- | ------------------------------------------------------------ |
83| formState  | Read only    | [FormState](#formstate)               | Widget state.                          |
84| want  | Read only    | Want               | Want text.   |
85
86##  FormState
87
88Enumerates the widget states.
89
90**System capability**
91
92SystemCapability.Ability.Form
93
94| Name       | Value  | Description        |
95| ----------- | ---- | ------------ |
96| UNKNOWN    | -1    | Unknown state.  |
97| DEFAULT     | 0   | Default state.  |
98| READY      | 1   | Ready state.  |
99
100##  FormParam
101
102Enumerates the widget parameters.
103
104**System capability**
105
106SystemCapability.Ability.Form
107
108| Name       | Value  | Description        |
109| ----------- | ---- | ------------ |
110| IDENTITY_KEY     | "ohos.extra.param.key.form_identity"    | ID of a widget.  |
111| DIMENSION_KEY      | "ohos.extra.param.key.form_dimension"  | Widget dimension.  |
112| NAME_KEY       | "ohos.extra.param.key.form_name"   | Widget name.  |
113| MODULE_NAME_KEY        | "ohos.extra.param.key.module_name"   | Name of the module to which the widget belongs.  |
114| WIDTH_KEY        | "ohos.extra.param.key.form_width"   | Widget width.  |
115| HEIGHT_KEY         | "ohos.extra.param.key.form_height"   | Widget height.  |
116| TEMPORARY_KEY          | "ohos.extra.param.key.form_temporary"   | Temporary widget.  |
117