• 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 * Declare scroll status
18 * @since 7
19 */
20declare enum ScrollState {
21  /**
22   * Not activated.
23   * @since 7
24   */
25  Idle,
26
27  /**
28   * Scrolling status.
29   * @since 7
30   */
31  Scroll,
32
33  /**
34   * Drag status.
35   * @since 7
36   */
37  Fling,
38}
39
40
41
42/**
43 * The list interface is extended.
44 * @since 7
45 */
46interface ListInterface {
47  /**
48   * Called when interface data is called.
49   * @since 7
50   */
51  (value?: { initialIndex?: number; space?: number | string; scroller?: Scroller }): ListAttribute;
52}
53
54/**
55 * @since 7
56 */
57declare class ListAttribute extends CommonMethod<ListAttribute> {
58  /**
59   * Called when the arrangement direction of the list component is set.
60   * @since 7
61   */
62  listDirection(value: Axis): ListAttribute;
63
64  /**
65   * Called when the display mode of the side slider is set.
66   * @since 7
67   */
68  scrollBar(value: BarState): ListAttribute;
69
70  /**
71   * Called when the sliding effect is set.
72   * @since 7
73   */
74  edgeEffect(value: EdgeEffect): ListAttribute;
75
76  /**
77   * Called when the ListItem split line style is set.
78   * @since 7
79   */
80  divider(
81    value: {
82      strokeWidth: Length;
83      color?: ResourceColor;
84      startMargin?: Length;
85      endMargin?: Length;
86    } | null,
87  ): ListAttribute;
88
89  /**
90   * Called when judging whether it is in editable mode.
91   * @since 7
92   */
93  editMode(value: boolean): ListAttribute;
94
95  /**
96   * Called when judging whether it is multiSelectable.
97   * @since 8
98   */
99  multiSelectable(value: boolean): ListAttribute;
100
101  /**
102   * Called when the minimum number of list item caches is set for long list deferred loading.
103   * @since 7
104   */
105  cachedCount(value: number): ListAttribute;
106
107  /**
108   * Called when setting whether to enable chain linkage dynamic effect.
109   * @since 7
110   */
111  chainAnimation(value: boolean): ListAttribute;
112
113  /**
114   * Called when the offset and status callback of the slide are set.
115   * @since 7
116   */
117  onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): ListAttribute;
118
119  /**
120   * Called when the start and end positions of the display change.
121   * @since 7
122   */
123  onScrollIndex(event: (start: number, end: number) => void): ListAttribute;
124
125  /**
126   * Called when the list begins to arrive.
127   * @since 7
128   */
129  onReachStart(event: () => void): ListAttribute;
130
131  /**
132   * Called when the list reaches the end.
133   * @since 7
134   */
135  onReachEnd(event: () => void): ListAttribute;
136
137  /**
138   * Called when the slider stops.
139   * @since 7
140   */
141  onScrollStop(event: () => void): ListAttribute;
142
143  /**
144   * Called when a list item is deleted.
145   * @since 7
146   */
147  onItemDelete(event: (index: number) => boolean): ListAttribute;
148
149  /**
150   * Called when a list item is moved.
151   * @since 7
152   */
153  onItemMove(event: (from: number, to: number) => boolean): ListAttribute;
154
155  /**
156   * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered.
157   * (To be triggered, press and hold for 170 milliseconds (ms))
158   * @since 8
159   */
160  onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) | void)): ListAttribute;
161
162  /**
163   * After binding, a callback is triggered when the component is dragged to the range of the component.
164   * @since 8
165   */
166  onItemDragEnter(event: (event: ItemDragInfo) => void): ListAttribute;
167
168  /**
169   * After binding, a callback is triggered when the drag moves within the range of a placeable component.
170   * @since 8
171   */
172  onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void): ListAttribute;
173
174  /**
175   * After binding, a callback is triggered when the component is dragged out of the component range.
176   * @since 8
177   */
178  onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void): ListAttribute;
179
180  /**
181   * The component bound to this event can be used as the drag release target.
182   * This callback is triggered when the drag behavior is stopped within the scope of the component.
183   * @since 8
184   */
185  onItemDrop(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void): ListAttribute;
186}
187
188declare const List: ListInterface;
189declare const ListInstance: ListAttribute;
190