• 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 * @since 7
19 * @systemapi
20 */
21declare enum FormDimension {
22  /**
23   * 1 x 2 cards
24   * @since 7
25   * @systemapi
26   */
27  Dimension_1_2,
28
29  /**
30   * 2 x 2 cards
31   * @since 7
32   * @systemapi
33   */
34  Dimension_2_2,
35
36  /**
37   * 2 x 4 cards
38   * @since 7
39   * @systemapi
40   */
41  Dimension_2_4,
42
43  /**
44   * 4 x 4 cards
45   * @since 7
46   * @systemapi
47   */
48  Dimension_4_4,
49
50  /**
51   * 2 x 1 cards
52   * @since 9
53   * @systemapi
54   */
55  Dimension_2_1,
56}
57
58/**
59 * Defines the FormComponent.
60 * @since 7
61 * @systemapi
62 */
63interface FormComponentInterface {
64  /**
65   * Set a new value.
66   * @param { number } id - id indicates the formId
67   * @param { string } name - name indicates the form name
68   * @param { string } bundle - bundle indicates the form provider's bundle name
69   * @param { string } ability - ability indicates the form provider's ability name
70   * @param { string } module - module indicates the form provider's ability name
71   * @param { FormDimension } [options] - dimension indicates the form size
72   * @param { boolean } [options] - temporary indicates that if the form is temporary
73   * @since 7
74   * @systemapi
75   */
76  /**
77   * Set a new value.
78   * @param { number } id - id indicates the formId
79   * @param { string } name - name indicates the form name
80   * @param { string } bundle - bundle indicates the form provider's bundle name
81   * @param { string } ability - ability indicates the form provider's ability name
82   * @param { string } module - module indicates the form provider's ability name
83   * @param { FormDimension } [options] - dimension indicates the form size
84   * @param { boolean } [options] - temporary indicates that if the form is temporary
85   * @param { Want } [options] - want indicates the want that host send to form provider
86   * @since 9
87   * @systemapi
88   */
89  (value: {
90    id: number;
91    name: string;
92    bundle: string;
93    ability: string;
94    module: string;
95    dimension?: FormDimension;
96    temporary?: boolean;
97    want?: import('../api/@ohos.app.ability.Want').default;
98  }): FormComponentAttribute;
99}
100
101/**
102 * @since 7
103 * @systemapi
104 */
105declare class FormComponentAttribute extends CommonMethod<FormComponentAttribute> {
106  /**
107   * Sets the display area size of the card.
108   * @since 7
109   * @systemapi
110   */
111  size(value: { width: number; height: number }): FormComponentAttribute;
112
113  /**
114   * Card module name.
115   * @since 7
116   * @systemapi
117   */
118  moduleName(value: string): FormComponentAttribute;
119
120  /**
121   * Set the card size.
122   * @since 7
123   * @systemapi
124   */
125  dimension(value: FormDimension): FormComponentAttribute;
126
127  /**
128   * Indicates whether to allow card update.
129   * @since 7
130   * @systemapi
131   */
132  allowUpdate(value: boolean): FormComponentAttribute;
133
134  /**
135   * Whether the card is visible.
136   * @since 7
137   * @systemapi
138   */
139  visibility(value: Visibility): FormComponentAttribute;
140
141  /**
142   * This function is triggered after card information is obtained.
143   * For details about the form information, see the definition of the original capability subsystem.
144   * @since 7
145   * @systemapi
146   */
147  onAcquired(callback: (info: { id: number }) => void): FormComponentAttribute;
148
149  /**
150   * Card loading error.
151   * @since 7
152   * @systemapi
153   */
154  onError(callback: (info: { errcode: number; msg: string }) => void): FormComponentAttribute;
155
156  /**
157   * Card to be redirected.
158   * @since 7
159   * @systemapi
160   */
161  onRouter(callback: (info: any) => void): FormComponentAttribute;
162
163  /**
164   * Uninstall Card.
165   * @since 7
166   * @systemapi
167   */
168  onUninstall(callback: (info: { id: number }) => void): FormComponentAttribute;
169}
170
171/**
172 * Defines FormComponent Component.
173 * @since 7
174 * @systemapi
175 */
176declare const FormComponent: FormComponentInterface;
177
178/**
179 * Defines FormComponent Component instance.
180 * @since 7
181 * @systemapi
182 */
183declare const FormComponentInstance: FormComponentAttribute;
184