From e3d26d041e8accb915f53a5012b596705eaede01 Mon Sep 17 00:00:00 2001 From: pensLong Date: Thu, 4 Sep 2025 13:32:19 +0800 Subject: [PATCH] feat: add undefined Signed-off-by: pensLong --- .../implementation/list_item_modifier.cpp | 14 ++++---- .../native/implementation/scroll_modifier.cpp | 33 +++++++++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/frameworks/core/interfaces/native/implementation/list_item_modifier.cpp b/frameworks/core/interfaces/native/implementation/list_item_modifier.cpp index 4b6eed69b2b..2e5f747e81d 100644 --- a/frameworks/core/interfaces/native/implementation/list_item_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/list_item_modifier.cpp @@ -160,8 +160,7 @@ void SetSelectableImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto convValue = Converter::OptConvertPtr(value); if (!convValue) { - // Implement Reset value - return; + convValue = true; } ListItemModelStatic::SetSelectable(frameNode, *convValue); } @@ -172,8 +171,7 @@ void SetSelectedImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto convValue = ProcessBindableSelected(frameNode, value); if (!convValue) { - // Implement Reset value - return; + convValue = false; } ListItemModelStatic::SetSelected(frameNode, *convValue); } @@ -184,7 +182,11 @@ void SetSwipeActionImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ListItemModelStatic::SetDeleteArea(frameNode, nullptr, nullptr, nullptr, nullptr, nullptr, + Dimension(0, DimensionUnit::VP), true); + ListItemModelStatic::SetDeleteArea(frameNode, nullptr, nullptr, nullptr, nullptr, nullptr, + Dimension(0, DimensionUnit::VP), false); + ListItemModelStatic::SetSwiperAction(frameNode, nullptr, nullptr, nullptr, V2::SwipeEdgeEffect::None); return; } @@ -212,7 +214,7 @@ void SetOnSelectImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ListItemModelStatic::SetSelectCallback(frameNode, nullptr); return; } auto onSelect = [arkCallback = CallbackHelper(*optValue)](bool param) { diff --git a/frameworks/core/interfaces/native/implementation/scroll_modifier.cpp b/frameworks/core/interfaces/native/implementation/scroll_modifier.cpp index c4ddcd587fd..3fa2e1eb738 100644 --- a/frameworks/core/interfaces/native/implementation/scroll_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/scroll_modifier.cpp @@ -114,6 +114,8 @@ void SetScrollOptionsImpl(Ark_NativePointer node, } } // ScrollInterfaceModifier namespace ScrollAttributeModifier { + constexpr Dimension DEFAULT_SCROLL_BAR_WIDTH_VALUE = 4.0_vp; + inline const Color DEFAULT_SCROLL_BAR_COLOR_VALUE = Color(0x66182431); void SetScrollableImpl(Ark_NativePointer node, const Opt_ScrollDirection* value) { @@ -129,7 +131,7 @@ void SetOnWillScrollImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnWillScroll(frameNode, nullptr); return; } if (optValue) { @@ -159,7 +161,7 @@ void SetOnDidScrollImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnDidScroll(frameNode, nullptr); return; } auto call = [arkCallback = CallbackHelper(*optValue)]( @@ -178,7 +180,7 @@ void SetOnScrollEdgeImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnScrollEdge(frameNode, nullptr); return; } auto call = [arkCallback = CallbackHelper(*optValue)](ScrollEdge edgeIn) { @@ -194,7 +196,7 @@ void SetOnScrollStartImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnScrollStart(frameNode, nullptr); return; } auto onEvent = [arkCallback = CallbackHelper(*optValue)]() { @@ -209,7 +211,7 @@ void SetOnScrollStopImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnScrollStop(frameNode, nullptr); return; } auto onEvent = [arkCallback = CallbackHelper(*optValue)]() { @@ -231,6 +233,9 @@ void SetScrollBarColorImpl(Ark_NativePointer node, auto frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); auto colorVal = Converter::OptConvertPtr(value); + if (!colorVal) { + colorVal = DEFAULT_SCROLL_BAR_COLOR_VALUE; + } ScrollModelStatic::SetScrollBarColor(frameNode, colorVal); } void SetScrollBarWidthImpl(Ark_NativePointer node, @@ -239,6 +244,9 @@ void SetScrollBarWidthImpl(Ark_NativePointer node, auto frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); auto width = Converter::OptConvertPtr(value); + if (!width) { + width = DEFAULT_SCROLL_BAR_WIDTH_VALUE; + } Validator::ValidateNonNegative(width); Validator::ValidateNonPercent(width); ScrollModelStatic::SetScrollBarWidth(frameNode, width); @@ -250,7 +258,7 @@ void SetOnScrollFrameBeginImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetOnScrollFrameBegin(frameNode, nullptr); return; } auto onScrollFrameEvent = [callback = CallbackHelper(*optValue)]( @@ -273,7 +281,7 @@ void SetNestedScrollImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + ScrollModelStatic::SetNestedScroll(frameNode, NestedScrollMode::SELF_ONLY, NestedScrollMode::SELF_ONLY); return; } auto forward = Converter::OptConvert(optValue->scrollForward); @@ -287,8 +295,7 @@ void SetEnableScrollInteractionImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto convValue = Converter::OptConvertPtr(value); if (!convValue) { - // Implement Reset value - return; + convValue = true; } ScrollModelStatic::SetScrollEnabled(frameNode, *convValue); } @@ -307,7 +314,8 @@ void SetScrollSnapImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto optValue = Converter::GetOptPtr(value); if (!optValue) { - // Implement Reset value + std::vector snapSizes; + ScrollModelStatic::SetScrollSnap(frameNode, std::nullopt, std::nullopt, snapSizes, std::nullopt, std::nullopt); return; } auto snapAlign = Converter::OptConvert(optValue->snapAlign); @@ -341,8 +349,7 @@ void SetEnablePagingImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto convValue = Converter::OptConvertPtr(value); if (!convValue) { - // Implement Reset value - return; + convValue = false; } ScrollModelStatic::SetEnablePaging(frameNode, *convValue); } @@ -353,7 +360,7 @@ void SetInitialOffsetImpl(Ark_NativePointer node, CHECK_NULL_VOID(frameNode); auto convValue = Converter::OptConvert>(*value); if (!convValue) { - // Implement Reset value + ScrollModelStatic::SetInitialOffset(frameNode, std::nullopt); return; } ScrollModelStatic::SetInitialOffset(frameNode, *convValue); -- Gitee