From 87b2c9f682c1df0c79796570d8277b72f2d27c4c Mon Sep 17 00:00:00 2001 From: yeyinglong_admin Date: Fri, 29 Nov 2024 16:55:04 +0800 Subject: [PATCH] =?UTF-8?q?List=E7=BB=84=E4=BB=B6C-API=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A1=A5=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeyinglong_admin --- arkui/ace_engine/native/native_node.h | 161 +++++++++++++++++++++++++- arkui/ace_engine/native/native_type.h | 18 +++ 2 files changed, 173 insertions(+), 6 deletions(-) diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index f20102e7c..1ca689dad 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -4542,6 +4542,32 @@ typedef enum { */ NODE_SCROLL_SIZE, + /** + * @brief Sets the offset from the start of the scrollable components content. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: offset from the start of the content, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: offset from the start of the content, in vp. \n + * + * @since 16 + */ + NODE_SCROLL_CONTENT_START_OFFSET, + + /** + * @brief Sets the offset from the end of the scrollable components content. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: offset from the end of the content, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: offset from the end of the content, in vp. \n + * + * @since 16 + */ + NODE_SCROLL_CONTENT_END_OFFSET, + /** * @brief Defines the direction in which the list items are arranged. This attribute can be set, reset, and * obtained as required through APIs. @@ -4592,12 +4618,20 @@ typedef enum { NODE_LIST_NODE_ADAPTER, /** - * @brief Sets the number of cached items in the list adapter. - * This attribute can be set, reset, and obtained as required through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: number of cached items in the list adapter. \n - */ + * @brief Sets the number of cached items in the list adapter. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: number of cached items in the list adapter. \n + * .value[1]?.i32: whether to show cached items. The value 0 means to hide cached items, and 1 means + * to show cached items. The default value is 0. This parameter is supported since API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of cached items in the list adapter. \n + * .value[1].i32: whether to show cached items. The value 0 means to hide cached items, and 1 means + * to show cached items. This parameter is supported since API version 16. \n + * + */ NODE_LIST_CACHED_COUNT, /** @@ -4612,6 +4646,8 @@ typedef enum { * 1 indicates an action and 0 indicates no action. Default value: 0。\n * .value[2]?.i32:Specify the alignment of the sliding element with the current container,The parameter type is * {@link ArkUI_ScrollAlignment}, default value is ARKUI_SCROLL_ALIGNMENT_START. \n + * .value[3]?.f32: extra offset, in vp. The default value is 0. + * This parameter is supported since API version 16. \n * */ NODE_LIST_SCROLL_TO_INDEX, @@ -4673,6 +4709,78 @@ typedef enum { */ NODE_LIST_DIVIDER = 1003009, + /** + * @brief Scrolls to the item with the specified index in the specified list item group. + * + * When smooth is set to true, all passed items are loaded and counted in layout calculation. + * This may result in performance issues if a large number of items are involved. \n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: index of the target list item group in the current list. \n + *.value[1].i32: index of the target list item in the list item group. \n + * .value[2]?.i32: whether to enable the smooth animation for scrolling to the item with the specified index. + * The value 1 means to enable the animation, and 0 means the opposite. + * The default value is 0. \n + * .value[3]?.i32: how the item to scroll to is aligned with the container. The parameter type is + * {@link ArkUI_ScrollAlignment}. The default value is ARKUI_SCROLL_ALIGNMENT_START. \n + * + * @since 16 + */ + NODE_LIST_SCROLL_TO_INDEX_IN_GROUP = 1003010, + + /** + * @brief Sets the number of lanes in the list. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: number of lanes in the list. If the maximum and minimum lane widths are set, setting the number + * of lanes will not take effect. \n + * .value[1]?.f32: minimum lane width, in vp. \n + * .value[2]?.f32: maximum column width, in vp. \n + * .value[3]?.f32: lane spacing, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: number of lanes in the list. \n + * .value[1].f32: minimum lane width, in vp. \n + * .value[2].f32: maximum column width, in vp. \n + * .value[3].f32: lane spacing, in vp. \n \n + * + * @since 16 + */ + NODE_LIST_LANES = 1003011, + + /** + * @brief Sets the list snap alignment mode. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: alignment mode for the list snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}. + * The default value is ARKUI_SCROLL_SNAP_ALIGN_NONE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: alignment mode for the list snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}.\n + * + * @since 16 + */ + NODE_LIST_SCROLL_SNAP_ALIGN = 1003012, + + /** + * @brief Sets whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. The value 0 means not to maintain the visible content's + * position, and 1 means the opposite. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. The value 0 means not to maintain the visible content's + * position, and 1 means the opposite. The default value is 0. \n + * + * @since 16 + */ + NODE_LIST_MAINTAIN_VISIBLE_CONTENT_POSITION = 1003013, + /** * @brief Defines whether to enable loop playback for the swiper. * This attribute can be set, reset, and obtained as required through APIs. @@ -5021,6 +5129,20 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_CHILDREN_MAIN_SIZE = 1005003, + /** + * @brief Defines the list item group adapter. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: {@link ArkUI_NodeAdapter} object as the adapter. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: {@link ArkUI_NodeAdapter} object. \n + * + * @since 16 + */ + NODE_LIST_ITEM_GROUP_NODE_ADAPTER = 1005004, + /** * @brief Defines the horizontal alignment mode of child components in the column. * This attribute can be set, reset, and obtained as required through APIs. @@ -6510,6 +6632,33 @@ typedef enum { * ArkUI_NodeComponentEvent.data[1].i32: Current sliding state. \n */ NODE_LIST_ON_DID_SCROLL, + /** + * @brief Defines the event triggered when the currently displayed content of the ARKUI_NODE_LIST changes. + * + * Notes for triggering the event:\n + * This event is triggered once when the list is initialized and when the index of the first child component or the + * next child component in the list display area changes. + * During index calculation, the list item, header of the list item group, and footer of the list item group each + * are counted as a child component. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains three parameters: \n + * ArkUI_NodeComponentEvent.data[0].i32: index of the first child component in the list display area. \n + * ArkUI_NodeComponentEvent.data[1].i32: area in the list item group where the list display area starts. + * The type is {@link ArkUI_ListItemGroupArea}. \n + * ArkUI_NodeComponentEvent.data[2].i32: index of the list item at the start of the list display area + * in the list item group. + * If the start of the list display area is not on a list item, the value is -1. \n + * ArkUI_NodeComponentEvent.data[3].i32: index of the last child component in the list display area. \n + * ArkUI_NodeComponentEvent.data[4].i32: area in the list item group where the list display area ends. + * The type is {@link ArkUI_ListItemGroupArea}. \n + * ArkUI_NodeComponentEvent.data[5].i32: index of the list item at the end of the list display area in the + * list item group. + * If the end of the list display area is not on a list item, the value is -1. \n + * + * @since 16 + */ + NODE_LIST_ON_SCROLL_VISIBLE_CONTENT_CHANGE, /** * @brief Defines the event triggered when the refresh state of the ARKUI_NODE_REFRESH object changes. diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index ca825e62b..2274a9320 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2184,6 +2184,24 @@ typedef enum { ARKUI_SAFE_AREA_TYPE_KEYBOARD = 1 << 2, } ArkUI_SafeAreaType; +/** + * @brief Define an enum for the areas of the ListItemGroup component. + * + * @since 16 + */ +typedef enum { + /** Outside the area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_GROUP_AREA_OUTSIDE = 0, + /** Area when the ListItemGroup component does not have the header, footer, or list item. */ + ARKUI_LIST_ITEM_SWIPE_AREA_NONE, + /** List item area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_ITEM, + /** Header area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_HEADER, + /** Footer area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_FOOTER, +} ArkUI_ListItemGroupArea; + /** * @brief defines the enumerated value of the direction of the extended security zone. * -- Gitee