From 47b453832bf20d70b2f1d85ae3de0deb93896ccc Mon Sep 17 00:00:00 2001 From: yeyinglong Date: Mon, 15 Aug 2022 16:17:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Elist=20item=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E5=88=92=E5=8A=A8=E7=89=B9=E6=80=A7API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeyinglong --- api/@internal/component/ets/list_item.d.ts | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/api/@internal/component/ets/list_item.d.ts b/api/@internal/component/ets/list_item.d.ts index 70e2a9195d..edfea632c9 100644 --- a/api/@internal/component/ets/list_item.d.ts +++ b/api/@internal/component/ets/list_item.d.ts @@ -62,6 +62,49 @@ declare enum EditMode { Movable, } +/** + * Sliding effect + * @since 9 + */ +declare enum SwipeEdgeEffect { + /** + * 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. + * @since 9 + */ + Spring, + + /** + * Sliding to the edge has no effect. + * @since 9 + */ + None, +} + +/** + * Defines the SwipeActionOption of swipeAction attribute method. + * @since 9 + */ +declare interface SwipeActionOptions { + /** + * An action item that appears when a list item slides right (when list direction is Vertical) or + * slides down (when list direction Horizontal). + * @since 9 + */ + start?: CustomBuilder; + /** + * An action item that appears when a list item slides left (when list direction is Vertical) or + * slides up (when list direction Horizontal). + * @since 9 + */ + end?: CustomBuilder; + + /** + * Sets whether sliding to a boundary has a spring effect. + * @since 9 + */ + edgeEffect?: SwipeEdgeEffect; +} + /** * @since 7 */ @@ -100,6 +143,13 @@ declare class ListItemAttribute extends CommonMethod { */ selectable(value: boolean): ListItemAttribute; + /** + * Sets the action item that appears when the list item slides in the cross axis direction of the list. + * @param value items defines in the SwipeActionOption. + * @since 9 + */ + swipeAction(value: SwipeActionOptions): ListItemAttribute; + /** * Called when the listItem is selected. * @since 8 -- Gitee