• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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/**
18 * Declare item ceiling attribute.
19 * @since 7
20 */
21declare enum Sticky {
22  /**
23   * No sticky.
24   * @since 7
25   */
26  None,
27
28  /**
29   * Normal mode
30   * @since 7
31   */
32  Normal,
33
34  /**
35   * Set opacity.
36   * @since 7
37   */
38  Opacity,
39}
40
41/**
42 * Declare whether the ListItem element is editable.
43 * @since 7
44 * @deprecated since 9
45 */
46declare enum EditMode {
47  /**
48   * Unrestricted operations.
49   * @since 7
50   */
51  None,
52
53  /**
54   * Deletable.
55   * @since 7
56   */
57  Deletable,
58
59  /**
60   * Movable.
61   * @since 7
62   */
63  Movable,
64}
65
66/**
67 * Sliding effect
68 * @since 9
69 */
70declare enum SwipeEdgeEffect {
71  /**
72   * Elastic physical action, sliding to the edge can continue to slide for a distance based on the initial speed or touch event, and spring back when released.
73   * @since 9
74   */
75  Spring,
76
77  /**
78   * Sliding to the edge has no effect.
79   * @since 9
80   */
81  None,
82}
83
84/**
85 * Defines the SwipeActionOption of swipeAction attribute method.
86 * @since 9
87 */
88declare interface SwipeActionOptions {
89  /**
90   * An action item that appears when a list item slides right (when list direction is Vertical) or
91   * slides down (when list direction Horizontal).
92   * @since 9
93   */
94  start?: CustomBuilder;
95  /**
96   * An action item that appears when a list item slides left (when list direction is Vertical) or
97   * slides up (when list direction Horizontal).
98   * @since 9
99   */
100  end?: CustomBuilder;
101
102  /**
103   * Sets whether sliding to a boundary has a spring effect.
104   * @since 9
105   */
106  edgeEffect?: SwipeEdgeEffect;
107}
108
109/**
110 * @since 7
111 */
112/**
113 * @form
114 * @since 9
115 */
116/**
117 * Values in the list
118 * @since 7
119 */
120/**
121 * Values in the list
122 * @form
123 * @since 9
124 */
125interface ListItemInterface {
126  /**
127   * Called when an interface is used.
128   * @since 7
129   */
130  /**
131   * Called when an interface is used.
132   * @form
133   * @since 9
134   */
135  (value?: string): ListItemAttribute;
136}
137
138/**
139 * @since 7
140 */
141/**
142 * @form
143 * @since 9
144 */
145declare class ListItemAttribute extends CommonMethod<ListItemAttribute> {
146  /**
147   * Called when setting whether item is ceiling effect.
148   * @since 7
149   */
150  sticky(value: Sticky): ListItemAttribute;
151
152  /**
153   * Called when judging whether it is editable.
154   * @since 7
155   * @deprecated since 9
156   */
157  editable(value: boolean | EditMode): ListItemAttribute;
158
159  /**
160   * Called when judging whether it is selectable.
161   * @since 8
162   */
163  selectable(value: boolean): ListItemAttribute;
164
165  /**
166   * Sets the action item that appears when the list item slides in the cross axis direction of the list.
167   * @param value items defines in the SwipeActionOption.
168   * @since 9
169   */
170  swipeAction(value: SwipeActionOptions): ListItemAttribute;
171
172  /**
173   * Called when the listItem is selected.
174   * @since 8
175   */
176  /**
177   * Called when the listItem is selected.
178   * @form
179   * @since 9
180   */
181  onSelect(event: (isSelected: boolean) => void): ListItemAttribute;
182}
183
184/**
185 * Defines ListItem Component instance.
186 * @since 7
187 */
188/**
189 * Defines ListItem Component instance.
190 * @form
191 * @since 9
192 */
193declare const ListItemInstance: ListItemAttribute;
194
195/**
196 * Defines ListItem Component.
197 * @since 7
198 */
199/**
200 * Defines ListItem Component.
201 * @form
202 * @since 9
203 */
204declare const ListItem: ListItemInterface;
205