• 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 grid interface.
18 * @since 7
19 */
20interface GridInterface {
21  /**
22   * Grid is returned when the parameter is transferred.
23   * @since 7
24   */
25  (scroller?: Scroller): GridAttribute;
26}
27
28/**
29 * The enum of property layoutDirection
30 * @since 8
31 */
32declare enum GridDirection {
33  /**
34   * The row direction.
35   * @since 8
36   */
37  Row,
38  /**
39   * The column direction.
40   * @since 8
41   */
42  Column,
43  /**
44   * The row reverse direction.
45   * @since 8
46   */
47  RowReverse,
48  /**
49   * The column reverse direction.
50   * @since 8
51   */
52  ColumnReverse,
53}
54
55/**
56 * Defines the grid attribute functions.
57 * @since 7
58 */
59declare class GridAttribute extends CommonMethod<GridAttribute> {
60  /**
61   * This parameter specifies the number of columns in the current grid layout.
62   * @since 7
63   */
64  columnsTemplate(value: string): GridAttribute;
65
66  /**
67   * Lets you set the number of rows in the current grid layout,
68   * @since 7
69   */
70  rowsTemplate(value: string): GridAttribute;
71
72  /**
73   * Allows you to set the spacing between columns.
74   * @since 7
75   */
76  columnsGap(value: Length): GridAttribute;
77
78  /**
79   * Lets you set the spacing between rows.
80   * @since 7
81   */
82  rowsGap(value: Length): GridAttribute;
83
84  /**
85   * This parameter specifies the width of the scroll bar.
86   * @since 7
87   */
88  scrollBarWidth(value: number | string): GridAttribute;
89
90  /**
91   * Sets the color of the scroll bar.
92   * @since 7
93   */
94  scrollBarColor(value: Color | number | string): GridAttribute;
95
96  /**
97   * Lets you set the spacing between rows.
98   * @since 7
99   */
100  scrollBar(value: BarState): GridAttribute;
101
102  /**
103   * Sets the status of the scroll bar.
104   * @since 7
105   */
106  onScrollIndex(event: (first: number) => void): GridAttribute;
107
108  /**
109   * cached Count
110   * @since 7
111   */
112  cachedCount(value: number): GridAttribute;
113
114  /**
115   * editMode
116   * @since 8
117   */
118  editMode(value: boolean): GridAttribute;
119
120  /**
121   * Called when judging whether it is multiSelectable.
122   * @since 8
123   */
124  multiSelectable(value: boolean): GridAttribute;
125
126  /**
127   * maxCount
128   * @since 8
129   */
130  maxCount(value: number): GridAttribute;
131
132  /**
133   * minCount
134   * @since 8
135   */
136  minCount(value: number): GridAttribute;
137
138  /**
139   * cellLength
140   * @since 8
141   */
142  cellLength(value: number): GridAttribute;
143
144  /**
145   * control GridDirection of the grid.
146   * @since 8
147   */
148  layoutDirection(value: GridDirection): GridAttribute;
149
150  /**
151   * control if the grid supports animation.
152   * @since 8
153   */
154  supportAnimation(value: boolean): GridAttribute;
155
156  /**
157   * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered.
158   * (To be triggered, press and hold for 170 milliseconds (ms))
159   * @since 8
160   */
161  onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) | void): GridAttribute;
162
163  /**
164   * After binding, a callback is triggered when the component is dragged to the range of the component.
165   * @since 8
166   */
167  onItemDragEnter(event: (event: ItemDragInfo) => void): GridAttribute;
168
169  /**
170   * After binding, a callback is triggered when the drag moves within the range of a placeable component.
171   * @since 8
172   */
173  onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void): GridAttribute;
174
175  /**
176   * After binding, a callback is triggered when the component is dragged out of the component range.
177   * @since 8
178   */
179  onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void): GridAttribute;
180
181  /**
182   * The component bound to this event can be used as the drag release target.
183   * This callback is triggered when the drag behavior is stopped within the scope of the component.
184   * @since 8
185   */
186  onItemDrop(
187    event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void,
188  ): GridAttribute;
189}
190
191/**
192 * Defines Grid Component.
193 * @since 7
194 */
195declare const Grid: GridInterface;
196
197/**
198 * Defines Grid Component instance.
199 * @since 7
200 */
201declare const GridInstance: GridAttribute;
202