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