From b760e2c4f3217d3aeae70ad31a877dc02ed9b9e6 Mon Sep 17 00:00:00 2001 From: Tintin9529 Date: Sun, 29 Dec 2024 11:31:07 +0800 Subject: [PATCH] =?UTF-8?q?popup=E6=8F=90=E4=BE=9B=E5=85=A8=E5=B1=80API?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81=E5=9C=A8=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E7=94=A8=E4=B8=AD=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tintin9529 Change-Id: I8718c2e715cadb79f979f41baa1f374f459769f9 --- frameworks/base/error/error_code.h | 2 + .../engine/jsUIContext.js | 61 +++++ .../declarative_frontend/jsview/js_popups.cpp | 84 ++++++- .../jsview/js_view_abstract.cpp | 9 +- .../jsview/js_view_abstract.h | 8 +- .../jsview/js_view_context.cpp | 190 +++++++++++++++- .../jsview/js_view_context.h | 3 + .../jsview/models/view_abstract_model_impl.h | 16 ++ .../common/properties/popup_param.h | 11 + .../core/components_ng/base/view_abstract.cpp | 215 ++++++++++++++++++ .../core/components_ng/base/view_abstract.h | 10 + .../components_ng/base/view_abstract_model.h | 4 + .../base/view_abstract_model_ng.h | 18 ++ .../pattern/bubble/bubble_pattern.h | 23 ++ .../pattern/bubble/bubble_view.cpp | 12 + .../pattern/bubble/bubble_view.h | 1 + .../pattern/overlay/overlay_manager.cpp | 20 ++ .../pattern/overlay/overlay_manager.h | 1 + 18 files changed, 668 insertions(+), 20 deletions(-) diff --git a/frameworks/base/error/error_code.h b/frameworks/base/error/error_code.h index a53181b9075..78d616ff8cf 100644 --- a/frameworks/base/error/error_code.h +++ b/frameworks/base/error/error_code.h @@ -89,6 +89,8 @@ constexpr int32_t ERROR_CODE_DRAG_DATA_ERROR = 190002; // GetData failed, da constexpr int32_t ERROR_CODE_DIALOG_CONTENT_ERROR = 103301; constexpr int32_t ERROR_CODE_DIALOG_CONTENT_ALREADY_EXIST = 103302; constexpr int32_t ERROR_CODE_DIALOG_CONTENT_NOT_FOUND = 103303; +constexpr int32_t ERROR_CODE_TARGET_INFO_NOT_EXIST = 103304; +constexpr int32_t ERROR_CODE_TARGET_NOT_ON_COMPONET_TREE = 103305; // toast error code constexpr int32_t ERROR_CODE_TOAST_NOT_FOUND = 103401; diff --git a/frameworks/bridge/declarative_frontend/engine/jsUIContext.js b/frameworks/bridge/declarative_frontend/engine/jsUIContext.js index fb298510900..edd9b2fad6c 100644 --- a/frameworks/bridge/declarative_frontend/engine/jsUIContext.js +++ b/frameworks/bridge/declarative_frontend/engine/jsUIContext.js @@ -1256,6 +1256,67 @@ class PromptAction { } } + openPopup(content, target, options) { + __JSScopeUtil__.syncInstanceId(this.instanceId_); + let argLength = arguments.length; + let paramErrMsg = + 'Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;' + + ' 2. Incorrect parameter types; 3. Parameter verification failed.'; + if (argLength < 2 || argLength > 3 || content === null || content === undefined || target === null || target === undefined) { + __JSScopeUtil__.restoreInstanceId(); + return new Promise((resolve, reject) => { + reject({ message: paramErrMsg, code: 401 }); + }); + } + let result_; + if (argLength === 2) { + result_ = Context.openPopup(content.getNodePtr(), target); + } else { + result_ = Context.openPopup(content.getNodePtr(), target, options); + } + __JSScopeUtil__.restoreInstanceId(); + return result_; + } + + updatePopup(content, options, partialUpdate) { + __JSScopeUtil__.syncInstanceId(this.instanceId_); + let argLength = arguments.length; + let paramErrMsg = + 'Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;' + + ' 2. Incorrect parameter types; 3. Parameter verification failed.'; + if (argLength < 2 || argLength > 3 || content === null || content === undefined || options === null || options === undefined) { + __JSScopeUtil__.restoreInstanceId(); + return new Promise((resolve, reject) => { + reject({ message: paramErrMsg, code: 401 }); + }); + } + let result_ + if (argLength === 2) { + result_ = Context.updatePopup(content.getNodePtr(), options); + } else { + result_ = Context.updatePopup(content.getNodePtr(), options, partialUpdate); + } + __JSScopeUtil__.restoreInstanceId(); + return result_; + } + + closePopup(content) { + __JSScopeUtil__.syncInstanceId(this.instanceId_); + let argLength = arguments.length; + const paramErrMsg = + 'Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;' + + ' 2. Incorrect parameter types; 3. Parameter verification failed.'; + if (argLength !== 1 || content === null || content === undefined) { + __JSScopeUtil__.restoreInstanceId(); + return new Promise((resolve, reject) => { + reject({ message: paramErrMsg, code: 401 }); + }); + } + let result_ = Context.closePopup(content.getNodePtr()); + __JSScopeUtil__.restoreInstanceId(); + return result_; + } + showActionMenu(options, callback) { __JSScopeUtil__.syncInstanceId(this.instanceId_); if (typeof callback !== 'undefined') { diff --git a/frameworks/bridge/declarative_frontend/jsview/js_popups.cpp b/frameworks/bridge/declarative_frontend/jsview/js_popups.cpp index 843d21442a4..3a1411f4f8d 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_popups.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_popups.cpp @@ -158,8 +158,8 @@ static void GetBlurStyleFromTheme(const RefPtr& popupParam) popupParam->SetBlurStyle(blurStyle); } -void ParsePopupCommonParam( - const JSCallbackInfo& info, const JSRef& popupObj, const RefPtr& popupParam) +void ParsePopupCommonParam(const JSCallbackInfo& info, const JSRef& popupObj, + const RefPtr& popupParam, const RefPtr popupTargetNode = nullptr) { auto arrowOffset = popupObj->GetProperty("arrowOffset"); CalcDimension offset; @@ -259,7 +259,12 @@ void ParsePopupCommonParam( std::vector keys = { "isVisible" }; RefPtr jsFunc = AceType::MakeRefPtr(JSRef(), JSRef::Cast(onStateChangeVal)); - auto targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode()); + WeakPtr targetNode = nullptr; + if (popupTargetNode) { + targetNode = AceType::WeakClaim(AceType::RawPtr(popupTargetNode)); + } else { + targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode()); + } if (popupParam) { auto onStateChangeCallback = [execCtx = info.GetExecutionContext(), func = std::move(jsFunc), keys, node = targetNode](const std::string& param) { @@ -357,12 +362,19 @@ void ParsePopupCommonParam( if (shadowVal->IsObject() || shadowVal->IsNumber()) { auto ret = JSViewAbstract::ParseShadowProps(shadowVal, shadow); if (!ret) { - JSViewAbstract::GetShadowFromTheme(defaultShadowStyle, shadow); + if (!popupParam->IsPartialUpdate()) { + JSViewAbstract::GetShadowFromTheme(defaultShadowStyle, shadow); + popupParam->SetShadow(shadow); + } + } else { + popupParam->SetShadow(shadow); } } else { - JSViewAbstract::GetShadowFromTheme(defaultShadowStyle, shadow); + if (!popupParam->IsPartialUpdate()) { + JSViewAbstract::GetShadowFromTheme(defaultShadowStyle, shadow); + popupParam->SetShadow(shadow); + } } - popupParam->SetShadow(shadow); auto blurStyleValue = popupObj->GetProperty("backgroundBlurStyle"); if (blurStyleValue->IsNumber()) { @@ -371,18 +383,27 @@ void ParsePopupCommonParam( blurStyle <= static_cast(BlurStyle::COMPONENT_ULTRA_THICK)) { popupParam->SetBlurStyle(static_cast(blurStyle)); } else { - GetBlurStyleFromTheme(popupParam); + if (!popupParam->IsPartialUpdate()) { + GetBlurStyleFromTheme(popupParam); + } } } else { - GetBlurStyleFromTheme(popupParam); + if (!popupParam->IsPartialUpdate()) { + GetBlurStyleFromTheme(popupParam); + } } auto popupTransition = popupObj->GetProperty("transition"); if (popupTransition->IsObject()) { popupParam->SetHasTransition(true); auto obj = JSRef::Cast(popupTransition); - auto effects = JSViewAbstract::ParseChainedTransition(obj, info.GetExecutionContext()); - popupParam->SetTransitionEffects(effects); + if (popupTargetNode) { + auto effects = JSViewAbstract::ParseChainedTransition(obj, info.GetExecutionContext(), popupTargetNode); + popupParam->SetTransitionEffects(effects); + } else { + auto effects = JSViewAbstract::ParseChainedTransition(obj, info.GetExecutionContext()); + popupParam->SetTransitionEffects(effects); + } } } @@ -1052,6 +1073,49 @@ panda::Local JSViewAbstract::JsDismissPopup(panda::JsiRuntime return JSValueRef::Undefined(runtimeCallInfo->GetVM()); } +void JSViewAbstract::ParseContentPopupCommonParam( + const JSCallbackInfo& info, const JSRef& popupObj, const RefPtr& popupParam) +{ + CHECK_EQUAL_VOID(popupObj->IsEmpty(), true); + CHECK_NULL_VOID(popupParam); + if (popupParam->GetTargetId().empty() || std::stoi(popupParam->GetTargetId()) < 0) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetId is error."); + return; + } + int32_t targetId = std::stoi(popupParam->GetTargetId()); + auto targetNode = ElementRegister::GetInstance()->GetSpecificItemById(targetId); + if (!targetNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetNode does not exist."); + return; + } + SetPopupDismiss(info, popupObj, popupParam); + ParsePopupCommonParam(info, popupObj, popupParam, targetNode); + auto focusableValue = popupObj->GetProperty("focusable"); + if (focusableValue->IsBoolean()) { + popupParam->SetFocusable(focusableValue->ToBoolean()); + } +} + +int32_t JSViewAbstract::OpenPopup(const RefPtr& param, const RefPtr& customNode) +{ + return ViewAbstractModel::GetInstance()->OpenPopup(param, customNode); +} + +int32_t JSViewAbstract::UpdatePopup(const RefPtr& param, const RefPtr& customNode) +{ + return ViewAbstractModel::GetInstance()->UpdatePopup(param, customNode); +} + +int32_t JSViewAbstract::ClosePopup(const RefPtr& customNode) +{ + return ViewAbstractModel::GetInstance()->ClosePopup(customNode); +} + +int32_t JSViewAbstract::GetPopupParam(RefPtr& param, const RefPtr& customNode) +{ + return ViewAbstractModel::GetInstance()->GetPopupParam(param, customNode); +} + void JSViewAbstract::JsBindContextMenu(const JSCallbackInfo& info) { NG::MenuParam menuParam; diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.cpp b/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.cpp index b9e0612bd74..bfb753fa7a2 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.cpp @@ -1138,7 +1138,7 @@ void UpdateOptionsLabelInfo(std::vector& params) } RefPtr JSViewAbstract::ParseChainedTransition( - const JSRef& object, const JSExecutionContext& context) + const JSRef& object, const JSExecutionContext& context, const RefPtr node) { auto propType = object->GetProperty("type_"); if (!propType->IsString()) { @@ -1194,7 +1194,12 @@ RefPtr JSViewAbstract::ParseChainedTransition( } auto animationOptionObj = JSRef::Cast(propAnimationOption); JSRef onFinish = animationOptionObj->GetProperty("onFinish"); - auto targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode()); + WeakPtr targetNode = nullptr; + if (node) { + targetNode = AceType::WeakClaim(AceType::RawPtr(node)); + } else { + targetNode = AceType::WeakClaim(NG::ViewStackProcessor::GetInstance()->GetMainFrameNode()); + } if (onFinish->IsFunction()) { RefPtr jsFunc = AceType::MakeRefPtr(JSRef(), JSRef::Cast(onFinish)); diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h b/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h index 56b8636b5ad..ab496111b20 100755 --- a/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h +++ b/frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h @@ -166,7 +166,7 @@ public: static bool CheckJSCallbackInfo( const std::string& callerName, const JSRef& tmpInfo, std::vector& infoTypes); static RefPtr ParseChainedTransition( - const JSRef& object, const JSExecutionContext& context); + const JSRef& object, const JSExecutionContext& context, const RefPtr node = nullptr); static bool ParseSheetIsShow( const JSCallbackInfo& info, const std::string& name, std::function& callback); static void ParseSheetStyle( @@ -482,6 +482,12 @@ public: const JSCallbackInfo& info, const JSRef& popupObj, const RefPtr& popupParam); static PopupOnWillDismiss ParsePopupCallback(const JSCallbackInfo& info, const JSRef& paramObj); static panda::Local JsDismissPopup(panda::JsiRuntimeCallInfo* runtimeCallInfo); + static void ParseContentPopupCommonParam( + const JSCallbackInfo& info, const JSRef& popupObj, const RefPtr& popupParam); + static int32_t OpenPopup(const RefPtr& param, const RefPtr& customNode); + static int32_t UpdatePopup(const RefPtr& param, const RefPtr& customNode); + static int32_t ClosePopup(const RefPtr& customNode); + static int32_t GetPopupParam(RefPtr& param, const RefPtr& customNode); #endif /** diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp b/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp index befafc5f851..c60538141ac 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp @@ -83,7 +83,7 @@ constexpr int32_t LENGTH_TWO = 2; constexpr int32_t LENGTH_THREE = 3; constexpr int32_t MAX_FLUSH_COUNT = 2; -std::unordered_map BIND_SHEET_ERROR_MAP = { +std::unordered_map UICONTEXT_ERROR_MAP = { { ERROR_CODE_BIND_SHEET_CONTENT_ERROR, "The bindSheetContent is incorrect." }, { ERROR_CODE_BIND_SHEET_CONTENT_ALREADY_EXIST, "The bindSheetContent already exists." }, { ERROR_CODE_BIND_SHEET_CONTENT_NOT_FOUND, "The bindSheetContent cannot be found." }, @@ -93,7 +93,12 @@ std::unordered_map BIND_SHEET_ERROR_MAP = { "The node of targetId is not a child of the page node or NavDestination node." }, { ERROR_CODE_INTERNAL_ERROR, "Internal error." }, { ERROR_CODE_PARAM_INVALID, "Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;" - "2. Incorrect parameter types; 3. Parameter verification failed." } + "2. Incorrect parameter types; 3. Parameter verification failed." }, + { ERROR_CODE_DIALOG_CONTENT_ERROR, "Dialog content error. " }, + { ERROR_CODE_DIALOG_CONTENT_ALREADY_EXIST, "Dialog content already exist. " }, + { ERROR_CODE_DIALOG_CONTENT_NOT_FOUND, "Dialog content not found. " }, + { ERROR_CODE_TARGET_INFO_NOT_EXIST, "The target does not exist. " }, + { ERROR_CODE_TARGET_NOT_ON_COMPONET_TREE, "The target node is not in the component tree. " } }; void PrintAnimationInfo(const AnimationOption& option, AnimationInterface interface, const std::optional& cnt) @@ -403,7 +408,7 @@ napi_value CreateErrorValue(napi_env env, int32_t errCode, const std::string& er return error; } -RefPtr ParseSheeetContentNode(const JSCallbackInfo& info) +RefPtr ParseContentNode(const JSCallbackInfo& info) { EcmaVM* vm = info.GetVm(); CHECK_NULL_RETURN(vm, nullptr); @@ -426,7 +431,7 @@ void ReturnPromise(const JSCallbackInfo& info, int32_t errCode) napi_create_promise(env, &deferred, &promise); if (errCode != ERROR_CODE_NO_ERROR) { - napi_value result = CreateErrorValue(env, errCode, BIND_SHEET_ERROR_MAP[errCode]); + napi_value result = CreateErrorValue(env, errCode, UICONTEXT_ERROR_MAP[errCode]); napi_reject_deferred(env, deferred, result); } else { napi_value result = nullptr; @@ -862,7 +867,7 @@ void JSViewContext::JSOpenBindSheet(const JSCallbackInfo& info) return; } - auto sheetContentNode = ParseSheeetContentNode(info); + auto sheetContentNode = ParseContentNode(info); if (sheetContentNode == nullptr) { ReturnPromise(info, ERROR_CODE_BIND_SHEET_CONTENT_ERROR); return; @@ -926,7 +931,7 @@ void JSViewContext::JSUpdateBindSheet(const JSCallbackInfo& info) ReturnPromise(info, ERROR_CODE_PARAM_INVALID); return; } - auto sheetContentNode = ParseSheeetContentNode(info); + auto sheetContentNode = ParseContentNode(info); if (sheetContentNode == nullptr) { ReturnPromise(info, ERROR_CODE_BIND_SHEET_CONTENT_ERROR); return; @@ -968,7 +973,7 @@ void JSViewContext::JSCloseBindSheet(const JSCallbackInfo& info) return; } - auto sheetContentNode = ParseSheeetContentNode(info); + auto sheetContentNode = ParseContentNode(info); if (sheetContentNode == nullptr) { ReturnPromise(info, ERROR_CODE_BIND_SHEET_CONTENT_ERROR); return; @@ -980,6 +985,174 @@ void JSViewContext::JSCloseBindSheet(const JSCallbackInfo& info) ReturnPromise(info, ret); return; } + +int32_t ParseTargetInfo(const JSRef& obj, int32_t& targetId) +{ + CHECK_EQUAL_RETURN(obj->IsEmpty(), true, ERROR_CODE_PARAM_INVALID); + auto targetInfoID = obj->GetProperty("id"); + if (targetInfoID->IsNumber()) { + targetId = targetInfoID->ToNumber(); + } else if (targetInfoID->IsString()) { + std::string targetIdString = targetInfoID->ToString(); + auto targetInfoComponentId = obj->GetProperty("componentId"); + if (targetInfoComponentId->IsNumber()) { + auto componentId = targetInfoComponentId->ToNumber(); + auto targetComponentIdNode = + ElementRegister::GetInstance()->GetSpecificItemById(componentId); + CHECK_NULL_RETURN(targetComponentIdNode, ERROR_CODE_TARGET_INFO_NOT_EXIST); + auto targetNode = NG::FrameNode::FindChildByName(targetComponentIdNode, targetIdString); + CHECK_NULL_RETURN(targetNode, ERROR_CODE_TARGET_INFO_NOT_EXIST); + targetId = targetNode->GetId(); + } else { + auto targetNode = ElementRegister::GetInstance()->GetAttachedFrameNodeById(targetIdString); + CHECK_NULL_RETURN(targetNode, ERROR_CODE_TARGET_INFO_NOT_EXIST); + targetId = targetNode->GetId(); + } + } + if (targetId < 0) { + return ERROR_CODE_PARAM_INVALID; + } + return ERROR_CODE_NO_ERROR; +} + +void JSViewContext::JSOpenPopup(const JSCallbackInfo& info) +{ + auto paramCnt = info.Length(); + if (paramCnt < LENGTH_TWO) { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return; + } + auto popupContentNode = ParseContentNode(info); + if (popupContentNode == nullptr) { + ReturnPromise(info, ERROR_CODE_DIALOG_CONTENT_ERROR); + return; + } + auto popupParam = AceType::MakeRefPtr(); + CHECK_NULL_VOID(popupParam); + popupParam->SetIsShow(true); + popupParam->SetUseCustomComponent(true); + if (info[INDEX_ONE]->IsObject()) { + auto popupObj = JSRef::Cast(info[INDEX_ONE]); + int32_t targetId = INVALID_ID; + auto result = ParseTargetInfo(popupObj, targetId); + if (result == ERROR_CODE_NO_ERROR) { + popupParam->SetTargetId(std::to_string(targetId)); + } else { + ReturnPromise(info, result); + return; + } + } else { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return; + } + if (paramCnt == LENGTH_THREE && info[INDEX_TWO]->IsObject()) { + auto popupObj = JSRef::Cast(info[INDEX_TWO]); + JSViewAbstract::ParseContentPopupCommonParam(info, popupObj, popupParam); + } + auto ret = JSViewAbstract::OpenPopup(popupParam, popupContentNode); + if (ret != ERROR_CODE_INTERNAL_ERROR) { + ReturnPromise(info, ret); + } + return; +} + +bool ParseContentPopupCommonParam(const JSCallbackInfo& info, RefPtr& popupParam, + const RefPtr& customNode, bool isPartialUpdate) +{ + if ((!popupParam) || (!customNode)) { + return false; + } + auto paramCnt = info.Length(); + if (!(paramCnt >= LENGTH_TWO && info[INDEX_ONE]->IsObject())) { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return false; + } + bool isShowInSubWindow = false; + if (isPartialUpdate) { + auto result = JSViewAbstract::GetPopupParam(popupParam, customNode); + if (result == ERROR_CODE_NO_ERROR) { + isShowInSubWindow = popupParam->IsShowInSubWindow(); + } else { + if (result != ERROR_CODE_INTERNAL_ERROR) { + ReturnPromise(info, result); + } + return false; + } + } else { + auto param = AceType::MakeRefPtr(); + CHECK_NULL_RETURN(param, false); + auto result = JSViewAbstract::GetPopupParam(param, customNode); + if (result == ERROR_CODE_NO_ERROR) { + isShowInSubWindow = param->IsShowInSubWindow(); + popupParam->SetTargetId(param->GetTargetId()); + } else { + if (result != ERROR_CODE_INTERNAL_ERROR) { + ReturnPromise(info, result); + } + return false; + } + } + popupParam->SetIsShow(true); + popupParam->SetUseCustomComponent(true); + popupParam->SetIsPartialUpdate(isPartialUpdate); + auto popupObj = JSRef::Cast(info[INDEX_ONE]); + JSViewAbstract::ParseContentPopupCommonParam(info, popupObj, popupParam); + popupParam->SetShowInSubWindow(isShowInSubWindow); + return true; +} + +void JSViewContext::JSUpdatePopup(const JSCallbackInfo& info) +{ + auto paramCnt = info.Length(); + if (paramCnt < LENGTH_TWO) { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return; + } + auto popupContentNode = ParseContentNode(info); + if (popupContentNode == nullptr) { + ReturnPromise(info, ERROR_CODE_DIALOG_CONTENT_ERROR); + return; + } + auto popupParam = AceType::MakeRefPtr(); + CHECK_NULL_VOID(popupParam); + bool isPartialUpdate = false; + if (paramCnt == LENGTH_THREE) { + if (!info[INDEX_TWO]->IsBoolean()) { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return; + } + isPartialUpdate = info[INDEX_TWO]->ToBoolean(); + } + auto result = ParseContentPopupCommonParam(info, popupParam, popupContentNode, isPartialUpdate); + if (!result) { + return; + } + auto ret = JSViewAbstract::UpdatePopup(popupParam, popupContentNode); + if (ret != ERROR_CODE_INTERNAL_ERROR) { + ReturnPromise(info, ret); + } + return; +} + +void JSViewContext::JSClosePopup(const JSCallbackInfo& info) +{ + auto paramCnt = info.Length(); + if (paramCnt < LENGTH_ONE) { + ReturnPromise(info, ERROR_CODE_PARAM_INVALID); + return; + } + auto popupContentNode = ParseContentNode(info); + if (popupContentNode == nullptr) { + ReturnPromise(info, ERROR_CODE_DIALOG_CONTENT_ERROR); + return; + } + auto ret = JSViewAbstract::ClosePopup(popupContentNode); + if (ret != ERROR_CODE_INTERNAL_ERROR) { + ReturnPromise(info, ret); + } + return; +} + void JSViewContext::IsFollowingSystemFontScale(const JSCallbackInfo& info) { auto container = Container::CurrentSafely(); @@ -1030,6 +1203,9 @@ void JSViewContext::JSBind(BindingTarget globalObj) JSClass::StaticMethod("openBindSheet", JSOpenBindSheet); JSClass::StaticMethod("updateBindSheet", JSUpdateBindSheet); JSClass::StaticMethod("closeBindSheet", JSCloseBindSheet); + JSClass::StaticMethod("openPopup", JSOpenPopup); + JSClass::StaticMethod("updatePopup", JSUpdatePopup); + JSClass::StaticMethod("closePopup", JSClosePopup); JSClass::StaticMethod("isFollowingSystemFontScale", IsFollowingSystemFontScale); JSClass::StaticMethod("getMaxFontScale", GetMaxFontScale); #ifndef ARKUI_WEARABLE diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_context.h b/frameworks/bridge/declarative_frontend/jsview/js_view_context.h index 04b0c9cffbb..6fc2fe5ed17 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_view_context.h +++ b/frameworks/bridge/declarative_frontend/jsview/js_view_context.h @@ -33,6 +33,9 @@ public: static void JSOpenBindSheet(const JSCallbackInfo& info); static void JSUpdateBindSheet(const JSCallbackInfo& info); static void JSCloseBindSheet(const JSCallbackInfo& info); + static void JSOpenPopup(const JSCallbackInfo& info); + static void JSUpdatePopup(const JSCallbackInfo& info); + static void JSClosePopup(const JSCallbackInfo& info); static void IsFollowingSystemFontScale(const JSCallbackInfo& info); static void GetMaxFontScale(const JSCallbackInfo& info); static void SetEnableSwipeBack(const JSCallbackInfo& info); diff --git a/frameworks/bridge/declarative_frontend/jsview/models/view_abstract_model_impl.h b/frameworks/bridge/declarative_frontend/jsview/models/view_abstract_model_impl.h index 963abdc8f83..3241e11c385 100755 --- a/frameworks/bridge/declarative_frontend/jsview/models/view_abstract_model_impl.h +++ b/frameworks/bridge/declarative_frontend/jsview/models/view_abstract_model_impl.h @@ -267,6 +267,22 @@ public: void BindBackground(std::function&& buildFunc, const Alignment& align) override; void BindPopup(const RefPtr& param, const RefPtr& customNode) override; + int32_t OpenPopup(const RefPtr& param, const RefPtr& customNode) override + { + return 0; + }; + int32_t UpdatePopup(const RefPtr& param, const RefPtr& customNode) override + { + return 0; + }; + int32_t ClosePopup(const RefPtr& customNode) override + { + return 0; + }; + int32_t GetPopupParam(RefPtr& param, const RefPtr& customNode) override + { + return 0; + }; void DismissPopup() override {} void BindMenu(std::vector&& params, std::function&& buildFunc, diff --git a/frameworks/core/components/common/properties/popup_param.h b/frameworks/core/components/common/properties/popup_param.h index 4c13a5236d8..d4adaa07045 100644 --- a/frameworks/core/components/common/properties/popup_param.h +++ b/frameworks/core/components/common/properties/popup_param.h @@ -510,6 +510,16 @@ public: return followTransformOfTarget_; } + void SetIsPartialUpdate(bool isPartialUpdate) + { + isPartialUpdate_ = isPartialUpdate; + } + + bool IsPartialUpdate() const + { + return isPartialUpdate_; + } + private: bool isShow_ = true; bool hasAction_ = false; @@ -527,6 +537,7 @@ private: bool isCaretMode_ = true; bool enableHoverMode_ = false; bool followTransformOfTarget_ = false; + bool isPartialUpdate_ = false; Color maskColor_; Color backgroundColor_; Placement placement_ = Placement::BOTTOM; diff --git a/frameworks/core/components_ng/base/view_abstract.cpp b/frameworks/core/components_ng/base/view_abstract.cpp index 67b76d708d9..78d2a33a3f9 100644 --- a/frameworks/core/components_ng/base/view_abstract.cpp +++ b/frameworks/core/components_ng/base/view_abstract.cpp @@ -19,6 +19,7 @@ #include "interfaces/inner_api/ui_session/ui_session_manager.h" #endif +#include "base/error/error_code.h" #include "base/subwindow/subwindow.h" #include "base/utils/system_properties.h" #include "base/utils/utils.h" @@ -2002,6 +2003,220 @@ void ViewAbstract::BindPopup( } } +RefPtr ViewAbstract::GetCurOverlayManager(const RefPtr& node) +{ + CHECK_NULL_RETURN(node, nullptr); + auto context = node->GetContextWithCheck(); + CHECK_NULL_RETURN(context, nullptr); + RefPtr overlayManager = nullptr; + auto instanceId = context->GetInstanceId(); + auto subwindow = SubwindowManager::GetInstance()->GetSubwindow(instanceId); + if (subwindow) { + overlayManager = subwindow->GetOverlayManager(); + } else { + overlayManager = context->GetOverlayManager(); + } + return overlayManager; +} + +int32_t ViewAbstract::OpenBindPopup( + const RefPtr& param, const RefPtr& targetNode, const RefPtr& customNode) +{ + BindPopup(param, targetNode, customNode); + auto overlayManager = GetCurOverlayManager(customNode); + if (!overlayManager) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The overlayManager of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); + if (!popupInfo.popupNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupNode of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto popupPattern = popupInfo.popupNode->GetPattern(); + if (!popupPattern) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupPattern does not exist."); + return ERROR_CODE_INTERNAL_ERROR; + } + popupPattern->SetPopupParam(param); + popupPattern->SetCustomNode(AceType::WeakClaim(AceType::RawPtr(customNode))); + return ERROR_CODE_NO_ERROR; +} + +int32_t ViewAbstract::OpenPopup(const RefPtr& param, const RefPtr& customNode) +{ + if (!param) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The param of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + if (!customNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The customNode of popup is null."); + return ERROR_CODE_DIALOG_CONTENT_ERROR; + } + if (PopupIsCurrentOnShow(customNode)) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The customNode of popup is already existed."); + return ERROR_CODE_DIALOG_CONTENT_ALREADY_EXIST; + } + if (param->GetTargetId().empty() || std::stoi(param->GetTargetId()) < 0) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetId is error."); + return ERROR_CODE_TARGET_INFO_NOT_EXIST; + } + int32_t targetId = std::stoi(param->GetTargetId()); + auto targetNode = ElementRegister::GetInstance()->GetSpecificItemById(targetId); + if (!targetNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetNode does not exist when oepn popup."); + return ERROR_CODE_TARGET_INFO_NOT_EXIST; + } + if (!targetNode->IsOnMainTree()) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetNode does not on main tree."); + return ERROR_CODE_TARGET_NOT_ON_COMPONET_TREE; + } + auto overlayManager = GetCurOverlayManager(customNode); + if (overlayManager) { + auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); + if (popupInfo.popupNode) { + BubbleView::ResetBubbleProperty(popupInfo.popupNode->GetId()); + } + } + return OpenBindPopup(param, targetNode, customNode); +} + +int32_t ViewAbstract::UpdatePopup(const RefPtr& param, const RefPtr& customNode) +{ + if (!param) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The param of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + if (!customNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The customNode of popup is null."); + return ERROR_CODE_DIALOG_CONTENT_ERROR; + } + if (param->GetTargetId().empty() || std::stoi(param->GetTargetId()) < 0) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetId is error."); + return ERROR_CODE_INTERNAL_ERROR; + } + int32_t targetId = std::stoi(param->GetTargetId()); + auto targetNode = ElementRegister::GetInstance()->GetSpecificItemById(targetId); + if (!targetNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetNode does not exist when update popup."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto overlayManager = GetCurOverlayManager(customNode); + if (!overlayManager) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The overlayManager of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); + if (!popupInfo.popupNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupNode of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + if (!popupInfo.isCurrentOnShow) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popup is closed."); + return ERROR_CODE_INTERNAL_ERROR; + } + BubbleView::ResetBubbleProperty(popupInfo.popupNode->GetId()); + BindPopup(param, targetNode, customNode); + auto popupPattern = popupInfo.popupNode->GetPattern(); + if (!popupPattern) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupPattern does not exist."); + return ERROR_CODE_INTERNAL_ERROR; + } + popupPattern->SetPopupParam(param); + return ERROR_CODE_NO_ERROR; +} + +int32_t ViewAbstract::CloseBindPopup( + const RefPtr& param, const int32_t& targetId, const RefPtr& customNode) +{ + auto targetNode = ElementRegister::GetInstance()->GetSpecificItemById(targetId); + if (!targetNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetNode does not exist when close popup."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto overlayManager = GetCurOverlayManager(customNode); + if (!overlayManager) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The overlayManager of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto popupInfo = overlayManager->GetPopupInfo(targetNode->GetId()); + if (!popupInfo.popupNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupNode of popup is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + if (!popupInfo.isCurrentOnShow) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popup is already closed."); + return ERROR_CODE_INTERNAL_ERROR; + } + popupInfo.markNeedUpdate = true; + if (param->IsShowInSubWindow()) { + SubwindowManager::GetInstance()->HidePopupNG(targetId); + } else { + overlayManager->HidePopup(targetId, popupInfo); + } + auto popupPattern = popupInfo.popupNode->GetPattern(); + if (!popupPattern) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupPattern does not exist."); + return ERROR_CODE_INTERNAL_ERROR; + } + popupPattern->SetPopupParam(param); + BubbleView::ResetBubbleProperty(popupInfo.popupNode->GetId()); + return ERROR_CODE_NO_ERROR; +} + +int32_t ViewAbstract::ClosePopup(const RefPtr& customNode) +{ + if (!customNode) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The customNode of popup is null."); + return ERROR_CODE_DIALOG_CONTENT_ERROR; + } + auto param = AceType::MakeRefPtr(); + if (!param) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The popupParam is null."); + return ERROR_CODE_INTERNAL_ERROR; + } + auto result = GetPopupParam(param, customNode); + if (result != ERROR_CODE_NO_ERROR) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "GetPopupParam failed"); + return result; + } + param->SetIsShow(false); + if (param->GetTargetId().empty() || std::stoi(param->GetTargetId()) < 0) { + TAG_LOGE(AceLogTag::ACE_DIALOG, "The targetId is error."); + return ERROR_CODE_INTERNAL_ERROR; + } + int32_t targetId = std::stoi(param->GetTargetId()); + return CloseBindPopup(param, targetId, customNode); +} + +int32_t ViewAbstract::GetPopupParam(RefPtr& param, const RefPtr& customNode) +{ + CHECK_NULL_RETURN(param, ERROR_CODE_INTERNAL_ERROR); + CHECK_NULL_RETURN(customNode, ERROR_CODE_DIALOG_CONTENT_ERROR); + auto overlayManager = GetCurOverlayManager(customNode); + CHECK_NULL_RETURN(overlayManager, ERROR_CODE_DIALOG_CONTENT_ERROR); + auto popupInfo = overlayManager->GetPopupInfoWithExistContent(customNode); + CHECK_NULL_RETURN(popupInfo.popupNode, ERROR_CODE_DIALOG_CONTENT_NOT_FOUND); + auto popupPattern = popupInfo.popupNode->GetPattern(); + CHECK_NULL_RETURN(popupPattern, ERROR_CODE_INTERNAL_ERROR); + param = popupPattern->GetPopupParam(); + CHECK_NULL_RETURN(param, ERROR_CODE_INTERNAL_ERROR); + if (param->GetTargetId().empty() || std::stoi(param->GetTargetId()) < 0) { + return ERROR_CODE_INTERNAL_ERROR; + } + return ERROR_CODE_NO_ERROR; +} + +bool ViewAbstract::PopupIsCurrentOnShow(const RefPtr& customNode) +{ + CHECK_NULL_RETURN(customNode, false); + auto overlayManager = GetCurOverlayManager(customNode); + CHECK_NULL_RETURN(overlayManager, false); + auto popupInfo = overlayManager->GetPopupInfoWithExistContent(customNode); + CHECK_NULL_RETURN(popupInfo.popupNode, false); + return popupInfo.isCurrentOnShow; +} + void ViewAbstract::DismissPopup() { auto context = PipelineContext::GetCurrentContext(); diff --git a/frameworks/core/components_ng/base/view_abstract.h b/frameworks/core/components_ng/base/view_abstract.h index 294eb01addd..4a0aabd27c9 100644 --- a/frameworks/core/components_ng/base/view_abstract.h +++ b/frameworks/core/components_ng/base/view_abstract.h @@ -356,6 +356,11 @@ public: // Bind properties static void BindPopup(const RefPtr ¶m, const RefPtr &targetNode, const RefPtr &customNode); + static RefPtr GetCurOverlayManager(const RefPtr& node); + static int32_t OpenPopup(const RefPtr& param, const RefPtr& customNode); + static int32_t UpdatePopup(const RefPtr& param, const RefPtr& customNode); + static int32_t ClosePopup(const RefPtr& customNode); + static int32_t GetPopupParam(RefPtr& param, const RefPtr& customNode); static void DismissDialog(); static void DismissPopup(); static void BindMenuWithItems(std::vector &¶ms, const RefPtr &targetNode, @@ -824,6 +829,11 @@ private: const std::optional& align, const std::optional& offsetX, const std::optional& offsetY); static void CheckIfParentNeedMarkDirty(FrameNode* frameNode); + static int32_t OpenBindPopup( + const RefPtr& param, const RefPtr& targetNode, const RefPtr& customNode); + static int32_t CloseBindPopup( + const RefPtr& param, const int32_t& targetId, const RefPtr& customNode); + static bool PopupIsCurrentOnShow(const RefPtr& customNode); static OEMVisualEffectFunc oemVisualEffectFunc; static std::mutex visualEffectMutex_; diff --git a/frameworks/core/components_ng/base/view_abstract_model.h b/frameworks/core/components_ng/base/view_abstract_model.h index 792a90d44c5..2a630e5f124 100755 --- a/frameworks/core/components_ng/base/view_abstract_model.h +++ b/frameworks/core/components_ng/base/view_abstract_model.h @@ -363,6 +363,10 @@ public: // popup and menu virtual void BindPopup(const RefPtr& param, const RefPtr& customNode) = 0; + virtual int32_t OpenPopup(const RefPtr& param, const RefPtr& customNode) = 0; + virtual int32_t UpdatePopup(const RefPtr& param, const RefPtr& customNode) = 0; + virtual int32_t ClosePopup(const RefPtr& customNode) = 0; + virtual int32_t GetPopupParam(RefPtr& param, const RefPtr& customNode) = 0; virtual void DismissPopup() = 0; virtual void BindMenu( std::vector&& params, std::function&& buildFunc, const NG::MenuParam& menuParam) = 0; diff --git a/frameworks/core/components_ng/base/view_abstract_model_ng.h b/frameworks/core/components_ng/base/view_abstract_model_ng.h index 596b703f70b..523a018dff4 100755 --- a/frameworks/core/components_ng/base/view_abstract_model_ng.h +++ b/frameworks/core/components_ng/base/view_abstract_model_ng.h @@ -1265,6 +1265,24 @@ public: ViewAbstract::BindPopup(param, AceType::Claim(targetNode), AceType::DynamicCast(customNode)); } + int32_t OpenPopup(const RefPtr& param, const RefPtr& customNode) override + { + return ViewAbstract::OpenPopup(param, customNode); + } + int32_t UpdatePopup(const RefPtr& param, const RefPtr& customNode) override + { + return ViewAbstract::UpdatePopup(param, customNode); + } + int32_t ClosePopup(const RefPtr& customNode) override + { + return ViewAbstract::ClosePopup(customNode); + } + + int32_t GetPopupParam(RefPtr& param, const RefPtr& customNode) override + { + return ViewAbstract::GetPopupParam(param, customNode); + } + void DismissDialog() override { ViewAbstract::DismissDialog(); diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h index c532db63a2d..9ec965d3a7b 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h +++ b/frameworks/core/components_ng/pattern/bubble/bubble_pattern.h @@ -21,6 +21,7 @@ #include "base/geometry/ng/offset_t.h" #include "base/geometry/ng/size_t.h" #include "base/memory/referenced.h" +#include "core/components/common/properties/popup_param.h" #include "core/components/popup/popup_theme.h" #include "core/components_ng/base/frame_node.h" #include "core/components_ng/event/focus_hub.h" @@ -248,6 +249,26 @@ public: } } + void SetPopupParam(const RefPtr& popupParam) + { + popupParam_ = popupParam; + } + + const RefPtr& GetPopupParam() const + { + return popupParam_; + } + + void SetCustomNode(const WeakPtr& customNode) + { + customNode_ = customNode; + } + + const RefPtr GetCustomNode() const + { + return customNode_.Upgrade(); + } + protected: void OnDetachFromFrameNode(FrameNode* frameNode) override; @@ -338,6 +359,8 @@ private: int32_t halfFoldHoverCallbackId_ = -1; std::function onStateChangeCallback_ = nullptr; std::function doubleBindCallback_ = nullptr; + RefPtr popupParam_ = nullptr; + WeakPtr customNode_ = nullptr; }; } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp b/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp index 0ebf22122f1..62e874fe729 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp +++ b/frameworks/core/components_ng/pattern/bubble/bubble_view.cpp @@ -670,6 +670,18 @@ void BubbleView::UpdateCommonParam(int32_t popupId, const RefPtr& pa } } +void BubbleView::ResetBubbleProperty(int32_t popupId) +{ + auto popupNode = FrameNode::GetFrameNode(V2::POPUP_ETS_TAG, popupId); + CHECK_NULL_VOID(popupNode); + auto popupLayoutProp = popupNode->GetLayoutProperty(); + CHECK_NULL_VOID(popupLayoutProp); + popupLayoutProp->Reset(); + auto popupPaintProp = popupNode->GetPaintProperty(); + CHECK_NULL_VOID(popupPaintProp); + popupPaintProp->Reset(); +} + RefPtr BubbleView::CreateMessage(const std::string& message, bool IsUseCustom) { auto textId = ElementRegister::GetInstance()->MakeUniqueId(); diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_view.h b/frameworks/core/components_ng/pattern/bubble/bubble_view.h index a22c82607fe..b4faaccb509 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_view.h +++ b/frameworks/core/components_ng/pattern/bubble/bubble_view.h @@ -46,6 +46,7 @@ public: static void UpdatePopupParam(int32_t popupId, const RefPtr& param, const RefPtr& targetNode); static void UpdateCustomPopupParam(int32_t popupId, const RefPtr& param); static void UpdateCommonParam(int32_t popupId, const RefPtr& param, bool custom = true); + static void ResetBubbleProperty(int32_t popupId); static void GetPopupMaxWidthAndHeight( const RefPtr& param, float& popupMaxWidth, float& popupMaxHeight, int32_t popupId); static void UpdateBubbleContent(int32_t popupId, const RefPtr& param); diff --git a/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp b/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp index ccc86f9bcb7..db31e7dc1f0 100644 --- a/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp +++ b/frameworks/core/components_ng/pattern/overlay/overlay_manager.cpp @@ -2014,6 +2014,26 @@ void OverlayManager::DismissPopup() HidePopup(dismissPopupId_, popupInfo); } +PopupInfo OverlayManager::GetPopupInfoWithExistContent(const RefPtr& node) +{ + PopupInfo popupInfoError; + popupInfoError.popupNode = nullptr; + CHECK_NULL_RETURN(node, popupInfoError); + auto iter = popupMap_.begin(); + + while (iter != popupMap_.end()) { + auto popupInfo = (*iter).second; + CHECK_NULL_RETURN(popupInfo.popupNode, popupInfoError); + auto popupPattern = popupInfo.popupNode->GetPattern(); + CHECK_NULL_RETURN(popupPattern, popupInfoError); + if (popupPattern->GetCustomNode() == node) { + return popupInfo; + } + iter++; + } + return popupInfoError; +} + void OverlayManager::ResetMenuWrapperVisibility(const RefPtr& menuWrapper) { CHECK_NULL_VOID(menuWrapper); diff --git a/frameworks/core/components_ng/pattern/overlay/overlay_manager.h b/frameworks/core/components_ng/pattern/overlay/overlay_manager.h index bcf3ecb7a2a..af8646370b9 100644 --- a/frameworks/core/components_ng/pattern/overlay/overlay_manager.h +++ b/frameworks/core/components_ng/pattern/overlay/overlay_manager.h @@ -119,6 +119,7 @@ public: void ShowPopupAnimation(const RefPtr& popupNode); void ShowPopupAnimationNG(const RefPtr& popupNode); void HidePopupAnimation(const RefPtr& popupNode, const std::function& finish); + PopupInfo GetPopupInfoWithExistContent(const RefPtr& node); PopupInfo GetPopupInfo(int32_t targetId) const { -- Gitee