mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-12-01 03:02:51 +00:00
Merge branch 'master' of gitee.com:openharmony/arkui_ace_engine into request
Signed-off-by: tsj_2020 <tongshijia@huawei.com>
This commit is contained in:
commit
ad5afab335
@ -63,6 +63,20 @@ void ClipboardImpl::HasData(const std::function<void(bool hasData)>& callback)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClipboardImpl::HasDataType(const std::function<void(bool hasData)>& callback, const std::string& mimeType)
|
||||
{
|
||||
#ifdef SYSTEM_CLIPBOARD_SUPPORTED
|
||||
bool hasData = false;
|
||||
CHECK_NULL_VOID(taskExecutor_);
|
||||
taskExecutor_->PostSyncTask(
|
||||
[&hasData, mimeType]() {
|
||||
hasData = OHOS::MiscServices::PasteboardClient::GetInstance()->HasDataType(mimeType);
|
||||
},
|
||||
TaskExecutor::TaskType::PLATFORM, "ArkUIClipboardHasDataType");
|
||||
callback(hasData);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClipboardImpl::SetData(const std::string& data, CopyOptions copyOption, bool isDragData)
|
||||
{
|
||||
CHECK_NULL_VOID(taskExecutor_);
|
||||
@ -476,11 +490,11 @@ void ClipboardImpl::GetSpanStringDataHelper(
|
||||
auto getDataRes = OHOS::MiscServices::PasteboardClient::GetInstance()->GetPasteData(pasteData);
|
||||
CHECK_NULL_VOID(getDataRes);
|
||||
std::vector<uint8_t> arr;
|
||||
clip->ProcessSpanStringData(arr, pasteData);
|
||||
std::string text;
|
||||
clip->ProcessSpanStringData(arr, pasteData, text);
|
||||
auto textData = pasteData.GetPrimaryText();
|
||||
if (textData) {
|
||||
text = *textData;
|
||||
if (textData && text.empty()) {
|
||||
text.append(*textData);
|
||||
}
|
||||
callback(arr, text);
|
||||
};
|
||||
@ -491,7 +505,8 @@ void ClipboardImpl::GetSpanStringDataHelper(
|
||||
}
|
||||
}
|
||||
|
||||
void ClipboardImpl::ProcessSpanStringData(std::vector<uint8_t>& arr, const OHOS::MiscServices::PasteData& pasteData)
|
||||
void ClipboardImpl::ProcessSpanStringData(
|
||||
std::vector<uint8_t>& arr, const OHOS::MiscServices::PasteData& pasteData, std::string& text)
|
||||
{
|
||||
for (const auto& pasteDataRecord : pasteData.AllRecords()) {
|
||||
if (pasteDataRecord == nullptr) {
|
||||
@ -513,6 +528,10 @@ void ClipboardImpl::ProcessSpanStringData(std::vector<uint8_t>& arr, const OHOS:
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (pasteDataRecord->GetPlainText() != nullptr) {
|
||||
auto textData = pasteDataRecord->GetPlainText();
|
||||
text.append(*textData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
const std::function<void(const std::string&, bool isLastRecord)>& urlCallback, bool syncMode = false) override;
|
||||
RefPtr<PasteDataMix> CreatePasteDataMix() override;
|
||||
void HasData(const std::function<void(bool hasData)>& callback) override;
|
||||
void HasDataType(const std::function<void(bool hasData)>& callback, const std::string& mimeType) override;
|
||||
void Clear() override;
|
||||
void GetSpanStringData(
|
||||
const std::function<void(std::vector<uint8_t>&, const std::string&)>& callback, bool syncMode = false) override;
|
||||
@ -66,7 +67,8 @@ private:
|
||||
void GetPixelMapDataAsync(const std::function<void(const RefPtr<PixelMap>&)>& callback);
|
||||
void GetSpanStringDataHelper(
|
||||
const std::function<void(std::vector<uint8_t>&, const std::string&)>& callback, bool syncMode = false);
|
||||
void ProcessSpanStringData(std::vector<uint8_t>& arr, const OHOS::MiscServices::PasteData& pasteData);
|
||||
void ProcessSpanStringData(
|
||||
std::vector<uint8_t>& arr, const OHOS::MiscServices::PasteData& pasteData, std::string& resText);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2551,6 +2551,9 @@ void AceContainer::UpdateResource()
|
||||
if (SystemProperties::GetResourceDecoupling()) {
|
||||
auto context = runtimeContext_.lock();
|
||||
auto abilityInfo = abilityInfo_.lock();
|
||||
if (pipelineContext_->IsFormRender()) {
|
||||
ReleaseResourceAdapter();
|
||||
}
|
||||
InitResourceAndThemeManager(
|
||||
pipelineContext_, assetManager_, colorScheme_, resourceInfo_, context, abilityInfo, true);
|
||||
} else {
|
||||
|
@ -316,9 +316,6 @@ void SubwindowOhos::HidePopupNG(int32_t targetId)
|
||||
ContainerScope scope(childContainerId_);
|
||||
overlayManager->HidePopup(targetId == -1 ? popupTargetId_ : targetId, popupInfo);
|
||||
context->FlushPipelineImmediately();
|
||||
HideEventColumn();
|
||||
HidePixelMap();
|
||||
HideFilter(false);
|
||||
}
|
||||
|
||||
void SubwindowOhos::GetPopupInfoNG(int32_t targetId, NG::PopupInfo& popupInfo)
|
||||
@ -515,7 +512,7 @@ void SubwindowOhos::ClearMenu()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SubwindowOhos::ShowPreviewNG()
|
||||
bool SubwindowOhos::ShowDragPreviewWindowNG()
|
||||
{
|
||||
CHECK_NULL_RETURN(window_, false);
|
||||
ShowWindow(false);
|
||||
@ -524,7 +521,7 @@ bool SubwindowOhos::ShowPreviewNG()
|
||||
return true;
|
||||
}
|
||||
|
||||
void SubwindowOhos::HidePreviewNG()
|
||||
void SubwindowOhos::HideDragPreviewWindowNG()
|
||||
{
|
||||
auto overlayManager = GetOverlayManager();
|
||||
CHECK_NULL_VOID(overlayManager);
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset) override;
|
||||
void ShowMenuNG(std::function<void()>&& buildFunc, std::function<void()>&& previewBuildFunc,
|
||||
const NG::MenuParam& menuParam, const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset) override;
|
||||
bool ShowPreviewNG() override;
|
||||
void HidePreviewNG() override;
|
||||
bool ShowDragPreviewWindowNG() override;
|
||||
void HideDragPreviewWindowNG() override;
|
||||
void HideMenuNG(const RefPtr<NG::FrameNode>& menu, int32_t targetId) override;
|
||||
void HideMenuNG(bool showPreviewAnimation, bool startDrag) override;
|
||||
void UpdateHideMenuOffsetNG(const NG::OffsetF& offset, bool isRedragStart) override;
|
||||
|
@ -128,14 +128,16 @@ void TimePickerHapticController::ThreadLoop()
|
||||
// Set different volumes for different sliding speeds:
|
||||
// sound effect loudness
|
||||
// (dB) = sound effect dB set by the user + (0.0066 screen movement speed (mm/s) - 0.01)
|
||||
// the range of volume interface setting is [0.0f, 1.0f]
|
||||
float volume = userVolume + 0.0066 * absSpeedInMm_ - 0.01;
|
||||
volume = std::clamp(volume, 0.0f, 1.0f);
|
||||
|
||||
// Different vibration parameters for different sliding speeds:
|
||||
// the frequency is between 260~300Hz and fixed, the vibration amount
|
||||
// (g) = 0.007 * screen movement speed (mm/s) + 0.3
|
||||
float haptic = (absSpeedInMm_ == 0) ? 0 : absSpeedInMm_ * 0.007 + 0.3;
|
||||
haptic = std::clamp(haptic, 0.0f, 100.0f);
|
||||
// (g) = (0.007 * screen movement speed (mm/s) + 0.3) * 100
|
||||
// the range of haptic intensity interface setting is [1.0f, 100.0f]
|
||||
float haptic = ((absSpeedInMm_ == 0) ? 0 : absSpeedInMm_ * 0.007 + 0.3) * 100;
|
||||
haptic = std::clamp(haptic, 1.0f, 100.0f);
|
||||
|
||||
auto startTime = std::chrono::high_resolution_clock::now();
|
||||
effectAudioHapticPlayer_->SetVolume(volume);
|
||||
|
@ -1129,7 +1129,8 @@ UIContentErrorCode UIContentImpl::CommonInitializeForm(
|
||||
}
|
||||
|
||||
if (isFormRender_) {
|
||||
errorCode = Platform::AceContainer::SetViewNew(aceView, density, formWidth_, formHeight_, window_);
|
||||
errorCode = Platform::AceContainer::SetViewNew(aceView, density, round(formWidth_),
|
||||
round(formHeight_), window_);
|
||||
CHECK_ERROR_CODE_RETURN(errorCode);
|
||||
auto frontend = AceType::DynamicCast<FormFrontendDeclarative>(container->GetFrontend());
|
||||
CHECK_NULL_RETURN(frontend, UIContentErrorCode::NULL_POINTER);
|
||||
@ -1155,7 +1156,8 @@ UIContentErrorCode UIContentImpl::CommonInitializeForm(
|
||||
}
|
||||
|
||||
if (isFormRender_) {
|
||||
Platform::AceViewOhos::SurfaceChanged(aceView, formWidth_, formHeight_, deviceHeight >= deviceWidth ? 0 : 1);
|
||||
Platform::AceViewOhos::SurfaceChanged(aceView, round(formWidth_), round(formHeight_),
|
||||
deviceHeight >= deviceWidth ? 0 : 1);
|
||||
SetFontScaleAndWeightScale(container, instanceId_);
|
||||
// Set sdk version in module json mode for form
|
||||
auto pipeline = container->GetPipelineContext();
|
||||
@ -2561,14 +2563,16 @@ void UIContentImpl::OnFormSurfaceChange(float width, float height)
|
||||
{
|
||||
auto container = Platform::AceContainer::GetContainer(instanceId_);
|
||||
CHECK_NULL_VOID(container);
|
||||
int32_t formWidth = round(width);
|
||||
int32_t formHeight = round(height);
|
||||
auto aceView = AceType::DynamicCast<Platform::AceViewOhos>(container->GetAceView());
|
||||
Platform::AceViewOhos::ChangeViewSize(aceView, width, height);
|
||||
Platform::AceViewOhos::ChangeViewSize(aceView, formWidth, formHeight);
|
||||
auto pipelineContext = container->GetPipelineContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
ContainerScope scope(instanceId_);
|
||||
auto density = pipelineContext->GetDensity();
|
||||
pipelineContext->SetRootSize(density, width, height);
|
||||
pipelineContext->OnSurfaceChanged(width, height);
|
||||
pipelineContext->SetRootSize(density, formWidth, formHeight);
|
||||
pipelineContext->OnSurfaceChanged(formWidth, formHeight);
|
||||
}
|
||||
|
||||
void UIContentImpl::SetFormBackgroundColor(const std::string& color)
|
||||
|
@ -61,12 +61,14 @@ void UiSessionManager::ReportRouterChangeEvent(const std::string& data)
|
||||
}
|
||||
}
|
||||
|
||||
void UiSessionManager::ReportComponentChangeEvent(const std::string& data)
|
||||
void UiSessionManager::ReportComponentChangeEvent(const std::string& key, const std::string& value)
|
||||
{
|
||||
for (auto pair : reportObjectMap_) {
|
||||
auto reportService = iface_cast<ReportService>(pair.second);
|
||||
if (reportService != nullptr) {
|
||||
reportService->ReportComponentChangeEvent(data);
|
||||
if (reportService != nullptr && GetComponentChangeEventRegistered()) {
|
||||
auto data = InspectorJsonUtil::Create();
|
||||
data->Put(key.data(), value.data());
|
||||
reportService->ReportComponentChangeEvent(data->ToString());
|
||||
} else {
|
||||
LOGW("report component event failed,process id:%{public}d", pair.first);
|
||||
}
|
||||
@ -181,4 +183,14 @@ void UiSessionManager::ReportInspectorTreeValue(const std::string& data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UiSessionManager::OnRouterChange(const std::string& path, const std::string& event)
|
||||
{
|
||||
if (GetRouterChangeEventRegistered()) {
|
||||
auto value = InspectorJsonUtil::Create(true);
|
||||
value->Put("path", path.c_str());
|
||||
value->Put("event", event.c_str());
|
||||
ReportRouterChangeEvent(value->ToString());
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -39,12 +39,12 @@ constexpr uint32_t SECONDS_TO_MILLISECONDS = 1000;
|
||||
const std::unordered_map<TextDataDetectType, std::string> TEXT_DETECT_MAP = {
|
||||
{ TextDataDetectType::PHONE_NUMBER, "phoneNum" }, { TextDataDetectType::URL, "url" },
|
||||
{ TextDataDetectType::EMAIL, "email" }, { TextDataDetectType::ADDRESS, "location" },
|
||||
{ TextDataDetectType::DATETIME, "datetime" }
|
||||
{ TextDataDetectType::DATE_TIME, "datetime" }
|
||||
};
|
||||
const std::unordered_map<std::string, TextDataDetectType> TEXT_DETECT_MAP_REVERSE = {
|
||||
{ "phoneNum", TextDataDetectType::PHONE_NUMBER }, { "url", TextDataDetectType::URL },
|
||||
{ "email", TextDataDetectType::EMAIL }, { "location", TextDataDetectType::ADDRESS },
|
||||
{ "datetime", TextDataDetectType::DATETIME }
|
||||
{ "datetime", TextDataDetectType::DATE_TIME }
|
||||
};
|
||||
|
||||
bool DataDetectorAdapter::ShowUIExtensionMenu(
|
||||
@ -165,7 +165,7 @@ void DataDetectorAdapter::SetWantParamaters(const AISpan& aiSpan, AAFwk::Want& w
|
||||
if (entityJson_.find(aiSpan.start) != entityJson_.end()) {
|
||||
want.SetParam("entityJson", entityJson_[aiSpan.start]);
|
||||
}
|
||||
if (aiSpan.type == TextDataDetectType::DATETIME) {
|
||||
if (aiSpan.type == TextDataDetectType::DATE_TIME) {
|
||||
want.SetParam("fullText", textForAI_);
|
||||
want.SetParam("offset", aiSpan.start);
|
||||
}
|
||||
@ -246,25 +246,29 @@ void DataDetectorAdapter::InitTextDetect(int32_t startPos, std::string detectTex
|
||||
auto context = host->GetContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
auto uiTaskExecutor = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::UI);
|
||||
uiTaskExecutor.PostTask([result, weak, instanceID, startPos, info] {
|
||||
ContainerScope scope(instanceID);
|
||||
auto dataDetectorAdapter = weak.Upgrade();
|
||||
CHECK_NULL_VOID(dataDetectorAdapter);
|
||||
if (info.module != dataDetectorAdapter->textDetectTypes_) {
|
||||
return;
|
||||
}
|
||||
dataDetectorAdapter->ParseAIResult(result, startPos);
|
||||
auto host = dataDetectorAdapter->GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
host->MarkDirtyNode(NG::PROPERTY_UPDATE_MEASURE);
|
||||
}, "ArkUITextParseAIResult");
|
||||
uiTaskExecutor.PostTask(
|
||||
[result, weak, instanceID, startPos, info] {
|
||||
ContainerScope scope(instanceID);
|
||||
auto dataDetectorAdapter = weak.Upgrade();
|
||||
CHECK_NULL_VOID(dataDetectorAdapter);
|
||||
if (info.module != dataDetectorAdapter->textDetectTypes_) {
|
||||
return;
|
||||
}
|
||||
dataDetectorAdapter->ParseAIResult(result, startPos);
|
||||
auto host = dataDetectorAdapter->GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
host->MarkDirtyNode(NG::PROPERTY_UPDATE_MEASURE);
|
||||
},
|
||||
"ArkUITextParseAIResult");
|
||||
};
|
||||
|
||||
auto uiTaskExecutor = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
uiTaskExecutor.PostTask([info, textFunc] {
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT, "Start entity detect using AI");
|
||||
DataDetectorMgr::GetInstance().DataDetect(info, textFunc);
|
||||
}, "ArkUITextInitDataDetect");
|
||||
uiTaskExecutor.PostTask(
|
||||
[info, textFunc] {
|
||||
TAG_LOGI(AceLogTag::ACE_TEXT, "Start entity detect using AI");
|
||||
DataDetectorMgr::GetInstance().DataDetect(info, textFunc);
|
||||
},
|
||||
"ArkUITextInitDataDetect");
|
||||
}
|
||||
|
||||
void DataDetectorAdapter::ParseAIResult(const TextDataDetectResult& result, int32_t startPos)
|
||||
|
@ -122,6 +122,8 @@ void ImageAnalyzerManager::UpdateAnalyzerOverlay(const RefPtr<OHOS::Ace::PixelMa
|
||||
|
||||
void ImageAnalyzerManager::DestroyAnalyzerOverlay()
|
||||
{
|
||||
ReleaseImageAnalyzer();
|
||||
|
||||
if (!isAnalyzerOverlayBuild_) {
|
||||
return;
|
||||
}
|
||||
@ -266,7 +268,8 @@ bool ImageAnalyzerManager::UpdateVideoConfig(const PixelMapInfo& info)
|
||||
}
|
||||
|
||||
bool shouldUpdateSize = analyzerUIConfig_.contentWidth != info.width ||
|
||||
analyzerUIConfig_.contentHeight != info.height;
|
||||
analyzerUIConfig_.contentHeight != info.height ||
|
||||
analyzerUIConfig_.overlayOffset != info.overlayOffset;
|
||||
if (shouldUpdateSize) {
|
||||
analyzerUIConfig_.UpdateFromInfo(info);
|
||||
}
|
||||
|
@ -103,9 +103,15 @@ void InputMethodManager::ProcessKeyboard(const RefPtr<NG::FrameNode>& curFocusNo
|
||||
windowFocus_.reset();
|
||||
auto callback = pipeline->GetWindowFocusCallback();
|
||||
if (callback) {
|
||||
TAG_LOGI(AceLogTag::ACE_KEYBOARD, "Trigger Window Focus Callback");
|
||||
callback();
|
||||
return;
|
||||
} else {
|
||||
TAG_LOGI(AceLogTag::ACE_KEYBOARD, "No Window Focus Callback");
|
||||
if (!pipeline->NeedSoftKeyboard()) {
|
||||
HideKeyboardAcrossProcesses();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (curFocusNode->GetTag() == V2::UI_EXTENSION_COMPONENT_ETS_TAG ||
|
||||
@ -153,6 +159,7 @@ void InputMethodManager::CloseKeyboard()
|
||||
auto textFieldManager = pipeline->GetTextFieldManager();
|
||||
CHECK_NULL_VOID(textFieldManager);
|
||||
if (!textFieldManager->GetImeShow()) {
|
||||
TAG_LOGI(AceLogTag::ACE_KEYBOARD, "Ime Not Shown, No need to close keyboard");
|
||||
return;
|
||||
}
|
||||
#if defined(ENABLE_STANDARD_INPUT)
|
||||
|
@ -884,15 +884,7 @@ RefPtr<NG::FrameNode> GetFramenodeByAccessibilityId(const RefPtr<NG::FrameNode>&
|
||||
#endif
|
||||
}
|
||||
|
||||
if (frameNode != nullptr && frameNode->GetAccessibilityProperty<NG::AccessibilityProperty>() != nullptr) {
|
||||
auto property = frameNode->GetAccessibilityProperty<NG::AccessibilityProperty>();
|
||||
if (property->GetAccessibilityLevel() != NG::AccessibilityProperty::Level::NO_HIDE_DESCENDANTS &&
|
||||
!property->IsAccessibilityGroup()) {
|
||||
nodes.push(Referenced::RawPtr(child));
|
||||
}
|
||||
} else {
|
||||
nodes.push(Referenced::RawPtr(child));
|
||||
}
|
||||
nodes.push(Referenced::RawPtr(child));
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@ -914,53 +906,7 @@ void GetFrameNodeParent(const RefPtr<NG::UINode>& uiNode, RefPtr<NG::FrameNode>&
|
||||
|
||||
bool CheckFrameNodeByAccessibilityLevel(const RefPtr<NG::FrameNode>& frameNode, bool isParent)
|
||||
{
|
||||
bool ret = false;
|
||||
CHECK_NULL_RETURN(frameNode, false);
|
||||
auto accessibilityProperty = frameNode->GetAccessibilityProperty<NG::AccessibilityProperty>();
|
||||
CHECK_NULL_RETURN(accessibilityProperty, false);
|
||||
auto uiNode = frameNode->GetParent();
|
||||
RefPtr<NG::FrameNode> parentNode;
|
||||
if (uiNode != nullptr) {
|
||||
GetFrameNodeParent(uiNode, parentNode);
|
||||
}
|
||||
|
||||
auto accessibilityLevel = accessibilityProperty->GetAccessibilityLevel();
|
||||
if (isParent) {
|
||||
if (accessibilityLevel == NG::AccessibilityProperty::Level::NO_HIDE_DESCENDANTS) {
|
||||
ret = false;
|
||||
return ret;
|
||||
}
|
||||
if (!parentNode) {
|
||||
if (accessibilityProperty->IsAccessibilityGroup()) {
|
||||
ret = false;
|
||||
} else {
|
||||
ret = true;
|
||||
}
|
||||
} else {
|
||||
if (accessibilityProperty->IsAccessibilityGroup()) {
|
||||
ret = false;
|
||||
} else {
|
||||
ret = CheckFrameNodeByAccessibilityLevel(parentNode, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (accessibilityLevel == NG::AccessibilityProperty::Level::AUTO ||
|
||||
accessibilityLevel == NG::AccessibilityProperty::Level::YES) {
|
||||
ret = true;
|
||||
if (!parentNode) {
|
||||
return ret;
|
||||
}
|
||||
auto parentAccessibilityProperty = parentNode->GetAccessibilityProperty<NG::AccessibilityProperty>();
|
||||
if (parentAccessibilityProperty->IsAccessibilityGroup()) {
|
||||
ret = false;
|
||||
} else {
|
||||
ret = CheckFrameNodeByAccessibilityLevel(parentNode, true);
|
||||
}
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetFrameNodeChildren(const RefPtr<NG::UINode>& uiNode, std::vector<int64_t>& children, int32_t pageId)
|
||||
@ -1156,6 +1102,8 @@ void JsAccessibilityManager::UpdateAccessibilityElementInfo(
|
||||
nodeInfo.SetRange(rangeInfo);
|
||||
}
|
||||
nodeInfo.SetHint(accessibilityProperty->GetHintText());
|
||||
nodeInfo.SetAccessibilityGroup(accessibilityProperty->IsAccessibilityGroup());
|
||||
nodeInfo.SetAccessibilityLevel(accessibilityProperty->GetAccessibilityLevel());
|
||||
nodeInfo.SetTextType(accessibilityProperty->GetTextType());
|
||||
nodeInfo.SetTextLengthLimit(accessibilityProperty->GetTextLengthLimit());
|
||||
nodeInfo.SetOffset(accessibilityProperty->GetScrollOffSet());
|
||||
@ -2077,7 +2025,6 @@ JsAccessibilityManager::~JsAccessibilityManager()
|
||||
auto eventType = AccessibilityStateEventType::EVENT_ACCESSIBILITY_STATE_CHANGED;
|
||||
|
||||
UnsubscribeStateObserver(eventType);
|
||||
UnsubscribeToastObserver();
|
||||
|
||||
DeregisterInteractionOperation();
|
||||
}
|
||||
@ -2156,8 +2103,6 @@ void JsAccessibilityManager::InitializeCallback()
|
||||
client->IsEnabled(isEnabled);
|
||||
AceApplicationInfo::GetInstance().SetAccessibilityEnabled(isEnabled);
|
||||
|
||||
SubscribeToastObserver();
|
||||
|
||||
if (pipelineContext->IsFormRender() || pipelineContext->IsJsCard() || pipelineContext->IsJsPlugin()) {
|
||||
return;
|
||||
}
|
||||
@ -4793,7 +4738,7 @@ void JsAccessibilityManager::GenerateCommonProperty(const RefPtr<PipelineBase>&
|
||||
output.windowLeft = GetWindowLeft(ngPipeline->GetWindowId());
|
||||
output.windowTop = GetWindowTop(ngPipeline->GetWindowId());
|
||||
}
|
||||
auto page = stageManager->GetLastPage();
|
||||
auto page = stageManager->GetLastPageWithTransition();
|
||||
if (page != nullptr) {
|
||||
output.pageId = page->GetPageId();
|
||||
output.pagePath = GetPagePath();
|
||||
|
@ -124,6 +124,7 @@ const std::unordered_map<AceLogTag, const char*> g_DOMAIN_CONTENTS_MAP = {
|
||||
{ AceLogTag::ACE_MOVING_PHOTO, "AceMovingPhoto" },
|
||||
{ AceLogTag::ACE_ARK_COMPONENT, "AceArkComponent" },
|
||||
{ AceLogTag::ACE_WINDOW, "AceWindow" },
|
||||
{ AceLogTag::ACE_INPUTKEYFLOW, "InputKeyFlow"},
|
||||
};
|
||||
// initial static member object
|
||||
LogLevel LogWrapper::level_ = LogLevel::DEBUG;
|
||||
|
@ -290,8 +290,6 @@ void PixelMapOhos::SavePixelMapToFile(const std::string& dst) const
|
||||
"_rowStride" + std::to_string(rowStride) + "_byteCount" + std::to_string(totalSize) + dst +
|
||||
".dat";
|
||||
auto path = ImageFileCache::GetInstance().ConstructCacheFilePath(filename);
|
||||
char realPath[PATH_MAX] = { 0x00 };
|
||||
CHECK_NULL_VOID(realpath(path.c_str(), realPath));
|
||||
std::ofstream outFile(path, std::fstream::out);
|
||||
if (!outFile.is_open()) {
|
||||
TAG_LOGW(AceLogTag::ACE_IMAGE, "write error, path=%{public}s", path.c_str());
|
||||
|
@ -88,7 +88,11 @@ static const std::set<std::string> stringAttrs = {
|
||||
"menu_has_filter",
|
||||
"calendar_picker_dialog_button_transparent",
|
||||
"calendar_picker_dialog_divider_transparent",
|
||||
"textfield_accessibility_property_delete"
|
||||
"textfield_accessibility_property_clear",
|
||||
"textfield_accessibility_show_password",
|
||||
"textfield_accessibility_hide_password",
|
||||
"rich_editor_show_handle",
|
||||
"text_show_handle"
|
||||
};
|
||||
|
||||
void ParseNumberUnit(const std::string& value, std::string& number, std::string& unit)
|
||||
|
@ -118,6 +118,11 @@ bool IsTextTraceEnabled()
|
||||
return (system::GetParameter("persist.ace.trace.text.enabled", "false") == "true");
|
||||
}
|
||||
|
||||
bool IsSyntaxTraceEnabled()
|
||||
{
|
||||
return (system::GetParameter("persist.ace.trace.syntax.enabled", "false") == "true");
|
||||
}
|
||||
|
||||
bool IsAccessTraceEnabled()
|
||||
{
|
||||
return (system::GetParameter("persist.ace.trace.access.enabled", "false") == "true");
|
||||
@ -365,6 +370,7 @@ bool SystemProperties::buildTraceEnable_ = IsBuildTraceEnabled() && developerMod
|
||||
bool SystemProperties::syncDebugTraceEnable_ = IsSyncDebugTraceEnabled();
|
||||
bool SystemProperties::pixelRoundEnable_ = IsPixelRoundEnabled();
|
||||
bool SystemProperties::textTraceEnable_ = IsTextTraceEnabled();
|
||||
bool SystemProperties::syntaxTraceEnable_ = IsSyntaxTraceEnabled();
|
||||
bool SystemProperties::accessTraceEnable_ = IsAccessTraceEnabled();
|
||||
bool SystemProperties::accessibilityEnabled_ = IsAccessibilityEnabled();
|
||||
bool SystemProperties::isRound_ = false;
|
||||
|
@ -54,6 +54,7 @@ ohos_source_set("preview_entrance_source") {
|
||||
"foldable_window_preview.cpp",
|
||||
"msdp/interaction_impl.cpp",
|
||||
"subwindow_preview.cpp",
|
||||
"timepicker/timepicker_haptic_factory.cpp",
|
||||
"touch_event_convertor.cpp",
|
||||
"udmf/udmf_impl.cpp",
|
||||
"ui_content_impl.cpp",
|
||||
|
@ -81,6 +81,11 @@ void ClipboardImpl::HasData(const std::function<void(bool hasData)>& callback)
|
||||
TaskExecutor::TaskType::UI, "ArkUIClipboardHasData");
|
||||
}
|
||||
|
||||
void ClipboardImpl::HasDataType(const std::function<void(bool hasData)>& callback, const std::string& mimeType)
|
||||
{
|
||||
HasData(callback);
|
||||
}
|
||||
|
||||
void ClipboardImpl::SetPixelMapData(const RefPtr<PixelMap>& pixmap, CopyOptions copyOption)
|
||||
{
|
||||
if (!taskExecutor_ || !callbackSetClipboardPixmapData_) {
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
void GetPixelMapData(const std::function<void(const RefPtr<PixelMap>&)>& callback, bool syncMode = false) override;
|
||||
void Clear() override;
|
||||
void HasData(const std::function<void(bool hasData)>& callback) override;
|
||||
void HasDataType(const std::function<void(bool hasData)>& callback, const std::string& mimeType) override;
|
||||
void RegisterCallbackSetClipboardPixmapData(CallbackSetClipboardPixmapData callback);
|
||||
void RegisterCallbackGetClipboardPixmapData(CallbackGetClipboardPixmapData callback);
|
||||
void AddPixelMapRecord(const RefPtr<PasteDataMix>& pasteData, const RefPtr<PixelMap>& pixmap) override;
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/components_ng/pattern/time_picker/timepicker_haptic_factory.h"
|
||||
#include "core/components_ng/pattern/time_picker/timepicker_haptic_interface.h"
|
||||
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
std::shared_ptr<ITimepickerAudioHaptic> TimepickerAudioHapticFactory::GetInstance()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
@ -47,6 +47,7 @@ bool SystemProperties::buildTraceEnable_ = false;
|
||||
bool SystemProperties::syncDebugTraceEnable_ = false;
|
||||
bool SystemProperties::pixelRoundEnable_ = true;
|
||||
bool SystemProperties::textTraceEnable_ = false;
|
||||
bool SystemProperties::syntaxTraceEnable_ = false;
|
||||
bool SystemProperties::accessTraceEnable_ = false;
|
||||
bool SystemProperties::accessibilityEnabled_ = false;
|
||||
bool SystemProperties::isRound_ = false;
|
||||
|
@ -1190,7 +1190,7 @@ export class ChipComponent extends ViewPU {
|
||||
return;
|
||||
}
|
||||
if (this.isHover) {
|
||||
if (i3.type === TouchType.Down || i3.type == TouchType.Move) {
|
||||
if (i3.type === TouchType.Down || i3.type === TouchType.Move) {
|
||||
this.isShowPressedBackGroundColor = true;
|
||||
}
|
||||
else if (i3.type === TouchType.Up) {
|
||||
@ -1201,7 +1201,7 @@ export class ChipComponent extends ViewPU {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (i3.type === TouchType.Down || i3.type == TouchType.Move) {
|
||||
if (i3.type === TouchType.Down || i3.type === TouchType.Move) {
|
||||
this.isShowPressedBackGroundColor = true;
|
||||
}
|
||||
else if (i3.type === TouchType.Up) {
|
||||
@ -1456,7 +1456,6 @@ export class ChipComponent extends ViewPU {
|
||||
this.observeComponentCreation2((o1, p1) => {
|
||||
Image.create(this.prefixIcon?.src);
|
||||
Image.direction(this.chipDirection);
|
||||
Image.matchTextDirection(this.chipDirection == Direction.Ltr ? false : true);
|
||||
Image.opacity(this.getChipNodeOpacity());
|
||||
Image.size(this.getPrefixIconSize());
|
||||
Image.fillColor(this.getPrefixIconFilledColor());
|
||||
@ -1518,7 +1517,6 @@ export class ChipComponent extends ViewPU {
|
||||
this.observeComponentCreation2((v, w) => {
|
||||
Image.create(this.getSuffixIconSrc());
|
||||
Image.direction(this.chipDirection);
|
||||
Image.matchTextDirection(this.chipDirection == Direction.Ltr ? false : true);
|
||||
Image.opacity(this.getChipNodeOpacity());
|
||||
Image.size(this.getSuffixIconSize());
|
||||
Image.fillColor(this.getSuffixIconFilledColor());
|
||||
@ -1552,7 +1550,7 @@ export class ChipComponent extends ViewPU {
|
||||
}, Image);
|
||||
});
|
||||
}
|
||||
else if ((this.allowClose ?? true)) {
|
||||
else if (this.allowClose ?? true) {
|
||||
this.ifElseBranchUpdateFunction(2, () => {
|
||||
this.observeComponentCreation2((q, r) => {
|
||||
SymbolGlyph.create({
|
||||
|
@ -716,7 +716,7 @@ export struct ChipComponent {
|
||||
return
|
||||
}
|
||||
if (this.isHover) {
|
||||
if (event.type === TouchType.Down || event.type == TouchEvent.Move) {
|
||||
if (event.type === TouchType.Down || event.type === TouchType.Move) {
|
||||
this.isShowPressedBackGroundColor = true
|
||||
} else if (event.type === TouchType.Up) {
|
||||
this.isShowPressedBackGroundColor = false
|
||||
@ -724,7 +724,7 @@ export struct ChipComponent {
|
||||
this.isShowPressedBackGroundColor = false
|
||||
}
|
||||
} else {
|
||||
if (event.type === TouchType.Down || event.type == TouchType.Move) {
|
||||
if (event.type === TouchType.Down || event.type === TouchType.Move) {
|
||||
this.isShowPressedBackGroundColor = true
|
||||
} else if (event.type === TouchType.Up) {
|
||||
this.isShowPressedBackGroundColor = false
|
||||
@ -921,7 +921,6 @@ export struct ChipComponent {
|
||||
} else if (this.prefixIcon?.src !== "") {
|
||||
Image(this.prefixIcon?.src)
|
||||
.direction(this.chipDirection)
|
||||
.matchTextDirection(this.chipDirection == Direction.Ltr ? false : true)
|
||||
.opacity(this.getChipNodeOpacity())
|
||||
.size(this.getPrefixIconSize())
|
||||
.fillColor(this.getPrefixIconFilledColor())
|
||||
@ -965,7 +964,6 @@ export struct ChipComponent {
|
||||
} else if (this.suffixIcon?.src !== "") {
|
||||
Image(this.getSuffixIconSrc())
|
||||
.direction(this.chipDirection)
|
||||
.matchTextDirection(this.chipDirection == Direction.Ltr ? false : true)
|
||||
.opacity(this.getChipNodeOpacity())
|
||||
.size(this.getSuffixIconSize())
|
||||
.fillColor(this.getSuffixIconFilledColor())
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_chipgroup_abc_start[];
|
||||
extern const char _binary_chipgroup_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_ChipGroup_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_ChipGroup_GetABCCode(
|
||||
const char** buf, int* buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_chipgroup_abc_start;
|
||||
|
@ -396,6 +396,11 @@ export class ChipGroup extends ViewPU {
|
||||
}
|
||||
getChipSize() {
|
||||
if (this.itemStyle && this.itemStyle.size) {
|
||||
if (typeof this.itemStyle.size == 'object') {
|
||||
if (!this.itemStyle.size.width || !this.itemStyle.size.height) {
|
||||
return defaultTheme.itemStyle.size;
|
||||
}
|
||||
}
|
||||
return this.itemStyle.size;
|
||||
}
|
||||
return defaultTheme.itemStyle.size;
|
||||
@ -627,6 +632,9 @@ export class ChipGroup extends ViewPU {
|
||||
if (!this.isMultiple()) {
|
||||
this.selectedIndexes = [];
|
||||
}
|
||||
if (!this.selectedIndexes || this.selectedIndexes.length === 0) {
|
||||
this.selectedIndexes = this.getSelectedIndexes();
|
||||
}
|
||||
this.selectedIndexes.push(index);
|
||||
}
|
||||
this.getOnChange()(this.getSelectedIndexes());
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
import { SymbolGlyphModifier } from '@ohos.arkui.modifier';
|
||||
import { Chip, ChipSize, ChipSymbolGlyphOptions } from '@ohos.arkui.advanced.Chip';
|
||||
import DeviceType from '@ohos.resourceManager';
|
||||
|
||||
interface ChipGroupTheme {
|
||||
itemStyle: ChipGroupStyleTheme;
|
||||
@ -275,6 +276,11 @@ export struct ChipGroup {
|
||||
|
||||
private getChipSize(): ChipSize | SizeOptions {
|
||||
if (this.itemStyle && this.itemStyle.size) {
|
||||
if (typeof this.itemStyle.size == 'object') {
|
||||
if ( !this.itemStyle.size.width || !this.itemStyle.size.height ) {
|
||||
return defaultTheme.itemStyle.size;
|
||||
}
|
||||
}
|
||||
return this.itemStyle.size;
|
||||
}
|
||||
return defaultTheme.itemStyle.size;
|
||||
@ -524,6 +530,9 @@ export struct ChipGroup {
|
||||
if (!this.isMultiple()) {
|
||||
this.selectedIndexes = [];
|
||||
}
|
||||
if (!this.selectedIndexes || this.selectedIndexes.length === 0) {
|
||||
this.selectedIndexes = this.getSelectedIndexes();
|
||||
}
|
||||
this.selectedIndexes.push(index);
|
||||
}
|
||||
this.getOnChange()(this.getSelectedIndexes());
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_composelistitem_abc_start[];
|
||||
extern const char _binary_composelistitem_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_ComposeListItem_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_ComposeListItem_GetABCCode(
|
||||
const char** buf, int* buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_composelistitem_abc_start;
|
||||
|
@ -248,7 +248,7 @@ class ContentItemStruct extends ViewPU {
|
||||
createIcon(v9 = null) {
|
||||
this.observeComponentCreation2((x9, y9) => {
|
||||
If.create();
|
||||
if (this.icon != null && this.iconStyle != null) {
|
||||
if (this.icon != null && this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) {
|
||||
this.ifElseBranchUpdateFunction(0, () => {
|
||||
this.observeComponentCreation2((c10, d10) => {
|
||||
If.create();
|
||||
@ -1444,10 +1444,10 @@ export class ComposeListItem extends ViewPU {
|
||||
if (m1) {
|
||||
let n1 = new ContentItemStruct(this, {}, undefined, l1, () => { }, { page: "library/src/main/ets/components/composelistitem.ets", line: 725 });
|
||||
ViewPU.create(n1);
|
||||
let o1 = () => {
|
||||
let c = () => {
|
||||
return {};
|
||||
};
|
||||
n1.paramsGenerator_ = o1;
|
||||
n1.paramsGenerator_ = c;
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(l1, {});
|
||||
@ -1478,7 +1478,7 @@ export class ComposeListItem extends ViewPU {
|
||||
leftWidth: this.calculatedLeftWidth()
|
||||
}, undefined, a1, () => { }, { page: "library/src/main/ets/components/composelistitem.ets", line: 728 });
|
||||
ViewPU.create(c1);
|
||||
let d1 = () => {
|
||||
let b = () => {
|
||||
return {
|
||||
icon: this.contentItem?.icon,
|
||||
iconStyle: this.contentItem?.iconStyle,
|
||||
@ -1488,7 +1488,7 @@ export class ComposeListItem extends ViewPU {
|
||||
leftWidth: this.calculatedLeftWidth()
|
||||
};
|
||||
};
|
||||
c1.paramsGenerator_ = d1;
|
||||
c1.paramsGenerator_ = b;
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(a1, {
|
||||
@ -1545,7 +1545,7 @@ export class ComposeListItem extends ViewPU {
|
||||
rightWidth: this.calculatedRightWidth()
|
||||
}, undefined, l, () => { }, { page: "library/src/main/ets/components/composelistitem.ets", line: 738 });
|
||||
ViewPU.create(n);
|
||||
let o = () => {
|
||||
let a = () => {
|
||||
return {
|
||||
icon: this.operateItem?.icon,
|
||||
subIcon: this.operateItem?.subIcon,
|
||||
@ -1565,7 +1565,7 @@ export class ComposeListItem extends ViewPU {
|
||||
rightWidth: this.calculatedRightWidth()
|
||||
};
|
||||
};
|
||||
n.paramsGenerator_ = o;
|
||||
n.paramsGenerator_ = a;
|
||||
}
|
||||
else {
|
||||
this.updateStateVarsOfChildByElmtId(l, {
|
||||
|
@ -146,7 +146,7 @@ struct ContentItemStruct {
|
||||
|
||||
@Builder
|
||||
createIcon() {
|
||||
if (this.icon != null && this.iconStyle != null) {
|
||||
if (this.icon != null && this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) {
|
||||
if (this.iconStyle <= IconType.PREVIEW) {
|
||||
Image(this.icon)
|
||||
.objectFit(ImageFit.Contain)
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_composetitlebar_abc_start[];
|
||||
extern const char _binary_composetitlebar_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_ComposeTitleBar_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_ComposeTitleBar_GetABCCode(
|
||||
const char** buf, int* buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_composetitlebar_abc_start;
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_counter_abc_start[];
|
||||
extern const char _binary_counter_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_Counter_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_Counter_GetABCCode(
|
||||
const char** buf, int* buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_counter_abc_start;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -698,7 +698,9 @@ export struct ConfirmDialog {
|
||||
if (index === this.textIndex) {
|
||||
this.textBuilder();
|
||||
} else if (index === this.checkboxIndex) {
|
||||
this.checkBoxBuilder();
|
||||
WithTheme({ theme: this.theme, colorMode: this.themeColorMode }) {
|
||||
this.checkBoxBuilder();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -995,13 +997,19 @@ struct CustomDialogContentComponent {
|
||||
}) {
|
||||
ForEach([this.titleIndex, this.contentIndex, this.buttonIndex], (index: number) => {
|
||||
if (index === this.titleIndex) {
|
||||
this.titleBuilder();
|
||||
WithTheme({ theme: this.theme, colorMode: this.themeColorMode }) {
|
||||
this.titleBuilder();
|
||||
}
|
||||
} else if (index === this.contentIndex) {
|
||||
Column() {
|
||||
this.contentBuilder();
|
||||
WithTheme({ theme: this.theme, colorMode: this.themeColorMode }) {
|
||||
this.contentBuilder();
|
||||
}
|
||||
}.padding(this.getContentPadding())
|
||||
} else {
|
||||
this.ButtonBuilder();
|
||||
WithTheme({ theme: this.theme, colorMode: this.themeColorMode }) {
|
||||
this.ButtonBuilder();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -97,21 +97,21 @@ const segmentButtonTheme = {
|
||||
FOCUS_BORDER_COLOR: {
|
||||
"id": -1,
|
||||
"type": 10001,
|
||||
params: ["sys.color.ohos_id_color_focused_outline"],
|
||||
params: ['sys.color.ohos_id_color_focused_outline'],
|
||||
"bundleName": "__harDefaultBundleName__",
|
||||
"moduleName": "__harDefaultModuleName__"
|
||||
},
|
||||
HOVER_COLOR: {
|
||||
"id": -1,
|
||||
"type": 10001,
|
||||
params: ["sys.color.ohos_id_color_hover"],
|
||||
params: ['sys.color.ohos_id_color_hover'],
|
||||
"bundleName": "__harDefaultBundleName__",
|
||||
"moduleName": "__harDefaultModuleName__"
|
||||
},
|
||||
PRESS_COLOR: {
|
||||
"id": -1,
|
||||
"type": 10001,
|
||||
params: ["sys.color.ohos_id_color_click_effect"],
|
||||
params: ['sys.color.ohos_id_color_click_effect'],
|
||||
"bundleName": "__harDefaultBundleName__",
|
||||
"moduleName": "__harDefaultModuleName__"
|
||||
},
|
||||
@ -134,18 +134,18 @@ SegmentButtonItemOptions = __decorate([
|
||||
], SegmentButtonItemOptions);
|
||||
let SegmentButtonItemOptionsArray = SegmentButtonItemOptionsArray_1 = class SegmentButtonItemOptionsArray extends Array {
|
||||
constructor(a48) {
|
||||
super(typeof a48 === "number" ? a48 : 0);
|
||||
super(typeof a48 === 'number' ? a48 : 0);
|
||||
this.changeStartIndex = void 0;
|
||||
this.deleteCount = void 0;
|
||||
this.addLength = void 0;
|
||||
if (typeof a48 !== "number" && a48 !== void 0) {
|
||||
if (typeof a48 !== 'number' && a48 !== void 0) {
|
||||
super.push(...a48.map((c48) => new SegmentButtonItemOptions(c48)));
|
||||
}
|
||||
}
|
||||
|
||||
push(...x47) {
|
||||
if (this.length + x47.length > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).");
|
||||
console.warn('Exceeded the maximum number of elements (5).');
|
||||
return this.length;
|
||||
}
|
||||
this.changeStartIndex = this.length;
|
||||
@ -156,7 +156,7 @@ let SegmentButtonItemOptionsArray = SegmentButtonItemOptionsArray_1 = class Segm
|
||||
|
||||
pop() {
|
||||
if (this.length <= MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).");
|
||||
console.warn('Below the minimum number of elements (2).');
|
||||
return void 0;
|
||||
}
|
||||
this.changeStartIndex = this.length - 1;
|
||||
@ -167,7 +167,7 @@ let SegmentButtonItemOptionsArray = SegmentButtonItemOptionsArray_1 = class Segm
|
||||
|
||||
shift() {
|
||||
if (this.length <= MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).");
|
||||
console.warn('Below the minimum number of elements (2).');
|
||||
return void 0;
|
||||
}
|
||||
this.changeStartIndex = 0;
|
||||
@ -178,7 +178,7 @@ let SegmentButtonItemOptionsArray = SegmentButtonItemOptionsArray_1 = class Segm
|
||||
|
||||
unshift(...u47) {
|
||||
if (this.length + u47.length > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).");
|
||||
console.warn('Exceeded the maximum number of elements (5).');
|
||||
return this.length;
|
||||
}
|
||||
if (u47.length > 0) {
|
||||
@ -193,11 +193,11 @@ let SegmentButtonItemOptionsArray = SegmentButtonItemOptionsArray_1 = class Segm
|
||||
let t47 = (this.length - r47) < 0 ? 0 : (this.length - r47);
|
||||
t47 += s47.length;
|
||||
if (t47 < MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).");
|
||||
console.warn('Below the minimum number of elements (2).');
|
||||
return [];
|
||||
}
|
||||
if (t47 > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).");
|
||||
console.warn('Exceeded the maximum number of elements (5).');
|
||||
return [];
|
||||
}
|
||||
this.changeStartIndex = q47;
|
||||
@ -249,7 +249,7 @@ let SegmentButtonOptions = SegmentButtonOptions_1 = class SegmentButtonOptions {
|
||||
this.localizedButtonPadding = l47.localizedButtonPadding;
|
||||
this.direction = l47.direction ?? Direction.Auto;
|
||||
this.buttons = new SegmentButtonItemOptionsArray(l47.buttons);
|
||||
if (this.type === "capsule") {
|
||||
if (this.type === 'capsule') {
|
||||
this.multiply = l47.multiply ?? false;
|
||||
this.buttons.forEach(n47 => {
|
||||
this.showText ||= n47.text !== void 0;
|
||||
@ -271,7 +271,7 @@ let SegmentButtonOptions = SegmentButtonOptions_1 = class SegmentButtonOptions {
|
||||
|
||||
static tab(k47) {
|
||||
return new SegmentButtonOptions_1({
|
||||
type: "tab",
|
||||
type: 'tab',
|
||||
buttons: k47.buttons,
|
||||
fontColor: k47.fontColor,
|
||||
selectedFontColor: k47.selectedFontColor,
|
||||
@ -293,7 +293,7 @@ let SegmentButtonOptions = SegmentButtonOptions_1 = class SegmentButtonOptions {
|
||||
|
||||
static capsule(j47) {
|
||||
return new SegmentButtonOptions_1({
|
||||
type: "capsule",
|
||||
type: 'capsule',
|
||||
buttons: j47.buttons,
|
||||
multiply: j47.multiply,
|
||||
fontColor: j47.fontColor,
|
||||
@ -747,7 +747,7 @@ class SegmentButtonItem extends ViewPU {
|
||||
this.__options = new SynchedPropertyNesedObjectPU(q43.options, this, "options");
|
||||
this.__property = new SynchedPropertyNesedObjectPU(q43.property, this, "property");
|
||||
this.__index = new SynchedPropertySimpleOneWayPU(q43.index, this, "index");
|
||||
this.groupId = "";
|
||||
this.groupId = '';
|
||||
this.setInitiallyProvidedValue(q43);
|
||||
this.finalizeConstruction();
|
||||
}
|
||||
@ -873,7 +873,6 @@ class SegmentButtonItem extends ViewPU {
|
||||
this.observeComponentCreation2((f43, g43) => {
|
||||
Image.create(this.property.isSelected ? this.itemOptions.selectedIcon : this.itemOptions.icon);
|
||||
Image.direction(this.options.direction);
|
||||
Image.matchTextDirection(this.options.direction == Direction.Ltr ? false : true);
|
||||
Image.size(this.options.imageSize ?? { width: 24, height: 24 });
|
||||
Image.focusable(!this.options.showText);
|
||||
Image.draggable(false);
|
||||
@ -2007,7 +2006,7 @@ export class SegmentButton extends ViewPU {
|
||||
}
|
||||
|
||||
isMovedFromPanGestureStartPoint(a35, b35) {
|
||||
return!nearEqual(a35, this.panGestureStartPoint.x) || !nearEqual(b35, this.panGestureStartPoint.y);
|
||||
return !nearEqual(a35, this.panGestureStartPoint.x) || !nearEqual(b35, this.panGestureStartPoint.y);
|
||||
}
|
||||
|
||||
isShouldMirror() {
|
||||
|
@ -45,9 +45,9 @@ const segmentButtonTheme: SegmentButtonThemeInterface = {
|
||||
BACKGROUND_COLOR: $r('sys.color.ohos_id_color_button_normal'),
|
||||
TAB_SELECTED_BACKGROUND_COLOR: $r('sys.color.ohos_id_color_foreground_contrary'),
|
||||
CAPSULE_SELECTED_BACKGROUND_COLOR: $r('sys.color.ohos_id_color_emphasize'),
|
||||
FOCUS_BORDER_COLOR: $r("sys.color.ohos_id_color_focused_outline"),
|
||||
HOVER_COLOR: $r("sys.color.ohos_id_color_hover"),
|
||||
PRESS_COLOR: $r("sys.color.ohos_id_color_click_effect"),
|
||||
FOCUS_BORDER_COLOR: $r('sys.color.ohos_id_color_focused_outline'),
|
||||
HOVER_COLOR: $r('sys.color.ohos_id_color_hover'),
|
||||
PRESS_COLOR: $r('sys.color.ohos_id_color_click_effect'),
|
||||
BACKGROUND_BLUR_STYLE: BlurStyle.NONE
|
||||
}
|
||||
|
||||
@ -111,11 +111,11 @@ export interface CapsuleSegmentButtonConstructionOptions extends CommonSegmentBu
|
||||
}
|
||||
|
||||
export interface TabSegmentButtonOptions extends TabSegmentButtonConstructionOptions {
|
||||
type: "tab",
|
||||
type: 'tab',
|
||||
}
|
||||
|
||||
export interface CapsuleSegmentButtonOptions extends CapsuleSegmentButtonConstructionOptions {
|
||||
type: "capsule"
|
||||
type: 'capsule'
|
||||
}
|
||||
|
||||
interface SegmentButtonItemOptionsConstructorOptions {
|
||||
@ -149,9 +149,9 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
constructor(elementsOrLength: SegmentButtonItemTuple | number) {
|
||||
|
||||
super(typeof elementsOrLength === "number" ? elementsOrLength : 0);
|
||||
super(typeof elementsOrLength === 'number' ? elementsOrLength : 0);
|
||||
|
||||
if (typeof elementsOrLength !== "number" && elementsOrLength !== void 0) {
|
||||
if (typeof elementsOrLength !== 'number' && elementsOrLength !== void 0) {
|
||||
super.push(...elementsOrLength.map((element?: SegmentButtonTextItem | SegmentButtonIconItem |
|
||||
SegmentButtonIconTextItem) => new SegmentButtonItemOptions(element as
|
||||
SegmentButtonItemOptionsConstructorOptions)))
|
||||
@ -160,7 +160,7 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
push(...items: SegmentButtonItemArray): number {
|
||||
if (this.length + items.length > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).")
|
||||
console.warn('Exceeded the maximum number of elements (5).')
|
||||
return this.length
|
||||
}
|
||||
this.changeStartIndex = this.length
|
||||
@ -172,7 +172,7 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
pop() {
|
||||
if (this.length <= MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).")
|
||||
console.warn('Below the minimum number of elements (2).')
|
||||
return void 0
|
||||
}
|
||||
this.changeStartIndex = this.length - 1
|
||||
@ -183,7 +183,7 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
shift() {
|
||||
if (this.length <= MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).")
|
||||
console.warn('Below the minimum number of elements (2).')
|
||||
return void 0
|
||||
}
|
||||
this.changeStartIndex = 0
|
||||
@ -194,7 +194,7 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
unshift(...items: SegmentButtonItemArray): number {
|
||||
if (this.length + items.length > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).")
|
||||
console.warn('Exceeded the maximum number of elements (5).')
|
||||
return this.length
|
||||
}
|
||||
if (items.length > 0) {
|
||||
@ -210,11 +210,11 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
let length = (this.length - deleteCount) < 0 ? 0 : (this.length - deleteCount)
|
||||
length += items.length
|
||||
if (length < MIN_ITEM_COUNT) {
|
||||
console.warn("Below the minimum number of elements (2).")
|
||||
console.warn('Below the minimum number of elements (2).')
|
||||
return []
|
||||
}
|
||||
if (length > MAX_ITEM_COUNT) {
|
||||
console.warn("Exceeded the maximum number of elements (5).")
|
||||
console.warn('Exceeded the maximum number of elements (5).')
|
||||
return []
|
||||
}
|
||||
this.changeStartIndex = start
|
||||
@ -230,7 +230,7 @@ export class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOption
|
||||
|
||||
@Observed
|
||||
export class SegmentButtonOptions {
|
||||
public type: "tab" | "capsule"
|
||||
public type: 'tab' | 'capsule'
|
||||
public multiply: boolean = false
|
||||
public fontColor: ResourceColor
|
||||
public selectedFontColor: ResourceColor
|
||||
@ -285,7 +285,7 @@ export class SegmentButtonOptions {
|
||||
this.localizedButtonPadding = options.localizedButtonPadding
|
||||
this.direction = options.direction ?? Direction.Auto
|
||||
this.buttons = new SegmentButtonItemOptionsArray(options.buttons)
|
||||
if (this.type === "capsule") {
|
||||
if (this.type === 'capsule') {
|
||||
this.multiply = (options as CapsuleSegmentButtonOptions).multiply ?? false
|
||||
this.buttons.forEach(button => {
|
||||
this.showText ||= button.text !== void 0
|
||||
@ -306,7 +306,7 @@ export class SegmentButtonOptions {
|
||||
|
||||
static tab(options: TabSegmentButtonConstructionOptions): SegmentButtonOptions {
|
||||
return new SegmentButtonOptions({
|
||||
type: "tab",
|
||||
type: 'tab',
|
||||
buttons: options.buttons,
|
||||
fontColor: options.fontColor,
|
||||
selectedFontColor: options.selectedFontColor,
|
||||
@ -328,7 +328,7 @@ export class SegmentButtonOptions {
|
||||
|
||||
static capsule(options: CapsuleSegmentButtonConstructionOptions): SegmentButtonOptions {
|
||||
return new SegmentButtonOptions({
|
||||
type: "capsule",
|
||||
type: 'capsule',
|
||||
buttons: options.buttons,
|
||||
multiply: options.multiply,
|
||||
fontColor: options.fontColor,
|
||||
@ -465,7 +465,7 @@ struct SegmentButtonItem {
|
||||
@ObjectLink options: SegmentButtonOptions;
|
||||
@ObjectLink property: ItemProperty
|
||||
@Prop index: number
|
||||
private groupId: string = ""
|
||||
private groupId: string = ''
|
||||
|
||||
private getTextPadding(): Padding | Dimension | LocalizedPadding {
|
||||
if (this.options.localizedTextPadding) {
|
||||
@ -505,7 +505,6 @@ struct SegmentButtonItem {
|
||||
if (this.options.showIcon) {
|
||||
Image(this.property.isSelected ? this.itemOptions.selectedIcon : this.itemOptions.icon)
|
||||
.direction(this.options.direction)
|
||||
.matchTextDirection(this.options.direction == Direction.Ltr ? false : true)
|
||||
.size(this.options.imageSize ?? { width: 24, height: 24 })
|
||||
.focusable(!this.options.showText)
|
||||
.draggable(false)
|
||||
@ -1017,7 +1016,7 @@ export struct SegmentButton {
|
||||
}
|
||||
|
||||
private isMovedFromPanGestureStartPoint(x: number, y: number) {
|
||||
return!nearEqual(x, this.panGestureStartPoint.x) || !nearEqual(y, this.panGestureStartPoint.y)
|
||||
return !nearEqual(x, this.panGestureStartPoint.x) || !nearEqual(y, this.panGestureStartPoint.y)
|
||||
}
|
||||
|
||||
private isShouldMirror(): boolean {
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_splitlayout_abc_start[];
|
||||
extern const char _binary_splitlayout_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_SplitLayout_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_SplitLayout_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_splitlayout_abc_start;
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_subheader_abc_start[];
|
||||
extern const char _binary_subheader_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_SubHeader_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_SubHeader_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_subheader_abc_start;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,6 @@ import { BusinessError } from '@ohos.base';
|
||||
import hilog from '@ohos.hilog';
|
||||
import common from '@ohos.app.ability.common';
|
||||
|
||||
const INDEX_ZERO: number = 0;
|
||||
const INDEX_ONE: number = 1;
|
||||
const INDEX_TWO: number = 2;
|
||||
// 行数及整体高度
|
||||
const SINGLE_LINE_NUM: number = 1;
|
||||
@ -47,6 +45,12 @@ const LOADING_SIZE: number = 24;
|
||||
const PADDING_LEVEL_2: number = 4;
|
||||
const MAX_RIGHT_WIDTH: Length = '34%';
|
||||
const MIN_FONT_SIZE: number = 1.75;
|
||||
const MIN_HOT_AREA_LENGTH: number = 40;
|
||||
const MULTI_ICON_REGION_WIDTH: number = 36;
|
||||
const ICON_REGION_X: number = -9;
|
||||
const ICON_REGION_Y: number = -8;
|
||||
const SINGLE_ICON_REGION_X: number = -12;
|
||||
const SINGLE_ICON_NUMBER: number = 1;
|
||||
|
||||
export enum OperationType {
|
||||
TEXT_ARROW = 0,
|
||||
@ -209,6 +213,34 @@ export struct SubHeader {
|
||||
})
|
||||
}
|
||||
|
||||
@Styles
|
||||
private rightAreaClickEvent() {
|
||||
.onClick(() => {
|
||||
if ((this.operationType === OperationType.TEXT_ARROW || this.operationType === OperationType.BUTTON) &&
|
||||
this.operationItem && this.operationItem.length > 0 && this.operationItem[0].action) {
|
||||
this.operationItem[0].action();
|
||||
}
|
||||
})
|
||||
.onTouch((event) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
if (this.operationType === OperationType.TEXT_ARROW) {
|
||||
this.textArrowBgColor = $r('sys.color.interactive_pressed');
|
||||
}
|
||||
if (this.operationType === OperationType.BUTTON) {
|
||||
this.buttonBgColor = $r('sys.color.interactive_pressed');
|
||||
}
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
if (this.operationType === OperationType.TEXT_ARROW) {
|
||||
this.textArrowBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
if (this.operationType === OperationType.BUTTON) {
|
||||
this.buttonBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async aboutToAppear(): Promise<void> {
|
||||
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
|
||||
this.fontSize = context.config?.fontSizeScale ?? 1;
|
||||
@ -251,6 +283,7 @@ export struct SubHeader {
|
||||
})
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.width('100%')
|
||||
.rightAreaClickEvent()
|
||||
}
|
||||
.constraintSize({ minHeight: this.getMinHeight() })
|
||||
.margin(this.contentMargin ?? this.subHeaderMargin)
|
||||
@ -267,8 +300,14 @@ export struct SubHeader {
|
||||
this.rightArea();
|
||||
}
|
||||
.justifyContent(FlexAlign.End)
|
||||
.constraintSize({ maxWidth: this.getMaxWidth() })
|
||||
.alignItems(VerticalAlign.Bottom)
|
||||
.constraintSize({
|
||||
maxWidth: this.getRightAreaMaxWidth(),
|
||||
minWidth: this.getRightAreaMinWidth(),
|
||||
minHeight: MIN_HOT_AREA_LENGTH,
|
||||
})
|
||||
.flexShrink(0)
|
||||
.rightAreaClickEvent()
|
||||
}
|
||||
.constraintSize({ minHeight: this.getMinHeight() })
|
||||
.margin(this.contentMargin ?? this.subHeaderMargin)
|
||||
@ -302,7 +341,7 @@ export struct SubHeader {
|
||||
})
|
||||
}
|
||||
|
||||
private getMaxWidth(): Length {
|
||||
private getRightAreaMaxWidth(): Length {
|
||||
if (this.operationType === OperationType.ICON_GROUP && (this.operationItem && this.operationItem.length > 0)) {
|
||||
return '100%';
|
||||
} else {
|
||||
@ -310,6 +349,13 @@ export struct SubHeader {
|
||||
}
|
||||
}
|
||||
|
||||
private getRightAreaMinWidth(): Length {
|
||||
if (this.operationItem && this.operationItem.length > 0) {
|
||||
return MIN_HOT_AREA_LENGTH;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private getMinHeight(): Length {
|
||||
if (this.secondaryTitle && this.icon) {
|
||||
return SINGLE_LINE_HEIGHT;
|
||||
@ -583,19 +629,6 @@ export struct SubHeader {
|
||||
this.buttonBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
})
|
||||
.onTouch((event) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.buttonBgColor = $r('sys.color.interactive_pressed');
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.buttonBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
})
|
||||
.onClick((event) => {
|
||||
if (button.action) {
|
||||
button.action();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.focusable(true)
|
||||
@ -699,19 +732,6 @@ export struct SubHeader {
|
||||
this.textArrowBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
})
|
||||
.onTouch((event) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.textArrowBgColor = $r('sys.color.interactive_pressed');
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.textArrowBgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
})
|
||||
.onClick((event) => {
|
||||
if (textArrow.action) {
|
||||
textArrow.action();
|
||||
}
|
||||
})
|
||||
}
|
||||
.attributeModifier(this.subHeaderModifier)
|
||||
.focusable(true)
|
||||
@ -725,9 +745,9 @@ export struct SubHeader {
|
||||
@Builder
|
||||
IconGroupStyle(operationItem: Array<OperationOption>): void {
|
||||
Row() {
|
||||
ForEach(operationItem, (item: OperationOption, index?: number) => {
|
||||
ForEach(operationItem, (item: OperationOption, index: number) => {
|
||||
if (Util.isResourceType(item.value)) {
|
||||
if (index === INDEX_ZERO) {
|
||||
if (index <= INDEX_TWO) {
|
||||
SingleIconStyle({
|
||||
item: {
|
||||
iconOptions: {
|
||||
@ -736,18 +756,8 @@ export struct SubHeader {
|
||||
this.operationSymbolOptions[index] : null,
|
||||
},
|
||||
action: item.action,
|
||||
}
|
||||
})
|
||||
} else if (index === INDEX_ONE || index === INDEX_TWO) {
|
||||
SingleIconStyle({
|
||||
item: {
|
||||
action: item.action,
|
||||
iconOptions: {
|
||||
icon: item.value as Resource,
|
||||
symbolicIconOption: this.operationSymbolOptions && this.operationSymbolOptions.length > index ?
|
||||
this.operationSymbolOptions[index] : null,
|
||||
},
|
||||
}
|
||||
},
|
||||
isSingleIcon: this.operationItem?.length === SINGLE_ICON_NUMBER,
|
||||
})
|
||||
.margin({
|
||||
start: LengthMetrics.resource($r('sys.float.padding_level4')),
|
||||
@ -756,13 +766,10 @@ export struct SubHeader {
|
||||
// 最大支持3个ICON,此场景不支持
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
.justifyContent(FlexAlign.End)
|
||||
.focusable(true)
|
||||
.margin({
|
||||
start: LengthMetrics.resource($r('sys.float.padding_level4')),
|
||||
})
|
||||
}
|
||||
|
||||
@Builder
|
||||
@ -805,6 +812,7 @@ struct SingleIconStyle {
|
||||
@State isFocus: boolean = false;
|
||||
item: ContentIconOption | null = null;
|
||||
@Consume subHeaderTheme: SubHeaderTheme;
|
||||
isSingleIcon: boolean = true;
|
||||
|
||||
build() {
|
||||
if (this.item && this.item.iconOptions) {
|
||||
@ -851,6 +859,7 @@ struct SingleIconStyle {
|
||||
this.bgColor = $r('sys.color.ohos_id_color_sub_background_transparent');
|
||||
}
|
||||
})
|
||||
.responseRegion(this.iconResponseRegion())
|
||||
.onClick((event) => {
|
||||
if (this.item?.action) {
|
||||
this.item?.action();
|
||||
@ -859,6 +868,13 @@ struct SingleIconStyle {
|
||||
}
|
||||
}
|
||||
|
||||
private iconResponseRegion(): Rectangle {
|
||||
if (this.isSingleIcon) {
|
||||
return { x: SINGLE_ICON_REGION_X, y: ICON_REGION_Y, width: MIN_HOT_AREA_LENGTH, height: MIN_HOT_AREA_LENGTH };
|
||||
}
|
||||
return { x: ICON_REGION_X, y: ICON_REGION_Y, width: MULTI_ICON_REGION_WIDTH, height: MIN_HOT_AREA_LENGTH };
|
||||
}
|
||||
|
||||
private fontSizeValue(item: ContentIconOption): Length {
|
||||
return item.iconOptions?.symbolicIconOption?.fontSize ?
|
||||
Util.symbolFontSize(item.iconOptions?.symbolicIconOption?.fontSize) : RIGHT_SINGLE_ICON_SIZE
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_swiperefresher_abc_start[];
|
||||
extern const char _binary_swiperefresher_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_SwipeRefresher_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_SwipeRefresher_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_swiperefresher_abc_start;
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_tabtitlebar_abc_start[];
|
||||
extern const char _binary_tabtitlebar_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_TabTitleBar_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_TabTitleBar_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_tabtitlebar_abc_start;
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_toolbar_abc_start[];
|
||||
extern const char _binary_toolbar_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_ToolBar_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_ToolBar_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_toolbar_abc_start;
|
||||
|
@ -22,8 +22,8 @@ extern const char _binary_treeview_abc_start[];
|
||||
extern const char _binary_treeview_abc_end[];
|
||||
|
||||
// Napi get abc code function
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_arkui_advanced_TreeView_GetABCCode(const char **buf, int *buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_arkui_advanced_TreeView_GetABCCode(
|
||||
const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_treeview_abc_start;
|
||||
|
@ -297,8 +297,8 @@ napi_value ExportMovingPhoto(napi_env env, napi_value exports)
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_multimedia_movingphotoview_GetJSCode(const char** buf, int* bufLen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_multimedia_movingphotoview_GetJSCode(
|
||||
const char** buf, int* bufLen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_multimedia_movingphotoview_js_start;
|
||||
@ -310,8 +310,8 @@ void NAPI_multimedia_movingphotoview_GetJSCode(const char** buf, int* bufLen)
|
||||
}
|
||||
|
||||
// multimedia_movingphotoview JS register
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_multimedia_movingphotoview_GetABCCode(const char** buf, int* buflen)
|
||||
extern "C" __attribute__((visibility("default"))) void NAPI_multimedia_movingphotoview_GetABCCode(
|
||||
const char** buf, int* buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_multimedia_movingphotoview_abc_start;
|
||||
|
@ -79,21 +79,25 @@ void MovingPhotoPattern::OnAttachToFrameNode()
|
||||
CHECK_NULL_VOID(context);
|
||||
auto uiTaskExecutor = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::UI);
|
||||
controller_->SetStartPlaybackImpl([weak = WeakClaim(this), uiTaskExecutor]() {
|
||||
uiTaskExecutor.PostTask([weak]() {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->StartPlayback();
|
||||
}, "ArkUIMovingPhotoStart");
|
||||
uiTaskExecutor.PostTask(
|
||||
[weak]() {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->StartPlayback();
|
||||
},
|
||||
"ArkUIMovingPhotoStart");
|
||||
});
|
||||
|
||||
controller_->SetStopPlaybackImpl([weak = WeakClaim(this), uiTaskExecutor]() {
|
||||
uiTaskExecutor.PostTask([weak]() {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->StopPlayback();
|
||||
}, "ArkUIMovingPhotoStop");
|
||||
uiTaskExecutor.PostTask(
|
||||
[weak]() {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->StopPlayback();
|
||||
},
|
||||
"ArkUIMovingPhotoStop");
|
||||
});
|
||||
|
||||
RegisterVisibleAreaChange();
|
||||
@ -239,14 +243,16 @@ void MovingPhotoPattern::UpdateVideoNode()
|
||||
auto pipelineContext = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
auto uiTaskExecutor = SingleTaskExecutor::Make(pipelineContext->GetTaskExecutor(), TaskExecutor::TaskType::UI);
|
||||
uiTaskExecutor.PostTask([weak = WeakClaim(this)]() {
|
||||
auto movingPhotoPattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(movingPhotoPattern);
|
||||
ContainerScope scope(movingPhotoPattern->instanceId_);
|
||||
movingPhotoPattern->PrepareMediaPlayer();
|
||||
movingPhotoPattern->UpdateMediaPlayerSpeed();
|
||||
movingPhotoPattern->UpdateMediaPlayerMuted();
|
||||
}, "ArkUIMovingPhotoUpdateVideo");
|
||||
uiTaskExecutor.PostTask(
|
||||
[weak = WeakClaim(this)]() {
|
||||
auto movingPhotoPattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(movingPhotoPattern);
|
||||
ContainerScope scope(movingPhotoPattern->instanceId_);
|
||||
movingPhotoPattern->PrepareMediaPlayer();
|
||||
movingPhotoPattern->UpdateMediaPlayerSpeed();
|
||||
movingPhotoPattern->UpdateMediaPlayerMuted();
|
||||
},
|
||||
"ArkUIMovingPhotoUpdateVideo");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::PrepareMediaPlayer()
|
||||
@ -275,11 +281,13 @@ void MovingPhotoPattern::PrepareMediaPlayer()
|
||||
auto context = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(this)] {
|
||||
auto movingPhotoPattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(movingPhotoPattern);
|
||||
movingPhotoPattern->ResetMediaPlayer();
|
||||
}, "ArkUIMovingPhotoPrepare");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(this)] {
|
||||
auto movingPhotoPattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(movingPhotoPattern);
|
||||
movingPhotoPattern->ResetMediaPlayer();
|
||||
},
|
||||
"ArkUIMovingPhotoPrepare");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::ResetMediaPlayer()
|
||||
@ -294,12 +302,14 @@ void MovingPhotoPattern::ResetMediaPlayer()
|
||||
CHECK_NULL_VOID(context);
|
||||
|
||||
auto uiTaskExecutor = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::UI);
|
||||
uiTaskExecutor.PostTask([weak = WeakClaim(this)] {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->FireMediaPlayerError();
|
||||
}, "ArkUIMovingPhotoReset");
|
||||
uiTaskExecutor.PostTask(
|
||||
[weak = WeakClaim(this)] {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
ContainerScope scope(pattern->instanceId_);
|
||||
pattern->FireMediaPlayerError();
|
||||
},
|
||||
"ArkUIMovingPhotoReset");
|
||||
return;
|
||||
}
|
||||
RegisterMediaPlayerEvent();
|
||||
@ -565,7 +575,8 @@ SizeF MovingPhotoPattern::GetRawImageSize()
|
||||
return imagePattern->GetRawImageSize();
|
||||
}
|
||||
|
||||
SizeF MovingPhotoPattern::MeasureContentLayout(const SizeF& layoutSize, const RefPtr<MovingPhotoLayoutProperty>& layoutProperty)
|
||||
SizeF MovingPhotoPattern::MeasureContentLayout(const SizeF& layoutSize,
|
||||
const RefPtr<MovingPhotoLayoutProperty>& layoutProperty)
|
||||
{
|
||||
if (!layoutProperty || !layoutProperty->HasVideoSize()) {
|
||||
return layoutSize;
|
||||
@ -811,11 +822,13 @@ void MovingPhotoPattern::Start()
|
||||
CHECK_NULL_VOID(context);
|
||||
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Play();
|
||||
}, "ArkUIMovingPhotoStartPlay");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Play();
|
||||
},
|
||||
"ArkUIMovingPhotoStartPlay");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::Pause()
|
||||
@ -829,11 +842,13 @@ void MovingPhotoPattern::Pause()
|
||||
CHECK_NULL_VOID(context);
|
||||
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Pause();
|
||||
}, "ArkUIMovingPhotoPausePlay");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Pause();
|
||||
},
|
||||
"ArkUIMovingPhotoPausePlay");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::Stop()
|
||||
@ -847,11 +862,13 @@ void MovingPhotoPattern::Stop()
|
||||
CHECK_NULL_VOID(context);
|
||||
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Stop();
|
||||
}, "ArkUIMovingPhotoStopPlay");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Stop();
|
||||
},
|
||||
"ArkUIMovingPhotoStopPlay");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::Seek(int32_t position)
|
||||
@ -865,11 +882,13 @@ void MovingPhotoPattern::Seek(int32_t position)
|
||||
CHECK_NULL_VOID(context);
|
||||
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_)), pos = position] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Seek(pos, SeekMode::SEEK_PREVIOUS_SYNC);
|
||||
}, "ArkUIMovingPhotoSeek");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_)), pos = position] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->Seek(pos, SeekMode::SEEK_PREVIOUS_SYNC);
|
||||
},
|
||||
"ArkUIMovingPhotoSeek");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::UpdateMediaPlayerSpeed()
|
||||
@ -882,11 +901,13 @@ void MovingPhotoPattern::UpdateMediaPlayerSpeed()
|
||||
auto context = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->SetPlaybackSpeed(static_cast<float>(NORMAL_PLAY_SPEED));
|
||||
}, "ArkUIMovingPhotoUpdateSpeed");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_))] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->SetPlaybackSpeed(static_cast<float>(NORMAL_PLAY_SPEED));
|
||||
},
|
||||
"ArkUIMovingPhotoUpdateSpeed");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::UpdateMediaPlayerMuted()
|
||||
@ -900,11 +921,13 @@ void MovingPhotoPattern::UpdateMediaPlayerMuted()
|
||||
auto context = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
auto platformTask = SingleTaskExecutor::Make(context->GetTaskExecutor(), TaskExecutor::TaskType::BACKGROUND);
|
||||
platformTask.PostTask([weak = WeakClaim(RawPtr(mediaPlayer_)), videoVolume = volume] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->SetVolume(videoVolume, videoVolume);
|
||||
}, "ArkUIMovingPhotoUpdateMuted");
|
||||
platformTask.PostTask(
|
||||
[weak = WeakClaim(RawPtr(mediaPlayer_)), videoVolume = volume] {
|
||||
auto mediaPlayer = weak.Upgrade();
|
||||
CHECK_NULL_VOID(mediaPlayer);
|
||||
mediaPlayer->SetVolume(videoVolume, videoVolume);
|
||||
},
|
||||
"ArkUIMovingPhotoUpdateMuted");
|
||||
}
|
||||
|
||||
void MovingPhotoPattern::OnAreaChangedInner()
|
||||
|
@ -66,6 +66,12 @@ constexpr int32_t ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR = 106103;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_ADAPTER_NO_LISTENER_ERROR = 106104;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_ADAPTER_EXIST = 106105;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_ADAPTER_CHILD_NODE_EXIST = 106106;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_EVENT_PARAM_INDEX_OUT_OF_RANGE = 106107;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_EVENT_PARAM_INVALID = 106108;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_EVENT_NO_RETURN = 106109;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_NODE_INDEX_INVALID = 106200;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_GET_INFO_FAILED = 106201;
|
||||
constexpr int32_t ERROR_CODE_NATIVE_IMPL_BUFFER_SIZE_ERROR = 106202;
|
||||
|
||||
// AI error for Canvas,XComponent
|
||||
constexpr int32_t ERROR_CODE_AI_ANALYSIS_UNSUPPORTED = 110001;
|
||||
|
@ -127,6 +127,7 @@ Matrix4 Matrix4::QuaternionToMatrix(double x, double y, double z, double w)
|
||||
y /= norm;
|
||||
z /= norm;
|
||||
|
||||
// Quaternion to matrix operation wiki:reference/apis-arkui/js-apis-matrix4.md.
|
||||
return Matrix4(1.0 - 2.0 * (y * y + z * z), 2.0 * (x * y - w * z), 2.0 * (x * z + w * y), 0.0,
|
||||
2.0 * (x * y + w * z), 1.0 - 2.0 * (x * x + z * z), 2.0 * (y * z - w * x), 0.0,
|
||||
2.0 * (x * z - w * y), 2.0 * (y * z + w * x), 1.0 - 2.0 * (x * x + y * y), 0.0,
|
||||
|
@ -55,7 +55,7 @@ void Cross3(float out[3], const float a[3], const float b[3])
|
||||
// Returns false if the matrix cannot be normalized.
|
||||
bool Normalize(Matrix4& m)
|
||||
{
|
||||
if (NearZero(m.Get(3, 3))) {
|
||||
if (NearZero(m.Get(3, 3), epsilon)) {
|
||||
return false;
|
||||
}
|
||||
float scale = 1.0f / m.Get(3, 3);
|
||||
@ -84,7 +84,7 @@ Matrix4 BuildTranslationMatrix(const DecomposedTransform& decomp)
|
||||
float dx = decomp.translate[0];
|
||||
float dy = decomp.translate[1];
|
||||
float dz = decomp.translate[2];
|
||||
if (NearZero(dx) && NearZero(dy) && NearZero(dz)) {
|
||||
if (NearZero(dx, epsilon) && NearZero(dy, epsilon) && NearZero(dz, epsilon)) {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ RotateOperation RotateOperation::Blend(const RotateOperation& to, const RotateOp
|
||||
ret.dy = to.dy;
|
||||
ret.dz = to.dz;
|
||||
// rotate vector is (0,0,0) is error
|
||||
if (NearZero(ret.dx) && NearZero(ret.dy) && NearZero(ret.dz)) {
|
||||
if (NearZero(ret.dx, epsilon) && NearZero(ret.dy, epsilon) && NearZero(ret.dz, epsilon)) {
|
||||
ret.dx = from.dx;
|
||||
ret.dy = from.dy;
|
||||
ret.dz = from.dz;
|
||||
@ -493,8 +493,8 @@ bool TransformUtil::DecomposeTransform(DecomposedTransform& out, const Matrix4&
|
||||
perspectiveMatrix.Set(3, i, 0.0);
|
||||
}
|
||||
perspectiveMatrix.Set(3, 3, 1.0);
|
||||
|
||||
if (!NearZero(matrix.Get(3, 0)) || !NearZero(matrix.Get(3, 1)) || !NearZero(matrix.Get(3, 2))) {
|
||||
if (!NearZero(matrix.Get(3, 0), epsilon) || !NearZero(matrix.Get(3, 1), epsilon) ||
|
||||
!NearZero(matrix.Get(3, 2), epsilon)) {
|
||||
double rhs[4] = { matrix.Get(3, 0), matrix.Get(3, 1), matrix.Get(3, 2), matrix.Get(3, 3) };
|
||||
|
||||
Matrix4 inversePerspectiveMatrix = Matrix4::Invert(perspectiveMatrix);
|
||||
@ -528,7 +528,7 @@ bool TransformUtil::DecomposeTransform(DecomposedTransform& out, const Matrix4&
|
||||
|
||||
// Compute X scale factor and normalize first column.
|
||||
out.scale[0] = Length3(column[0]);
|
||||
if (!NearZero(out.scale[0])) {
|
||||
if (!NearZero(out.scale[0], epsilon)) {
|
||||
column[0][0] /= out.scale[0];
|
||||
column[0][1] /= out.scale[0];
|
||||
column[0][2] /= out.scale[0];
|
||||
@ -540,7 +540,7 @@ bool TransformUtil::DecomposeTransform(DecomposedTransform& out, const Matrix4&
|
||||
|
||||
// Now, compute Y scale and normalize 2nd column.
|
||||
out.scale[1] = Length3(column[1]);
|
||||
if (!NearZero(out.scale[1])) {
|
||||
if (!NearZero(out.scale[1], epsilon)) {
|
||||
column[1][0] /= out.scale[1];
|
||||
column[1][1] /= out.scale[1];
|
||||
column[1][2] /= out.scale[1];
|
||||
@ -555,7 +555,7 @@ bool TransformUtil::DecomposeTransform(DecomposedTransform& out, const Matrix4&
|
||||
|
||||
// Next, get Z scale and normalize the 3rd column.
|
||||
out.scale[2] = Length3(column[2]);
|
||||
if (!NearZero(out.scale[2])) {
|
||||
if (!NearZero(out.scale[2], epsilon)) {
|
||||
column[2][0] /= out.scale[2];
|
||||
column[2][1] /= out.scale[2];
|
||||
column[2][2] /= out.scale[2];
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include "base/geometry/quaternion.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
namespace {
|
||||
constexpr double epsilon = 0.000001;
|
||||
}
|
||||
struct ACE_EXPORT TranslateOperation {
|
||||
TranslateOperation() = default;
|
||||
TranslateOperation(Dimension dx, Dimension dy, Dimension dz = Dimension {}) : dx(dx), dy(dy), dz(dz) {}
|
||||
@ -44,7 +46,6 @@ struct ACE_EXPORT ScaleOperation {
|
||||
ScaleOperation(float x, float y, float z) : scaleX(x), scaleY(y), scaleZ(z) {}
|
||||
bool operator==(const ScaleOperation& other) const
|
||||
{
|
||||
constexpr double epsilon = 0.0001;
|
||||
return NearEqual(scaleX, other.scaleX, epsilon) && NearEqual(scaleY, other.scaleY, epsilon) &&
|
||||
NearEqual(scaleZ, other.scaleZ, epsilon);
|
||||
}
|
||||
@ -60,7 +61,7 @@ struct ACE_EXPORT SkewOperation {
|
||||
SkewOperation(float x, float y) : skewX(x), skewY(y) {}
|
||||
bool operator==(const SkewOperation& other) const
|
||||
{
|
||||
return NearEqual(skewX, other.skewX) && NearEqual(skewY, other.skewY);
|
||||
return NearEqual(skewX, other.skewX, epsilon) && NearEqual(skewY, other.skewY, epsilon);
|
||||
}
|
||||
float skewX = 0.0f;
|
||||
float skewY = 0.0f;
|
||||
@ -73,8 +74,8 @@ struct ACE_EXPORT RotateOperation {
|
||||
RotateOperation(float x, float y, float z, float angle) : dx(x), dy(y), dz(z), angle(angle) {}
|
||||
bool operator==(const RotateOperation& other) const
|
||||
{
|
||||
return NearEqual(dx, other.dx) && NearEqual(dy, other.dy) && NearEqual(dz, other.dz) &&
|
||||
NearEqual(angle, other.angle);
|
||||
return NearEqual(dx, other.dx, epsilon) && NearEqual(dy, other.dy, epsilon) &&
|
||||
NearEqual(dz, other.dz, epsilon) && NearEqual(angle, other.angle, epsilon);
|
||||
}
|
||||
float dx = 0.0f;
|
||||
float dy = 0.0f;
|
||||
|
@ -33,6 +33,8 @@
|
||||
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetSvgTraceEnabled(), fmt, ##__VA_ARGS__)
|
||||
#define ACE_TEXT_SCOPED_TRACE(fmt, ...) \
|
||||
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetTextTraceEnabled(), fmt, ##__VA_ARGS__)
|
||||
#define ACE_SYNTAX_SCOPED_TRACE(fmt, ...) \
|
||||
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetSyntaxTraceEnabled(), fmt, ##__VA_ARGS__)
|
||||
#define ACE_ACCESS_SCOPED_TRACE(fmt, ...) \
|
||||
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetAccessTraceEnabled(), fmt, ##__VA_ARGS__)
|
||||
#define ACE_LAYOUT_SCOPED_TRACE(fmt, ...) \
|
||||
|
@ -191,6 +191,7 @@ enum AceLogTag : uint8_t {
|
||||
ACE_WINDOW, // C0394E
|
||||
ACE_LIBUV, // C0394F
|
||||
ACE_SECURITYUIEXTENSION, // C03950
|
||||
ACE_INPUTKEYFLOW, // C03951
|
||||
|
||||
FORM_RENDER = 255, // C039FF FormRenderer
|
||||
END = 256, // Last one, do not use
|
||||
|
@ -125,6 +125,9 @@ public:
|
||||
|
||||
// window title bar closed
|
||||
static constexpr char APP_EXIT_FROM_WINDOW_TITLE_BAR_CLOSED[] = "APP_EXIT_FROM_WINDOW_TITLE_BAR_CLOSED";
|
||||
|
||||
// PC start app from other
|
||||
static constexpr char LAUNCHER_APP_LAUNCH_FROM_OTHER[] = "LAUNCHER_APP_LAUNCH_FROM_OTHER";
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // ARKUI_PERF_SCENE_ID_H
|
||||
|
@ -524,7 +524,8 @@ bool PerfMonitor::IsExceptResponseTime(int64_t time, const std::string& sceneId)
|
||||
PerfConstants::PC_EXIT_RECENT, PerfConstants::PC_SHORTCUT_TO_APP_CENTER_ON_RECENT,
|
||||
PerfConstants::PC_SHORTCUT_TO_APP_CENTER, PerfConstants::PC_SHORTCUT_EXIT_APP_CENTER,
|
||||
PerfConstants::WINDOW_TITLE_BAR_MINIMIZED,
|
||||
PerfConstants::APP_EXIT_FROM_WINDOW_TITLE_BAR_CLOSED
|
||||
PerfConstants::APP_EXIT_FROM_WINDOW_TITLE_BAR_CLOSED,
|
||||
PerfConstants::LAUNCHER_APP_LAUNCH_FROM_OTHER
|
||||
};
|
||||
if (exceptSceneSet.find(sceneId) != exceptSceneSet.end()) {
|
||||
return true;
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset) = 0;
|
||||
virtual void ShowMenuNG(std::function<void()>&& buildFunc, std::function<void()>&& previewBuildFunc,
|
||||
const NG::MenuParam& menuParam, const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset) = 0;
|
||||
virtual bool ShowPreviewNG() = 0;
|
||||
virtual void HidePreviewNG() = 0;
|
||||
virtual bool ShowDragPreviewWindowNG() = 0;
|
||||
virtual void HideDragPreviewWindowNG() = 0;
|
||||
virtual void HideMenuNG(const RefPtr<NG::FrameNode>& menu, int32_t targetId) = 0;
|
||||
virtual void HideMenuNG(bool showPreviewAnimation = true, bool startDrag = false) = 0;
|
||||
virtual void UpdateHideMenuOffsetNG(const NG::OffsetF& offset = NG::OffsetF(0.0f, 0.0f),
|
||||
|
@ -193,7 +193,7 @@ Rect SubwindowManager::GetParentWindowRect()
|
||||
return currentSubwindow_->GetParentWindowRect();
|
||||
}
|
||||
|
||||
RefPtr<Subwindow> SubwindowManager::ShowPreviewNG()
|
||||
RefPtr<Subwindow> SubwindowManager::ShowDragPreviewWindowNG()
|
||||
{
|
||||
auto containerId = Container::CurrentId();
|
||||
auto subwindow =
|
||||
@ -204,7 +204,7 @@ RefPtr<Subwindow> SubwindowManager::ShowPreviewNG()
|
||||
CHECK_NULL_RETURN(subwindow->GetIsRosenWindowCreate(), nullptr);
|
||||
AddSubwindow(containerId, subwindow);
|
||||
}
|
||||
if (!subwindow->ShowPreviewNG()) {
|
||||
if (!subwindow->ShowDragPreviewWindowNG()) {
|
||||
return nullptr;
|
||||
}
|
||||
return subwindow;
|
||||
@ -246,11 +246,11 @@ void SubwindowManager::ShowMenuNG(std::function<void()>&& buildFunc, std::functi
|
||||
subwindow->ShowMenuNG(std::move(buildFunc), std::move(previewBuildFunc), menuParam, targetNode, offset);
|
||||
}
|
||||
|
||||
void SubwindowManager::HidePreviewNG()
|
||||
void SubwindowManager::HideDragPreviewWindowNG()
|
||||
{
|
||||
auto subwindow = GetCurrentWindow();
|
||||
if (subwindow) {
|
||||
subwindow->HidePreviewNG();
|
||||
subwindow->HideDragPreviewWindowNG();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
const RefPtr<Subwindow>& GetCurrentWindow();
|
||||
Rect GetParentWindowRect();
|
||||
|
||||
RefPtr<Subwindow> ShowPreviewNG();
|
||||
void HidePreviewNG();
|
||||
RefPtr<Subwindow> ShowDragPreviewWindowNG();
|
||||
void HideDragPreviewWindowNG();
|
||||
void ShowMenu(const RefPtr<Component>& newComponent);
|
||||
void ShowMenuNG(const RefPtr<NG::FrameNode>& menuNode, const NG::MenuParam& menuParam,
|
||||
const RefPtr<NG::FrameNode>& targetNode, const NG::OffsetF& offset);
|
||||
|
@ -293,6 +293,11 @@ public:
|
||||
return textTraceEnable_;
|
||||
}
|
||||
|
||||
static bool GetSyntaxTraceEnabled()
|
||||
{
|
||||
return syntaxTraceEnable_;
|
||||
}
|
||||
|
||||
static bool GetAccessTraceEnabled()
|
||||
{
|
||||
return accessTraceEnable_;
|
||||
@ -548,6 +553,7 @@ private:
|
||||
static bool syncDebugTraceEnable_;
|
||||
static bool pixelRoundEnable_;
|
||||
static bool textTraceEnable_;
|
||||
static bool syntaxTraceEnable_;
|
||||
static bool accessTraceEnable_;
|
||||
static bool accessibilityEnabled_;
|
||||
static uint32_t canvasDebugMode_;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/common/thread_checker.h"
|
||||
#include "frameworks/bridge/common/utils/utils.h"
|
||||
#include "frameworks/bridge/declarative_frontend/ng/page_router_manager_factory.h"
|
||||
#include "frameworks/core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
@ -48,7 +49,7 @@ bool CardFrontendDeclarative::Initialize(FrontendType type, const RefPtr<TaskExe
|
||||
|
||||
void CardFrontendDeclarative::InitializeDelegate(const RefPtr<TaskExecutor>& taskExecutor)
|
||||
{
|
||||
auto pageRouterManager = AceType::MakeRefPtr<NG::PageRouterManager>();
|
||||
auto pageRouterManager = NG::PageRouterManagerFactory::CreateManager();
|
||||
delegate_ = AceType::MakeRefPtr<Framework::CardFrontendDelegateDeclarative>(taskExecutor);
|
||||
delegate_->SetPageRouterManager(pageRouterManager);
|
||||
}
|
||||
|
@ -254,6 +254,16 @@ void FfiOHOSAceFrameworkViewAbstractSetHeight(double height, int32_t unit)
|
||||
ViewAbstractModel::GetInstance()->SetHeight(value);
|
||||
}
|
||||
|
||||
void FFISetWidthWithEmpty()
|
||||
{
|
||||
ViewAbstractModel::GetInstance()->ClearWidthOrHeight(true);
|
||||
}
|
||||
|
||||
void FFISetHeightWithEmpty()
|
||||
{
|
||||
ViewAbstractModel::GetInstance()->ClearWidthOrHeight(false);
|
||||
}
|
||||
|
||||
void FfiOHOSAceFrameworkViewAbstractSetSize(double width, int32_t widthUnit, double height, int32_t heightUnit)
|
||||
{
|
||||
Dimension widthDime(width, static_cast<DimensionUnit>(widthUnit));
|
||||
|
@ -399,6 +399,9 @@ CJ_EXPORT void FFIOHOSAceFrameworkGroupDefaultFocus(bool isGroupDefaultFocus);
|
||||
CJ_EXPORT void FFIOHOSAceFrameworkFocusOnTouch(bool isFocusOnTouch);
|
||||
CJ_EXPORT bool FFIOHOSAceFrameworkRequestFocus(const char* inspectorKey);
|
||||
|
||||
CJ_EXPORT void FFISetWidthWithEmpty();
|
||||
CJ_EXPORT void FFISetHeightWithEmpty();
|
||||
|
||||
struct CJContentCoverOptions {
|
||||
uint32_t modalTransition;
|
||||
NativeOptionUInt32 backgroundColor;
|
||||
|
@ -383,6 +383,11 @@ void FfiOHOSAceFrameworkWebUserAgent(const std::string& userAgent)
|
||||
WebModel::GetInstance()->SetUserAgent(userAgent);
|
||||
}
|
||||
|
||||
void FfiOHOSAceFrameworkWebBackgroundColor(uint32_t color)
|
||||
{
|
||||
WebModel::GetInstance()->SetBackgroundColor(Color(color));
|
||||
}
|
||||
|
||||
void OnCommonDialog(bool (*callback)(FfiWebEvent event), int64_t dialogEventType)
|
||||
{
|
||||
auto instanceId = Container::CurrentId();
|
||||
|
@ -72,6 +72,7 @@ CJ_EXPORT void FfiOHOSAceFrameworkWebGeolocationAccessEnabled(bool isGeolocation
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkWebVerticalScrollBarAccessEnabled(bool isVerticalScrollBarAccess);
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkNestedScroll(int32_t nestedScrollNum, int32_t scrollBackwardNum);
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkWebUserAgent(const std::string& userAgent);
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkWebBackgroundColor(uint32_t color);
|
||||
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkWebOnAlert(bool (*callback)(FfiWebEvent event));
|
||||
CJ_EXPORT void FfiOHOSAceFrameworkWebOnPageStart(void (*callback)(const char* url));
|
||||
|
@ -45,6 +45,17 @@ template("declarative_frontend") {
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_split_mode && defined(vender_configs.ace_advanced_split_mode)) {
|
||||
include_dirs += vender_configs.ace_advanced_split_mode_dirs
|
||||
}
|
||||
|
||||
if (enable_split_mode &&
|
||||
defined(vender_configs.ace_advanced_split_mode_bridge)) {
|
||||
sources += vender_configs.ace_engine_advanced_split_mode_bridge
|
||||
} else {
|
||||
sources += [ "ng/page_router_manager_factory.cpp" ]
|
||||
}
|
||||
|
||||
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
|
||||
external_deps = [
|
||||
"ets_runtime:libark_jsruntime",
|
||||
@ -501,6 +512,7 @@ template("declarative_js_engine") {
|
||||
if (defined(vendor_configs.ace_engine_advanced)) {
|
||||
include_dirs += vendor_configs.ace_advance_dirs
|
||||
sources += vendor_configs.ace_engine_advanced_jsview
|
||||
external_deps += vendor_configs.ace_engine_ext_jsview_deps
|
||||
} else {
|
||||
sources += [ "jsview/js_cached_image.cpp" ]
|
||||
}
|
||||
|
@ -227,8 +227,8 @@ declare class ArkComponent implements CommonMethod<CommonAttribute> {
|
||||
pixelStretchEffect(options: PixelStretchEffectOptions): this;
|
||||
keyboardShortcut(value: string | FunctionKey, keys: Array<ModifierKey>, action?: () => void): this;
|
||||
accessibilityGroup(value: boolean): this;
|
||||
accessibilityText(value: string): this;
|
||||
accessibilityDescription(value: string): this;
|
||||
accessibilityText(value: string | Resource): this;
|
||||
accessibilityDescription(value: string | Resource): this;
|
||||
accessibilityLevel(value: string): this;
|
||||
obscured(reasons: Array<ObscuredReasons>): this;
|
||||
reuseId(id: string): this;
|
||||
@ -655,8 +655,8 @@ declare class ArkSpanComponent implements CommonMethod<SpanAttribute> {
|
||||
pixelStretchEffect(options: PixelStretchEffectOptions): this;
|
||||
keyboardShortcut(value: string | FunctionKey, keys: Array<ModifierKey>, action?: () => void): this;
|
||||
accessibilityGroup(value: boolean): this;
|
||||
accessibilityText(value: string): this;
|
||||
accessibilityDescription(value: string): this;
|
||||
accessibilityText(value: string | Resource): this;
|
||||
accessibilityDescription(value: string | Resource): this;
|
||||
accessibilityLevel(value: string): this;
|
||||
obscured(reasons: Array<ObscuredReasons>): this;
|
||||
reuseId(id: string): this;
|
||||
@ -1702,8 +1702,8 @@ declare class ArkXComponentComponent implements CommonMethod<XComponentAttribute
|
||||
pixelStretchEffect(options: PixelStretchEffectOptions): this;
|
||||
keyboardShortcut(value: string | FunctionKey, keys: ModifierKey[], action?: () => void): this;
|
||||
accessibilityGroup(value: boolean): this;
|
||||
accessibilityText(value: string): this;
|
||||
accessibilityDescription(value: string): this;
|
||||
accessibilityText(value: string | Resource): this;
|
||||
accessibilityDescription(value: string | Resource): this;
|
||||
accessibilityLevel(value: string): this;
|
||||
obscured(reasons: ObscuredReasons[]): this;
|
||||
reuseId(id: string): this;
|
||||
@ -1857,6 +1857,7 @@ declare class ArkTabsComponent extends ArkComponent implements TabsAttribute {
|
||||
barBackgroundBlurStyle(value: BlurStyle): TabsAttribute;
|
||||
barGridAlign(value: BarGridColumnOptions): TabsAttribute;
|
||||
clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute): this;
|
||||
edgeEffect(value: EdgeEffect): TabsAttribute;
|
||||
}
|
||||
declare class ArkTabContentComponent extends ArkComponent implements TabContentAttribute {
|
||||
constructor(nativePtr: KNode, classType?: ModifierType);
|
||||
|
@ -52,7 +52,7 @@ class ArkButtonComponent extends ArkComponent implements ButtonAttribute {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonCreateTypeModifier.identity, ButtonCreateTypeModifier, false);
|
||||
}
|
||||
if (value.length === 1) {
|
||||
if (isObject(value[0])) {
|
||||
if (!isNull(value[0]) && isObject(value[0])) {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonOptionsModifier.identity, ButtonOptionsModifier, value[0]);
|
||||
} else if (isResource(value[0]) || isString(value[0])) {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonLabelModifier.identity, ButtonLabelModifier, value[0]);
|
||||
|
@ -82,6 +82,34 @@ class RichEditorCaretColorModifier extends ModifierWithKey<ResourceColor> {
|
||||
}
|
||||
}
|
||||
|
||||
class RichEditorOnSubmitModifier extends ModifierWithKey<SubmitCallback> {
|
||||
constructor(value: SubmitCallback) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('richEditorOnSubmit');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetOnSubmit(node);
|
||||
} else {
|
||||
getUINativeModule().richEditor.setOnSubmit(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RichEditorAboutToIMEInputModifier extends ModifierWithKey<(value: RichEditorInsertValue) => boolean> {
|
||||
constructor(value: (value: RichEditorInsertValue) => boolean) {
|
||||
super(value);
|
||||
}
|
||||
static identity = Symbol('richEditorAboutToIMEInput');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetAboutToIMEInput(node);
|
||||
} else {
|
||||
getUINativeModule().richEditor.setAboutToIMEInput(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RichEditorOnReadyModifier extends ModifierWithKey<() => void> {
|
||||
constructor(value: () => void) {
|
||||
super(value);
|
||||
@ -223,8 +251,13 @@ class ArkRichEditorComponent extends ArkComponent implements CommonMethod<RichEd
|
||||
onSelect(callback: (value: RichEditorSelection) => void): RichEditorAttribute {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
onSubmit(callback: SubmitCallback): RichEditorAttribute {
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorOnSubmitModifier.identity, RichEditorOnSubmitModifier, callback);
|
||||
return this;
|
||||
}
|
||||
aboutToIMEInput(callback: (value: RichEditorInsertValue) => boolean): RichEditorAttribute {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorAboutToIMEInputModifier.identity, RichEditorAboutToIMEInputModifier, callback);
|
||||
return this;
|
||||
}
|
||||
onIMEInputComplete(callback: (value: RichEditorTextSpanResult) => void): RichEditorAttribute {
|
||||
throw new Error('Method not implemented.');
|
||||
|
@ -257,6 +257,90 @@ class ScrollInitializeModifier extends ModifierWithKey<Scroller> {
|
||||
}
|
||||
}
|
||||
}
|
||||
class ScrollOnScrollStartModifier extends ModifierWithKey<() => void> {
|
||||
constructor(value: () => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnScrollStart');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollStart(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollStart(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollOnScrollEndModifier extends ModifierWithKey<() => void> {
|
||||
constructor(value: () => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnScrollEnd');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollEnd(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollEnd(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollOnScrollStopModifier extends ModifierWithKey<() => void> {
|
||||
constructor(value: () => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnScrollStop');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollStop(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollStop(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollOnScrollModifier extends ModifierWithKey<(xOffset: number, yOffset: number) => void> {
|
||||
constructor(value: (xOffset: number, yOffset: number) => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnScroll');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollModifier(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollModifier(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollOnScrollEdgeModifier extends ModifierWithKey<(side: Edge) => void> {
|
||||
constructor(value: (side: Edge) => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnScrollEdge');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollEdge(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollEdge(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollOnDidScrollModifier extends ModifierWithKey<(xOffset: number,
|
||||
yOffset: number, scrollState: ScrollState) => void> {
|
||||
constructor(value: (xOffset: number, yOffset: number, scrollState: ScrollState) => void) {
|
||||
super(value);
|
||||
}
|
||||
static identity: Symbol = Symbol('scrollOnDidScroll');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnDidScroll(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnDidScroll(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ArkScrollComponent extends ArkComponent implements ScrollAttribute {
|
||||
constructor(nativePtr: KNode, classType?: ModifierType) {
|
||||
@ -276,19 +360,24 @@ class ArkScrollComponent extends ArkComponent implements ScrollAttribute {
|
||||
return this;
|
||||
}
|
||||
onScroll(event: (xOffset: number, yOffset: number) => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollModifier.identity, ScrollOnScrollModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollEdge(event: (side: Edge) => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollEdgeModifier.identity, ScrollOnScrollEdgeModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollStart(event: () => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollStartModifier.identity, ScrollOnScrollStartModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollEnd(event: () => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollEndModifier.identity, ScrollOnScrollEndModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollStop(event: () => void): this {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollStopModifier.identity, ScrollOnScrollStopModifier, event);
|
||||
return this;
|
||||
}
|
||||
enablePaging(value: boolean): this {
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollEnablePagingModifier.identity, ScrollEnablePagingModifier, value);
|
||||
@ -320,6 +409,12 @@ class ArkScrollComponent extends ArkComponent implements ScrollAttribute {
|
||||
onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number; }): this {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
onDidScroll(callback: (xOffset: number, yOffset: number, scrollState: ScrollState) => void): this {
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnDidScrollModifier.identity, ScrollOnDidScrollModifier, callback);
|
||||
return this;
|
||||
}
|
||||
|
||||
nestedScroll(value: NestedScrollOptions): ScrollAttribute {
|
||||
let options = new ArkNestedScrollOptions();
|
||||
if (value) {
|
||||
|
@ -423,6 +423,20 @@ class TabClipModifier extends ModifierWithKey<boolean | object> {
|
||||
}
|
||||
}
|
||||
|
||||
class TabEdgeEffectModifier extends ModifierWithKey<EdgeEffect> {
|
||||
static identity: Symbol = Symbol('tabedgeEffect');
|
||||
applyPeer(node: KNode, reset: boolean): void {
|
||||
if (reset) {
|
||||
getUINativeModule().tabs.resetTabEdgeEffect(node);
|
||||
} else {
|
||||
getUINativeModule().tabs.setTabEdgeEffect(node, this.value);
|
||||
}
|
||||
}
|
||||
checkObjectDiff(): boolean {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
class TabWidthModifier extends ModifierWithKey<Length> {
|
||||
constructor(value: Length) {
|
||||
super(value);
|
||||
|
@ -396,6 +396,7 @@ class RenderNode {
|
||||
private scaleValue: Vector2;
|
||||
private shadowColorValue: number;
|
||||
private shadowOffsetValue: Vector2;
|
||||
private labelValue: string;
|
||||
private shadowAlphaValue: number;
|
||||
private shadowElevationValue: number;
|
||||
private shadowRadiusValue: number;
|
||||
@ -430,6 +431,7 @@ class RenderNode {
|
||||
this.scaleValue = { x: 1.0, y: 1.0 };
|
||||
this.shadowColorValue = 0;
|
||||
this.shadowOffsetValue = { x: 0, y: 0 };
|
||||
this.labelValue = '';
|
||||
this.shadowAlphaValue = 0;
|
||||
this.shadowElevationValue = 0;
|
||||
this.shadowRadiusValue = 0;
|
||||
@ -523,6 +525,10 @@ class RenderNode {
|
||||
}
|
||||
getUINativeModule().renderNode.setShadowOffset(this.nodePtr, this.shadowOffsetValue.x, this.shadowOffsetValue.y, this.lengthMetricsUnitValue);
|
||||
}
|
||||
set label(label: string) {
|
||||
this.labelValue = this.checkUndefinedOrNullWithDefaultValue<string>(label, '');
|
||||
getUINativeModule().renderNode.setLabel(this.nodePtr, this.labelValue);
|
||||
}
|
||||
set shadowAlpha(alpha: number) {
|
||||
this.shadowAlphaValue = this.checkUndefinedOrNullWithDefaultValue<number>(alpha, 0);
|
||||
getUINativeModule().renderNode.setShadowAlpha(this.nodePtr, this.shadowAlphaValue);
|
||||
@ -618,6 +624,9 @@ class RenderNode {
|
||||
get shadowOffset(): Vector2 {
|
||||
return this.shadowOffsetValue;
|
||||
}
|
||||
get label(): string {
|
||||
return this.labelValue;
|
||||
}
|
||||
get shadowAlpha(): number {
|
||||
return this.shadowAlphaValue;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "core/common/thread_checker.h"
|
||||
#include "core/components/navigator/navigator_component.h"
|
||||
#include "frameworks/bridge/card_frontend/form_frontend_delegate_declarative.h"
|
||||
#include "frameworks/bridge/declarative_frontend/ng/page_router_manager_factory.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
namespace {
|
||||
|
||||
@ -603,7 +605,7 @@ void DeclarativeFrontend::InitializeFrontendDelegate(const RefPtr<TaskExecutor>&
|
||||
return jsEngine->PreloadNamedRouter(name, std::move(loadFinishCallback));
|
||||
};
|
||||
|
||||
auto pageRouterManager = AceType::MakeRefPtr<NG::PageRouterManager>();
|
||||
auto pageRouterManager = NG::PageRouterManagerFactory::CreateManager();
|
||||
pageRouterManager->SetLoadJsCallback(std::move(loadPageCallback));
|
||||
pageRouterManager->SetLoadJsByBufferCallback(std::move(loadPageByBufferCallback));
|
||||
pageRouterManager->SetLoadNamedRouterCallback(std::move(loadNamedRouterCallback));
|
||||
|
@ -7413,6 +7413,34 @@ class RichEditorCaretColorModifier extends ModifierWithKey {
|
||||
}
|
||||
RichEditorCaretColorModifier.identity = Symbol('richEditorCaretColor');
|
||||
|
||||
class RichEditorOnSubmitModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetOnSubmit(node);
|
||||
} else {
|
||||
getUINativeModule().richEditor.setOnSubmit(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
RichEditorOnSubmitModifier.identity = Symbol('richEditorOnSubmit');
|
||||
|
||||
class RichEditorAboutToIMEInputModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().richEditor.resetAboutToIMEInput(node);
|
||||
} else {
|
||||
getUINativeModule().richEditor.setAboutToIMEInput(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
RichEditorAboutToIMEInputModifier.identity = Symbol('richEditorAboutToIMEInput');
|
||||
|
||||
class RichEditorSelectedBackgroundColorModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
@ -7575,8 +7603,13 @@ class ArkRichEditorComponent extends ArkComponent {
|
||||
onSelect(callback) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
onSubmit(callback) {
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorOnSubmitModifier.identity, RichEditorOnSubmitModifier, callback);
|
||||
return this;
|
||||
}
|
||||
aboutToIMEInput(callback) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, RichEditorAboutToIMEInputModifier.identity, RichEditorAboutToIMEInputModifier, callback);
|
||||
return this;
|
||||
}
|
||||
onIMEInputComplete(callback) {
|
||||
throw new Error('Method not implemented.');
|
||||
@ -14968,7 +15001,7 @@ class ArkButtonComponent extends ArkComponent {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonCreateTypeModifier.identity, ButtonCreateTypeModifier, false);
|
||||
}
|
||||
if (value.length === 1) {
|
||||
if (isObject(value[0])) {
|
||||
if (!isNull(value[0]) && isObject(value[0])) {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonOptionsModifier.identity, ButtonOptionsModifier, value[0]);
|
||||
} else if (isResource(value[0]) || isString(value[0])) {
|
||||
modifierWithKey(this._modifiersWithKeys, ButtonLabelModifier.identity, ButtonLabelModifier, value[0]);
|
||||
@ -15977,6 +16010,91 @@ class ScrollInitializeModifier extends ModifierWithKey {
|
||||
}
|
||||
}
|
||||
ScrollInitializeModifier.identity = Symbol('scrollInitialize');
|
||||
|
||||
class ScrollOnScrollStartModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollStart(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollStart(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnScrollStartModifier.identity = Symbol('scrollOnScrollStart');
|
||||
|
||||
class ScrollOnScrollEndModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollEnd(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollEnd(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnScrollEndModifier.identity = Symbol('scrollOnScrollEnd');
|
||||
|
||||
class ScrollOnScrollStopModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollStop(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollStop(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnScrollStopModifier.identity = Symbol('scrollOnScrollStop');
|
||||
|
||||
class ScrollOnScrollModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScroll(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScroll(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnScrollModifier.identity = Symbol('scrollOnScroll');
|
||||
|
||||
class ScrollOnScrollEdgeModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnScrollEdge(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnScrollEdge(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnScrollEdgeModifier.identity = Symbol('scrollOnScrollEdge');
|
||||
|
||||
class ScrollOnDidScrollModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
}
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().scroll.resetScrollOnDidScroll(node);
|
||||
} else {
|
||||
getUINativeModule().scroll.setScrollOnDidScroll(node, this.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollOnDidScrollModifier.identity = Symbol('scrollOnDidScroll');
|
||||
|
||||
class ArkScrollComponent extends ArkComponent {
|
||||
constructor(nativePtr, classType) {
|
||||
super(nativePtr, classType);
|
||||
@ -15995,19 +16113,24 @@ class ArkScrollComponent extends ArkComponent {
|
||||
return this;
|
||||
}
|
||||
onScroll(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollModifier.identity, ScrollOnScrollModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollEdge(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollEdgeModifier.identity, ScrollOnScrollEdgeModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollStart(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollStartModifier.identity, ScrollOnScrollStartModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollEnd(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollEndModifier.identity, ScrollOnScrollEndModifier, event);
|
||||
return this;
|
||||
}
|
||||
onScrollStop(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnScrollStopModifier.identity, ScrollOnScrollStopModifier, event);
|
||||
return this;
|
||||
}
|
||||
scrollBar(value) {
|
||||
if (value in BarState) {
|
||||
@ -16036,6 +16159,12 @@ class ArkScrollComponent extends ArkComponent {
|
||||
onScrollFrameBegin(event) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
onDidScroll(callback) {
|
||||
modifierWithKey(this._modifiersWithKeys, ScrollOnDidScrollModifier.identity, ScrollOnDidScrollModifier, callback);
|
||||
return this;
|
||||
}
|
||||
|
||||
nestedScroll(value) {
|
||||
let options = new ArkNestedScrollOptions();
|
||||
if (value) {
|
||||
@ -26114,6 +26243,19 @@ class TabClipModifier extends ModifierWithKey {
|
||||
}
|
||||
}
|
||||
TabClipModifier.identity = Symbol('tabclip');
|
||||
class TabEdgeEffectModifier extends ModifierWithKey {
|
||||
applyPeer(node, reset) {
|
||||
if (reset) {
|
||||
getUINativeModule().tabs.resetTabEdgeEffect(node);
|
||||
} else {
|
||||
getUINativeModule().tabs.setTabEdgeEffect(node, this.value);
|
||||
}
|
||||
}
|
||||
checkObjectDiff() {
|
||||
return !isBaseOrResourceEqual(this.stageValue, this.value);
|
||||
}
|
||||
}
|
||||
TabClipModifier.identity = Symbol('tabedgeEffect');
|
||||
class TabWidthModifier extends ModifierWithKey {
|
||||
constructor(value) {
|
||||
super(value);
|
||||
|
@ -64,7 +64,7 @@ var TextDataDetectorType;
|
||||
TextDataDetectorType[TextDataDetectorType["URL"] = 1] = "URL";
|
||||
TextDataDetectorType[TextDataDetectorType["EMAIL"] = 2] = "EMAIL";
|
||||
TextDataDetectorType[TextDataDetectorType["ADDRESS"] = 3] = "ADDRESS";
|
||||
TextDataDetectorType[TextDataDetectorType["DATETIME"] = 4] = "DATETIME";
|
||||
TextDataDetectorType[TextDataDetectorType["DATE_TIME"] = 4] = "DATE_TIME";
|
||||
})(TextDataDetectorType || (TextDataDetectorType = {}));
|
||||
|
||||
var DataPanelType;
|
||||
@ -1226,6 +1226,7 @@ var ProtectedResourceType;
|
||||
ProtectedResourceType["MidiSysex"] = "TYPE_MIDI_SYSEX";
|
||||
ProtectedResourceType["VIDEO_CAPTURE"] = "TYPE_VIDEO_CAPTURE";
|
||||
ProtectedResourceType["AUDIO_CAPTURE"] = "TYPE_AUDIO_CAPTURE";
|
||||
ProtectedResourceType["SENSORS"] = "TYPE_SENSORS";
|
||||
})(ProtectedResourceType || (ProtectedResourceType = {}));
|
||||
|
||||
var ProgressType;
|
||||
@ -1947,6 +1948,48 @@ class TransitionEffect {
|
||||
}
|
||||
}
|
||||
|
||||
class TextMenuItemId {
|
||||
id_ = '';
|
||||
|
||||
constructor(id) {
|
||||
this.id_ = id;
|
||||
}
|
||||
|
||||
static of(id) {
|
||||
return new TextMenuItemId(id);
|
||||
}
|
||||
|
||||
equals(id) {
|
||||
return id.id_ == this.id_;
|
||||
}
|
||||
|
||||
static get CUT() {
|
||||
return new TextMenuItemId('OH_DEFAULT_CUT');
|
||||
}
|
||||
|
||||
static get COPY() {
|
||||
return new TextMenuItemId('OH_DEFAULT_COPY');
|
||||
}
|
||||
|
||||
static get PASTE() {
|
||||
return new TextMenuItemId('OH_DEFAULT_PASTE');
|
||||
}
|
||||
|
||||
static get SELECT_ALL() {
|
||||
return new TextMenuItemId('OH_DEFAULT_SELECT_ALL');
|
||||
}
|
||||
|
||||
static get COLLABORATION_SERVICE() {
|
||||
return new TextMenuItemId('OH_DEFAULT_COLLABORATION_SERVICE');
|
||||
}
|
||||
|
||||
static get CAMERA_INPUT() {
|
||||
return new TextMenuItemId('OH_DEFAULT_CAMERA_INPUT');
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.TextMenuItemId = TextMenuItemId;
|
||||
|
||||
var SliderBlockType;
|
||||
(function (SliderBlockType) {
|
||||
SliderBlockType[SliderBlockType["DEFAULT"] = 0] = "DEFAULT";
|
||||
@ -2010,6 +2053,7 @@ var LaunchMode;
|
||||
LaunchMode[LaunchMode.STANDARD = 0] = "STANDARD";
|
||||
LaunchMode[LaunchMode.MOVE_TO_TOP_SINGLETON = 1] = "MOVE_TO_TOP_SINGLETON";
|
||||
LaunchMode[LaunchMode.POP_TO_SINGLETON = 2] = "POP_TO_SINGLETON";
|
||||
LaunchMode[LaunchMode.NEW_INSTANCE = 3] = "NEW_INSTANCE";
|
||||
})(LaunchMode || (LaunchMode = {}));
|
||||
|
||||
class NavPathInfo {
|
||||
@ -2019,6 +2063,7 @@ class NavPathInfo {
|
||||
this.onPop = onPop;
|
||||
this.index = -1;
|
||||
this.needUpdate = false;
|
||||
this.needBuildNewInstance = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2065,11 +2110,10 @@ class NavPathStack {
|
||||
for (let i = this.popArray.length - 1; i >= 0; i--) {
|
||||
if (name === this.popArray[i].name) {
|
||||
let info = this.popArray.splice(i, 1);
|
||||
this.pathArray[this.pathArray.length - 1].index = info[0].index;
|
||||
return;
|
||||
return info[0].index;
|
||||
}
|
||||
}
|
||||
this.pathArray[this.pathArray.length - 1].index = -1; // add new navdestination
|
||||
return -1; // add new navdestination
|
||||
}
|
||||
setNativeStack(stack) {
|
||||
this.nativeStack = stack;
|
||||
@ -2084,8 +2128,9 @@ class NavPathStack {
|
||||
return this.parentStack;
|
||||
}
|
||||
pushName(name, param) {
|
||||
this.pathArray.push(new NavPathInfo(name, param));
|
||||
this.findInPopArray(name);
|
||||
let info = new NavPathInfo(name, param);
|
||||
info.index = this.findInPopArray(name);
|
||||
this.pathArray.push(info);
|
||||
this.isReplace = 0;
|
||||
this.nativeStack?.onStateChanged();
|
||||
}
|
||||
@ -2093,12 +2138,14 @@ class NavPathStack {
|
||||
this.pushPath(info, animated);
|
||||
}
|
||||
pushPathByName(name, param, onPop, animated) {
|
||||
let info = undefined;
|
||||
if (onPop === undefined || typeof onPop === 'boolean') {
|
||||
this.pathArray.push(new NavPathInfo(name, param));
|
||||
info = new NavPathInfo(name, param);
|
||||
} else {
|
||||
this.pathArray.push(new NavPathInfo(name, param, onPop));
|
||||
info = new NavPathInfo(name, param, onPop);
|
||||
}
|
||||
this.findInPopArray(name);
|
||||
info.index = this.findInPopArray(name);
|
||||
this.pathArray.push(info);
|
||||
this.isReplace = 0;
|
||||
if (typeof onPop === 'boolean') {
|
||||
this.animated = onPop;
|
||||
@ -2116,7 +2163,6 @@ class NavPathStack {
|
||||
} else {
|
||||
info = new NavPathInfo(name, param, onPop);
|
||||
}
|
||||
this.pathArray.push(info);
|
||||
this.isReplace = 0;
|
||||
if (typeof onPop === 'boolean') {
|
||||
this.animated = onPop;
|
||||
@ -2128,12 +2174,12 @@ class NavPathStack {
|
||||
|
||||
let promise = this.nativeStack?.onPushDestination(info);
|
||||
if (!promise) {
|
||||
this.pathArray.pop();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: 'Internal error.', code: 100001 });
|
||||
})
|
||||
}
|
||||
this.findInPopArray(name);
|
||||
info.index = this.findInPopArray(name);
|
||||
this.pathArray.push(info);
|
||||
this.nativeStack?.onStateChanged();
|
||||
return promise;
|
||||
}
|
||||
@ -2181,9 +2227,11 @@ class NavPathStack {
|
||||
if (ret) {
|
||||
return;
|
||||
}
|
||||
info.index = this.findInPopArray(info.name);
|
||||
if (launchMode === LaunchMode.NEW_INSTANCE) {
|
||||
info.needBuildNewInstance = true;
|
||||
}
|
||||
this.pathArray.push(info);
|
||||
let name = this.pathArray[this.pathArray.length - 1].name;
|
||||
this.findInPopArray(name);
|
||||
this.isReplace = 0;
|
||||
this.animated = animated;
|
||||
this.nativeStack?.onStateChanged();
|
||||
@ -2194,18 +2242,19 @@ class NavPathStack {
|
||||
if (ret) {
|
||||
return promiseRet;
|
||||
}
|
||||
this.pathArray.push(info);
|
||||
this.isReplace = 0;
|
||||
this.animated = animated;
|
||||
let promise = this.nativeStack?.onPushDestination(info);
|
||||
if (!promise) {
|
||||
this.pathArray.pop();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: 'Internal error.', code: 100001 });
|
||||
})
|
||||
}
|
||||
let name = this.pathArray[this.pathArray.length - 1].name;
|
||||
this.findInPopArray(name);
|
||||
info.index = this.findInPopArray(info.name);
|
||||
if (launchMode === LaunchMode.NEW_INSTANCE) {
|
||||
info.needBuildNewInstance = true;
|
||||
}
|
||||
this.pathArray.push(info);
|
||||
this.nativeStack?.onStateChanged();
|
||||
return promise;
|
||||
}
|
||||
|
@ -88,25 +88,25 @@ class ComponentSnapshot {
|
||||
this.instanceId_ = instanceId;
|
||||
this.ohos_componentSnapshot = globalThis.requireNapi('arkui.componentSnapshot');
|
||||
}
|
||||
get(id, callback) {
|
||||
get(id, callback, options) {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
if (typeof callback === 'undefined') {
|
||||
let promise = this.ohos_componentSnapshot.get(id);
|
||||
if (typeof callback !== 'function') {
|
||||
let promise = this.ohos_componentSnapshot.get(id, callback);
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return promise;
|
||||
} else {
|
||||
this.ohos_componentSnapshot.get(id, callback);
|
||||
this.ohos_componentSnapshot.get(id, callback, options);
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
}
|
||||
createFromBuilder(builder, callback) {
|
||||
createFromBuilder(builder, callback, delay, checkImageStatus, options) {
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
if (typeof callback === 'undefined') {
|
||||
let promise = this.ohos_componentSnapshot.createFromBuilder(builder);
|
||||
if (typeof callback !== 'function') {
|
||||
let promise = this.ohos_componentSnapshot.createFromBuilder(builder, callback, delay, checkImageStatus);
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return promise;
|
||||
} else {
|
||||
this.ohos_componentSnapshot.createFromBuilder(builder, callback);
|
||||
this.ohos_componentSnapshot.createFromBuilder(builder, callback, delay, checkImageStatus, options);
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
}
|
||||
}
|
||||
@ -333,20 +333,20 @@ class UIContext {
|
||||
openBindSheet(content, options, targetId) {
|
||||
let paramErrMsg =
|
||||
'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.';
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
let argLength = arguments.length;
|
||||
if (argLength < 1 || content == null || content == undefined) {
|
||||
if (argLength < 1 || content === null || content === undefined) {
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: paramErrMsg, code: 401 });
|
||||
})
|
||||
});
|
||||
}
|
||||
if ((argLength >= 3 && (targetId == null || targetId == undefined))) {
|
||||
if ((argLength >= 3 && (targetId === null || targetId === undefined))) {
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: paramErrMsg, code: 401 });
|
||||
})
|
||||
});
|
||||
}
|
||||
let result_;
|
||||
if (argLength === 1) {
|
||||
@ -361,13 +361,16 @@ class UIContext {
|
||||
}
|
||||
|
||||
updateBindSheet(content, options, partialUpdate) {
|
||||
let paramErrMsg =
|
||||
'Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;' +
|
||||
' 2. Incorrect parameter types; 3. Parameter verification failed.';
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
let argLength = arguments.length;
|
||||
if (argLength < 2 || content == null || content == undefined) {
|
||||
if (argLength < 2 || content === null || content === undefined) {
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: 'Parameter error.', code: 401 });
|
||||
})
|
||||
reject({ message: paramErrMsg, code: 401 });
|
||||
});
|
||||
}
|
||||
let result_;
|
||||
if (argLength === 2) {
|
||||
@ -380,12 +383,15 @@ class UIContext {
|
||||
}
|
||||
|
||||
closeBindSheet(content) {
|
||||
let paramErrMsg =
|
||||
'Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;' +
|
||||
' 2. Incorrect parameter types; 3. Parameter verification failed.';
|
||||
__JSScopeUtil__.syncInstanceId(this.instanceId_);
|
||||
if (arguments.length < 1 || content == null || content == undefined) {
|
||||
if (arguments.length < 1 || content === null || content === undefined) {
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({ message: 'Parameter error.', code: 401 });
|
||||
})
|
||||
reject({ message: paramErrMsg, code: 401 });
|
||||
});
|
||||
}
|
||||
let result_ = Context.closeBindSheet(content.getNodePtr());
|
||||
__JSScopeUtil__.restoreInstanceId();
|
||||
|
@ -1614,6 +1614,7 @@ class RenderNode {
|
||||
this.scaleValue = { x: 1.0, y: 1.0 };
|
||||
this.shadowColorValue = 0;
|
||||
this.shadowOffsetValue = { x: 0, y: 0 };
|
||||
this.labelValue = '';
|
||||
this.shadowAlphaValue = 0;
|
||||
this.shadowElevationValue = 0;
|
||||
this.shadowRadiusValue = 0;
|
||||
@ -1712,6 +1713,10 @@ class RenderNode {
|
||||
}
|
||||
getUINativeModule().renderNode.setShadowOffset(this.nodePtr, this.shadowOffsetValue.x, this.shadowOffsetValue.y, this.lengthMetricsUnitValue);
|
||||
}
|
||||
set label(label) {
|
||||
this.labelValue = this.checkUndefinedOrNullWithDefaultValue(label, '');
|
||||
getUINativeModule().renderNode.setLabel(this.nodePtr, this.labelValue);
|
||||
}
|
||||
set shadowAlpha(alpha) {
|
||||
this.shadowAlphaValue = this.checkUndefinedOrNullWithDefaultValue(alpha, 0);
|
||||
getUINativeModule().renderNode.setShadowAlpha(this.nodePtr, this.shadowAlphaValue);
|
||||
@ -1811,6 +1816,9 @@ class RenderNode {
|
||||
get shadowOffset() {
|
||||
return this.shadowOffsetValue;
|
||||
}
|
||||
get label() {
|
||||
return this.labelValue;
|
||||
}
|
||||
get shadowAlpha() {
|
||||
return this.shadowAlphaValue;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ namespace OHOS::Ace::Framework {
|
||||
FUNCTION("selectedColorValue", SELECTED_COLOR_VALUE) \
|
||||
FUNCTION("selectedItemHeightValue", SELECTED_ITEM_HEIGHT_VALUE) \
|
||||
FUNCTION("selectedItemWidthValue", SELECTED_ITEM_WIDTH_VALUE) \
|
||||
FUNCTION("maxDisplayCountValue", MAX_DISPLAY_COUNT_VALUE) \
|
||||
FUNCTION("size", SIZE) \
|
||||
FUNCTION("slice", SLICE) \
|
||||
FUNCTION("source", SOURCE) \
|
||||
|
@ -1212,6 +1212,12 @@ bool JsiDeclarativeEngine::Initialize(const RefPtr<FrontendDelegate>& delegate)
|
||||
if (nativeEngine_ == nullptr) {
|
||||
nativeEngine_ = new ArkNativeEngine(vm, static_cast<void*>(this));
|
||||
}
|
||||
EngineTask(sharedRuntime);
|
||||
return result;
|
||||
}
|
||||
|
||||
void JsiDeclarativeEngine::EngineTask(bool sharedRuntime)
|
||||
{
|
||||
engineInstance_->SetNativeEngine(nativeEngine_);
|
||||
engineInstance_->InitJsObject();
|
||||
if (!sharedRuntime) {
|
||||
@ -1222,8 +1228,6 @@ bool JsiDeclarativeEngine::Initialize(const RefPtr<FrontendDelegate>& delegate)
|
||||
RegisterWorker();
|
||||
engineInstance_->RegisterFaPlugin();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void JsiDeclarativeEngine::SetPostTask(NativeEngine* nativeEngine)
|
||||
@ -1234,18 +1238,20 @@ void JsiDeclarativeEngine::SetPostTask(NativeEngine* nativeEngine)
|
||||
if (delegate == nullptr) {
|
||||
return;
|
||||
}
|
||||
delegate->PostJsTask([weakEngine, needSync, id]() {
|
||||
auto jsEngine = weakEngine.Upgrade();
|
||||
if (jsEngine == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto nativeEngine = jsEngine->GetNativeEngine();
|
||||
if (nativeEngine == nullptr) {
|
||||
return;
|
||||
}
|
||||
ContainerScope scope(id);
|
||||
nativeEngine->Loop(LOOP_NOWAIT, needSync);
|
||||
}, "ArkUISetNativeEngineLoop");
|
||||
delegate->PostJsTask(
|
||||
[weakEngine, needSync, id]() {
|
||||
auto jsEngine = weakEngine.Upgrade();
|
||||
if (jsEngine == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto nativeEngine = jsEngine->GetNativeEngine();
|
||||
if (nativeEngine == nullptr) {
|
||||
return;
|
||||
}
|
||||
ContainerScope scope(id);
|
||||
nativeEngine->Loop(LOOP_NOWAIT, needSync);
|
||||
},
|
||||
"ArkUISetNativeEngineLoop");
|
||||
};
|
||||
nativeEngine_->SetPostTask(postTask);
|
||||
}
|
||||
@ -1317,7 +1323,7 @@ void JsiDeclarativeEngine::RegisterOffWorkerFunc()
|
||||
void JsiDeclarativeEngine::RegisterAssetFunc()
|
||||
{
|
||||
auto weakDelegate = WeakPtr(engineInstance_->GetDelegate());
|
||||
auto && assetFunc = [weakDelegate](const std::string& uri, uint8_t** buff, size_t* buffSize,
|
||||
auto&& assetFunc = [weakDelegate](const std::string& uri, uint8_t** buff, size_t* buffSize,
|
||||
std::vector<uint8_t>& content, std::string& ami, bool& useSecureMem, bool isRestricted) {
|
||||
auto delegate = weakDelegate.Upgrade();
|
||||
if (delegate == nullptr) {
|
||||
|
@ -272,6 +272,7 @@ public:
|
||||
~JsiDeclarativeEngine() override;
|
||||
|
||||
bool Initialize(const RefPtr<FrontendDelegate>& delegate) override;
|
||||
void EngineTask(bool sharedRuntime);
|
||||
|
||||
void Destroy() override;
|
||||
|
||||
|
@ -63,12 +63,14 @@ shared_ptr<JsValue> AppTerminate(const shared_ptr<JsRuntime>& runtime, const sha
|
||||
}
|
||||
auto uiTaskExecutor = delegate->GetUiTask();
|
||||
WeakPtr<PipelineBase> pipelineContextWeak(pipelineContext);
|
||||
uiTaskExecutor.PostTask([pipelineContextWeak]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
pipelineContext->Finish();
|
||||
}
|
||||
}, "ArkUIAppTerminate");
|
||||
uiTaskExecutor.PostTask(
|
||||
[pipelineContextWeak]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
pipelineContext->Finish();
|
||||
}
|
||||
},
|
||||
"ArkUIAppTerminate");
|
||||
return runtime->NewNull();
|
||||
}
|
||||
|
||||
@ -95,15 +97,17 @@ shared_ptr<JsValue> AppSetImageCacheCount(const shared_ptr<JsRuntime>& runtime,
|
||||
return runtime->NewNull();
|
||||
}
|
||||
WeakPtr<PipelineBase> pipelineContextWeak(pipelineContext);
|
||||
taskExecutor->PostTask([ pipelineContextWeak, size ]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
auto imageCache = pipelineContext->GetImageCache();
|
||||
if (imageCache) {
|
||||
imageCache->SetCapacity(size);
|
||||
taskExecutor->PostTask(
|
||||
[pipelineContextWeak, size]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
auto imageCache = pipelineContext->GetImageCache();
|
||||
if (imageCache) {
|
||||
imageCache->SetCapacity(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, TaskExecutor::TaskType::UI, "ArkUISetImageCacheCount");
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUISetImageCacheCount");
|
||||
return runtime->NewNull();
|
||||
}
|
||||
|
||||
@ -132,15 +136,17 @@ shared_ptr<JsValue> AppSetImageRawDataCacheSize(
|
||||
return runtime->NewNull();
|
||||
}
|
||||
WeakPtr<PipelineBase> pipelineContextWeak(pipelineContext);
|
||||
taskExecutor->PostTask([ pipelineContextWeak, size ]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
auto imageCache = pipelineContext->GetImageCache();
|
||||
if (imageCache) {
|
||||
imageCache->SetDataCacheLimit(size);
|
||||
taskExecutor->PostTask(
|
||||
[pipelineContextWeak, size]() mutable {
|
||||
auto pipelineContext = pipelineContextWeak.Upgrade();
|
||||
if (pipelineContext) {
|
||||
auto imageCache = pipelineContext->GetImageCache();
|
||||
if (imageCache) {
|
||||
imageCache->SetDataCacheLimit(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, TaskExecutor::TaskType::UI, "ArkUISetImageDataCacheSize");
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUISetImageDataCacheSize");
|
||||
return runtime->NewNull();
|
||||
}
|
||||
|
||||
|
@ -1578,6 +1578,14 @@ ArkUINativeModuleValue ArkUINativeModule::GetArkUINativeModule(ArkUIRuntimeCallI
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetEnableDataDetector));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetEnableDataDetector"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::ResetEnableDataDetector));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "setOnSubmit"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetOnSubmit));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetOnSubmit"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::ResetOnSubmit));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "setAboutToIMEInput"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetAboutToIMEInput));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetAboutToIMEInput"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::ResetAboutToIMEInput));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "setCopyOptions"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RichEditorBridge::SetCopyOptions));
|
||||
richEditor->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetCopyOptions"),
|
||||
@ -3316,6 +3324,8 @@ void ArkUINativeModule::RegisterRenderNodeAttributes(Local<panda::ObjectRef> obj
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RenderNodeBridge::SetShadowColor));
|
||||
renderNode->Set(vm, panda::StringRef::NewFromUtf8(vm, "setShadowOffset"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RenderNodeBridge::SetShadowOffset));
|
||||
renderNode->Set(vm, panda::StringRef::NewFromUtf8(vm, "setLabel"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RenderNodeBridge::SetLabel));
|
||||
renderNode->Set(vm, panda::StringRef::NewFromUtf8(vm, "setShadowAlpha"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), RenderNodeBridge::SetShadowAlpha));
|
||||
renderNode->Set(vm, panda::StringRef::NewFromUtf8(vm, "setShadowElevation"),
|
||||
@ -3705,6 +3715,10 @@ void ArkUINativeModule::RegisterTabAttributes(Local<panda::ObjectRef> object, Ec
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TabsBridge::SetTabClip));
|
||||
tabs->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetTabClip"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TabsBridge::ResetTabClip));
|
||||
tabs->Set(vm, panda::StringRef::NewFromUtf8(vm, "setTabEdgeEffect"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TabsBridge::SetTabEdgeEffect));
|
||||
tabs->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetTabEdgeEffect"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TabsBridge::ResetTabEdgeEffect));
|
||||
tabs->Set(vm, panda::StringRef::NewFromUtf8(vm, "setTabWidth"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), TabsBridge::SetWidthAuto));
|
||||
tabs->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetTabWidth"),
|
||||
@ -4201,6 +4215,30 @@ void ArkUINativeModule::RegisterScrollAttributes(Local<panda::ObjectRef> object,
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM *>(vm), ScrollBridge::SetFlingSpeedLimit));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetFlingSpeedLimit"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM *>(vm), ScrollBridge::ResetFlingSpeedLimit));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnScrollStart"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnScrollStart));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnScrollStart"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnScrollStart));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnScrollEnd"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnScrollEnd));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnScrollEnd"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnScrollEnd));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnScrollStop"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnScrollStop));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnScrollStop"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnScrollStop));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnScroll"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnScroll));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnScroll"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnScroll));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnScrollEdge"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnScrollEdge));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnScrollEdge"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnScrollEdge));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "setScrollOnDidScroll"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::SetScrollOnDidScroll));
|
||||
scroll->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetScrollOnDidScroll"),
|
||||
panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ScrollBridge::ResetScrollOnDidScroll));
|
||||
object->Set(vm, panda::StringRef::NewFromUtf8(vm, "scroll"), scroll);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,9 @@ const std::vector<TextHeightAdaptivePolicy> HEIGHT_ADAPTIVE_POLICY = { TextHeigh
|
||||
TextHeightAdaptivePolicy::MIN_FONT_SIZE_FIRST, TextHeightAdaptivePolicy::LAYOUT_CONSTRAINT_FIRST };
|
||||
const std::string DEFAULT_FONT_WEIGHT = "400";
|
||||
const std::string NONE_FONT_FAMILY = "NoneFontFamily";
|
||||
constexpr int32_t DEFAULT_BUTTON_TYPE = 1;
|
||||
constexpr bool DEFAULT_STATE_EFFECT = true;
|
||||
constexpr uint32_t DEFAULT_CONTROL_SIZE = 1;
|
||||
constexpr uint32_t DEFAULT_STYLE = 1;
|
||||
constexpr uint32_t DEFAULT_ROLE = 0;
|
||||
constexpr int32_t CALL_ARG_0 = 0;
|
||||
@ -123,27 +126,31 @@ ArkUINativeModuleValue ButtonBridge::SetOptions(ArkUIRuntimeCallInfo* runtimeCal
|
||||
Local<JSValueRef> controlSizeArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_4);
|
||||
Local<JSValueRef> roleArg = runtimeCallInfo->GetCallArgRef(CALL_ARG_5);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
int32_t type = DEFAULT_BUTTON_TYPE;
|
||||
if (typeArg->IsNumber()) {
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonType(nativeNode, typeArg->Int32Value(vm));
|
||||
type = typeArg->Int32Value(vm);
|
||||
}
|
||||
bool stateEffect = DEFAULT_STATE_EFFECT;
|
||||
if (stateEffectArg->IsBoolean()) {
|
||||
bool stateEffect = stateEffectArg->ToBoolean(vm)->Value();
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonStateEffect(nativeNode, stateEffect);
|
||||
stateEffect = stateEffectArg->ToBoolean(vm)->Value();
|
||||
}
|
||||
uint32_t controlSize = DEFAULT_CONTROL_SIZE;
|
||||
if (controlSizeArg->IsNumber()) {
|
||||
uint32_t controlSize = controlSizeArg->Uint32Value(vm);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonControlSize(nativeNode, controlSize);
|
||||
controlSize = controlSizeArg->Uint32Value(vm);
|
||||
}
|
||||
uint32_t buttonStyle = DEFAULT_STYLE;
|
||||
if (buttonStyleArg->IsNumber()) {
|
||||
buttonStyle = buttonStyleArg->Uint32Value(vm);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonStyle(nativeNode, buttonStyle);
|
||||
}
|
||||
uint32_t buttonRole = DEFAULT_ROLE;
|
||||
if (roleArg->IsNumber()) {
|
||||
buttonRole = roleArg->Uint32Value(vm);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonRole(nativeNode, buttonRole);
|
||||
}
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonType(nativeNode, type);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonStateEffect(nativeNode, stateEffect);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonControlSize(nativeNode, controlSize);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonStyle(nativeNode, buttonStyle);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonRole(nativeNode, buttonRole);
|
||||
GetArkUINodeModifiers()->getButtonModifier()->setButtonOptions(nativeNode, buttonStyle, buttonRole);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
@ -249,6 +249,23 @@ ArkUINativeModuleValue RenderNodeBridge::SetShadowOffset(ArkUIRuntimeCallInfo* r
|
||||
GetArkUINodeModifiers()->getRenderNodeModifier()->setShadowOffset(nativeNode, offsetX, offsetY, unit);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue RenderNodeBridge::SetLabel(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
Local<JSValueRef> label = runtimeCallInfo->GetCallArgRef(1);
|
||||
std::string labelValue;
|
||||
if (label->IsString(vm)) {
|
||||
labelValue = label->ToString(vm)->ToString();
|
||||
} else {
|
||||
labelValue = "";
|
||||
LOGW("The label of the node should be a string!");
|
||||
}
|
||||
GetArkUINodeModifiers()->getRenderNodeModifier()->setLabel(nativeNode, labelValue.c_str());
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
ArkUINativeModuleValue RenderNodeBridge::SetShadowAlpha(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
static ArkUINativeModuleValue SetRotation(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetShadowColor(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetShadowOffset(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetLabel(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetShadowAlpha(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetShadowElevation(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetShadowRadius(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
@ -14,12 +14,14 @@
|
||||
*/
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_rich_editor_bridge.h"
|
||||
#include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_utils.h"
|
||||
#include "bridge/declarative_frontend/jsview/js_richeditor.h"
|
||||
#include "bridge/declarative_frontend/engine/jsi/jsi_types.h"
|
||||
#include "core/components/common/layout/constants.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
constexpr int NUM_0 = 0;
|
||||
constexpr int NUM_1 = 1;
|
||||
constexpr int NUM_2 = 2;
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetEnableDataDetector(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
@ -101,6 +103,96 @@ ArkUINativeModuleValue RichEditorBridge::ResetCaretColor(ArkUIRuntimeCallInfo* r
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetOnSubmit(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorOnSubmit(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(int32_t, NG::TextFieldCommonEvent&)> callback = [vm, frameNode,
|
||||
func = panda::CopyableGlobal(vm, func)](int32_t key, NG::TextFieldCommonEvent& event) {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
const char* keys[] = { "text", "keepEditableState" };
|
||||
Local<JSValueRef> values[] = { panda::StringRef::NewFromUtf8(vm, event.GetText().c_str()),
|
||||
panda::FunctionRef::New(vm, Framework::JSRichEditor::JsKeepEditableState) };
|
||||
auto eventObject = panda::ObjectRef::NewWithNamedProperties(vm, ArraySize(keys), keys, values);
|
||||
eventObject->SetNativePointerFieldCount(vm, NUM_1);
|
||||
eventObject->SetNativePointerField(vm, 0, static_cast<void*>(&event));
|
||||
panda::Local<panda::JSValueRef> params[NUM_2] = {
|
||||
panda::IntegerRef::New(vm, key), eventObject };
|
||||
func->Call(vm, func.ToLocal(), params, NUM_2);
|
||||
};
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->setRichEditorOnSubmit(
|
||||
nativeNode, reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::ResetOnSubmit(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorOnSubmit(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetAboutToIMEInput(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(NUM_1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorAboutToIMEInput(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<bool(const RichEditorInsertValue&)> callback =
|
||||
[vm, frameNode, func = panda::CopyableGlobal(vm, func)](const RichEditorInsertValue& insertValue) {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
const char* keys[] = { "insertOffset", "insertValue", "previewText" };
|
||||
Local<JSValueRef> values[] = { panda::NumberRef::New(vm, insertValue.GetInsertOffset()),
|
||||
panda::StringRef::NewFromUtf8(vm, insertValue.GetInsertValue().c_str()),
|
||||
panda::StringRef::NewFromUtf8(vm, insertValue.GetPreviewText().c_str()) };
|
||||
auto eventObject = panda::ObjectRef::NewWithNamedProperties(vm, ArraySize(keys), keys, values);
|
||||
panda::Local<panda::JSValueRef> params[NUM_1] = { eventObject };
|
||||
auto ret = func->Call(vm, func.ToLocal(), params, NUM_1);
|
||||
if (ret->IsBoolean()) {
|
||||
return ret->ToBoolean(vm)->Value();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->setRichEditorAboutToIMEInput(
|
||||
nativeNode, reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::ResetAboutToIMEInput(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(NUM_0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getRichEditorModifier()->resetRichEditorAboutToIMEInput(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue RichEditorBridge::SetOnReady(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
|
@ -29,6 +29,12 @@ public:
|
||||
static ArkUINativeModuleValue SetCaretColor(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetCaretColor(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
||||
static ArkUINativeModuleValue SetOnSubmit(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetOnSubmit(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
||||
static ArkUINativeModuleValue SetAboutToIMEInput(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetAboutToIMEInput(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
||||
static ArkUINativeModuleValue SetOnReady(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetOnReady(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
||||
|
@ -469,4 +469,236 @@ ArkUINativeModuleValue ScrollBridge::ResetScrollInitialize(ArkUIRuntimeCallInfo*
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnScrollStart(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollStart(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
|
||||
std::function<void()> callback = [vm, frameNode, func = panda::CopyableGlobal(vm, func)]() {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
func->Call(vm, func.ToLocal(), nullptr, 0);
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnScrollStart(
|
||||
nativeNode, reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnScrollStart(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollStart(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnScrollEnd(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollEnd(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(void)> callback = [vm, frameNode, func = panda::CopyableGlobal(vm, func)]() {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
func->Call(vm, func.ToLocal(), nullptr, 0);
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnScrollEnd(nativeNode, reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnScrollEnd(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollEnd(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnScrollStop(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM *vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollStop(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(void)> callback = [vm, frameNode, func = panda::CopyableGlobal(vm, func)]() {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
func->Call(vm, func.ToLocal(), nullptr, 0);
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnScrollStop(nativeNode, reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnScrollStop(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollStop(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnScroll(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScroll(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(OHOS::Ace::Dimension, OHOS::Ace::Dimension)> callback =
|
||||
[vm, frameNode, func = panda::CopyableGlobal(vm, func)](
|
||||
OHOS::Ace::Dimension xOffset, OHOS::Ace::Dimension yOffset) {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
|
||||
panda::Local<panda::NumberRef> xOffsetParam = panda::NumberRef::New(
|
||||
vm, static_cast<int32_t>(xOffset.ConvertToVp()));
|
||||
panda::Local<panda::NumberRef> yOffsetParam = panda::NumberRef::New(
|
||||
vm, static_cast<int32_t>(yOffset.ConvertToVp()));
|
||||
panda::Local<panda::JSValueRef> params[2] = { xOffsetParam, yOffsetParam }; // 2: Array .length
|
||||
func->Call(vm, func.ToLocal(), params, 2); // 2: Array length
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnScroll(nativeNode,
|
||||
reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnScroll(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScroll(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnScrollEdge(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollEdge(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(OHOS::Ace::NG::ScrollEdge)> callback =
|
||||
[vm, frameNode, func = panda::CopyableGlobal(vm, func)](
|
||||
OHOS::Ace::NG::ScrollEdge edge) {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
|
||||
panda::Local<panda::NumberRef> edgeParam = panda::NumberRef::New(vm, static_cast<int32_t>(edge));
|
||||
panda::Local<panda::JSValueRef> params[1] = { edgeParam }; // 1: Array length
|
||||
func->Call(vm, func.ToLocal(), params, 1); // 1: Array length
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnScrollEdge(nativeNode,
|
||||
reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnScrollEdge(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnScrollEdge(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::SetScrollOnDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> callbackArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
if (callbackArg->IsUndefined() || callbackArg->IsNull() || !callbackArg->IsFunction(vm)) {
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnDidScroll(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
auto frameNode = reinterpret_cast<FrameNode*>(nativeNode);
|
||||
CHECK_NULL_RETURN(frameNode, panda::JSValueRef::Undefined(vm));
|
||||
panda::Local<panda::FunctionRef> func = callbackArg->ToObject(vm);
|
||||
std::function<void(Dimension, Dimension, ScrollState)> callback =
|
||||
[vm, frameNode, func = panda::CopyableGlobal(vm, func)](
|
||||
Dimension xOffset, Dimension yOffset, ScrollState state) {
|
||||
panda::LocalScope pandaScope(vm);
|
||||
panda::TryCatch trycatch(vm);
|
||||
PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode));
|
||||
|
||||
panda::Local<panda::NumberRef> xOffsetParam = panda::NumberRef::New(
|
||||
vm, static_cast<int32_t>(xOffset.ConvertToVp()));
|
||||
panda::Local<panda::NumberRef> yOffsetParam = panda::NumberRef::New(
|
||||
vm, static_cast<int32_t>(yOffset.ConvertToVp()));
|
||||
panda::Local<panda::NumberRef> stateParam = panda::NumberRef::New(vm, static_cast<int32_t>(state));
|
||||
// 3: Array length
|
||||
panda::Local<panda::JSValueRef> params[3] = { xOffsetParam, yOffsetParam, stateParam };
|
||||
func->Call(vm, func.ToLocal(), params, 3); // 3: Array length
|
||||
};
|
||||
GetArkUINodeModifiers()->getScrollModifier()->setScrollOnDidScrollCallBack(nativeNode,
|
||||
reinterpret_cast<void*>(&callback));
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue ScrollBridge::ResetScrollOnDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::JSValueRef::Undefined(vm));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getScrollModifier()->resetScrollOnDidScroll(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -47,6 +47,18 @@ public:
|
||||
static ArkUINativeModuleValue ResetFlingSpeedLimit(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollInitialize(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollInitialize(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnScrollStart(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnScrollStart(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnScrollEnd(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnScrollEnd(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnScrollStop(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnScrollStop(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnScroll(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnScroll(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnScrollEdge(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnScrollEdge(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetScrollOnDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetScrollOnDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
|
@ -604,6 +604,37 @@ ArkUINativeModuleValue TabsBridge::ResetTabClip(ArkUIRuntimeCallInfo* runtimeCal
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue TabsBridge::SetTabEdgeEffect(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(1);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
|
||||
int32_t effect = static_cast<int32_t>(EdgeEffect::SPRING);
|
||||
if (secondArg->IsUndefined() || secondArg->IsNull()) {
|
||||
effect = static_cast<int32_t>(EdgeEffect::SPRING);
|
||||
} else {
|
||||
effect = secondArg->Int32Value(vm);
|
||||
}
|
||||
if (effect < static_cast<int32_t>(EdgeEffect::SPRING) || effect > static_cast<int32_t>(EdgeEffect::NONE)) {
|
||||
effect = static_cast<int32_t>(EdgeEffect::SPRING);
|
||||
}
|
||||
GetArkUINodeModifiers()->getTabsModifier()->setTabEdgeEffect(nativeNode, effect);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue TabsBridge::ResetTabEdgeEffect(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
|
||||
Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
|
||||
auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
|
||||
GetArkUINodeModifiers()->getTabsModifier()->resetTabEdgeEffect(nativeNode);
|
||||
return panda::JSValueRef::Undefined(vm);
|
||||
}
|
||||
|
||||
ArkUINativeModuleValue TabsBridge::SetWidthAuto(ArkUIRuntimeCallInfo* runtimeCallInfo)
|
||||
{
|
||||
EcmaVM* vm = runtimeCallInfo->GetVM();
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
static ArkUINativeModuleValue ResetBarPosition(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetTabClip(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetTabClip(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetTabEdgeEffect(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetTabEdgeEffect(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetWidthAuto(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue ResetWidthAuto(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
static ArkUINativeModuleValue SetHeightAuto(ArkUIRuntimeCallInfo* runtimeCallInfo);
|
||||
|
@ -4081,7 +4081,9 @@ class PUV2ViewBase extends NativeViewPartialUpdate {
|
||||
return;
|
||||
}
|
||||
const child = iChild;
|
||||
child.updateStateVars(params);
|
||||
if ('updateStateVars' in child) {
|
||||
child.updateStateVars(params);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -7680,8 +7682,8 @@ class ObserveV2 {
|
||||
if (weakComp && 'deref' in weakComp && (comp = weakComp.deref()) && comp instanceof ComputedV2) {
|
||||
const target = comp.getTarget();
|
||||
if (target instanceof ViewV2 && !target.isViewActive()) {
|
||||
// FIXME @Component freeze enable
|
||||
// addDelayedComputedIds id
|
||||
// add delayed ComputedIds id
|
||||
target.addDelayedComputedIds(id);
|
||||
}
|
||||
else {
|
||||
comp.fireChange();
|
||||
@ -7765,17 +7767,17 @@ class ObserveV2 {
|
||||
constructMonitor(owningObject, owningObjectName) {
|
||||
let watchProp = Symbol.for(MonitorV2.WATCH_PREFIX + owningObjectName);
|
||||
if (owningObject && (typeof owningObject === 'object') && owningObject[watchProp]) {
|
||||
Object.entries(owningObject[watchProp]).forEach(([monitorFuncName, monitorFunc]) => {
|
||||
Object.entries(owningObject[watchProp]).forEach(([pathString, monitorFunc]) => {
|
||||
var _a;
|
||||
var _b;
|
||||
if (monitorFunc && monitorFuncName && typeof monitorFunc === 'function') {
|
||||
const monitor = new MonitorV2(owningObject, monitorFuncName, monitorFunc);
|
||||
if (monitorFunc && pathString && typeof monitorFunc === 'function') {
|
||||
const monitor = new MonitorV2(owningObject, pathString, monitorFunc);
|
||||
monitor.InitRun();
|
||||
const refs = (_a = owningObject[_b = ObserveV2.MONITOR_REFS]) !== null && _a !== void 0 ? _a : (owningObject[_b] = {});
|
||||
// store a reference inside owningObject
|
||||
// thereby MonitorV2 will share lifespan as owning @ComponentV2 or @ObservedV2
|
||||
// remember: id2cmp only has a WeakRef to MonitorV2 obj
|
||||
refs[monitorFuncName] = monitor;
|
||||
refs[monitorFunc.name] = monitor;
|
||||
}
|
||||
// FIXME Else handle error
|
||||
});
|
||||
@ -8158,7 +8160,6 @@ class ProviderConsumerUtilV2 {
|
||||
*/
|
||||
static metaAliasKey(aliasName, deco) {
|
||||
return `${ProviderConsumerUtilV2.ALIAS_PREFIX}_${deco}_${aliasName}`;
|
||||
;
|
||||
}
|
||||
/**
|
||||
* Helper function to add meta data about @Provider and @Consumer decorators to ViewV2
|
||||
@ -8187,7 +8188,7 @@ class ProviderConsumerUtilV2 {
|
||||
// check all entries of this format varName: { deco: '@Provider' | '@Consumer', aliasName: ..... }
|
||||
// do not check alias entries
|
||||
// 'varName' is only in alias entries, see addProvideConsumeVariableDecoMeta
|
||||
if (typeof value == 'object' && value['deco'] === '@Consumer' && !('varName' in value)) {
|
||||
if (typeof value === 'object' && value['deco'] === '@Consumer' && !('varName' in value)) {
|
||||
let result = ProviderConsumerUtilV2.findProvider(view, value['aliasName']);
|
||||
if (result && result[0] && result[1]) {
|
||||
ProviderConsumerUtilV2.connectConsumer2Provider(view, key, result[0], result[1]);
|
||||
@ -8208,7 +8209,7 @@ class ProviderConsumerUtilV2 {
|
||||
static findProvider(view, aliasName) {
|
||||
var _a;
|
||||
let checkView = view === null || view === void 0 ? void 0 : view.getParent();
|
||||
const searchingPrefixedAliasName = ProviderConsumerUtilV2.metaAliasKey(aliasName, "@Provider");
|
||||
const searchingPrefixedAliasName = ProviderConsumerUtilV2.metaAliasKey(aliasName, '@Provider');
|
||||
|
||||
while (checkView) {
|
||||
const meta = (_a = checkView.constructor) === null || _a === void 0 ? void 0 : _a.prototype[ObserveV2.V2_DECO_META];
|
||||
@ -8973,6 +8974,7 @@ class ViewV2 extends PUV2ViewBase {
|
||||
this.markNeedUpdate();
|
||||
this.elmtIdsDelayedUpdate.clear();
|
||||
this.monitorIdsDelayedUpdate.clear();
|
||||
this.computedIdsDelayedUpdate.clear();
|
||||
|
||||
}
|
||||
/*
|
||||
|
@ -1088,6 +1088,7 @@ void FrontendDelegateDeclarative::GetRouterStateByIndex(int32_t& index, std::str
|
||||
}
|
||||
}
|
||||
auto pos = url.rfind(".js");
|
||||
// url length - (.js) length
|
||||
if (pos == url.length() - 3) {
|
||||
url = url.substr(0, pos);
|
||||
}
|
||||
@ -1135,6 +1136,7 @@ void FrontendDelegateDeclarative::GetRouterStateByUrl(std::string& url, std::vec
|
||||
if (iter.url == url) {
|
||||
stateInfo.index = counter;
|
||||
auto pos = url.rfind(".js");
|
||||
// url length - (.js) length
|
||||
if (pos == url.length() - 3) {
|
||||
tempUrl = url.substr(0, pos);
|
||||
}
|
||||
|
@ -14,6 +14,10 @@
|
||||
*/
|
||||
|
||||
#include "bridge/declarative_frontend/jsview/js_animator.h"
|
||||
#if !defined(PREVIEW)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "base/log/ace_scoring_log.h"
|
||||
#include "bridge/declarative_frontend/engine/functions/js_animator_function.h"
|
||||
@ -137,6 +141,9 @@ std::function<void()> GetEventCallback(const JSCallbackInfo& info, const std::st
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCORING_EVENT(name);
|
||||
func->Execute();
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", name);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,10 @@
|
||||
*/
|
||||
|
||||
#include "frameworks/bridge/declarative_frontend/jsview/js_button.h"
|
||||
#if !defined(PREVIEW)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#include "core/components_ng/pattern/button/button_layout_property.h"
|
||||
#endif
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
#include "base/log/ace_scoring_log.h"
|
||||
@ -525,6 +529,17 @@ void JSButton::JsOnClick(const JSCallbackInfo& info)
|
||||
ACE_SCORING_EVENT("onClick");
|
||||
PipelineContext::SetCallBackNode(node);
|
||||
func->Execute(info);
|
||||
#if !defined(PREVIEW)
|
||||
std::string label = "";
|
||||
if (!node.Invalid()) {
|
||||
auto pattern = node.GetRawPtr()->GetPattern();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
auto layoutProperty = pattern->GetLayoutProperty<NG::ButtonLayoutProperty>();
|
||||
CHECK_NULL_VOID(layoutProperty);
|
||||
label = layoutProperty->GetLabel().value_or("");
|
||||
}
|
||||
JSInteractableView::ReportClickEvent(node, label);
|
||||
#endif
|
||||
};
|
||||
auto onClick = [execCtx = info.GetExecutionContext(), func = jsOnClickFunc, node = targetNode](
|
||||
const ClickInfo* info) {
|
||||
@ -532,6 +547,17 @@ void JSButton::JsOnClick(const JSCallbackInfo& info)
|
||||
ACE_SCORING_EVENT("onClick");
|
||||
PipelineContext::SetCallBackNode(node);
|
||||
func->Execute(*info);
|
||||
#if !defined(PREVIEW)
|
||||
std::string label = "";
|
||||
if (!node.Invalid()) {
|
||||
auto pattern = node.GetRawPtr()->GetPattern();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
auto layoutProperty = pattern->GetLayoutProperty<NG::ButtonLayoutProperty>();
|
||||
CHECK_NULL_VOID(layoutProperty);
|
||||
label = layoutProperty->GetLabel().value_or("");
|
||||
}
|
||||
JSInteractableView::ReportClickEvent(node, label);
|
||||
#endif
|
||||
};
|
||||
|
||||
ButtonModel::GetInstance()->OnClick(std::move(onTap), std::move(onClick));
|
||||
|
@ -1323,8 +1323,12 @@ void JSTimePicker::Loop(const JSCallbackInfo& info)
|
||||
TimePickerModel::GetInstance()->SetWheelModeEnabled(isLoop);
|
||||
}
|
||||
|
||||
void JSTimePicker::EnableHapticFeedback(bool isEnableHapticFeedback)
|
||||
void JSTimePicker::EnableHapticFeedback(const JSCallbackInfo& info)
|
||||
{
|
||||
bool isEnableHapticFeedback = true;
|
||||
if (info[0]->IsBoolean()) {
|
||||
isEnableHapticFeedback = info[0]->ToBoolean();
|
||||
}
|
||||
TimePickerModel::GetInstance()->SetIsEnableHapticFeedback(isEnableHapticFeedback);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
static void OnChange(const JSCallbackInfo& info);
|
||||
static void Loop(const JSCallbackInfo& info);
|
||||
static void UseMilitaryTime(bool isUseMilitaryTime);
|
||||
static void EnableHapticFeedback(bool isEnableHapticFeedback);
|
||||
static void EnableHapticFeedback(const JSCallbackInfo& info);
|
||||
static void PickerBackgroundColor(const JSCallbackInfo& info);
|
||||
|
||||
static void SetDisappearTextStyle(const JSCallbackInfo& info);
|
||||
|
@ -106,6 +106,30 @@ void JSFlexImpl::CreateWrapComponent(const JSCallbackInfo& info, int32_t wrapVal
|
||||
return;
|
||||
}
|
||||
JSRef<JSObject> obj = JSRef<JSObject>::Cast(info[0]);
|
||||
WrapComponent(obj, wrapVal);
|
||||
if (obj->HasProperty("space")) {
|
||||
JSRef<JSVal> spaceVal = obj->GetProperty("space");
|
||||
if (spaceVal->IsUndefined()) {
|
||||
return;
|
||||
}
|
||||
CalcDimension mainValue;
|
||||
CalcDimension crossValue;
|
||||
JSRef<JSObject> spaceObj = JSRef<JSObject>::Cast(obj->GetProperty("space"));
|
||||
JSRef<JSVal> mainSpaceVal = spaceObj->GetProperty("main");
|
||||
JSRef<JSVal> crossSpaceVal = spaceObj->GetProperty("cross");
|
||||
if (!ParseLengthMetricsToPositiveDimension(mainSpaceVal, mainValue) || mainValue.IsNegative()) {
|
||||
mainValue.Reset();
|
||||
}
|
||||
if (!ParseLengthMetricsToPositiveDimension(crossSpaceVal, crossValue) || crossValue.IsNegative()) {
|
||||
crossValue.Reset();
|
||||
}
|
||||
FlexModel::GetInstance()->SetMainSpace(mainValue);
|
||||
FlexModel::GetInstance()->SetCrossSpace(crossValue);
|
||||
}
|
||||
}
|
||||
|
||||
void JSFlexImpl::WrapComponent(const JSRef<JSObject>& obj, int32_t wrapVal)
|
||||
{
|
||||
JSRef<JSVal> directionVal = obj->GetProperty("direction");
|
||||
JSRef<JSVal> justifyVal = obj->GetProperty("justifyContent");
|
||||
JSRef<JSVal> alignItemVal = obj->GetProperty("alignItems");
|
||||
@ -146,25 +170,6 @@ void JSFlexImpl::CreateWrapComponent(const JSCallbackInfo& info, int32_t wrapVal
|
||||
FlexModel::GetInstance()->SetWrapAlignment(WRAP_TABLE[alignContent]);
|
||||
}
|
||||
}
|
||||
if (obj->HasProperty("space")) {
|
||||
JSRef<JSVal> spaceVal = obj->GetProperty("space");
|
||||
if (spaceVal->IsUndefined()) {
|
||||
return;
|
||||
}
|
||||
CalcDimension mainValue;
|
||||
CalcDimension crossValue;
|
||||
JSRef<JSObject> spaceObj = JSRef<JSObject>::Cast(obj->GetProperty("space"));
|
||||
JSRef<JSVal> mainSpaceVal = spaceObj->GetProperty("main");
|
||||
JSRef<JSVal> crossSpaceVal = spaceObj->GetProperty("cross");
|
||||
if (!ParseLengthMetricsToPositiveDimension(mainSpaceVal, mainValue) || mainValue.IsNegative()) {
|
||||
mainValue.Reset();
|
||||
}
|
||||
if (!ParseLengthMetricsToPositiveDimension(crossSpaceVal, crossValue) || crossValue.IsNegative()) {
|
||||
crossValue.Reset();
|
||||
}
|
||||
FlexModel::GetInstance()->SetMainSpace(mainValue);
|
||||
FlexModel::GetInstance()->SetCrossSpace(crossValue);
|
||||
}
|
||||
}
|
||||
|
||||
void JSFlexImpl::JsFlexWidth(const JSCallbackInfo& info)
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
protected:
|
||||
static void CreateFlexComponent(const JSCallbackInfo& info);
|
||||
static void CreateWrapComponent(const JSCallbackInfo& info, int32_t wrapVal);
|
||||
static void WrapComponent(const JSRef<JSObject>& obj, int32_t wrapVal);
|
||||
static void JsFlexWidth(const JSRef<JSVal>& jsValue);
|
||||
static void JsFlexHeight(const JSRef<JSVal>& jsValue);
|
||||
};
|
||||
|
@ -14,6 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "bridge/declarative_frontend/jsview/js_menu_item.h"
|
||||
#if !defined(PREVIEW)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#endif
|
||||
|
||||
#include "want.h"
|
||||
|
||||
@ -121,6 +124,9 @@ void JSFormMenuItem::JsOnRegClick(const JSCallbackInfo& info)
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCORING_EVENT("onTap");
|
||||
RequestPublishFormWithSnapshot(wantValue, formBindingDataStr, jsCBFunc);
|
||||
#if !defined(PREVIEW)
|
||||
JSInteractableView::ReportClickEvent(node);
|
||||
#endif
|
||||
};
|
||||
|
||||
auto onClick = [execCtx = info.GetExecutionContext(), node = targetNode,
|
||||
@ -135,6 +141,9 @@ void JSFormMenuItem::JsOnRegClick(const JSCallbackInfo& info)
|
||||
ACE_SCORING_EVENT("onClick");
|
||||
PipelineContext::SetCallBackNode(node);
|
||||
RequestPublishFormWithSnapshot(wantValue, formBindingDataStr, jsCBFunc);
|
||||
#if !defined(PREVIEW)
|
||||
JSInteractableView::ReportClickEvent(node);
|
||||
#endif
|
||||
};
|
||||
ViewAbstractModel::GetInstance()->SetOnClick(std::move(onTap), std::move(onClick));
|
||||
}
|
||||
|
@ -14,6 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "bridge/declarative_frontend/jsview/js_grid.h"
|
||||
#if !defined(PREVIEW)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#endif
|
||||
|
||||
#include "base/log/ace_scoring_log.h"
|
||||
#include "base/utils/utils.h"
|
||||
@ -606,6 +609,9 @@ void JSGrid::JsOnGridDrop(const JSCallbackInfo& info)
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCORING_EVENT("Grid.onItemDrop");
|
||||
func->ItemDropExecute(dragInfo, itemIndex, insertIndex, isSuccess);
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Grid.onItemDrop");
|
||||
#endif
|
||||
};
|
||||
GridModel::GetInstance()->SetOnItemDrop(std::move(onItemDrop));
|
||||
}
|
||||
@ -684,6 +690,9 @@ void JSGrid::JsOnScrollStop(const JSCallbackInfo& args)
|
||||
if (args[0]->IsFunction()) {
|
||||
auto onScrollStop = [execCtx = args.GetExecutionContext(), func = JSRef<JSFunc>::Cast(args[0])]() {
|
||||
func->Call(JSRef<JSObject>());
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Grid.onScrollStop");
|
||||
#endif
|
||||
return;
|
||||
};
|
||||
GridModel::GetInstance()->SetOnScrollStop(std::move(onScrollStop));
|
||||
@ -744,6 +753,9 @@ void JSGrid::JsOnReachStart(const JSCallbackInfo& args)
|
||||
if (args[0]->IsFunction()) {
|
||||
auto onReachStart = [execCtx = args.GetExecutionContext(), func = JSRef<JSFunc>::Cast(args[0])]() {
|
||||
func->Call(JSRef<JSObject>());
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Grid.onReachStart");
|
||||
#endif
|
||||
return;
|
||||
};
|
||||
GridModel::GetInstance()->SetOnReachStart(std::move(onReachStart));
|
||||
@ -756,6 +768,9 @@ void JSGrid::JsOnReachEnd(const JSCallbackInfo& args)
|
||||
if (args[0]->IsFunction()) {
|
||||
auto onReachEnd = [execCtx = args.GetExecutionContext(), func = JSRef<JSFunc>::Cast(args[0])]() {
|
||||
func->Call(JSRef<JSObject>());
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Grid.onReachEnd");
|
||||
#endif
|
||||
return;
|
||||
};
|
||||
GridModel::GetInstance()->SetOnReachEnd(std::move(onReachEnd));
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#if !defined(PREVIEW)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#endif
|
||||
#include "base/utils/utils.h"
|
||||
|
||||
#if !defined(PREVIEW)
|
||||
@ -213,6 +216,9 @@ void JSImage::OnComplete(const JSCallbackInfo& args)
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCORING_EVENT("Image.onComplete");
|
||||
func->Execute(info);
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Image.onComplete");
|
||||
#endif
|
||||
};
|
||||
ImageModel::GetInstance()->SetOnComplete(std::move(onComplete));
|
||||
}
|
||||
@ -228,6 +234,9 @@ void JSImage::OnError(const JSCallbackInfo& args)
|
||||
JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
|
||||
ACE_SCORING_EVENT("Image.onError");
|
||||
func->Execute(info);
|
||||
#if !defined(PREVIEW)
|
||||
UiSessionManager::GetInstance().ReportComponentChangeEvent("event", "Image.onError");
|
||||
#endif
|
||||
};
|
||||
|
||||
ImageModel::GetInstance()->SetOnError(onError);
|
||||
|
@ -378,6 +378,8 @@ void JSIndexer::SetPopupPosition(const JSCallbackInfo& args)
|
||||
(!yVal->IsString() && JSViewAbstract::ParseJsDimensionVp(yVal, y))) {
|
||||
yOpt = y;
|
||||
}
|
||||
} else if (Container::LessThanAPITargetVersion(PlatformVersion::VERSION_TWELVE)) {
|
||||
return;
|
||||
}
|
||||
IndexerModel::GetInstance()->SetPopupPositionX(xOpt);
|
||||
IndexerModel::GetInstance()->SetPopupPositionY(yOpt);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user