• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import Want from './@ohos.application.Want';
17
18/**
19 * interface of formInfo.
20 *
21 * @name formInfo
22 * @since 8
23 * @syscap SystemCapability.Ability.Form
24 */
25declare namespace formInfo {
26    /**
27     * Provides information about a form.
28     *
29     * @name FormInfo
30     * @since 8
31     * @syscap SystemCapability.Ability.Form
32     */
33    interface FormInfo {
34        /**
35         * Obtains the bundle name of the application to which this form belongs.
36         *
37         * @since 8
38         * @syscap SystemCapability.Ability.Form
39         */
40        bundleName: string;
41
42        /**
43         * Obtains the name of the application module to which this form belongs.
44         *
45         * @since 8
46         * @syscap SystemCapability.Ability.Form
47         */
48        moduleName: string;
49
50        /**
51         * Obtains the class name of the ability to which this form belongs.
52         *
53         * @since 8
54         * @syscap SystemCapability.Ability.Form
55         */
56        abilityName: string;
57
58        /**
59         * Obtains the name of this form.
60         *
61         * @since 8
62         * @syscap SystemCapability.Ability.Form
63         */
64        name: string;
65
66        /**
67         * Obtains the name of this form.
68         *
69         * @since 8
70         * @syscap SystemCapability.Ability.Form
71         */
72        description: string;
73
74        /**
75         * Obtains the type of this form. Currently, JS forms are supported.
76         *
77         * @since 8
78         * @syscap SystemCapability.Ability.Form
79         */
80        type: FormType;
81
82        /**
83         * Obtains the JS component name of this JS form.
84         *
85         * @since 8
86         * @syscap SystemCapability.Ability.Form
87         */
88        jsComponentName: string;
89
90        /**
91         * Obtains the color mode of this form.
92         *
93         * @since 8
94         * @syscap SystemCapability.Ability.Form
95         */
96        colorMode: ColorMode;
97
98        /**
99         * Checks whether this form is a default form.
100         *
101         * @since 8
102         * @syscap SystemCapability.Ability.Form
103         */
104        isDefault: boolean;
105
106        /**
107         * Obtains the updateEnabled.
108         *
109         * @since 8
110         * @syscap SystemCapability.Ability.Form
111         */
112        updateEnabled: boolean;
113
114        /**
115         * Obtains whether notify visible of this form.
116         *
117         * @since 8
118         * @syscap SystemCapability.Ability.Form
119         */
120        formVisibleNotify: boolean;
121
122        /**
123         * Obtains the bundle relatedBundleName of the application to which this form belongs.
124         *
125         * @since 8
126         * @syscap SystemCapability.Ability.Form
127         */
128        relatedBundleName: string;
129
130        /**
131         * Obtains the scheduledUpdateTime.
132         *
133         * @since 8
134         * @syscap SystemCapability.Ability.Form
135         */
136        scheduledUpdateTime: string;
137
138        /**
139         * Obtains the form config ability about this form.
140         *
141         * @since 8
142         * @syscap SystemCapability.Ability.Form
143         */
144        formConfigAbility: string;
145
146        /**
147         * Obtains the updateDuration.
148         *
149         * @since 8
150         * @syscap SystemCapability.Ability.Form
151         */
152        updateDuration: number;
153
154        /**
155         * Obtains the default grid style of this form.
156         *
157         * @since 8
158         * @syscap SystemCapability.Ability.Form
159         */
160        defaultDimension: number;
161
162        /**
163         * Obtains the grid styles supported by this form.
164         *
165         * @since 8
166         * @syscap SystemCapability.Ability.Form
167         */
168        supportDimensions: Array<number>;
169
170        /**
171         * Obtains the custom data defined in this form.
172         *
173         * @since 8
174         * @syscap SystemCapability.Ability.Form
175         */
176        customizeData: {[key: string]: [value: string]};
177    }
178
179    /**
180     * Type of form.
181     *
182     * @name FormType
183     * @since 8
184     * @syscap SystemCapability.Ability.Form
185    */
186    enum FormType {
187        /**
188         * JS form.
189         *
190         * @since 8
191         * @syscap SystemCapability.Ability.Form
192         */
193        JS = 1
194    }
195
196    /**
197     * Color mode.
198     *
199     * @name ColorMode
200     * @since 8
201     * @syscap SystemCapability.Ability.Form
202    */
203    enum ColorMode {
204        /**
205         * Automatic mode.
206         *
207         * @since 8
208         * @syscap SystemCapability.Ability.Form
209         */
210        MODE_AUTO = -1,
211
212        /**
213         * Dark mode.
214         *
215         * @since 8
216         * @syscap SystemCapability.Ability.Form
217         */
218        MODE_DARK = 0,
219
220        /**
221         * Light mode.
222         *
223         * @since 8
224         * @syscap SystemCapability.Ability.Form
225         */
226        MODE_LIGHT = 1
227    }
228
229    /**
230     * Provides state information about a form.
231     *
232     * @name FormStateInfo
233     * @since 8
234     * @syscap SystemCapability.Ability.Form
235     */
236    interface FormStateInfo {
237        /**
238         * Obtains the form state.
239         *
240         * @since 8
241         * @syscap SystemCapability.Ability.Form
242         */
243        formState: FormState;
244
245        /**
246         * Obtains the want form .
247         *
248         * @since 8
249         * @syscap SystemCapability.Ability.Form
250         */
251        want: Want;
252    }
253
254    /**
255     * Provides state about a form.
256     *
257     * @name FormState
258     * @since 8
259     * @syscap SystemCapability.Ability.Form
260     */
261    enum FormState {
262        /**
263         * Indicates that the form status is unknown due to an internal error.
264         *
265         * @since 8
266         * @syscap SystemCapability.Ability.Form
267         */
268        UNKNOWN = -1,
269
270        /**
271         * Indicates that the form is in the default state.
272         *
273         * @since 8
274         * @syscap SystemCapability.Ability.Form
275         */
276        DEFAULT = 0,
277
278        /**
279         * Indicates that the form is ready.
280         *
281         * @since 8
282         * @syscap SystemCapability.Ability.Form
283         */
284        READY = 1,
285    }
286
287    /**
288     * Parameter of form.
289     *
290     * @name FormParam
291     * @since 8
292     * @syscap SystemCapability.Ability.Form
293     */
294    enum FormParam {
295        /**
296         * Indicates the key specifying the ID of the form to be obtained, which is represented as
297         * want: {
298         *   "parameters": {
299         *       IDENTITY_KEY: 1L
300         *    }
301         * }.
302         *
303         * @since 8
304         * @syscap SystemCapability.Ability.Form
305         * @systemapi hide for inner use.
306         */
307        IDENTITY_KEY = "ohos.extra.param.key.form_identity",
308
309        /**
310         * Indicates the key specifying the grid style of the form to be obtained, which is represented as
311         * want: {
312         *   "parameters": {
313         *       DIMENSION_KEY: 1
314         *    }
315         * }.
316         *
317         * @since 8
318         * @syscap SystemCapability.Ability.Form
319         */
320        DIMENSION_KEY = "ohos.extra.param.key.form_dimension",
321
322        /**
323         * Indicates the key specifying the name of the form to be obtained, which is represented as
324         * want: {
325         *   "parameters": {
326         *       NAME_KEY: "formName"
327         *    }
328         * }.
329         *
330         * @since 8
331         * @syscap SystemCapability.Ability.Form
332         */
333        NAME_KEY = "ohos.extra.param.key.form_name",
334
335        /**
336         * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is
337         * represented as
338         * want: {
339         *   "parameters": {
340         *       MODULE_NAME_KEY: "formEntry"
341         *    }
342         * }
343         * This constant is mandatory.
344         *
345         * @since 8
346         * @syscap SystemCapability.Ability.Form
347         */
348        MODULE_NAME_KEY = "ohos.extra.param.key.module_name",
349
350        /**
351         * Indicates the key specifying the width of the form to be obtained, which is represented as
352         * want: {
353         *   "parameters": {
354         *       WIDTH_KEY: 800
355         *    }
356         * }
357         *
358         * @since 8
359         * @syscap SystemCapability.Ability.Form
360         */
361        WIDTH_KEY = "ohos.extra.param.key.form_width",
362
363        /**
364         * Indicates the key specifying the height of the form to be obtained, which is represented as
365         * want: {
366         *   "parameters": {
367         *       HEIGHT_KEY: 400
368         *    }
369         * }
370         *
371         * @since 8
372         * @syscap SystemCapability.Ability.Form
373         */
374        HEIGHT_KEY = "ohos.extra.param.key.form_height",
375
376        /**
377         * Indicates the key specifying whether a form is temporary, which is represented as
378         * want: {
379         *   "parameters": {
380         *       TEMPORARY_KEY: true
381         *    }
382         * }
383         *
384         * @since 8
385         * @syscap SystemCapability.Ability.Form
386         */
387        TEMPORARY_KEY = "ohos.extra.param.key.form_temporary"
388    }
389}
390export default formInfo;