• 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 * Declare item ceiling attribute.
18 *
19 * @enum { number }
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 7
22 * @deprecated since 9
23 * @useinstead list/StickyStyle
24 */
25declare enum Sticky {
26  /**
27   * No sticky.
28   *
29   * @syscap SystemCapability.ArkUI.ArkUI.Full
30   * @since 7
31   * @deprecated since 9
32   */
33  None,
34
35  /**
36   * Normal mode
37   *
38   * @syscap SystemCapability.ArkUI.ArkUI.Full
39   * @since 7
40   * @deprecated since 9
41   */
42  Normal,
43
44  /**
45   * Set opacity.
46   *
47   * @syscap SystemCapability.ArkUI.ArkUI.Full
48   * @since 7
49   * @deprecated since 9
50   */
51  Opacity,
52}
53
54/**
55 * Declare whether the ListItem element is editable.
56 *
57 * @enum { number }
58 * @syscap SystemCapability.ArkUI.ArkUI.Full
59 * @since 7
60 * @deprecated since 9
61 */
62declare enum EditMode {
63  /**
64   * Unrestricted operations.
65   *
66   * @syscap SystemCapability.ArkUI.ArkUI.Full
67   * @since 7
68   * @deprecated since 9
69   */
70  None,
71
72  /**
73   * Deletable.
74   *
75   * @syscap SystemCapability.ArkUI.ArkUI.Full
76   * @since 7
77   * @deprecated since 9
78   */
79  Deletable,
80
81  /**
82   * Movable.
83   *
84   * @syscap SystemCapability.ArkUI.ArkUI.Full
85   * @since 7
86   * @deprecated since 9
87   */
88  Movable,
89}
90
91/**
92 * Sliding effect
93 *
94 * @enum { number }
95 * @syscap SystemCapability.ArkUI.ArkUI.Full
96 * @since 9
97 */
98/**
99 * Sliding effect
100 *
101 * @enum { number }
102 * @syscap SystemCapability.ArkUI.ArkUI.Full
103 * @crossplatform
104 * @since 10
105 */
106declare enum SwipeEdgeEffect {
107  /**
108   * 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.
109   *
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @since 9
112   */
113  /**
114   * 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.
115   *
116   * @syscap SystemCapability.ArkUI.ArkUI.Full
117   * @crossplatform
118   * @since 10
119   */
120  Spring,
121
122  /**
123   * Sliding to the edge has no effect.
124   *
125   * @syscap SystemCapability.ArkUI.ArkUI.Full
126   * @since 9
127   */
128  /**
129   * Sliding to the edge has no effect.
130   *
131   * @syscap SystemCapability.ArkUI.ArkUI.Full
132   * @crossplatform
133   * @since 10
134   */
135  None,
136}
137
138/**
139 * Defines the swipe action item for SwipeActionOptions.
140 *
141 * @interface SwipeActionItem
142 * @syscap SystemCapability.ArkUI.ArkUI.Full
143 * @since 10
144 */
145declare interface SwipeActionItem {
146  /**
147   * An action item that appears when a list item slides right (when list direction is Vertical) or
148   * slides down (when list direction Horizontal).
149   *
150   * @type { ?CustomBuilder }
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @since 10
153   */
154  builder?: CustomBuilder;
155
156  /**
157   * Defines distance for the delete area.
158   *
159   * @type { ?Length }
160   * @default 56vp
161   * @syscap SystemCapability.ArkUI.ArkUI.Full
162   * @since 10
163   */
164  actionAreaDistance?: Length;
165
166  /**
167   * Called when ListItem need to be deleted.
168   *
169   * @type { ?function }
170   * @syscap SystemCapability.ArkUI.ArkUI.Full
171   * @since 10
172   */
173  onAction?: () => void;
174
175  /**
176   * Called when swipe entry delete area.
177   *
178   * @type { ?function }
179   * @syscap SystemCapability.ArkUI.ArkUI.Full
180   * @since 10
181   */
182  onEnterActionArea?: () => void;
183
184  /**
185   * Called when swipe exit delete area.
186   *
187   * @type { ?function }
188   * @syscap SystemCapability.ArkUI.ArkUI.Full
189   * @since 10
190   */
191  onExitActionArea?: () => void;
192}
193
194/**
195 * Defines the SwipeActionOption of swipeAction attribute method.
196 *
197 * @interface SwipeActionOptions
198 * @syscap SystemCapability.ArkUI.ArkUI.Full
199 * @since 9
200 */
201/**
202 * Defines the SwipeActionOption of swipeAction attribute method.
203 *
204 * @interface SwipeActionOptions
205 * @syscap SystemCapability.ArkUI.ArkUI.Full
206 * @crossplatform
207 * @since 10
208 */
209declare interface SwipeActionOptions {
210  /**
211   * An action item that appears when a list item slides right (when list direction is Vertical) or
212   * slides down (when list direction Horizontal).
213   *
214   * @type { ?(CustomBuilder | SwipeActionItem) }
215   * @syscap SystemCapability.ArkUI.ArkUI.Full
216   * @since 9
217   */
218  /**
219   * An action item that appears when a list item slides right (when list direction is Vertical) or
220   * slides down (when list direction Horizontal).
221   *
222   * @type { ?(CustomBuilder | SwipeActionItem) }
223   * @syscap SystemCapability.ArkUI.ArkUI.Full
224   * @crossplatform
225   * @since 10
226   */
227  start?: CustomBuilder | SwipeActionItem;
228
229  /**
230   * An action item that appears when a list item slides left (when list direction is Vertical) or
231   * slides up (when list direction Horizontal).
232   *
233   * @type { ?(CustomBuilder | SwipeActionItem) }
234   * @syscap SystemCapability.ArkUI.ArkUI.Full
235   * @since 9
236   */
237  /**
238   * An action item that appears when a list item slides left (when list direction is Vertical) or
239   * slides up (when list direction Horizontal).
240   *
241   * @type { ?(CustomBuilder | SwipeActionItem) }
242   * @syscap SystemCapability.ArkUI.ArkUI.Full
243   * @crossplatform
244   * @since 10
245   */
246  end?: CustomBuilder | SwipeActionItem;
247
248  /**
249   * Sets whether sliding to a boundary has a spring effect.
250   *
251   * @type { ?SwipeEdgeEffect }
252   * @syscap SystemCapability.ArkUI.ArkUI.Full
253   * @since 9
254   */
255  /**
256   * Sets whether sliding to a boundary has a spring effect.
257   *
258   * @type { ?SwipeEdgeEffect }
259   * @syscap SystemCapability.ArkUI.ArkUI.Full
260   * @crossplatform
261   * @since 10
262   */
263  edgeEffect?: SwipeEdgeEffect;
264}
265
266/**
267 * Defines the list item style.
268 *
269 * @enum { number }
270 * @syscap SystemCapability.ArkUI.ArkUI.Full
271 * @since 10
272 */
273declare enum ListItemStyle {
274  /**
275   * Show custom style.
276   *
277   * @syscap SystemCapability.ArkUI.ArkUI.Full
278   * @since 10
279   */
280  NONE = 0,
281
282  /**
283   * Show default style.
284   *
285   * @syscap SystemCapability.ArkUI.ArkUI.Full
286   * @since 10
287   */
288  CARD = 1,
289}
290
291/**
292 * Defines the list item options.
293 *
294 * @interface ListItemOptions
295 * @syscap SystemCapability.ArkUI.ArkUI.Full
296 * @since 10
297 */
298declare interface ListItemOptions {
299  /**
300   * Describes the ListItem style.
301   *
302   * @type { ?ListItemStyle }
303   * @syscap SystemCapability.ArkUI.ArkUI.Full
304   * @since 10
305   */
306  style?: ListItemStyle;
307}
308
309/**
310 * Values in the list
311 *
312 * @interface ListItemInterface
313 * @syscap SystemCapability.ArkUI.ArkUI.Full
314 * @since 7
315 */
316/**
317 * Values in the list
318 *
319 * @interface ListItemInterface
320 * @syscap SystemCapability.ArkUI.ArkUI.Full
321 * @since 9
322 * @form
323 */
324/**
325 * Values in the list
326 *
327 * @interface ListItemInterface
328 * @syscap SystemCapability.ArkUI.ArkUI.Full
329 * @crossplatform
330 * @since 10
331 * @form
332 */
333interface ListItemInterface {
334  /**
335   * Called when an interface is used.
336   *
337   * @param { ListItemOptions } value
338   * @returns { ListItemAttribute }
339   * @syscap SystemCapability.ArkUI.ArkUI.Full
340   * @crossplatform
341   * @since 10
342   * @form
343   */
344  (value?: ListItemOptions): ListItemAttribute;
345
346  /**
347   * Called when an interface is used.
348   *
349   * @param { string } value
350   * @returns { ListItemAttribute }
351   * @syscap SystemCapability.ArkUI.ArkUI.Full
352   * @since 7
353   */
354  /**
355   * Called when an interface is used.
356   *
357   * @param { string } value
358   * @returns { ListItemAttribute }
359   * @syscap SystemCapability.ArkUI.ArkUI.Full
360   * @since 9
361   * @deprecated since 10
362   * @useinstead listItem/ListItemInterface
363   * @form
364   */
365  (value?: string): ListItemAttribute;
366}
367
368/**
369 * @extends CommonMethod
370 * @syscap SystemCapability.ArkUI.ArkUI.Full
371 * @since 7
372 */
373/**
374 * @extends CommonMethod
375 * @syscap SystemCapability.ArkUI.ArkUI.Full
376 * @since 9
377 * @form
378 */
379/**
380 * @extends CommonMethod
381 * @syscap SystemCapability.ArkUI.ArkUI.Full
382 * @crossplatform
383 * @since 10
384 * @form
385 */
386declare class ListItemAttribute extends CommonMethod<ListItemAttribute> {
387  /**
388   * Called when setting whether item is ceiling effect.
389   *
390   * @param { Sticky } value
391   * @returns { ListItemAttribute }
392   * @syscap SystemCapability.ArkUI.ArkUI.Full
393   * @since 7
394   * @deprecated since 9
395   * @useinstead list/List#sticky
396   */
397  sticky(value: Sticky): ListItemAttribute;
398
399  /**
400   * Called when judging whether it is editable.
401   *
402   * @param { boolean | EditMode } value
403   * @returns { ListItemAttribute }
404   * @syscap SystemCapability.ArkUI.ArkUI.Full
405   * @since 7
406   * @deprecated since 9
407   */
408  editable(value: boolean | EditMode): ListItemAttribute;
409
410  /**
411   * Called when judging whether it is selectable.
412   *
413   * @param { boolean } value
414   * @returns { ListItemAttribute }
415   * @syscap SystemCapability.ArkUI.ArkUI.Full
416   * @since 8
417   */
418  /**
419   * Called when judging whether it is selectable.
420   *
421   * @param { boolean } value
422   * @returns { ListItemAttribute }
423   * @syscap SystemCapability.ArkUI.ArkUI.Full
424   * @since 9
425   * @form
426   */
427  /**
428   * Called when judging whether it is selectable.
429   *
430   * @param { boolean } value
431   * @returns { ListItemAttribute }
432   * @syscap SystemCapability.ArkUI.ArkUI.Full
433   * @crossplatform
434   * @since 10
435   * @form
436   */
437  selectable(value: boolean): ListItemAttribute;
438
439  /**
440   * Called when judging whether it is selected.
441   * This parameter supports $$ for two-way binding of variables.
442   *
443   * @param { boolean } value - if the listItem is selected.
444   * @returns { ListItemAttribute } the attribute of the listItem.
445   * @syscap SystemCapability.ArkUI.ArkUI.Full
446   * @crossplatform
447   * @since 10
448   * @form
449   */
450  selected(value: boolean): ListItemAttribute;
451
452  /**
453   * Sets the action item that appears when the list item slides in the cross axis direction of the list.
454   *
455   * @param { SwipeActionOptions } value - items defines in the SwipeActionOption.
456   * @returns { ListItemAttribute }
457   * @syscap SystemCapability.ArkUI.ArkUI.Full
458   * @since 9
459   */
460  /**
461   * Sets the action item that appears when the list item slides in the cross axis direction of the list.
462   *
463   * @param { SwipeActionOptions } value - items defines in the SwipeActionOption.
464   * @returns { ListItemAttribute }
465   * @syscap SystemCapability.ArkUI.ArkUI.Full
466   * @crossplatform
467   * @since 10
468   */
469  swipeAction(value: SwipeActionOptions): ListItemAttribute;
470
471  /**
472   * Called when the listItem is selected.
473   *
474   * @param { function } event
475   * @returns { ListItemAttribute }
476   * @syscap SystemCapability.ArkUI.ArkUI.Full
477   * @since 8
478   */
479  /**
480   * Called when the listItem is selected.
481   *
482   * @param { function } event
483   * @returns { ListItemAttribute }
484   * @syscap SystemCapability.ArkUI.ArkUI.Full
485   * @since 9
486   * @form
487   */
488  /**
489   * Called when the listItem is selected.
490   *
491   * @param { function } event
492   * @returns { ListItemAttribute }
493   * @syscap SystemCapability.ArkUI.ArkUI.Full
494   * @crossplatform
495   * @since 10
496   * @form
497   */
498  onSelect(event: (isSelected: boolean) => void): ListItemAttribute;
499}
500
501/**
502 * Defines ListItem Component instance.
503 *
504 * @syscap SystemCapability.ArkUI.ArkUI.Full
505 * @since 7
506 */
507/**
508 * Defines ListItem Component instance.
509 *
510 * @syscap SystemCapability.ArkUI.ArkUI.Full
511 * @since 9
512 * @form
513 */
514/**
515 * Defines ListItem Component instance.
516 *
517 * @syscap SystemCapability.ArkUI.ArkUI.Full
518 * @crossplatform
519 * @since 10
520 * @form
521 */
522declare const ListItemInstance: ListItemAttribute;
523
524/**
525 * Defines ListItem Component.
526 *
527 * @syscap SystemCapability.ArkUI.ArkUI.Full
528 * @since 7
529 */
530/**
531 * Defines ListItem Component.
532 *
533 * @syscap SystemCapability.ArkUI.ArkUI.Full
534 * @since 9
535 * @form
536 */
537/**
538 * Defines ListItem Component.
539 *
540 * @syscap SystemCapability.ArkUI.ArkUI.Full
541 * @crossplatform
542 * @since 10
543 * @form
544 */
545declare const ListItem: ListItemInterface;
546
547