• 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 * Defines the FormDimension enum.
18 *
19 * @enum { number }
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @systemapi
22 * @since 7
23 */
24declare enum FormDimension {
25  /**
26   * 1 x 2 cards
27   *
28   * @syscap SystemCapability.ArkUI.ArkUI.Full
29   * @systemapi
30   * @since 7
31   */
32  Dimension_1_2,
33
34  /**
35   * 2 x 2 cards
36   *
37   * @syscap SystemCapability.ArkUI.ArkUI.Full
38   * @systemapi
39   * @since 7
40   */
41  Dimension_2_2,
42
43  /**
44   * 2 x 4 cards
45   *
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @systemapi
48   * @since 7
49   */
50  Dimension_2_4,
51
52  /**
53   * 4 x 4 cards
54   *
55   * @syscap SystemCapability.ArkUI.ArkUI.Full
56   * @systemapi
57   * @since 7
58   */
59  Dimension_4_4,
60
61  /**
62   * 2 x 1 cards
63   *
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @systemapi
66   * @since 9
67   */
68  Dimension_2_1,
69}
70
71/**
72 * Defines the FormComponent.
73 *
74 * @interface FormComponentInterface
75 * @syscap SystemCapability.ArkUI.ArkUI.Full
76 * @systemapi
77 * @since 7
78 */
79interface FormComponentInterface {
80  /**
81   * Set a new value.
82   *
83   * @param { {
84   * id: number;
85   * name: string;
86   * bundle: string;
87   * ability: string;
88   * module: string;
89   * dimension?: FormDimension;
90   * temporary?: boolean;
91   * want?: import('../api/@ohos.app.ability.Want').default;
92   * } } value
93   * @returns { FormComponentAttribute }
94   * @syscap SystemCapability.ArkUI.ArkUI.Full
95   * @systemapi
96   * @since 7
97   */
98  /**
99   * Set a new value.
100   *
101   * @param { object } value
102   * @returns { FormComponentAttribute }
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @systemapi
105   * @since 9
106   */
107  (value: {
108    id: number;
109    name: string;
110    bundle: string;
111    ability: string;
112    module: string;
113    dimension?: FormDimension;
114    temporary?: boolean;
115    want?: import('../api/@ohos.app.ability.Want').default;
116  }): FormComponentAttribute;
117}
118
119/**
120 * @extends CommonMethod
121 * @syscap SystemCapability.ArkUI.ArkUI.Full
122 * @systemapi
123 * @since 7
124 */
125declare class FormComponentAttribute extends CommonMethod<FormComponentAttribute> {
126  /**
127   * Sets the display area size of the card.
128   *
129   * @param { object } value
130   * @returns { FormComponentAttribute }
131   * @syscap SystemCapability.ArkUI.ArkUI.Full
132   * @systemapi
133   * @since 7
134   */
135  size(value: { width: number; height: number }): FormComponentAttribute;
136
137  /**
138   * Card module name.
139   *
140   * @param { string } value
141   * @returns { FormComponentAttribute }
142   * @syscap SystemCapability.ArkUI.ArkUI.Full
143   * @systemapi
144   * @since 7
145   */
146  moduleName(value: string): FormComponentAttribute;
147
148  /**
149   * Set the card size.
150   *
151   * @param { FormDimension } value
152   * @returns { FormComponentAttribute }
153   * @syscap SystemCapability.ArkUI.ArkUI.Full
154   * @systemapi
155   * @since 7
156   */
157  dimension(value: FormDimension): FormComponentAttribute;
158
159  /**
160   * Indicates whether to allow card update.
161   *
162   * @param { boolean } value
163   * @returns { FormComponentAttribute }
164   * @syscap SystemCapability.ArkUI.ArkUI.Full
165   * @systemapi
166   * @since 7
167   */
168  allowUpdate(value: boolean): FormComponentAttribute;
169
170  /**
171   * Whether the card is visible.
172   *
173   * @param { Visibility } value
174   * @returns { FormComponentAttribute }
175   * @syscap SystemCapability.ArkUI.ArkUI.Full
176   * @systemapi
177   * @since 7
178   */
179  visibility(value: Visibility): FormComponentAttribute;
180
181  /**
182   * This function is triggered after card information is obtained.
183   * For details about the form information, see the definition of the original capability subsystem.
184   *
185   * @param { function } callback
186   * @returns { FormComponentAttribute }
187   * @syscap SystemCapability.ArkUI.ArkUI.Full
188   * @systemapi
189   * @since 7
190   */
191  onAcquired(callback: (info: { id: number }) => void): FormComponentAttribute;
192
193  /**
194   * Card loading error.
195   *
196   * @param { function } callback
197   * @returns { FormComponentAttribute }
198   * @syscap SystemCapability.ArkUI.ArkUI.Full
199   * @systemapi
200   * @since 7
201   */
202  onError(callback: (info: { errcode: number; msg: string }) => void): FormComponentAttribute;
203
204  /**
205   * Card to be redirected.
206   *
207   * @param { function } callback
208   * @returns { FormComponentAttribute }
209   * @syscap SystemCapability.ArkUI.ArkUI.Full
210   * @systemapi
211   * @since 7
212   */
213  onRouter(callback: (info: any) => void): FormComponentAttribute;
214
215  /**
216   * Uninstall Card.
217   *
218   * @param { function } callback
219   * @returns { FormComponentAttribute }
220   * @syscap SystemCapability.ArkUI.ArkUI.Full
221   * @systemapi
222   * @since 7
223   */
224  onUninstall(callback: (info: { id: number }) => void): FormComponentAttribute;
225
226  /**
227   * Card to be loaded.
228   *
229   * @param { function } callback
230   * @returns { FormComponentAttribute }
231   * @syscap SystemCapability.ArkUI.ArkUI.Full
232   * @systemapi
233   * @since 10
234   */
235  onLoad(callback: () => void): FormComponentAttribute;
236}
237
238/**
239 * Defines FormComponent Component.
240 *
241 * @syscap SystemCapability.ArkUI.ArkUI.Full
242 * @systemapi
243 * @since 7
244 */
245declare const FormComponent: FormComponentInterface;
246
247/**
248 * Defines FormComponent Component instance.
249 *
250 * @syscap SystemCapability.ArkUI.ArkUI.Full
251 * @systemapi
252 * @since 7
253 */
254declare const FormComponentInstance: FormComponentAttribute;
255