• 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/**
52 * Defines the FormComponent.
53 * @since 7
54 * @systemapi
55 */
56interface FormComponentInterface {
57  /**
58   * Set a new value.
59   * @since 7
60   * @systemapi
61   */
62  (value: {
63    id: number;
64    name: string;
65    bundle: string;
66    ability: string;
67    module: string;
68    dimension?: FormDimension;
69    temporary?: boolean;
70  }): FormComponentAttribute;
71}
72
73/**
74 * @since 7
75 * @systemapi
76 */
77declare class FormComponentAttribute extends CommonMethod<FormComponentAttribute> {
78  /**
79   * Sets the display area size of the card.
80   * @since 7
81   * @systemapi
82   */
83  size(value: { width: number; height: number }): FormComponentAttribute;
84
85  /**
86   * Card module name.
87   * @since 7
88   * @systemapi
89   */
90  moduleName(value: string): FormComponentAttribute;
91
92  /**
93   * Set the card size.
94   * @since 7
95   * @systemapi
96   */
97  dimension(value: FormDimension): FormComponentAttribute;
98
99  /**
100   * Indicates whether to allow card update.
101   * @since 7
102   * @systemapi
103   */
104  allowUpdate(value: boolean): FormComponentAttribute;
105
106  /**
107   * Whether the card is visible.
108   * @since 7
109   * @systemapi
110   */
111  visibility(value: Visibility): FormComponentAttribute;
112
113  /**
114   * This function is triggered after card information is obtained.
115   * For details about the form information, see the definition of the original capability subsystem.
116   * @since 7
117   * @systemapi
118   */
119  onAcquired(callback: (info: { id: number }) => void): FormComponentAttribute;
120
121  /**
122   * Card loading error.
123   * @since 7
124   * @systemapi
125   */
126  onError(callback: (info: { errcode: number; msg: string }) => void): FormComponentAttribute;
127
128  /**
129   * Card to be redirected.
130   * @since 7
131   * @systemapi
132   */
133  onRouter(callback: (info: any) => void): FormComponentAttribute;
134
135  /**
136   * Uninstall Card.
137   * @since 7
138   * @systemapi
139   */
140  onUninstall(callback: (info: { id: number }) => void): FormComponentAttribute;
141}
142
143/**
144*@systemapi
145*/
146declare const FormComponent: FormComponentInterface;
147/**
148*@systemapi
149*/
150
151declare const FormComponentInstance: FormComponentAttribute;
152