• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21/**
22 * Defines the FormDimension enum.
23 *
24 * @enum { number }
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @systemapi
27 * @since 7
28 */
29declare enum FormDimension {
30  /**
31   * 1 x 2 cards
32   *
33   * @syscap SystemCapability.ArkUI.ArkUI.Full
34   * @systemapi
35   * @since 7
36   */
37  Dimension_1_2,
38
39  /**
40   * 2 x 2 cards
41   *
42   * @syscap SystemCapability.ArkUI.ArkUI.Full
43   * @systemapi
44   * @since 7
45   */
46  Dimension_2_2,
47
48  /**
49   * 2 x 4 cards
50   *
51   * @syscap SystemCapability.ArkUI.ArkUI.Full
52   * @systemapi
53   * @since 7
54   */
55  Dimension_2_4,
56
57  /**
58   * 4 x 4 cards
59   *
60   * @syscap SystemCapability.ArkUI.ArkUI.Full
61   * @systemapi
62   * @since 7
63   */
64  Dimension_4_4,
65
66  /**
67   * 2 x 1 cards
68   *
69   * @syscap SystemCapability.ArkUI.ArkUI.Full
70   * @systemapi
71   * @since 9
72   */
73  Dimension_2_1,
74
75  /**
76   * 1 x 1 cards
77   * The default value is 6
78   *
79   * @syscap SystemCapability.ArkUI.ArkUI.Full
80   * @systemapi
81   * @since 11
82   */
83  DIMENSION_1_1 = 6,
84
85  /**
86   * 6 x 4 cards
87   *
88   * @syscap SystemCapability.ArkUI.ArkUI.Full
89   * @systemapi
90   * @since 12
91   */
92  DIMENSION_6_4,
93
94  /**
95   * 2 x 3 cards used for wearable devices
96   *
97   * @syscap SystemCapability.ArkUI.ArkUI.Full
98   * @systemapi
99   * @since 18
100   */
101  DIMENSION_2_3 = 8,
102
103  /**
104   * 3 x 3 cards used for wearable devices
105   *
106   * @syscap SystemCapability.ArkUI.ArkUI.Full
107   * @systemapi
108   * @since 18
109   */
110  DIMENSION_3_3 = 9,
111}
112
113/**
114 * Defines the FormRenderingMode enum.
115 *
116 * @enum { number }
117 * @syscap SystemCapability.ArkUI.ArkUI.Full
118 * @systemapi
119 * @since 11
120 */
121declare enum FormRenderingMode {
122
123  /**
124   *  Full color mode, this is default value
125   *
126   * @syscap SystemCapability.ArkUI.ArkUI.Full
127   * @systemapi
128   * @since 11
129   */
130  FULL_COLOR,
131
132  /**
133   *  single color mode
134   *
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @systemapi
137   * @since 11
138   */
139  SINGLE_COLOR,
140}
141
142/**
143 * Defines the FormShape enum.
144 *
145 * @enum { number }
146 * @syscap SystemCapability.ArkUI.ArkUI.Full
147 * @systemapi
148 * @since 12
149 */
150declare enum FormShape {
151    /**
152     * The rect shape.
153     *
154     * @syscap SystemCapability.ArkUI.ArkUI.Full
155     * @systemapi
156     * @since 12
157     */
158    RECT = 1,
159
160    /**
161     * The circle shape.
162     *
163     * @syscap SystemCapability.ArkUI.ArkUI.Full
164     * @systemapi
165     * @since 12
166     */
167    CIRCLE,
168}
169
170/**
171 * Defines the FormInfo.
172 *
173 * @interface FormInfo
174 * @syscap SystemCapability.ArkUI.ArkUI.Full
175 * @systemapi
176 * @since 12
177 */
178declare interface FormInfo {
179  /**
180   * The id the form.
181   *
182   * @type { number | string }
183   * @syscap SystemCapability.ArkUI.ArkUI.Full
184   * @systemapi
185   * @since 12
186   */
187  id: number | string;
188
189  /**
190   * The name of the form.
191   *
192   * @type { string }
193   * @syscap SystemCapability.ArkUI.ArkUI.Full
194   * @systemapi
195   * @since 12
196   */
197  name: string;
198
199  /**
200   * The bundle of the form.
201   *
202   * @type { string }
203   * @syscap SystemCapability.ArkUI.ArkUI.Full
204   * @systemapi
205   * @since 12
206   */
207  bundle: string;
208
209  /**
210   * The ability of the form.
211   *
212   * @type { string }
213   * @syscap SystemCapability.ArkUI.ArkUI.Full
214   * @systemapi
215   * @since 12
216   */
217  ability: string;
218
219  /**
220   * The module of the form.
221   *
222   * @type { string }
223   * @syscap SystemCapability.ArkUI.ArkUI.Full
224   * @systemapi
225   * @since 12
226   */
227  module: string;
228
229  /**
230   * The dimension of the form.
231   *
232   * @type { ?FormDimension }
233   * @syscap SystemCapability.ArkUI.ArkUI.Full
234   * @systemapi
235   * @since 12
236   */
237  dimension?: FormDimension;
238
239  /**
240   * Whether the form is temporary.
241   *
242   * @type { ?boolean }
243   * @syscap SystemCapability.ArkUI.ArkUI.Full
244   * @systemapi
245   * @since 12
246   */
247  temporary?: boolean;
248
249  /**
250   * The want of the form.
251   *
252   * @type { ?import('../api/@ohos.app.ability.Want').default }
253   * @syscap SystemCapability.ArkUI.ArkUI.Full
254   * @systemapi
255   * @since 12
256   */
257  want?: import('../api/@ohos.app.ability.Want').default;
258
259  /**
260   * The renderingMode of the form.
261   *
262   * @type { ?FormRenderingMode }
263   * @syscap SystemCapability.ArkUI.ArkUI.Full
264   * @systemapi
265   * @since 12
266   */
267  renderingMode?: FormRenderingMode;
268
269  /**
270   * The shape of the form.
271   *
272   * @type { ?FormShape }
273   * @syscap SystemCapability.ArkUI.ArkUI.Full
274   * @systemapi
275   * @since 12
276   */
277  shape?: FormShape;
278}
279
280/**
281 * Defines the FormComponent.
282 *
283 * @interface FormComponentInterface
284 * @syscap SystemCapability.ArkUI.ArkUI.Full
285 * @systemapi
286 * @since 7
287 */
288interface FormComponentInterface {
289  /**
290   * Set a new value.
291   *
292   * @param { {
293   * id: number;
294   * name: string;
295   * bundle: string;
296   * ability: string;
297   * module: string;
298   * dimension?: FormDimension;
299   * temporary?: boolean;
300   * want?: import('../api/@ohos.app.ability.Want').default;
301   * } } value
302   * @returns { FormComponentAttribute }
303   * @syscap SystemCapability.ArkUI.ArkUI.Full
304   * @systemapi
305   * @since 7
306   */
307  /**
308   * Set a new value.
309   *
310   * @param { object } value
311   * @returns { FormComponentAttribute }
312   * @syscap SystemCapability.ArkUI.ArkUI.Full
313   * @systemapi
314   * @since 9
315   */
316  /**
317   * Set a new value.
318   *
319   * @param { object } value
320   * @returns { FormComponentAttribute }
321   * @syscap SystemCapability.ArkUI.ArkUI.Full
322   * @systemapi
323   * @since 11
324   */
325  /**
326   * Set a new value of form info.
327   *
328   * @param { FormInfo } value
329   * @returns { FormComponentAttribute }
330   * @syscap SystemCapability.ArkUI.ArkUI.Full
331   * @systemapi
332   * @since 12
333   */
334  (value: FormInfo): FormComponentAttribute;
335}
336
337/**
338 * Defines the FormCallbackInfo.
339 *
340 * @interface FormCallbackInfo
341 * @syscap SystemCapability.ArkUI.ArkUI.Full
342 * @systemapi
343 * @since 12
344 */
345interface FormCallbackInfo {
346  /**
347   * The id of the form.
348   *
349   * @type { number }
350   * @syscap SystemCapability.ArkUI.ArkUI.Full
351   * @systemapi
352   * @since 12
353   */
354  id: number;
355
356  /**
357   * The string id of the form.
358   *
359   * @type { string }
360   * @syscap SystemCapability.ArkUI.ArkUI.Full
361   * @systemapi
362   * @since 12
363   */
364  idString: string;
365}
366
367/**
368 * Defines the size of Form.
369 *
370 * @typedef FormSize
371 * @syscap SystemCapability.ArkUI.ArkUI.Full
372 * @systemapi
373 * @since 18
374 */
375interface FormSize {
376  /**
377   * The width of the form.
378   * Anonymous Object Rectification
379   *
380   * @type { number }
381   * @syscap SystemCapability.ArkUI.ArkUI.Full
382   * @systemapi
383   * @since 18
384   */
385  width: number;
386
387  /**
388   * The height of the form.
389   * Anonymous Object Rectification
390   *
391   * @type { number }
392   * @syscap SystemCapability.ArkUI.ArkUI.Full
393   * @systemapi
394   * @since 18
395   */
396  height: number;
397}
398
399/**
400 * Defines error information for card loading.
401 *
402 * @typedef ErrorInformation
403 * @syscap SystemCapability.ArkUI.ArkUI.Full
404 * @systemapi
405 * @since 18
406 */
407interface ErrorInformation {
408  /**
409   * Error code.
410   * Anonymous Object Rectification
411   *
412   * @type { number }
413   * @syscap SystemCapability.ArkUI.ArkUI.Full
414   * @systemapi
415   * @since 18
416   */
417  errcode: number;
418
419  /**
420   * Error information.
421   * Anonymous Object Rectification
422   *
423   * @type { string }
424   * @syscap SystemCapability.ArkUI.ArkUI.Full
425   * @systemapi
426   * @since 18
427   */
428  msg: string;
429}
430
431/**
432 * @extends CommonMethod<FormComponentAttribute>
433 * @syscap SystemCapability.ArkUI.ArkUI.Full
434 * @systemapi
435 * @since 7
436 */
437declare class FormComponentAttribute extends CommonMethod<FormComponentAttribute> {
438  /**
439   * Sets the display area size of the card.
440   *
441   * @param { object } value
442   * @returns { FormComponentAttribute }
443   * @syscap SystemCapability.ArkUI.ArkUI.Full
444   * @systemapi
445   * @since 7
446   */
447  /**
448   * Sets the display area size of the card.
449   * Anonymous Object Rectification
450   *
451   * @param { FormSize } formSize - The size of Form.
452   * @returns { FormComponentAttribute }
453   * @syscap SystemCapability.ArkUI.ArkUI.Full
454   * @systemapi
455   * @since 18
456   */
457  size(formSize: FormSize): FormComponentAttribute;
458
459  /**
460   * Card module name.
461   *
462   * @param { string } value
463   * @returns { FormComponentAttribute }
464   * @syscap SystemCapability.ArkUI.ArkUI.Full
465   * @systemapi
466   * @since 7
467   */
468  moduleName(value: string): FormComponentAttribute;
469
470  /**
471   * Set the card size.
472   *
473   * @param { FormDimension } value
474   * @returns { FormComponentAttribute }
475   * @syscap SystemCapability.ArkUI.ArkUI.Full
476   * @systemapi
477   * @since 7
478   */
479  dimension(value: FormDimension): FormComponentAttribute;
480
481  /**
482   * Indicates whether to allow card update.
483   *
484   * @param { boolean } value
485   * @returns { FormComponentAttribute }
486   * @syscap SystemCapability.ArkUI.ArkUI.Full
487   * @systemapi
488   * @since 7
489   */
490  allowUpdate(value: boolean): FormComponentAttribute;
491
492  /**
493   * Whether the card is visible.
494   *
495   * @param { Visibility } value
496   * @returns { FormComponentAttribute }
497   * @syscap SystemCapability.ArkUI.ArkUI.Full
498   * @systemapi
499   * @since 7
500   */
501  visibility(value: Visibility): FormComponentAttribute;
502
503  /**
504   * This function is triggered after card information is obtained.
505   * For details about the form information, see the definition of the original capability subsystem.
506   *
507   * @param { function } callback
508   * @returns { FormComponentAttribute }
509   * @syscap SystemCapability.ArkUI.ArkUI.Full
510   * @systemapi
511   * @since 7
512   */
513  /**
514   * This function is triggered after card information is obtained.
515   * For details about the form information, see the definition of the original capability subsystem.
516   *
517   * @param { Callback<FormCallbackInfo> } callback
518   * @returns { FormComponentAttribute }
519   * @syscap SystemCapability.ArkUI.ArkUI.Full
520   * @systemapi
521   * @since 12
522   */
523  onAcquired(callback: Callback<FormCallbackInfo>): FormComponentAttribute;
524
525  /**
526   * Card loading error.
527   *
528   * @param { function } callback
529   * @returns { FormComponentAttribute }
530   * @syscap SystemCapability.ArkUI.ArkUI.Full
531   * @systemapi
532   * @since 7
533   */
534  /**
535   * Card loading error.
536   * Anonymous Object Rectification
537   *
538   * @param { Callback<ErrorInformation> } callback
539   * @returns { FormComponentAttribute }
540   * @syscap SystemCapability.ArkUI.ArkUI.Full
541   * @systemapi
542   * @since 18
543   */
544  onError(callback: Callback<ErrorInformation>): FormComponentAttribute;
545
546  /**
547   * Card to be redirected.
548   *
549   * @param { function } callback
550   * @returns { FormComponentAttribute }
551   * @syscap SystemCapability.ArkUI.ArkUI.Full
552   * @systemapi
553   * @since 7
554   */
555  /**
556   * Card to be redirected.
557   * Anonymous Object Rectification
558   *
559   * @param { Callback<object> } callback
560   * @returns { FormComponentAttribute }
561   * @syscap SystemCapability.ArkUI.ArkUI.Full
562   * @systemapi
563   * @since 18
564   */
565  onRouter(callback: Callback<object>): FormComponentAttribute;
566
567  /**
568   * Uninstall Card.
569   *
570   * @param { function } callback
571   * @returns { FormComponentAttribute }
572   * @syscap SystemCapability.ArkUI.ArkUI.Full
573   * @systemapi
574   * @since 7
575   */
576  /**
577   * Uninstall Card.
578   *
579   * @param { Callback<FormCallbackInfo> } callback
580   * @returns { FormComponentAttribute }
581   * @syscap SystemCapability.ArkUI.ArkUI.Full
582   * @systemapi
583   * @since 12
584   */
585  onUninstall(callback: Callback<FormCallbackInfo>): FormComponentAttribute;
586
587  /**
588   * Card to be loaded.
589   *
590   * @param { function } callback
591   * @returns { FormComponentAttribute }
592   * @syscap SystemCapability.ArkUI.ArkUI.Full
593   * @systemapi
594   * @since 10
595   */
596  /**
597   * Card to be loaded.
598   * Anonymous Object Rectification
599   *
600   * @param { VoidCallback } callback
601   * @returns { FormComponentAttribute }
602   * @syscap SystemCapability.ArkUI.ArkUI.Full
603   * @systemapi
604   * @since 18
605   */
606  onLoad(callback: VoidCallback): FormComponentAttribute;
607}
608
609/**
610 * Defines FormComponent Component.
611 *
612 * @syscap SystemCapability.ArkUI.ArkUI.Full
613 * @systemapi
614 * @since 7
615 */
616declare const FormComponent: FormComponentInterface;
617
618/**
619 * Defines FormComponent Component instance.
620 *
621 * @syscap SystemCapability.ArkUI.ArkUI.Full
622 * @systemapi
623 * @since 7
624 */
625declare const FormComponentInstance: FormComponentAttribute;
626