diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..f01339f
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,16 @@
+# 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.
+
+group("as_advanced_ui_component") {
+ deps = [ "atomicservicetabs/interfaces:atomicservicetabs" ]
+}
diff --git a/README.md b/README.md
index 6ea1082..46fbe93 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ advanced_ui is an ArkTS-based UI framework that offers efficient UI combinations
**Figure 1** Relationship between advanced_ui and ArkUI
![](figures/advanced_ui_en.png "Relationship between advanced_ui and ArkUI")
+
**Figure 2** advanced_ui architecture
![](figures/advanced_ui_sub_en.png "advanced_ui architecture")
@@ -16,20 +17,12 @@ The following figure shows the directory structure.
```
/arkui_advanced_ui_component
-├── interface # APIs
-│ ├── arkdialog # Components
-│ └── composelistitem
-│ └── .....
+├── atomicservicetabs # Components
+│ └── interface # APIs
+│ └── source # framework sorce work
+├── .....
-├── source # Framework source code
-│ ├── arkdialog # Components
-│ └── composelistitem
-│ └── .....
```
## When to Use
With advanced_ui, you can develop your application UI must faster, leveraging its diverse array of UI component combinations with consistent design and style definitions. You can use and reuse any component anywhere as needed.
-
-## How to Use
-> See the [doc folder](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/tree/master/doc).
-
diff --git a/README_zh.md b/README_zh.md
index d311683..48e0ba0 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -4,9 +4,12 @@
advanced_ui 是基于使用场景设计,为应用提供高效的UI组合,接口封闭、风格一致,开箱即用的组件接口;使用ArkTS语言开发,依赖系统的public API
## 软件架构
-**图 1** advanced_ui和ArkUI架构关系
+**图 1** advanced_ui和ArkUI架构关系
+
![](figures/advanced_ui.png "advanced_ui和ArkUI架构关系")
-**图 2** advanced_ui架构设计
+
+**图 2** advanced_ui架构设计
+
![](figures/advanced_ui_sub.png "advanced_ui架构设计")
## 目录
@@ -14,15 +17,11 @@ advanced_ui 是基于使用场景设计,为应用提供高效的UI组合,接
```
/arkui_advanced_ui_component
-├── interface # 接口目录
-│ ├── arkdialog # 各个组件目录
-│ └── composelistitem
-│ └── .....
+├── atomicservicetabs # Components
+│ └── interface # APIs
+│ └── source # framework sorce work
+├── .....
-├── source # 框架源码
-│ ├── arkdialog # 各个组件目录
-│ └── composelistitem
-│ └── .....
```
## 使用场景
diff --git a/atomicservicetabs/interfaces/BUILD.gn b/atomicservicetabs/interfaces/BUILD.gn
new file mode 100644
index 0000000..dead4b3
--- /dev/null
+++ b/atomicservicetabs/interfaces/BUILD.gn
@@ -0,0 +1,59 @@
+# 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.
+
+import("//build/config/components/ets_frontend/es2abc_config.gni")
+import("//build/ohos.gni")
+import("//foundation/arkui/ace_engine/ace_config.gni")
+import("//foundation/arkui/ace_engine/adapter/preview/build/config.gni")
+import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
+
+es2abc_gen_abc("gen_atomicservicetabs_abc") {
+ src_js = rebase_path("atomicservicetabs.js")
+ dst_file = rebase_path(target_out_dir + "/atomicservicetabs.abc")
+ in_puts = [ "atomicservicetabs.js" ]
+ out_puts = [ target_out_dir + "/atomicservicetabs.abc" ]
+ extra_args = [ "--module" ]
+}
+
+gen_js_obj("atomicservicetabs_abc") {
+ input = get_label_info(":gen_atomicservicetabs_abc", "target_out_dir") +
+ "/atomicservicetabs.abc"
+ output = target_out_dir + "/atomicservicetabs_abc.o"
+ dep = ":gen_atomicservicetabs_abc"
+}
+
+gen_obj("atomicservicetabs_abc_preview") {
+ input = get_label_info(":gen_atomicservicetabs_abc", "target_out_dir") +
+ "/atomicservicetabs.abc"
+ output = target_out_dir + "/atomicservicetabs_abc.c"
+ snapshot_dep = [ ":gen_atomicservicetabs_abc" ]
+}
+
+ohos_shared_library("atomicservicetabs") {
+ sources = [ "atomicservicetabs.cpp" ]
+
+ if (use_mingw_win || use_mac || use_linux) {
+ deps = [ ":gen_obj_src_atomicservicetabs_abc_preview" ]
+ } else {
+ deps = [ ":atomicservicetabs_abc" ]
+ }
+
+ external_deps = [
+ "hilog:libhilog",
+ "napi:ace_napi",
+ ]
+
+ relative_install_dir = "module/atomicservice"
+ subsystem_name = "arkui"
+ part_name = "as_advanced_ui_component"
+}
diff --git a/interface/subheader/subheader.cpp b/atomicservicetabs/interfaces/atomicservicetabs.cpp
similarity index 58%
rename from interface/subheader/subheader.cpp
rename to atomicservicetabs/interfaces/atomicservicetabs.cpp
index 89d8b92..456bea6 100644
--- a/interface/subheader/subheader.cpp
+++ b/atomicservicetabs/interfaces/atomicservicetabs.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
+ * 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
@@ -13,42 +13,39 @@
* limitations under the License.
*/
-#include "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
#include "napi/native_node_api.h"
-extern const char _binary_subheader_abc_start[];
-extern const char _binary_subheader_abc_end[];
+extern const char _binary_atomicservicetabs_abc_start[];
+extern const char _binary_atomicservicetabs_abc_end[];
// Napi get abc code function
extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_SubHeader_GetABCCode(const char **buf, int *buflen)
+void NAPI_atomicservice_AtomicServiceTabs_GetABCCode(const char **buf, int *buflen)
{
if (buf != nullptr) {
- *buf = _binary_subheader_abc_start;
+ *buf = _binary_atomicservicetabs_abc_start;
}
if (buflen != nullptr) {
- *buflen = _binary_subheader_abc_end - _binary_subheader_abc_start;
+ *buflen = _binary_atomicservicetabs_abc_end - _binary_atomicservicetabs_abc_start;
}
}
/*
* Module define
*/
-static napi_module subheaderModule = {
+static napi_module AtomicServiceTabsModule = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = nullptr,
- .nm_modname = "arkui.advanced.SubHeader",
+ .nm_modname = "atomicservice.AtomicServiceTabs",
.nm_priv = ((void*)0),
.reserved = { 0 },
};
/*
- * Module register function
+ * Module registerfunction
*/
-extern "C" __attribute__((constructor)) void subheaderRegisterModule(void)
+extern "C" __attribute__((constructor)) void AtomicServiceTabsRegisterModule(void)
{
- napi_module_register(&subheaderModule);
+ napi_module_register(&AtomicServiceTabsModule);
}
\ No newline at end of file
diff --git a/atomicservicetabs/interfaces/atomicservicetabs.js b/atomicservicetabs/interfaces/atomicservicetabs.js
new file mode 100644
index 0000000..172d3fb
--- /dev/null
+++ b/atomicservicetabs/interfaces/atomicservicetabs.js
@@ -0,0 +1,205 @@
+/*
+ * 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.
+ */
+
+if (!("finalizeConstruction" in ViewPU.prototype)) {
+ Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
+}
+const DEFAULT_BAR_WIDTH = 96;
+const DEFAULT_BAR_HEIGHT = 52;
+export class AtomicServiceTabs extends ViewPU {
+ constructor(m1, n1, o1, p1 = -1, q1 = undefined, r1) {
+ super(m1, o1, p1, r1);
+ if (typeof q1 === "function") {
+ this.paramsGenerator_ = q1;
+ }
+ this.tabContents = undefined;
+ this.__tabBarOptionsArray = new SynchedPropertyObjectOneWayPU(n1.tabBarOptionsArray, this, "tabBarOptionsArray");
+ this.__tabBarPosition = new SynchedPropertySimpleOneWayPU(n1.tabBarPosition, this, "tabBarPosition");
+ this.__barBackgroundColor = new SynchedPropertyObjectOneWayPU(n1.barBackgroundColor, this, "barBackgroundColor");
+ this.__index = new SynchedPropertyObjectOneWayPU(n1.index, this, "index");
+ this.__barOverlap = new SynchedPropertySimpleOneWayPU(n1.barOverlap, this, "barOverlap");
+ this.controller = new TabsController();
+ this.onChange = undefined;
+ this.onTabBarClick = undefined;
+ this.onContentWillChange = undefined;
+ this.setInitiallyProvidedValue(n1);
+ this.finalizeConstruction();
+ }
+ setInitiallyProvidedValue(l1) {
+ if (l1.tabContents !== undefined) {
+ this.tabContents = l1.tabContents;
+ }
+ if (l1.tabBarPosition === undefined) {
+ this.__tabBarPosition.set(TabBarPosition.BOTTOM);
+ }
+ if (l1.barBackgroundColor === undefined) {
+ this.__barBackgroundColor.set(Color.Transparent);
+ }
+ if (l1.index === undefined) {
+ this.__index.set(0);
+ }
+ if (l1.barOverlap === undefined) {
+ this.__barOverlap.set(true);
+ }
+ if (l1.controller !== undefined) {
+ this.controller = l1.controller;
+ }
+ if (l1.onChange !== undefined) {
+ this.onChange = l1.onChange;
+ }
+ if (l1.onTabBarClick !== undefined) {
+ this.onTabBarClick = l1.onTabBarClick;
+ }
+ if (l1.onContentWillChange !== undefined) {
+ this.onContentWillChange = l1.onContentWillChange;
+ }
+ }
+ updateStateVars(k1) {
+ this.__tabBarOptionsArray.reset(k1.tabBarOptionsArray);
+ this.__tabBarPosition.reset(k1.tabBarPosition);
+ this.__barBackgroundColor.reset(k1.barBackgroundColor);
+ this.__index.reset(k1.index);
+ this.__barOverlap.reset(k1.barOverlap);
+ }
+ purgeVariableDependenciesOnElmtId(j1) {
+ this.__tabBarOptionsArray.purgeDependencyOnElmtId(j1);
+ this.__tabBarPosition.purgeDependencyOnElmtId(j1);
+ this.__barBackgroundColor.purgeDependencyOnElmtId(j1);
+ this.__index.purgeDependencyOnElmtId(j1);
+ this.__barOverlap.purgeDependencyOnElmtId(j1);
+ }
+ aboutToBeDeleted() {
+ this.__tabBarOptionsArray.aboutToBeDeleted();
+ this.__tabBarPosition.aboutToBeDeleted();
+ this.__barBackgroundColor.aboutToBeDeleted();
+ this.__index.aboutToBeDeleted();
+ this.__barOverlap.aboutToBeDeleted();
+ SubscriberManager.Get().delete(this.id__());
+ this.aboutToBeDeletedInternal();
+ }
+ get tabBarOptionsArray() {
+ return this.__tabBarOptionsArray.get();
+ }
+ set tabBarOptionsArray(i1) {
+ this.__tabBarOptionsArray.set(i1);
+ }
+ get tabBarPosition() {
+ return this.__tabBarPosition.get();
+ }
+ set tabBarPosition(h1) {
+ this.__tabBarPosition.set(h1);
+ }
+ get barBackgroundColor() {
+ return this.__barBackgroundColor.get();
+ }
+ set barBackgroundColor(g1) {
+ this.__barBackgroundColor.set(g1);
+ }
+ get index() {
+ return this.__index.get();
+ }
+ set index(f1) {
+ this.__index.set(f1);
+ }
+ get barOverlap() {
+ return this.__barOverlap.get();
+ }
+ set barOverlap(e1) {
+ this.__barOverlap.set(e1);
+ }
+ initialRender() {
+ this.observeComponentCreation2((c1, d1) => {
+ Tabs.create({
+ barPosition: this.tabBarPosition === TabBarPosition.LEFT ? BarPosition.Start : BarPosition.End,
+ index: this.index,
+ controller: this.controller
+ });
+ Tabs.barBackgroundColor(ObservedObject.GetRawObject(this.barBackgroundColor));
+ Tabs.divider(null);
+ Tabs.vertical(this.tabBarPosition === TabBarPosition.LEFT ? true : false);
+ Tabs.scrollable(false);
+ Tabs.barOverlap(this.barOverlap);
+ Tabs.barBackgroundBlurStyle(BlurStyle.COMPONENT_THICK);
+ Tabs.onChange(this.onChange);
+ Tabs.onTabBarClick(this.onTabBarClick);
+ Tabs.onContentWillChange(this.onContentWillChange);
+ Tabs.width((!this.tabContents && this.tabBarPosition === TabBarPosition.LEFT) ? DEFAULT_BAR_WIDTH : '100%');
+ Tabs.height((!this.tabContents && this.tabBarPosition === TabBarPosition.BOTTOM) ? DEFAULT_BAR_HEIGHT : '100%');
+ }, Tabs);
+ this.observeComponentCreation2((h, i) => {
+ ForEach.create();
+ const j = (l, m) => {
+ const n = l;
+ this.observeComponentCreation2((p, q) => {
+ If.create();
+ if (n) {
+ this.ifElseBranchUpdateFunction(0, () => {
+ this.observeComponentCreation2((u, v) => {
+ TabContent.create(() => {
+ this.observeComponentCreation2((y, z) => {
+ If.create();
+ if (this.tabContents && this.tabContents[m]) {
+ this.ifElseBranchUpdateFunction(0, () => {
+ this.tabContents[m]?.bind(this)?.(this);
+ });
+ }
+ else {
+ this.ifElseBranchUpdateFunction(1, () => {
+ });
+ }
+ }, If);
+ If.pop();
+ });
+ TabContent.tabBar(BottomTabBarStyle.of(n.icon, n.text)
+ .labelStyle({ unselectedColor: n.unselectedColor, selectedColor: n.selectedColor })
+ .iconStyle({ unselectedColor: n.unselectedColor, selectedColor: n.selectedColor }));
+ TabContent.width((!this.tabContents && this.tabBarPosition === TabBarPosition.LEFT) ? DEFAULT_BAR_WIDTH : '100%');
+ TabContent.height((!this.tabContents && this.tabBarPosition === TabBarPosition.BOTTOM) ? DEFAULT_BAR_HEIGHT : '100%');
+ }, TabContent);
+ TabContent.pop();
+ });
+ }
+ else {
+ this.ifElseBranchUpdateFunction(1, () => {
+ });
+ }
+ }, If);
+ If.pop();
+ };
+ this.forEachUpdateFunction(h, this.tabBarOptionsArray, j, undefined, true, false);
+ }, ForEach);
+ ForEach.pop();
+ Tabs.pop();
+ }
+ rerender() {
+ this.updateDirtyElements();
+ }
+}
+export class TabBarOptions {
+ constructor(b, c, d, e) {
+ this.icon = b;
+ this.text = c;
+ this.unselectedColor = d;
+ this.selectedColor = e;
+ }
+}
+
+export var TabBarPosition;
+(function (a) {
+ a[a["LEFT"] = 0] = "LEFT";
+ a[a["BOTTOM"] = 1] = "BOTTOM";
+})(TabBarPosition || (TabBarPosition = {}));
+
+export default { AtomicServiceTabs, TabBarOptions, TabBarPosition};
\ No newline at end of file
diff --git a/atomicservicetabs/source/atomicservicetabs.ets b/atomicservicetabs/source/atomicservicetabs.ets
new file mode 100644
index 0000000..8598e28
--- /dev/null
+++ b/atomicservicetabs/source/atomicservicetabs.ets
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+const DEFAULT_BAR_WIDTH: number = 96;
+const DEFAULT_BAR_HEIGHT: number = 52;
+
+@Component
+export struct AtomicServiceTabs {
+ @BuilderParam tabContents?: [TabContentBuilder?,
+ TabContentBuilder?,
+ TabContentBuilder?,
+ TabContentBuilder?,
+ TabContentBuilder?];
+ @Prop tabBarOptionsArray: [TabBarOptions, TabBarOptions, TabBarOptions?, TabBarOptions?, TabBarOptions?];
+ @Prop tabBarPosition?: TabBarPosition = TabBarPosition.BOTTOM;
+ @Prop barBackgroundColor?: ResourceColor = Color.Transparent;
+ @Prop index?: number | undefined = 0;
+ @Prop barOverlap?: boolean = true;
+ controller?: TabsController = new TabsController();
+ onChange?: Callback;
+ onTabBarClick?: Callback;
+ onContentWillChange?: OnContentWillChangeCallback;
+
+ build() {
+ Tabs({
+ barPosition: this.tabBarPosition === TabBarPosition.LEFT ? BarPosition.Start : BarPosition.End,
+ index: this.index,
+ controller: this.controller
+ }) {
+ ForEach(this.tabBarOptionsArray, (item: TabBarOptions, index: number) => {
+ if (item) {
+ TabContent() {
+ if (this.tabContents && this.tabContents[index]) {
+ this.tabContents[index]?.()
+ }
+ }
+ .tabBar(BottomTabBarStyle.of(item.icon, item.text)
+ .labelStyle({ unselectedColor: item.unselectedColor, selectedColor: item.selectedColor })
+ .iconStyle({ unselectedColor: item.unselectedColor, selectedColor: item.selectedColor }))
+ .width((!this.tabContents && this.tabBarPosition === TabBarPosition.LEFT) ? DEFAULT_BAR_WIDTH : '100%')
+ .height((!this.tabContents && this.tabBarPosition === TabBarPosition.BOTTOM) ? DEFAULT_BAR_HEIGHT : '100%')
+ }
+ })
+ }
+ .barBackgroundColor(this.barBackgroundColor)
+ .divider(null)
+ .vertical(this.tabBarPosition === TabBarPosition.LEFT ? true : false)
+ .scrollable(false)
+ .barOverlap(this.barOverlap)
+ .barBackgroundBlurStyle(BlurStyle.COMPONENT_THICK)
+ .onChange(this.onChange)
+ .onTabBarClick(this.onTabBarClick)
+ .onContentWillChange(this.onContentWillChange)
+ .width((!this.tabContents && this.tabBarPosition === TabBarPosition.LEFT) ? DEFAULT_BAR_WIDTH : '100%')
+ .height((!this.tabContents && this.tabBarPosition === TabBarPosition.BOTTOM) ? DEFAULT_BAR_HEIGHT : '100%')
+ }
+}
+
+export class TabBarOptions {
+ public icon: ResourceStr | TabBarSymbol;
+ public text: ResourceStr;
+ public unselectedColor?: ResourceColor;
+ public selectedColor?: ResourceColor;
+
+ constructor(icon: ResourceStr | TabBarSymbol, text: ResourceStr,
+ unselectedColor?: ResourceColor, selectedColor?: ResourceColor) {
+ this.icon = icon;
+ this.text = text;
+ this.unselectedColor = unselectedColor;
+ this.selectedColor = selectedColor;
+ }
+}
+
+export enum TabBarPosition {
+ LEFT = 0,
+ BOTTOM = 1
+}
+
+export type TabContentBuilder = () => void;
+export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;
\ No newline at end of file
diff --git a/bundle.json b/bundle.json
index c1bf0a6..b9a2d95 100644
--- a/bundle.json
+++ b/bundle.json
@@ -1,13 +1,13 @@
{
"name": "@ohos/advanced_ui_component",
"version": "1.0.0",
- "description": "advanced_ui_component",
+ "description": "as_advanced_ui_component",
"publishAs": "code-segment",
"segment": {
- "destPath": "foundation/arkui/advanced_ui_component"
+ "destPath": "foundation/arkui/as_advanced_ui_component"
},
"component": {
- "name": "advanced_ui_component",
+ "name": "as_advanced_ui_component",
"subsystem": "arkui",
"syscap": [],
"features": [],
@@ -25,19 +25,7 @@
},
"build": {
"sub_component": [
- "//foundation/arkui/advanced_ui_component/interface/filter:filter",
- "//foundation/arkui/advanced_ui_component/interface/composetitlebar:composetitlebar",
- "//foundation/arkui/advanced_ui_component/interface/editabletitlebar:editabletitlebar",
- "//foundation/arkui/advanced_ui_component/interface/selecttitlebar:selecttitlebar",
- "//foundation/arkui/advanced_ui_component/interface/tabtitlebar:tabtitlebar",
- "//foundation/arkui/advanced_ui_component/interface/splitlayout:splitlayout",
- "//foundation/arkui/advanced_ui_component/interface/subheader:subheader",
- "//foundation/arkui/advanced_ui_component/interface/treeview:treeview",
- "//foundation/arkui/advanced_ui_component/interface/composelistitem:composelistitem",
- "//foundation/arkui/advanced_ui_component/interface/swiperefresher:swiperefresher",
- "//foundation/arkui/advanced_ui_component/interface/arkdialog:arkdialog",
- "//foundation/arkui/advanced_ui_component/interface/toolbar:toolbar",
- "//foundation/arkui/advanced_ui_component/interface/progressbutton:progressbutton"
+ "//foundation/arkui/arkui_advanced_ui_component/atomicservicetabs/interfaces:atomicservicetabs"
],
"inner_kits": [],
"test": []
diff --git a/doc/Readme-CN.md b/doc/Readme-CN.md
deleted file mode 100644
index 0728c2b..0000000
--- a/doc/Readme-CN.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# 组件目录
-
-- [Dialog](ts-composite-components-arkdialog.md)
-- [SplitLayout](ts-composite-components-splitlayout.md)
-- [ToolBar](ts-composite-components-toolbar.md)
-- [ProgressButton](ts-composite-components-progressbutton.md)
-- [SubHeader](ts-composite-components-subheader.md)
-- [Filter](ts-composite-components-filter.md)
-- [TreeView](ts-composite-components-treeview.md)
-- [ComposeListItem](ts-composite-components-composelistitem.md)
-- [EditableTitleBar](ts-composite-components-editabletitlebar.md)
-- [ComposeTitleBar](ts-composite-components-composetitlebar.md)
-- [SelectTitleBar](ts-composite-components-selecttitlebar.md)
-- [TabTitleBar](ts-composite-components-tabtitlebar.md)
-- [SwipeRefresher](ts-composite-components-swiperefresher.md)
diff --git a/doc/figures/20230728-101201.png b/doc/figures/20230728-101201.png
deleted file mode 100644
index 614c169..0000000
Binary files a/doc/figures/20230728-101201.png and /dev/null differ
diff --git a/doc/figures/20230728-101236.png b/doc/figures/20230728-101236.png
deleted file mode 100644
index e57a28b..0000000
Binary files a/doc/figures/20230728-101236.png and /dev/null differ
diff --git a/doc/figures/20230728-101306.png b/doc/figures/20230728-101306.png
deleted file mode 100644
index 0070b57..0000000
Binary files a/doc/figures/20230728-101306.png and /dev/null differ
diff --git a/doc/figures/20230728-101355.png b/doc/figures/20230728-101355.png
deleted file mode 100644
index 8d840d1..0000000
Binary files a/doc/figures/20230728-101355.png and /dev/null differ
diff --git a/doc/figures/20230728-111325.png b/doc/figures/20230728-111325.png
deleted file mode 100644
index 53aefe6..0000000
Binary files a/doc/figures/20230728-111325.png and /dev/null differ
diff --git a/doc/figures/Snipaste_2023-07-24_11-35-40.png b/doc/figures/Snipaste_2023-07-24_11-35-40.png
deleted file mode 100644
index 742fccf..0000000
Binary files a/doc/figures/Snipaste_2023-07-24_11-35-40.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001616913438.png b/doc/figures/zh-cn_image_0000001616913438.png
deleted file mode 100644
index f36a025..0000000
Binary files a/doc/figures/zh-cn_image_0000001616913438.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001616916278.png b/doc/figures/zh-cn_image_0000001616916278.png
deleted file mode 100644
index c4b0a43..0000000
Binary files a/doc/figures/zh-cn_image_0000001616916278.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001616957408.png b/doc/figures/zh-cn_image_0000001616957408.png
deleted file mode 100644
index 2a0835b..0000000
Binary files a/doc/figures/zh-cn_image_0000001616957408.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001616959836.png b/doc/figures/zh-cn_image_0000001616959836.png
deleted file mode 100644
index 8bf1753..0000000
Binary files a/doc/figures/zh-cn_image_0000001616959836.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001617073302.png b/doc/figures/zh-cn_image_0000001617073302.png
deleted file mode 100644
index 5aa7060..0000000
Binary files a/doc/figures/zh-cn_image_0000001617073302.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001617116972.png b/doc/figures/zh-cn_image_0000001617116972.png
deleted file mode 100644
index 1b0d3aa..0000000
Binary files a/doc/figures/zh-cn_image_0000001617116972.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001617233250.png b/doc/figures/zh-cn_image_0000001617233250.png
deleted file mode 100644
index b4ea8f8..0000000
Binary files a/doc/figures/zh-cn_image_0000001617233250.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001617393174.png b/doc/figures/zh-cn_image_0000001617393174.png
deleted file mode 100644
index 739a1cb..0000000
Binary files a/doc/figures/zh-cn_image_0000001617393174.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001617439304.png b/doc/figures/zh-cn_image_0000001617439304.png
deleted file mode 100644
index 59694ce..0000000
Binary files a/doc/figures/zh-cn_image_0000001617439304.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001658655445.png b/doc/figures/zh-cn_image_0000001658655445.png
deleted file mode 100644
index 4c01b6d..0000000
Binary files a/doc/figures/zh-cn_image_0000001658655445.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001664546481.png b/doc/figures/zh-cn_image_0000001664546481.png
deleted file mode 100644
index 6e383ed..0000000
Binary files a/doc/figures/zh-cn_image_0000001664546481.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001664713029.png b/doc/figures/zh-cn_image_0000001664713029.png
deleted file mode 100644
index 99ff75f..0000000
Binary files a/doc/figures/zh-cn_image_0000001664713029.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001664822257.png b/doc/figures/zh-cn_image_0000001664822257.png
deleted file mode 100644
index 6d4a01a..0000000
Binary files a/doc/figures/zh-cn_image_0000001664822257.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001665393297.png b/doc/figures/zh-cn_image_0000001665393297.png
deleted file mode 100644
index fe44722..0000000
Binary files a/doc/figures/zh-cn_image_0000001665393297.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001665513149.png b/doc/figures/zh-cn_image_0000001665513149.png
deleted file mode 100644
index 00230be..0000000
Binary files a/doc/figures/zh-cn_image_0000001665513149.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001665553957.png b/doc/figures/zh-cn_image_0000001665553957.png
deleted file mode 100644
index 23685e0..0000000
Binary files a/doc/figures/zh-cn_image_0000001665553957.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001665793709.png b/doc/figures/zh-cn_image_0000001665793709.png
deleted file mode 100644
index 6511f95..0000000
Binary files a/doc/figures/zh-cn_image_0000001665793709.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_0000001665809293.png b/doc/figures/zh-cn_image_0000001665809293.png
deleted file mode 100644
index a5a22f5..0000000
Binary files a/doc/figures/zh-cn_image_0000001665809293.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_2023072902.png b/doc/figures/zh-cn_image_2023072902.png
deleted file mode 100644
index 2ddd83b..0000000
Binary files a/doc/figures/zh-cn_image_2023072902.png and /dev/null differ
diff --git a/doc/figures/zh-cn_image_2023072903.PNG b/doc/figures/zh-cn_image_2023072903.PNG
deleted file mode 100644
index 6e64323..0000000
Binary files a/doc/figures/zh-cn_image_2023072903.PNG and /dev/null differ
diff --git a/doc/figures/zh-cn_image_2023072904.PNG b/doc/figures/zh-cn_image_2023072904.PNG
deleted file mode 100644
index 49d6c2a..0000000
Binary files a/doc/figures/zh-cn_image_2023072904.PNG and /dev/null differ
diff --git a/doc/figures/zh-cn_image_2023072905.PNG b/doc/figures/zh-cn_image_2023072905.PNG
deleted file mode 100644
index 31ea0da..0000000
Binary files a/doc/figures/zh-cn_image_2023072905.PNG and /dev/null differ
diff --git a/doc/figures/zh-cn_image_2023072906.PNG b/doc/figures/zh-cn_image_2023072906.PNG
deleted file mode 100644
index 1c93742..0000000
Binary files a/doc/figures/zh-cn_image_2023072906.PNG and /dev/null differ
diff --git a/doc/figures/zh-cn_image_202307291.png b/doc/figures/zh-cn_image_202307291.png
deleted file mode 100644
index 9b1e6b7..0000000
Binary files a/doc/figures/zh-cn_image_202307291.png and /dev/null differ
diff --git a/doc/public_sys-resources/icon-caution.gif b/doc/public_sys-resources/icon-caution.gif
deleted file mode 100644
index 6e90d7c..0000000
Binary files a/doc/public_sys-resources/icon-caution.gif and /dev/null differ
diff --git a/doc/public_sys-resources/icon-danger.gif b/doc/public_sys-resources/icon-danger.gif
deleted file mode 100644
index 6e90d7c..0000000
Binary files a/doc/public_sys-resources/icon-danger.gif and /dev/null differ
diff --git a/doc/public_sys-resources/icon-note.gif b/doc/public_sys-resources/icon-note.gif
deleted file mode 100644
index 6314297..0000000
Binary files a/doc/public_sys-resources/icon-note.gif and /dev/null differ
diff --git a/doc/public_sys-resources/icon-notice.gif b/doc/public_sys-resources/icon-notice.gif
deleted file mode 100644
index 86024f6..0000000
Binary files a/doc/public_sys-resources/icon-notice.gif and /dev/null differ
diff --git a/doc/public_sys-resources/icon-tip.gif b/doc/public_sys-resources/icon-tip.gif
deleted file mode 100644
index 93aa720..0000000
Binary files a/doc/public_sys-resources/icon-tip.gif and /dev/null differ
diff --git a/doc/public_sys-resources/icon-warning.gif b/doc/public_sys-resources/icon-warning.gif
deleted file mode 100644
index 6e90d7c..0000000
Binary files a/doc/public_sys-resources/icon-warning.gif and /dev/null differ
diff --git a/doc/ts-composite-components-arkdialog.md b/doc/ts-composite-components-arkdialog.md
deleted file mode 100644
index 791271f..0000000
--- a/doc/ts-composite-components-arkdialog.md
+++ /dev/null
@@ -1,414 +0,0 @@
-# Dialog
-
-
-弹出框是一种模态窗口,通常用于在保持当前的上下文环境时,临时展示用户需关注的信息或待处理的操作,用户在模态弹出框内完成上述交互任务。模态弹出框需要用户进行交互才能够退出模态模式。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { TipsDialog, SelectDialog, ConfirmDialog, AlertDialog, LoadingDialog } from '@ohos.arkui.advanced.Dialog'
-```
-
-
-## 子组件
-
-无
-
-
-## TipsDialog
-
-
-TipsDialog({controller: CustomDialogController, imageRes: Resource, imageSize: SizeOptions, title: ResourceStr, content?: ResourceStr, checkTips?: ResourceStr, ischecked?: boolean, primaryButton?: ButtonOptions, secondaryButton?: ButtonOptions})
-
-
-提示弹出框,即为带图形确认框,必要时可通过图形化方式展现确认框。
-
-
-**装饰器类型:**\@CustomDialog
-
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 装饰器类型 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| controller | [CustomDialogController](https://docs.openharmony.cn/pages/v3.2/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md/) | 是 | - | 提示弹出框控制器。 |
-| imageRes | [Resource](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resource) | 是 | - | 展示的图片。 |
-| imageSize | [SizeOptions](https://docs.openharmony.cn/pages/v4.0/en/application-dev/reference/arkui-ts/ts-types.md/#sizeoptions) | 是 | - | 自定义图片尺寸。 |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | - | 提示弹出框标题。 |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | - | 提示弹出框内容。 |
-| checkTips | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | - | checkbox的提示内容。 |
-| isChecked | boolean | 否 | \@Prop | value为true时,表示checkbox已选中,value为false时,表示未选中。
默认值:false。 |
-| primaryButton | [ButtonOptions](#buttonoptions) | 否 | - | 提示框左侧按钮。 |
-| secondaryButton | [ButtonOptions](#buttonoptions) | 否 | - | 提示框右侧按钮。 |
-
-
-## SelectDialog
-
-SelectDialog({controller: CustomDialogController, title: ResourceStr, content?: ResourceStr, selectedIndex?: number, confirm?: ButtonOptions, radioContent?: Array<SheetInfo>})
-
-选择类弹出框,弹框中以列表或网格的形式提供可选的的内容。
-
-**装饰器类型:**\@CustomDialog
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| controller | CustomDialogController | 是 | 选择弹出框控制器。 |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 选择弹出框标题。 |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 选择弹出框内容。 |
-| selectedIndex | number | 否 | 选择弹出框的选中项。 |
-| confirm | boolean | 否 | 确认按钮。 |
-| radioContent | Array<[SheetInfo](https://docs.openharmony.cn/pages/v3.2/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md/)> | 否 | 选择弹出框的子项内容列表,每个选择项支持设置图片、文本和选中的回调事件。 |
-
-
-## ConfirmDialog
-
-ConfirmDialog({controller: CustomDialogController, title: ResourceStr, content?: ResourceStr, checkTips?: ResourceStr, ischecked?: boolean, primaryButton?: ButtonOptions, secondaryButton?: ButtonOptions})
-
-信息确认类弹出框,操作未正确执行(如网络错误、电池电量过低),或未正确操作时(如指纹录入),反馈的错误或提示信息。
-
-**装饰器类型:**\@CustomDialog
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| controller | CustomDialogController | 是 | - | 确认弹出框控制器。 |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | - | 确认弹出框标题。 |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | - | 确认弹出框内容。 |
-| checkTips | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | - | checkbox的提示内容。 |
-| isChecked | boolean | 否 | \@Prop | value为true时,表示checkbox已选中,value为false时,表示未选中。
默认值:false。 |
-| primaryButton | [ButtonOptions](#buttonoptions) | 否 | - | 确认框左侧按钮。 |
-| secondaryButton | [ButtonOptions](#buttonoptions) | 否 | - | 确认框右侧按钮。 |
-
-
-## AlertDialog
-
-AlertDialog({controller: CustomDialogController, content?: ResourceStr, primaryButton?: ButtonOptions, secondaryButton?: ButtonOptions})
-
-操作确认类弹出框,触发一个将产生严重后果的不可逆操作时,如删除、重置、取消编辑、停止等。
-
-**装饰器类型:**\@CustomDialog
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| controller | CustomDialogController | 是 | 确认弹出框控制器。 |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 确认弹出框内容。 |
-| primaryButton | [ButtonOptions](#buttonoptions) | 否 | 确认框左侧按钮。 |
-| secondaryButton | [ButtonOptions](#buttonoptions) | 否 | 确认框右侧按钮。 |
-
-
-## LoadingDialog
-
-LoadingDialog({controller: CustomDialogController, content?: ResourceStr})
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| controller | CustomDialogController | 是 | 加载弹出框控制器。 |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 加载弹出框内容。 |
-
-
-## ButtonOptions
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-| 名称 | 类型 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 按钮的内容。 |
-| action | () => void | 否 | 按钮的点击事件。 |
-| background | [ResourceColor](https://docs.openharmony.cn/pages/v3.2/en/application-dev/reference/arkui-ts/ts-types.md/#resourcecolor) | 否 | 按钮的背景。 |
-| fontColor | [ResourceColor](https://docs.openharmony.cn/pages/v3.2/en/application-dev/reference/arkui-ts/ts-types.md/#resourcecolor) | 否 | 按钮的字体颜色。 |
-
-
-## 示例
-
-
-### 示例1
-
-```
-import { TipsDialog } from '@ohos.arkui.advanced.Dialog'
-@Entry
-@Component
-struct Index {
- radioIndex = 0;
- isChecked = false;
- dialogControllerImage: CustomDialogController = new CustomDialogController({
- builder: TipsDialog({
- imageRes: $r('app.media.icon'),
- title: '文本标题',
- content: '文本文本文本文本文本文本文本文本文本',
- isChecked: this.isChecked,
- checkTips: '不再提示',
- primaryButton: {
- value: '取消',
- action: () => {
- console.info('Callback when the CheckBox is clicked')
- },
- },
- secondaryButton: {
- value: '确定',
- action: () => {
- console.info('Callback when the second button is clicked')
- }
- },
- }),
- autoCancel: true,
- customStyle: true,
- alignment: DialogAlignment.Bottom
- })
-
- build() {
- Row() {
- Stack() {
- Column(){
- Button("上图下文弹出框")
- .width(96)
- .height(40)
- .onClick(() => {
- this.dialogControllerImage.open()
- })
- }.margin({bottom: 300})
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- .backgroundImageSize({ width: '100%', height: '100%' })
- .height('100%')
- }
-}
-```
-
-![20230728-111325](figures/20230728-111325.png)
-
-
-### 示例2
-
-```
-import { SelectDialog } from '@ohos.arkui.advanced.Dialog'
-@Entry
-@Component
-struct Index {
- radioIndex = 0;
- isChecked = false;
-dialogControllerList: CustomDialogController = new CustomDialogController({
- builder: SelectDialog({
- title: '文本标题',
- selectedIndex: this.radioIndex,
- confirm: {
- value: '取消',
- action: () => null,
- },
- radioContent: [
- {
- title: '文本文本文本文本文本',
- action: () => {
- this.radioIndex = 0
- }
- },
- {
- title: '文本文本文本文本',
- action: () => {
- this.radioIndex = 1
- }
- },
- {
- title: '文本文本文本文本',
- action: () => {
- this.radioIndex = 2
- }
- },
- ]
- }),
- customStyle: true,
- alignment: DialogAlignment.Bottom,
- autoCancel: false
-})
-
- build() {
- Row() {
- Stack() {
- Column(){
- Button("纯列表弹出框")
- .width(96)
- .height(40)
- .onClick(() => {
- this.dialogControllerList.open()
- })
- }.margin({bottom: 300})
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- .backgroundImageSize({ width: '100%', height: '100%' })
- .height('100%')
- }
-}
-```
-
-![20230728-101201](figures/20230728-101201.png)
-
-
-### 示例3
-
-```
-import { ConfirmDialog } from '@ohos.arkui.advanced.Dialog'
-@Entry
-@Component
-struct Index {
- radioIndex = 0;
- isChecked = false;
-dialogControllerCheckBox: CustomDialogController = new CustomDialogController({
- builder: CheckBoxDialog({
- title: '文本标题',
- content: '文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本',
- isChecked: this.isChecked,
- checkTips: '禁止后不再提示',
- primaryButton: {
- value: '禁止',
- action: () => null,
- },
- secondaryButton: {
- value: '允许',
- action: () => {
- this.isChecked = false
- console.info('Callback when the second button is clicked')
- }
- },
- }),
- autoCancel: true,
- customStyle: true,
- alignment: DialogAlignment.Bottom
-})
-
- build() {
- Row() {
- Stack() {
- Column(){
- Button("文本+勾选弹出框")
- .width(96)
- .height(40)
- .onClick(() => {
- this.dialogControllerCheckBox.open()
- })
- }.margin({bottom: 300})
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- .backgroundImageSize({ width: '100%', height: '100%' })
- .height('100%')
- }
-}
-```
-
-![20230728-101236](figures/20230728-101236.png)
-
-
-### 示例4
-
-```
-import { AlertDialog } from '@ohos.arkui.advanced.Dialog'
-@Entry
-@Component
-struct Index {
- radioIndex = 0;
- isChecked = false;
-dialogControllerConfirm: CustomDialogController = new CustomDialogController({
- builder: AlertDialog({
- content: '文本文本文本文本文本',
- primaryButton: {
- value: '取消',
- action: () => null,
- },
- secondaryButton: {
- value: '确认',
- fontColor: $r('sys.color.ohos_id_color_warning'),
- action: () => {
- console.info('Callback when the second button is clicked')
- }
- },
- }),
- autoCancel: true,
- customStyle: true,
- alignment: DialogAlignment.Bottom
-})
-
- build() {
- Row() {
- Stack() {
- Column(){
- Button("纯文本弹出框")
- .width(96)
- .height(40)
- .onClick(() => {
- this.dialogControllerConfirm.open()
- })
- }.margin({bottom: 300})
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- .backgroundImageSize({ width: '100%', height: '100%' })
- .height('100%')
- }
-}
-```
-
-![20230728-101355](figures/20230728-101355.png)
-
-
-### 示例5
-
-```
-import { LoadingDialog } from '@ohos.arkui.advanced.Dialog'
-@Entry
-@Component
-struct Index {
- radioIndex = 0;
- isChecked = false;
-dialogControllerProgress: CustomDialogController = new CustomDialogController({
- builder: ProgressDialog({
- content: '文本文本文本文本文本...',
- }),
- autoCancel: true,
- customStyle: true,
- alignment: DialogAlignment.Bottom
-})
-
- build() {
- Row() {
- Stack() {
- Column(){
- Button("进度条弹出框")
- .width(96)
- .height(40)
- .onClick(() => {
- this.dialogControllerProgress.open()
- })
- }.margin({bottom: 300})
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- .backgroundImageSize({ width: '100%', height: '100%' })
- .height('100%')
- }
-}
-```
-
-![20230728-101306](figures/20230728-101306.png)
diff --git a/doc/ts-composite-components-composelistitem.md b/doc/ts-composite-components-composelistitem.md
deleted file mode 100644
index 17aa3d6..0000000
--- a/doc/ts-composite-components-composelistitem.md
+++ /dev/null
@@ -1,240 +0,0 @@
-# ComposeListItem
-
-
-列表包含一系列相同宽度的列表项。适合连续、多行呈现同类数据,例如图片和文本。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { ComposeListItem } from "@ohos.arkui.advanced.ComposeListItem"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-ComposeListItem({contentItem?: ContentItem, operateItem?: OperateItem})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| contentItem | [ContentItem](#contentitem) | 否 | \@Prop | 定义左侧以及中间元素。 |
-| operateItem | [OperateItem](#operateitem) | 否 | \@Prop | 定义右侧元素。 |
-
-
-## ContentItem
-
-| 名称 | 值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| iconStyle | [IconType](#icontype枚举说明) | 否 | 左侧元素-图标样式。 |
-| icon | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 左侧元素-图标。 |
-| primaryText | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 中间元素-标题内容。 |
-| secondaryText | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 中间元素-副标题内容。 |
-| description | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 中间元素-描述内容。 |
-
-
-## IconType枚举说明
-
-| 名称 | 描述 |
-| -------- | -------- |
-| BADGE | 左侧图标为badge类型,图标大小为8\*8dp。 |
-| NORMAL_ICON | 左侧图标为小图标类型,图标大小为16\*16dp。 |
-| SYSTEM_ICON | 左侧图标为系统图标类型,图标大小为24\*24dp。 |
-| HEAD_SCULPTURE | 左侧图标为头像类型,图标大小为40\*40dp。 |
-| APP_ICON | 左侧图标为应用图标类型,图标大小为64\*64dp。 |
-| PREVIEW | 左侧图标为预览图类型,图标大小为96\*96dp。 |
-| LONGITUDINAL | 左侧图标为横向特殊比例(宽比高大),保持最长边为96dp。 |
-| VERTICAL | 左侧图标为竖向特殊比例(高比宽大),保持最长边为96dp。 |
-
-
-## OperateItem
-
-| 名称 | 值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| arrow | [OperateIcon](#operateicon) | 否 | 右侧元素-箭头,大小为12\*24dp。 |
-| icon | [OperateIcon](#operateicon) | 否 | 右侧元素-第一个图标,大小为24\*24dp。 |
-| subIcon | [OperateIcon](#operateicon) | 否 | 右侧元素-第二个图标,大小为24\*24dp。 |
-| button | [OperateButton](#operatebutton) | 否 | 右侧元素-按钮。 |
-| switch | [OperateCheck](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/blob/master/doc/ts-composite-components-composelistitem.md#switchcheckboxradio-operatecheck) | 否 | 右侧元素-开关。 |
-| checkbox | [OperateCheck](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/blob/master/doc/ts-composite-components-composelistitem.md#switchcheckboxradio-operatecheck) | 否 | 右侧元素-多选框,大小为24\*24dp。 |
-| radio | [OperateCheck](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/blob/master/doc/ts-composite-components-composelistitem.md#switchcheckboxradio-operatecheck) | 否 | 右侧元素-单选,大小为24\*24dp。 |
-| image | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 右侧元素-图片,大小为48\*48dp。 |
-| text | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 右侧元素-文字。 |
-
-
-## OperateIcon
-
-| 名称 | 值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 右侧元素-图标/箭头。 |
-| action | ()=>void | 否 | 右侧元素-图标/箭头点击事件。 |
-
-
-## OperateButton
-
-| 名称 | 值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| text | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 右侧元素-按钮文字。 |
-
-
-## Switch/CheckBox/Radio-OperateCheck
-
-| 名称 | 值 | 必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| isCheck | boolean | 否 | 右侧元素-右侧Switch/CheckBox/Radio选中状态。 |
-| onChange | (value: boolean)=>void | 否 | 右侧元素-右侧Switch/CheckBox/Radio选中状态改变时触发回调。 |
-
-
-## 示例1-纯文本
-
-```ts
-import { ComposeListItem } from '@ohos.arkui.advanced.ComposeListItem';
-import { ContentItem } from '@ohos.arkui.advanced.ComposeListItem';
-
-@Entry
-@Component
-struct ComposeListItemExample {
- build() {
- Column() {
- List() {
- ListItem(){
- ComposeListItem({
- contentItem: ({
- primaryText: '单行列表'
- })
- })
- }
- }
- }
- }
-}
-```
-
-
-![示例1-纯文本](figures/zh-cn_image_2023072903.PNG)
-
-
-## 示例2-左侧元素+文本
-
-```ts
-import { ComposeListItem } from '@ohos.arkui.advanced.ComposeListItem';
-import { IconType } from '@ohos.arkui.advanced.ComposeListItem';
-import { ContentItem } from '@ohos.arkui.advanced.ComposeListItem';
-
-@Entry
-@Component
-struct ComposeListItemExample {
- build() {
- Column() {
- List() {
- ListItem(){
- ComposeListItem({
- contentItem: ({
- iconStyle: IconType.NORMAL_ICON,
- icon: $r('sys.media.ohos_app_icon'),
- primaryText: '双行列表',
- secondaryText: '辅助文字'
- })
- })
- }
- }
- }
- }
-}
-```
-
-
-![示例2-左侧元素+文本](figures/zh-cn_image_2023072904.PNG)
-
-
-## 示例3-右侧元素
-
-```ts
-import { ComposeListItem } from '@ohos.arkui.advanced.ComposeListItem';
-import { OperateItem } from '@ohos.arkui.advanced.ComposeListItem';
-import promptAction from '@ohos.promptAction'
-
-@Entry
-@Component
-struct ComposeListItemExample {
- build() {
- Column() {
- List() {
- ListItem() {
- ComposeListItem({
- operateItem: ({
- icon: {
- value: $r('sys.media.ohos_app_icon'),
- action: () => {
- promptAction.showToast({ message: 'icon' })
- }
- },
- text: '右侧文本'
- })
- })
- }
- }
- }
- }
-}
-```
-
-
-![示例3-右侧元素](figures/zh-cn_image_2023072905.PNG)
-
-
-## 示例4-左右元素+文本
-
-```ts
-import { ComposeListItem } from '@ohos.arkui.advanced.ComposeListItem';
-import { IconType } from '@ohos.arkui.advanced.ComposeListItem';
-import { ContentItem } from '@ohos.arkui.advanced.ComposeListItem';
-import { OperateItem } from '@ohos.arkui.advanced.ComposeListItem';
-import promptAction from '@ohos.promptAction'
-
-@Entry
-@Component
-struct ComposeListItemExample {
- build() {
- Column() {
- List() {
- ListItem() {
- ComposeListItem({
- contentItem: ({
- iconStyle: IconType.NORMAL_ICON,
- icon: $r('sys.media.ohos_app_icon'),
- primaryText: '双行列表',
- secondaryText: '辅助文字'
- }),
- operateItem: ({
- icon: {
- value: $r('sys.media.ohos_app_icon'),
- action: () => {
- promptAction.showToast({ message: 'icon' })
- } },
- text: '右侧文本'
- })
- })
- }
- }
- }
- }
-```
-
-![示例4-左右元素+文本](figures/zh-cn_image_2023072906.PNG)
diff --git a/doc/ts-composite-components-composetitlebar.md b/doc/ts-composite-components-composetitlebar.md
deleted file mode 100644
index fd6143f..0000000
--- a/doc/ts-composite-components-composetitlebar.md
+++ /dev/null
@@ -1,177 +0,0 @@
-# ComposeTitleBar
-
-
-普通型标题栏的一种,支持设置标题、头像(可选)、副标题(可选);可用于一级页面、二级及其以上界面(配置返回键)。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-ComposeTitleBar({item?: ComposeTitleBarMenuItem, title: ResourceStr, subtitle?: ResourceStr, menuItems?: Array<ComposeTitleBarMenuItem>})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| item | [ERROR:Invalid link:zh-cn_topic_0000001617072014.xml#xref1948916525328,link:zh-cn_topic_0000001609264184.xml#section478410410453](zh-cn_topic_0000001609264184.xml#section478410410453) | 否 | 用于左侧头像的单个菜单项目 |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 标题 |
-| subtitle | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 副标题 |
-| menuItems | Array<[ERROR:Invalid link:zh-cn_topic_0000001617072014.xml#xref33563123310,link:zh-cn_topic_0000001609264184.xml#section478410410453](zh-cn_topic_0000001609264184.xml#section478410410453)> | 否 | 右侧菜单项目列表 |
-
-
-### ComposeTitleBarMenuItem
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 图标资源 |
-| isEnabled | boolean | 是 | 是否启用,默认启用 |
-| action | () => void | 否 | 触发时的动作闭包 |
-
-
-## 示例 1 - 单行文本
-
-```
-import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar"
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- ComposeTitleBar({
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦"
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001616913438](figures/zh-cn_image_0000001616913438.png)
-
-
-## 示例 2 - 双行文本
-
-```
-import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar"
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- ComposeTitleBar({
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- subtitle: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦"
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001665513149](figures/zh-cn_image_0000001665513149.png)
-
-
-## 示例 3 - 双行文本带菜单
-
-```
-import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- menuItems: { value: Resource, isEnabled: boolean, action: () => void }[] =
- [ { isEnabled: true, value: $r('app.media.ic_public_save'),
- action: () => prompt.showToast({ message: "show toast index 1" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_reduce'),
- action: () => prompt.showToast({ message: "show toast index 2" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_edit'),
- action: () => prompt.showToast({ message: "show toast index 3" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_reduce'),
- action: () => prompt.showToast({ message: "show toast index 4" })
- } ]
- build() {
- Row() {
- Column() {
- Divider().height(2).color(0xCCCCCC)
- ComposeTitleBar({
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- subtitle: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- menuItems: this.menuItems.slice(0, 1),
- })
- Divider().height(2).color(0xCCCCCC)
- ComposeTitleBar({
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- subtitle: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- menuItems: this.menuItems.slice(0, 2),
- })
- Divider().height(2).color(0xCCCCCC)
- ComposeTitleBar({
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- subtitle: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- menuItems: this.menuItems,
- })
- Divider().height(2).color(0xCCCCCC)
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001617233250](figures/zh-cn_image_0000001617233250.png)
-
-
-## 示例 4 - 头像+双行文本带菜单
-
-```
-import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- ComposeTitleBar({
- menuItems: [ { isEnabled: true, value: $r('app.media.ic_public_save'),
- action: () => Prompt.showToast({ message: "show toast index 1" })
- } ],
- title: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- subtitle: "啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦",
- item: { isEnabled: true, value: $r('app.media.app_icon'),
- action: () => Prompt.showToast({message:"show toast index portrait"})
- } })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001617393174](figures/zh-cn_image_0000001617393174.png)
diff --git a/doc/ts-composite-components-editabletitlebar.md b/doc/ts-composite-components-editabletitlebar.md
deleted file mode 100644
index f82a255..0000000
--- a/doc/ts-composite-components-editabletitlebar.md
+++ /dev/null
@@ -1,130 +0,0 @@
-# EditableTitleBar
-
-
-编辑型标题栏,适用于多选界面或者内容的编辑界面,一般采取左叉右勾的形式。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { EditableTitleBar } from "@ohos.arkui.advanced.EditableTitleBar"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-EditableTitleBar({leftIconType: EditableLeftIconType, title: ResourceStr, menuItems?: Array<EditableTitleBarMenuItem>, onSave?: () => void, onCancel?: () =>void})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| leftIconStyle | [ERROR:Invalid link:zh-cn_topic_0000001665632009.xml#xref19441410133613,link:zh-cn_topic_0000001658583341.xml#section1340683083317](zh-cn_topic_0000001658583341.xml#section1340683083317) | 是 | 左侧按钮类型 |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 标题 |
-| menuItems | Array<[ERROR:Invalid link:zh-cn_topic_0000001665632009.xml#xref81499144365,link:zh-cn_topic_0000001658583341.xml#section1287821819325](zh-cn_topic_0000001658583341.xml#section1287821819325)> | 否 | 右侧菜单项目列表 |
-| onSave | () => void | 否 | 保存时的动作闭包 |
-| onCancel | () => void | 否 | 当左侧按钮类型为 Left,触发取消时的动作闭包 |
-
-
-### EditableLeftIconType
-
-| 名称 | 描述 |
-| -------- | -------- |
-| Back | 返回按钮 |
-| Cancel | 取消按钮 |
-
-
-### EditableTitleBarMenuItem
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 图标资源 |
-| isEnabled | boolean | 是 | 是否启用,默认启用 |
-| action | () => void | 否 | 触发时的动作闭包 |
-
-
-## 示例 1
-
-```
-import { EditableLeftIconType } from "@ohos.arkui.advanced.EditableTitleBar"
-import { EditableTitleBar } from "@ohos.arkui.advanced.EditableTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- EditableTitleBar({
- leftIconStyle: EditableLeftIconType.Cancel,
- title: "编辑页面",
- menuItems: [],
- onCancel: () => {
- Prompt.showToast({ message: "on cancel" })
- },
- onSave: () => {
- Prompt.showToast({ message: "on save" })
- }
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-
-![zh-cn_image_0000001617073302](figures/zh-cn_image_0000001617073302.png)
-
-
-## 示例 2
-
-```
-import { EditableLeftIconType } from "@ohos.arkui.advanced.EditableTitleBar"
-import { EditableTitleBar } from "@ohos.arkui.advanced.EditableTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- EditableTitleBar({
- leftIconStyle: EditableLeftIconType.Back,
- title: "编辑页面",
- menuItems: [
- { value: $r('app.media.ic_public_reduce'),
- isEnabled: false,
- action: () => {
- Prompt.showToast({ message: "show toast index 2" })
- }
- }
- ],
- onCancel: () => {
- Prompt.showToast({ message: "on cancel" })
- },
- onSave: () => {
- Prompt.showToast({ message: "on save" })
- }
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001665393297](figures/zh-cn_image_0000001665393297.png)
diff --git a/doc/ts-composite-components-filter.md b/doc/ts-composite-components-filter.md
deleted file mode 100644
index f6118c8..0000000
--- a/doc/ts-composite-components-filter.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Filter
-
-
-多条件筛选,帮助用户在大量信息中找到所需内容,应结合具体场景选择合适筛选方式。多条件筛选控件由筛选器与悬浮条构成,悬浮条可下拉展示悬浮筛选器。筛选器样式可分为多行可折叠类型与多行列表类型,并可以在筛选器最后一行附加快捷筛选器。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { Filter } from '@ohos.arkui.advanced.Filter'
-```
-
-
-## 子组件
-
-无
-
-
-## Filter
-
-Filter({ multiFilters: Array<FilterParams>, additionFilters: FilterParams, filterType: FilterType, onFilterChanged: (Array<FilterResult>) => void })
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必选 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| multiFilters | Array<[FilterParams](#filterparams)> | 是 | \@Prop | 多条件筛选列表。 |
-| additionFilters | [FilterParams](#filterparams) | 否 | \@Prop | 附加快捷筛选项。 |
-| filterType | [FilterType](#filtertype) | 否 | \@Prop | 筛选器的样式类型。 |
-| onFilterChanged | (Array<[FilterResult](#filterresult)>) => void | 是 | \@Prop | 用户点击后的回调事件。回调函数的参数为选中的筛选项结果列表。 |
-| container | ()=>void | 否 | \@BuilderParam | 筛选结果展示区域自定义内容,通过尾随闭包形式传入。 |
-
-
-## FilterParams
-
-| 名称 | 值 | 是否必选 | 描述 |
-| -------- | -------- | -------- | -------- |
-| name | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 筛选项维度名称。 |
-| options | Array<[ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr)> | 是 | 筛选项维度可选项列表。 |
-
-
-## FilterType
-
-| 参数名 | 描述 |
-| -------- | -------- |
-| MULTI_LINE_FILTER | 多行可折叠类型筛选器。 |
-| LIST_FILTER | 多行列表类型筛选器。 |
-
-
-## FilterResult
-
-| 名称 | 值 | 是否必选 | 描述 |
-| -------- | -------- | -------- | -------- |
-| name | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 筛选项维度名称。 |
-| index | number | 是 | 该维度筛选项选中项目的索引值。
默认值:-1 |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 该维度筛选项选中项目的值。
默认值:"" |
-
-
-## 示例
-
-多行可折叠Filter:内容区可完全自定义。
-
-```
-import { Filter, FilterParams, FilterResult, FilterType } from '@ohos.arkui.advanced.Filter'
-
-@Entry
-@Component
-struct Index {
- private filterParam: Array = [{name: '月份', options: ['全部','1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']},
- {name: '年份', options: ['全部','2023','2022','2021','2020','2019','2018','2017','2016','2015','2014','2013','2012','2011','2010','2009','2008']},
- {name: '节气', options: ['全部','立春','雨水','惊蛰','春分','清明','谷雨','立夏','小满','芒种','夏至','小暑','大暑','立秋','处暑','白露','秋分','寒露','霜降','立冬','小雪','大雪','冬至','小寒','大寒']}]
- private additionParam: FilterParams = { name: '您还可以搜', options: ['运营栏目1','运营栏目2','运营栏目3','运营栏目4','运营栏目5','运营栏目6']}
- private arr: number[] = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10];
- build() {
- Column() {
- Filter({
- multiFilters: this.filterParam,
- additionFilters: this.additionParam,
- filterType: FilterType.MULTI_LINE_FILTER,
- onFilterChanged: (select: Array) => {
- console.log('rec filter change')
- for (let filter of select) {
- console.log('name:' + filter.name + ',index:' + filter.index + ',value:' + filter.value)
- }
- }
- }){
- List({ initialIndex: 0 }) {
- ForEach(this.arr, (item, index: number) => {
- ListItem() {
- Text(item.toString())
- .width("100%")
- .height(100)
- .fontSize(16)
- .textAlign(TextAlign.Center)
- .borderRadius(10)
- .backgroundColor(Color.White)
- .margin({ top:10, bottom: 10 })
- }
- })
- }.backgroundColor(Color.Gray)
- .padding({ left: 20, right: 20 })
- }
- }
- .height('100%')
- .width('100%')
- }
-}
-```
-
-![zh-cn_image_0000001665809293](figures/zh-cn_image_0000001665809293.png)
diff --git a/doc/ts-composite-components-progressbutton.md b/doc/ts-composite-components-progressbutton.md
deleted file mode 100644
index 171c800..0000000
--- a/doc/ts-composite-components-progressbutton.md
+++ /dev/null
@@ -1,152 +0,0 @@
-# ProgressButton
-
-
-文本下载按钮,可显示具体下载进度。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { ProgressButton } from '@ohos.arkui.advanced.ProgressButton'
-```
-
-
-## ProgressButton
-
-ProgressButton({progress: number, content: string, progressButtonWidth?: Length, clickCallback: () => void, enable: boolean})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 装饰器类型 | 描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| progress | number | 是 | \@Prop | 下载按钮的当前进度值。 |
-| content | string | 是 | | 下载按钮的文本。 |
-| progressButtonWidth | Length | 否 | - | 下载按钮的宽度。 |
-| clickCallback | void | 是 | | 下载按钮的点击回调。 |
-| enable | boolean | 是 | | 下载按钮是否可以点击,
默认为true。 |
-
-
-## 示例
-
-```
-import { ProgressButton } from '@ohos.arkui.advanced.ProgressButton'
-@Entry
-@Component
-struct Index {
- @State halfProgress: number = 50
- @State smallProgress: number = 8
- @State bigProgress: number = 51
- @State textState1: string = '下载'
- @State textState2: string = '下载'
- @State textState3: string = '下载'
- @State isRunning1: boolean = false
- @State isRunning2: boolean = false
- @State isRunning3: boolean = false
- @State enableState1: boolean = true
- @State enableState2: boolean = true
- @State enableState3: boolean = true
- build() {
- Column({space: 20}) {
- Text('6、下载按钮:')
- ProgressButton({
- progress: this.halfProgress,
- progressButtonWidth: "60",
- content: this.textState1,
- enable: this.enableState1,
- clickCallback: () => {
- if (this.textState1 && !this.isRunning1 && this.halfProgress < 100) {
- this.textState1 = '继续'
- }
- this.isRunning1 = !this.isRunning1
- let timer = setInterval(() => {
- if (this.isRunning1) {
- if (this.halfProgress === 100) {
- } else {
- this.halfProgress++
- if (this.halfProgress === 100) {
- // this.halfProgress = 0
- this.textState1 = '已完成'
- this.enableState1 = false
- }
- console.info('x progress++ = ' + this.halfProgress)
- }
- } else {
- console.info('x isRunning = ' + false)
- clearInterval(timer)
- }
- }, 100)
- }
- })
- ProgressButton({
- progress: this.smallProgress,
- progressButtonWidth: "100",
- content: this.textState2,
- enable: this.enableState2,
- clickCallback: () => {
- if (this.textState2 && !this.isRunning2 && this.smallProgress < 100) {
- this.textState2 = '继续'
- }
- this.isRunning2 = !this.isRunning2
- let timer = setInterval(() => {
- if (this.isRunning2) {
- if (this.smallProgress === 100) {
-
- } else {
- this.smallProgress++
- if (this.smallProgress === 100) {
- this.textState2 = '已完成'
- this.enableState2 = false
- }
- console.info('x progress++ = ' + this.smallProgress)
- }
- } else {
- console.info('x isRunning = ' + false)
- clearInterval(timer)
- }
- }, 100)
- }
- })
- ProgressButton({
- progress: this.bigProgress,
- progressButtonWidth: '300',
- content: this.textState3,
- enable: this.enableState3,
- clickCallback: () => {
- this.isRunning3 = !this.isRunning3
- if (!this.isRunning3 && this.textState3 && this.bigProgress < 100) {
- this.textState3 = '继续'
- }
-
- let timer = setInterval(() => {
- if (this.isRunning3) {
- if (this.bigProgress === 100) {
- } else {
- this.bigProgress++
- if (this.bigProgress === 100) {
- this.textState3 = '已完成'
- this.enableState3 = false
- }
- console.info('x progress++ = ' + this.bigProgress)
- }
- } else {
- console.info('x isRunning = ' + false)
- clearInterval(timer)
- }
- }, 100)
- }
- })
- }.alignItems(HorizontalAlign.Center).width('100%')
- }
-}
-```
-
-
-![zh-cn_image_0000001664713029](figures/zh-cn_image_0000001664713029.png)
diff --git a/doc/ts-composite-components-selecttitlebar.md b/doc/ts-composite-components-selecttitlebar.md
deleted file mode 100644
index 84af742..0000000
--- a/doc/ts-composite-components-selecttitlebar.md
+++ /dev/null
@@ -1,186 +0,0 @@
-# SelectTitleBar
-
-
-普通型标题栏的一种,含有一个 Select 控件,可用于页面之间的切换;可用于一级页面、二级及其以上界面(配置返回键)。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { SelectTitleBar } from "@ohos.arkui.advanced.SelectTitleBar"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-SelectTitleBar({selected: number, options: Array<SelectOption>, menuItems?: Array<SelectTitleBarMenuItem>, subtitle?: ResourceStr, badgeValue?: number, hidesBackButton?: boolean, onSelected?: (index: number) => void})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| selected | number | 是 | \@Prop | 当前选中项目的索引 |
-| options | Array<SelectOption> | 是 | - | 下拉菜单中的项目 |
-| menuItems | Array Prompt.showToast({ message: 'page index ' + index }),
- hidesBackButton: true
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001665793709](figures/zh-cn_image_0000001665793709.png)
-
-
-## 示例 2 - 二级页面下拉菜单
-
-```
-import { SelectTitleBar } from "@ohos.arkui.advanced.SelectTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- build() {
- Row() {
- Column() {
- Divider().height(2).color(0xCCCCCC)
- SelectTitleBar({
- options: [
- { value: '所有照片' },
- { value: '本地(设备)' },
- { value: '本地本地本地本地本地(储存卡)' }
- ],
- selected: 0,
- onSelected: (index) => Prompt.showToast({ message: 'page index ' + index }),
- hidesBackButton: false
- })
- Divider().height(2).color(0xCCCCCC)
- SelectTitleBar({
- options: [
- { value: '所有照片' },
- { value: '本地(设备)' },
- { value: '本地本地本地本地本地(储存卡)' }
- ],
- selected: 1,
- onSelected: (index) => Prompt.showToast({ message: 'page index ' + index }),
- subtitle: "example@openharmony.cn"
- })
- Divider().height(2).color(0xCCCCCC)
- SelectTitleBar({
- options: [
- { value: '所有照片' },
- { value: '本地(设备)' },
- { value: '本地本地本地本地本地(储存卡)' }
- ],
- selected: 1,
- onSelected: (index) => Prompt.showToast({ message: 'page index ' + index }),
- subtitle: "example@openharmony.cn",
- menuItems: [ { isEnabled: true, value: $r('app.media.ic_public_save'),
- action: () => Prompt.showToast({ message: "show toast index 1" })
- } ]
- })
- Divider().height(2).color(0xCCCCCC)
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001617439304](figures/zh-cn_image_0000001617439304.png)
-
-
-## 示例 3 - 新事件标记
-
-```
-import { SelectTitleBar } from "@ohos.arkui.advanced.SelectTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- menuItems: { value: Resource, isEnabled: boolean, action: () => void }[] =
- [ { isEnabled: true, value: $r('app.media.ic_public_save'),
- action: () => prompt.showToast({ message: "show toast index 1" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_reduce'),
- action: () => prompt.showToast({ message: "show toast index 2" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_edit'),
- action: () => prompt.showToast({ message: "show toast index 3" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_reduce'),
- action: () => prompt.showToast({ message: "show toast index 4" })
- } ]
- build() {
- Row() {
- Column() {
- SelectTitleBar({
- options: [
- { value: '所有照片' },
- { value: '本地(设备)' },
- { value: '本地本地本地本地本地(储存卡)' }
- ],
- selected: 0,
- onSelected: (index) => Prompt.showToast({ message: 'page index ' + index }),
- subtitle: "example@openharmony.cn",
- menuItems: this.menuItems,
- badgeValue: 99,
- hidesBackButton: true
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001616959836](figures/zh-cn_image_0000001616959836.png)
diff --git a/doc/ts-composite-components-splitlayout.md b/doc/ts-composite-components-splitlayout.md
deleted file mode 100644
index 4206e22..0000000
--- a/doc/ts-composite-components-splitlayout.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# SplitLayout
-
-
-上下结构布局介绍了常用的页面布局样式。主要分为上下文本和上下图文两种类型。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { SplitLayout } from '@ohos.arkui.advanced.SplitLayout'
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-SplitLayout({mainImage: Resource, primaryText: string, secondaryText?: string, tertiaryText?: string})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| mainImage | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 传入图片。 |
-| primaryText | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 标题内容。 |
-| secondaryText | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 副标题内容。 |
-| tertiaryText | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 辅助文本。 |
-| container | () => void | 否 | 容器内组件。 |
-
-
-## 示例
-
-```
-import { SplitLayout } from '@ohos.arkui.advanced.SplitLayout'
-@Entry
-@Component
-struct Index {
- @State demoImage: Resource = $r("app.media.music")
- @State primaryText: string = "主标题"
- @State secondaryText: string = "副标题"
-
- build() {
- Column() {
- SplitLayout({
- mainImage: this.demoImage,
- primaryText: '新歌推荐',
- secondaryText: '私人订制新歌精选站,为你推荐专属优质新歌;',
- tertiaryText: "每日更新",
- }) {
- Text('示例:空白区域容器内可添加组件')
- .margin({top:36})
- }
- }
- .justifyContent(FlexAlign.SpaceBetween)
- .height('100%')
- .width('100%')
- }
-}
-```
-
-
-小于600Vp布局:
-
-
-![zh-cn_image_0000001665553957](figures/zh-cn_image_0000001665553957.png)
-
-
-大于600Vp小于840Vp布局:
-
-
-![zh-cn_image_0000001616957408](figures/zh-cn_image_0000001616957408.png)
-
-
-大于840Vp布局:
-
-
-![zh-cn_image_0000001617116972](figures/zh-cn_image_0000001617116972.png)
diff --git a/doc/ts-composite-components-subheader.md b/doc/ts-composite-components-subheader.md
deleted file mode 100644
index d7b226b..0000000
--- a/doc/ts-composite-components-subheader.md
+++ /dev/null
@@ -1,168 +0,0 @@
-# SubHeader
-
-
-子标题,用于列表项顶部,将该组列表划分为一个区块,子标题名称用来概括该区块内容;也可以用于内容项顶部,子标题名称用来概括该区块内容。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```ts
-import { SubHeader } from '@ohos.arkui.advanced.SubHeader'
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-SubHeader({primaryTitle?: ResourceStr, secondaryTitle?: ResourceStr, icon?: ResourceStr, select?: SelectOptions, operationType?: OperationType, operationItem?: Array<OperationOption>})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| primaryTitle | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | \@Prop | 标题内容。 |
-| secondaryTitle | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | \@Prop | 副标题内容。 |
-| icon | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | \@Prop | 图标设置项。 |
-| select | SelectOptions | 否 | - | select内容以及事件。 |
-| operationType | OperationType | 否 | \@Prop | 操作区(右侧)元素样式。
默认值:OperationType.BUTTON |
-| operationItem | Array<OperationOption> | 否 | - | 操作区(右侧)的设置项。 |
-
-
-## OperationType枚举说明
-
-| 名称 | 描述 |
-| -------- | -------- |
-| TEXT_ARROW | 文本按钮(带右箭头)。 |
-| BUTTON | 文本按钮(不带右箭头)。 |
-| ICON_GROUP | 图标按钮(最多支持配置三张图标)。 |
-| LOADING | 加载动画。 |
-
-
-## SelectOptions
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| options | Array<[SelectOption](https://docs.openharmony.cn/pages/v3.1/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md/)> | 是 | 下拉选项内容。 |
-| selected | number | 否 | 设置下拉菜单初始选项的索引。
第一项的索引为0。
当不设置selected属性时,
默认选择值为-1,菜单项不选中。 |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 设置下拉按钮本身的文本内容。 |
-| onSelect | callback: (index: number, value?: string) => void | 否 | 下拉菜单选中某一项的回调。
- index:选中项的索引。
- value:选中项的值。 |
-
-
-## OperationOption
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 文本内容。 |
-| action | ()=>void | 否 | 事件。 |
-
-
-## 示例
-
-```ts
-import promptAction from '@ohos.promptAction'
-import { OperationType, SubHeader } from '@ohos.arkui.advanced.SubHeader'
-
-@Entry
-@Component
-struct SubHeaderExample {
- build() {
- Column() {
- SubHeader({
- icon: $r('app.media.ic_public_community_messages'),
- primaryTitle: '子标题',
- operationType: OperationType.BUTTON,
- operationItem: [{ value: '操作',
- action: () => {
- promptAction.showToast({ message: 'demo' })
- }
- }]
- })
- }
- }
-}
-```
-
-![子标题3](figures/zh-cn_image_202307291.png)
-
-```ts
-import promptAction from '@ohos.promptAction'
-import { OperationType, SubHeader } from '@ohos.arkui.advanced.SubHeader'
-
-@Entry
-@Component
-struct SubHeaderExample {
- build() {
- Column() {
- SubHeader({
- primaryTitle: '标题',
- secondaryTitle: '副文本副文本副文本副文本',
- operationType: OperationType.TEXT_ARROW,
- operationItem: [{ value: '更多',
- action: () => {
- promptAction.showToast({ message: 'demo' })
- }
- }]
- })
- }
- }
-}
-```
-
-![zh-cn_image_0000001664546481](figures/zh-cn_image_0000001664546481.png)
-
-```ts
-import promptAction from '@ohos.promptAction'
-import { OperationType, SubHeader } from '@ohos.arkui.advanced.SubHeader'
-
-@Entry
-@Component
-struct SubHeaderExample {
- build() {
- Column() {
- SubHeader({
- select: {
- options: [{ value: 'aaa' }, { value: 'bbb' }, { value: 'ccc' }],
- value: 'selectdemo',
- selected: 2,
- onSelect: (index: number, value?: string) => {
- promptAction.showToast({ message: 'demo' })
- }
- },
- operationType: OperationType.ICON_GROUP,
- operationItem: [{
- value: $r('app.media.ic_public_community_messages'),
- action: () => {
- promptAction.showToast({ message: 'demo' })
- }
- }, {
- value: $r('app.media.ic_public_community_messages'),
- action: () => {
- promptAction.showToast({ message: 'demo' })
- }
- }, {
- value: $r('app.media.ic_public_community_messages'),
- action: () => {
- promptAction.showToast({ message: 'demo' })
- }
- }
- })
- }
- }
-}
-```
-
-![子标题5](figures/zh-cn_image_2023072902.png)
diff --git a/doc/ts-composite-components-swiperefresher.md b/doc/ts-composite-components-swiperefresher.md
deleted file mode 100644
index a8c1616..0000000
--- a/doc/ts-composite-components-swiperefresher.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# SwipeRefresher
-
-
-内容加载指获取内容并加载出来。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件及其子组件从 API Version 10 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { SwipeRefresher } from '@ohos.arkui.advacned.SwipeRefresher'
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-SwipeRefresher ({content: string, isLoading: boolean})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数值 | 参数类型 | 必填 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| content | string | 否 | \@Prop | 内容加载时显示的文本。 |
-| isLoading | boolean | 是 | \@Prop | 当前是否正在加载。 |
-
-
-## 示例
-
-```
-import { SwipeRefresher } from '@ohos.arkui.advacned.SwipeRefresher';
-
-@Entry
-@Component
-struct Index {
- build() {
- Column() {
- SwipeRefresher({
- content: '正在加载中',
- isLoading: true })
-
- SwipeRefresher({
- isLoading: true })
- SwipeRefresher({
- content: '正在加载中',
- isLoading: false })
- }
- }
-}
-```
-
-![Snipaste_2023-07-24_11-35-40](figures/Snipaste_2023-07-24_11-35-40.png)
diff --git a/doc/ts-composite-components-tabtitlebar.md b/doc/ts-composite-components-tabtitlebar.md
deleted file mode 100644
index e079515..0000000
--- a/doc/ts-composite-components-tabtitlebar.md
+++ /dev/null
@@ -1,126 +0,0 @@
-# TabTitleBar
-
-
-页签型标题栏,用于页面之间的切换;仅一级页面适用。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { TabTitleBar } from "@ohos.arkui.advanced.TabTitleBar"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-TabTitleBar({tabItems: Array<TabTitleBarTabItem>, menuItems?: Array<TabTitleBarMenuItem>, swiperContent: () => void})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 装饰器类型 | 参数描述 |
-| -------- | -------- | -------- | -------- | -------- |
-| tabItems | Array<[TabTitleBarTabItem](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/blob/master/doc/ts-composite-components-tabtitlebar.md/#tabtitlebartabitem)> | 是 | - | 左侧页签项目列表,定义标题栏左侧的页签项目。 |
-| menuItems | Array<[TabTitleBarMenuItem](https://gitee.com/openharmony-sig/arkui_advanced_ui_component/blob/master/doc/ts-composite-components-tabtitlebar.md/#tabtitlebarmenuitem)> | 否 | - | 右侧菜单项目列表,定义标题栏右侧的菜单项目 |
-| swiperContent | () => void | 否 | \@BuilderParam | 页签列表关联的页面内容构造器 |
-
-
-### TabTitleBarMenuItem
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| value | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 图标资源 |
-| isEnabled | boolean | 是 | 是否启用 |
-| action | () => void | 否 | 触发时的动作闭包 |
-
-
-### TabTitleBarTabItem
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| title | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 文字页签 |
-| icon | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 否 | 图片页签资源 |
-
-
-## 示例
-
-```
-import { TabTitleBar } from "@ohos.arkui.advanced.TabTitleBar"
-import Prompt from '@system.prompt'
-
-@Entry
-@Component
-struct Index {
- @Builder componentBuilder() {
- Text("#1ABC9C\nTURQUOISE")
- .fontWeight(FontWeight.Bold)
- .fontSize(14)
- .width("100%")
- .textAlign(TextAlign.Center)
- .fontColor("#CCFFFFFF")
- .backgroundColor("#1ABC9C")
- Text("#16A085\nGREEN SEA")
- .fontWeight(FontWeight.Bold)
- .fontSize(14)
- .width("100%")
- .textAlign(TextAlign.Center)
- .fontColor("#CCFFFFFF")
- .backgroundColor("#16A085")
- Text("#2ECC71\nEMERALD")
- .fontWeight(FontWeight.Bold)
- .fontSize(14)
- .width("100%")
- .textAlign(TextAlign.Center)
- .fontColor("#CCFFFFFF")
- .backgroundColor("#2ECC71")
- Text("#27AE60\nNEPHRITIS")
- .fontWeight(FontWeight.Bold)
- .fontSize(14)
- .width("100%")
- .textAlign(TextAlign.Center)
- .fontColor("#CCFFFFFF")
- .backgroundColor("#27AE60")
- }
- private readonly tabItems: { title: ResourceStr, icon?: ResourceStr }[] =
- [ { title: "页签1" },
- { title: "页签2" },
- { title: "页签3" },
- { title: "Happy",
- icon: $r('app.media.emoji_happy') } ]
- private readonly menuItems: { value: Resource, isEnabled: boolean, action: () => void }[] =
- [ { isEnabled: true, value: $r('app.media.ic_public_reduce'),
- action: () => Prompt.showToast({ message: "on item click! index 0" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_edit'),
- action: () => Prompt.showToast({ message: "on item click! index 1" })
- },
- { isEnabled: true, value: $r('app.media.ic_public_save'),
- action: () => Prompt.showToast({ message: "on item click! index 2" })
- } ]
- build() {
- Row() {
- Column() {
- TabTitleBar({
- swiperContent: this.componentBuilder,
- tabItems: this.tabItems,
- menuItems: this.menuItems,
- })
- }.width('100%')
- }.height('100%')
- }
-}
-```
-
-![zh-cn_image_0000001616916278](figures/zh-cn_image_0000001616916278.png)
diff --git a/doc/ts-composite-components-toolbar.md b/doc/ts-composite-components-toolbar.md
deleted file mode 100644
index f460ee9..0000000
--- a/doc/ts-composite-components-toolbar.md
+++ /dev/null
@@ -1,135 +0,0 @@
-# ToolBar
-
-
-工具栏用于展示针对当前界面内容的操作选项,在界面底部显示。底部最多显示5个入口,超过则收纳入“更多”子项中,在最右侧显示。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { ToolBar, ToolBarOptions } from '@ohos.arkui.advanced.ToolBar'
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-Toolbar({toolBarList: ToolBarOptions, activateIndex?: number, controller: TabsController})
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-**参数:**
-
-| 参数名 | 参数类型 | 必选 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| toolBarList | [ToolBarOptions](#toolbaroptions) | 是 | 工具栏列表。 |
-| activateIndex | number | 否 | 激活态的子项。
默认值为-1。 |
-| controller | [TabsController](https://docs.openharmony.cn/pages/v3.1/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md/#Tabscontroller) | 是 | 筛选器的样式类型。 |
-
-
-## ToolBarOptions
-
-继承自Array<ToolBarOption>
-
-**ToolBarOption:**
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| content | [ResourceStr](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resourcestr) | 是 | 工具栏子项的文本。 |
-| action | void | 否 | 工具栏子项点击事件。 |
-| icon | [Resource](https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-types.md/#resource) | 否 | 工具栏子项的图标。 |
-| state | [ItemState](#itemstate) | 否 | 工具栏子项的状态,默认为ENABLE。 |
-
-
-## ItemState
-
-| 名称 | 描述 |
-| -------- | -------- |
-| ENABLE | 工具栏子项为正常可点击状态。 |
-| DISABLE | 工具栏子项为不可点击状态。 |
-| ACTIVATE | 工具栏子项为激活状态,可点击。 |
-
-
-## 示例
-
-```
-import { ToolBar, ToolBarOptions } from '@ohos.arkui.advanced.ToolBar'
-@Entry
-@Component
-struct Index {
- @State toolbarList: ToolBarOptions = new ToolBarOptions()
- aboutToAppear() {
- this.toolbarList.push({ text: '剪贴我是超超超超超超超超超长样式',
- icon: $r('sys.media.ohos_ic_public_share'),
- action: () => {
- },
- })
- this.toolbarList.push({ text: '拷贝',
- icon: $r('sys.media.ohos_ic_public_copy'),
- action: () => {
- },
- state:2
- })
- this.toolbarList.push({ text: '粘贴',
- icon: $r('sys.media.ohos_ic_public_paste'),
- action: () => {
- },
- state:3
- })
- this.toolbarList.push({ text: '全选',
- icon: $r('sys.media.ohos_ic_public_select_all'),
- action: () => {
- },
- })
- this.toolbarList.push({ text: '分享',
- icon: $r('sys.media.ohos_ic_public_share'),
- action: () => {
- },
- })
- this.toolbarList.push({ text: '分享',
- icon: $r('sys.media.ohos_ic_public_share'),
- action: () => {
- },
- })
- }
- build() {
- Row() {
- Stack() {
- Column(){
- Button("修改减少item")
- .width(96)
- .height(40)
- .onClick(() => {
- this.toolbarList.pop()
- })
- Button("修改增加item")
- .width(96)
- .height(40)
- .onClick(() => {
- this.toolbarList.push(this.toolbarList[1])
- })
- }.margin({bottom: 300})
- Column() {
- ToolBar({
- currentIndex: 2,
- hwToolBarList: this.toolbarList,
- })
- }
- }.align(Alignment.Bottom)
- .width('100%').height('100%')
- }
- }
-}
-```
-
-![zh-cn_image_0000001658655445](figures/zh-cn_image_0000001658655445.png)
diff --git a/doc/ts-composite-components-treeview.md b/doc/ts-composite-components-treeview.md
deleted file mode 100644
index 0a8ddae..0000000
--- a/doc/ts-composite-components-treeview.md
+++ /dev/null
@@ -1,379 +0,0 @@
-# TreeView
-
-
-树视图作为一种分层显示的列表,适合显示嵌套结构。拥有父列表项和子列表项,可展开或折叠。子列表项支持选中一项或多项。
-
-
-用于效率型应用,如备忘录、电子邮件、图库中的侧边导航栏中。
-
-
-> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
-> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
-
-
-## 导入模块
-
-```
-import { TreeView } from "@ohos.arkui.advanced.TreeView"
-```
-
-
-## 子组件
-
-无
-
-
-## 接口
-
-TreeView({ treeController: TreeController })
-
-**装饰器类型:**\@Component
-
-**系统能力:** SystemCapability.ArkUI.ArkUI.Full
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| treeController | [TreeController](#treecontroller) | 是 | 树视图节点信息。 |
-
-
-## TreeController
-
-树视图组件的控制器,可以将此对象绑定至树视图组件,然后通过它控制树的节点信息,同一个控制器不可以控制多个树视图组件。
-
-
-### 导入对象
-
-```
-treeController: TreeController = new TreeController()
-```
-
-
-### addNode
-
-
-addNode(nodeParam?: NodeParam): void
-
-
-点击某个节点后,调用该方法可以触发新增孩子节点
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| nodeParam | [NodeParam](#nodeparam) | 否 | 节点信息。 |
-
-
-### removeNode
-
-removeNode(): void
-
-点击某个节点后,调用该方法可以触发删除该节点
-
-
-### modifyNode
-
-
-modifyNode(): void
-
-
-点击某个节点后,调用该方法可以触发修改该节点
-
-
-### buildDone
-
-buildDone(): void
-
-建立树视图。节点增加完毕后,必须调用该方法,触发树信息的保存
-
-
-### refreshNode
-
-refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| parentId | number | 是 | 父节点Id。 |
-| parentSubTitle | ResourceStr | 是 | 父节点副文本 |
-| currentSubtitle | ResourceStr | 是 | 当前节点副文本 |
-
-
-## NodeParam
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| parentNodeId | number | 否 | 父亲节点 |
-| currentNodeId | number | 否 | 当前孩子节点 |
-| isFolder | boolean | 否 | 是否是目录 |
-| icon | ResourceStr | 否 | 图标 |
-| selectedIcon | ResourceStr | 否 | 选中图标 |
-| editIcon | ResourceStr | 否 | 编辑图标 |
-| primaryTitle | ResourceStr | 否 | 主标题 |
-| secondaryTitle | ResourceStr | 否 | 副标题 |
-| container | () => void | 否 | 绑定在节点上的子组件,子组件由[@Builder](https://docs.openharmony.cn/pages/v3.1/en/application-dev/ui/ts-component-based-builder.md/)修饰 |
-
-
-## TreeListenerManager对象说明
-
-树视图组件的监听器,可以将此对象绑定至树视图组件,然后通过它监听树的节点的变化,同一个监听器不可以控制多个树视图组件。
-
-
-### 导入对象
-
-```
-import { TreeListenerManager } from '@ohos.arkui.advanced.TreeView'
-```
-
-
-### getInstance
-
-getInstance(): TreeListenerManager
-
-获取监听管理器单例对象
-
-
-### getTreeListener()
-
-getTreeListener(): TreeListener
-
-获取监听器
-
-
-## TreeListener对象说明
-
-树视图组件的监听器,可以将此对象绑定至树视图组件,然后通过它监听树的节点的变化,同一个监听器不可以控制多个树视图组件。
-
-
-### 导入对象
-
-```
-treeListener: TreeListener = TreeListenerManager.getInstance().getTreeListener()
-```
-
-
-### on
-
-on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
-
-注册监听
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| type | [TreeListenType](#treelistentype) | 是 | 监听类型 |
-| nodeParam | [NodeParam](#nodeparam) | 是 | 节点信息。 |
-
-
-### once
-
-once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
-
-注册一次监听
-
-**参数:**
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| type | [TreeListenType](#treelistentype) | 是 | 监听类型 |
-| nodeParam | [NodeParam](#nodeparam) | 是 | 节点信息。 |
-
-
-### off
-
-
-off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void;
-
-
-取消监听
-
-
-**参数:**
-
-
-| 参数名 | 参数类型 | 必填 | 参数描述 |
-| -------- | -------- | -------- | -------- |
-| type | [TreeListenType](#treelistentype) | 是 | 监听类型 |
-| nodeParam | [NodeParam](#nodeparam) | 是 | 节点信息。 |
-
-
-## TreeListenType
-
-| 名称 | 描述 |
-| -------- | -------- |
-| NODE_CLICK | 监听节点点击事件 |
-| NODE_ADD | 监听节点增加事件 |
-| NODE_DELETE | 监听节点删除事件 |
-| NODE_MODIFY | 监听节点修改事件 |
-| NODE_MOVE | 监听节点移动事件 |
-
-
-## CallbackParam
-
-| 名称 | 值 | 是否必填 | 描述 |
-| -------- | -------- | -------- | -------- |
-| currentNodeId | number | 是 | 当前孩子节点 |
-| parentNodeId | number | 否 | 父亲节点表 |
-| childIndex: number | number | 否 | 孩子索引 |
-
-
-## 示例
-
-```
-import { TreeController, TreeListener, TreeListenerManager, TreeListenType, NodeParam, TreeView, CallbackParam } from '@ohos.arkui.advanced.TreeView'
-
-@Entry
-@Component
-struct TreeViewDemo {
- private listTreeNode: TreeController = new TreeController();
- private appEventBus: TreeListener = TreeListenerManager.getInstance().getTreeListener();
- @State clickNodeId: number = 0;
- @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'];
-
- aboutToDisappear(): void {
- this.appEventBus.off(TreeListenType.NODE_CLICK, null);
- this.appEventBus.off(TreeListenType.NODE_ADD, null);
- this.appEventBus.off(TreeListenType.NODE_DELETE, null);
- }
-
- @Builder menuBuilder0() {
- Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
- Text('删除').fontSize(16).width(100).height(30).textAlign(TextAlign.Center)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.removeNode();
- })
- }.width(100).border({width: 1, color: 0x80808a, radius: '16dp'})
- }
-
- @Builder menuBuilder1() {
- Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
- Text('新增').fontSize(16).width(100).height(30).textAlign(TextAlign.Center)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.addNode();
- })
- Divider()
- Text('删除').fontSize(16).width(100).height(30).textAlign(TextAlign.Center)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.removeNode();
- })
- Divider()
- Text('重命名').fontSize(16).width(100).height(30).textAlign(TextAlign.Center)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.modifyNode();
- })
- }.width(100).border({width: 1, color: 0x80808a, radius: '16dp'})
- }
-
- aboutToAppear(): void {
- this.appEventBus.on(TreeListenType.NODE_MOVE, (callbackParam: CallbackParam) => {
- })
- this.appEventBus.on(TreeListenType.NODE_CLICK, (callbackParam: CallbackParam) => {
- })
-
- let normalResource: Resource = $r('app.media.ic_public_collect_normal');
- let selectedResource: Resource = $r('app.media.ic_public_collect_selected');
- let editResource: Resource = $r('app.media.ic_public_collect_edit');
- let nodeParam: NodeParam = { parentNodeId:-1, currentNodeId: 1, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录1验证悬浮框自适应效果是否OK",
- menu: this.menuBuilder1.bind(this), secondaryTitle: "6" };
- this.listTreeNode
- .addNode(nodeParam)
- .addNode({parentNodeId:1, currentNodeId: 2, isFolder: false, primaryTitle: "项目1_1" })
- .addNode({ parentNodeId:-1, currentNodeId: 7, isFolder: true, primaryTitle: "目录2", menu: this.menuBuilder1.bind(this) })
- .addNode({ parentNodeId:-1, currentNodeId: 23, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录3", menu: this.menuBuilder1.bind(this) })
- .addNode({ parentNodeId:-1, currentNodeId: 24, isFolder: false, primaryTitle: "项目4", menu: this.menuBuilder1.bind(this) })
- .addNode({ parentNodeId:-1, currentNodeId: 31, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录5", menu: this.menuBuilder1.bind(this), secondaryTitle: "0" })
- .addNode({ parentNodeId:-1, currentNodeId: 32, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录6", menu: this.menuBuilder1.bind(this), secondaryTitle: "0" })
- .addNode({ parentNodeId:32, currentNodeId: 35, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录6-1", menu: this.menuBuilder1.bind(this), secondaryTitle: "0" })
- .addNode({ parentNodeId:-1, currentNodeId: 33, isFolder: true, icon: normalResource, selectedIcon: selectedResource,
- editIcon: editResource, primaryTitle: "目录7", menu: this.menuBuilder1.bind(this), secondaryTitle: "0" })
- .addNode({ parentNodeId:33, currentNodeId: 34, isFolder: false, primaryTitle: "项目8" })
- .addNode({ parentNodeId:-1, currentNodeId: 36, isFolder: false, primaryTitle: "项目9" })
- .buildDone();
- }
-
- @Builder subfieldPopup(item: any) {
- Column() {
- Text(item)
- .width('50%').height(60).fontSize(16).borderRadius(10)
- .textAlign(TextAlign.Center).backgroundColor(Color.Yellow)
- }
- }
-
- build() {
- SideBarContainer(SideBarContainerType.Embed)
- {
- TreeView({ treeController: this.listTreeNode })
- Row() {
- Divider().vertical(true).strokeWidth(2).color(0x000000).lineCap(LineCapStyle.Round)
- Column() {
- Row() {
- Text('ClickNodeId=' + this.clickNodeId).fontSize('16fp')
- Button('Add', { type: ButtonType.Normal, stateEffect: true })
- .borderRadius(8).backgroundColor(0x317aff).width(90)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.addNode();
- })
- Button('Modify', { type: ButtonType.Normal, stateEffect: true })
- .borderRadius(8).backgroundColor(0x317aff).width(90)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.modifyNode();
- })
- Button('Remove', { type: ButtonType.Normal, stateEffect: true })
- .borderRadius(8).backgroundColor(0x317aff).width(120)
- .onClick((event: ClickEvent) => {
- this.listTreeNode.removeNode();
- })
- }
-
- /* drag item. */
- List({ space: 10, initialIndex: 0 }) {
- ForEach(this.numbers, (item) => {
- ListItem() {
- Text('' + item)
- .width('100%').height(38).fontSize(16).borderRadius(10)
- .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE)
- }
- .onSelect((isSelected: boolean) => {
- console.log('listItem selected')
- })
- .onDragStart(() => {
- this.listTreeNode.refreshNode(1,'选择节点','目标节点')
- return this.subfieldPopup(item)
- })
- }, item => item)
- }
- .editMode(true)
- .multiSelectable(true)
- .onDrop((event: DragEvent, extraParams: string) => {
- console.log('outer onDrop')
- })
-
- }.height('100%').width('70%').alignItems(HorizontalAlign.Start)
- }
- }
- .focusable(true)
- .sideBarWidth(240)
- .minSideBarWidth(0)
- .maxSideBarWidth(900)
- .showControlButton(false)
- .showSideBar(true)
- .onChange((value: boolean) => {
- console.info('status:' + value);
- })
- }
-}
-```
-
-![zh-cn_image_0000001664822257](figures/zh-cn_image_0000001664822257.png)
diff --git a/interface/arkdialog/BUILD.gn b/interface/arkdialog/BUILD.gn
deleted file mode 100644
index 6c5b90f..0000000
--- a/interface/arkdialog/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_arkdialog_abc") {
- src_js = rebase_path("arkdialog.js")
- dst_file = rebase_path(target_out_dir + "/arkdialog.abc")
- in_puts = [ "arkdialog.js" ]
- out_puts = [ target_out_dir + "/arkdialog.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("arkdialog_abc") {
- input = get_label_info(":gen_arkdialog_abc", "target_out_dir") + "/arkdialog.abc"
- output = target_out_dir + "/arkdialog_abc.o"
- dep = ":gen_arkdialog_abc"
-}
-
-ohos_shared_library("arkdialog") {
- sources = [ "arkdialog.cpp" ]
-
- deps = [ ":arkdialog_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/arkdialog/arkdialog.cpp b/interface/arkdialog/arkdialog.cpp
deleted file mode 100644
index 0db1e88..0000000
--- a/interface/arkdialog/arkdialog.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-extern const char _binary_arkdialog_abc_start[];
-extern const char _binary_arkdialog_abc_end[];
-
-// Napi get abc code function
-extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_ArkDialog_GetABCCode(const char **buf, int *buflen)
-{
- if (buf != nullptr) {
- *buf = _binary_arkdialog_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_arkdialog_abc_end - _binary_arkdialog_abc_start;
- }
-}
-
-/*
- * Module define
- */
-static napi_module arkdialogModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.ArkDialog",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-/*
- * Module register function
- */
-extern "C" __attribute__((constructor)) void arkdialogRegisterModule(void)
-{
- napi_module_register(&arkdialogModule);
-}
diff --git a/interface/arkdialog/arkdialog.js b/interface/arkdialog/arkdialog.js
deleted file mode 100644
index 36e355f..0000000
--- a/interface/arkdialog/arkdialog.js
+++ /dev/null
@@ -1,1604 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const CHECKBOX_CONTAINER_HEIGHT = 48;
-const CONTENT_MAX_LINES = 2;
-const DIVIDER_CONTAINER_WIDTH = 16;
-const DIVIDER_HEIGHT = 24;
-const DIVIDER_WIDTH = 2;
-const LOADING_PROGRESS_WIDTH = 40;
-const LOADING_PROGRESS_HEIGHT = 48;
-const ITEM_TEXT_SIZE = 14;
-
-export class TipsDialog extends ViewPU {
- constructor(e, o, t, r = -1) {
- super(e, t, r);
- this.controller = void 0;
- this.imageRes = void 0;
- this.imageSize = { width: '100%', height: 180 };
- this.title = '';
- this.content = '';
- this.checkTips = '';
- this.__isChecked = new ObservedPropertySimplePU(!1, this, 'isChecked');
- this.primaryButton = { value: '' };
- this.secondaryButton = { value: '' };
- this.setInitiallyProvidedValue(o);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.imageRes && (this.imageRes = e.imageRes);
- void 0 !== e.imageSize && (this.imageSize = e.imageSize);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.content && (this.content = e.content);
- void 0 !== e.checkTips && (this.checkTips = e.checkTips);
- void 0 !== e.isChecked && (this.isChecked = e.isChecked);
- void 0 !== e.primaryButton && (this.primaryButton = e.primaryButton);
- void 0 !== e.secondaryButton && (this.secondaryButton = e.secondaryButton);
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__isChecked.purgeDependencyOnElmtId(e);
- }
-
- aboutToBeDeleted() {
- this.__isChecked.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- setController(e) {
- this.controller = e;
- }
-
- get isChecked() {
- return this.__isChecked.get();
- }
-
- set isChecked(e) {
- this.__isChecked.set(e);
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.backgroundBlurStyle(BlurStyle.Thick);
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_dialog'],
- bundleName: '',
- moduleName: ''
- });
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_start'],
- bundleName: '',
- moduleName: ''
- },
- right: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_end'],
- bundleName: '',
- moduleName: ''
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_bottom'],
- bundleName: '',
- moduleName: ''
- }
- });
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_dialog_bg'],
- bundleName: '',
- moduleName: ''
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width('100%');
- Row.padding({ left: 24, right: 24 });
- Row.margin({ top: 24 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.layoutWeight(1);
- Column.clip(!0);
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.imageRes);
- Image.size(this.imageSize);
- Image.objectFit(ImageFit.Fill);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Column.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24 });
- Row.margin({ top: 16 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_headline8'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.textAlign(TextAlign.Center);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.content ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- Row.width('100%');
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body2'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.textAlign(TextAlign.Center);
- Text.minFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body3'],
- bundleName: '',
- moduleName: ''
- });
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.height(CHECKBOX_CONTAINER_HEIGHT);
- Row.width('100%');
- Row.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Checkbox.create({ name: 'checkbox', group: 'checkboxGroup' });
- Checkbox.select(this.isChecked);
- Checkbox.onChange((e => {
- this.isChecked = e;
- }));
- Checkbox.margin({ left: 0, right: 8 });
- o || Checkbox.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Checkbox.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.checkTips);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body2'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxLines(CONTENT_MAX_LINES);
- Text.layoutWeight(1);
- Text.focusOnTouch(!0);
- Text.onClick((() => {
- this.isChecked = !this.isChecked;
- }));
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width('100%');
- Row.padding({ left: 16, right: 16, top: 16, bottom: 16 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.primaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.primaryButton.background ? this.primaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.primaryButton.action && this.primaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value && this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(DIVIDER_CONTAINER_WIDTH);
- Column.alignItems(HorizontalAlign.Center);
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.background ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.width(DIVIDER_WIDTH);
- Divider.height(DIVIDER_HEIGHT);
- Divider.color({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_list_separator'],
- bundleName: '',
- moduleName: ''
- });
- Divider.vertical(!0);
- o || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- }));
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Column.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.secondaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.secondaryButton.background ? this.secondaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.secondaryButton.action && this.secondaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Row.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-
-export class SelectDialog extends ViewPU {
- constructor(e, o, t, r = -1) {
- super(e, t, r);
- this.controller = void 0;
- this.title = '';
- this.content = '';
- this.selectedIndex = -1;
- this.confirm = { value: '' };
- this.radioContent = [];
- this.setInitiallyProvidedValue(o);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.content && (this.content = e.content);
- void 0 !== e.selectedIndex && (this.selectedIndex = e.selectedIndex);
- void 0 !== e.confirm && (this.confirm = e.confirm);
- void 0 !== e.radioContent && (this.radioContent = e.radioContent);
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- }
-
- aboutToBeDeleted() {
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- setController(e) {
- this.controller = e;
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.backgroundBlurStyle(BlurStyle.Thick);
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_dialog'],
- bundleName: '',
- moduleName: ''
- });
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_start'],
- bundleName: '',
- moduleName: ''
- },
- right: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_end'],
- bundleName: '',
- moduleName: ''
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_bottom'],
- bundleName: '',
- moduleName: ''
- }
- });
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_dialog_bg'],
- bundleName: '',
- moduleName: ''
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 24 });
- Row.constraintSize({ minHeight: 56 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_dialog_tittle'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.maxLines(CONTENT_MAX_LINES);
- Text.minFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_sub_title1'],
- bundleName: '',
- moduleName: ''
- });
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.textAlign(TextAlign.Start);
- Text.width('100%');
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.content ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- Row.width('100%');
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body2'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxLines(CONTENT_MAX_LINES);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.minFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body3'],
- bundleName: '',
- moduleName: ''
- });
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- List.create({ space: 1 });
- List.width('100%');
- List.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- List.clip(!1);
- o || List.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.radioContent, ((e, o) => {
- const t = e;
- {
- const e = !0;
- const r = (o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ListItem.create(i, e);
- t || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording();
- };
- const s = () => {
- this.observeComponentCreation(r);
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.constraintSize({ minHeight: 48 });
- Row.clip(!1);
- Row.onClick((() => {
- t.action && t.action();
- this.controller.close();
- }));
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(t.title);
- Text.fontSize(ITEM_TEXT_SIZE);
- Text.fontWeight(FontWeight.Regular);
- Text.maxLines(CONTENT_MAX_LINES);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.layoutWeight(1);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- this.observeComponentCreation(((e, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Radio.create({ value: 'item.title', group: 'radioGroup' });
- Radio.checked(this.selectedIndex === o);
- Radio.onChange((() => {
- t.action && t.action();
- this.controller.close();
- }));
- Radio.onClick((() => {
- t.action && t.action();
- this.controller.close();
- }));
- r || Radio.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- o < this.radioContent.length - 1 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.color({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_list_separator'],
- bundleName: '',
- moduleName: ''
- });
- o || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Column.pop();
- ListItem.pop();
- };
- const i = (e, s) => {
- r(e, s);
- this.updateFuncByElmtId.set(e, r);
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.constraintSize({ minHeight: 48 });
- Row.clip(!1);
- Row.onClick((() => {
- t.action && t.action();
- this.controller.close();
- }));
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(t.title);
- Text.fontSize(ITEM_TEXT_SIZE);
- Text.fontWeight(FontWeight.Regular);
- Text.maxLines(CONTENT_MAX_LINES);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.layoutWeight(1);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- this.observeComponentCreation(((e, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Radio.create({ value: 'item.title', group: 'radioGroup' });
- Radio.checked(this.selectedIndex === o);
- Radio.onChange((() => {
- t.action && t.action();
- this.controller.close();
- }));
- Radio.onClick((() => {
- t.action && t.action();
- this.controller.close();
- }));
- r || Radio.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- o < this.radioContent.length - 1 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.color({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_list_separator'],
- bundleName: '',
- moduleName: ''
- });
- o || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Column.pop();
- ListItem.pop();
- };
- e ? (() => {
- this.observeComponentCreation(r);
- ListItem.pop();
- })() : s();
- }
- }), void 0, !0, !1);
- o || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- ForEach.pop();
- List.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width('100%');
- Row.padding({ left: 16, right: 16, top: 16, bottom: 16 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.confirm.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.confirm.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.confirm.background ? this.confirm.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.confirm.fontColor ? this.confirm.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.confirm.action && this.confirm.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Row.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-
-export class ConfirmDialog extends ViewPU {
- constructor(e, o, t, r = -1) {
- super(e, t, r);
- this.controller = void 0;
- this.title = '';
- this.content = '';
- this.checkTips = '';
- this.__isChecked = new ObservedPropertySimplePU(!1, this, 'isChecked');
- this.primaryButton = { value: '' };
- this.secondaryButton = { value: '' };
- this.setInitiallyProvidedValue(o);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.content && (this.content = e.content);
- void 0 !== e.checkTips && (this.checkTips = e.checkTips);
- void 0 !== e.isChecked && (this.isChecked = e.isChecked);
- void 0 !== e.primaryButton && (this.primaryButton = e.primaryButton);
- void 0 !== e.secondaryButton && (this.secondaryButton = e.secondaryButton);
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__isChecked.purgeDependencyOnElmtId(e);
- }
-
- aboutToBeDeleted() {
- this.__isChecked.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- setController(e) {
- this.controller = e;
- }
-
- get isChecked() {
- return this.__isChecked.get();
- }
-
- set isChecked(e) {
- this.__isChecked.set(e);
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.backgroundBlurStyle(BlurStyle.Thick);
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_dialog'],
- bundleName: '',
- moduleName: ''
- });
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_start'],
- bundleName: '',
- moduleName: ''
- },
- right: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_end'],
- bundleName: '',
- moduleName: ''
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_bottom'],
- bundleName: '',
- moduleName: ''
- }
- });
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_dialog_bg'],
- bundleName: '',
- moduleName: ''
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 24 });
- Row.constraintSize({ minHeight: 56 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_dialog_tittle'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.maxLines(CONTENT_MAX_LINES);
- Text.minFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_sub_title1'],
- bundleName: '',
- moduleName: ''
- });
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.textAlign(TextAlign.Start);
- Text.width('100%');
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.content ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- Row.width('100%');
- Row.constraintSize({ minHeight: 36 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body1'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxLines(CONTENT_MAX_LINES);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.minFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body3'],
- bundleName: '',
- moduleName: ''
- });
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.height(CHECKBOX_CONTAINER_HEIGHT);
- Row.width('100%');
- Row.padding({ left: 24, right: 24, top: 8, bottom: 8 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Checkbox.create({ name: 'checkbox', group: 'checkboxGroup' });
- Checkbox.select(this.isChecked);
- Checkbox.onChange((e => {
- this.isChecked = e;
- }));
- Checkbox.margin({ left: 0, right: 8 });
- o || Checkbox.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Checkbox.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.checkTips);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body2'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxLines(CONTENT_MAX_LINES);
- Text.layoutWeight(1);
- Text.focusOnTouch(!0);
- Text.onClick((() => {
- this.isChecked = !this.isChecked;
- }));
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width('100%');
- Row.padding({ left: 16, right: 16, top: 16, bottom: 16 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.primaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.primaryButton.background ? this.primaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.primaryButton.action && this.primaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value && this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(DIVIDER_CONTAINER_WIDTH);
- Column.alignItems(HorizontalAlign.Center);
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.background ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.width(DIVIDER_WIDTH);
- Divider.height(DIVIDER_HEIGHT);
- Divider.color({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_list_separator'],
- bundleName: '',
- moduleName: ''
- });
- Divider.vertical(!0);
- o || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- }));
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Column.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.secondaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.secondaryButton.background ? this.secondaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.secondaryButton.action && this.secondaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Row.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-
-export class AlertDialog extends ViewPU {
- constructor(e, o, t, r = -1) {
- super(e, t, r);
- this.controller = void 0;
- this.content = '';
- this.primaryButton = { value: '' };
- this.secondaryButton = { value: '' };
- this.setInitiallyProvidedValue(o);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.content && (this.content = e.content);
- void 0 !== e.primaryButton && (this.primaryButton = e.primaryButton);
- void 0 !== e.secondaryButton && (this.secondaryButton = e.secondaryButton);
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- }
-
- aboutToBeDeleted() {
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- setController(e) {
- this.controller = e;
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.backgroundBlurStyle(BlurStyle.Thick);
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_dialog'],
- bundleName: '',
- moduleName: ''
- });
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_start'],
- bundleName: '',
- moduleName: ''
- },
- right: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_end'],
- bundleName: '',
- moduleName: ''
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_bottom'],
- bundleName: '',
- moduleName: ''
- }
- });
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_dialog_bg'],
- bundleName: '',
- moduleName: ''
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.padding({ left: 24, right: 24, top: 24 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body1'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width('100%');
- Row.padding({ left: 16, right: 16, top: 16, bottom: 16 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.primaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.primaryButton.background ? this.primaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.primaryButton.action && this.primaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value && this.primaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(DIVIDER_CONTAINER_WIDTH);
- Column.alignItems(HorizontalAlign.Center);
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.background ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.width(DIVIDER_WIDTH);
- Divider.height(DIVIDER_HEIGHT);
- Divider.color({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_list_separator'],
- bundleName: '',
- moduleName: ''
- });
- Divider.vertical(!0);
- o || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- }));
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Column.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.secondaryButton.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithLabel(this.secondaryButton.value);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button1'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontWeight(FontWeight.Medium);
- Button.layoutWeight(1);
- Button.backgroundColor(this.secondaryButton.background ? this.secondaryButton.background : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_background_transparent'],
- bundleName: '',
- moduleName: ''
- });
- Button.fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- });
- Button.onClick((() => {
- this.secondaryButton.action && this.secondaryButton.action();
- this.controller.close();
- }));
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Button.pop();
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Row.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-
-export class LoadingDialog extends ViewPU {
- constructor(e, o, t, r = -1) {
- super(e, t, r);
- this.controller = void 0;
- this.content = '';
- this.setInitiallyProvidedValue(o);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.content && (this.content = e.content);
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- }
-
- aboutToBeDeleted() {
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- setController(e) {
- this.controller = e;
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.backgroundBlurStyle(BlurStyle.Thick);
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_dialog'],
- bundleName: '',
- moduleName: ''
- });
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_start'],
- bundleName: '',
- moduleName: ''
- },
- right: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_end'],
- bundleName: '',
- moduleName: ''
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_dialog_margin_bottom'],
- bundleName: '',
- moduleName: ''
- }
- });
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_dialog_bg'],
- bundleName: '',
- moduleName: ''
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({ left: 24, right: 24, top: 24, bottom: 24 });
- Row.constraintSize({ minHeight: 48 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_body1'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- });
- Text.layoutWeight(1);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- LoadingProgress.create();
- LoadingProgress.width(LOADING_PROGRESS_WIDTH);
- LoadingProgress.height(LOADING_PROGRESS_HEIGHT);
- LoadingProgress.margin({ left: 16 });
- o || LoadingProgress.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Row.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-export default { TipsDialog, ConfirmDialog, SelectDialog, AlertDialog, LoadingDialog };
\ No newline at end of file
diff --git a/interface/composelistitem/BUILD.gn b/interface/composelistitem/BUILD.gn
deleted file mode 100644
index a70c722..0000000
--- a/interface/composelistitem/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_composelistitem_abc") {
- src_js = rebase_path("composelistitem.js")
- dst_file = rebase_path(target_out_dir + "/composelistitem.abc")
- in_puts = [ "composelistitem.js" ]
- out_puts = [ target_out_dir + "/composelistitem.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("composelistitem_abc") {
- input = get_label_info(":gen_composelistitem_abc", "target_out_dir") + "/composelistitem.abc"
- output = target_out_dir + "/composelistitem_abc.o"
- dep = ":gen_composelistitem_abc"
-}
-
-ohos_shared_library("composelistitem") {
- sources = [ "composelistitem.cpp" ]
-
- deps = [ ":composelistitem_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/composelistitem/composelistitem.cpp b/interface/composelistitem/composelistitem.cpp
deleted file mode 100644
index bf795fc..0000000
--- a/interface/composelistitem/composelistitem.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
- {
- if (buf != nullptr) {
- *buf = _binary_composelistitem_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_composelistitem_abc_end - _binary_composelistitem_abc_start;
- }
- }
-
-
-static napi_module composelistitemModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.ComposeListItem",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void composelistitemRegisterModule(void)
-{
- napi_module_register(&composelistitemModule);
-}
\ No newline at end of file
diff --git a/interface/composelistitem/composelistitem.js b/interface/composelistitem/composelistitem.js
deleted file mode 100644
index 09de65f..0000000
--- a/interface/composelistitem/composelistitem.js
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-export var IconType;
-!function(e){
- e[e.BADGE=1] = "BADGE";
- e[e.NORMAL_ICON=2] = "NORMAL_ICON";
- e[e.SYSTEM_ICON=3] = "SYSTEM_ICON";
- e[e.HEAD_SCULPTURE=4] = "HEAD_SCULPTURE";
- e[e.APP_ICON=5] = "APP_ICON";
- e[e.PREVIEW=6] = "PREVIEW";
- e[e.LONGITUDINAL=7] = "LONGITUDINAL";
- e[e.VERTICAL=8] = "VERTICAL"
-}(IconType || (IconType = {}));
-var ItemHeight;
-!function(e){
- e[e.FIRST_HEIGHT=48] = "FIRST_HEIGHT";
- e[e.SECOND_HEIGHT=56] = "SECOND_HEIGHT";
- e[e.THIRD_HEIGHT=64] = "THIRD_HEIGHT";
- e[e.FOURTH_HEIGHT=72] = "FOURTH_HEIGHT";
- e[e.FIFTH_HEIGHT=96] = "FIFTH_HEIGHT"
-}(ItemHeight || (ItemHeight = {}));
-const LISTITEMCARD_BORDER_HIDDEN = 0;
-const TEXT_MAX_LINE = 1;
-const LISTITEMCARD_BORDER_SHOWN = 2;
-const TEXT_COLUMN_SPACE = 2;
-const TEXT_SAFE_MARGIN = 8;
-const BADGE_SIZE = 8;
-const SMALL_ICON_SIZE = 16;
-const SYSTEM_ICON_SIZE = 24;
-const SAFE_LIST_PADDING = 32;
-const HEADSCULPTURE_SIZE = 40;
-const BUTTON_SIZE = 28;
-const APP_ICON_SIZE = 64;
-const PREVIEW_SIZE = 96;
-const LONGITUDINAL_SIZE = 96;
-const VERTICAL_SIZE = 96;
-const NORMAL_ITEM_ROW_SPACE = 16;
-const SPECIAL_ITEM_ROW_SPACE = 0;
-const SPECIAL_ICON_SIZE = 0;
-const DEFAULT_ROW_SPACE = 0;
-const SPECICAL_ROW_SPACE = 4;
-const OPERATEITEM_ICONLIKE_SIZE = 24;
-const OPERATEITEM_ARROW_WIDTH = 12;
-const OPERATEITEM_ICON_CLICKABLE_SIZE = 48;
-const OPERATEITEM_IMAGE_SIZE = 48;
-const HOVERING_COLOR = "#0d000000";
-const TOUCH_DOWN_COLOR = "#1a000000";
-const ACTIVED_COLOR = "#1a0a59f7";
-
-class ContentItemStruct extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.iconStyle = null;
- this.icon = null;
- this.title = null;
- this.subtitle = null;
- this.description = null;
- this.iconSizeMap = new Map([[IconType.BADGE, 8], [IconType.NORMAL_ICON, 16], [IconType.SYSTEM_ICON, 24], [IconType.HEAD_SCULPTURE, 40], [IconType.APP_ICON, 64], [IconType.PREVIEW, 96], [IconType.LONGITUDINAL, 96], [IconType.VERTICAL, 96]]);
- this.itemHeight = ItemHeight.FIRST_HEIGHT;
- this.itemRowSpace = 16;
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.iconStyle && (this.iconStyle = e.iconStyle);
- void 0 !== e.icon && (this.icon = e.icon);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.subtitle && (this.subtitle = e.subtitle);
- void 0 !== e.description && (this.description = e.description);
- void 0 !== e.iconSizeMap && (this.iconSizeMap = e.iconSizeMap);
- void 0 !== e.itemHeight && (this.itemHeight = e.itemHeight);
- void 0 !== e.itemRowSpace && (this.itemRowSpace = e.itemRowSpace)
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- }
-
- aboutToBeDeleted() {
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- aboutToAppear() {
- null == this.subtitle && null == this.description ? null == this.icon ? this.itemHeight = ItemHeight.FIRST_HEIGHT : this.itemHeight = this.iconStyle <= IconType.HEAD_SCULPTURE ? ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT : null == this.description ? null == this.icon || null != this.icon && this.iconStyle <= IconType.SYSTEM_ICON ? this.itemHeight = ItemHeight.THIRD_HEIGHT : this.itemHeight = ItemHeight.FOURTH_HEIGHT : this.itemHeight = ItemHeight.FIFTH_HEIGHT;
- null == this.icon && null == this.iconStyle && (this.itemRowSpace = 0);
- this.iconSizeMap.get(this.iconStyle) >= this.itemHeight && (this.itemHeight = this.iconSizeMap.get(this.iconStyle) + 32)
- }
-
- createIcon(e = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.icon && null != this.iconStyle ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.iconStyle <= IconType.PREVIEW ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.icon);
- Image.objectFit(ImageFit.Contain);
- Image.width(this.iconSizeMap.get(this.iconStyle));
- Image.height(this.iconSizeMap.get(this.iconStyle));
- Image.borderRadius({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_default_m"],
- bundleName: "",
- moduleName: ""
- });
- Image.focusable(!0);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.icon);
- Image.objectFit(ImageFit.Contain);
- Image.constraintSize({
- minWidth: 0,
- maxWidth: this.iconSizeMap.get(this.iconStyle),
- minHeight: 0,
- maxHeight: this.iconSizeMap.get(this.iconStyle)
- });
- Image.borderRadius({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_default_m"],
- bundleName: "",
- moduleName: ""
- });
- Image.focusable(!0);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- }
-
- createText(e = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create({ space: 2 });
- Column.margin({ top: 8, bottom: 8 });
- Column.alignItems(HorizontalAlign.Start);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.focusable(!0);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.subtitle);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.focusable(!0);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.description ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.description);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.focusable(!0);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({ space: this.itemRowSpace });
- Row.height(this.itemHeight);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.createIcon.bind(this)();
- this.createText.bind(this)();
- Row.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-class OperateItemStruct extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.arrow = null;
- this.icon = null;
- this.subIcon = null;
- this.button = null;
- this.switch = null;
- this.checkBox = null;
- this.radio = null;
- this.image = null;
- this.text = null;
- this.__switchState = new ObservedPropertySimplePU(!1, this, "switchState");
- this.__radioState = new ObservedPropertySimplePU(!1, this, "radioState");
- this.__checkBoxState = new ObservedPropertySimplePU(!1, this, "checkBoxState");
- this.rowSpace = 0;
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.arrow && (this.arrow = e.arrow);
- void 0 !== e.icon && (this.icon = e.icon);
- void 0 !== e.subIcon && (this.subIcon = e.subIcon);
- void 0 !== e.button && (this.button = e.button);
- void 0 !== e.switch && (this.switch = e.switch);
- void 0 !== e.checkBox && (this.checkBox = e.checkBox);
- void 0 !== e.radio && (this.radio = e.radio);
- void 0 !== e.image && (this.image = e.image);
- void 0 !== e.text && (this.text = e.text);
- void 0 !== e.switchState && (this.switchState = e.switchState);
- void 0 !== e.radioState && (this.radioState = e.radioState);
- void 0 !== e.checkBoxState && (this.checkBoxState = e.checkBoxState);
- void 0 !== e.rowSpace && (this.rowSpace = e.rowSpace)
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__switchState.purgeDependencyOnElmtId(e);
- this.__radioState.purgeDependencyOnElmtId(e);
- this.__checkBoxState.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__switchState.aboutToBeDeleted();
- this.__radioState.aboutToBeDeleted();
- this.__checkBoxState.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get switchState() {
- return this.__switchState.get()
- }
-
- set switchState(e) {
- this.__switchState.set(e)
- }
-
- get radioState() {
- return this.__radioState.get()
- }
-
- set radioState(e) {
- this.__radioState.set(e)
- }
-
- get checkBoxState() {
- return this.__checkBoxState.get()
- }
-
- set checkBoxState(e) {
- this.__checkBoxState.set(e)
- }
-
- aboutToAppear() {
- null != this.switch && (this.switchState = this.switch.isCheck);
- null != this.radio && (this.radioState = this.radio.isCheck);
- null != this.checkBox && (this.checkBoxState = this.checkBox.isCheck);
- (null == this.button && null == this.image && null != this.icon && null != this.text || null == this.button && null == this.image && null == this.icon && null != this.arrow && null != this.text) && (this.rowSpace = 4)
- }
-
- createButton(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Button.createWithLabel(e);
- Button.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_button3"],
- bundleName: "",
- moduleName: ""
- });
- Button.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated_transparent"],
- bundleName: "",
- moduleName: ""
- });
- Button.height(28);
- Button.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_button_normal"],
- bundleName: "",
- moduleName: ""
- });
- Button.labelStyle({ maxLines: 1 });
- o || Button.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Button.pop()
- }
-
- createIcon(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Row.create();
- Row.height(48);
- Row.width(48);
- Row.justifyContent(FlexAlign.Center);
- Row.onClick(e.action);
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Image.create(e.value);
- Image.height(24);
- Image.width(24);
- Image.focusable(!0);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- });
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
-
- createImage(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Image.create(e);
- Image.height(48);
- Image.width(48);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }
-
- createText(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Text.create(e);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.focusable(!0);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- }
-
- createArrow(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Image.create(e.value);
- Image.height(24);
- Image.width(12);
- Image.focusable(!0);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_fourth"],
- bundleName: "",
- moduleName: ""
- });
- Image.onClick(e.action);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }
-
- createRadio(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Radio.create({ value: null, group: null });
- Radio.checked(this.radioState);
- Radio.onChange(e.onChange);
- Radio.height(24);
- Radio.width(24);
- o || Radio.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }
-
- createCheckBox(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Checkbox.create();
- Checkbox.select(this.checkBoxState);
- Checkbox.onChange(e.onChange);
- Checkbox.height(24);
- Checkbox.height(24);
- o || Checkbox.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Checkbox.pop()
- }
-
- createSwitch(e, t = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.height(48);
- Row.width(48);
- Row.justifyContent(FlexAlign.Center);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Toggle.create({ type: ToggleType.Switch, isOn: this.switchState });
- Toggle.onChange(e.onChange);
- Toggle.onClick((() => {
- this.switchState = !this.switchState
- }));
- o || Toggle.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Toggle.pop();
- Row.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({ space: this.rowSpace });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.button ? this.ifElseBranchUpdateFunction(0, (() => {
- this.createButton.bind(this)(this.button.text)
- })) : null != this.image ? this.ifElseBranchUpdateFunction(1, (() => {
- this.createImage.bind(this)(this.image)
- })) : null != this.icon && null != this.text ? this.ifElseBranchUpdateFunction(2, (() => {
- this.createText.bind(this)(this.text);
- this.createIcon.bind(this)(this.icon)
- })) : null != this.arrow && null == this.text ? this.ifElseBranchUpdateFunction(3, (() => {
- this.createArrow.bind(this)(this.arrow)
- })) : null != this.arrow && null != this.text ? this.ifElseBranchUpdateFunction(4, (() => {
- this.createText.bind(this)(this.text);
- this.createArrow.bind(this)(this.arrow)
- })) : null != this.text ? this.ifElseBranchUpdateFunction(5, (() => {
- this.createText.bind(this)(this.text)
- })) : null != this.radio ? this.ifElseBranchUpdateFunction(6, (() => {
- this.createRadio.bind(this)(this.radio)
- })) : null != this.checkBox ? this.ifElseBranchUpdateFunction(7, (() => {
- this.createCheckBox.bind(this)(this.checkBox)
- })) : null != this.switch ? this.ifElseBranchUpdateFunction(8, (() => {
- this.createSwitch.bind(this)(this.switch)
- })) : null != this.icon && this.ifElseBranchUpdateFunction(9, (() => {
- this.createIcon.bind(this)(this.icon);
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.subIcon ? this.ifElseBranchUpdateFunction(0, (() => {
- this.createIcon.bind(this)(this.subIcon)
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export class ComposeListItem extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.__contentItem = new SynchedPropertyObjectOneWayPU(t.contentItem, this, "contentItem");
- this.__operateItem = new SynchedPropertyObjectOneWayPU(t.operateItem, this, "operateItem");
- this.__frontColor = new ObservedPropertySimplePU(Color.Transparent.toString(), this, "frontColor");
- this.__borderSize = new ObservedPropertySimplePU(0, this, "borderSize");
- this.isActive = !1;
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.contentItem ? this.__contentItem.set(e.contentItem) : this.__contentItem.set(null);
- void 0 !== e.operateItem ? this.__operateItem.set(e.operateItem) : this.__operateItem.set(null);
- void 0 !== e.frontColor && (this.frontColor = e.frontColor);
- void 0 !== e.borderSize && (this.borderSize = e.borderSize);
- void 0 !== e.isActive && (this.isActive = e.isActive)
- }
-
- updateStateVars(e) {
- this.__contentItem.reset(e.contentItem);
- this.__operateItem.reset(e.operateItem)
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__contentItem.purgeDependencyOnElmtId(e);
- this.__operateItem.purgeDependencyOnElmtId(e);
- this.__frontColor.purgeDependencyOnElmtId(e);
- this.__borderSize.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__contentItem.aboutToBeDeleted();
- this.__operateItem.aboutToBeDeleted();
- this.__frontColor.aboutToBeDeleted();
- this.__borderSize.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get contentItem() {
- return this.__contentItem.get()
- }
-
- set contentItem(e) {
- this.__contentItem.set(e)
- }
-
- get operateItem() {
- return this.__operateItem.get()
- }
-
- set operateItem(e) {
- this.__operateItem.set(e)
- }
-
- get frontColor() {
- return this.__frontColor.get()
- }
-
- set frontColor(e) {
- this.__frontColor.set(e)
- }
-
- get borderSize() {
- return this.__borderSize.get()
- }
-
- set borderSize(e) {
- this.__borderSize.set(e)
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.padding({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center });
- Flex.focusable(!0);
- Flex.border({
- width: this.borderSize,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- }
- });
- Flex.borderRadius({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_default_m"],
- bundleName: "",
- moduleName: ""
- });
- Flex.backgroundColor(this.frontColor);
- Flex.onFocus((() => {
- this.borderSize = 2
- }));
- Flex.onBlur((() => {
- this.borderSize = 0
- }));
- Flex.onHover((e => {
- this.frontColor = e ? "#0d000000" : this.isActive ? "#1a0a59f7" : Color.Transparent.toString()
- }));
- Flex.onTouch((e => {
- e.type == TouchType.Down && (this.frontColor = "#1a000000");
- e.type == TouchType.Up && (this.frontColor = this.isActive ? "#1a0a59f7" : Color.Transparent.toString())
- }));
- Flex.onClick((() => {
- this.isActive = !this.isActive;
- this.frontColor = this.isActive ? "#1a0a59f7" : Color.Transparent.toString()
- }));
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null == this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ContentItemStruct(this, {
- title: null
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ContentItemStruct(this, {
- icon: "string" == typeof this.contentItem.icon ? null : this.contentItem.icon,
- iconStyle: this.contentItem.iconStyle,
- title: "string" == typeof this.contentItem.primaryText ? this.contentItem.primaryText : null,
- subtitle: "string" == typeof this.contentItem.secondaryText ? this.contentItem.secondaryText : null,
- description: "string" == typeof this.contentItem.description ? this.contentItem.description : null
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.operateItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new OperateItemStruct(this, {
- icon: this.operateItem.icon,
- subIcon: this.operateItem.subIcon,
- button: this.operateItem.button,
- switch: this.operateItem.switch,
- checkBox: this.operateItem.checkbox,
- radio: this.operateItem.radio,
- image: "string" == typeof this.operateItem.image ? null : this.operateItem.image,
- text: "string" == typeof this.operateItem.text ? this.operateItem.text : null,
- arrow: "string" == typeof this.operateItem.arrow ? null : this.operateItem.arrow
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Flex.pop();
- Column.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export default { IconType, ComposeListItem };
\ No newline at end of file
diff --git a/interface/composetitlebar/BUILD.gn b/interface/composetitlebar/BUILD.gn
deleted file mode 100755
index f953441..0000000
--- a/interface/composetitlebar/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_composetitlebar_abc") {
- src_js = rebase_path("composetitlebar.js")
- dst_file = rebase_path(target_out_dir + "/composetitlebar.abc")
- in_puts = [ "composetitlebar.js" ]
- out_puts = [ target_out_dir + "/composetitlebar.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("composetitlebar_abc") {
- input = get_label_info(":gen_composetitlebar_abc", "target_out_dir") + "/composetitlebar.abc"
- output = target_out_dir + "/composetitlebar_abc.o"
- dep = ":gen_composetitlebar_abc"
-}
-
-ohos_shared_library("composetitlebar") {
- sources = [ "composetitlebar.cpp" ]
-
- deps = [ ":composetitlebar_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/composetitlebar/composetitlebar.cpp b/interface/composetitlebar/composetitlebar.cpp
deleted file mode 100644
index efe49d9..0000000
--- a/interface/composetitlebar/composetitlebar.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
- {
- if (buf != nullptr) {
- *buf = _binary_composetitlebar_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_composetitlebar_abc_end - _binary_composetitlebar_abc_start;
- }
- }
-
-
-static napi_module composetitlebarModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.ComposeTitleBar",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void composetitlebarRegisterModule(void)
-{
- napi_module_register(&composetitlebarModule);
-}
\ No newline at end of file
diff --git a/interface/composetitlebar/composetitlebar.js b/interface/composetitlebar/composetitlebar.js
deleted file mode 100644
index cff24b9..0000000
--- a/interface/composetitlebar/composetitlebar.js
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-var __decorate = this && this.__decorate || function(e, t, o, i) {
- var s, r = arguments.length,
- n = r < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, o, i);
- else
- for (var c = e.length - 1; c >= 0; c--)(s = e[c]) && (n = (r < 3 ? s(n) : r > 3 ? s(t, o, n) : s(t, o)) || n);
- return r > 3 && n && Object.defineProperty(t, o, n), n
-};
-const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
-const PUBLIC_MORE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuAxhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BICydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdYjJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5HnhkC9+zAA5YXXy8jBKV5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rmj79U74wCszuih+F/ljrSi/+uud8YBGA10rayqrnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hkH4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ/N5Vjd0oTXKp9QcKFpD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fNQ1BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnXfo96DGYBRZD1ycpc/XzbmbvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jpyaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jvjACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrpVV1fXOOADLA10rq6rrnXEAVga6VlZV13uh8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5LP+r7veGQfgd+T+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtUtTXit8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXvO9H8f1bfVPQ9FvQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC";
-const PUBLIC_BACK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0GiIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpgIzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLnHedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+sPy9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6zELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC";
-export class ComposeTitleBar extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.item = void 0;
- this.title = void 0;
- this.subtitle = void 0;
- this.menuItems = void 0;
- this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, "titleMaxWidth");
- this.__isItemOnFocus = new ObservedPropertySimplePU(!1, this, "isItemOnFocus");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.subtitle && (this.subtitle = e.subtitle);
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.titleMaxWidth && (this.titleMaxWidth = e.titleMaxWidth);
- void 0 !== e.isItemOnFocus && (this.isItemOnFocus = e.isItemOnFocus)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__titleMaxWidth.purgeDependencyOnElmtId(e);
- this.__isItemOnFocus.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__titleMaxWidth.aboutToBeDeleted();
- this.__isItemOnFocus.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get titleMaxWidth() {
- return this.__titleMaxWidth.get()
- }
- set titleMaxWidth(e) {
- this.__titleMaxWidth.set(e)
- }
- get isItemOnFocus() {
- return this.__isItemOnFocus.get()
- }
- set isItemOnFocus(e) {
- this.__isItemOnFocus.set(e)
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- });
- Flex.width("100%");
- Flex.height(ComposeTitleBar.totalHeight);
- Flex.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Flex.onAreaChange(((e, t) => {
- let o = Number(t.width);
- if (void 0 !== this.menuItems) {
- let e = this.menuItems.length;
- e >= CollapsibleMenuSection.maxCountOfVisibleItems ? o -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems : e > 0 && (o -= ImageMenuItem.imageHotZoneWidth * e)
- }
- this.titleMaxWidth = o;
- this.titleMaxWidth -= ComposeTitleBar.leftPadding;
- this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth;
- void 0 !== this.item && (this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding + ComposeTitleBar.portraitImageSize + ComposeTitleBar.portraitImageRightPadding);
- this.titleMaxWidth -= ComposeTitleBar.rightPadding
- }));
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_start"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Navigator.create();
- t || Navigator.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: {
- value: PUBLIC_BACK,
- isEnabled: !0
- }
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Navigator.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.item ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.width(ComposeTitleBar.portraitImageSize);
- Image.height(ComposeTitleBar.portraitImageSize);
- Image.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_m"],
- bundleName: "",
- moduleName: ""
- }
- });
- Image.focusable(this.item.isEnabled);
- Image.borderRadius(ImageMenuItem.buttonBorderRadius);
- Image.onFocus((() => this.isItemOnFocus = !0));
- Image.onBlur((() => this.isItemOnFocus = !1));
- Image.border(this.isItemOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Image.onClick((() => this.item.isEnabled && this.item.action && this.item.action()));
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.justifyContent(FlexAlign.Start);
- Column.alignItems(HorizontalAlign.Start);
- Column.constraintSize({
- maxWidth: this.titleMaxWidth
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.title ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.justifyContent(FlexAlign.Start);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontWeight(FontWeight.Medium);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline8"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(void 0 !== this.subtitle ? 1 : 2);
- Text.textOverflow({
- overflow: TextOverflow.Ellipsis
- });
- Text.constraintSize({
- maxWidth: this.titleMaxWidth
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.justifyContent(FlexAlign.Start);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.subtitle);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_over_line"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_subtitle_text"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({
- overflow: TextOverflow.Ellipsis
- });
- Text.constraintSize({
- maxWidth: this.titleMaxWidth
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new CollapsibleMenuSection(this, {
- menuItems: this.menuItems
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Flex.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-ComposeTitleBar.totalHeight = 56;
-ComposeTitleBar.leftPadding = 12;
-ComposeTitleBar.rightPadding = 12;
-ComposeTitleBar.portraitImageSize = 40;
-ComposeTitleBar.portraitImageLeftPadding = 4;
-ComposeTitleBar.portraitImageRightPadding = 16;
-class CollapsibleMenuSection extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.menuItems = void 0;
- this.__isPopupShown = new ObservedPropertySimplePU(!1, this, "isPopupShown");
- this.__isMoreIconOnFocus = new ObservedPropertySimplePU(!1, this, "isMoreIconOnFocus");
- this.__isMoreIconOnHover = new ObservedPropertySimplePU(!1, this, "isMoreIconOnHover");
- this.__isMoreIconOnClick = new ObservedPropertySimplePU(!1, this, "isMoreIconOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.isPopupShown && (this.isPopupShown = e.isPopupShown);
- void 0 !== e.isMoreIconOnFocus && (this.isMoreIconOnFocus = e.isMoreIconOnFocus);
- void 0 !== e.isMoreIconOnHover && (this.isMoreIconOnHover = e.isMoreIconOnHover);
- void 0 !== e.isMoreIconOnClick && (this.isMoreIconOnClick = e.isMoreIconOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isPopupShown.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnHover.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isPopupShown.aboutToBeDeleted();
- this.__isMoreIconOnFocus.aboutToBeDeleted();
- this.__isMoreIconOnHover.aboutToBeDeleted();
- this.__isMoreIconOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isPopupShown() {
- return this.__isPopupShown.get()
- }
- set isPopupShown(e) {
- this.__isPopupShown.set(e)
- }
- get isMoreIconOnFocus() {
- return this.__isMoreIconOnFocus.get()
- }
- set isMoreIconOnFocus(e) {
- this.__isMoreIconOnFocus.set(e)
- }
- get isMoreIconOnHover() {
- return this.__isMoreIconOnHover.get()
- }
- set isMoreIconOnHover(e) {
- this.__isMoreIconOnHover.set(e)
- }
- get isMoreIconOnClick() {
- return this.__isMoreIconOnClick.get()
- }
- set isMoreIconOnClick(e) {
- this.__isMoreIconOnClick.set(e)
- }
- getMoreIconFgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getMoreIconBgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isMoreIconOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("100%");
- Column.margin({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Column.justifyContent(FlexAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems, (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getMoreIconFgColor());
- Row.backgroundColor(this.getMoreIconBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.border(this.isMoreIconOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => this.isMoreIconOnFocus = !0));
- Row.onBlur((() => this.isMoreIconOnFocus = !1));
- Row.onHover((e => this.isMoreIconOnHover = e));
- Row.onKeyEvent((e => {
- if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) {
- e.type === KeyType.Down && (this.isMoreIconOnClick = !0);
- e.type === KeyType.Up && (this.isMoreIconOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- e.type === TouchType.Down && (this.isMoreIconOnClick = !0);
- e.type === TouchType.Up && (this.isMoreIconOnClick = !1)
- }));
- Row.onClick((() => this.isPopupShown = !0));
- Row.bindPopup(this.isPopupShown, {
- builder: {
- builder: this.popupBuilder.bind(this)
- },
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: !1,
- onStateChange: e => this.isPopupShown = e.isVisible
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(PUBLIC_MORE);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(!0);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Column.pop()
- }
- popupBuilder(e = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum);
- Column.margin({
- top: CollapsibleMenuSection.focusPadding,
- bottom: CollapsibleMenuSection.focusPadding
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), ((e, t) => {
- const o = e;
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: o
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }), void 0, !0, !1);
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Column.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-CollapsibleMenuSection.maxCountOfVisibleItems = 3;
-CollapsibleMenuSection.focusPadding = 4;
-CollapsibleMenuSection.marginsNum = 2;
-__decorate([], CollapsibleMenuSection.prototype, "popupBuilder", null);
-class ImageMenuItem extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.item = void 0;
- this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus");
- this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover");
- this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus);
- void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover);
- void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isOnFocus.purgeDependencyOnElmtId(e);
- this.__isOnHover.purgeDependencyOnElmtId(e);
- this.__isOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isOnFocus.aboutToBeDeleted();
- this.__isOnHover.aboutToBeDeleted();
- this.__isOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isOnFocus() {
- return this.__isOnFocus.get()
- }
- set isOnFocus(e) {
- this.__isOnFocus.set(e)
- }
- get isOnHover() {
- return this.__isOnHover.get()
- }
- set isOnHover(e) {
- this.__isOnHover.set(e)
- }
- get isOnClick() {
- return this.__isOnClick.get()
- }
- set isOnClick(e) {
- this.__isOnClick.set(e)
- }
- getFgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getBgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getFgColor());
- Row.backgroundColor(this.getBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
- Row.border(this.isOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => {
- this.item.isEnabled && (this.isOnFocus = !0)
- }));
- Row.onBlur((() => this.isOnFocus = !1));
- Row.onHover((e => {
- this.item.isEnabled && (this.isOnHover = e)
- }));
- Row.onKeyEvent((e => {
- if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- if (this.item.isEnabled) {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action()));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(this.item.isEnabled);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-ImageMenuItem.imageSize = 24;
-ImageMenuItem.imageHotZoneWidth = 48;
-ImageMenuItem.buttonBorderRadius = 8;
-ImageMenuItem.focusBorderWidth = 2;
-ImageMenuItem.disabledImageOpacity = .4;
-export default {
- ComposeTitleBar: ComposeTitleBar
-};
\ No newline at end of file
diff --git a/interface/editabletitlebar/BUILD.gn b/interface/editabletitlebar/BUILD.gn
deleted file mode 100755
index 2a7a013..0000000
--- a/interface/editabletitlebar/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_editabletitlebar_abc") {
- src_js = rebase_path("editabletitlebar.js")
- dst_file = rebase_path(target_out_dir + "/editabletitlebar.abc")
- in_puts = [ "editabletitlebar.js" ]
- out_puts = [ target_out_dir + "/editabletitlebar.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("editabletitlebar_abc") {
- input = get_label_info(":gen_editabletitlebar_abc", "target_out_dir") + "/editabletitlebar.abc"
- output = target_out_dir + "/editabletitlebar_abc.o"
- dep = ":gen_editabletitlebar_abc"
-}
-
-ohos_shared_library("editabletitlebar") {
- sources = [ "editabletitlebar.cpp" ]
-
- deps = [ ":editabletitlebar_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/editabletitlebar/editabletitlebar.cpp b/interface/editabletitlebar/editabletitlebar.cpp
deleted file mode 100644
index 2630a0d..0000000
--- a/interface/editabletitlebar/editabletitlebar.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-extern const char _binary_editabletitlebar_abc_start[];
-extern const char _binary_editabletitlebar_abc_end[];
-
-// Napi get abc code function
-extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_EditableTitleBar_GetABCCode(const char **buf, int *buflen)
- {
- if (buf != nullptr) {
- *buf = _binary_editabletitlebar_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_editabletitlebar_abc_end - _binary_editabletitlebar_abc_start;
- }
- }
-
-
-static napi_module editabletitlebarModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.EditableTitleBar",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void editabletitlebarRegisterModule(void)
-{
- napi_module_register(&editabletitlebarModule);
-}
\ No newline at end of file
diff --git a/interface/editabletitlebar/editabletitlebar.js b/interface/editabletitlebar/editabletitlebar.js
deleted file mode 100644
index d3e9b68..0000000
--- a/interface/editabletitlebar/editabletitlebar.js
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
-export var EditableLeftIconType;
-! function(e) {
- e[e.Back = 0] = "Back";
- e[e.Cancel = 1] = "Cancel"
-}(EditableLeftIconType || (EditableLeftIconType = {}));
-const PUBLIC_CANCEL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABKpJREFUeNrt3bFrlHccx/Ff4o2dgkOQ4JzR4SYJgksnbYcGOrTQsUPtpE4d/RNcFBeFlg7NUlTSTrXQQgsKGV0KHTs4ODiJSL8PdxaUGJK7pPc893m94TvleZLnnt/7fcc9z5FrDQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnDQrPTuej2u2a87VvKp5XLNT87OlGiSf1lx6Zz2/q3kkgLdZr7k5lX8/7tZ8XfOCU4OgW887U/n341bN9T6s56menLAfaj464OfdM8iF6XYv+dV7+X+pOX/ANuOatZqHAmjti5prh9jurAgGI//mIbbtIvi15u9FHvBqD07a50fYdqtmt+YDrg1a/jd8tuiD7kMA4yNuL4LlkH+WtV/KAEYz7COC4cs/69ovXQB7M+4ngmHLP8/aL1UAD+bYVwTDlX/etT8W+nAV6M82uQS6PuP+rg4NV/5vBNDa6za5HLY9xzO5CIYl/9OaT5obYf/xrE1uioggQ/6LNf/04QGd6tHJFQH5owMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDSI6A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI1gjfyLY8UpmJnNqbjrc/yO32pOk98rQPIrwWnyCyA5AvILQATkF4AIyC8AEZBfACIgvwBEQH4BiID8J8qqU3BiPJ8O+XuMO8Eng8/2CID85BcA+ckvAPKT35tg8h+n/KP2/3/2SADojfzf1+yKYH7cBxim/N39hWX8RnsBkP9Q8r9BBAKIlV8EAoiXXwQCiJdfBAKIl18EAoiXXwQz4D5A/+Tv2KjZmuPvdfu6T+AVYJDyd3Qfo17Gb7QXAPkPzTMRCCBVfhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIwD+qFUFuAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBdAD3a8bkj4rgTM2PAmjty5or5I+L4FzNHzV/LfKB9OGb4rfJP0iO49xvL/pB9CGAMfljIxgLoLUR+WMjGAmgtT3yx0awJ4DWdsgfG8HOog+6D1eBntR8WLNB/sFzlKtDnfw3BNDa65rfp2+I3hfBo5rL5B9UBFttcoNzP35qk8vfLxZ9sCs9OnHdG6Kvps8e3TXiVzWPp88Ut3k1OLr1vFpz6Z31/LbmntMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAO/wLvsR65mx80NAAAAABJRU5ErkJggg==";
-const PUBLIC_OK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA+lJREFUeNrt3bFrFgccx+GLlSDi4JDBITiJZHBwEBGRIoqKoIu6iVMd3OosCg6W0sm/wEFUDDgpCDoIDoqOKqIoHUrp4CDFoUMRB39HLotoeXMpMXff54EfFE0ivv1+kpQGrmkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBJTHkJGIhddT/V7ajbUPey7l7dlbpPAmCs1tb9Wne2++cvPa07Vfd7nw/+g9eXVT7+m3Wn69Z8421m6w7WXa37KADGNv4TE7ztTN36uvtL/UPWeJ0Z+PgXnejzBwmAMYx/8VuhTQIgcfy9CYCxjP9D3TsBkPqZf95XAFLH3372vyAAEsf/T93Ruvd93tn/CWbo4z9c96jvBxAAseMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eP/HgG0z3f9uVl45uu2ZuGBBu3zXn9rej7mEuMfSgDtA46v1c195ff+rbtU94stGv9KWqnHpLaPsXxSt/k//iXsq9vY9HjUJca/2gNoH2e/c4K32yUC4x9bAOvqrjeTP41GBMY/qgC2151Z4vuIwPhXxEo8I2xdz/c7W3fZXo1/6F8B/q471/N9fSUw/sEH8LEb8hYRGH9iAK3HdafrpkVg/IkBtA8yflt3bBn/3SEC4x9sAK3Xda9EYPypAYjA+OMDEIHxxwcgAuOPD0AExh8fgAiMPz4AERh/fAAiMP74AERg/PEBiMD44wMQgfHHByAC448PQATGHx+ACIw/PgARGH98AMkRGL8AYiMwfgHERmD8AoiNwPgFEBuB8QsgNgLjF0BsBMYvgNgIjF8AsREYvwBiIzB+AcRGYPwCiI3A+AUQG4HxCyA2AuMXQGwExi+A2AiMXwCxERi/AGIjMH4BjDaCTXUP6j59423aJ2PeMH4BjDWCHd24n9f9+cXvHa+7U7fb+Fe/qeC/ezvU+e5bleX40A11pm6u+xapMX5fARK+Eix+u7O1brbp/1Bw4xfAoCP4Pxi/AGIjMH4BxEZg/AKIjcD4BRAbgfELIDYC4xdAbATGL4DYCIxfAIOL4EXdkbrpZX6sd3WH6p56WQUwJG/qbtX92Cz8EFwfD+sO1L31cq4uU16CibU/M3Sy7nzdlgnf51ndxbrbXj4BjCmEPXX76/Y2Cz8DNNP9+l91f3Sf8e92AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzKZwK1uX4kZ6mnAAAAAElFTkSuQmCC";
-const PUBLIC_BACK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0GiIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpgIzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLnHedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+sPy9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6zELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC";
-export class EditableTitleBar extends ViewPU {
- constructor(e, t, A, i = -1) {
- super(e, A, i);
- this.leftIconStyle = void 0;
- this.title = void 0;
- this.menuItems = void 0;
- this.onSave = void 0;
- this.onCancel = void 0;
- this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, "titleMaxWidth");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.leftIconStyle && (this.leftIconStyle = e.leftIconStyle);
- void 0 !== e.title && (this.title = e.title);
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.onSave && (this.onSave = e.onSave);
- void 0 !== e.onCancel && (this.onCancel = e.onCancel);
- void 0 !== e.titleMaxWidth && (this.titleMaxWidth = e.titleMaxWidth)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__titleMaxWidth.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__titleMaxWidth.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get titleMaxWidth() {
- return this.__titleMaxWidth.get()
- }
- set titleMaxWidth(e) {
- this.__titleMaxWidth.set(e)
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- });
- Flex.width("100%");
- Flex.height(EditableTitleBar.totalHeight);
- Flex.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Flex.onAreaChange(((e, t) => {
- let A = Number(t.width);
- A = A - EditableTitleBar.leftPadding - EditableTitleBar.rightPadding - EditableTitleBar.titlePadding;
- A = A - ImageMenuItem.imageHotZoneWidth - ImageMenuItem.imageHotZoneWidth;
- void 0 !== this.menuItems ? this.menuItems.length > EditableTitleBar.maxCountOfExtraItems ? this.titleMaxWidth = A - ImageMenuItem.imageHotZoneWidth * EditableTitleBar.maxCountOfExtraItems : this.titleMaxWidth = A - ImageMenuItem.imageHotZoneWidth * this.menuItems.length : this.titleMaxWidth = A
- }));
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_start"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.leftIconStyle == EditableLeftIconType.Back ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Navigator.create();
- t || Navigator.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: {
- value: PUBLIC_BACK,
- isEnabled: !0
- }
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Navigator.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: {
- value: PUBLIC_CANCEL,
- isEnabled: !0,
- action: () => this.onCancel && this.onCancel()
- }
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.justifyContent(FlexAlign.Start);
- Column.alignItems(HorizontalAlign.Start);
- Column.constraintSize({
- maxWidth: this.titleMaxWidth
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.title);
- Text.fontWeight(FontWeight.Medium);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline8"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({
- overflow: TextOverflow.Ellipsis
- });
- Text.constraintSize({
- maxWidth: this.titleMaxWidth
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Column.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new EditableTitleBarMenuSection(this, {
- menuItems: this.menuItems,
- onSave: this.onSave
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Flex.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-EditableTitleBar.maxCountOfExtraItems = 2;
-EditableTitleBar.totalHeight = 56;
-EditableTitleBar.leftPadding = 12;
-EditableTitleBar.rightPadding = 12;
-EditableTitleBar.titlePadding = 16;
-class EditableTitleBarMenuSection extends ViewPU {
- constructor(e, t, A, i = -1) {
- super(e, A, i);
- this.menuItems = void 0;
- this.onSave = void 0;
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.onSave && (this.onSave = e.onSave)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {}
- aboutToBeDeleted() {
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_vertical_l"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Column.justifyContent(FlexAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(0, EditableTitleBar.maxCountOfExtraItems), (e => {
- const t = e;
- this.observeComponentCreation(((e, A) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- A ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: {
- value: PUBLIC_OK,
- isEnabled: !0,
- action: () => this.onSave && this.onSave()
- }
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop();
- Column.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-class ImageMenuItem extends ViewPU {
- constructor(e, t, A, i = -1) {
- super(e, A, i);
- this.item = void 0;
- this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus");
- this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover");
- this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus);
- void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover);
- void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isOnFocus.purgeDependencyOnElmtId(e);
- this.__isOnHover.purgeDependencyOnElmtId(e);
- this.__isOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isOnFocus.aboutToBeDeleted();
- this.__isOnHover.aboutToBeDeleted();
- this.__isOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isOnFocus() {
- return this.__isOnFocus.get()
- }
- set isOnFocus(e) {
- this.__isOnFocus.set(e)
- }
- get isOnHover() {
- return this.__isOnHover.get()
- }
- set isOnHover(e) {
- this.__isOnHover.set(e)
- }
- get isOnClick() {
- return this.__isOnClick.get()
- }
- set isOnClick(e) {
- this.__isOnClick.set(e)
- }
- getFgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getBgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getFgColor());
- Row.backgroundColor(this.getBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
- Row.border(this.isOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => {
- this.item.isEnabled && (this.isOnFocus = !0)
- }));
- Row.onBlur((() => this.isOnFocus = !1));
- Row.onHover((e => {
- this.item.isEnabled && (this.isOnHover = e)
- }));
- Row.onKeyEvent((e => {
- if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- if (this.item.isEnabled) {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action()));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(this.item.isEnabled);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-ImageMenuItem.imageSize = 24;
-ImageMenuItem.imageHotZoneWidth = 48;
-ImageMenuItem.buttonBorderRadius = 8;
-ImageMenuItem.focusBorderWidth = 2;
-ImageMenuItem.disabledImageOpacity = .4;
-export default {
- EditableLeftIconType: EditableLeftIconType,
- EditableTitleBar: EditableTitleBar
-};
\ No newline at end of file
diff --git a/interface/filter/BUILD.gn b/interface/filter/BUILD.gn
deleted file mode 100644
index e06d1b7..0000000
--- a/interface/filter/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_filter_abc") {
- src_js = rebase_path("filter.js")
- dst_file = rebase_path(target_out_dir + "/filter.abc")
- in_puts = [ "filter.js" ]
- out_puts = [ target_out_dir + "/filter.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("filter_abc") {
- input = get_label_info(":gen_filter_abc", "target_out_dir") + "/filter.abc"
- output = target_out_dir + "/filter_abc.o"
- dep = ":gen_filter_abc"
-}
-
-ohos_shared_library("filter") {
- sources = [ "filter.cpp" ]
-
- deps = [ ":filter_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/filter/filter.cpp b/interface/filter/filter.cpp
deleted file mode 100644
index c3321f4..0000000
--- a/interface/filter/filter.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-extern const char _binary_filter_abc_start[];
-extern const char _binary_filter_abc_end[];
-
-// Napi get abc code function
-extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_Filter_GetABCCode(const char **buf, int *buflen)
-{
- if (buf != nullptr) {
- *buf = _binary_filter_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_filter_abc_end - _binary_filter_abc_start;
- }
-}
-
-/*
- * Module define
- */
-static napi_module filterModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.Filter",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-/*
- * Module register function
- */
-extern "C" __attribute__((constructor)) void filterRegisterModule(void)
-{
- napi_module_register(&filterModule);
-}
diff --git a/interface/filter/filter.js b/interface/filter/filter.js
deleted file mode 100644
index efb762d..0000000
--- a/interface/filter/filter.js
+++ /dev/null
@@ -1,2169 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const curves = requireNativeModule('ohos.curves');
-const measure = requireNapi('measure');
-
-var __decorate = this && this.__decorate || function (o, e, t, r) {
- var i, s = arguments.length, n = s < 3 ? e : null === r ? r = Object.getOwnPropertyDescriptor(e, t) : r;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(o, e, t, r); else for (var a = o.length - 1;a >= 0; a--) (i = o[a]) && (n = (s < 3 ? i(n) : s > 3 ? i(e, t, n) : i(e, t)) || n);
- return s > 3 && n && Object.defineProperty(e, t, n), n
-};
-
-const TEXT_HOT_AREA_WIDTH = 8;
-const LIST_ROW_HEIGHT = 40;
-const ARROW_IMG_SIZE = 24;
-const MULTI_LINE_PADDING = 24;
-const BAR_ANIMATION_DURATION = 150;
-const ARROW_ANIMATION_DURATION = 200;
-const ANIMATION_DURATION_250 = 250;
-const ANIMATION_DURATION_100 = 100;
-const FILTER_TOP_PADDING = 8;
-const SEPARATOR_HEIGHT = 16;
-const SEPARATOR_WIDTH = 1;
-const FLOAT_OPACITY = .95;
-const FILTER_FONT_SIZE = 12;
-const FOCUS_BORDER_WIDTH = 2;
-const ARROW_SHOW_DELAY = 300;
-const PERCENT_100 = "100%";
-const SHARP_CUBIC_BEZIER = curves.cubicBezierCurve(.33, 0, .67, 1);
-const INTER_POLATING_SPRING = curves.interpolatingSpring(0, 1, 328, 34);
-const FRICTION_CUBIC_BEZIER = curves.cubicBezierCurve(.2, 0, .2, 1);
-const TRANS_COLOR = "#00FFFFFF";
-const KEYCODE_SPACE = 2050;
-const KEYCODE_ENTER = 2054;
-
-export var FilterType;
-!function(o){
- o[o.MULTI_LINE_FILTER=0] = "MULTI_LINE_FILTER";
- o[o.LIST_FILTER=1] = "LIST_FILTER"
-}(FilterType || (FilterType = {}));
-let FontWeightArray = class extends Array {
-};
-FontWeightArray = __decorate([Observed], FontWeightArray);
-let ResourceArray = class extends Array {
-};
-ResourceArray = __decorate([Observed], ResourceArray);
-let BooleanArray = class extends Array {
-};
-BooleanArray = __decorate([Observed], BooleanArray);
-let ObservedBoolean = class {
- constructor(o) {
- this.value = o
- }
-};
-ObservedBoolean = __decorate([Observed], ObservedBoolean);
-
-export { ObservedBoolean };
-let ObservedNumber = class {
- constructor(o) {
- this.value = o
- }
-};
-ObservedNumber = __decorate([Observed], ObservedNumber);
-
-class ListFilterRow extends ViewPU {
- constructor(o, e, t, r = -1) {
- super(o, t, r);
- this.__colorRow = new SynchedPropertyNesedObjectPU(e.colorRow, this, "colorRow");
- this.__fontWeightRow = new SynchedPropertyNesedObjectPU(e.fontWeightRow, this, "fontWeightRow");
- this.__backgroundColorRow = new SynchedPropertyNesedObjectPU(e.backgroundColorRow, this, "backgroundColorRow");
- this.__isBackgroundHoverRow = new SynchedPropertyNesedObjectPU(e.isBackgroundHoverRow, this, "isBackgroundHoverRow");
- this.filterRow = void 0;
- this.onItemClick = void 0;
- this.setInitiallyProvidedValue(e)
- }
-
- setInitiallyProvidedValue(o) {
- this.__colorRow.set(o.colorRow);
- this.__fontWeightRow.set(o.fontWeightRow);
- this.__backgroundColorRow.set(o.backgroundColorRow);
- this.__isBackgroundHoverRow.set(o.isBackgroundHoverRow);
- void 0 !== o.filterRow && (this.filterRow = o.filterRow);
- void 0 !== o.onItemClick && (this.onItemClick = o.onItemClick)
- }
-
- updateStateVars(o) {
- this.__colorRow.set(o.colorRow);
- this.__fontWeightRow.set(o.fontWeightRow);
- this.__backgroundColorRow.set(o.backgroundColorRow);
- this.__isBackgroundHoverRow.set(o.isBackgroundHoverRow)
- }
-
- purgeVariableDependenciesOnElmtId(o) {
- this.__colorRow.purgeDependencyOnElmtId(o);
- this.__fontWeightRow.purgeDependencyOnElmtId(o);
- this.__backgroundColorRow.purgeDependencyOnElmtId(o);
- this.__isBackgroundHoverRow.purgeDependencyOnElmtId(o)
- }
-
- aboutToBeDeleted() {
- this.__colorRow.aboutToBeDeleted();
- this.__fontWeightRow.aboutToBeDeleted();
- this.__backgroundColorRow.aboutToBeDeleted();
- this.__isBackgroundHoverRow.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get colorRow() {
- return this.__colorRow.get()
- }
-
- get fontWeightRow() {
- return this.__fontWeightRow.get()
- }
-
- get backgroundColorRow() {
- return this.__backgroundColorRow.get()
- }
-
- get isBackgroundHoverRow() {
- return this.__isBackgroundHoverRow.get()
- }
-
- initialRender() {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- List.create();
- List.listDirection(Axis.Horizontal);
- List.margin({ left: -16 });
- List.scrollBar(BarState.Off);
- List.width("100%");
- List.height(40);
- List.align(Alignment.Start);
- e || List.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.filterRow.options, ((o, e) => {
- const t = o;
- {
- const o = !0;
- const r = (t, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- ListItem.create(s, o);
- ListItem.height("100%");
- ListItem.onClick((() => {
- this.onItemClick(e)
- }));
- ListItem.focusable(!0);
- ViewStackProcessor.visualState("focused");
- ListItem.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- ListItem.padding({ left: 6, right: 6 });
- ViewStackProcessor.visualState("normal");
- ListItem.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- ListItem.padding({ left: 8, right: 8 });
- ViewStackProcessor.visualState();
- ListItem.backgroundColor(this.isBackgroundHoverRow[e] ? this.backgroundColorRow[e] : "#00FFFFFF");
- ListItem.onHover((o => {
- Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- if (o) {
- this.backgroundColorRow[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[e] = !0
- } else this.isBackgroundHoverRow[e] = !1
- }))
- }));
- ListItem.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.backgroundColorRow[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[e] = !0
- })) : o.type === TouchType.Up && Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.isBackgroundHoverRow[e] = !1
- }))
- }));
- r || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const i = () => {
- this.observeComponentCreation(r);
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.colorRow[e]);
- Text.fontWeight(this.fontWeightRow[e]);
- Text.focusable(!0);
- r || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- ListItem.pop()
- };
- const s = (o, i) => {
- r(o, i);
- this.updateFuncByElmtId.set(o, r);
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.colorRow[e]);
- Text.fontWeight(this.fontWeightRow[e]);
- Text.focusable(!0);
- r || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- ListItem.pop()
- };
- o ? (() => {
- this.observeComponentCreation(r);
- ListItem.pop()
- })() : i()
- }
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- List.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-class MultiFilterRow extends ViewPU {
- constructor(o, e, t, r = -1) {
- super(o, t, r);
- this.__colorRow = new SynchedPropertyNesedObjectPU(e.colorRow, this, "colorRow");
- this.__fontWeightRow = new SynchedPropertyNesedObjectPU(e.fontWeightRow, this, "fontWeightRow");
- this.__backgroundColorRow = new SynchedPropertyNesedObjectPU(e.backgroundColorRow, this, "backgroundColorRow");
- this.__isBackgroundHoverRow = new SynchedPropertyNesedObjectPU(e.isBackgroundHoverRow, this, "isBackgroundHoverRow");
- this.__twoLineModeItemNumRow = new SynchedPropertyNesedObjectPU(e.twoLineModeItemNumRow, this, "twoLineModeItemNumRow");
- this.__twoLineModeItemNumRecordRow = new SynchedPropertyNesedObjectPU(e.twoLineModeItemNumRecordRow, this, "twoLineModeItemNumRecordRow");
- this.__arrowShowStateRow = new SynchedPropertyNesedObjectPU(e.arrowShowStateRow, this, "arrowShowStateRow");
- this.__isArrowIconDown = new SynchedPropertyNesedObjectPU(e.isArrowIconDown, this, "isArrowIconDown");
- this.filterRow = null;
- this.onItemClick = void 0;
- this.__arrowBgColorRow = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- }, this, "arrowBgColorRow");
- this.__isArrowBgHoverRow = new ObservedPropertySimplePU(!1, this, "isArrowBgHoverRow");
- this.filterColumnWidth = 0;
- this.setInitiallyProvidedValue(e)
- }
-
- setInitiallyProvidedValue(o) {
- this.__colorRow.set(o.colorRow);
- this.__fontWeightRow.set(o.fontWeightRow);
- this.__backgroundColorRow.set(o.backgroundColorRow);
- this.__isBackgroundHoverRow.set(o.isBackgroundHoverRow);
- this.__twoLineModeItemNumRow.set(o.twoLineModeItemNumRow);
- this.__twoLineModeItemNumRecordRow.set(o.twoLineModeItemNumRecordRow);
- this.__arrowShowStateRow.set(o.arrowShowStateRow);
- this.__isArrowIconDown.set(o.isArrowIconDown);
- void 0 !== o.filterRow && (this.filterRow = o.filterRow);
- void 0 !== o.onItemClick && (this.onItemClick = o.onItemClick);
- void 0 !== o.arrowBgColorRow && (this.arrowBgColorRow = o.arrowBgColorRow);
- void 0 !== o.isArrowBgHoverRow && (this.isArrowBgHoverRow = o.isArrowBgHoverRow);
- void 0 !== o.filterColumnWidth && (this.filterColumnWidth = o.filterColumnWidth)
- }
-
- updateStateVars(o) {
- this.__colorRow.set(o.colorRow);
- this.__fontWeightRow.set(o.fontWeightRow);
- this.__backgroundColorRow.set(o.backgroundColorRow);
- this.__isBackgroundHoverRow.set(o.isBackgroundHoverRow);
- this.__twoLineModeItemNumRow.set(o.twoLineModeItemNumRow);
- this.__twoLineModeItemNumRecordRow.set(o.twoLineModeItemNumRecordRow);
- this.__arrowShowStateRow.set(o.arrowShowStateRow);
- this.__isArrowIconDown.set(o.isArrowIconDown)
- }
-
- purgeVariableDependenciesOnElmtId(o) {
- this.__colorRow.purgeDependencyOnElmtId(o);
- this.__fontWeightRow.purgeDependencyOnElmtId(o);
- this.__backgroundColorRow.purgeDependencyOnElmtId(o);
- this.__isBackgroundHoverRow.purgeDependencyOnElmtId(o);
- this.__twoLineModeItemNumRow.purgeDependencyOnElmtId(o);
- this.__twoLineModeItemNumRecordRow.purgeDependencyOnElmtId(o);
- this.__arrowShowStateRow.purgeDependencyOnElmtId(o);
- this.__isArrowIconDown.purgeDependencyOnElmtId(o);
- this.__arrowBgColorRow.purgeDependencyOnElmtId(o);
- this.__isArrowBgHoverRow.purgeDependencyOnElmtId(o)
- }
-
- aboutToBeDeleted() {
- this.__colorRow.aboutToBeDeleted();
- this.__fontWeightRow.aboutToBeDeleted();
- this.__backgroundColorRow.aboutToBeDeleted();
- this.__isBackgroundHoverRow.aboutToBeDeleted();
- this.__twoLineModeItemNumRow.aboutToBeDeleted();
- this.__twoLineModeItemNumRecordRow.aboutToBeDeleted();
- this.__arrowShowStateRow.aboutToBeDeleted();
- this.__isArrowIconDown.aboutToBeDeleted();
- this.__arrowBgColorRow.aboutToBeDeleted();
- this.__isArrowBgHoverRow.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get colorRow() {
- return this.__colorRow.get()
- }
-
- get fontWeightRow() {
- return this.__fontWeightRow.get()
- }
-
- get backgroundColorRow() {
- return this.__backgroundColorRow.get()
- }
-
- get isBackgroundHoverRow() {
- return this.__isBackgroundHoverRow.get()
- }
-
- get twoLineModeItemNumRow() {
- return this.__twoLineModeItemNumRow.get()
- }
-
- get twoLineModeItemNumRecordRow() {
- return this.__twoLineModeItemNumRecordRow.get()
- }
-
- get arrowShowStateRow() {
- return this.__arrowShowStateRow.get()
- }
-
- get isArrowIconDown() {
- return this.__isArrowIconDown.get()
- }
-
- get arrowBgColorRow() {
- return this.__arrowBgColorRow.get()
- }
-
- set arrowBgColorRow(o) {
- this.__arrowBgColorRow.set(o)
- }
-
- get isArrowBgHoverRow() {
- return this.__isArrowBgHoverRow.get()
- }
-
- set isArrowBgHoverRow(o) {
- this.__isArrowBgHoverRow.set(o)
- }
-
- calcMultiFilterRowItemNum() {
- var o = this.filterColumnWidth - vp2px(24);
- var e = 0;
- var t = 1;
- for (var r = 0;r < this.filterRow.options.length; r++) {
- let i = this.filterRow.options[r];
- let s = measure.measureText({ textContent: i, fontSize: 12 });
- if (0 !== r) {
- s += vp2px(16);
- if (o - s > 0) {
- o -= s;
- e += 1
- } else {
- if (0 === e) {
- e++;
- o = 0
- }
- if (1 !== t) break;
- t += 1;
- o = this.filterColumnWidth - vp2px(24) - vp2px(24);
- r--
- }
- }
- }
- return e
- }
-
- DownAndUpArrow(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- }
- });
- Row.height(40);
- Row.width(24);
- Row.backgroundColor(this.isArrowBgHoverRow ? this.arrowBgColorRow : "#00FFFFFF");
- Row.focusable(!0);
- Row.visibility(this.arrowShowStateRow.value ? Visibility.Visible : Visibility.Hidden);
- Row.onHover((o => {
- Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- if (o) {
- this.arrowBgColorRow = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isArrowBgHoverRow = !0
- } else this.isArrowBgHoverRow = !1
- }))
- }));
- Row.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.arrowBgColorRow = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isArrowBgHoverRow = !0
- })) : o.type === TouchType.Up && Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.isArrowBgHoverRow = !1
- }))
- }));
- Row.onClick((() => {
- if (this.isArrowIconDown.value) {
- this.isArrowIconDown.value = !1;
- this.arrowShowStateRow.value = !1;
- Context.animateTo({ curve: INTER_POLATING_SPRING }, (() => {
- this.twoLineModeItemNumRow.value = this.filterRow.options.length
- }));
- Context.animateTo({ delay: 300, duration: 200, curve: SHARP_CUBIC_BEZIER }, (() => {
- this.arrowShowStateRow.value = !0
- }))
- } else {
- this.isArrowIconDown.value = !0;
- this.arrowShowStateRow.value = !1;
- Context.animateTo({ curve: INTER_POLATING_SPRING }, (() => {
- this.twoLineModeItemNumRow.value = this.twoLineModeItemNumRecordRow.value
- }));
- Context.animateTo({ delay: 300, duration: 200, curve: SHARP_CUBIC_BEZIER }, (() => {
- this.arrowShowStateRow.value = !0
- }))
- }
- }));
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Image.create(this.isArrowIconDown.value ? {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_up"],
- bundleName: "",
- moduleName: ""
- });
- Image.width(24);
- Image.height(40);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_tertiary"],
- bundleName: "",
- moduleName: ""
- });
- Image.focusable(!0);
- ViewStackProcessor.visualState("focused");
- Image.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- Image.width(28);
- Image.offset({ x: -2 });
- ViewStackProcessor.visualState("normal");
- Image.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- Image.width(24);
- Image.offset({ x: 0 });
- ViewStackProcessor.visualState();
- e || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.width("100%");
- Row.alignItems(VerticalAlign.Top);
- Row.padding({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- this.filterRow.options && this.filterRow.options.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(this.filterRow.options[0].toString());
- Text.height(40);
- Text.width(px2vp(measure.measureText({
- textContent: this.filterRow.options[0].toString(),
- fontSize: 12
- })) + 16);
- Text.margin({ left: -8 });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.colorRow[0]);
- Text.fontWeight(this.fontWeightRow[0]);
- Text.backgroundColor(this.isBackgroundHoverRow[0] ? this.backgroundColorRow[0] : "#00FFFFFF");
- Text.onClick((() => {
- this.onItemClick(0)
- }));
- Text.focusable(!0);
- Text.onHover((o => {
- Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- if (o) {
- this.backgroundColorRow[0] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[0] = !0
- } else this.isBackgroundHoverRow[0] = !1
- }))
- }));
- Text.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.backgroundColorRow[0] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[0] = !0
- })) : o.type === TouchType.Up && Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.isBackgroundHoverRow[0] = !1
- }))
- }));
- ViewStackProcessor.visualState("focused");
- Text.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- Text.padding({ left: 6, right: 6 });
- ViewStackProcessor.visualState("normal");
- Text.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- Text.padding({ left: 8, right: 8 });
- ViewStackProcessor.visualState();
- e || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- e || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.width("100%");
- Row.padding({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Row.onAreaChange(((o, e) => {
- this.filterColumnWidth = vp2px(parseInt(e.width.toString(), 0));
- if (0 === this.twoLineModeItemNumRow.value) {
- var t = this.calcMultiFilterRowItemNum();
- this.twoLineModeItemNumRow.value = t;
- this.twoLineModeItemNumRecordRow.value = t;
- t < this.filterRow.options.length - 1 ? this.arrowShowStateRow.value = !0 : this.arrowShowStateRow.value = !1
- }
- }));
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Flex.create({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap });
- Flex.alignSelf(ItemAlign.Stretch);
- e || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.filterRow.options.slice(0, this.twoLineModeItemNumRow.value + 1), ((o, e) => {
- const t = o;
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- e > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.toString());
- Text.transition(TransitionEffect.OPACITY);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.height(40);
- Text.fontColor(this.colorRow[e]);
- Text.fontWeight(this.fontWeightRow[e]);
- Text.backgroundColor(this.isBackgroundHoverRow[e] ? this.backgroundColorRow[e] : "#00FFFFFF");
- Text.onClick((() => {
- this.onItemClick(e)
- }));
- Text.onHover((o => {
- Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- if (o) {
- this.backgroundColorRow[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[e] = !0
- } else this.isBackgroundHoverRow[e] = !1
- }))
- }));
- Text.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.backgroundColorRow[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isBackgroundHoverRow[e] = !0
- })) : o.type === TouchType.Up && Context.animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: 100
- }, (() => {
- this.isBackgroundHoverRow[e] = !1
- }))
- }));
- Text.focusable(!0);
- ViewStackProcessor.visualState("focused");
- Text.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- Text.padding({ left: 6, right: 6 });
- ViewStackProcessor.visualState("normal");
- Text.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- Text.padding({ left: 8, right: 8 });
- ViewStackProcessor.visualState();
- r || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- r || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- this.DownAndUpArrow.bind(this)();
- Flex.pop();
- Row.pop();
- Row.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export class Filter extends ViewPU {
- constructor(o, e, t, r = -1) {
- super(o, t, r);
- this.container = void 0;
- this.__multiFilters = new SynchedPropertyObjectOneWayPU(e.multiFilters, this, "multiFilters");
- this.__additionFilters = new SynchedPropertyObjectOneWayPU(e.additionFilters, this, "additionFilters");
- this.onFilterChanged = null;
- this.__filterType = new SynchedPropertySimpleOneWayPU(e.filterType, this, "filterType");
- this.selectedFilters = null;
- this.__colorArr = new ObservedPropertyObjectPU(null, this, "colorArr");
- this.__fontWeightArr = new ObservedPropertyObjectPU(null, this, "fontWeightArr");
- this.__backgroundColorArr = new ObservedPropertyObjectPU(null, this, "backgroundColorArr");
- this.__isBackgroundHover = new ObservedPropertyObjectPU(null, this, "isBackgroundHover");
- this.__floatArrowBgColor = new ObservedPropertyObjectPU(null, this, "floatArrowBgColor");
- this.__isFloatArrowBgHover = new ObservedPropertySimplePU(!1, this, "isFloatArrowBgHover");
- this.__isArrowIconDownArr = new ObservedPropertyObjectPU(null, this, "isArrowIconDownArr");
- this.__additionColorArr = new ObservedPropertyObjectPU(null, this, "additionColorArr");
- this.__additionFontWeightArr = new ObservedPropertyObjectPU(null, this, "additionFontWeightArr");
- this.__additionBackgroundColorArr = new ObservedPropertyObjectPU(null, this, "additionBackgroundColorArr");
- this.__isAdditionBackgroundHover = new ObservedPropertyObjectPU(null, this, "isAdditionBackgroundHover");
- this.__colorRefresh = new ObservedPropertySimplePU(!1, this, "colorRefresh");
- this.__isFloatBarShow = new ObservedPropertySimplePU(!1, this, "isFloatBarShow");
- this.isFloatBarShowWithoutAnimation = !1;
- this.__isFloatShowAllFilter = new ObservedPropertySimplePU(!1, this, "isFloatShowAllFilter");
- this.isFloatShowAllFilterWithoutAnimation = !1;
- this.__floatFilterPosition = new ObservedPropertySimplePU(0, this, "floatFilterPosition");
- this.__floatFilterBarHeight = new ObservedPropertySimplePU(0, this, "floatFilterBarHeight");
- this.__floatFilterBarPosition = new ObservedPropertySimplePU(0, this, "floatFilterBarPosition");
- this.filterDynamicHeight = 0;
- this.__twoLineModeItemNum = new ObservedPropertyObjectPU(null, this, "twoLineModeItemNum");
- this.__twoLineModeItemNumRecord = new ObservedPropertyObjectPU(null, this, "twoLineModeItemNumRecord");
- this.__downArrowShowState = new ObservedPropertyObjectPU(null, this, "downArrowShowState");
- this.listScroller = new Scroller;
- this.setInitiallyProvidedValue(e)
- }
-
- setInitiallyProvidedValue(o) {
- void 0 !== o.container && (this.container = o.container);
- void 0 !== o.multiFilters ? this.__multiFilters.set(o.multiFilters) : this.__multiFilters.set([]);
- void 0 !== o.additionFilters ? this.__additionFilters.set(o.additionFilters) : this.__additionFilters.set(null);
- void 0 !== o.onFilterChanged && (this.onFilterChanged = o.onFilterChanged);
- void 0 !== o.filterType ? this.__filterType.set(o.filterType) : this.__filterType.set(FilterType.LIST_FILTER);
- void 0 !== o.selectedFilters && (this.selectedFilters = o.selectedFilters);
- void 0 !== o.colorArr && (this.colorArr = o.colorArr);
- void 0 !== o.fontWeightArr && (this.fontWeightArr = o.fontWeightArr);
- void 0 !== o.backgroundColorArr && (this.backgroundColorArr = o.backgroundColorArr);
- void 0 !== o.isBackgroundHover && (this.isBackgroundHover = o.isBackgroundHover);
- void 0 !== o.floatArrowBgColor && (this.floatArrowBgColor = o.floatArrowBgColor);
- void 0 !== o.isFloatArrowBgHover && (this.isFloatArrowBgHover = o.isFloatArrowBgHover);
- void 0 !== o.isArrowIconDownArr && (this.isArrowIconDownArr = o.isArrowIconDownArr);
- void 0 !== o.additionColorArr && (this.additionColorArr = o.additionColorArr);
- void 0 !== o.additionFontWeightArr && (this.additionFontWeightArr = o.additionFontWeightArr);
- void 0 !== o.additionBackgroundColorArr && (this.additionBackgroundColorArr = o.additionBackgroundColorArr);
- void 0 !== o.isAdditionBackgroundHover && (this.isAdditionBackgroundHover = o.isAdditionBackgroundHover);
- void 0 !== o.colorRefresh && (this.colorRefresh = o.colorRefresh);
- void 0 !== o.isFloatBarShow && (this.isFloatBarShow = o.isFloatBarShow);
- void 0 !== o.isFloatBarShowWithoutAnimation && (this.isFloatBarShowWithoutAnimation = o.isFloatBarShowWithoutAnimation);
- void 0 !== o.isFloatShowAllFilter && (this.isFloatShowAllFilter = o.isFloatShowAllFilter);
- void 0 !== o.isFloatShowAllFilterWithoutAnimation && (this.isFloatShowAllFilterWithoutAnimation = o.isFloatShowAllFilterWithoutAnimation);
- void 0 !== o.floatFilterPosition && (this.floatFilterPosition = o.floatFilterPosition);
- void 0 !== o.floatFilterBarHeight && (this.floatFilterBarHeight = o.floatFilterBarHeight);
- void 0 !== o.floatFilterBarPosition && (this.floatFilterBarPosition = o.floatFilterBarPosition);
- void 0 !== o.filterDynamicHeight && (this.filterDynamicHeight = o.filterDynamicHeight);
- void 0 !== o.twoLineModeItemNum && (this.twoLineModeItemNum = o.twoLineModeItemNum);
- void 0 !== o.twoLineModeItemNumRecord && (this.twoLineModeItemNumRecord = o.twoLineModeItemNumRecord);
- void 0 !== o.downArrowShowState && (this.downArrowShowState = o.downArrowShowState);
- void 0 !== o.listScroller && (this.listScroller = o.listScroller)
- }
-
- updateStateVars(o) {
- this.__multiFilters.reset(o.multiFilters);
- this.__additionFilters.reset(o.additionFilters);
- this.__filterType.reset(o.filterType)
- }
-
- purgeVariableDependenciesOnElmtId(o) {
- this.__multiFilters.purgeDependencyOnElmtId(o);
- this.__additionFilters.purgeDependencyOnElmtId(o);
- this.__filterType.purgeDependencyOnElmtId(o);
- this.__colorArr.purgeDependencyOnElmtId(o);
- this.__fontWeightArr.purgeDependencyOnElmtId(o);
- this.__backgroundColorArr.purgeDependencyOnElmtId(o);
- this.__isBackgroundHover.purgeDependencyOnElmtId(o);
- this.__floatArrowBgColor.purgeDependencyOnElmtId(o);
- this.__isFloatArrowBgHover.purgeDependencyOnElmtId(o);
- this.__isArrowIconDownArr.purgeDependencyOnElmtId(o);
- this.__additionColorArr.purgeDependencyOnElmtId(o);
- this.__additionFontWeightArr.purgeDependencyOnElmtId(o);
- this.__additionBackgroundColorArr.purgeDependencyOnElmtId(o);
- this.__isAdditionBackgroundHover.purgeDependencyOnElmtId(o);
- this.__colorRefresh.purgeDependencyOnElmtId(o);
- this.__isFloatBarShow.purgeDependencyOnElmtId(o);
- this.__isFloatShowAllFilter.purgeDependencyOnElmtId(o);
- this.__floatFilterPosition.purgeDependencyOnElmtId(o);
- this.__floatFilterBarHeight.purgeDependencyOnElmtId(o);
- this.__floatFilterBarPosition.purgeDependencyOnElmtId(o);
- this.__twoLineModeItemNum.purgeDependencyOnElmtId(o);
- this.__twoLineModeItemNumRecord.purgeDependencyOnElmtId(o);
- this.__downArrowShowState.purgeDependencyOnElmtId(o)
- }
-
- aboutToBeDeleted() {
- this.__multiFilters.aboutToBeDeleted();
- this.__additionFilters.aboutToBeDeleted();
- this.__filterType.aboutToBeDeleted();
- this.__colorArr.aboutToBeDeleted();
- this.__fontWeightArr.aboutToBeDeleted();
- this.__backgroundColorArr.aboutToBeDeleted();
- this.__isBackgroundHover.aboutToBeDeleted();
- this.__floatArrowBgColor.aboutToBeDeleted();
- this.__isFloatArrowBgHover.aboutToBeDeleted();
- this.__isArrowIconDownArr.aboutToBeDeleted();
- this.__additionColorArr.aboutToBeDeleted();
- this.__additionFontWeightArr.aboutToBeDeleted();
- this.__additionBackgroundColorArr.aboutToBeDeleted();
- this.__isAdditionBackgroundHover.aboutToBeDeleted();
- this.__colorRefresh.aboutToBeDeleted();
- this.__isFloatBarShow.aboutToBeDeleted();
- this.__isFloatShowAllFilter.aboutToBeDeleted();
- this.__floatFilterPosition.aboutToBeDeleted();
- this.__floatFilterBarHeight.aboutToBeDeleted();
- this.__floatFilterBarPosition.aboutToBeDeleted();
- this.__twoLineModeItemNum.aboutToBeDeleted();
- this.__twoLineModeItemNumRecord.aboutToBeDeleted();
- this.__downArrowShowState.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get multiFilters() {
- return this.__multiFilters.get()
- }
-
- set multiFilters(o) {
- this.__multiFilters.set(o)
- }
-
- get additionFilters() {
- return this.__additionFilters.get()
- }
-
- set additionFilters(o) {
- this.__additionFilters.set(o)
- }
-
- get filterType() {
- return this.__filterType.get()
- }
-
- set filterType(o) {
- this.__filterType.set(o)
- }
-
- get colorArr() {
- return this.__colorArr.get()
- }
-
- set colorArr(o) {
- this.__colorArr.set(o)
- }
-
- get fontWeightArr() {
- return this.__fontWeightArr.get()
- }
-
- set fontWeightArr(o) {
- this.__fontWeightArr.set(o)
- }
-
- get backgroundColorArr() {
- return this.__backgroundColorArr.get()
- }
-
- set backgroundColorArr(o) {
- this.__backgroundColorArr.set(o)
- }
-
- get isBackgroundHover() {
- return this.__isBackgroundHover.get()
- }
-
- set isBackgroundHover(o) {
- this.__isBackgroundHover.set(o)
- }
-
- get floatArrowBgColor() {
- return this.__floatArrowBgColor.get()
- }
-
- set floatArrowBgColor(o) {
- this.__floatArrowBgColor.set(o)
- }
-
- get isFloatArrowBgHover() {
- return this.__isFloatArrowBgHover.get()
- }
-
- set isFloatArrowBgHover(o) {
- this.__isFloatArrowBgHover.set(o)
- }
-
- get isArrowIconDownArr() {
- return this.__isArrowIconDownArr.get()
- }
-
- set isArrowIconDownArr(o) {
- this.__isArrowIconDownArr.set(o)
- }
-
- get additionColorArr() {
- return this.__additionColorArr.get()
- }
-
- set additionColorArr(o) {
- this.__additionColorArr.set(o)
- }
-
- get additionFontWeightArr() {
- return this.__additionFontWeightArr.get()
- }
-
- set additionFontWeightArr(o) {
- this.__additionFontWeightArr.set(o)
- }
-
- get additionBackgroundColorArr() {
- return this.__additionBackgroundColorArr.get()
- }
-
- set additionBackgroundColorArr(o) {
- this.__additionBackgroundColorArr.set(o)
- }
-
- get isAdditionBackgroundHover() {
- return this.__isAdditionBackgroundHover.get()
- }
-
- set isAdditionBackgroundHover(o) {
- this.__isAdditionBackgroundHover.set(o)
- }
-
- get colorRefresh() {
- return this.__colorRefresh.get()
- }
-
- set colorRefresh(o) {
- this.__colorRefresh.set(o)
- }
-
- get isFloatBarShow() {
- return this.__isFloatBarShow.get()
- }
-
- set isFloatBarShow(o) {
- this.__isFloatBarShow.set(o)
- }
-
- get isFloatShowAllFilter() {
- return this.__isFloatShowAllFilter.get()
- }
-
- set isFloatShowAllFilter(o) {
- this.__isFloatShowAllFilter.set(o)
- }
-
- get floatFilterPosition() {
- return this.__floatFilterPosition.get()
- }
-
- set floatFilterPosition(o) {
- this.__floatFilterPosition.set(o)
- }
-
- get floatFilterBarHeight() {
- return this.__floatFilterBarHeight.get()
- }
-
- set floatFilterBarHeight(o) {
- this.__floatFilterBarHeight.set(o)
- }
-
- get floatFilterBarPosition() {
- return this.__floatFilterBarPosition.get()
- }
-
- set floatFilterBarPosition(o) {
- this.__floatFilterBarPosition.set(o)
- }
-
- get twoLineModeItemNum() {
- return this.__twoLineModeItemNum.get()
- }
-
- set twoLineModeItemNum(o) {
- this.__twoLineModeItemNum.set(o)
- }
-
- get twoLineModeItemNumRecord() {
- return this.__twoLineModeItemNumRecord.get()
- }
-
- set twoLineModeItemNumRecord(o) {
- this.__twoLineModeItemNumRecord.set(o)
- }
-
- get downArrowShowState() {
- return this.__downArrowShowState.get()
- }
-
- set downArrowShowState(o) {
- this.__downArrowShowState.set(o)
- }
-
- textColor(o, e) {
- return this.selectedFilters.length > o && this.selectedFilters[o].index === e ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- }
- }
-
- aboutToAppear() {
- this.initParams()
- }
-
- filterItemClick(o, e) {
- let t = this.multiFilters[o].options[e];
- if (e != this.selectedFilters[o].index) {
- this.colorArr[o][e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- };
- this.colorArr[o][this.selectedFilters[o].index] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- };
- this.fontWeightArr[o][e] = FontWeight.Medium;
- this.fontWeightArr[o][this.selectedFilters[o].index] = FontWeight.Regular;
- this.colorRefresh = !this.colorRefresh;
- this.selectedFilters[o].value = t;
- this.selectedFilters[o].index = e;
- this.onFilterChanged && this.onFilterChanged(this.selectedFilters)
- }
- }
-
- initParams() {
- if (!this.selectedFilters) {
- this.selectedFilters = [];
- for (let e of this.multiFilters) {
- var o = { name: e.name, index: -1, value: null };
- if (e.options.length > 0) {
- o.index = 0;
- o.value = e.options[0]
- }
- this.selectedFilters.push(o)
- }
- if (this.additionFilters && this.additionFilters.name) {
- o = { name: this.additionFilters.name, index: -1, value: null };
- this.selectedFilters.push(o)
- }
- }
- if (!this.colorArr) {
- this.colorArr = [];
- this.backgroundColorArr = [];
- this.isBackgroundHover = [];
- this.fontWeightArr = [];
- this.isArrowIconDownArr = [];
- this.floatArrowBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- for (let o of this.multiFilters) {
- var e = new ResourceArray;
- var t = new FontWeightArray;
- var r = new ResourceArray;
- var i = new BooleanArray;
- for (let i of o.options.keys()) {
- if (0 === i) {
- e.push({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- });
- t.push(FontWeight.Medium)
- } else {
- e.push({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- t.push(FontWeight.Regular)
- }
- r.push({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- })
- }
- this.colorArr.push(e);
- this.fontWeightArr.push(t);
- this.backgroundColorArr.push(r);
- this.isBackgroundHover.push(i);
- this.isArrowIconDownArr.push(new ObservedBoolean(!0))
- }
- }
- if (this.additionFilters && this.additionFilters.options) {
- this.additionColorArr = [];
- this.additionFontWeightArr = [];
- this.additionBackgroundColorArr = [];
- this.isAdditionBackgroundHover = [];
- for (let o = 0;o < this.additionFilters.options.length; o++) {
- this.additionColorArr.push({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- this.additionFontWeightArr.push(FontWeight.Regular);
- this.additionBackgroundColorArr.push({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- });
- this.isAdditionBackgroundHover.push(!1)
- }
- }
- if (!this.twoLineModeItemNum) {
- this.twoLineModeItemNum = [];
- this.twoLineModeItemNumRecord = [];
- this.downArrowShowState = [];
- for (let o = 0;o < this.multiFilters.length; o++) {
- this.twoLineModeItemNum.push(new ObservedNumber(0));
- this.twoLineModeItemNumRecord.push(new ObservedNumber(0));
- this.downArrowShowState.push(new ObservedBoolean(!1))
- }
- }
- }
-
- ListFilter(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.width("100%");
- Column.align(Alignment.Start);
- Column.padding({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- }
- });
- Column.onAreaChange(((o, e) => {
- if (!this.isFloatShowAllFilterWithoutAnimation && !this.isFloatBarShowWithoutAnimation) {
- null != this.additionFilters ? this.filterDynamicHeight = parseInt(e.height.toString(), 0) + 40 + 8 : this.filterDynamicHeight = parseInt(e.height.toString(), 0) + 8;
- this.floatFilterPosition = -this.filterDynamicHeight
- }
- }));
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.multiFilters, ((o, e) => {
- const t = o;
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- r ? ViewPU.create(new ListFilterRow(this, {
- colorRow: this.colorArr[e],
- fontWeightRow: this.fontWeightArr[e],
- backgroundColorRow: this.backgroundColorArr[e],
- isBackgroundHoverRow: this.isBackgroundHover[e],
- filterRow: t,
- onItemClick: o => {
- this.filterItemClick(e, o)
- }
- }, void 0, o)) : this.updateStateVarsOfChildByElmtId(o, {
- colorRow: this.colorArr[e],
- fontWeightRow: this.fontWeightArr[e],
- backgroundColorRow: this.backgroundColorArr[e],
- isBackgroundHoverRow: this.isBackgroundHover[e]
- });
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Column.pop()
- }
-
- MultiLineFilter(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.width("100%");
- Column.onAreaChange(((o, e) => {
- null != this.additionFilters ? this.filterDynamicHeight = parseInt(e.height.toString(), 0) + 40 + 8 : this.filterDynamicHeight = parseInt(e.height.toString(), 0) + 8;
- this.isFloatBarShowWithoutAnimation || this.isFloatShowAllFilterWithoutAnimation || (this.floatFilterPosition = -this.filterDynamicHeight)
- }));
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.multiFilters, ((o, e) => {
- const t = o;
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- r ? ViewPU.create(new MultiFilterRow(this, {
- colorRow: this.colorArr[e],
- fontWeightRow: this.fontWeightArr[e],
- backgroundColorRow: this.backgroundColorArr[e],
- isBackgroundHoverRow: this.isBackgroundHover[e],
- arrowShowStateRow: this.downArrowShowState[e],
- twoLineModeItemNumRow: this.twoLineModeItemNum[e],
- twoLineModeItemNumRecordRow: this.twoLineModeItemNumRecord[e],
- isArrowIconDown: this.isArrowIconDownArr[e],
- filterRow: t,
- onItemClick: o => {
- this.filterItemClick(e, o)
- }
- }, void 0, o)) : this.updateStateVarsOfChildByElmtId(o, {
- colorRow: this.colorArr[e],
- fontWeightRow: this.fontWeightArr[e],
- backgroundColorRow: this.backgroundColorArr[e],
- isBackgroundHoverRow: this.isBackgroundHover[e],
- arrowShowStateRow: this.downArrowShowState[e],
- twoLineModeItemNumRow: this.twoLineModeItemNum[e],
- twoLineModeItemNumRecordRow: this.twoLineModeItemNumRecord[e],
- isArrowIconDown: this.isArrowIconDownArr[e]
- });
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Column.pop()
- }
-
- additionItemClick(o) {
- let e = this.multiFilters.length;
- if (this.selectedFilters[e].index != o) if (-1 === this.selectedFilters[e].index) {
- this.additionColorArr[o] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- };
- this.additionFontWeightArr[o] = FontWeight.Medium;
- this.selectedFilters[e].value = this.additionFilters.options[o];
- this.selectedFilters[e].index = o
- } else {
- let t = this.selectedFilters[e].index;
- this.additionColorArr[t] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- };
- this.additionColorArr[o] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- };
- this.additionFontWeightArr[t] = FontWeight.Regular;
- this.additionFontWeightArr[o] = FontWeight.Medium;
- this.selectedFilters[e].value = this.additionFilters.options[o];
- this.selectedFilters[e].index = o
- } else {
- this.additionColorArr[o] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- };
- this.additionFontWeightArr[o] = FontWeight.Regular;
- this.selectedFilters[e].value = null;
- this.selectedFilters[e].index = -1
- }
- this.onFilterChanged && this.onFilterChanged(this.selectedFilters);
- this.colorRefresh = !this.colorRefresh
- }
-
- AdditionFilterList(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- this.additionFilters && this.additionFilters.name && this.additionFilters.options && 0 != this.additionFilters.options.length ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- List.create();
- List.listDirection(Axis.Horizontal);
- List.scrollBar(BarState.Off);
- List.padding({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- }
- });
- List.margin({ left: -16 });
- List.width("100%");
- List.height(40);
- e || List.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- {
- const o = !0;
- const e = (e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ListItem.create(r, o);
- ListItem.height("100%");
- t || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const t = () => {
- this.observeComponentCreation(e);
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(this.additionFilters.name.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ left: 8, right: 8 });
- e || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.width(1);
- Row.height(16);
- Row.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_list_separator"],
- bundleName: "",
- moduleName: ""
- });
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop();
- Row.pop();
- ListItem.pop()
- };
- const r = (o, t) => {
- e(o, t);
- this.updateFuncByElmtId.set(o, e);
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(this.additionFilters.name.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ left: 8, right: 8 });
- e || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.width(1);
- Row.height(16);
- Row.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_list_separator"],
- bundleName: "",
- moduleName: ""
- });
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop();
- Row.pop();
- ListItem.pop()
- };
- o ? (() => {
- this.observeComponentCreation(e);
- ListItem.pop()
- })() : t()
- }
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.additionFilters.options, ((o, e) => {
- const t = o;
- {
- const o = !0;
- const r = (t, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- ListItem.create(s, o);
- ListItem.height("100%");
- ListItem.backgroundColor(this.isAdditionBackgroundHover[e] ? this.additionBackgroundColorArr[e] : "#00FFFFFF");
- ListItem.onHover((o => {
- Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- if (o) {
- this.additionBackgroundColorArr[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isAdditionBackgroundHover[e] = !0
- } else this.isAdditionBackgroundHover[e] = !1
- }))
- }));
- ListItem.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.additionBackgroundColorArr[e] = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isAdditionBackgroundHover[e] = !0
- })) : o.type === TouchType.Up && Context.animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: 100
- }, (() => {
- this.isAdditionBackgroundHover[e] = !1
- }))
- }));
- ListItem.focusable(!0);
- ViewStackProcessor.visualState("focused");
- ListItem.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- ListItem.padding({ left: 6, right: 6 });
- ViewStackProcessor.visualState("normal");
- ListItem.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- ListItem.padding({ left: 8, right: 8 });
- ViewStackProcessor.visualState();
- ListItem.onClick((() => {
- this.additionItemClick(e)
- }));
- r || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const i = () => {
- this.observeComponentCreation(r);
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.additionColorArr[e]);
- Text.fontWeight(this.additionFontWeightArr[e]);
- Text.focusable(!0);
- r || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- ListItem.pop()
- };
- const s = (o, i) => {
- r(o, i);
- this.updateFuncByElmtId.set(o, r);
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.toString());
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.additionColorArr[e]);
- Text.fontWeight(this.additionFontWeightArr[e]);
- Text.focusable(!0);
- r || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- ListItem.pop()
- };
- o ? (() => {
- this.observeComponentCreation(r);
- ListItem.pop()
- })() : i()
- }
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- List.pop()
- })) : If.branchId(1);
- e || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- }
-
- FilterHeader(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.padding({ top: 8 });
- Column.onVisibleAreaChange([0, 1], ((o, e) => {
- if (e > 0) {
- this.isFloatShowAllFilter = !1;
- this.isFloatShowAllFilterWithoutAnimation = !1;
- this.isFloatBarShowWithoutAnimation = !1;
- Context.animateTo({ curve: INTER_POLATING_SPRING, onFinish: () => {
- this.isFloatBarShowWithoutAnimation || (this.isFloatBarShow = !1)
- } }, (() => {
- this.floatFilterBarHeight = 0
- }))
- } else {
- this.isFloatBarShow = !0;
- this.isFloatBarShowWithoutAnimation = !0;
- Context.animateTo({ curve: INTER_POLATING_SPRING }, (() => {
- this.floatFilterBarHeight = 48
- }))
- }
- }));
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- this.filterType === FilterType.LIST_FILTER ? this.ifElseBranchUpdateFunction(0, (() => {
- this.ListFilter.bind(this)()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.MultiLineFilter.bind(this)()
- }));
- e || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.AdditionFilterList.bind(this)();
- Column.pop()
- }
-
- FloatFilterHeader(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.padding({ top: 8 });
- Column.width("100%");
- Column.clip(!0);
- Column.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Column.opacity(.95);
- Column.backgroundBlurStyle(BlurStyle.Thin);
- Column.visibility(this.isFloatShowAllFilter ? Visibility.Visible : Visibility.Hidden);
- Column.position({ x: 0, y: this.floatFilterPosition });
- Column.zIndex(2);
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- this.filterType === FilterType.LIST_FILTER ? this.ifElseBranchUpdateFunction(0, (() => {
- this.ListFilter.bind(this)()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.MultiLineFilter.bind(this)()
- }));
- e || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.AdditionFilterList.bind(this)();
- Column.pop()
- }
-
- FloatFilterBar(o = null) {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.width("100%");
- Row.padding({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Row.height(this.floatFilterBarHeight);
- Row.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Row.opacity(.95);
- Row.clip(!0);
- Row.backgroundBlurStyle(BlurStyle.Thin);
- Row.visibility(this.isFloatBarShow ? Visibility.Visible : Visibility.Hidden);
- Row.alignItems(VerticalAlign.Bottom);
- Row.position({ x: 0, y: this.floatFilterBarPosition });
- Row.zIndex(1);
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.alignItems(HorizontalAlign.Center);
- Column.width("100%");
- Column.height(40);
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.height("100%");
- Row.alignItems(VerticalAlign.Center);
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- ForEach.create();
- this.forEachUpdateFunction(o, this.selectedFilters.slice(0, (this.colorRefresh, this.selectedFilters.length)), ((o, e) => {
- const t = o;
- this.observeComponentCreation(((o, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- 0 != e && null != t.value ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create("/");
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- e || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- r || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(t.value);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body3"],
- bundleName: "",
- moduleName: ""
- });
- e || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- }), void 0,!0,!1);
- e || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Row.pop();
- Column.pop();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.height(40);
- Row.margin({ left: -24 });
- Row.backgroundColor(this.isFloatArrowBgHover ? this.floatArrowBgColor : "#00FFFFFF");
- Row.focusable(!0);
- ViewStackProcessor.visualState("focused");
- Row.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 2,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- });
- Row.width(28);
- Row.offset({ x: -2 });
- ViewStackProcessor.visualState("normal");
- Row.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- width: 0
- });
- Row.width(24);
- Row.offset({ x: 0 });
- ViewStackProcessor.visualState();
- Row.onHover((o => {
- o ? Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- this.floatArrowBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- };
- this.isFloatArrowBgHover = !0
- })) : Context.animateTo({ curve: FRICTION_CUBIC_BEZIER, duration: 250 }, (() => {
- this.isFloatArrowBgHover = !1
- }))
- }));
- Row.onTouch((o => {
- o.type === TouchType.Down ? Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.floatArrowBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- };
- this.isFloatArrowBgHover = !0
- })) : o.type === TouchType.Up && Context.animateTo({ curve: SHARP_CUBIC_BEZIER, duration: 100 }, (() => {
- this.isFloatArrowBgHover = !1
- }))
- }));
- Row.onClick((() => {
- Context.animateTo({ duration: 150, curve: SHARP_CUBIC_BEZIER }, (() => {
- this.isFloatBarShow = !1;
- this.isFloatBarShowWithoutAnimation = !1
- }));
- this.isFloatShowAllFilter = !0;
- this.isFloatShowAllFilterWithoutAnimation = !0;
- Context.animateTo({ curve: INTER_POLATING_SPRING }, (() => {
- this.floatFilterPosition = 0;
- this.floatFilterBarPosition = this.filterDynamicHeight
- }))
- }));
- e || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Image.create({
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- });
- Image.width(24);
- Image.height(24);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_tertiary"],
- bundleName: "",
- moduleName: ""
- });
- Image.focusable(!0);
- e || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop();
- Row.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Stack.create({ alignContent: Alignment.Top });
- Stack.clip(!0);
- e || Stack.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.FloatFilterBar.bind(this)();
- this.FloatFilterHeader.bind(this)();
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Column.create();
- Column.zIndex(0);
- e || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, e) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- List.create({ initialIndex: 0, scroller: this.listScroller });
- List.listDirection(Axis.Vertical);
- List.width("100%");
- List.height("100%");
- List.edgeEffect(EdgeEffect.Spring);
- List.onScroll(((o, e) => {
- if (this.isFloatShowAllFilterWithoutAnimation && e == ScrollState.Scroll) {
- this.isFloatBarShowWithoutAnimation = !0;
- this.isFloatShowAllFilterWithoutAnimation = !1;
- Context.animateTo({ duration: 150, curve: SHARP_CUBIC_BEZIER }, (() => {
- this.isFloatBarShow = !0
- }));
- Context.animateTo({ curve: INTER_POLATING_SPRING, onFinish: () => {
- this.isFloatShowAllFilterWithoutAnimation || (this.isFloatShowAllFilter = !1)
- } }, (() => {
- this.floatFilterPosition = -this.filterDynamicHeight;
- this.floatFilterBarPosition = 0
- }))
- }
- }));
- e || List.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- {
- const o = !0;
- const e = (e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ListItem.create(r, o);
- ListItem.focusable(!0);
- ListItem.onFocus((() => {
- this.listScroller.scrollToIndex(0,!0)
- }));
- t || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const t = () => {
- this.observeComponentCreation(e);
- this.FilterHeader.bind(this)();
- ListItem.pop()
- };
- const r = (o, t) => {
- e(o, t);
- this.updateFuncByElmtId.set(o, e);
- this.FilterHeader.bind(this)();
- ListItem.pop()
- };
- o ? (() => {
- this.observeComponentCreation(e);
- ListItem.pop()
- })() : t()
- }
- {
- const o = !0;
- const e = (e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ListItem.create(r, o);
- ListItem.focusable(!0);
- ListItem.onFocus((() => {
- this.listScroller.scrollToIndex(1,!0)
- }));
- t || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const t = () => {
- this.observeComponentCreation(e);
- this.container.bind(this)();
- ListItem.pop()
- };
- const r = (o, t) => {
- e(o, t);
- this.updateFuncByElmtId.set(o, e);
- this.container.bind(this)();
- ListItem.pop()
- };
- o ? (() => {
- this.observeComponentCreation(e);
- ListItem.pop()
- })() : t()
- }
- List.pop();
- Column.pop();
- Stack.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export default {
- Filter, FilterType
-};
\ No newline at end of file
diff --git a/interface/progressbutton/BUILD.gn b/interface/progressbutton/BUILD.gn
deleted file mode 100644
index 411fb32..0000000
--- a/interface/progressbutton/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_progressbutton_abc") {
- src_js = rebase_path("progressbutton.js")
- dst_file = rebase_path(target_out_dir + "/progressbutton.abc")
- in_puts = [ "progressbutton.js" ]
- out_puts = [ target_out_dir + "/progressbutton.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("progressbutton_abc") {
- input = get_label_info(":gen_progressbutton_abc", "target_out_dir") + "/progressbutton.abc"
- output = target_out_dir + "/progressbutton_abc.o"
- dep = ":gen_progressbutton_abc"
-}
-
-ohos_shared_library("progressbutton") {
- sources = [ "progressbutton.cpp" ]
-
- deps = [ ":progressbutton_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/progressbutton/progressbutton.cpp b/interface/progressbutton/progressbutton.cpp
deleted file mode 100644
index 4a3fc1d..0000000
--- a/interface/progressbutton/progressbutton.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-extern const char _binary_progressbutton_abc_start[];
-extern const char _binary_progressbutton_abc_end[];
-
-// Napi get abc code function
-extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_ProgressButton_GetABCCode(const char **buf, int *buflen)
-{
- if (buf != nullptr) {
- *buf = _binary_progressbutton_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_progressbutton_abc_end - _binary_progressbutton_abc_start;
- }
-}
-
-/*
- * Module define
- */
-static napi_module progressbuttonModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.ProgressButton",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-/*
- * Module register function
- */
-extern "C" __attribute__((constructor)) void progressbuttonRegisterModule(void)
-{
- napi_module_register(&progressbuttonModule);
-}
diff --git a/interface/progressbutton/progressbutton.js b/interface/progressbutton/progressbutton.js
deleted file mode 100644
index 9a3bd18..0000000
--- a/interface/progressbutton/progressbutton.js
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const EMPTY_STRING = '';
-const MAX_PROGRESS = 100;
-const MAX_PERCENTAGE = '100%';
-const MIN_PERCENTAGE = '0%';
-const TEXT_OPACITY = 0.4;
-const BUTTON_NORMARL_WIDTH = 44;
-const BUTTON_NORMARL_HEIGHT = 28;
-const BUTTON_BORDER_RADIUS = 14;
-const BUTTON_BORDER_WIDTH = 0.5;
-
-export class ProgressButton extends ViewPU {
- constructor(e, t, s, r = -1) {
- super(e, s, r);
- this.__progress = new SynchedPropertySimpleOneWayPU(t.progress, this, 'progress');
- this.__textProgress = new ObservedPropertySimplePU('', this, 'textProgress');
- this.__content = new SynchedPropertySimpleOneWayPU(t.content, this, 'content');
- this.__isLoading = new ObservedPropertySimplePU(!1, this, 'isLoading');
- this.__enable = new SynchedPropertySimpleOneWayPU(t.enable, this, 'enable');
- this.progressButtonWidth = 44;
- this.clickCallback = null;
- this.setInitiallyProvidedValue(t);
- this.declareWatch('progress', this.getProgressContext);
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.textProgress && (this.textProgress = e.textProgress);
- void 0 !== e.content ? this.__content.set(e.content) : this.__content.set('');
- void 0 !== e.isLoading && (this.isLoading = e.isLoading);
- void 0 !== e.enable ? this.__enable.set(e.enable) : this.__enable.set(!0);
- void 0 !== e.progressButtonWidth && (this.progressButtonWidth = e.progressButtonWidth);
- void 0 !== e.clickCallback && (this.clickCallback = e.clickCallback);
- }
-
- updateStateVars(e) {
- this.__progress.reset(e.progress);
- this.__content.reset(e.content);
- this.__enable.reset(e.enable);
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__progress.purgeDependencyOnElmtId(e);
- this.__textProgress.purgeDependencyOnElmtId(e);
- this.__content.purgeDependencyOnElmtId(e);
- this.__isLoading.purgeDependencyOnElmtId(e);
- this.__enable.purgeDependencyOnElmtId(e);
- }
-
- aboutToBeDeleted() {
- this.__progress.aboutToBeDeleted();
- this.__textProgress.aboutToBeDeleted();
- this.__content.aboutToBeDeleted();
- this.__isLoading.aboutToBeDeleted();
- this.__enable.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- get progress() {
- return this.__progress.get();
- }
-
- set progress(e) {
- this.__progress.set(e);
- }
-
- get textProgress() {
- return this.__textProgress.get();
- }
-
- set textProgress(e) {
- this.__textProgress.set(e);
- }
-
- get content() {
- return this.__content.get();
- }
-
- set content(e) {
- this.__content.set(e);
- }
-
- get isLoading() {
- return this.__isLoading.get();
- }
-
- set isLoading(e) {
- this.__isLoading.set(e);
- }
-
- get enable() {
- return this.__enable.get();
- }
-
- set enable(e) {
- this.__enable.set(e);
- }
-
- getButtonProgress() {
- return this.progress < 0 ? 0 : this.progress > MAX_PROGRESS ? MAX_PROGRESS : this.progress;
- }
-
- getProgressContext() {
- if (this.progress < 0) {
- this.isLoading = !1;
- this.textProgress = '0%';
- } else if (this.progress >= MAX_PROGRESS) {
- this.isLoading = !1;
- this.textProgress = '100%';
- } else {
- this.textProgress = Math.floor(this.progress / MAX_PROGRESS * MAX_PROGRESS).toString() + '%';
- }
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Button.createWithChild();
- Button.borderRadius(BUTTON_BORDER_RADIUS);
- Button.clip(!1);
- Button.hoverEffect(HoverEffect.None);
- Button.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_foreground_contrary'],
- bundleName: '',
- moduleName: ''
- });
- Button.border({
- width: BUTTON_BORDER_WIDTH,
- color: this.enable ? {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_text_actived'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_foreground_contrary_disable'],
- bundleName: '',
- moduleName: ''
- }
- });
- Button.constraintSize({ minWidth: 44 });
- Button.width(this.progressButtonWidth < BUTTON_NORMARL_WIDTH ? BUTTON_NORMARL_WIDTH : this.progressButtonWidth);
- Button.stateEffect(this.enable);
- Button.onClick((() => {
- if (this.enable) {
- this.progress < MAX_PROGRESS && (this.isLoading = !this.isLoading);
- this.clickCallback && this.clickCallback();
- }
- }));
- t || Button.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Stack.create();
- t || Stack.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Progress.create({ value: this.getButtonProgress(), total: MAX_PROGRESS, style: ProgressStyle.Capsule });
- Progress.height(BUTTON_NORMARL_HEIGHT);
- Progress.borderRadius(BUTTON_BORDER_RADIUS);
- Progress.width('100%');
- Progress.hoverEffect(HoverEffect.None);
- Progress.clip(!1);
- Progress.enabled(this.enable);
- t || Progress.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.isLoading ? this.textProgress : this.content);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_button3'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- Text.fontColor(this.isLoading ? {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_emphasize'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxLines(1);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.padding({ left: 8, right: 8 });
- Text.opacity(this.enable ? 1 : TEXT_OPACITY);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Row.pop();
- Stack.pop();
- Button.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-export default { ProgressButton };
\ No newline at end of file
diff --git a/interface/selecttitlebar/BUILD.gn b/interface/selecttitlebar/BUILD.gn
deleted file mode 100755
index 2b37576..0000000
--- a/interface/selecttitlebar/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_selecttitlebar_abc") {
- src_js = rebase_path("selecttitlebar.js")
- dst_file = rebase_path(target_out_dir + "/selecttitlebar.abc")
- in_puts = [ "selecttitlebar.js" ]
- out_puts = [ target_out_dir + "/selecttitlebar.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("selecttitlebar_abc") {
- input = get_label_info(":gen_selecttitlebar_abc", "target_out_dir") + "/selecttitlebar.abc"
- output = target_out_dir + "/selecttitlebar_abc.o"
- dep = ":gen_selecttitlebar_abc"
-}
-
-ohos_shared_library("selecttitlebar") {
- sources = [ "selecttitlebar.cpp" ]
-
- deps = [ ":selecttitlebar_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/selecttitlebar/selecttitlebar.cpp b/interface/selecttitlebar/selecttitlebar.cpp
deleted file mode 100644
index 9d11696..0000000
--- a/interface/selecttitlebar/selecttitlebar.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-extern const char _binary_selecttitlebar_abc_start[];
-extern const char _binary_selecttitlebar_abc_end[];
-
-// Napi get abc code function
-extern "C" __attribute__((visibility("default")))
-void NAPI_arkui_advanced_SelectTitleBar_GetABCCode(const char **buf, int *buflen)
- {
- if (buf != nullptr) {
- *buf = _binary_selecttitlebar_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_selecttitlebar_abc_end - _binary_selecttitlebar_abc_start;
- }
- }
-
-
-static napi_module selecttitlebarModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.SelectTitleBar",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void selecttitlebarRegisterModule(void)
-{
- napi_module_register(&selecttitlebarModule);
-}
\ No newline at end of file
diff --git a/interface/selecttitlebar/selecttitlebar.js b/interface/selecttitlebar/selecttitlebar.js
deleted file mode 100644
index 08d5151..0000000
--- a/interface/selecttitlebar/selecttitlebar.js
+++ /dev/null
@@ -1,785 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-var __decorate = this && this.__decorate || function(e, t, o, i) {
- var s, r = arguments.length,
- n = r < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, o, i);
- else
- for (var c = e.length - 1; c >= 0; c--)(s = e[c]) && (n = (r < 3 ? s(n) : r > 3 ? s(t, o, n) : s(t, o)) || n);
- return r > 3 && n && Object.defineProperty(t, o, n), n
-};
-const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
-const PUBLIC_MORE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuAxhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BICydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdYjJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5HnhkC9+zAA5YXXy8jBKV5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rmj79U74wCszuih+F/ljrSi/+uud8YBGA10rayqrnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hkH4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ/N5Vjd0oTXKp9QcKFpD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fNQ1BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnXfo96DGYBRZD1ycpc/XzbmbvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jpyaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jvjACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrpVV1fXOOADLA10rq6rrnXEAVga6VlZV13uh8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5LP+r7veGQfgd+T+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtUtTXit8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXvO9H8f1bfVPQ9FvQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC";
-const PUBLIC_BACK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0GiIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpgIzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLnHedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+sPy9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6zELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC";
-export class SelectTitleBar extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.__selected = new ObservedPropertySimplePU(0, this, "selected");
- this.options = void 0;
- this.menuItems = void 0;
- this.subtitle = void 0;
- this.badgeValue = void 0;
- this.hidesBackButton = void 0;
- this.onSelected = void 0;
- this.__selectMaxWidth = new ObservedPropertySimplePU(0, this, "selectMaxWidth");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.selected && (this.selected = e.selected);
- void 0 !== e.options && (this.options = e.options);
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.subtitle && (this.subtitle = e.subtitle);
- void 0 !== e.badgeValue && (this.badgeValue = e.badgeValue);
- void 0 !== e.hidesBackButton && (this.hidesBackButton = e.hidesBackButton);
- void 0 !== e.onSelected && (this.onSelected = e.onSelected);
- void 0 !== e.selectMaxWidth && (this.selectMaxWidth = e.selectMaxWidth)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__selected.purgeDependencyOnElmtId(e);
- this.__selectMaxWidth.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__selected.aboutToBeDeleted();
- this.__selectMaxWidth.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get selected() {
- return this.__selected.get()
- }
- set selected(e) {
- this.__selected.set(e)
- }
- get selectMaxWidth() {
- return this.__selectMaxWidth.get()
- }
- set selectMaxWidth(e) {
- this.__selectMaxWidth.set(e)
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- });
- Flex.width("100%");
- Flex.height(SelectTitleBar.totalHeight);
- Flex.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Flex.onAreaChange(((e, t) => {
- let o = Number(t.width);
- if (!this.hidesBackButton) {
- o -= ImageMenuItem.imageHotZoneWidth;
- o += SelectTitleBar.leftPadding;
- o -= SelectTitleBar.leftPaddingWithBack
- }
- if (void 0 !== this.menuItems) {
- let e = this.menuItems.length;
- e >= CollapsibleMenuSection.maxCountOfVisibleItems ? o -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems : e > 0 && (o -= ImageMenuItem.imageHotZoneWidth * e)
- }
- void 0 !== this.badgeValue ? this.selectMaxWidth = o - SelectTitleBar.badgeSize - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding - SelectTitleBar.badgePadding : this.selectMaxWidth = o - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding
- }));
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: this.hidesBackButton ? {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_start"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.hidesBackButton ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Navigator.create();
- t || Navigator.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: {
- value: PUBLIC_BACK,
- isEnabled: !0
- }
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Navigator.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.justifyContent(FlexAlign.Start);
- Column.alignItems(HorizontalAlign.Start);
- Column.constraintSize({
- maxWidth: this.selectMaxWidth
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.badgeValue ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Badge.create({
- count: this.badgeValue,
- position: BadgePosition.Right,
- style: {
- badgeSize: SelectTitleBar.badgeSize,
- badgeColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- borderColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- borderWidth: 0
- }
- });
- t || Badge.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.justifyContent(FlexAlign.Start);
- Row.margin({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_l"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Select.create(this.options);
- Select.selected(this.selected);
- Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : "");
- Select.font({
- size: this.hidesBackButton && void 0 === this.subtitle ? {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline8"],
- bundleName: "",
- moduleName: ""
- }
- });
- Select.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text"],
- bundleName: "",
- moduleName: ""
- });
- Select.backgroundColor(Color.Transparent);
- Select.onSelect(this.onSelected);
- Select.constraintSize({
- maxWidth: this.selectMaxWidth
- });
- Select.offset({
- x: -4
- });
- t || Select.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Select.pop();
- Row.pop();
- Badge.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.justifyContent(FlexAlign.Start);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Select.create(this.options);
- Select.selected(this.selected);
- Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : "");
- Select.font({
- size: this.hidesBackButton && void 0 === this.subtitle ? {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline8"],
- bundleName: "",
- moduleName: ""
- }
- });
- Select.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text"],
- bundleName: "",
- moduleName: ""
- });
- Select.backgroundColor(Color.Transparent);
- Select.onSelect(this.onSelected);
- Select.constraintSize({
- maxWidth: this.selectMaxWidth
- });
- Select.offset({
- x: -4
- });
- t || Select.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Select.pop();
- Row.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.justifyContent(FlexAlign.Start);
- Row.margin({
- left: SelectTitleBar.subtitleLeftPadding
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.subtitle);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_over_line"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_subtitle_text"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.textOverflow({
- overflow: TextOverflow.Ellipsis
- });
- Text.constraintSize({
- maxWidth: this.selectMaxWidth
- });
- Text.offset({
- y: -4
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new CollapsibleMenuSection(this, {
- menuItems: this.menuItems
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Flex.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-SelectTitleBar.badgeSize = 16;
-SelectTitleBar.totalHeight = 56;
-SelectTitleBar.leftPadding = 24;
-SelectTitleBar.leftPaddingWithBack = 12;
-SelectTitleBar.rightPadding = 24;
-SelectTitleBar.badgePadding = 16;
-SelectTitleBar.subtitleLeftPadding = 4;
-class CollapsibleMenuSection extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.menuItems = void 0;
- this.__isPopupShown = new ObservedPropertySimplePU(!1, this, "isPopupShown");
- this.__isMoreIconOnFocus = new ObservedPropertySimplePU(!1, this, "isMoreIconOnFocus");
- this.__isMoreIconOnHover = new ObservedPropertySimplePU(!1, this, "isMoreIconOnHover");
- this.__isMoreIconOnClick = new ObservedPropertySimplePU(!1, this, "isMoreIconOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.isPopupShown && (this.isPopupShown = e.isPopupShown);
- void 0 !== e.isMoreIconOnFocus && (this.isMoreIconOnFocus = e.isMoreIconOnFocus);
- void 0 !== e.isMoreIconOnHover && (this.isMoreIconOnHover = e.isMoreIconOnHover);
- void 0 !== e.isMoreIconOnClick && (this.isMoreIconOnClick = e.isMoreIconOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isPopupShown.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnHover.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isPopupShown.aboutToBeDeleted();
- this.__isMoreIconOnFocus.aboutToBeDeleted();
- this.__isMoreIconOnHover.aboutToBeDeleted();
- this.__isMoreIconOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isPopupShown() {
- return this.__isPopupShown.get()
- }
- set isPopupShown(e) {
- this.__isPopupShown.set(e)
- }
- get isMoreIconOnFocus() {
- return this.__isMoreIconOnFocus.get()
- }
- set isMoreIconOnFocus(e) {
- this.__isMoreIconOnFocus.set(e)
- }
- get isMoreIconOnHover() {
- return this.__isMoreIconOnHover.get()
- }
- set isMoreIconOnHover(e) {
- this.__isMoreIconOnHover.set(e)
- }
- get isMoreIconOnClick() {
- return this.__isMoreIconOnClick.get()
- }
- set isMoreIconOnClick(e) {
- this.__isMoreIconOnClick.set(e)
- }
- getMoreIconFgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getMoreIconBgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isMoreIconOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("100%");
- Column.margin({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Column.justifyContent(FlexAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems, (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getMoreIconFgColor());
- Row.backgroundColor(this.getMoreIconBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.border(this.isMoreIconOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => this.isMoreIconOnFocus = !0));
- Row.onBlur((() => this.isMoreIconOnFocus = !1));
- Row.onHover((e => this.isMoreIconOnHover = e));
- Row.onKeyEvent((e => {
- if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) {
- e.type === KeyType.Down && (this.isMoreIconOnClick = !0);
- e.type === KeyType.Up && (this.isMoreIconOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- e.type === TouchType.Down && (this.isMoreIconOnClick = !0);
- e.type === TouchType.Up && (this.isMoreIconOnClick = !1)
- }));
- Row.onClick((() => this.isPopupShown = !0));
- Row.bindPopup(this.isPopupShown, {
- builder: {
- builder: this.popupBuilder.bind(this)
- },
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: !1,
- onStateChange: e => this.isPopupShown = e.isVisible
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(PUBLIC_MORE);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(!0);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Column.pop()
- }
- popupBuilder(e = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum);
- Column.margin({
- top: CollapsibleMenuSection.focusPadding,
- bottom: CollapsibleMenuSection.focusPadding
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), ((e, t) => {
- const o = e;
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: o
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }), void 0, !0, !1);
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Column.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-CollapsibleMenuSection.maxCountOfVisibleItems = 3;
-CollapsibleMenuSection.focusPadding = 4;
-CollapsibleMenuSection.marginsNum = 2;
-__decorate([], CollapsibleMenuSection.prototype, "popupBuilder", null);
-class ImageMenuItem extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.item = void 0;
- this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus");
- this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover");
- this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus);
- void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover);
- void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isOnFocus.purgeDependencyOnElmtId(e);
- this.__isOnHover.purgeDependencyOnElmtId(e);
- this.__isOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isOnFocus.aboutToBeDeleted();
- this.__isOnHover.aboutToBeDeleted();
- this.__isOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isOnFocus() {
- return this.__isOnFocus.get()
- }
- set isOnFocus(e) {
- this.__isOnFocus.set(e)
- }
- get isOnHover() {
- return this.__isOnHover.get()
- }
- set isOnHover(e) {
- this.__isOnHover.set(e)
- }
- get isOnClick() {
- return this.__isOnClick.get()
- }
- set isOnClick(e) {
- this.__isOnClick.set(e)
- }
- getFgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getBgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getFgColor());
- Row.backgroundColor(this.getBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
- Row.border(this.isOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => {
- this.item.isEnabled && (this.isOnFocus = !0)
- }));
- Row.onBlur((() => this.isOnFocus = !1));
- Row.onHover((e => {
- this.item.isEnabled && (this.isOnHover = e)
- }));
- Row.onKeyEvent((e => {
- if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- if (this.item.isEnabled) {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action()));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(this.item.isEnabled);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-ImageMenuItem.imageSize = 24;
-ImageMenuItem.imageHotZoneWidth = 48;
-ImageMenuItem.buttonBorderRadius = 8;
-ImageMenuItem.focusBorderWidth = 2;
-ImageMenuItem.disabledImageOpacity = .4;
-export default {
- SelectTitleBar: SelectTitleBar
-};
\ No newline at end of file
diff --git a/interface/splitlayout/BUILD.gn b/interface/splitlayout/BUILD.gn
deleted file mode 100644
index 8a0a21c..0000000
--- a/interface/splitlayout/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_splitlayout_abc") {
- src_js = rebase_path("splitlayout.js")
- dst_file = rebase_path(target_out_dir + "/splitlayout.abc")
- in_puts = [ "splitlayout.js" ]
- out_puts = [ target_out_dir + "/splitlayout.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("splitlayout_abc") {
- input = get_label_info(":gen_splitlayout_abc", "target_out_dir") + "/splitlayout.abc"
- output = target_out_dir + "/splitlayout_abc.o"
- dep = ":gen_splitlayout_abc"
-}
-
-ohos_shared_library("splitlayout") {
- sources = [ "splitlayout.cpp" ]
-
- deps = [ ":splitlayout_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
\ No newline at end of file
diff --git a/interface/splitlayout/splitlayout.cpp b/interface/splitlayout/splitlayout.cpp
deleted file mode 100644
index 154b774..0000000
--- a/interface/splitlayout/splitlayout.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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_splitlayout_GetABCCode(const char **buf, int *buflen)
-{
- if (buf != nullptr) {
- *buf = _binary_splitlayout_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_splitlayout_abc_end - _binary_splitlayout_abc_start;
- }
-}
-
-static napi_module splitlayoutModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "splitlayout",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void splitlayoutRegisterModule(void)
-{
- napi_module_register(&splitlayoutModule);
-}
\ No newline at end of file
diff --git a/interface/splitlayout/splitlayout.js b/interface/splitlayout/splitlayout.js
deleted file mode 100644
index 85792d4..0000000
--- a/interface/splitlayout/splitlayout.js
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-export class splitlayout extends ViewPU {
- constructor(e, t, o, r = -1) {
- super(e, o, r);
- this.container = void 0;
- this.__sizeValue = new ObservedPropertySimplePU("", this, "sizeValue");
- this.__areaWidth = new ObservedPropertySimplePU(0, this, "areaWidth");
- this.__imageBackgroundColor = new ObservedPropertySimplePU("#FFFFFF", this, "imageBackgroundColor");
- this.__mainImage = new SynchedPropertyObjectOneWayPU(t.mainImage, this, "mainImage");
- this.__primaryText = new SynchedPropertySimpleOneWayPU(t.primaryText, this, "primaryText");
- this.secondaryText = "私人订制新歌精选站,为你推荐专属优质新歌;为你推荐专属优质新歌";
- this.tertiaryText = "每日更新";
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.container && (this.container = e.container);
- void 0 !== e.sizeValue && (this.sizeValue = e.sizeValue);
- void 0 !== e.areaWidth && (this.areaWidth = e.areaWidth);
- void 0 !== e.imageBackgroundColor && (this.imageBackgroundColor = e.imageBackgroundColor);
- void 0 !== e.mainImage ? this.__mainImage.set(e.mainImage) : this.__mainImage.set({
- id: -1,
- type: 2e4,
- params: ["app.media.music"],
- bundleName: "",
- moduleName: ""
- });
- void 0 !== e.primaryText ? this.__primaryText.set(e.primaryText) : this.__primaryText.set("新歌推荐");
- void 0 !== e.secondaryText && (this.secondaryText = e.secondaryText);
- void 0 !== e.tertiaryText && (this.tertiaryText = e.tertiaryText)
- }
-
- updateStateVars(e) {
- this.__mainImage.reset(e.mainImage);
- this.__primaryText.reset(e.primaryText)
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__sizeValue.purgeDependencyOnElmtId(e);
- this.__areaWidth.purgeDependencyOnElmtId(e);
- this.__imageBackgroundColor.purgeDependencyOnElmtId(e);
- this.__mainImage.purgeDependencyOnElmtId(e);
- this.__primaryText.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__sizeValue.aboutToBeDeleted();
- this.__areaWidth.aboutToBeDeleted();
- this.__imageBackgroundColor.aboutToBeDeleted();
- this.__mainImage.aboutToBeDeleted();
- this.__primaryText.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get sizeValue() {
- return this.__sizeValue.get()
- }
-
- set sizeValue(e) {
- this.__sizeValue.set(e)
- }
-
- get areaWidth() {
- return this.__areaWidth.get()
- }
-
- set areaWidth(e) {
- this.__areaWidth.set(e)
- }
-
- get imageBackgroundColor() {
- return this.__imageBackgroundColor.get()
- }
-
- set imageBackgroundColor(e) {
- this.__imageBackgroundColor.set(e)
- }
-
- get mainImage() {
- return this.__mainImage.get()
- }
-
- set mainImage(e) {
- this.__mainImage.set(e)
- }
-
- get primaryText() {
- return this.__primaryText.get()
- }
-
- set primaryText(e) {
- this.__primaryText.set(e)
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.onAreaChange(((e, t) => {
- console.info(`Ace: on area change, oldValue is ${JSON.stringify(e)} value is ${JSON.stringify(t)}`);
- this.sizeValue = JSON.stringify(t);
- this.areaWidth = parseInt(t.width.toString(), 0);
- console.info("pingAce: on area change, oldValue is" + this.areaWidth);
- console.info("pingAce: on area change, oldValue is" + parseInt(t.height.toString(), 0))
- }));
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.areaWidth < 600 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridRow.create({
- columns: 4,
- breakpoints: { reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- });
- t || GridRow.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridCol.create({ span: { xs: 4, sm: 4, md: 4, lg: 4 } });
- t || GridCol.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Stack.create({ alignContent: Alignment.Bottom });
- Stack.height("34%");
- Stack.width("100%");
- t || Stack.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.mainImage);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.alignItems(HorizontalAlign.Center);
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.primaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.secondaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ top: 4, bottom: 8 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.tertiaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_caption"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ bottom: 24 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Column.pop();
- Stack.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("66%");
- Column.width("100%");
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.container.bind(this)();
- Column.pop();
- Column.pop();
- GridCol.pop();
- GridRow.pop()
- })) : 600 < this.areaWidth && this.areaWidth < 840 ? this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridRow.create({
- columns: 8,
- breakpoints: { reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- });
- t || GridRow.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridCol.create({ span: { xs: 8, sm: 8, md: 8, lg: 8 } });
- t || GridCol.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(this.imageBackgroundColor);
- Row.height("34%");
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.mainImage);
- Image.margin({ left: 96, right: 36 });
- Image.height("60%");
- Image.width("20%");
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.alignItems(HorizontalAlign.Start);
- Column.margin({ right: 96 });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.primaryText);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.secondaryText);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ top: 4, bottom: 8 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.tertiaryText);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_caption"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Column.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("66%");
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.container.bind(this)();
- Column.pop();
- Column.pop();
- GridCol.pop();
- GridRow.pop()
- })) : this.areaWidth > 840 && this.ifElseBranchUpdateFunction(2, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridRow.create({
- columns: 12,
- breakpoints: { reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- });
- t || GridRow.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridCol.create({ span: { xs: 4, sm: 4, md: 4, lg: 4 } });
- GridCol.height("100%");
- t || GridCol.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("100%");
- Column.backgroundColor(this.imageBackgroundColor);
- Column.justifyContent(FlexAlign.Center);
- Column.alignItems(HorizontalAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.mainImage);
- Image.height("17%");
- Image.width("34%");
- Image.margin({ bottom: 36 });
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.primaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ left: 48, right: 48 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.secondaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ top: 4, bottom: 8, left: 48, right: 48 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.tertiaryText);
- Text.textAlign(TextAlign.Center);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ bottom: 24, left: 48, right: 48 });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Column.pop();
- GridCol.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- GridCol.create({ span: { xs: 8, sm: 8, md: 8, lg: 8 } });
- t || GridCol.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.container.bind(this)();
- GridCol.pop();
- GridRow.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
\ No newline at end of file
diff --git a/interface/subheader/BUILD.gn b/interface/subheader/BUILD.gn
deleted file mode 100644
index 926d6ed..0000000
--- a/interface/subheader/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_subheader_abc") {
- src_js = rebase_path("subheader.js")
- dst_file = rebase_path(target_out_dir + "/subheader.abc")
- in_puts = [ "subheader.js" ]
- out_puts = [ target_out_dir + "/subheader.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("subheader_abc") {
- input = get_label_info(":gen_subheader_abc", "target_out_dir") + "/subheader.abc"
- output = target_out_dir + "/subheader_abc.o"
- dep = ":gen_subheader_abc"
-}
-
-ohos_shared_library("subheader") {
- sources = [ "subheader.cpp" ]
-
- deps = [ ":subheader_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
\ No newline at end of file
diff --git a/interface/subheader/subheader.js b/interface/subheader/subheader.js
deleted file mode 100644
index 651a883..0000000
--- a/interface/subheader/subheader.js
+++ /dev/null
@@ -1,1141 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const SPACE_MARGIN = 8;
-const MARGIN_NUM = 4;
-const IMAGE_WIDTH_NUM = 16;
-const IMAGE_HEIGHT_NUM = 24;
-const BUTTON_SIZE = 32;
-const SINGLE_LINE_HEIGHT = 48;
-const DOUBLE_LINE_HEIGHT = 64;
-const BUTTON_HEIGHT = 28;
-const IMAGE_WIDTH = 12;
-const BORDER_WIDTH = 2;
-const SINGLE_LINE_NUM = 1;
-const DOUBLE_LINE_NUM = 2;
-const MIN_FONT_SIZE = 14;
-const MAIN_TEXT_SIZE = 10;
-const MIN_CONSTRAINT_WIDTH = 3;
-
-export var OperationType;
-!function(e){
- e[e.TEXT_ARROW=0] = "TEXT_ARROW";
- e[e.BUTTON=1] = "BUTTON";
- e[e.ICON_GROUP=2] = "ICON_GROUP";
- e[e.LOADING=3] = "LOADING"
-}(OperationType || (OperationType = {}));
-
-class ButtonStyle extends ViewPU {
- constructor(e, o, t, s = -1) {
- super(e, t, s);
- this.__buttonBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "buttonBgColor");
- this.__isButtonFocus = new ObservedPropertySimplePU(!1, this, "isButtonFocus");
- this.button = void 0;
- this.focusBorderWidth = 2;
- this.setInitiallyProvidedValue(o)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.buttonBgColor && (this.buttonBgColor = e.buttonBgColor);
- void 0 !== e.isButtonFocus && (this.isButtonFocus = e.isButtonFocus);
- void 0 !== e.button && (this.button = e.button);
- void 0 !== e.focusBorderWidth && (this.focusBorderWidth = e.focusBorderWidth)
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__buttonBgColor.purgeDependencyOnElmtId(e);
- this.__isButtonFocus.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__buttonBgColor.aboutToBeDeleted();
- this.__isButtonFocus.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get buttonBgColor() {
- return this.__buttonBgColor.get()
- }
-
- set buttonBgColor(e) {
- this.__buttonBgColor.set(e)
- }
-
- get isButtonFocus() {
- return this.__isButtonFocus.get()
- }
-
- set isButtonFocus(e) {
- this.__isButtonFocus.set(e)
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.align(Alignment.End);
- Row.justifyContent(FlexAlign.Center);
- Row.focusable(!0);
- Row.height(28);
- Row.margin({ left: 8, right: 8 });
- Row.borderRadius(16);
- Row.backgroundColor(ObservedObject.GetRawObject(this.buttonBgColor));
- Row.onTouch((e => {
- if (e.type === TouchType.Down) {
- this.button.action && this.button.action();
- this.buttonBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- }
- }
- e.type === TouchType.Up && (this.buttonBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- })
- }));
- Row.onHover((e => {
- this.buttonBgColor = e ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }
- }));
- Row.border(this.isButtonFocus ? {
- width: this.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : { width: 0 });
- Row.onFocus((() => {
- this.isButtonFocus = !0
- }));
- Row.onBlur((() => {
- this.isButtonFocus = !1
- }));
- Row.onKeyEvent((e => {
- 2054 !== e.keyCode && 2050 !== e.keyCode || this.button.action && this.button.action()
- }));
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.button.value);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_button2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontWeight(FontWeight.Medium);
- Text.margin({ left: 8, right: 8 });
- Text.focusable(!0);
- Text.maxLines(2);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-class IconGroup extends ViewPU {
- constructor(e, o, t, s = -1) {
- super(e, t, s);
- this.__bgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "bgColor");
- this.__isFocus = new ObservedPropertySimplePU(!1, this, "isFocus");
- this.item = void 0;
- this.focusBorderWidth = 2;
- this.setInitiallyProvidedValue(o)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.bgColor && (this.bgColor = e.bgColor);
- void 0 !== e.isFocus && (this.isFocus = e.isFocus);
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.focusBorderWidth && (this.focusBorderWidth = e.focusBorderWidth)
- }
-
- updateStateVars(e) {
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__bgColor.purgeDependencyOnElmtId(e);
- this.__isFocus.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__bgColor.aboutToBeDeleted();
- this.__isFocus.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get bgColor() {
- return this.__bgColor.get()
- }
-
- set bgColor(e) {
- this.__bgColor.set(e)
- }
-
- get isFocus() {
- return this.__isFocus.get()
- }
-
- set isFocus(e) {
- this.__isFocus.set(e)
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.focusable(!0);
- Row.width(32);
- Row.height(32);
- Row.margin({ right: 8 });
- Row.justifyContent(FlexAlign.Center);
- Row.borderRadius({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- });
- Row.backgroundColor(ObservedObject.GetRawObject(this.bgColor));
- Row.onTouch((e => {
- if (e.type === TouchType.Down) {
- this.item.action && this.item.action();
- this.bgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- }
- }
- e.type === TouchType.Up && (this.bgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- })
- }));
- Row.onHover((e => {
- this.bgColor = e ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }
- }));
- Row.border(this.isFocus ? {
- width: this.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : { width: 0 });
- Row.onFocus((() => {
- this.isFocus = !0
- }));
- Row.onBlur((() => {
- this.isFocus = !1
- }));
- Row.onKeyEvent((e => {
- 2054 !== e.keyCode && 2050 !== e.keyCode || this.item.action && this.item.action()
- }));
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- });
- Image.width(24);
- Image.height(24);
- Image.focusable(!0);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export class SubHeader extends ViewPU {
- constructor(e, o, t, s = -1) {
- super(e, t, s);
- this.__icon = new SynchedPropertyObjectOneWayPU(o.icon, this, "icon");
- this.__primaryTitle = new SynchedPropertySimpleOneWayPU(o.primaryTitle, this, "primaryTitle");
- this.__secondaryTitle = new SynchedPropertySimpleOneWayPU(o.secondaryTitle, this, "secondaryTitle");
- this.__select = new SynchedPropertyObjectOneWayPU(o.select, this, "select");
- this.__operationType = new SynchedPropertySimpleOneWayPU(o.operationType, this, "operationType");
- this.operationItem = void 0;
- this.__isDuplicateLine = new ObservedPropertySimplePU(!1, this, "isDuplicateLine");
- this.__textArrowBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "textArrowBgColor");
- this.__buttonBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "buttonBgColor");
- this.__iconBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "iconBgColor");
- this.__firstIconBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "firstIconBgColor");
- this.__SecondaryIconBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "SecondaryIconBgColor");
- this.__thirdIconBgColor = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }, this, "thirdIconBgColor");
- this.__flag = new ObservedPropertySimplePU(!1, this, "flag");
- this.__isTextArrowFocus = new ObservedPropertySimplePU(!1, this, "isTextArrowFocus");
- this.focusBorderWidth = 2;
- this.setInitiallyProvidedValue(o)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.operationType ? this.__operationType.set(e.operationType) : this.__operationType.set(OperationType.BUTTON);
- void 0 !== e.operationItem && (this.operationItem = e.operationItem);
- void 0 !== e.isDuplicateLine && (this.isDuplicateLine = e.isDuplicateLine);
- void 0 !== e.textArrowBgColor && (this.textArrowBgColor = e.textArrowBgColor);
- void 0 !== e.buttonBgColor && (this.buttonBgColor = e.buttonBgColor);
- void 0 !== e.iconBgColor && (this.iconBgColor = e.iconBgColor);
- void 0 !== e.firstIconBgColor && (this.firstIconBgColor = e.firstIconBgColor);
- void 0 !== e.SecondaryIconBgColor && (this.SecondaryIconBgColor = e.SecondaryIconBgColor);
- void 0 !== e.thirdIconBgColor && (this.thirdIconBgColor = e.thirdIconBgColor);
- void 0 !== e.flag && (this.flag = e.flag);
- void 0 !== e.isTextArrowFocus && (this.isTextArrowFocus = e.isTextArrowFocus);
- void 0 !== e.focusBorderWidth && (this.focusBorderWidth = e.focusBorderWidth)
- }
-
- updateStateVars(e) {
- this.__icon.reset(e.icon);
- this.__primaryTitle.reset(e.primaryTitle);
- this.__secondaryTitle.reset(e.secondaryTitle);
- this.__select.reset(e.select);
- this.__operationType.reset(e.operationType)
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__icon.purgeDependencyOnElmtId(e);
- this.__primaryTitle.purgeDependencyOnElmtId(e);
- this.__secondaryTitle.purgeDependencyOnElmtId(e);
- this.__select.purgeDependencyOnElmtId(e);
- this.__operationType.purgeDependencyOnElmtId(e);
- this.__isDuplicateLine.purgeDependencyOnElmtId(e);
- this.__textArrowBgColor.purgeDependencyOnElmtId(e);
- this.__buttonBgColor.purgeDependencyOnElmtId(e);
- this.__iconBgColor.purgeDependencyOnElmtId(e);
- this.__firstIconBgColor.purgeDependencyOnElmtId(e);
- this.__SecondaryIconBgColor.purgeDependencyOnElmtId(e);
- this.__thirdIconBgColor.purgeDependencyOnElmtId(e);
- this.__flag.purgeDependencyOnElmtId(e);
- this.__isTextArrowFocus.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__icon.aboutToBeDeleted();
- this.__primaryTitle.aboutToBeDeleted();
- this.__secondaryTitle.aboutToBeDeleted();
- this.__select.aboutToBeDeleted();
- this.__operationType.aboutToBeDeleted();
- this.__isDuplicateLine.aboutToBeDeleted();
- this.__textArrowBgColor.aboutToBeDeleted();
- this.__buttonBgColor.aboutToBeDeleted();
- this.__iconBgColor.aboutToBeDeleted();
- this.__firstIconBgColor.aboutToBeDeleted();
- this.__SecondaryIconBgColor.aboutToBeDeleted();
- this.__thirdIconBgColor.aboutToBeDeleted();
- this.__flag.aboutToBeDeleted();
- this.__isTextArrowFocus.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get icon() {
- return this.__icon.get()
- }
-
- set icon(e) {
- this.__icon.set(e)
- }
-
- get primaryTitle() {
- return this.__primaryTitle.get()
- }
-
- set primaryTitle(e) {
- this.__primaryTitle.set(e)
- }
-
- get secondaryTitle() {
- return this.__secondaryTitle.get()
- }
-
- set secondaryTitle(e) {
- this.__secondaryTitle.set(e)
- }
-
- get select() {
- return this.__select.get()
- }
-
- set select(e) {
- this.__select.set(e)
- }
-
- get operationType() {
- return this.__operationType.get()
- }
-
- set operationType(e) {
- this.__operationType.set(e)
- }
-
- get isDuplicateLine() {
- return this.__isDuplicateLine.get()
- }
-
- set isDuplicateLine(e) {
- this.__isDuplicateLine.set(e)
- }
-
- get textArrowBgColor() {
- return this.__textArrowBgColor.get()
- }
-
- set textArrowBgColor(e) {
- this.__textArrowBgColor.set(e)
- }
-
- get buttonBgColor() {
- return this.__buttonBgColor.get()
- }
-
- set buttonBgColor(e) {
- this.__buttonBgColor.set(e)
- }
-
- get iconBgColor() {
- return this.__iconBgColor.get()
- }
-
- set iconBgColor(e) {
- this.__iconBgColor.set(e)
- }
-
- get firstIconBgColor() {
- return this.__firstIconBgColor.get()
- }
-
- set firstIconBgColor(e) {
- this.__firstIconBgColor.set(e)
- }
-
- get SecondaryIconBgColor() {
- return this.__SecondaryIconBgColor.get()
- }
-
- set SecondaryIconBgColor(e) {
- this.__SecondaryIconBgColor.set(e)
- }
-
- get thirdIconBgColor() {
- return this.__thirdIconBgColor.get()
- }
-
- set thirdIconBgColor(e) {
- this.__thirdIconBgColor.set(e)
- }
-
- get flag() {
- return this.__flag.get()
- }
-
- set flag(e) {
- this.__flag.set(e)
- }
-
- get isTextArrowFocus() {
- return this.__isTextArrowFocus.get()
- }
-
- set isTextArrowFocus(e) {
- this.__isTextArrowFocus.set(e)
- }
-
- ListTextStyle(e, o = null) {
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.content);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title3"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(2);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- },
- bottom: 8,
- right: 4
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- }
-
- ListIconStyle(e, o, t = null) {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- },
- bottom: 8,
- right: 4
- });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(o);
- Image.width(16);
- Image.height(16);
- Image.margin({ right: 8 });
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.content);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title3"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(2);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- }
-
- ContentTextStyle(e, o = null) {
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.content);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title2"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(2);
- Text.maxFontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title2"],
- bundleName: "",
- moduleName: ""
- });
- Text.minFontSize(14);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: 4,
- bottom: 8
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- }
-
- SubTextStyle(e, o = null) {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.alignItems(HorizontalAlign.Start);
- Column.onAppear((() => {
- this.isDuplicateLine = !0
- }));
- Column.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: 4,
- bottom: 8
- });
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.content);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title2"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.maxFontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title2"],
- bundleName: "",
- moduleName: ""
- });
- Text.minFontSize(14);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.subContent);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title3"],
- bundleName: "",
- moduleName: ""
- });
- Text.maxLines(1);
- Text.maxFontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_sub_title3"],
- bundleName: "",
- moduleName: ""
- });
- Text.minFontSize(10);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Column.pop()
- }
-
- SelectStyle(e, o = null) {
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Select.create(e.options);
- Select.selected(e.selected);
- Select.value(e.value);
- Select.onSelect(((o, t) => {
- e.onSelect && e.onSelect(o, t)
- }));
- Select.margin({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_start"],
- bundleName: "",
- moduleName: ""
- },
- right: 4
- });
- t || Select.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Select.pop()
- }
-
- LoadingProcessStyle(e = null) {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- LoadingProgress.create();
- LoadingProgress.width(24);
- LoadingProgress.height(24);
- LoadingProgress.focusable(!0);
- LoadingProgress.margin({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- o || LoadingProgress.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }
-
- TextArrowStyle(e, o = null) {
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.focusable(!0);
- Row.margin({ left: 4, right: 4, bottom: 4 });
- Row.borderRadius({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_subtab"],
- bundleName: "",
- moduleName: ""
- });
- Row.backgroundColor(ObservedObject.GetRawObject(this.textArrowBgColor));
- Row.onTouch((o => {
- if (o.type === TouchType.Down) {
- e.action && e.action();
- this.textArrowBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- }
- }
- o.type === TouchType.Up && (this.textArrowBgColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- })
- }));
- Row.onHover((e => {
- this.textArrowBgColor = e ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- }
- }));
- Row.border(this.isTextArrowFocus ? {
- width: this.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : { width: 0 });
- Row.onFocus((() => {
- this.isTextArrowFocus = !0
- }));
- Row.onBlur((() => {
- this.isTextArrowFocus = !1
- }));
- Row.onKeyEvent((o => {
- 2054 !== o.keyCode && 2050 !== o.keyCode || e.action && e.action()
- }));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({ left: 8, right: 8 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Text.create(e.value);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.margin({ right: 4 });
- Text.focusable(!0);
- Text.maxLines(2);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create({
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_right"],
- bundleName: "",
- moduleName: ""
- });
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_tertiary"],
- bundleName: "",
- moduleName: ""
- });
- Image.width(12);
- Image.height(24);
- Image.focusable(!0);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop();
- Row.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.End });
- Flex.padding({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_default_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Flex.height(this.isDuplicateLine ? 64 : 48);
- o || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- null != this.secondaryTitle && null != this.icon ? this.ifElseBranchUpdateFunction(0, (() => {
- this.ListIconStyle.bind(this)({ content: this.secondaryTitle }, ObservedObject.GetRawObject(this.icon))
- })) : null != this.secondaryTitle && null != this.primaryTitle ? this.ifElseBranchUpdateFunction(1, (() => {
- this.SubTextStyle.bind(this)(makeBuilderParameterProxy("SubTextStyle", {
- content: () => this.__primaryTitle ? this.__primaryTitle : this.primaryTitle,
- subContent: () => this.__secondaryTitle ? this.__secondaryTitle : this.secondaryTitle
- }))
- })) : null != this.secondaryTitle ? this.ifElseBranchUpdateFunction(2, (() => {
- this.ListTextStyle.bind(this)(makeBuilderParameterProxy("ListTextStyle", {
- content: () => this.__secondaryTitle ? this.__secondaryTitle : this.secondaryTitle
- }))
- })) : null != this.select ? this.ifElseBranchUpdateFunction(3, (() => {
- this.SelectStyle.bind(this)(ObservedObject.GetRawObject(this.select))
- })) : null != this.primaryTitle && this.ifElseBranchUpdateFunction(4, (() => {
- this.ContentTextStyle.bind(this)(makeBuilderParameterProxy("ContentTextStyle", {
- content: () => this.__primaryTitle ? this.__primaryTitle : this.primaryTitle
- }))
- }));
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.operationType === OperationType.BUTTON && null != this.operationItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- __Common__.create();
- __Common__.margin({ bottom: 4 });
- o || __Common__.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ButtonStyle(this, {
- button: this.operationItem[0]
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- __Common__.pop()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.operationType === OperationType.ICON_GROUP && null != this.operationItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({ bottom: 4 });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.operationItem, ((e, o) => {
- const t = e;
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- 0 == o ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new IconGroup(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- s || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- 1 == o ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new IconGroup(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- s || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- 2 == o ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new IconGroup(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- s || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- }), void 0,!0,!1);
- o || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Row.pop()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.operationType === OperationType.TEXT_ARROW && null != this.operationItem ? this.ifElseBranchUpdateFunction(0, (() => {
- this.TextArrowStyle.bind(this)(this.operationItem[0])
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.operationType === OperationType.LOADING ? this.ifElseBranchUpdateFunction(0, (() => {
- this.LoadingProcessStyle.bind(this)()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Flex.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
-
-export default { OperationStyle, SubHeader }
\ No newline at end of file
diff --git a/interface/swiperefresher/BUILD.gn b/interface/swiperefresher/BUILD.gn
deleted file mode 100644
index 785f9a4..0000000
--- a/interface/swiperefresher/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_swiperefresher_abc") {
- src_js = rebase_path("swiperefresher.js")
- dst_file = rebase_path(target_out_dir + "/swiperefresher.abc")
- in_puts = [ "swiperefresher.js" ]
- out_puts = [ target_out_dir + "/swiperefresher.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("swiperefresher_abc") {
- input = get_label_info(":gen_swiperefresher_abc", "target_out_dir") + "/swiperefresher.abc"
- output = target_out_dir + "/swiperefresher_abc.o"
- dep = ":gen_swiperefresher_abc"
-}
-
-ohos_shared_library("swiperefresher") {
- sources = [ "swiperefresher.cpp" ]
-
- deps = [ ":swiperefresher_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/swiperefresher/swiperefresher.cpp b/interface/swiperefresher/swiperefresher.cpp
deleted file mode 100644
index 8d5726b..0000000
--- a/interface/swiperefresher/swiperefresher.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
- {
- if (buf != nullptr) {
- *buf = _binary_swiperefresher_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_swiperefresher_abc_end - _binary_swiperefresher_abc_start;
- }
- }
-
-
-static napi_module swiperefresherModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.SwipeRefresher",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void swiperefresherRegisterModule(void)
-{
- napi_module_register(&swiperefresherModule);
-}
\ No newline at end of file
diff --git a/interface/swiperefresher/swiperefresher.js b/interface/swiperefresher/swiperefresher.js
deleted file mode 100644
index d34c05f..0000000
--- a/interface/swiperefresher/swiperefresher.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const LOADINGPROGRESS_SIZE = 24;
-const DEFAULT_MARGIN = 16;
-const ITEM_SPACE = 4;
-
-export class SwipeRefresher extends ViewPU {
- constructor(e, t, o, s = -1) {
- super(e, o, s);
- this.__content = new SynchedPropertySimpleOneWayPU(t.content, this, "content");
- this.__isLoading = new SynchedPropertySimpleOneWayPU(t.isLoading, this, "isLoading");
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.content ? this.__content.set(e.content) : this.__content.set(null);
- void 0 !== e.isLoading ? this.__isLoading.set(e.isLoading) : this.__isLoading.set(!1)
- }
-
- updateStateVars(e) {
- this.__content.reset(e.content);
- this.__isLoading.reset(e.isLoading)
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__content.purgeDependencyOnElmtId(e);
- this.__isLoading.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__content.aboutToBeDeleted();
- this.__isLoading.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get content() {
- return this.__content.get()
- }
-
- set content(e) {
- this.__content.set(e)
- }
-
- get isLoading() {
- return this.__isLoading.get()
- }
-
- set isLoading(e) {
- this.__isLoading.set(e)
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center });
- Flex.margin({ top: 16, bottom: 16 });
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.isLoading ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- LoadingProgress.create();
- LoadingProgress.height(24);
- LoadingProgress.width(24);
- LoadingProgress.margin({ right: 4 });
- t || LoadingProgress.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.content);
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Flex.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
-}
\ No newline at end of file
diff --git a/interface/tabtitlebar/BUILD.gn b/interface/tabtitlebar/BUILD.gn
deleted file mode 100755
index 5a1effe..0000000
--- a/interface/tabtitlebar/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_tabtitlebar_abc") {
- src_js = rebase_path("tabtitlebar.js")
- dst_file = rebase_path(target_out_dir + "/tabtitlebar.abc")
- in_puts = [ "tabtitlebar.js" ]
- out_puts = [ target_out_dir + "/tabtitlebar.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("tabtitlebar_abc") {
- input = get_label_info(":gen_tabtitlebar_abc", "target_out_dir") + "/tabtitlebar.abc"
- output = target_out_dir + "/tabtitlebar_abc.o"
- dep = ":gen_tabtitlebar_abc"
-}
-
-ohos_shared_library("tabtitlebar") {
- sources = [ "tabtitlebar.cpp" ]
-
- deps = [ ":tabtitlebar_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
diff --git a/interface/tabtitlebar/tabtitlebar.cpp b/interface/tabtitlebar/tabtitlebar.cpp
deleted file mode 100644
index 8cc4eb3..0000000
--- a/interface/tabtitlebar/tabtitlebar.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
- {
- if (buf != nullptr) {
- *buf = _binary_tabtitlebar_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_tabtitlebar_abc_end - _binary_tabtitlebar_abc_start;
- }
- }
-
-
-static napi_module tabtitlebarModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.TabTitleBar",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-extern "C" __attribute__((constructor)) void tabtitlebarRegisterModule(void)
-{
- napi_module_register(&tabtitlebarModule);
-}
\ No newline at end of file
diff --git a/interface/tabtitlebar/tabtitlebar.js b/interface/tabtitlebar/tabtitlebar.js
deleted file mode 100644
index f2b8bc1..0000000
--- a/interface/tabtitlebar/tabtitlebar.js
+++ /dev/null
@@ -1,930 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-var __decorate = this && this.__decorate || function(e, t, o, i) {
- var s, r = arguments.length,
- n = r < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(e, t, o, i);
- else
- for (var c = e.length - 1; c >= 0; c--)(s = e[c]) && (n = (r < 3 ? s(n) : r > 3 ? s(t, o, n) : s(t, o)) || n);
- return r > 3 && n && Object.defineProperty(t, o, n), n
-};
-const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
-const PUBLIC_MORE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuAxhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BICydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdYjJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5HnhkC9+zAA5YXXy8jBKV5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rmj79U74wCszuih+F/ljrSi/+uud8YBGA10rayqrnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hkH4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ/N5Vjd0oTXKp9QcKFpD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fNQ1BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnXfo96DGYBRZD1ycpc/XzbmbvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jpyaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jvjACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrpVV1fXOOADLA10rq6rrnXEAVga6VlZV13uh8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5LP+r7veGQfgd+T+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtUtTXit8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXvO9H8f1bfVPQ9FvQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC";
-export class TabTitleBar extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.tabItems = void 0;
- this.menuItems = void 0;
- this.swiperContent = void 0;
- this.__tabWidth = new ObservedPropertySimplePU(0, this, "tabWidth");
- this.__currentIndex = new ObservedPropertySimplePU(0, this, "currentIndex");
- this.menuSectionWidth = 0;
- this.scroller = new Scroller;
- this.swiperController = new SwiperController;
- this.settings = new RenderingContextSettings(!0);
- this.leftContext2D = new CanvasRenderingContext2D(this.settings);
- this.rightContext2D = new CanvasRenderingContext2D(this.settings);
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.tabItems && (this.tabItems = e.tabItems);
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.swiperContent && (this.swiperContent = e.swiperContent);
- void 0 !== e.tabWidth && (this.tabWidth = e.tabWidth);
- void 0 !== e.currentIndex && (this.currentIndex = e.currentIndex);
- void 0 !== e.menuSectionWidth && (this.menuSectionWidth = e.menuSectionWidth);
- void 0 !== e.scroller && (this.scroller = e.scroller);
- void 0 !== e.swiperController && (this.swiperController = e.swiperController);
- void 0 !== e.settings && (this.settings = e.settings);
- void 0 !== e.leftContext2D && (this.leftContext2D = e.leftContext2D);
- void 0 !== e.rightContext2D && (this.rightContext2D = e.rightContext2D)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__tabWidth.purgeDependencyOnElmtId(e);
- this.__currentIndex.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__tabWidth.aboutToBeDeleted();
- this.__currentIndex.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get tabWidth() {
- return this.__tabWidth.get()
- }
- set tabWidth(e) {
- this.__tabWidth.set(e)
- }
- get currentIndex() {
- return this.__currentIndex.get()
- }
- set currentIndex(e) {
- this.__currentIndex.set(e)
- }
- GradientMask(e, t, o, i, s, r = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(TabTitleBar.gradientMaskWidth);
- Column.height(TabTitleBar.totalHeight);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((r, n) => {
- ViewStackProcessor.StartGetAccessRecordingFor(r);
- Canvas.create(e);
- Canvas.width(TabTitleBar.gradientMaskWidth);
- Canvas.height(TabTitleBar.totalHeight);
- Canvas.onReady((() => {
- var r = e.createLinearGradient(t, o, i, s);
- r.addColorStop(0, "#ffffffff");
- r.addColorStop(1, "#00ffffff");
- e.fillStyle = r;
- e.fillRect(0, 0, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight)
- }));
- n || Canvas.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Canvas.pop();
- Column.pop()
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Flex.create({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- });
- Flex.backgroundColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- Flex.margin({
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_max_padding_end"],
- bundleName: "",
- moduleName: ""
- }
- });
- Flex.onAreaChange(((e, t) => {
- this.tabWidth = Number(t.width) - this.menuSectionWidth
- }));
- t || Flex.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Stack.create({
- alignContent: Alignment.End
- });
- t || Stack.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Stack.create({
- alignContent: Alignment.Start
- });
- t || Stack.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- List.create({
- initialIndex: 0,
- scroller: this.scroller,
- space: 0
- });
- List.width("100%");
- List.height(TabTitleBar.totalHeight);
- List.constraintSize({
- maxWidth: this.tabWidth
- });
- List.edgeEffect(EdgeEffect.Spring);
- List.listDirection(Axis.Horizontal);
- List.scrollBar(BarState.Off);
- t || List.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.tabItems, ((e, t) => {
- const o = e;
- {
- const e = !0;
- const i = (t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- ListItem.create(r, e);
- o || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const s = () => {
- this.observeComponentCreation(i);
- this.observeComponentCreation(((e, i) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- i ? ViewPU.create(new TabContentItem(this, {
- item: o,
- index: t,
- maxIndex: this.tabItems.length - 1,
- currentIndex: this.currentIndex,
- onCustomClick: () => this.currentIndex = t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {
- currentIndex: this.currentIndex
- });
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ListItem.pop()
- };
- const r = (e, s) => {
- i(e, s);
- this.updateFuncByElmtId.set(e, i);
- this.observeComponentCreation(((e, i) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- i ? ViewPU.create(new TabContentItem(this, {
- item: o,
- index: t,
- maxIndex: this.tabItems.length - 1,
- currentIndex: this.currentIndex,
- onCustomClick: () => this.currentIndex = t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {
- currentIndex: this.currentIndex
- });
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ListItem.pop()
- };
- e ? (() => {
- this.observeComponentCreation(i);
- ListItem.pop()
- })() : s()
- }
- }), void 0, !0, !1);
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- List.pop();
- Column.pop();
- this.GradientMask.bind(this)(this.leftContext2D, 0, TabTitleBar.totalHeight / 2, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2);
- Stack.pop();
- this.GradientMask.bind(this)(this.rightContext2D, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2, 0, TabTitleBar.totalHeight / 2);
- Stack.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 !== this.menuItems && this.menuItems.length > 0 ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- __Common__.create();
- __Common__.height(TabTitleBar.totalHeight);
- __Common__.onAreaChange(((e, t) => {
- this.menuSectionWidth = Number(t.width)
- }));
- t || __Common__.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new CollapsibleMenuSection(this, {
- menuItems: this.menuItems
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }));
- __Common__.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Flex.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Swiper.create(this.swiperController);
- Swiper.index(this.currentIndex);
- Swiper.itemSpace(0);
- Swiper.indicator(!1);
- Swiper.width("100%");
- Swiper.height("100%");
- Swiper.curve(Curve.Friction);
- Swiper.onChange((e => {
- this.currentIndex = e;
- this.scroller.scrollToIndex(this.currentIndex);
- this.scroller.scrollBy(TabTitleBar.correctionOffset, 0)
- }));
- Swiper.onAppear((() => {
- this.scroller.scrollToIndex(this.currentIndex);
- this.scroller.scrollBy(TabTitleBar.correctionOffset, 0)
- }));
- t || Swiper.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.swiperContent.bind(this)();
- Swiper.pop();
- Column.pop();
- Column.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-TabTitleBar.totalHeight = 56;
-TabTitleBar.correctionOffset = -40;
-TabTitleBar.gradientMaskWidth = 24;
-__decorate([], TabTitleBar.prototype, "GradientMask", null);
-class CollapsibleMenuSection extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.menuItems = void 0;
- this.__isPopupShown = new ObservedPropertySimplePU(!1, this, "isPopupShown");
- this.__isMoreIconOnFocus = new ObservedPropertySimplePU(!1, this, "isMoreIconOnFocus");
- this.__isMoreIconOnHover = new ObservedPropertySimplePU(!1, this, "isMoreIconOnHover");
- this.__isMoreIconOnClick = new ObservedPropertySimplePU(!1, this, "isMoreIconOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.menuItems && (this.menuItems = e.menuItems);
- void 0 !== e.isPopupShown && (this.isPopupShown = e.isPopupShown);
- void 0 !== e.isMoreIconOnFocus && (this.isMoreIconOnFocus = e.isMoreIconOnFocus);
- void 0 !== e.isMoreIconOnHover && (this.isMoreIconOnHover = e.isMoreIconOnHover);
- void 0 !== e.isMoreIconOnClick && (this.isMoreIconOnClick = e.isMoreIconOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isPopupShown.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnHover.purgeDependencyOnElmtId(e);
- this.__isMoreIconOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isPopupShown.aboutToBeDeleted();
- this.__isMoreIconOnFocus.aboutToBeDeleted();
- this.__isMoreIconOnHover.aboutToBeDeleted();
- this.__isMoreIconOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isPopupShown() {
- return this.__isPopupShown.get()
- }
- set isPopupShown(e) {
- this.__isPopupShown.set(e)
- }
- get isMoreIconOnFocus() {
- return this.__isMoreIconOnFocus.get()
- }
- set isMoreIconOnFocus(e) {
- this.__isMoreIconOnFocus.set(e)
- }
- get isMoreIconOnHover() {
- return this.__isMoreIconOnHover.get()
- }
- set isMoreIconOnHover(e) {
- this.__isMoreIconOnHover.set(e)
- }
- get isMoreIconOnClick() {
- return this.__isMoreIconOnClick.get()
- }
- set isMoreIconOnClick(e) {
- this.__isMoreIconOnClick.set(e)
- }
- getMoreIconFgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getMoreIconBgColor() {
- return this.isMoreIconOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isMoreIconOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.height("100%");
- Column.justifyContent(FlexAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems, (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (e => {
- const t = e;
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- o ? ViewPU.create(new ImageMenuItem(this, {
- item: t
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getMoreIconFgColor());
- Row.backgroundColor(this.getMoreIconBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.border(this.isMoreIconOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => this.isMoreIconOnFocus = !0));
- Row.onBlur((() => this.isMoreIconOnFocus = !1));
- Row.onHover((e => this.isMoreIconOnHover = e));
- Row.onKeyEvent((e => {
- if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) {
- e.type === KeyType.Down && (this.isMoreIconOnClick = !0);
- e.type === KeyType.Up && (this.isMoreIconOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- e.type === TouchType.Down && (this.isMoreIconOnClick = !0);
- e.type === TouchType.Up && (this.isMoreIconOnClick = !1)
- }));
- Row.onClick((() => this.isPopupShown = !0));
- Row.bindPopup(this.isPopupShown, {
- builder: {
- builder: this.popupBuilder.bind(this)
- },
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: !1,
- onStateChange: e => this.isPopupShown = e.isVisible
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(PUBLIC_MORE);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(!0);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Column.pop()
- }
- popupBuilder(e = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum);
- Column.margin({
- top: CollapsibleMenuSection.focusPadding,
- bottom: CollapsibleMenuSection.focusPadding
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), ((e, t) => {
- const o = e;
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- t ? ViewPU.create(new ImageMenuItem(this, {
- item: o
- }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {});
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }), void 0, !0, !1);
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- ForEach.pop();
- Column.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-CollapsibleMenuSection.maxCountOfVisibleItems = 1;
-CollapsibleMenuSection.focusPadding = 4;
-CollapsibleMenuSection.marginsNum = 2;
-__decorate([], CollapsibleMenuSection.prototype, "popupBuilder", null);
-class TabContentItem extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.item = void 0;
- this.index = void 0;
- this.maxIndex = void 0;
- this.onCustomClick = void 0;
- this.__currentIndex = new SynchedPropertySimpleOneWayPU(t.currentIndex, this, "currentIndex");
- this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus");
- this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover");
- this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.index && (this.index = e.index);
- void 0 !== e.maxIndex && (this.maxIndex = e.maxIndex);
- void 0 !== e.onCustomClick && (this.onCustomClick = e.onCustomClick);
- void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus);
- void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover);
- void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick)
- }
- updateStateVars(e) {
- this.__currentIndex.reset(e.currentIndex)
- }
- purgeVariableDependenciesOnElmtId(e) {
- this.__currentIndex.purgeDependencyOnElmtId(e);
- this.__isOnFocus.purgeDependencyOnElmtId(e);
- this.__isOnHover.purgeDependencyOnElmtId(e);
- this.__isOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__currentIndex.aboutToBeDeleted();
- this.__isOnFocus.aboutToBeDeleted();
- this.__isOnHover.aboutToBeDeleted();
- this.__isOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get currentIndex() {
- return this.__currentIndex.get()
- }
- set currentIndex(e) {
- this.__currentIndex.set(e)
- }
- get isOnFocus() {
- return this.__isOnFocus.get()
- }
- set isOnFocus(e) {
- this.__isOnFocus.set(e)
- }
- get isOnHover() {
- return this.__isOnHover.get()
- }
- set isOnHover(e) {
- this.__isOnHover.set(e)
- }
- get isOnClick() {
- return this.__isOnClick.get()
- }
- set isOnClick(e) {
- this.__isOnClick.set(e)
- }
- getBgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.height(TabTitleBar.totalHeight);
- Row.alignItems(VerticalAlign.Center);
- Row.justifyContent(FlexAlign.Center);
- Row.margin({
- left: 0 === this.index ? 16 : 0,
- right: this.index === this.maxIndex ? 12 : 0
- });
- Row.borderRadius(TabContentItem.buttonBorderRadius);
- Row.backgroundColor(this.getBgColor());
- Row.border(this.isOnFocus ? {
- width: TabContentItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.justifyContent(FlexAlign.Center);
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- void 0 === this.item.icon ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.item.title);
- Text.fontSize(this.index === this.currentIndex ? {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline7"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_headline9"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontColor(this.index === this.currentIndex ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_text_off"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontWeight(FontWeight.Medium);
- Text.focusable(!0);
- Text.padding({
- top: this.index === this.currentIndex ? 6 : 10,
- left: 8,
- bottom: 2,
- right: 8
- });
- Text.onFocus((() => this.isOnFocus = !0));
- Text.onBlur((() => this.isOnFocus = !1));
- Text.onHover((e => this.isOnHover = e));
- Text.onKeyEvent((e => {
- if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Text.onTouch((e => {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }));
- Text.onClick((() => this.onCustomClick && this.onCustomClick()));
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(TabContentItem.imageHotZoneWidth);
- Row.height(TabContentItem.imageHotZoneWidth);
- Row.justifyContent(FlexAlign.Center);
- Row.onFocus((() => this.isOnFocus = !0));
- Row.onBlur((() => this.isOnFocus = !1));
- Row.onHover((e => this.isOnHover = e));
- Row.onKeyEvent((e => {
- if (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }));
- Row.onClick((() => this.onCustomClick && this.onCustomClick()));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.icon);
- Image.alt(this.item.title);
- Image.height(TabContentItem.imageSize);
- Image.focusable(!0);
- Image.scale({
- x: this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1,
- y: this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1
- });
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop();
- Row.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-TabContentItem.imageSize = 24;
-TabContentItem.imageHotZoneWidth = 48;
-TabContentItem.imageMagnificationFactor = 1.4;
-TabContentItem.buttonBorderRadius = 8;
-TabContentItem.focusBorderWidth = 2;
-class ImageMenuItem extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.item = void 0;
- this.__isOnFocus = new ObservedPropertySimplePU(!1, this, "isOnFocus");
- this.__isOnHover = new ObservedPropertySimplePU(!1, this, "isOnHover");
- this.__isOnClick = new ObservedPropertySimplePU(!1, this, "isOnClick");
- this.setInitiallyProvidedValue(t)
- }
- setInitiallyProvidedValue(e) {
- void 0 !== e.item && (this.item = e.item);
- void 0 !== e.isOnFocus && (this.isOnFocus = e.isOnFocus);
- void 0 !== e.isOnHover && (this.isOnHover = e.isOnHover);
- void 0 !== e.isOnClick && (this.isOnClick = e.isOnClick)
- }
- updateStateVars(e) {}
- purgeVariableDependenciesOnElmtId(e) {
- this.__isOnFocus.purgeDependencyOnElmtId(e);
- this.__isOnHover.purgeDependencyOnElmtId(e);
- this.__isOnClick.purgeDependencyOnElmtId(e)
- }
- aboutToBeDeleted() {
- this.__isOnFocus.aboutToBeDeleted();
- this.__isOnHover.aboutToBeDeleted();
- this.__isOnClick.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
- get isOnFocus() {
- return this.__isOnFocus.get()
- }
- set isOnFocus(e) {
- this.__isOnFocus.set(e)
- }
- get isOnHover() {
- return this.__isOnHover.get()
- }
- set isOnHover(e) {
- this.__isOnHover.set(e)
- }
- get isOnClick() {
- return this.__isOnClick.get()
- }
- set isOnClick(e) {
- this.__isOnClick.set(e)
- }
- getFgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon_pressed"],
- bundleName: "",
- moduleName: ""
- } : {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_titlebar_icon"],
- bundleName: "",
- moduleName: ""
- }
- }
- getBgColor() {
- return this.isOnClick ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- } : this.isOnHover ? {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- } : Color.Transparent
- }
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.width(ImageMenuItem.imageHotZoneWidth);
- Row.height(ImageMenuItem.imageHotZoneWidth);
- Row.borderRadius(ImageMenuItem.buttonBorderRadius);
- Row.foregroundColor(this.getFgColor());
- Row.backgroundColor(this.getBgColor());
- Row.justifyContent(FlexAlign.Center);
- Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
- Row.border(this.isOnFocus ? {
- width: ImageMenuItem.focusBorderWidth,
- color: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- },
- style: BorderStyle.Solid
- } : {
- width: 0
- });
- Row.onFocus((() => {
- this.item.isEnabled && (this.isOnFocus = !0)
- }));
- Row.onBlur((() => this.isOnFocus = !1));
- Row.onHover((e => {
- this.item.isEnabled && (this.isOnHover = e)
- }));
- Row.onKeyEvent((e => {
- if (this.item.isEnabled && (e.keyCode === KeyCode.KEYCODE_ENTER || e.keyCode === KeyCode.KEYCODE_SPACE)) {
- e.type === KeyType.Down && (this.isOnClick = !0);
- e.type === KeyType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onTouch((e => {
- if (this.item.isEnabled) {
- e.type === TouchType.Down && (this.isOnClick = !0);
- e.type === TouchType.Up && (this.isOnClick = !1)
- }
- }));
- Row.onClick((() => this.item.isEnabled && this.item.action && this.item.action()));
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(this.item.value);
- Image.width(ImageMenuItem.imageSize);
- Image.height(ImageMenuItem.imageSize);
- Image.focusable(this.item.isEnabled);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- }
- rerender() {
- this.updateDirtyElements()
- }
-}
-ImageMenuItem.imageSize = 24;
-ImageMenuItem.imageHotZoneWidth = 48;
-ImageMenuItem.buttonBorderRadius = 8;
-ImageMenuItem.focusBorderWidth = 2;
-ImageMenuItem.disabledImageOpacity = .4;
-export default {
- TabTitleBar: TabTitleBar
-};
\ No newline at end of file
diff --git a/interface/toolbar/BUILD.gn b/interface/toolbar/BUILD.gn
deleted file mode 100644
index 956cede..0000000
--- a/interface/toolbar/BUILD.gn
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_toolbar_abc") {
- src_js = rebase_path("toolbar.js")
- dst_file = rebase_path(target_out_dir + "/toolbar.abc")
- in_puts = [ "toolbar.js" ]
- out_puts = [ target_out_dir + "/toolbar.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("toolbar_abc") {
- input = get_label_info(":gen_toolbar_abc", "target_out_dir") + "/toolbar.abc"
- output = target_out_dir + "/toolbar_abc.o"
- dep = ":gen_toolbar_abc"
-}
-
-ohos_shared_library("toolbar") {
- sources = [ "toolbar.cpp" ]
-
- deps = [ ":toolbar_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
\ No newline at end of file
diff --git a/interface/toolbar/toolbar.cpp b/interface/toolbar/toolbar.cpp
deleted file mode 100644
index db4ee6e..0000000
--- a/interface/toolbar/toolbar.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
-{
- if (buf != nullptr) {
- *buf = _binary_toolbar_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_toolbar_abc_end - _binary_toolbar_abc_start;
- }
-}
-
-/*
- * Module define
- */
-static napi_module toolbarModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.ToolBar",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-/*
- * Module register function
- */
-extern "C" __attribute__((constructor)) void toolbarRegisterModule(void)
-{
- napi_module_register(&toolbarModule);
-}
diff --git a/interface/toolbar/toolbar.js b/interface/toolbar/toolbar.js
deleted file mode 100644
index 5c34c87..0000000
--- a/interface/toolbar/toolbar.js
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const REFLECT_MAX_COUNT = 3;
-const IMAGE_SIZE_WIDTH_HEIGHT = 24;
-const TEXT_MIN_SIZE = 9;
-const DISABLE_OPACITY = 0.4;
-const TEXT_MAX_LINES = 2;
-const TOOLBAR_LIST_LENGTH = 5;
-const TOOLBAR_LIST_NORMORL = 4;
-const ITEM_DISABLE_STATE = 2;
-const ITEM_DISABLE_ACTIVATE = 3;
-
-let __decorate = this && this.__decorate || function (e, t, o, r) {
- let s;
- let i = arguments.length;
- let a = i < REFLECT_MAX_COUNT ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, o) : r;
- if ('object' === typeof Reflect && 'function' === typeof Reflect.decorate) {
- a = Reflect.decorate(e, t, o, r);
- } else {
- for (let n = e.length - 1; n >= 0; n--) {
- (s = e[n]) && (a = (i < REFLECT_MAX_COUNT ? s(a) : i > REFLECT_MAX_COUNT ? s(t, o, a) : s(t, o)) || a);
- }
- }
- return i > REFLECT_MAX_COUNT && a && Object.defineProperty(t, o, a), a;
-};
-export let ItemState;
-!function(e) {
- e[e.ENABLE = 1] = 'ENABLE';
- e[e.DISABLE = 2] = 'DISABLE';
- e[e.ACTIVATE = 3] = 'ACTIVATE';
-}(ItemState || (ItemState = {}));
-const PUBLIC_MORE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAA' +
- 'IGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IAr' +
- 's4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAYFJREFUeNrt3CFLQ1EUB/CpCwYRo8' +
- 'G4j2IwCNrUYjH4AfwcfgBBwWZRMNgtFqPdILJgEhGDweAZvDjmJnfv3I3fD/5l3DfOfWdv23vhdDoAAAAAAAAwzxa' +
- 'm9L5rkePIdmSjee05chu5iHxXej5ar3saDdiJXDabGaYfOYg8VHbyU+peKryJvch1ZHnEmtXIYeQ+8lrJyU+re7Hg' +
- 'JtYj52Ou7Uau/thwW1LrLtmAk8jKBOsH37FHFTQgte6SDdht6ZjSUusu2YBeS8eUllr3YvLmuzP6971bYwP6/zjmpY' +
- 'KTmVp3yQbctXRMaal1l2zAaeRngvUfkbMKGpBad8kbsffIZ2RrzPX7kacKGpBad+k74cfmE7I54ur6au4obyr6UU2r' +
- 'e1oP43rNDc6wh1qDS/6t0n83s1o3AAAAAAAAAAAAAEAysyKS6zYrIrlusyKS6zYrwqyIdGZFJDMrIplZETPIrIh5qdu' +
- 'sCLMi0pkVkcysiAqYFVEJsyIAAAAAAAAAKOYXUlF8EUcdfbsAAAAASUVORK5CYII=';
-let ToolBarOption = class {
- constructor() {
- this.state = 1;
- }
-};
-ToolBarOption = __decorate([Observed], ToolBarOption);
-
-export { ToolBarOption };
-let ToolBarOptions = class extends Array {
-};
-ToolBarOptions = __decorate([Observed], ToolBarOptions);
-
-export { ToolBarOptions };
-
-export class ToolBar extends ViewPU {
- constructor(e, t, o, r = -1) {
- super(e, o, r);
- this.__toolBarList = new SynchedPropertyNesedObjectPU(t.toolBarList, this, 'toolBarList');
- this.controller = void 0;
- this.__activateIndex = new SynchedPropertySimpleOneWayPU(t.activateIndex, this, 'activateIndex');
- this.__menuContent = new ObservedPropertyObjectPU([], this, 'menuContent');
- this.toolBarItemBackground = [];
- this.__itemBackground = new ObservedPropertyObjectPU({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_bg'],
- bundleName: '',
- moduleName: ''
- }, this, 'itemBackground');
- this.setInitiallyProvidedValue(t);
- }
-
- setInitiallyProvidedValue(e) {
- this.__toolBarList.set(e.toolBarList);
- void 0 !== e.controller && (this.controller = e.controller);
- void 0 !== e.activateIndex ? this.__activateIndex.set(e.activateIndex) : this.__activateIndex.set(-1);
- void 0 !== e.menuContent && (this.menuContent = e.menuContent);
- void 0 !== e.toolBarItemBackground && (this.toolBarItemBackground = e.toolBarItemBackground);
- void 0 !== e.itemBackground && (this.itemBackground = e.itemBackground);
- }
-
- updateStateVars(e) {
- this.__toolBarList.set(e.toolBarList);
- this.__activateIndex.reset(e.activateIndex);
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__toolBarList.purgeDependencyOnElmtId(e);
- this.__activateIndex.purgeDependencyOnElmtId(e);
- this.__menuContent.purgeDependencyOnElmtId(e);
- this.__itemBackground.purgeDependencyOnElmtId(e);
- }
-
- aboutToBeDeleted() {
- this.__toolBarList.aboutToBeDeleted();
- this.__activateIndex.aboutToBeDeleted();
- this.__menuContent.aboutToBeDeleted();
- this.__itemBackground.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal();
- }
-
- get toolBarList() {
- return this.__toolBarList.get();
- }
-
- get activateIndex() {
- return this.__activateIndex.get();
- }
-
- set activateIndex(e) {
- this.__activateIndex.set(e);
- }
-
- get menuContent() {
- return this.__menuContent.get();
- }
-
- set menuContent(e) {
- this.__menuContent.set(e);
- }
-
- get itemBackground() {
- return this.__itemBackground.get();
- }
-
- set itemBackground(e) {
- this.__itemBackground.set(e);
- }
-
- MoreTabBuilder(e, t = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width('100%');
- Column.height('100%');
- Column.bindMenu(ObservedObject.GetRawObject(this.menuContent), { offset: { x: 5, y: -10 } });
- Column.padding({ left: 4, right: 4 });
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_clicked'],
- bundleName: '',
- moduleName: ''
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(PUBLIC_MORE);
- Image.width(IMAGE_SIZE_WIDTH_HEIGHT);
- Image.height(IMAGE_SIZE_WIDTH_HEIGHT);
- Image.fillColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_icon'],
- bundleName: '',
- moduleName: ''
- });
- Image.margin({ top: 8, bottom: 2 });
- Image.objectFit(ImageFit.Contain);
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create({
- id: -1,
- type: 10003,
- params: ['app.string.id_string_more'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_text'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_caption'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontWeight(FontWeight.Medium);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Column.pop();
- }
-
- TabBuilder(e, t = null) {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Column.create();
- Column.width('100%');
- Column.height('100%');
- Column.focusable(!(ITEM_DISABLE_STATE === this.toolBarList[e].state));
- Column.focusOnTouch(!(ITEM_DISABLE_STATE === this.toolBarList[e].state));
- Column.padding({ left: 4, right: 4 });
- Column.borderRadius({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_corner_radius_clicked'],
- bundleName: '',
- moduleName: ''
- });
- Column.backgroundColor(ObservedObject.GetRawObject(this.itemBackground));
- Column.onClick((() => {
- ITEM_DISABLE_ACTIVATE === this.toolBarList[e].state && (this.activateIndex === e ? this.activateIndex = -1 : this.activateIndex = e);
- ITEM_DISABLE_STATE !== this.toolBarList[e].state && this.toolBarList[e].action && this.toolBarList[e].action();
- }));
- Column.onHover((t => {
- this.toolBarItemBackground[e] = t ? ITEM_DISABLE_STATE === this.toolBarList[e].state ? {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_bg'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_hover'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_bg'],
- bundleName: '',
- moduleName: ''
- };
- this.itemBackground = this.toolBarItemBackground[e];
- }));
- ViewStackProcessor.visualState('pressed');
- Column.backgroundColor(ITEM_DISABLE_STATE === this.toolBarList[e].state ? this.toolBarItemBackground[e] : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_click_effect'],
- bundleName: '',
- moduleName: ''
- });
- ViewStackProcessor.visualState('normal');
- Column.backgroundColor(this.toolBarItemBackground[e]);
- ViewStackProcessor.visualState();
- o || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Image.create(this.toolBarList[e].icon);
- Image.width(IMAGE_SIZE_WIDTH_HEIGHT);
- Image.height(IMAGE_SIZE_WIDTH_HEIGHT);
- Image.fillColor(this.activateIndex === e && ITEM_DISABLE_STATE !== this.toolBarList[e].state ? {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_text_primary_activated'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_primary'],
- bundleName: '',
- moduleName: ''
- });
- Image.opacity(ITEM_DISABLE_STATE === this.toolBarList[e].state ? DISABLE_OPACITY : 1);
- Image.margin({ top: 8, bottom: 2 });
- Image.objectFit(ImageFit.Contain);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Text.create(this.toolBarList[e].content);
- Text.fontColor(this.activateIndex === e && ITEM_DISABLE_STATE !== this.toolBarList[e].state ? {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_text_actived'],
- bundleName: '',
- moduleName: ''
- } : {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_text'],
- bundleName: '',
- moduleName: ''
- });
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_caption'],
- bundleName: '',
- moduleName: ''
- });
- Text.maxFontSize({
- id: -1,
- type: 10002,
- params: ['sys.float.ohos_id_text_size_caption'],
- bundleName: '',
- moduleName: ''
- });
- Text.minFontSize(TEXT_MIN_SIZE);
- Text.fontWeight(FontWeight.Medium);
- Text.maxLines(TEXT_MAX_LINES);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.opacity(ITEM_DISABLE_STATE === this.toolBarList[e].state ? DISABLE_OPACITY : 1);
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- Text.pop();
- Column.pop();
- }
-
- refreshData() {
- this.menuContent = [];
- for (let e = 0; e < this.toolBarList.length; e++) {
- if (e >= TOOLBAR_LIST_NORMORL && this.toolBarList.length > TOOLBAR_LIST_LENGTH) {
- this.menuContent[e - TOOLBAR_LIST_NORMORL] = {
- value: this.toolBarList[e].content,
- action: this.toolBarList[e].action
- };
- } else {
- this.toolBarItemBackground[e] = {
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_bg'],
- bundleName: '',
- moduleName: ''
- };
- this.menuContent = [];
- }
- }
- return !0;
- }
-
- aboutToAppear() {
- this.refreshData();
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.width('100%');
- Divider.height(1);
- t || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.width('100%');
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Tabs.create({ barPosition: BarPosition.End, controller: this.controller });
- Tabs.vertical(!1);
- Tabs.constraintSize({ minHeight: 56, maxHeight: 56 });
- Tabs.barMode(BarMode.Fixed);
- Tabs.onChange((e => {
- }));
- Tabs.width('100%');
- Tabs.backgroundColor({
- id: -1,
- type: 10001,
- params: ['sys.color.ohos_id_color_toolbar_bg'],
- bundleName: '',
- moduleName: ''
- });
- t || Tabs.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- ForEach.create();
- this.forEachUpdateFunction(e, this.toolBarList, ((e, t) => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.toolBarList.length <= TOOLBAR_LIST_LENGTH ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- TabContent.create();
- TabContent.tabBar({
- builder: () => {
- this.TabBuilder.call(this, t);
- }
- });
- TabContent.enabled(!(ITEM_DISABLE_STATE === this.toolBarList[t].state));
- TabContent.focusOnTouch(!(ITEM_DISABLE_STATE === this.toolBarList[t].state));
- r || TabContent.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- TabContent.pop();
- })) : t < TOOLBAR_LIST_NORMORL && this.ifElseBranchUpdateFunction(1, (() => {
- this.observeComponentCreation(((e, r) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- TabContent.create();
- TabContent.tabBar({
- builder: () => {
- this.TabBuilder.call(this, t);
- }
- });
- TabContent.enabled(!(ITEM_DISABLE_STATE === this.toolBarList[t].state));
- TabContent.focusOnTouch(!(ITEM_DISABLE_STATE === this.toolBarList[t].state));
- r || TabContent.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- TabContent.pop();
- }));
- r || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- }), void 0, !0, !1);
- t || ForEach.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- ForEach.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.refreshData() && this.toolBarList.length > TOOLBAR_LIST_LENGTH ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- TabContent.create();
- TabContent.tabBar({
- builder: () => {
- this.MoreTabBuilder.call(this, TOOLBAR_LIST_NORMORL);
- }
- });
- t || TabContent.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- TabContent.pop();
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording();
- }));
- If.pop();
- Tabs.pop();
- Column.pop();
- Column.pop();
- }
-
- rerender() {
- this.updateDirtyElements();
- }
-}
-export default { ToolBarOptions, ToolBar };
\ No newline at end of file
diff --git a/interface/treeview/BUILD.gn b/interface/treeview/BUILD.gn
deleted file mode 100644
index d8bdb0c..0000000
--- a/interface/treeview/BUILD.gn
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (c) 2023-2023 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.
-
-import("//build/ohos.gni")
-import("//foundation/arkui/ace_engine/ace_config.gni")
-import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
-
-es2abc_gen_abc("gen_treeview_abc") {
- src_js = rebase_path("treeview.js")
- dst_file = rebase_path(target_out_dir + "/treeview.abc")
- in_puts = [ "treeview.js" ]
- out_puts = [ target_out_dir + "/treeview.abc" ]
- extra_args = [ "--module" ]
-}
-
-gen_js_obj("treeview_abc") {
- input = get_label_info(":gen_treeview_abc", "target_out_dir") + "/treeview.abc"
- output = target_out_dir + "/treeview_abc.o"
- dep = ":gen_treeview_abc"
-}
-
-ohos_shared_library("treeview") {
- sources = [ "treeview.cpp" ]
-
- deps = [ ":treeview_abc" ]
-
- external_deps = [
- "hilog:libhilog",
- "napi:ace_napi",
- ]
-
- subsystem_name = "arkui"
- part_name = "advanced_ui_component"
-
- relative_install_dir = "module/arkui/advanced"
-}
-
-
diff --git a/interface/treeview/treeview.cpp b/interface/treeview/treeview.cpp
deleted file mode 100644
index 1c51ddb..0000000
--- a/interface/treeview/treeview.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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 "native_engine/native_engine.h"
-
-#include "napi/native_api.h"
-#include "napi/native_node_api.h"
-
-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)
-{
-
- if (buf != nullptr) {
- *buf = _binary_treeview_abc_start;
- }
- if (buflen != nullptr) {
- *buflen = _binary_treeview_abc_end - _binary_treeview_abc_start;
- }
-}
-
-/*
- * Module define
- */
-static napi_module treeviewModule = {
- .nm_version = 1,
- .nm_flags = 0,
- .nm_filename = nullptr,
- .nm_modname = "arkui.advanced.TreeView",
- .nm_priv = ((void*)0),
- .reserved = { 0 },
-};
-
-/*
- * Module register function
- */
-extern "C" __attribute__((constructor)) void treeviewRegisterModule(void)
-{
- napi_module_register(&treeviewModule);
-}
\ No newline at end of file
diff --git a/interface/treeview/treeview.js b/interface/treeview/treeview.js
deleted file mode 100644
index 25425d8..0000000
--- a/interface/treeview/treeview.js
+++ /dev/null
@@ -1,3666 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-var __decorate = this && this.__decorate || function (e, t, o, i) {
- var s, a = arguments.length, d = a < 3 ? t : null === i ? i = Object.getOwnPropertyDescriptor(t, o) : i;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) d = Reflect.decorate(e, t, o, i); else for (var r = e.length - 1;r >= 0; r--) (s = e[r]) && (d = (a < 3 ? s(d) : a > 3 ? s(t, o, d) : s(t, o)) || d);
- return a > 3 && d && Object.defineProperty(t, o, d), d
-};
-
-export var TreeView;
-!function(e){
- const t = "#00000000";
- const o = "#FFFFFF";
-
- class i {
- constructor() {
- this._events = []
- }
-
- on(e, t) {
- if (Array.isArray(e)) for (let o = 0,
- i = e.length;o < i; o++) this.on(e[o], t); else (this._events[e] || (this._events[e] = [])).push(t)
- }
-
- once(e, t) {
- let o = this;
-
- function i() {
- o.off(e, i);
- t.apply(null, [e, t])
- }
-
- i.callback = t;
- this.on(e, i)
- }
-
- off(e, t) {
- null == e && (this._events = []);
- if (Array.isArray(e)) for (let o = 0, i = e.length;o < i; o++) this.off(e[o], t);
- const o = this._events[e];
- if (!o) return;
- null == t && (this._events[e] = null);
- let i, s = o.length;
- for (; s--; ) {
- i = o[s];
- if (i === t || i.callback === t) {
- o.splice(s, 1);
- break
- }
- }
- }
-
- emit(e, t) {
- let o = this;
- if (!this._events[e]) return;
- let i = [...this._events[e]];
- if (i) for (let e = 0, s = i.length;e < s; e++) try {
- i[e].apply(o, t)
- } catch (e) {
- new Error(e)
- }
- }
- }
-
- e.TreeListener = i;
- let s;
- !function(e){
- e.NODE_ADD = "NodeAdd";
- e.NODE_DELETE = "NodeDelete";
- e.NODE_MODIFY = "NodeModify";
- e.NODE_MOVE = "NodeMove";
- e.NODE_CLICK = "NodeClick"
- }(s = e.TreeListenType || (e.TreeListenType = {}));
-
- class a {
- constructor() {
- this.appEventBus = new i
- }
-
- static getInstance() {
- null == AppStorage.Get(this.APP_KEY_EVENT_BUS) && AppStorage.SetOrCreate(this.APP_KEY_EVENT_BUS, new a);
- return AppStorage.Get(this.APP_KEY_EVENT_BUS)
- }
-
- getTreeListener() {
- return this.appEventBus
- }
- }
-
- a.APP_KEY_EVENT_BUS = "app_key_event_bus";
- e.TreeListenerManager = a;
-
- class d {
- constructor() {
- this.listeners = []
- }
-
- totalCount() {
- return 0
- }
-
- getData(e) {
- }
-
- registerDataChangeListener(e) {
- this.listeners.indexOf(e) < 0 && this.listeners.push(e)
- }
-
- unregisterDataChangeListener(e) {
- const t = this.listeners.indexOf(e);
- t >= 0 && this.listeners.splice(t, 1)
- }
-
- notifyDataReload() {
- this.listeners.forEach((e => {
- e.onDataReloaded()
- }))
- }
-
- notifyDataAdd(e) {
- this.listeners.forEach((t => {
- t.onDataAdd(e)
- }))
- }
-
- notifyDataChange(e) {
- this.listeners.forEach((t => {
- t.onDataChange(e)
- }))
- }
-
- notifyDataDelete(e) {
- this.listeners.forEach((t => {
- t.onDataDelete(e)
- }))
- }
-
- notifyDataMove(e, t) {
- this.listeners.forEach((o => {
- o.onDataMove(e, t)
- }))
- }
- }
-
- let r;
- !function(e){
- e[e.TOUCH_DOWN=0] = "TOUCH_DOWN";
- e[e.TOUCH_UP=1] = "TOUCH_UP";
- e[e.HOVER=3] = "HOVER";
- e[e.HOVER_OVER=4] = "HOVER_OVER";
- e[e.FOCUS=5] = "FOCUS";
- e[e.BLUR=6] = "BLUR";
- e[e.MOUSE_BUTTON_RIGHT=7] = "MOUSE_BUTTON_RIGHT";
- e[e.DRAG=8] = "DRAG"
- }(r = e.Event || (e.Event = {}));
- let n;
- !function(e){
- e[e.ADD_NODE=0] = "ADD_NODE";
- e[e.REMOVE_NODE=1] = "REMOVE_NODE";
- e[e.MODIFY_NODE=2] = "MODIFY_NODE";
- e[e.COMMIT_NODE=3] = "COMMIT_NODE"
- }(n = e.MenuOperation || (e.MenuOperation = {}));
- let l;
- !function(e){
- e[e.HINTS=0] = "HINTS";
- e[e.WARNINGS=1] = "WARNINGS"
- }(l = e.PopUpType || (e.PopUpType = {}));
- let h;
- !function(e){
- e[e.INVALID_ERROR=0] = "INVALID_ERROR";
- e[e.LENGTH_ERROR=1] = "LENGTH_ERROR";
- e[e.NONE=2] = "NONE"
- }(h = e.InputError || (e.InputError = {}));
- let g;
- !function(e){
- e[e.DOWN_FLAG=0] = "DOWN_FLAG";
- e[e.UP_FLAG=1] = "UP_FLAG";
- e[e.NONE=2] = "NONE"
- }(g = e.Flag || (e.Flag = {}));
-
- class c {
- constructor(e) {
- this.data = e;
- this.nodeLevel = -1;
- this.parentNodeId = -1;
- this.nodeItem = { imageNode: null, mainTitleNode: null, imageCollapse: null };
- this.childNodeInfo = { isHasChildNode: !1, childNum: 0, allChildNum: 0 };
- this.menu = e.menu;
- e.icon && (this.nodeItem.imageNode = new p(e.icon, e.selectedIcon, e.editIcon, {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_alpha_content_fourth"],
- bundleName: "",
- moduleName: ""
- }, 24, 24));
- e.primaryTitle && (this.nodeItem.mainTitleNode = new m(e.primaryTitle));
- this.children = []
- }
-
- addImageCollapse(e) {
- if (e) {
- this.nodeItem.imageCollapse = new p({
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_right"],
- bundleName: "",
- moduleName: ""
- }, null, null, {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_alpha_content_tertiary"],
- bundleName: "",
- moduleName: ""
- }, 24, 24);
- this.nodeItem.imageCollapse.itemRightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- }
- } else this.nodeItem.imageCollapse = null
- }
-
- getNodeItem() {
- return this.nodeItem
- }
-
- getChildNodeInfo() {
- return this.childNodeInfo
- }
-
- getMenu() {
- return this.menu
- }
-
- getCurrentNodeId() {
- return this.currentNodeId
- }
-
- getIsFolder() {
- return this.data.isFolder
- }
- }
-
- e.NodeItem = c;
-
- class N {
- constructor() {
- }
-
- set itemWidth(e) {
- this.width = e
- }
-
- get itemWidth() {
- return this.width
- }
-
- set itemHeight(e) {
- this.height = e
- }
-
- get itemHeight() {
- return this.height
- }
-
- set itemRightMargin(e) {
- this.rightMargin = e
- }
-
- get itemRightMargin() {
- return this.rightMargin
- }
- }
-
- let I;
- !function(e){
- e[e.Expand=0] = "Expand";
- e[e.Collapse=1] = "Collapse"
- }(I = e.NodeStatus || (e.NodeStatus = {}));
- let u;
- !function(e){
- e[e.Normal=0] = "Normal";
- e[e.Selected=1] = "Selected";
- e[e.Edit=2] = "Edit";
- e[e.FinishEdit=3] = "FinishEdit";
- e[e.DragInsert=4] = "DragInsert";
- e[e.FinishDragInsert=5] = "FinishDragInsert"
- }(u = e.InteractionStatus || (e.InteractionStatus = {}));
-
- class p extends N {
- constructor(e, t, o, i, s, a) {
- super();
- this.rightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_m"],
- bundleName: "",
- moduleName: ""
- };
- this.imageSource = e;
- this.imageNormalSource = e;
- this.imageSelectedSource = null != t ? t : this.imageNormalSource;
- this.imageEditSource = null != o ? o : this.imageNormalSource;
- this.imageOpacity = i;
- this.itemWidth = s;
- this.itemHeight = a;
- this.imageCollapseSource = e;
- this.imageCollapseDownSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- };
- this.imageCollapseRightSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_right"],
- bundleName: "",
- moduleName: ""
- };
- this.isImageCollapse = !0
- }
-
- get source() {
- return this.imageSource
- }
-
- get normalSource() {
- return this.imageNormalSource
- }
-
- get selectedSource() {
- return this.imageSelectedSource
- }
-
- get editSource() {
- return this.imageEditSource
- }
-
- get opacity() {
- return this.imageOpacity
- }
-
- get noOpacity() {
- return 1
- }
-
- get collapseSource() {
- return this.imageCollapseSource
- }
-
- get isCollapse() {
- return this.isImageCollapse
- }
-
- changeImageCollapseSource(e) {
- e == I.Expand ? this.imageCollapseSource = this.imageCollapseDownSource : e == I.Collapse && (this.imageCollapseSource = this.imageCollapseRightSource)
- }
-
- setImageCollapseSource(e, t) {
- if (e === u.Edit || e === u.DragInsert) {
- this.imageCollapseDownSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- };
- this.imageCollapseRightSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_right"],
- bundleName: "",
- moduleName: ""
- };
- this.isImageCollapse = !1
- } else if (e === u.FinishEdit || e === u.FinishDragInsert) {
- this.imageCollapseDownSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- };
- this.imageCollapseRightSource = {
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_right"],
- bundleName: "",
- moduleName: ""
- };
- this.isImageCollapse = !0
- }
- this.imageCollapseSource = t == I.Collapse ? this.imageCollapseRightSource : this.imageCollapseDownSource
- }
-
- setImageSource(e) {
- switch (e) {
- case u.Normal:
- this.imageSource = this.imageNormalSource;
- this.currentInteractionStatus = e;
- break;
- case u.Selected:
- if (this.currentInteractionStatus !== u.Edit) {
- this.imageSource = this.imageSelectedSource;
- this.currentInteractionStatus = e
- }
- break;
- case u.Edit:
- this.imageSource = this.imageEditSource;
- this.currentInteractionStatus = e;
- break;
- case u.FinishEdit:
- this.imageSource = this.imageSelectedSource;
- this.currentInteractionStatus = e;
- break;
- case u.DragInsert:
- this.imageSource = this.imageEditSource;
- this.currentInteractionStatus = e;
- break;
- case u.FinishDragInsert:
- this.imageSource = this.imageNormalSource;
- this.currentInteractionStatus = e
- }
- }
- }
-
- e.ImageNode = p;
-
- class m extends N {
- constructor(e) {
- super();
- this.mainTitleName = e;
- this.itemWidth = 0;
- this.itemHeight = 44;
- this.rightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- };
- this.mainTitleSetting = {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Normal
- };
- this.showPopUpTimeout = 0
- }
-
- setMainTitleSelected(e) {
- this.mainTitleSetting = e ? {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary_activated"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Regular
- } : {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Normal
- }
- }
-
- set title(e) {
- this.mainTitleName = e
- }
-
- get title() {
- return this.mainTitleName
- }
-
- set popUpTimeout(e) {
- this.showPopUpTimeout = e
- }
-
- get popUpTimeout() {
- return this.showPopUpTimeout
- }
-
- get color() {
- return this.mainTitleSetting.fontColor
- }
-
- get size() {
- return this.mainTitleSetting.fontSize
- }
-
- get weight() {
- return this.mainTitleSetting.fontWeight
- }
-
- setMainTitleHighLight(e) {
- this.mainTitleSetting = e ? {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary_contrary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Regular
- } : {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Normal
- }
- }
- }
-
- e.MainTitleNode = m;
-
- class f extends N {
- constructor() {
- super();
- this.statusColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- };
- this.editItemColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_emphasize"],
- bundleName: "",
- moduleName: ""
- };
- this.radius = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_default_xs"],
- bundleName: "",
- moduleName: ""
- };
- this.itemWidth = 0;
- this.itemHeight = 32;
- this.rightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- };
- this.inputTextSetting = {
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_primary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Normal
- }
- }
-
- get color() {
- return this.inputTextSetting.fontColor
- }
-
- get size() {
- return this.inputTextSetting.fontSize
- }
-
- get weight() {
- return this.inputTextSetting.fontWeight
- }
-
- get borderRadius() {
- return this.radius
- }
-
- get backgroundColor() {
- return this.statusColor
- }
-
- get editColor() {
- return this.editItemColor
- }
-
- get textInputStatusColor() {
- return this.status
- }
- }
-
- e.InputText = f;
-
- class S {
- constructor(e) {
- this.borderWidth = { has: 2, none: 0 };
- this.canShowFlagLine = !1;
- this.isOverBorder = !1;
- this.canShowBottomFlagLine = !1;
- this.isHighLight = !1;
- this.isModify = !1;
- this.childNodeInfo = e.getChildNodeInfo();
- this.nodeItem = { imageNode: null, inputText: null, mainTitleNode: null, imageCollapse: null };
- this.popUpInfo = {
- popUpIsShow: !1,
- popUpEnableArrow: !1,
- popUpColor: null,
- popUpText: "",
- popUpTextColor: null
- };
- this.nodeItem.imageNode = e.getNodeItem().imageNode;
- this.nodeItem.inputText = new f;
- this.nodeItem.mainTitleNode = e.getNodeItem().mainTitleNode;
- this.nodeItem.imageCollapse = e.getNodeItem().imageCollapse;
- this.menu = e.menu;
- this.parentNodeId = e.parentNodeId;
- this.currentNodeId = e.currentNodeId;
- this.nodeHeight = 44;
- this.nodeLevel = e.nodeLevel;
- this.nodeLeftPadding = 12 * e.nodeLevel + 8;
- this.nodeColor = {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- };
- this.nodeIsShow = !(this.nodeLevel > 0);
- this.listItemHeight = this.nodeLevel > 0 ? 0 : 48;
- this.isShowTitle = !0;
- this.isShowInputText = !1;
- this.isSelected = !1;
- this.status = {
- normal: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background_transparent"],
- bundleName: "",
- moduleName: ""
- },
- hover: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_hover"],
- bundleName: "",
- moduleName: ""
- },
- press: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_click_effect"],
- bundleName: "",
- moduleName: ""
- },
- selected: "#1A0A59F7",
- highLight: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_activated"],
- bundleName: "",
- moduleName: ""
- }
- };
- this.nodeBorder = {
- borderWidth: 0,
- borderColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_focused_outline"],
- bundleName: "",
- moduleName: ""
- },
- borderRadius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- }
- };
- this.flagLineLeftMargin = 12 * e.nodeLevel + 8;
- this.node = e;
- this.nodeParam = e.data
- }
-
- getPopUpInfo() {
- return this.popUpInfo
- }
-
- setPopUpIsShow(e) {
- this.popUpInfo.popUpIsShow = e
- }
-
- setPopUpEnableArrow(e) {
- this.popUpInfo.popUpEnableArrow = e
- }
-
- setPopUpColor(e) {
- this.popUpInfo.popUpColor = e
- }
-
- setPopUpText(e) {
- this.popUpInfo.popUpText = e
- }
-
- setPopUpTextColor(e) {
- this.popUpInfo.popUpTextColor = e
- }
-
- getIsShowTitle() {
- return this.isShowTitle
- }
-
- getIsShowInputText() {
- return this.isShowInputText
- }
-
- setTitleAndInputTextStatus(e) {
- if (e) {
- this.isShowTitle = !1;
- this.isShowInputText = !0
- } else {
- this.isShowTitle = !0;
- this.isShowInputText = !1
- }
- }
-
- handleImageCollapseAfterAddNode(e) {
- if (e) {
- this.nodeItem.imageCollapse = new p({
- id: -1,
- type: 2e4,
- params: ["sys.media.ohos_ic_public_arrow_down"],
- bundleName: "",
- moduleName: ""
- }, null, null, {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_alpha_content_tertiary"],
- bundleName: "",
- moduleName: ""
- }, 24, 24);
- this.nodeItem.imageCollapse.itemRightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- }
- } else this.nodeItem.imageCollapse = null
- }
-
- setNodeColor(e) {
- this.nodeColor = e
- }
-
- getNodeColor() {
- return this.nodeColor
- }
-
- setListItemHeight(e) {
- this.listItemHeight = e
- }
-
- getListItemHeight() {
- return this.listItemHeight
- }
-
- getNodeCurrentNodeId() {
- return this.currentNodeId
- }
-
- getNodeParentNodeId() {
- return this.parentNodeId
- }
-
- getNodeLeftPadding() {
- return this.nodeLeftPadding
- }
-
- getNodeHeight() {
- return this.nodeHeight
- }
-
- setNodeIsShow(e) {
- this.nodeIsShow = e
- }
-
- getNodeIsShow() {
- return this.nodeIsShow
- }
-
- getNodeItem() {
- return this.nodeItem
- }
-
- getNodeStatus() {
- return this.status
- }
-
- getNodeBorder() {
- return this.nodeBorder
- }
-
- setNodeBorder(e) {
- this.nodeBorder.borderWidth = e ? this.borderWidth.has : this.borderWidth.none
- }
-
- getChildNodeInfo() {
- return this.childNodeInfo
- }
-
- getCurrentNodeId() {
- return this.currentNodeId
- }
-
- getMenu() {
- return this.menu
- }
-
- setIsSelected(e) {
- this.isSelected = e
- }
-
- getIsSelected() {
- return this.isSelected
- }
-
- getNodeInfoData() {
- return this.nodeParam
- }
-
- getNodeInfoNode() {
- return this.node
- }
-
- getIsFolder() {
- return this.nodeParam.isFolder
- }
-
- setCanShowFlagLine(e) {
- this.canShowFlagLine = e
- }
-
- getCanShowFlagLine() {
- return this.canShowFlagLine
- }
-
- setFlagLineLeftMargin(e) {
- this.flagLineLeftMargin = 12 * e + 8
- }
-
- getFlagLineLeftMargin() {
- return this.flagLineLeftMargin
- }
-
- getNodeLevel() {
- return this.nodeLevel
- }
-
- setIsOverBorder(e) {
- this.isOverBorder = e
- }
-
- getIsOverBorder() {
- return this.isOverBorder
- }
-
- setCanShowBottomFlagLine(e) {
- this.canShowBottomFlagLine = e
- }
-
- getCanShowBottomFlagLine() {
- return this.canShowBottomFlagLine
- }
-
- setIsHighLight(e) {
- this.isHighLight = e
- }
-
- getIsHighLight() {
- return this.isHighLight
- }
-
- setIsModify(e) {
- this.isModify = e
- }
-
- getIsModify() {
- return this.isModify
- }
- }
-
- e.NodeInfo = S;
-
- class C {
- constructor() {
- this.MaxNodeLevel = 50;
- this.MAX_CN_LENGTH = 254;
- this.MAX_EN_LENGTH = 255;
- this.INITIAL_INVALID_VALUE = -1;
- this._root = new c({});
- this._root.nodeLevel = -1;
- this._root.parentNodeId = -1;
- this._root.currentNodeId = -1
- }
-
- getNewNodeId() {
- return this.addNewNodeId
- }
-
- traverseNodeDF(e, t = this._root) {
- let o = [], i = !1;
- o.unshift(t);
- let s = o.shift();
- for (;!i && s; ) {
- i = !0 === e(s);
- if (!i) {
- o.unshift(...s.children);
- s = o.shift()
- }
- }
- }
-
- traverseNodeBF(e) {
- let t = [];
- let o = !1;
- t.push(this._root);
- let i = t.shift();
- for (;!o && i; ) {
- try {
- o = e(i)
- } catch (e) {
- e.name, e.message
- }
- if (!o) {
- t.push(...i.children);
- i = t.shift()
- }
- }
- }
-
- contains(e, t) {
- t.call(this, e,!0)
- }
-
- updateParentChildNum(e, t, o) {
- let i = e.parentNodeId;
- for (; i >= 0; ) this.traverseNodeDF((e => {
- if (e.currentNodeId == i) {
- e.getChildNodeInfo().allChildNum = t ? e.getChildNodeInfo().allChildNum + o : e.getChildNodeInfo()
- .allChildNum - o;
- i = e.parentNodeId;
- return !1
- }
- return !1
- }))
- }
-
- findParentNodeId(e) {
- let t = null;
- this.contains((function (o) {
- if (o.currentNodeId == e) {
- t = o;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- return t.parentNodeId
- }
-
- addNode(e, t, o) {
- if (null === this._root) {
- this._root = new c({});
- this._root.nodeLevel = -1;
- this._root.parentNodeId = -1;
- this._root.currentNodeId = -1
- }
- let i = null;
- this.contains((function (t) {
- if (t.currentNodeId == e) {
- i = t;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- if (i) {
- let s = new c(o);
- if (i.nodeLevel > this.MaxNodeLevel) throw new Error("ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.");
- s.nodeLevel = i.nodeLevel + 1;
- s.parentNodeId = e;
- s.currentNodeId = t;
- i.children.push(s);
- i.getChildNodeInfo().isHasChildNode = !0;
- i.getChildNodeInfo().childNum = i.children.length;
- i.getChildNodeInfo().allChildNum += 1;
- i.addImageCollapse(i.getChildNodeInfo().isHasChildNode);
- this.updateParentChildNum(i,!0, 1);
- return this
- }
- throw new Error("ListNodeUtils[addNode]: Parent node not found.")
- }
-
- findNodeIndex(e, t) {
- let o = this.INITIAL_INVALID_VALUE;
- for (let i = 0, s = e.length;i < s; i++) if (e[i].currentNodeId === t) {
- o = i;
- break
- }
- return o
- }
-
- freeNodeMemory(e, t) {
- let o = [];
- this.traverseNodeDF((function (e) {
- o.push(e);
- return !1
- }), e);
- o.forEach((e => {
- t.push(e.currentNodeId);
- e = null
- }))
- }
-
- removeNode(e, t, o) {
- let i = null;
- this.contains((function (e) {
- if (e.currentNodeId == t) {
- i = e;
- return !0
- }
- return !1
- }), o);
- if (i) {
- let t = [];
- let o = this.findNodeIndex(i.children, e);
- if (o < 0) throw new Error("Node does not exist.");
- {
- var s = i.children[o].getChildNodeInfo().allChildNum + 1;
- this.freeNodeMemory(i.children[o], t);
- let e = i.children.splice(o, 1);
- e = null;
- 0 == i.children.length && i.addImageCollapse(!1)
- }
- i.getChildNodeInfo().childNum = i.children.length;
- i.getChildNodeInfo().allChildNum -= s;
- this.updateParentChildNum(i,!1, s);
- return t
- }
- throw new Error("Parent does not exist.")
- }
-
- getNewNodeInfo(e) {
- let t = null;
- this.contains((function (o) {
- if (o.currentNodeId == e) {
- t = o;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- let o = {
- isFolder: !0,
- icon: null,
- selectedIcon: null,
- editIcon: null,
- menu: null,
- secondaryTitle: ""
- };
- if (t) if (0 === t.children.length) if (null != t.getNodeItem().imageNode) {
- o.icon = t.getNodeItem().imageNode.normalSource;
- o.selectedIcon = t.getNodeItem().imageNode.selectedSource;
- o.editIcon = t.getNodeItem().imageNode.editSource;
- o.menu = t.getMenu()
- } else {
- o.icon = null;
- o.selectedIcon = null;
- o.editIcon = null;
- o.menu = t.getMenu()
- } else if (t.children.length > 0) if (null != t.getNodeItem().imageNode) {
- o.icon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem()
- .imageNode
- .normalSource : null;
- o.selectedIcon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem()
- .imageNode
- .selectedSource : null;
- o.editIcon = null != t.children[0].getNodeItem().imageNode ? t.children[0].getNodeItem()
- .imageNode
- .editSource : null;
- o.menu = t.children[0].getMenu()
- } else {
- o.icon = null;
- o.selectedIcon = null;
- o.editIcon = null;
- o.menu = t.children[0].getMenu()
- }
- return o
- }
-
- getClickChildId(e) {
- let t = null;
- this.contains((function (o) {
- if (o.currentNodeId == e) {
- t = o;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- if (t) {
- if (0 === t.children.length) return [];
- if (t.children.length > 0) {
- var o = new Array(t.children.length);
- for (let e = 0;e < o.length; e++) o[e] = 0;
- for (let e = 0;e < t.children.length && e < o.length; e++) o[e] = t.children[e].currentNodeId;
- return o
- }
- }
- return []
- }
-
- getClickNodeChildrenInfo(e) {
- let t = null;
- this.contains((function (o) {
- if (o.currentNodeId == e) {
- t = o;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- if (t) {
- if (0 === t.children.length) return [];
- if (t.children.length > 0) {
- var o = new Array(t.children.length);
- for (let e = 0;e < o.length; e++) o[e] = { itemId: null, itemIcon: null, itemTitle: null, isFolder: null };
- for (let e = 0;e < t.children.length && e < o.length; e++) {
- o[e].itemId = t.children[e].currentNodeId;
- t.children[e].getNodeItem().imageNode && (o[e].itemIcon = t.children[e].getNodeItem().imageNode.source);
- t.children[e].getNodeItem().mainTitleNode && (o[e].itemTitle = t.children[e].getNodeItem()
- .mainTitleNode
- .title);
- o[e].isFolder = t.children[e].getIsFolder()
- }
- return o
- }
- }
- return []
- }
-
- checkMainTitleIsValid(e) {
- let t = /^[\u4e00-\u9fa5]+$/;
- return!/[\\\/:*?"<>|]/.test(e) && !(t.test(e) && e.length > this.MAX_CN_LENGTH || !t.test(e) && e.length > this.MAX_EN_LENGTH)
- }
-
- dragTraverseNodeDF(e, t = this._root, o) {
- let i = [], s = !1;
- i.unshift(t);
- let a = i.shift();
- for (;!s && a; ) {
- s = !0 === e(a, o);
- if (!s) {
- i.unshift(...a.children);
- a = i.shift()
- }
- }
- }
-
- addDragNode(e, t, o, i, s) {
- if (null === this._root) {
- this._root = new c({});
- this._root.nodeLevel = this.INITIAL_INVALID_VALUE;
- this._root.parentNodeId = this.INITIAL_INVALID_VALUE;
- this._root.currentNodeId = this.INITIAL_INVALID_VALUE
- }
- let a = null;
- this.contains((function (t) {
- if (t.currentNodeId == e) {
- a = t;
- return !0
- }
- return !1
- }), this.traverseNodeBF);
- if (a) {
- let d = new c(s);
- if (a.nodeLevel > this.MaxNodeLevel) throw new Error("ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.");
- d.nodeLevel = a.nodeLevel + 1;
- d.parentNodeId = e;
- d.currentNodeId = t;
- let r = this.INITIAL_INVALID_VALUE;
- if (a.children.length) {
- for (let e = 0;e < a.children.length; e++) if (a.children[e].getCurrentNodeId() == o) {
- r = e;
- break
- }
- i ? a.children.splice(r + 1, 0, d) : a.children.splice(r, 0, d)
- } else a.children.push(d);
- a.getChildNodeInfo().isHasChildNode = !0;
- a.getChildNodeInfo().childNum = a.children.length;
- a.getChildNodeInfo().allChildNum += 1;
- a.addImageCollapse(a.getChildNodeInfo().isHasChildNode);
- this.updateParentChildNum(a,!0, 1);
- return this
- }
- throw new Error("ListNodeUtils[addNode]: Parent node not found.")
- }
- }
-
- e.ListNodeUtils = C;
-
- class D extends d {
- constructor() {
- super(...arguments);
- this.ROOT_NODE_ID = -1;
- this.listNodeUtils = new C;
- this.listNode = [];
- this.INITIAL_INVALID_VALUE = -1;
- this.lastIndex = -1;
- this.thisIndex = -1;
- this.modifyNodeIndex = -1;
- this.modifyNodeId = -1;
- this.expandAndCollapseInfo = new Map;
- this.loadedNodeIdAndIndexMap = new Map;
- this.isTouchDown = !1;
- this.appEventBus = a.getInstance().getTreeListener();
- this.isInnerDrag = !1;
- this.isDrag = !1;
- this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE;
- this.draggingParentNodeId = this.INITIAL_INVALID_VALUE;
- this.currentNodeInfo = null;
- this.listItemOpacity = 1;
- this.lastPassIndex = this.INITIAL_INVALID_VALUE;
- this.lastPassId = this.INITIAL_INVALID_VALUE;
- this.thisPassIndex = this.INITIAL_INVALID_VALUE;
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
- this.timeoutExpandId = this.INITIAL_INVALID_VALUE;
- this.lastTimeoutExpandId = this.INITIAL_INVALID_VALUE;
- this.clearTimeoutExpandId = this.INITIAL_INVALID_VALUE;
- this.timeoutHighLightId = this.INITIAL_INVALID_VALUE;
- this.lastTimeoutHighLightId = this.INITIAL_INVALID_VALUE;
- this.clearTimeoutHighLightId = this.INITIAL_INVALID_VALUE;
- this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE;
- this.lastDelayHighLightId = this.INITIAL_INVALID_VALUE;
- this.nodeIdAndSubtitleMap = new Map;
- this.flag = g.NONE;
- this.selectedParentNodeId = this.INITIAL_INVALID_VALUE;
- this.selectedParentNodeSubtitle = "";
- this.insertNodeSubtitle = "";
- this.currentFocusNodeId = this.INITIAL_INVALID_VALUE;
- this.lastFocusNodeId = this.INITIAL_INVALID_VALUE;
- this.addFocusNodeId = this.INITIAL_INVALID_VALUE;
- this.FLAG_LINE = {
- flagLineHeight: "1.5vp",
- flagLineColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_activated"],
- bundleName: "",
- moduleName: ""
- },
- xOffset: "0vp",
- yTopOffset: "2.75vp",
- yBottomOffset: "-1.25vp",
- yBasePlateOffset: "1.5vp"
- };
- this.DRAG_POPUP = {
- floorConstraintSize: { minWidth: "128vp", maxWidth: "208vp" },
- textConstraintSize: { minWidth1: "80vp", maxWidth1: "160vp", minWidth2: "112vp", maxWidth2: "192vp" },
- padding: { left: "8vp", right: "8vp" },
- backgroundColor: o,
- height: "48",
- shadow: {
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_default_m"],
- bundleName: "",
- moduleName: ""
- },
- color: "#00001E",
- offsetX: 0,
- offsetY: 10
- },
- borderRadius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_corner_radius_clicked"],
- bundleName: "",
- moduleName: ""
- },
- fontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body1"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Regular,
- imageOpacity: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_alpha_content_fourth"],
- bundleName: "",
- moduleName: ""
- }
- };
- this.subTitle = {
- normalFontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_secondary"],
- bundleName: "",
- moduleName: ""
- },
- highLightFontColor: {
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_primary_contrary"],
- bundleName: "",
- moduleName: ""
- },
- fontSize: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- },
- fontWeight: FontWeight.Regular,
- margin: { left: "4vp", right: "24" }
- }
- }
-
- changeNodeColor(e, t) {
- this.listNode[e].setNodeColor(t)
- }
-
- getNodeColor(e) {
- return this.listNode[e].getNodeColor()
- }
-
- handleFocusEffect(e, t) {
- this.listNode[e].getNodeIsShow() && this.listNode[e].setNodeBorder(t)
- }
-
- setImageSource(e, t) {
- let o = this.listNode[e];
- o.setIsSelected(t === u.Selected || t === u.Edit || t === u.FinishEdit);
- null != o.getNodeItem().mainTitleNode && t != u.DragInsert && t != u.FinishDragInsert && o.getNodeItem()
- .mainTitleNode
- .setMainTitleSelected(t === u.Selected || t === u.FinishEdit);
- null != o.getNodeItem().imageNode && o.getNodeItem().imageNode.setImageSource(t)
- }
-
- setImageCollapseSource(e, t) {
- let o = this.listNode[e];
- null != o.getNodeItem().imageCollapse && o.getNodeItem()
- .imageCollapse
- .setImageCollapseSource(t, this.expandAndCollapseInfo.get(o.getCurrentNodeId()))
- }
-
- clearLastIndexStatus() {
- if (!(-1 == this.lastIndex || this.lastIndex >= this.listNode.length)) {
- this.setImageSource(this.lastIndex, u.Normal);
- this.changeNodeColor(this.lastIndex, this.listNode[this.lastIndex].getNodeStatus().normal);
- this.handleFocusEffect(this.lastIndex,!1);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastIndex].getCurrentNodeId()))
- }
- }
-
- changeNodeStatus(e) {
- let t = e;
- let o = this.ListNode;
- let i = o[e].getCurrentNodeId();
- if (this.expandAndCollapseInfo.get(i) == I.Expand) {
- this.expandAndCollapseInfo.set(i, I.Collapse);
- o[t].getNodeItem().imageCollapse.changeImageCollapseSource(I.Collapse)
- } else if (this.expandAndCollapseInfo.get(i) == I.Collapse) {
- this.expandAndCollapseInfo.set(i, I.Expand);
- o[t].getNodeItem().imageCollapse.changeImageCollapseSource(I.Expand)
- }
- }
-
- handleExpandAndCollapse(e) {
- let t = e;
- let o = this.ListNode;
- let i = o[t].getCurrentNodeId();
- if (!this.expandAndCollapseInfo.has(i)) return;
- let s = this.expandAndCollapseInfo.get(i);
- if (o[t].getChildNodeInfo().isHasChildNode && s == I.Collapse) {
- for (var a = 0;a < o[t].getChildNodeInfo().allChildNum; a++) {
- o[t + 1+a].setNodeIsShow(!1);
- o[t + 1+a].setListItemHeight(0)
- }
- this.notifyDataReload();
- return
- }
- let d = new Array(o[t].getChildNodeInfo().childNum);
- d[0] = t + 1;
- let r = 1;
- for (; r < o[t].getChildNodeInfo().childNum; ) {
- d[r] = d[r-1] + o[d[r-1]].getChildNodeInfo().allChildNum + 1;
- r++
- }
- if (s == I.Expand) for (a = 0; a < d.length; a++) {
- o[d[a]].setNodeIsShow(!0);
- o[d[a]].setListItemHeight(48);
- let e = o[d[a]].getCurrentNodeId();
- this.expandAndCollapseInfo.get(e) == I.Expand && this.handleExpandAndCollapse(d[a])
- }
- d = null;
- this.notifyDataReload()
- }
-
- init(e) {
- let t = 0;
- this.listNode = [];
- this.listNodeUtils = e;
- this.loadedNodeIdAndIndexMap.clear();
- this.listNodeUtils.traverseNodeDF((e => {
- if (e.currentNodeId >= 0) {
- var o = new S(e);
- this.listNode.push(o);
- o.getChildNodeInfo().isHasChildNode && this.expandAndCollapseInfo.set(o.getCurrentNodeId(), I.Collapse);
- o.getNodeIsShow() && this.loadedNodeIdAndIndexMap.set(o.getCurrentNodeId(), t++);
- o.getIsFolder() && this.nodeIdAndSubtitleMap.set(o.getCurrentNodeId(), o.getNodeInfoData()
- .secondaryTitle || 0 == o.getNodeInfoData()
- .secondaryTitle ? o.getNodeInfoData().secondaryTitle : "")
- }
- return !1
- }))
- }
-
- refreshRemoveNodeData(e, t) {
- let o = [];
- for (let t = 0;t < e.length; t++) for (let i = 0;i < this.listNode.length; i++) if (this.listNode[i].getNodeCurrentNodeId() == e[t]) {
- let s = this.listNode[i].getNodeCurrentNodeId();
- this.loadedNodeIdAndIndexMap.has(s) && o.push(this.loadedNodeIdAndIndexMap.get(s));
- let a = this.listNode.splice(i, 1);
- a = null;
- this.expandAndCollapseInfo.has(e[t]) && this.expandAndCollapseInfo.delete(e[t]);
- break
- }
- o.forEach((e => {
- this.notifyDataDelete(e);
- this.notifyDataChange(e)
- }));
- for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getNodeCurrentNodeId() == t.getNodeCurrentNodeId()) {
- if (null == t.getNodeItem().imageCollapse) {
- this.listNode[e].handleImageCollapseAfterAddNode(!1);
- this.expandAndCollapseInfo.delete(t.getNodeCurrentNodeId());
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[e].getNodeCurrentNodeId()))
- }
- break
- }
- let i = { currentNodeId: t.getNodeCurrentNodeId(), parentNodeId: t.getNodeParentNodeId() };
- this.appEventBus.emit(s.NODE_DELETE, [i])
- }
-
- refreshAddNodeData(e) {
- var t;
- this.listNodeUtils.traverseNodeDF((o => {
- if (o.currentNodeId === e[0]) {
- t = new S(o);
- return !0
- }
- return !1
- }));
- t.setIsModify(!0);
- let o = 0;
- for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getNodeCurrentNodeId() == t.getNodeParentNodeId()) {
- o = e;
- if (null == this.listNode[e].getNodeItem().imageCollapse) {
- this.listNode[e].handleImageCollapseAfterAddNode(!0);
- this.notifyDataChange(o)
- } else this.expandAndCollapseInfo.get(this.listNode[e].getNodeCurrentNodeId()) == I.Collapse && this.changeNodeStatus(o);
- this.listNode.splice(e + 1, 0, t);
- this.listNode[e+1].setTitleAndInputTextStatus(!0);
- this.listNode[e+1].setNodeIsShow(!0);
- this.listNode[e+1].setListItemHeight(48);
- this.setImageSource(e + 1, u.Edit);
- this.currentOperation = n.ADD_NODE;
- this.notifyDataAdd(e + 1);
- this.notificationNodeInfo(e + 1, this.currentOperation);
- break
- }
- this.modifyNodeIndex = o + 1;
- this.expandAndCollapseInfo.set(t.getNodeParentNodeId(), I.Expand);
- this.handleExpandAndCollapse(o)
- }
-
- refreshData(e, t, o, i) {
- let s;
- this.listNodeUtils = e;
- this.listNodeUtils.traverseNodeDF((e => {
- if (e.currentNodeId == o) {
- s = new S(e);
- return !0
- }
- return !1
- }));
- if (t === n.REMOVE_NODE) {
- this.nodeIdAndSubtitleMap.set(o, this.selectedParentNodeSubtitle);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(o));
- this.refreshRemoveNodeData(i, s)
- }
- if (t === n.ADD_NODE) {
- this.addFocusNodeId = i[0];
- this.nodeIdAndSubtitleMap.set(this.getClickNodeId(), this.selectedParentNodeSubtitle);
- this.nodeIdAndSubtitleMap.set(i[0], this.insertNodeSubtitle);
- this.refreshAddNodeData(i)
- }
- }
-
- setClickIndex(e) {
- this.thisIndex = e
- }
-
- getClickNodeId() {
- return this.thisIndex < 0 || this.thisIndex >= this.ListNode.length ? -1 : this.ListNode[this.thisIndex].getCurrentNodeId()
- }
-
- expandAndCollapseNode(e) {
- this.changeNodeStatus(e);
- this.handleExpandAndCollapse(e)
- }
-
- getIsTouchDown() {
- return this.isTouchDown
- }
-
- getLastIndex() {
- return this.lastIndex
- }
-
- handleEvent(e, t) {
- if (this.isDrag) return;
- e !== r.TOUCH_DOWN && e !== r.TOUCH_UP && e !== r.MOUSE_BUTTON_RIGHT || t != this.lastIndex && this.clearLastIndexStatus();
- let o = this.loadedNodeIdAndIndexMap.get(this.listNode[t].getCurrentNodeId());
- switch (e) {
- case r.TOUCH_DOWN:
- this.isTouchDown = !0;
- this.changeNodeColor(t, this.listNode[t].getNodeStatus().press);
- break;
- case r.TOUCH_UP: {
- this.isInnerDrag && (this.isInnerDrag = !1);
- this.isTouchDown = !1;
- let e = this.listNode[t];
- this.setImageSource(t, u.Selected);
- this.lastIndex = t;
- this.changeNodeColor(t, e.getNodeStatus().selected);
- this.notifyDataChange(o);
- break
- }
- case r.HOVER:
- if (this.getNodeColor(t) != this.listNode[t].getNodeStatus().selected) {
- this.changeNodeColor(t, this.listNode[t].getNodeStatus().hover);
- this.notifyDataChange(o)
- }
- break;
- case r.HOVER_OVER:
- if (this.getNodeColor(t) != this.listNode[t].getNodeStatus().selected) {
- this.changeNodeColor(t, this.listNode[t].getNodeStatus().normal);
- this.notifyDataChange(o)
- }
- break;
- case r.FOCUS:
- this.handleFocusEffect(t,!0);
- this.notifyDataChange(o);
- break;
- case r.BLUR:
- this.handleFocusEffect(t,!1);
- this.notifyDataChange(o);
- break;
- case r.MOUSE_BUTTON_RIGHT:
- this.lastIndex = t;
- this.finishEditing();
- break;
- case r.DRAG:
- this.isTouchDown = !1;
- let e = this.listNode[t];
- this.setImageSource(t, u.Selected);
- this.lastIndex = t;
- this.changeNodeColor(t, e.getNodeStatus().selected);
- this.notifyDataChange(o)
- }
- }
-
- notificationNodeInfo(e, t) {
- if (t === n.MODIFY_NODE) {
- let e = this.listNode[this.modifyNodeIndex];
- let t = { currentNodeId: e.getNodeCurrentNodeId(), parentNodeId: e.getNodeParentNodeId() };
- this.appEventBus.emit(s.NODE_MODIFY, [t])
- } else if (t === n.ADD_NODE) {
- let t = this.listNode[e];
- null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.source;
- null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.selectedSource;
- null != t.getNodeItem().imageNode && t.getNodeItem().imageNode.editSource;
- let o = { currentNodeId: t.getNodeCurrentNodeId(), parentNodeId: t.getNodeParentNodeId() };
- this.appEventBus.emit(s.NODE_ADD, [o])
- }
- }
-
- finishEditing() {
- if (-1 != this.modifyNodeIndex) {
- this.setImageSource(this.modifyNodeIndex, u.FinishEdit);
- this.setImageCollapseSource(this.modifyNodeIndex, u.FinishEdit);
- this.listNode[this.modifyNodeIndex].setIsModify(!1);
- this.listNode[this.modifyNodeIndex].setTitleAndInputTextStatus(!1);
- this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
- this.notifyDataChange(this.modifyNodeIndex)
- }
- }
-
- setItemVisibilityOnEdit(e, t) {
- let o = -1;
- if (-1 != e) {
- if (t === n.MODIFY_NODE) {
- for (let t = 0;t < this.listNode.length; t++) if (this.listNode[t].getCurrentNodeId() == e) {
- o = t;
- break
- }
- let t = this.listNode[o];
- t.setIsModify(!0);
- if (null === t.getNodeItem().mainTitleNode) return;
- this.currentOperation = n.MODIFY_NODE;
- t.setTitleAndInputTextStatus(!0);
- this.setImageSource(o, u.Edit);
- this.setImageCollapseSource(o, u.Edit);
- this.modifyNodeIndex = o;
- t.getNodeItem().inputText && (null != t.getNodeItem().imageCollapse ? t.getNodeItem()
- .inputText
- .rightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_paragraph_margin_xs"],
- bundleName: "",
- moduleName: ""
- } : t.getNodeItem().inputText.rightMargin = {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_m"],
- bundleName: "",
- moduleName: ""
- });
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e))
- }
- o = e;
- if (t === n.COMMIT_NODE) {
- let e = this.listNode[o];
- e.setTitleAndInputTextStatus(!1);
- e.setIsModify(!1);
- this.setImageSource(o, u.FinishEdit);
- this.setImageCollapseSource(o, u.FinishEdit);
- this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e.getCurrentNodeId()))
- }
- }
- }
-
- setPopUpInfo(e, t, o, i) {
- let s = this.listNode[i];
- s.setPopUpIsShow(o);
- let a = this.loadedNodeIdAndIndexMap.get(s.getCurrentNodeId());
- if (o) {
- if (e === l.HINTS) {
- if (null != s.getNodeItem().mainTitleNode) s.setPopUpText(s.getNodeItem().mainTitleNode.title); else {
- s.setPopUpText("");
- s.setPopUpIsShow(!1)
- }
- s.setPopUpEnableArrow(!1);
- s.setPopUpColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_background"],
- bundleName: "",
- moduleName: ""
- });
- s.setPopUpTextColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_secondary"],
- bundleName: "",
- moduleName: ""
- })
- } else if (e === l.WARNINGS && null != s.getNodeItem().inputText) {
- t === h.INVALID_ERROR ? s.setPopUpText("invalid error") : t === h.LENGTH_ERROR && s.setPopUpText("length error");
- s.setPopUpEnableArrow(!0);
- s.setPopUpColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_help_tip_bg"],
- bundleName: "",
- moduleName: ""
- });
- s.setPopUpTextColor({
- id: -1,
- type: 10001,
- params: ["sys.color.ohos_id_color_text_hint_contrary"],
- bundleName: "",
- moduleName: ""
- })
- }
- this.notifyDataChange(a)
- } else this.notifyDataChange(a)
- }
-
- setShowPopUpTimeout(e, t) {
- null != this.listNode[t].getNodeItem().mainTitleNode && (this.listNode[t].getNodeItem()
- .mainTitleNode
- .popUpTimeout = e);
- let o = this.loadedNodeIdAndIndexMap.get(this.listNode[t].getCurrentNodeId());
- this.notifyDataChange(o)
- }
-
- setMainTitleNameOnEdit(e, t) {
- this.modifyNodeIndex = e;
- if (null != this.listNode[e].getNodeItem().mainTitleNode) {
- this.listNode[e].getNodeItem().mainTitleNode.title = t;
- let o = this.loadedNodeIdAndIndexMap.get(this.listNode[e].getCurrentNodeId());
- this.notifyDataChange(o)
- }
- }
-
- get ListNode() {
- return this.listNode
- }
-
- totalCount() {
- let e = 0;
- let t = 0;
- this.loadedNodeIdAndIndexMap.clear();
- for (let o = 0;o < this.listNode.length; o++) if (this.listNode[o].getNodeIsShow()) {
- this.loadedNodeIdAndIndexMap.set(this.listNode[o].getCurrentNodeId(), t++);
- e++
- }
- return e
- }
-
- getData(e) {
- let t = 0;
- for (let o = 0;o < this.listNode.length; o++) if (this.listNode[o].getNodeIsShow()) {
- if (e == t) return this.listNode[o];
- t++
- }
- return null
- }
-
- addData(e, t) {
- this.listNode.splice(e, 0, t);
- this.notifyDataAdd(e)
- }
-
- pushData(e) {
- this.listNode.push(e);
- this.notifyDataAdd(this.listNode.length - 1)
- }
-
- setIsInnerDrag(e) {
- this.isInnerDrag = e
- }
-
- getIsInnerDrag() {
- return this.isInnerDrag
- }
-
- setIsDrag(e) {
- this.isDrag = e
- }
-
- getIsDrag() {
- return this.isDrag
- }
-
- setCurrentNodeInfo(e) {
- this.currentNodeInfo = e
- }
-
- getCurrentNodeInfo() {
- return this.currentNodeInfo
- }
-
- setDraggingParentNodeId(e) {
- this.draggingParentNodeId = e
- }
-
- getDraggingParentNodeId() {
- return this.draggingParentNodeId
- }
-
- getDraggingCurrentNodeId() {
- return this.draggingCurrentNodeId
- }
-
- setDraggingCurrentNodeId(e) {
- this.draggingCurrentNodeId = e
- }
-
- setListItemOpacity(e) {
- this.listItemOpacity = e
- }
-
- getListItemOpacity(e) {
- return e.getCurrentNodeId() == this.getDraggingCurrentNodeId() ? this.listItemOpacity : 1
- }
-
- getDragPopupPara() {
- return this.DRAG_POPUP
- }
-
- setLastPassIndex(e) {
- this.lastPassIndex = e
- }
-
- getLastPassIndex() {
- return this.lastPassIndex
- }
-
- getIsParentOfInsertNode(e) {
- let t = this.currentNodeInfo.getNodeInfoNode();
- let o = !1;
- this.listNodeUtils.traverseNodeDF((function (t) {
- if (t.currentNodeId == e) {
- o = !0;
- return !0
- }
- return !1
- }), t);
- return o
- }
-
- setPassIndex(e) {
- this.thisPassIndex = e
- }
-
- getPassIndex() {
- return this.thisPassIndex
- }
-
- clearTimeOutAboutDelayHighLightAndExpand(e) {
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let e = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- let t = this;
- this.ListNode.forEach((function (e) {
- e.getNodeCurrentNodeId() == t.lastPassId && e.setCanShowFlagLine(!1)
- }));
- this.notifyDataChange(e)
- }
- if (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) {
- clearTimeout(this.lastTimeoutHighLightId);
- if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) {
- this.clearHighLight(this.lastDelayHighLightIndex);
- let e = this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastDelayHighLightIndex].getCurrentNodeId());
- this.notifyDataChange(e)
- }
- this.clearTimeoutHighLightId = this.lastTimeoutHighLightId
- }
- this.lastTimeoutHighLightId = this.timeoutHighLightId;
- this.lastDelayHighLightIndex = e;
- if (this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId) {
- clearTimeout(this.lastTimeoutExpandId);
- this.clearTimeoutExpandId = this.lastTimeoutExpandId
- }
- this.lastTimeoutExpandId = this.timeoutExpandId;
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE
- }
-
- clearHighLight(e) {
- this.changeNodeColor(e, this.listNode[e].getNodeStatus().normal);
- this.changeNodeHighLightColor(e,!1);
- this.setImageSource(e, u.FinishDragInsert);
- this.setImageCollapseSource(e, u.FinishDragInsert);
- this.listNode[e].setIsHighLight(!1)
- }
-
- changeNodeHighLightColor(e, t) {
- this.listNode[e].getNodeItem()
- .mainTitleNode && this.listNode[e].getIsShowTitle() && this.listNode[e].getNodeItem()
- .mainTitleNode
- .setMainTitleHighLight(t)
- }
-
- setVisibility(e, t, o) {
- let i = this.thisPassIndex != t || this.flag != e;
- this.thisPassIndex = t;
- if ((i || o) && this.isInnerDrag) {
- this.flag = e;
- let o = this.getData(t).getCurrentNodeId();
- let i = this.expandAndCollapseInfo.get(o) == I.Expand && this.flag == g.DOWN_FLAG ? this.getData(t)
- .getNodeLevel() + 1 : this.getData(t)
- .getNodeLevel();
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let e = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- let t = this;
- this.ListNode.forEach((function (e) {
- e.getNodeCurrentNodeId() == t.lastPassId && e.setCanShowFlagLine(!1)
- }));
- this.notifyDataChange(e)
- }
- if (this.flag == g.DOWN_FLAG && t < this.totalCount() - 1) {
- this.getData(t).setCanShowFlagLine(!1);
- this.getData(t + 1).setCanShowFlagLine(!0);
- this.getData(t).setCanShowBottomFlagLine(!1);
- this.getData(t + 1).setFlagLineLeftMargin(i);
- this.notifyDataChange(t);
- this.notifyDataChange(t + 1);
- this.lastPassId = this.getData(t + 1).getNodeCurrentNodeId()
- } else if (this.flag == g.UP_FLAG && t < this.totalCount() - 1) {
- this.getData(t).setCanShowFlagLine(!0);
- this.getData(t + 1).setCanShowFlagLine(!1);
- this.getData(t).setCanShowBottomFlagLine(!1);
- this.getData(t).setFlagLineLeftMargin(i);
- this.notifyDataChange(t);
- this.notifyDataChange(t + 1);
- this.lastPassId = this.getData(t).getNodeCurrentNodeId()
- } else if (t >= this.totalCount() - 1) {
- if (this.flag == g.DOWN_FLAG) {
- this.getData(t).setCanShowFlagLine(!1);
- this.getData(t).setCanShowBottomFlagLine(!0)
- } else {
- this.getData(t).setCanShowFlagLine(!0);
- this.getData(t).setCanShowBottomFlagLine(!1)
- }
- this.getData(t).setFlagLineLeftMargin(i);
- this.notifyDataChange(t);
- this.lastPassId = this.getData(t).getNodeCurrentNodeId()
- }
- }
- }
-
- delayHighLightAndExpandNode(e, t, o) {
- let i = e != this.lastDelayExpandIndex;
- let s = this.getData(o).getIsOverBorder();
- this.lastDelayExpandIndex = s ? this.INITIAL_INVALID_VALUE : e;
- if (s || i) {
- let i = this;
- if (!s && (!this.isInnerDrag || this.expandAndCollapseInfo.get(t) == I.Collapse && this.isInnerDrag || !this.expandAndCollapseInfo.has(t) && this.listNode[e].getIsFolder())) {
- this.changeNodeColor(e, this.listNode[e].getNodeStatus().hover);
- this.notifyDataChange(o);
- let t = this.isInnerDrag ? 1e3 : 0;
- this.timeoutHighLightId = setTimeout((function () {
- i.delayHighLight(e)
- }), t)
- }
- if (s || this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) {
- clearTimeout(this.lastTimeoutHighLightId);
- if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) {
- this.clearHighLight(this.lastDelayHighLightIndex);
- this.notifyDataReload()
- }
- this.clearTimeoutHighLightId = this.lastTimeoutHighLightId
- }
- this.lastTimeoutHighLightId = this.timeoutHighLightId;
- this.lastDelayHighLightIndex = e;
- if (!s && this.expandAndCollapseInfo.get(t) == I.Collapse) {
- let t = this.getData(o).getNodeInfoNode().children[0].currentNodeId;
- let s = 2e3;
- this.timeoutExpandId = setTimeout((function () {
- i.clearHighLight(i.lastDelayHighLightIndex);
- i.alterFlagLineAndExpandNode(e, t)
- }), s)
- }
- if (s || this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId) {
- clearTimeout(this.lastTimeoutExpandId);
- this.clearTimeoutExpandId = this.lastTimeoutExpandId
- }
- this.lastTimeoutExpandId = this.timeoutExpandId
- }
- }
-
- delayHighLight(e) {
- let t = this;
- this.ListNode.forEach((function (e) {
- if (e.getNodeCurrentNodeId() == t.lastPassId) {
- e.setCanShowFlagLine(!1);
- e.setCanShowBottomFlagLine(!1)
- }
- }));
- this.changeNodeColor(e, this.listNode[e].getNodeStatus().highLight);
- this.listNode[e].setIsHighLight(!0);
- this.changeNodeHighLightColor(e,!0);
- this.setImageSource(e, u.DragInsert);
- this.setImageCollapseSource(e, u.DragInsert);
- this.notifyDataReload()
- }
-
- alterFlagLineAndExpandNode(e, t) {
- let o = this;
- this.ListNode.forEach((function (e) {
- if (e.getNodeCurrentNodeId() == o.lastPassId) {
- e.setCanShowFlagLine(!1);
- e.setCanShowBottomFlagLine(!1)
- }
- }));
- this.ListNode.forEach((function (e) {
- o.isInnerDrag && e.getNodeCurrentNodeId() == t && e.setCanShowFlagLine(!0)
- }));
- this.changeNodeStatus(e);
- this.handleExpandAndCollapse(e);
- this.lastPassId = t
- }
-
- hideLastLine() {
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let e = this;
- this.ListNode.forEach((function (t) {
- if (t.getNodeCurrentNodeId() == e.lastPassId) {
- t.setCanShowFlagLine(!1);
- t.setCanShowBottomFlagLine(!1)
- }
- }));
- let t = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- this.notifyDataChange(t)
- }
- }
-
- clearLastTimeoutHighLight() {
- if (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE && this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) {
- clearTimeout(this.lastTimeoutHighLightId);
- this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE && this.clearHighLight(this.lastDelayHighLightIndex)
- }
- }
-
- clearLastTimeoutExpand() {
- this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE && this.clearTimeoutExpandId != this.lastTimeoutExpandId && clearTimeout(this.lastTimeoutExpandId)
- }
-
- getSubtitle(e) {
- return this.nodeIdAndSubtitleMap.has(e) ? "number" == typeof this.nodeIdAndSubtitleMap.get(e) ? this.nodeIdAndSubtitleMap.get(e)
- .toString() : this.nodeIdAndSubtitleMap.get(e) : ""
- }
-
- hasSubtitle(e) {
- return this.nodeIdAndSubtitleMap.has(e)
- }
-
- initialParameterAboutDelayHighLightAndExpandIndex() {
- this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE;
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
- this.lastPassIndex = this.INITIAL_INVALID_VALUE;
- this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE;
- this.flag = g.NONE
- }
-
- refreshSubtitle(e) {
- this.nodeIdAndSubtitleMap.set(this.selectedParentNodeId, this.selectedParentNodeSubtitle);
- this.nodeIdAndSubtitleMap.set(e, this.insertNodeSubtitle);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.selectedParentNodeId));
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(e))
- }
-
- setNodeSubtitlePara(e, t, o) {
- this.selectedParentNodeId = e;
- this.selectedParentNodeSubtitle = t;
- this.insertNodeSubtitle = o
- }
-
- getInsertNodeSubtitle() {
- return this.insertNodeSubtitle
- }
-
- getExpandAndCollapseInfo(e) {
- return this.expandAndCollapseInfo.get(e)
- }
-
- getLastDelayHighLightId() {
- return this.lastDelayHighLightId
- }
-
- setLastDelayHighLightId() {
- this.ListNode.forEach(((e, t) => {
- t == this.lastDelayHighLightIndex && (this.lastDelayHighLightId = e.getCurrentNodeId())
- }))
- }
-
- setLastPassId(e) {
- this.lastPassId = e
- }
-
- setLastDelayHighLightIndex(e) {
- this.lastDelayHighLightIndex = e
- }
-
- alterDragNode(e, t, o, i, a, d) {
- let r = [];
- let n = e;
- let l = a;
- let h = d.getNodeInfoData();
- let c = null;
- let N = d.getNodeInfoNode();
- let u = !1;
- let p = this.INITIAL_INVALID_VALUE;
- let m = this.INITIAL_INVALID_VALUE;
- let f = this.flag == g.DOWN_FLAG;
- m = this.getChildIndex(i, a);
- p = this.getChildIndex(e, t);
- p = e != i ? f ? p + 1 : p : p > m ? f ? p : p - 1 : f ? p + 1 : p;
- for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getCurrentNodeId() == t) {
- u = this.listNode[e].getIsHighLight();
- if (this.flag == g.DOWN_FLAG && this.expandAndCollapseInfo.get(t) == I.Expand) {
- n = t;
- p = 0
- } else if (this.flag == g.UP_FLAG && this.expandAndCollapseInfo.get(t) == I.Expand && 0 == this.listNode[e].getCanShowFlagLine()) {
- n = t;
- p = 0
- } else if (u) {
- n = t;
- p = 0
- }
- break
- }
- let S = { currentNodeId: l, parentNodeId: n, childIndex: p };
- this.appEventBus.emit(s.NODE_MOVE, [S]);
- r.push({ parentId: n, currentId: l, data: h });
- let C = null;
- this.listNodeUtils.dragTraverseNodeDF((function (e, t) {
- if (e) {
- C = e;
- n = C.parentNodeId;
- l = C.currentNodeId;
- for (let e = 0;e < t.length; e++) if (t[e].getNodeCurrentNodeId() == l) {
- c = t[e];
- break
- }
- h = c.getNodeInfoData();
- n != i && r.push({ parentId: n, currentId: l, data: h });
- return !1
- }
- return !1
- }), N, this.listNode);
- this.listNodeUtils.removeNode(a, i, this.listNodeUtils.traverseNodeBF);
- let D = t;
- let _ = f;
- if (this.expandAndCollapseInfo.get(t) == I.Expand) {
- _ = !1;
- this.listNode.forEach((e => {
- e.getCurrentNodeId() == t && 0 == e.getCanShowFlagLine() && (D = e.getNodeInfoNode()
- .children
- .length ? e.getNodeInfoNode()
- .children[0]
- .currentNodeId : this.INITIAL_INVALID_VALUE)
- }))
- } else !this.expandAndCollapseInfo.get(t) && u && this.expandAndCollapseInfo.set(t, I.Expand);
- this.listNodeUtils.addDragNode(r[0].parentId, r[0].currentId, D, _, r[0].data);
- for (let e = 1;e < r.length; e++) this.listNodeUtils.addNode(r[e].parentId, r[e].currentId, r[e].data);
- for (let e = 0;e < this.listNode.length; e++) if (this.listNode[e].getCurrentNodeId() == i && null == this.listNode[e].getNodeInfoNode()
- .getNodeItem()
- .imageCollapse) {
- this.listNode[e].handleImageCollapseAfterAddNode(!1);
- this.expandAndCollapseInfo.delete(i);
- break
- }
- let T = [...this.listNode];
- this.reloadListNode(this.listNodeUtils, T)
- }
-
- reloadListNode(e, t) {
- let o = 0;
- this.listNode = [];
- this.listNodeUtils = e;
- this.loadedNodeIdAndIndexMap.clear();
- this.listNodeUtils.traverseNodeDF((e => {
- if (e.currentNodeId >= 0) {
- var i = new S(e);
- this.listNode.push(i);
- this.expandAndCollapseInfo.get(e.currentNodeId) == I.Expand ? i.getNodeItem()
- .imageCollapse
- .changeImageCollapseSource(I.Expand) : this.expandAndCollapseInfo.get(e.currentNodeId) == I.Collapse && i.getNodeItem()
- .imageCollapse
- .changeImageCollapseSource(I.Collapse);
- for (let e = 0;e < t.length; e++) if (t[e].getCurrentNodeId() == i.getCurrentNodeId()) {
- i.setNodeIsShow(t[e].getNodeIsShow());
- i.setListItemHeight(t[e].getListItemHeight());
- i.getNodeItem().mainTitleNode && i.getIsShowTitle() && (i.getNodeItem()
- .mainTitleNode
- .title = t[e].getNodeItem().mainTitleNode.title);
- break
- }
- i.getNodeIsShow() && this.loadedNodeIdAndIndexMap.set(i.getCurrentNodeId(), o++)
- }
- return !1
- }))
- }
-
- getFlagLine() {
- return this.FLAG_LINE
- }
-
- getVisibility(e) {
- let t = this.loadedNodeIdAndIndexMap.get(e.getCurrentNodeId()) - 1;
- if (t > this.INITIAL_INVALID_VALUE) {
- let o = this.getData(t);
- return 1 != e.getCanShowFlagLine() || e.getIsHighLight() || o.getIsHighLight() ? Visibility.Hidden : Visibility.Visible
- }
- return 1 != e.getCanShowFlagLine() || e.getIsHighLight() ? Visibility.Hidden : Visibility.Visible
- }
-
- getSubTitlePara() {
- return this.subTitle
- }
-
- getIsFolder(e) {
- return!!this.loadedNodeIdAndIndexMap.has(e) && this.getData(this.loadedNodeIdAndIndexMap.get(e)).getIsFolder()
- }
-
- getSubTitleFontColor(e) {
- return e ? this.subTitle.highLightFontColor : this.subTitle.normalFontColor
- }
-
- getChildIndex(e, t) {
- let o = this.INITIAL_INVALID_VALUE;
- this.listNodeUtils.traverseNodeBF((function (i) {
- if (i.getCurrentNodeId() == e) {
- i.children.forEach(((e, i) => {
- e.getCurrentNodeId() == t && (o = i)
- }));
- return !0
- }
- return !1
- }));
- return o
- }
-
- setCurrentFocusNodeId(e) {
- this.currentFocusNodeId = e
- }
-
- getCurrentFocusNodeId() {
- return this.currentFocusNodeId
- }
-
- setLastFocusNodeId(e) {
- this.lastFocusNodeId = e
- }
-
- getLastFocusNodeId() {
- return this.lastFocusNodeId
- }
-
- getAddFocusNodeId() {
- return this.addFocusNodeId
- }
-
- setFlag(e) {
- this.flag = e
- }
- }
-
- e.ListNodeDataSource = D;
-
- function _(e) {
- let t = 0;
- this.listNodeDataSource.ListNode.forEach((function (o, i) {
- o.getNodeCurrentNodeId() == e && (t = i)
- }));
- return t
- }
-
- class T extends ViewPU {
- constructor(e, t, o, i = -1) {
- super(e, o, i);
- this.listNodeDataSource = void 0;
- this.treeController = void 0;
- this.__dropSelectedIndex = new ObservedPropertySimplePU(0, this, "dropSelectedIndex");
- this.listTreeViewMenu = null;
- this.__listTreeViewWidth = new SynchedPropertySimpleOneWayPU(t.listTreeViewWidth, this, "listTreeViewWidth");
- this.__listTreeViewHeight = new SynchedPropertySimpleOneWayPU(t.listTreeViewHeight, this, "listTreeViewHeight");
- this.MAX_CN_LENGTH = 254;
- this.MAX_EN_LENGTH = 255;
- this.INITIAL_INVALID_VALUE = -1;
- this.MAX_TOUCH_DOWN_COUNT = 0;
- this.isMultiPress = !1;
- this.touchDownCount = this.INITIAL_INVALID_VALUE;
- this.appEventBus = a.getInstance().getTreeListener();
- this.itemPadding = {
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_card_margin_middle"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_card_margin_middle"],
- bundleName: "",
- moduleName: ""
- },
- top: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_margin_vertical"],
- bundleName: "",
- moduleName: ""
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_margin_vertical"],
- bundleName: "",
- moduleName: ""
- }
- };
- this.textInputPadding = { left: "0vp", right: "0vp", top: "0vp", bottom: "0vp" };
- this.setInitiallyProvidedValue(t)
- }
-
- setInitiallyProvidedValue(e) {
- void 0 !== e.listNodeDataSource && (this.listNodeDataSource = e.listNodeDataSource);
- void 0 !== e.treeController && (this.treeController = e.treeController);
- void 0 !== e.dropSelectedIndex && (this.dropSelectedIndex = e.dropSelectedIndex);
- void 0 !== e.listTreeViewMenu && (this.listTreeViewMenu = e.listTreeViewMenu);
- void 0 !== e.MAX_CN_LENGTH && (this.MAX_CN_LENGTH = e.MAX_CN_LENGTH);
- void 0 !== e.MAX_EN_LENGTH && (this.MAX_EN_LENGTH = e.MAX_EN_LENGTH);
- void 0 !== e.INITIAL_INVALID_VALUE && (this.INITIAL_INVALID_VALUE = e.INITIAL_INVALID_VALUE);
- void 0 !== e.MAX_TOUCH_DOWN_COUNT && (this.MAX_TOUCH_DOWN_COUNT = e.MAX_TOUCH_DOWN_COUNT);
- void 0 !== e.isMultiPress && (this.isMultiPress = e.isMultiPress);
- void 0 !== e.touchDownCount && (this.touchDownCount = e.touchDownCount);
- void 0 !== e.appEventBus && (this.appEventBus = e.appEventBus);
- void 0 !== e.itemPadding && (this.itemPadding = e.itemPadding);
- void 0 !== e.textInputPadding && (this.textInputPadding = e.textInputPadding)
- }
-
- updateStateVars(e) {
- this.__listTreeViewWidth.reset(e.listTreeViewWidth);
- this.__listTreeViewHeight.reset(e.listTreeViewHeight)
- }
-
- purgeVariableDependenciesOnElmtId(e) {
- this.__dropSelectedIndex.purgeDependencyOnElmtId(e);
- this.__listTreeViewWidth.purgeDependencyOnElmtId(e);
- this.__listTreeViewHeight.purgeDependencyOnElmtId(e)
- }
-
- aboutToBeDeleted() {
- this.__dropSelectedIndex.aboutToBeDeleted();
- this.__listTreeViewWidth.aboutToBeDeleted();
- this.__listTreeViewHeight.aboutToBeDeleted();
- SubscriberManager.Get().delete(this.id__());
- this.aboutToBeDeletedInternal()
- }
-
- get dropSelectedIndex() {
- return this.__dropSelectedIndex.get()
- }
-
- set dropSelectedIndex(e) {
- this.__dropSelectedIndex.set(e)
- }
-
- get listTreeViewWidth() {
- return this.__listTreeViewWidth.get()
- }
-
- set listTreeViewWidth(e) {
- this.__listTreeViewWidth.set(e)
- }
-
- get listTreeViewHeight() {
- return this.__listTreeViewHeight.get()
- }
-
- set listTreeViewHeight(e) {
- this.__listTreeViewHeight.set(e)
- }
-
- aboutToAppear() {
- this.listTreeViewWidth = void 0 === this.listTreeViewWidth ? 200 : this.listTreeViewWidth;
- this.listNodeDataSource = this.treeController.getListNodeDataSource()
- }
-
- checkInvalidPattern(e) {
- return /[\\\/:*?"<>|]/.test(e)
- }
-
- checkIsAllCN(e) {
- return /^[\u4e00-\u9fa5]+$/.test(e)
- }
-
- popupForShowTitle(e, t, o, i = null) {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(t);
- Row.border({
- radius: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_l"],
- bundleName: "",
- moduleName: ""
- }
- });
- Row.padding({
- left: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_l"],
- bundleName: "",
- moduleName: ""
- },
- right: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_elements_margin_horizontal_l"],
- bundleName: "",
- moduleName: ""
- },
- top: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_card_margin_middle"],
- bundleName: "",
- moduleName: ""
- },
- bottom: {
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_card_margin_middle"],
- bundleName: "",
- moduleName: ""
- }
- });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((t, i) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Text.create(e);
- Text.fontSize({
- id: -1,
- type: 10002,
- params: ["sys.float.ohos_id_text_size_body2"],
- bundleName: "",
- moduleName: ""
- });
- Text.fontWeight("regular");
- Text.fontColor(o);
- i || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- }
-
- builder(e = null) {
- this.listTreeViewMenu.bind(this)()
- }
-
- draggingPopup(e, o = null) {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.constraintSize({
- minWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.minWidth,
- maxWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.maxWidth
- });
- Row.height(this.listNodeDataSource.getDragPopupPara().height);
- Row.backgroundColor(this.listNodeDataSource.getDragPopupPara().backgroundColor);
- Row.padding({
- left: this.listNodeDataSource.getDragPopupPara().padding.left,
- right: this.listNodeDataSource.getDragPopupPara().padding.right
- });
- Row.shadow({
- radius: this.listNodeDataSource.getDragPopupPara().shadow.radius,
- color: this.listNodeDataSource.getDragPopupPara().shadow.color,
- offsetY: this.listNodeDataSource.getDragPopupPara().shadow.offsetY
- });
- Row.borderRadius(this.listNodeDataSource.getDragPopupPara().borderRadius);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((o, i) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- If.create();
- e.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((o, i) => {
- ViewStackProcessor.StartGetAccessRecordingFor(o);
- Row.create();
- Row.backgroundColor(t);
- Row.margin({ right: e.getNodeItem().imageNode.itemRightMargin });
- Row.height(e.getNodeItem().imageNode.itemHeight);
- Row.width(e.getNodeItem().imageNode.itemWidth);
- i || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Image.create(e.getNodeItem().imageNode.normalSource);
- Image.objectFit(ImageFit.Contain);
- Image.height(e.getNodeItem().imageNode.itemHeight);
- Image.width(e.getNodeItem().imageNode.itemWidth);
- Image.opacity(this.listNodeDataSource.getDragPopupPara().imageOpacity);
- o || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- i || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Row.create();
- Row.constraintSize({
- minWidth: e.getNodeItem().imageNode ? this.listNodeDataSource.getDragPopupPara()
- .textConstraintSize
- .minWidth1 : this.listNodeDataSource.getDragPopupPara()
- .textConstraintSize
- .minWidth2,
- maxWidth: e.getNodeItem().imageNode ? this.listNodeDataSource.getDragPopupPara()
- .textConstraintSize
- .maxWidth1 : this.listNodeDataSource.getDragPopupPara()
- .textConstraintSize
- .maxWidth2
- });
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- If.create();
- e.getNodeItem().mainTitleNode && e.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- Text.create(e.getNodeItem().mainTitleNode.title);
- Text.maxLines(1);
- Text.fontSize(e.getNodeItem().mainTitleNode.size);
- Text.fontColor(this.listNodeDataSource.getDragPopupPara().fontColor);
- Text.fontWeight(this.listNodeDataSource.getDragPopupPara().fontWeight);
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- o || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Row.pop()
- }
-
- initialRender() {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- List.create({});
- List.width(this.listTreeViewWidth);
- List.height(this.listTreeViewHeight);
- List.onDragMove((e => {
- if (this.isMultiPress) {
- console.error("drag error, a item has been dragged");
- return
- }
- let t = Math.floor(e.getY() / 24) % 2 ? g.DOWN_FLAG : g.UP_FLAG;
- let o = Math.floor(e.getY() / 48);
- let i = !1;
- if (o >= this.listNodeDataSource.totalCount()) {
- t = g.DOWN_FLAG;
- o = this.listNodeDataSource.totalCount() - 1;
- this.listNodeDataSource.getData(o).setIsOverBorder(!0);
- i = !0
- } else this.listNodeDataSource.getData(o).setIsOverBorder(!1);
- let s = this.listNodeDataSource.getData(o).getCurrentNodeId();
- if (o != this.listNodeDataSource.getLastPassIndex() && this.listNodeDataSource.getIsInnerDrag()) {
- if (this.listNodeDataSource.getIsParentOfInsertNode(s)) {
- this.listNodeDataSource.setPassIndex(o);
- let e = this;
- this.listNodeDataSource.clearTimeOutAboutDelayHighLightAndExpand(_.call(e, s));
- this.listNodeDataSource.setFlag(g.NONE);
- return
- }
- }
- this.listNodeDataSource.setLastPassIndex(o);
- this.listNodeDataSource.setVisibility(t, o, i);
- if (s != this.listNodeDataSource.getDraggingCurrentNodeId()) {
- let e = this;
- this.listNodeDataSource.delayHighLightAndExpandNode(_.call(e, s), s, o)
- }
- }));
- List.onDragEnter(((e, t) => {
- if (this.listNodeDataSource.getIsInnerDrag()) {
- this.listNodeDataSource.setIsDrag(!0);
- let e = .4;
- this.listNodeDataSource.setListItemOpacity(e)
- }
- }));
- List.onDragLeave(((e, t) => {
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.clearLastTimeoutExpand();
- this.listNodeDataSource.setListItemOpacity(1);
- this.listNodeDataSource.setIsDrag(!1);
- this.listNodeDataSource.notifyDataReload()
- }));
- List.onDrop(((e, t) => {
- this.listNodeDataSource.clearLastTimeoutExpand();
- this.listNodeDataSource.setListItemOpacity(1);
- let o = this.listNodeDataSource.getPassIndex();
- let i = this.dropSelectedIndex;
- if (i - 1 > this.listNodeDataSource.totalCount() || null == i) {
- console.error("drag error, currentNodeIndex is not found");
- this.listNodeDataSource.setIsDrag(!1);
- return
- }
- if (o == this.listNodeDataSource.totalCount()) {
- console.log("need to insert into the position of the last line, now insertNodeIndex = insertNodeIndex - 1");
- o -= 1
- }
- let s = this.listNodeDataSource.getData(o);
- let a = s.getNodeCurrentNodeId();
- if (!this.listNodeDataSource.getIsDrag() || !this.listNodeDataSource.getIsInnerDrag()) {
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.setIsInnerDrag(!1);
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.refreshSubtitle(a);
- this.listNodeDataSource.notifyDataReload();
- return
- }
- let d = this.listNodeDataSource.getCurrentNodeInfo();
- let n = s.getNodeParentNodeId();
- let l = this.listNodeDataSource.getDraggingCurrentNodeId();
- let h = this.listNodeDataSource.getDraggingParentNodeId();
- if (this.listNodeDataSource.getIsParentOfInsertNode(a)) {
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.setIsInnerDrag(!1);
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.notifyDataChange(o);
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.setIsDrag(!1);
- let e = this;
- let t = _.call(e, l);
- this.listNodeDataSource.setClickIndex(t);
- this.listNodeDataSource.handleEvent(r.DRAG, t);
- return
- }
- if (this.listNodeDataSource.getExpandAndCollapseInfo(l) == I.Expand) {
- let e = this;
- this.listNodeDataSource.expandAndCollapseNode(_.call(e, l))
- }
- if (this.listNodeDataSource.getExpandAndCollapseInfo(a) == I.Collapse) {
- let e = this;
- let t = _.call(e, a);
- this.listNodeDataSource.ListNode[t].getIsHighLight() && this.listNodeDataSource.expandAndCollapseNode(t)
- }
- this.listNodeDataSource.setLastDelayHighLightId();
- if (l != a) {
- this.listNodeDataSource.alterDragNode(n, a, s, h, l, d);
- this.listNodeDataSource.hideLastLine()
- } else {
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.setLastPassId(l);
- this.listNodeDataSource.hideLastLine()
- }
- let g = _.call(this, this.listNodeDataSource.getLastDelayHighLightId());
- this.listNodeDataSource.setLastDelayHighLightIndex(g);
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.setIsDrag(!1);
- let c = _.call(this, l);
- this.listNodeDataSource.setClickIndex(c);
- this.listNodeDataSource.handleEvent(r.DRAG, c);
- this.listNodeDataSource.setIsInnerDrag(!1);
- this.listNodeDataSource.notifyDataReload()
- }));
- t || List.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- {
- const e = e => {
- const i = e;
- {
- const e = void 0 !== globalThis.__lazyForEachItemGenFunction && !0;
- const a = (t, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(t);
- ListItem.create(g, e);
- ListItem.width("100%");
- ListItem.height(i.getListItemHeight());
- ListItem.padding({ left: this.itemPadding.left, right: this.itemPadding.right });
- ListItem.align(Alignment.Start);
- ListItem.onDragStart(((e, t) => {
- if (this.listNodeDataSource.getIsDrag() || this.listNodeDataSource.getIsInnerDrag() || this.isMultiPress) {
- console.error("drag error, a item has been dragged");
- return
- }
- this.dropSelectedIndex = JSON.parse(t).selectedIndex;
- let o = JSON.parse(t).selectedIndex;
- let s = this.listNodeDataSource.getData(o);
- let a = i.getNodeCurrentNodeId();
- if (o >= this.listNodeDataSource.totalCount() || null == o) {
- console.error("drag error, currentNodeIndex is not found in onDragStart");
- return
- }
- this.listNodeDataSource.setIsInnerDrag(!0);
- this.listNodeDataSource.setIsDrag(!0);
- this.listNodeDataSource.setCurrentNodeInfo(s);
- this.listNodeDataSource.setDraggingCurrentNodeId(s.getNodeCurrentNodeId());
- this.listNodeDataSource.setDraggingParentNodeId(s.getNodeParentNodeId());
- this.listNodeDataSource.setListItemOpacity(.4);
- this.listNodeDataSource.notifyDataChange(o);
- if (a == s.getNodeCurrentNodeId()) return { builder: () => {
- this.draggingPopup.call(this, s)
- } };
- console.error("drag is too fast,it attribute a fault to OH");
- this.listNodeDataSource.setIsDrag(!1)
- }));
- o || ListItem.pop();
- ViewStackProcessor.StopGetAccessRecording()
- };
- const d = () => {
- this.observeComponentCreation(a);
- this.observeComponentCreation(((e, a) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeIsShow() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.focusable(!0);
- Column.onMouse((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- if (e.button == MouseButton.Right) {
- t.listNodeDataSource.handleEvent(r.MOUSE_BUTTON_RIGHT, _.call(t, i.getNodeCurrentNodeId()));
- this.listTreeViewMenu = i.getMenu();
- t.listNodeDataSource.setClickIndex(o);
- t.listNodeDataSource.setPopUpInfo(l.HINTS, h.NONE,!1, o);
- clearTimeout(i.getNodeItem().mainTitleNode.popUpTimeout)
- }
- e.stopPropagation()
- }));
- Column.padding({ top: this.itemPadding.top, bottom: this.itemPadding.bottom });
- Column.bindPopup(i.getPopUpInfo().popUpIsShow, {
- builder: { builder: () => {
- this.popupForShowTitle.call(this, i.getPopUpInfo().popUpText, i.getPopUpInfo()
- .popUpColor, i.getPopUpInfo().popUpTextColor)
- } },
- placement: Placement.BottomLeft,
- placementOnTop: !1,
- popupColor: i.getPopUpInfo().popUpColor,
- autoCancel: !0,
- enableArrow: i.getPopUpInfo().popUpEnableArrow
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight);
- Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor);
- Divider.visibility(this.listNodeDataSource.getVisibility(i));
- Divider.lineCap(LineCapStyle.Round);
- Divider.margin({ left: i.getFlagLineLeftMargin() });
- Divider.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yTopOffset
- });
- t || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({});
- Row.opacity(this.listNodeDataSource.getListItemOpacity(i));
- Row.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBasePlateOffset
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({});
- Row.width("100%");
- Row.onTouch((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- let a = i.getNodeCurrentNodeId();
- t.listNodeDataSource.setClickIndex(o);
- if (e.type === TouchType.Down) {
- this.touchDownCount++;
- this.isMultiPress = this.touchDownCount > this.MAX_TOUCH_DOWN_COUNT;
- this.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.TOUCH_DOWN, o)
- }
- if (e.type === TouchType.Up) {
- this.touchDownCount--;
- this.touchDownCount < this.MAX_TOUCH_DOWN_COUNT && (this.isMultiPress = !1);
- let e = { currentNodeId: a };
- this.appEventBus.emit(s.NODE_CLICK, [e]);
- t.listNodeDataSource.handleEvent(r.TOUCH_UP, o)
- }
- }));
- Row.onHover((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- e ? t.listNodeDataSource.handleEvent(r.HOVER, o) : t.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.HOVER_OVER, o)
- }));
- Gesture.create(GesturePriority.Low);
- TapGesture.create({ count: 2 });
- TapGesture.onAction((e => {
- this.listNodeDataSource.expandAndCollapseNode(_.call(this, i.getNodeCurrentNodeId()))
- }));
- TapGesture.pop();
- Gesture.pop();
- Row.height(i.getNodeHeight());
- Row.padding({ left: i.getNodeLeftPadding() });
- Row.backgroundColor(i.getNodeItem().mainTitleNode && i.getNodeItem()
- .inputText && i.getIsShowInputText() ? i.getNodeItem().inputText.editColor : i.getNodeColor());
- Row.border({
- width: i.getNodeBorder().borderWidth,
- color: i.getNodeBorder().borderColor,
- radius: i.getNodeBorder().borderRadius
- });
- Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(t);
- Row.margin({ right: i.getNodeItem().imageNode.itemRightMargin });
- Row.height(i.getNodeItem().imageNode.itemHeight);
- Row.width(i.getNodeItem().imageNode.itemWidth);
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(i.getNodeItem().imageNode.source);
- Image.objectFit(ImageFit.Contain);
- Image.height(i.getNodeItem().imageNode.itemHeight);
- Image.width(i.getNodeItem().imageNode.itemWidth);
- Image.opacity(i.getIsSelected() || i.getIsHighLight() ? i.getNodeItem()
- .imageNode
- .noOpacity : i.getNodeItem()
- .imageNode
- .opacity);
- Image.focusable(null == i.getNodeItem().mainTitleNode);
- Image.onFocus((() => {
- this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId()))
- }));
- Image.onBlur((() => {
- this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId()))
- }));
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.layoutWeight(1);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().mainTitleNode && i.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(i.getNodeItem().mainTitleNode.title);
- Text.maxLines(1);
- Text.fontSize(i.getNodeItem().mainTitleNode.size);
- Text.fontColor(i.getNodeItem().mainTitleNode.color);
- Text.margin({ right: i.getNodeItem().mainTitleNode.itemRightMargin });
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.fontWeight(i.getNodeItem().mainTitleNode.weight);
- Text.focusable(!0);
- Text.onFocus((() => {
- this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId()))
- }));
- Text.onBlur((() => {
- this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId()))
- }));
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().mainTitleNode && i.getNodeItem()
- .inputText && i.getIsShowInputText() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(i.getNodeItem().inputText.backgroundColor);
- Row.borderRadius(i.getNodeItem().inputText.borderRadius);
- Row.margin({ right: i.getNodeItem().inputText.itemRightMargin });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- TextInput.create({ text: i.getNodeItem().mainTitleNode.title });
- TextInput.height(i.getNodeItem().inputText.itemHeight);
- TextInput.fontSize(i.getNodeItem().inputText.size);
- TextInput.fontColor(i.getNodeItem().inputText.color);
- TextInput.borderRadius(i.getNodeItem().inputText.borderRadius);
- TextInput.backgroundColor(i.getNodeItem().inputText.backgroundColor);
- TextInput.enterKeyType(EnterKeyType.Done);
- TextInput.padding({
- left: this.textInputPadding.left,
- right: this.textInputPadding.right,
- top: this.textInputPadding.top,
- bottom: this.textInputPadding.bottom
- });
- TextInput.onChange((e => {
- let t = this;
- var o = _.call(t, i.getNodeCurrentNodeId());
- let s = "";
- let a = !1;
- let d = !1;
- if (t.checkInvalidPattern(e)) {
- for (let o = 0;o < e.length; o++) t.checkInvalidPattern(e[o]) || (s += e[o]);
- a = !0;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!0, o)
- } else {
- s = e;
- a = !1;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!1, o)
- }
- if (t.checkIsAllCN(s) && s.length > this.MAX_CN_LENGTH || !t.checkIsAllCN(s) && s.length > this.MAX_EN_LENGTH) {
- s = t.checkIsAllCN(s) ? s.substr(0, this.MAX_CN_LENGTH) : s.substr(0, this.MAX_EN_LENGTH);
- d = !0;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!0, o)
- } else d = !1;
- if (!d && !a) {
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!1, o);
- t.listNodeDataSource.setMainTitleNameOnEdit(o, s)
- }
- }));
- TextInput.onSubmit((e => {
- let t = this;
- var o = _.call(t, i.getNodeCurrentNodeId());
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.NONE,!1, o);
- t.listNodeDataSource.setItemVisibilityOnEdit(o, n.COMMIT_NODE)
- }));
- t || TextInput.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Blank.create();
- t || Blank.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Blank.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.listNodeDataSource.hasSubtitle(i.getCurrentNodeId()) ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: this.listNodeDataSource.getSubTitlePara().margin.left,
- right: i.getNodeItem().imageCollapse ? 0 : this.listNodeDataSource.getSubTitlePara()
- .margin
- .right
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.listNodeDataSource.getSubtitle(i.getCurrentNodeId()));
- Text.fontSize(this.listNodeDataSource.getSubTitlePara().fontSize);
- Text.fontColor(this.listNodeDataSource.getSubTitleFontColor(i.getIsHighLight() || i.getIsModify()));
- Text.fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().imageCollapse ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(t);
- Row.height(i.getNodeItem().imageCollapse.itemHeight);
- Row.width(i.getNodeItem().imageCollapse.itemWidth);
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(i.getNodeItem().imageCollapse.collapseSource);
- Image.fillColor(i.getNodeItem().imageCollapse.isCollapse ? t : o);
- Image.align(Alignment.End);
- Image.objectFit(ImageFit.Contain);
- Image.height(i.getNodeItem().imageCollapse.itemHeight);
- Image.width(i.getNodeItem().imageCollapse.itemWidth);
- Image.opacity(i.getIsHighLight() ? i.getNodeItem().imageCollapse.noOpacity : i.getNodeItem()
- .imageCollapse
- .opacity);
- Image.onTouch((e => {
- if (e.type === TouchType.Down) {
- let e = this;
- e.listNodeDataSource.expandAndCollapseNode(_.call(e, i.getNodeCurrentNodeId()));
- this.listNodeDataSource.setCurrentFocusNodeId(i.getCurrentNodeId())
- }
- e.stopPropagation()
- }));
- s || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- s || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getCanShowBottomFlagLine() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.listNodeDataSource.getPassIndex() != this.listNodeDataSource.totalCount() - 1 || i.getIsHighLight() ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight);
- Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor);
- Divider.visibility(Visibility.Visible);
- Divider.lineCap(LineCapStyle.Round);
- Divider.margin({ left: i.getFlagLineLeftMargin() });
- Divider.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBottomOffset
- });
- t || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop()
- })) : If.branchId(1);
- a || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- ListItem.pop()
- };
- const g = (e, d) => {
- a(e, d);
- this.updateFuncByElmtId.set(e, a);
- this.observeComponentCreation(((e, a) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeIsShow() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Column.create();
- Column.focusable(!0);
- Column.onMouse((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- if (e.button == MouseButton.Right) {
- t.listNodeDataSource.handleEvent(r.MOUSE_BUTTON_RIGHT, _.call(t, i.getNodeCurrentNodeId()));
- this.listTreeViewMenu = i.getMenu();
- t.listNodeDataSource.setClickIndex(o);
- t.listNodeDataSource.setPopUpInfo(l.HINTS, h.NONE,!1, o);
- clearTimeout(i.getNodeItem().mainTitleNode.popUpTimeout)
- }
- e.stopPropagation()
- }));
- Column.padding({ top: this.itemPadding.top, bottom: this.itemPadding.bottom });
- Column.bindPopup(i.getPopUpInfo().popUpIsShow, {
- builder: { builder: () => {
- this.popupForShowTitle.call(this, i.getPopUpInfo().popUpText, i.getPopUpInfo()
- .popUpColor, i.getPopUpInfo().popUpTextColor)
- } },
- placement: Placement.BottomLeft,
- placementOnTop: !1,
- popupColor: i.getPopUpInfo().popUpColor,
- autoCancel: !0,
- enableArrow: i.getPopUpInfo().popUpEnableArrow
- });
- t || Column.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight);
- Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor);
- Divider.visibility(this.listNodeDataSource.getVisibility(i));
- Divider.lineCap(LineCapStyle.Round);
- Divider.margin({ left: i.getFlagLineLeftMargin() });
- Divider.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yTopOffset
- });
- t || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({});
- Row.opacity(this.listNodeDataSource.getListItemOpacity(i));
- Row.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBasePlateOffset
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create({});
- Row.width("100%");
- Row.onTouch((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- let a = i.getNodeCurrentNodeId();
- t.listNodeDataSource.setClickIndex(o);
- if (e.type === TouchType.Down) {
- this.touchDownCount++;
- this.isMultiPress = this.touchDownCount > this.MAX_TOUCH_DOWN_COUNT;
- this.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.TOUCH_DOWN, o)
- }
- if (e.type === TouchType.Up) {
- this.touchDownCount--;
- this.touchDownCount < this.MAX_TOUCH_DOWN_COUNT && (this.isMultiPress = !1);
- let e = { currentNodeId: a };
- this.appEventBus.emit(s.NODE_CLICK, [e]);
- t.listNodeDataSource.handleEvent(r.TOUCH_UP, o)
- }
- }));
- Row.onHover((e => {
- let t = this;
- let o = _.call(t, i.getNodeCurrentNodeId());
- e ? t.listNodeDataSource.handleEvent(r.HOVER, o) : t.listNodeDataSource.getIsTouchDown() || t.listNodeDataSource.handleEvent(r.HOVER_OVER, o)
- }));
- Gesture.create(GesturePriority.Low);
- TapGesture.create({ count: 2 });
- TapGesture.onAction((e => {
- this.listNodeDataSource.expandAndCollapseNode(_.call(this, i.getNodeCurrentNodeId()))
- }));
- TapGesture.pop();
- Gesture.pop();
- Row.height(i.getNodeHeight());
- Row.padding({ left: i.getNodeLeftPadding() });
- Row.backgroundColor(i.getNodeItem().mainTitleNode && i.getNodeItem()
- .inputText && i.getIsShowInputText() ? i.getNodeItem().inputText.editColor : i.getNodeColor());
- Row.border({
- width: i.getNodeBorder().borderWidth,
- color: i.getNodeBorder().borderColor,
- radius: i.getNodeBorder().borderRadius
- });
- Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().imageNode ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(t);
- Row.margin({ right: i.getNodeItem().imageNode.itemRightMargin });
- Row.height(i.getNodeItem().imageNode.itemHeight);
- Row.width(i.getNodeItem().imageNode.itemWidth);
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(i.getNodeItem().imageNode.source);
- Image.objectFit(ImageFit.Contain);
- Image.height(i.getNodeItem().imageNode.itemHeight);
- Image.width(i.getNodeItem().imageNode.itemWidth);
- Image.opacity(i.getIsSelected() || i.getIsHighLight() ? i.getNodeItem()
- .imageNode
- .noOpacity : i.getNodeItem()
- .imageNode
- .opacity);
- Image.focusable(null == i.getNodeItem().mainTitleNode);
- Image.onFocus((() => {
- this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId()))
- }));
- Image.onBlur((() => {
- this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId()))
- }));
- t || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- o || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.layoutWeight(1);
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().mainTitleNode && i.getIsShowTitle() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(i.getNodeItem().mainTitleNode.title);
- Text.maxLines(1);
- Text.fontSize(i.getNodeItem().mainTitleNode.size);
- Text.fontColor(i.getNodeItem().mainTitleNode.color);
- Text.margin({ right: i.getNodeItem().mainTitleNode.itemRightMargin });
- Text.textOverflow({ overflow: TextOverflow.Ellipsis });
- Text.fontWeight(i.getNodeItem().mainTitleNode.weight);
- Text.focusable(!0);
- Text.onFocus((() => {
- this.listNodeDataSource.handleEvent(r.FOCUS, _.call(this, i.getNodeCurrentNodeId()))
- }));
- Text.onBlur((() => {
- this.listNodeDataSource.handleEvent(r.BLUR, _.call(this, i.getNodeCurrentNodeId()))
- }));
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().mainTitleNode && i.getNodeItem()
- .inputText && i.getIsShowInputText() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(i.getNodeItem().inputText.backgroundColor);
- Row.borderRadius(i.getNodeItem().inputText.borderRadius);
- Row.margin({ right: i.getNodeItem().inputText.itemRightMargin });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- TextInput.create({ text: i.getNodeItem().mainTitleNode.title });
- TextInput.height(i.getNodeItem().inputText.itemHeight);
- TextInput.fontSize(i.getNodeItem().inputText.size);
- TextInput.fontColor(i.getNodeItem().inputText.color);
- TextInput.borderRadius(i.getNodeItem().inputText.borderRadius);
- TextInput.backgroundColor(i.getNodeItem().inputText.backgroundColor);
- TextInput.enterKeyType(EnterKeyType.Done);
- TextInput.padding({
- left: this.textInputPadding.left,
- right: this.textInputPadding.right,
- top: this.textInputPadding.top,
- bottom: this.textInputPadding.bottom
- });
- TextInput.onChange((e => {
- let t = this;
- var o = _.call(t, i.getNodeCurrentNodeId());
- let s = "";
- let a = !1;
- let d = !1;
- if (t.checkInvalidPattern(e)) {
- for (let o = 0;o < e.length; o++) t.checkInvalidPattern(e[o]) || (s += e[o]);
- a = !0;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!0, o)
- } else {
- s = e;
- a = !1;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.INVALID_ERROR,!1, o)
- }
- if (t.checkIsAllCN(s) && s.length > this.MAX_CN_LENGTH || !t.checkIsAllCN(s) && s.length > this.MAX_EN_LENGTH) {
- s = t.checkIsAllCN(s) ? s.substr(0, this.MAX_CN_LENGTH) : s.substr(0, this.MAX_EN_LENGTH);
- d = !0;
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!0, o)
- } else d = !1;
- if (!d && !a) {
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.LENGTH_ERROR,!1, o);
- t.listNodeDataSource.setMainTitleNameOnEdit(o, s)
- }
- }));
- TextInput.onSubmit((e => {
- let t = this;
- var o = _.call(t, i.getNodeCurrentNodeId());
- t.listNodeDataSource.setPopUpInfo(l.WARNINGS, h.NONE,!1, o);
- t.listNodeDataSource.setItemVisibilityOnEdit(o, n.COMMIT_NODE)
- }));
- t || TextInput.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Blank.create();
- t || Blank.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Blank.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.listNodeDataSource.hasSubtitle(i.getCurrentNodeId()) ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.margin({
- left: this.listNodeDataSource.getSubTitlePara().margin.left,
- right: i.getNodeItem().imageCollapse ? 0 : this.listNodeDataSource.getSubTitlePara()
- .margin
- .right
- });
- t || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Text.create(this.listNodeDataSource.getSubtitle(i.getCurrentNodeId()));
- Text.fontSize(this.listNodeDataSource.getSubTitlePara().fontSize);
- Text.fontColor(this.listNodeDataSource.getSubTitleFontColor(i.getIsHighLight() || i.getIsModify()));
- Text.fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight);
- t || Text.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Text.pop();
- Row.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getNodeItem().imageCollapse ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, o) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Row.create();
- Row.backgroundColor(t);
- Row.height(i.getNodeItem().imageCollapse.itemHeight);
- Row.width(i.getNodeItem().imageCollapse.itemWidth);
- o || Row.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- this.observeComponentCreation(((e, s) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Image.create(i.getNodeItem().imageCollapse.collapseSource);
- Image.fillColor(i.getNodeItem().imageCollapse.isCollapse ? t : o);
- Image.align(Alignment.End);
- Image.objectFit(ImageFit.Contain);
- Image.height(i.getNodeItem().imageCollapse.itemHeight);
- Image.width(i.getNodeItem().imageCollapse.itemWidth);
- Image.opacity(i.getIsHighLight() ? i.getNodeItem().imageCollapse.noOpacity : i.getNodeItem()
- .imageCollapse
- .opacity);
- Image.onTouch((e => {
- if (e.type === TouchType.Down) {
- let e = this;
- e.listNodeDataSource.expandAndCollapseNode(_.call(e, i.getNodeCurrentNodeId()));
- this.listNodeDataSource.setCurrentFocusNodeId(i.getCurrentNodeId())
- }
- e.stopPropagation()
- }));
- s || Image.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- Row.pop()
- })) : If.branchId(1);
- s || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Row.pop();
- Row.pop();
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- i.getCanShowBottomFlagLine() ? this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- If.create();
- this.listNodeDataSource.getPassIndex() != this.listNodeDataSource.totalCount() - 1 || i.getIsHighLight() ? If.branchId(1) : this.ifElseBranchUpdateFunction(0, (() => {
- this.observeComponentCreation(((e, t) => {
- ViewStackProcessor.StartGetAccessRecordingFor(e);
- Divider.create();
- Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight);
- Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor);
- Divider.visibility(Visibility.Visible);
- Divider.lineCap(LineCapStyle.Round);
- Divider.margin({ left: i.getFlagLineLeftMargin() });
- Divider.markAnchor({
- x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBottomOffset
- });
- t || Divider.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }))
- }));
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop()
- })) : If.branchId(1);
- t || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- Column.pop()
- })) : If.branchId(1);
- a || If.pop();
- ViewStackProcessor.StopGetAccessRecording()
- }));
- If.pop();
- ListItem.pop()
- };
- e ? (() => {
- this.observeComponentCreation(a);
- ListItem.pop()
- })() : d()
- }
- };
- const i = e => JSON.stringify(e);
- LazyForEach.create("1", this, this.listNodeDataSource, e, i);
- LazyForEach.pop()
- }
- List.pop()
- }
-
- rerender() {
- this.updateDirtyElements()
- }
- }
-
- __decorate([], T.prototype, "popupForShowTitle", null);
- __decorate([], T.prototype, "builder", null);
- __decorate([], T.prototype, "draggingPopup", null);
- e.TreeView = T;
- e.TreeController = class {
- constructor() {
- this.ROOT_NODE_ID = -1;
- this.nodeIdList = [];
- this.listNodeUtils = new C;
- this.listNodeDataSource = new D
- }
-
- getListNodeDataSource() {
- return this.listNodeDataSource
- }
-
- getClickNodeChildrenInfo() {
- let e = this.listNodeDataSource.getClickNodeId();
- return this.listNodeUtils.getClickNodeChildrenInfo(e)
- }
-
- getChildrenId() {
- let e = this.listNodeDataSource.getClickNodeId();
- return this.listNodeUtils.getClickChildId(e)
- }
-
- removeNode() {
- let e = this.listNodeDataSource.getClickNodeId();
- let t = this.listNodeUtils.findParentNodeId(e);
- let o = this.listNodeUtils.removeNode(e, t, this.listNodeUtils.traverseNodeBF);
- this.listNodeDataSource.refreshData(this.listNodeUtils, n.REMOVE_NODE, t, o);
- this.nodeIdList.splice(this.nodeIdList.indexOf(e), 1)
- }
-
- modifyNode() {
- let e = this.listNodeDataSource.getClickNodeId();
- this.listNodeDataSource.setItemVisibilityOnEdit(e, n.MODIFY_NODE)
- }
-
- add() {
- let e = this.listNodeDataSource.getClickNodeId();
- if (e == this.listNodeDataSource.ROOT_NODE_ID || !this.listNodeDataSource.getIsFolder(e)) return;
- let t = {
- isFolder: !0,
- icon: null,
- selectedIcon: null,
- editIcon: null,
- menu: null,
- secondaryTitle: ""
- };
- t = this.listNodeUtils.getNewNodeInfo(e);
- this.nodeIdList.push(this.nodeIdList[this.nodeIdList.length-1] + 1);
- let o = this.nodeIdList[this.nodeIdList.length-1];
- this.listNodeUtils.addNewNodeId = o;
- this.listNodeUtils.addNode(e, o, {
- isFolder: t.isFolder,
- icon: t.icon,
- selectedIcon: t.selectedIcon,
- editIcon: t.editIcon,
- primaryTitle: "新建文件夹",
- menu: t.menu,
- secondaryTitle: t.secondaryTitle
- });
- this.listNodeDataSource.refreshData(this.listNodeUtils, n.ADD_NODE, e, [o])
- }
-
- addNodeParam(e) {
- if (null != e.primaryTitle && !this.listNodeUtils.checkMainTitleIsValid(e.primaryTitle)) throw new Error('ListTreeNode[addNode]: The directory name cannot contain the following characters /: *? "< > | or exceeds the maximum length.');
- if (null == e.primaryTitle && null == e.icon) throw new Error("ListTreeNode[addNode]: The icon and directory name cannot be empty at the same time.");
- if (e.currentNodeId === this.ROOT_NODE_ID || null === e.currentNodeId) throw new Error("ListTreeNode[addNode]: currentNodeId can not be -1 or null.");
- this.nodeIdList.push(e.currentNodeId);
- this.listNodeUtils.addNode(e.parentNodeId, e.currentNodeId, e);
- return this
- }
-
- addNode(e) {
- if (null != e) {
- if (null != e.primaryTitle && !this.listNodeUtils.checkMainTitleIsValid(e.primaryTitle)) throw new Error('ListTreeNode[addNode]: The directory name cannot contain the following characters /: *? "< > | or exceeds the maximum length.');
- if (null == e.primaryTitle && null == e.icon) throw new Error("ListTreeNode[addNode]: The icon and directory name cannot be empty at the same time.");
- if (e.currentNodeId === this.ROOT_NODE_ID || null === e.currentNodeId) throw new Error("ListTreeNode[addNode]: currentNodeId can not be -1 or null.");
- this.nodeIdList.push(e.currentNodeId);
- this.listNodeUtils.addNode(e.parentNodeId, e.currentNodeId, e);
- return this
- }
- this.add()
- }
-
- buildDone() {
- this.listNodeDataSource.init(this.listNodeUtils);
- this.nodeIdList.sort(((e, t) => e - t))
- }
-
- refreshNode(e, t = "", o = "") {
- this.listNodeDataSource.setNodeSubtitlePara(e, t, o)
- }
- }
-}(TreeView || (TreeView = {}));
-
-export default TreeView
\ No newline at end of file
diff --git a/source/ArkDialog/ArkDialog.ets b/source/ArkDialog/ArkDialog.ets
deleted file mode 100644
index 37c4f0b..0000000
--- a/source/ArkDialog/ArkDialog.ets
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const CHECKBOX_CONTAINER_HEIGHT: number = 48
-const CONTENT_MAX_LINES: number = 2
-const DIVIDER_CONTAINER_WIDTH: number = 16
-const DIVIDER_HEIGHT: number = 24
-const DIVIDER_WIDTH: number = 2
-const LOADING_PROGRESS_WIDTH: number = 40
-const LOADING_PROGRESS_HEIGHT: number = 48
-const ITEM_TEXT_SIZE: number = 14
-export declare type ButtonOptions = {
- value: ResourceStr;
- action?: () => void;
- background?: ResourceColor;
- fontColor?: ResourceColor;
-}
-
-@CustomDialog
-export struct TipsDialog{
- controller: CustomDialogController
- imageRes: Resource
- imageSize: SizeOptions = {width: '100%', height: 180}
- title: ResourceStr = ''
- content?: ResourceStr = ''
- checkTips?: ResourceStr = ''
- @State isChecked?: boolean = false
- primaryButton?: ButtonOptions = {value: ""}
- secondaryButton?: ButtonOptions = {value: ""}
-
- build() {
- Column() {
- Row() {
- Column() {
- Image(this.imageRes)
- .size(this.imageSize)
- .objectFit(ImageFit.Fill)
- }.layoutWeight(1)
- .clip(true)
- }.width('100%')
- .padding({ left: 24, right: 24})
- .margin({top: 24})
- Row() {
- Text(this.title)
- .fontSize($r('sys.float.ohos_id_text_size_headline8'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .textAlign(TextAlign.Center)
- }.padding({ left: 24, right: 24 })
- .margin({top: 16})
- if (this.content) {
- Row() {
- Text(this.content)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .textAlign(TextAlign.Center)
- .minFontSize($r('sys.float.ohos_id_text_size_body3'))
- }.padding({ left: 24, right: 24, top: 8, bottom: 8 })
- .width('100%')
- }
- Row() {
- Checkbox({ name: 'checkbox', group: 'checkboxGroup' }).select(this.isChecked)
- .onChange((checked: boolean) => {
- this.isChecked = checked
- })
- .margin({ left: 0, right: 8})
- Text(this.checkTips).fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .maxLines(CONTENT_MAX_LINES)
- .layoutWeight(1)
- .focusOnTouch(true)
- .onClick(() => {
- this.isChecked = !this.isChecked
- })
- }.height(CHECKBOX_CONTAINER_HEIGHT).width('100%').padding({ left: 24, right: 24 , top: 8, bottom: 8 })
-
- Row() {
- if (this.primaryButton.value) {
- Button(this.primaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.primaryButton.background? this.primaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.primaryButton.action) this.primaryButton.action()
- this.controller.close()
- })
- }
- if (this.secondaryButton.value && this.primaryButton.value) {
- Column() {
- if (!this.secondaryButton.background) {
- Divider().width(DIVIDER_WIDTH).height(DIVIDER_HEIGHT).color($r('sys.color.ohos_id_color_list_separator')).vertical(true)
- }
- }.width(DIVIDER_CONTAINER_WIDTH).alignItems(HorizontalAlign.Center)
- }
- if (this.secondaryButton.value) {
- Button(this.secondaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.secondaryButton.background? this.secondaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.secondaryButton.action) this.secondaryButton.action()
- this.controller.close()
- })
- }
- }.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
- }
- .backgroundBlurStyle(BlurStyle.Thick)
- .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
- .margin({
- left: $r('sys.float.ohos_id_dialog_margin_start'),
- right: $r('sys.float.ohos_id_dialog_margin_end'),
- bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
- })
- // 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
- .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
- }
-}
-
-@CustomDialog
-export struct SelectDialog{
- controller: CustomDialogController
- title: ResourceStr = ''
- content?: ResourceStr = ''
- selectedIndex?: number = -1
- confirm?: ButtonOptions = {value: ""}
- radioContent: Array = []
-
- build() {
- Column() {
- Row() {
- Text(this.title)
- .fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
- .fontWeight(FontWeight.Medium)
- .maxLines(CONTENT_MAX_LINES)
- .minFontSize($r('sys.float.ohos_id_text_size_sub_title1'))
- .textOverflow({ overflow: TextOverflow.Ellipsis})
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .textAlign(TextAlign.Start)
- .width('100%')
- }.padding({ left: 24, right: 24, top: 24 })
- .constraintSize({minHeight: 56})
- if (this.content) {
- Row() {
- Text(this.content)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .maxLines(CONTENT_MAX_LINES)
- .textOverflow({ overflow: TextOverflow.Ellipsis})
- .minFontSize($r('sys.float.ohos_id_text_size_body3'))
- }.padding({ left: 24, right: 24, top: 8, bottom: 8 })
- .width('100%')
- }
- List({space: 1}) {
- ForEach(this.radioContent, (item: SheetInfo, index?: number) => {
- ListItem() {
- Column() {
- Row() {
- Text(item.title)
- .fontSize(ITEM_TEXT_SIZE)
- .fontWeight(FontWeight.Regular)
- .maxLines(CONTENT_MAX_LINES)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .layoutWeight(1)
- Radio({ value: 'item.title', group: 'radioGroup'}).checked(this.selectedIndex == index)
- .onChange(() => {
- item.action && item.action()
- this.controller.close()
- })
- .onClick(() => {
- item.action && item.action()
- this.controller.close()
- })
- }.constraintSize({minHeight: 48}).clip(false)
- .onClick(() => {
- item.action && item.action()
- this.controller.close()
- })
- if (index < this.radioContent.length - 1) {
- Divider().color($r('sys.color.ohos_id_color_list_separator'))
- }
- }
- }
- })
- }.width('100%').padding({ left: 24, right: 24, top: 8, bottom: 8 }).clip(false)
- Row() {
- if (this.confirm.value) {
- Button(this.confirm.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.confirm.background? this.confirm.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.confirm.fontColor ? this.confirm.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- this.confirm.action && this.confirm.action()
- this.controller.close()
- })
- }
- }.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
- }
- .backgroundBlurStyle(BlurStyle.Thick)
- .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
- .margin({
- left: $r('sys.float.ohos_id_dialog_margin_start'),
- right: $r('sys.float.ohos_id_dialog_margin_end'),
- bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
- })
- // 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
- .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
- }
-}
-
-@CustomDialog
-export struct ConfirmDialog{
- controller: CustomDialogController
- title: ResourceStr = ''
- content?: ResourceStr = ''
- checkTips?: ResourceStr = ''
- @State isChecked?: boolean = false
- primaryButton?: ButtonOptions = {value: ""}
- secondaryButton?: ButtonOptions = {value: ""}
-
- build() {
- Column() {
- Row() {
- Text(this.title)
- .fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
- .fontWeight(FontWeight.Medium)
- .maxLines(CONTENT_MAX_LINES)
- .minFontSize($r('sys.float.ohos_id_text_size_sub_title1'))
- .textOverflow({ overflow: TextOverflow.Ellipsis})
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .textAlign(TextAlign.Start)
- .width('100%')
- }.padding({ left: 24, right: 24, top: 24 })
- .constraintSize({minHeight: 56})
- if (this.content) {
- Row() {
- Text(this.content)
- .fontSize($r('sys.float.ohos_id_text_size_body1'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .maxLines(CONTENT_MAX_LINES)
- .textOverflow({ overflow: TextOverflow.Ellipsis})
- .minFontSize($r('sys.float.ohos_id_text_size_body3'))
- }.padding({ left: 24, right: 24, top: 8, bottom: 8 })
- .width('100%')
- .constraintSize({minHeight: 36})
- }
- Row() {
- Checkbox({ name: 'checkbox', group: 'checkboxGroup' }).select(this.isChecked)
- .onChange((checked: boolean) => {
- this.isChecked = checked
- })
- .margin({ left: 0, right: 8})
- Text(this.checkTips).fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .maxLines(CONTENT_MAX_LINES)
- .layoutWeight(1)
- .focusOnTouch(true)
- .onClick(() => {
- this.isChecked = !this.isChecked
- })
- }.height(CHECKBOX_CONTAINER_HEIGHT).width('100%').padding({ left: 24, right: 24 , top: 8, bottom: 8 })
-
- Row() {
- if (this.primaryButton.value) {
- Button(this.primaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.primaryButton.background? this.primaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.primaryButton.action) this.primaryButton.action()
- this.controller.close()
- })
- }
- if (this.secondaryButton.value && this.primaryButton.value) {
- Column() {
- if (!this.secondaryButton.background) {
- Divider().width(DIVIDER_WIDTH).height(DIVIDER_HEIGHT).color($r('sys.color.ohos_id_color_list_separator')).vertical(true)
- }
- }.width(DIVIDER_CONTAINER_WIDTH).alignItems(HorizontalAlign.Center)
- }
- if (this.secondaryButton.value) {
- Button(this.secondaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.secondaryButton.background? this.secondaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.secondaryButton.action) this.secondaryButton.action()
- this.controller.close()
- })
- }
- }.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
- }
- .backgroundBlurStyle(BlurStyle.Thick)
- .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
- .margin({
- left: $r('sys.float.ohos_id_dialog_margin_start'),
- right: $r('sys.float.ohos_id_dialog_margin_end'),
- bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
- })
- // 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
- .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
- }
-}
-
-@CustomDialog
-export struct AlertDialog{
- controller: CustomDialogController
- content: ResourceStr = ''
- primaryButton?: ButtonOptions = {value: ""}
- secondaryButton?: ButtonOptions = {value: ""}
- build() {
- Column() {
- Row() {
- Text(this.content)
- .fontSize($r('sys.float.ohos_id_text_size_body1'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- }.padding({ left: 24, right: 24, top: 24 })
- Row() {
- if (this.primaryButton.value) {
- Button(this.primaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.primaryButton.background? this.primaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.primaryButton.fontColor ? this.primaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.primaryButton.action) this.primaryButton.action()
- this.controller.close()
- })
- }
- if (this.secondaryButton.value && this.primaryButton.value) {
- Column() {
- if (!this.secondaryButton.background) {
- Divider().width(DIVIDER_WIDTH).height(DIVIDER_HEIGHT).color($r('sys.color.ohos_id_color_list_separator')).vertical(true)
- }
- }.width(DIVIDER_CONTAINER_WIDTH).alignItems(HorizontalAlign.Center)
- }
- if (this.secondaryButton.value) {
- Button(this.secondaryButton.value)
- .fontSize($r('sys.float.ohos_id_text_size_button1'))
- .fontWeight(FontWeight.Medium)
- .layoutWeight(1)
- .backgroundColor(this.secondaryButton.background? this.secondaryButton.background: $r('sys.color.ohos_id_color_background_transparent'))
- .fontColor(this.secondaryButton.fontColor ? this.secondaryButton.fontColor: $r('sys.color.ohos_id_color_text_primary_activated'))
- .onClick(() => {
- if (this.secondaryButton.action) this.secondaryButton.action()
- this.controller.close()
- })
- }
- }.width('100%').padding({ left: 16, right: 16, top: 16, bottom: 16 })
- }
- .backgroundBlurStyle(BlurStyle.Thick)
- .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
- .margin({
- left: $r('sys.float.ohos_id_dialog_margin_start'),
- right: $r('sys.float.ohos_id_dialog_margin_end'),
- bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
- })
- // 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
- .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
- }
-}
-
-@CustomDialog
-export struct LoadingDialog{
- controller: CustomDialogController
- content?: ResourceStr = ''
- build() {
- Column() {
- Row() {
- Text(this.content)
- .fontSize($r('sys.float.ohos_id_text_size_body1'))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .layoutWeight(1)
- LoadingProgress().width(LOADING_PROGRESS_WIDTH).height(LOADING_PROGRESS_HEIGHT).margin({ left: 16 })
- }.margin({ left: 24, right: 24, top: 24, bottom: 24 })
- .constraintSize({minHeight: 48})
- }
- .backgroundBlurStyle(BlurStyle.Thick)
- .borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
- .margin({
- left: $r('sys.float.ohos_id_dialog_margin_start'),
- right: $r('sys.float.ohos_id_dialog_margin_end'),
- bottom: $r('sys.float.ohos_id_dialog_margin_bottom')
- })
- // 1.backgroundcolor use in blur enable mod mast set this color: colorDialogBgBlur. but now it is not found
- .backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
- }
-}
\ No newline at end of file
diff --git a/source/ComposeListItem/ComposeListItem.ets b/source/ComposeListItem/ComposeListItem.ets
deleted file mode 100644
index 0c6bb53..0000000
--- a/source/ComposeListItem/ComposeListItem.ets
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-export enum IconType {
- BADGE = 1,
- NORMAL_ICON,
- SYSTEM_ICON,
- HEAD_SCULPTURE,
- APP_ICON,
- PREVIEW,
- LONGITUDINAL,
- VERTICAL
-}
-
-enum ItemHeight {
- FIRST_HEIGHT = 48,
- SECOND_HEIGHT = 56,
- THIRD_HEIGHT = 64,
- FOURTH_HEIGHT = 72,
- FIFTH_HEIGHT = 96
-}
-
-export type OperateItem = {
- icon?: OperateIcon,
- subIcon ?: OperateIcon,
- button?: OperateButton;
- switch?: OperateCheck;
- checkbox?: OperateCheck;
- radio?: OperateCheck;
- image?: ResourceStr;
- text?: ResourceStr;
- arrow?: OperateIcon;
-}
-
-export type ContentItem = {
- iconStyle?: IconType;
- icon?: ResourceStr;
- primaryText?: ResourceStr;
- secondaryText?: ResourceStr;
- description?: ResourceStr;
-}
-
-const LISTITEMCARD_BORDER_HIDDEN = 0;
-const TEXT_MAX_LINE = 1;
-const LISTITEMCARD_BORDER_SHOWN = 2;
-const TEXT_COLUMN_SPACE = 2;
-const TEXT_SAFE_MARGIN = 8;
-const BADGE_SIZE = 8;
-const SMALL_ICON_SIZE = 16;
-const SYSTEM_ICON_SIZE = 24;
-const SAFE_LIST_PADDING = 32;
-const HEADSCULPTURE_SIZE = 40;
-const BUTTON_SIZE = 28;
-const APP_ICON_SIZE = 64;
-const PREVIEW_SIZE = 96;
-const LONGITUDINAL_SIZE = 96;
-const VERTICAL_SIZE = 96;
-const NORMAL_ITEM_ROW_SPACE = 16;
-const SPECIAL_ITEM_ROW_SPACE = 0;
-const SPECIAL_ICON_SIZE = 0;
-const DEFAULT_ROW_SPACE = 0;
-const SPECICAL_ROW_SPACE = 4;
-const OPERATEITEM_ICONLIKE_SIZE = 24;
-const OPERATEITEM_ARROW_WIDTH = 12
-const OPERATEITEM_ICON_CLICKABLE_SIZE = 48;
-const OPERATEITEM_IMAGE_SIZE = 48;
-const HOVERING_COLOR = '#0d000000';
-const TOUCH_DOWN_COLOR = '#1a000000';
-const ACTIVED_COLOR = '#1a0a59f7';
-
-@Component
-struct ContentItemStruct {
- iconStyle: IconType = null
- icon: Resource = null
- title: string = null
- subtitle: string = null
- description: string = null
- private iconSizeMap: Map = new Map([
- [IconType.BADGE, BADGE_SIZE],
- [IconType.NORMAL_ICON, SMALL_ICON_SIZE],
- [IconType.SYSTEM_ICON, SYSTEM_ICON_SIZE],
- [IconType.HEAD_SCULPTURE, HEADSCULPTURE_SIZE],
- [IconType.APP_ICON, APP_ICON_SIZE],
- [IconType.PREVIEW, PREVIEW_SIZE],
- [IconType.LONGITUDINAL, LONGITUDINAL_SIZE],
- [IconType.VERTICAL, VERTICAL_SIZE]
- ])
- private itemHeight: number = ItemHeight.FIRST_HEIGHT
- private itemRowSpace: number = NORMAL_ITEM_ROW_SPACE
-
- aboutToAppear() {
- if (this.subtitle == null && this.description == null) {
- if (this.icon == null) {
- this.itemHeight = ItemHeight.FIRST_HEIGHT
- }
- else {
- this.itemHeight = this.iconStyle <= IconType.HEAD_SCULPTURE ? ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT
- }
- }
- else if (this.description == null) {
- if (this.icon == null || (this.icon != null && this.iconStyle <= IconType.SYSTEM_ICON)) {
- this.itemHeight = ItemHeight.THIRD_HEIGHT
- }
- else {
- this.itemHeight = ItemHeight.FOURTH_HEIGHT
- }
- }
- else {
- this.itemHeight = ItemHeight.FIFTH_HEIGHT
- }
-
- if (this.icon == null && this.iconStyle == null) {
- this.itemRowSpace = SPECIAL_ITEM_ROW_SPACE
- }
-
- if (this.iconSizeMap.get(this.iconStyle) >= this.itemHeight) {
- this.itemHeight = this.iconSizeMap.get(this.iconStyle) + SAFE_LIST_PADDING;
- }
- }
-
- @Builder
- createIcon() {
- if (this.icon != null && this.iconStyle != null) {
- if (this.iconStyle <= IconType.PREVIEW) {
- Image(this.icon)
- .objectFit(ImageFit.Contain)
- .width(this.iconSizeMap.get(this.iconStyle))
- .height(this.iconSizeMap.get(this.iconStyle))
- .borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
- .focusable(true)
- }
- else {
- Image(this.icon)
- .objectFit(ImageFit.Contain)
- .constraintSize({
- minWidth: SPECIAL_ICON_SIZE,
- maxWidth: this.iconSizeMap.get(this.iconStyle),
- minHeight: SPECIAL_ICON_SIZE,
- maxHeight: this.iconSizeMap.get(this.iconStyle)
- })
- .borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
- .focusable(true)
- }
- }
- }
-
- @Builder
- createText() {
- Column({ space: TEXT_COLUMN_SPACE }) {
- Text(this.title)
- .fontSize($r('sys.float.ohos_id_text_size_body1'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .maxLines(TEXT_MAX_LINE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .focusable(true)
- if (this.subtitle != null) {
- Text(this.subtitle)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .maxLines(TEXT_MAX_LINE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .focusable(true)
- }
- if (this.description != null) {
- Text(this.description)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .maxLines(TEXT_MAX_LINE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .focusable(true)
- }
- }
- .margin({
- top: TEXT_SAFE_MARGIN,
- bottom: TEXT_SAFE_MARGIN
- })
- .alignItems(HorizontalAlign.Start)
- }
-
- build() {
- Row({ space: this.itemRowSpace }) {
- this.createIcon()
- this.createText()
- }
- .height(this.itemHeight)
- }
-}
-
-@Component
-struct OperateItemStruct {
- arrow: OperateIcon = null
- icon: OperateIcon = null
- subIcon: OperateIcon = null
- button: OperateButton = null
- switch: OperateCheck = null
- checkBox: OperateCheck = null
- radio: OperateCheck = null
- image: Resource = null
- text: string = null
- @State switchState: boolean = false
- @State radioState: boolean = false
- @State checkBoxState: boolean = false
- private rowSpace: number = DEFAULT_ROW_SPACE
-
- aboutToAppear() {
- if (this.switch != null) {
- this.switchState = this.switch.isCheck
- }
- if (this.radio != null) {
- this.radioState = this.radio.isCheck
- }
- if (this.checkBox != null) {
- this.checkBoxState = this.checkBox.isCheck
- }
-
- if ((this.button == null && this.image == null && this.icon != null && this.text != null) ||
- (this.button == null && this.image == null && this.icon == null && this.arrow != null && this.text != null)) {
- this.rowSpace = SPECICAL_ROW_SPACE
- }
- }
-
- @Builder
- createButton(text: string) {
- Button(text)
- .fontSize($r('sys.float.ohos_id_text_size_button3'))
- .fontColor($r('sys.color.ohos_id_color_text_primary_activated_transparent'))
- .height(BUTTON_SIZE)
- .backgroundColor($r('sys.color.ohos_id_color_button_normal'))
- .labelStyle({
- maxLines: TEXT_MAX_LINE
- })
- }
-
- @Builder
- createIcon(icon: OperateIcon) {
- Row() {
- Image(icon.value)
- .height(OPERATEITEM_ICONLIKE_SIZE)
- .width(OPERATEITEM_ICONLIKE_SIZE)
- .focusable(true)
- .fillColor($r('sys.color.ohos_id_color_primary'))
- }
- .height(OPERATEITEM_ICON_CLICKABLE_SIZE)
- .width(OPERATEITEM_ICON_CLICKABLE_SIZE)
- .justifyContent(FlexAlign.Center)
- .onClick(icon.action)
- }
-
- @Builder
- createImage(image: Resource) {
- Image(image)
- .height(OPERATEITEM_IMAGE_SIZE)
- .width(OPERATEITEM_IMAGE_SIZE)
- }
-
- @Builder
- createText(text: string) {
- Text(text)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .focusable(true)
- }
-
- @Builder
- createArrow(icon: OperateIcon) {
- Image(icon.value)
- .height(OPERATEITEM_ICONLIKE_SIZE)
- .width(OPERATEITEM_ARROW_WIDTH)
- .focusable(true)
- .fillColor($r('sys.color.ohos_id_color_fourth'))
- .onClick(icon.action)
- }
-
- @Builder
- createRadio(radio: OperateCheck) {
- Radio({ value: null, group: null })
- .checked(this.radioState)
- .onChange(radio.onChange)
- .height(OPERATEITEM_ICONLIKE_SIZE)
- .width(OPERATEITEM_ICONLIKE_SIZE)
- }
-
- @Builder
- createCheckBox(checkBox: OperateCheck) {
- Checkbox()
- .select(this.checkBoxState)
- .onChange(checkBox.onChange)
- .height(OPERATEITEM_ICONLIKE_SIZE)
- .height(OPERATEITEM_ICONLIKE_SIZE)
- }
-
- @Builder
- createSwitch(toggleParams: OperateCheck) {
- Row() {
- Toggle({ type: ToggleType.Switch, isOn: this.switchState })
- .onChange(toggleParams.onChange)
- .onClick(() => {
- this.switchState = !this.switchState
- })
- }
- .height(OPERATEITEM_ICON_CLICKABLE_SIZE)
- .width(OPERATEITEM_ICON_CLICKABLE_SIZE)
- .justifyContent(FlexAlign.Center)
- }
-
- build() {
- Row({
- space: this.rowSpace
- }) {
- if (this.button != null) {
- this.createButton(this.button.text)
- }
-
- else if (this.image != null) {
- this.createImage(this.image)
- }
- else if (this.icon != null && this.text != null) {
- this.createText(this.text)
- this.createIcon(this.icon)
- }
- else if (this.arrow != null && this.text == null) {
- this.createArrow(this.arrow)
- }
- else if (this.arrow != null && this.text != null) {
- this.createText(this.text)
- this.createArrow(this.arrow)
- }
- else if (this.text != null) {
- this.createText(this.text)
- }
- else if (this.radio != null) {
- this.createRadio(this.radio)
- }
- else if (this.checkBox != null) {
- this.createCheckBox(this.checkBox)
- }
- else if (this.switch != null) {
- this.createSwitch(this.switch)
- }
- else if (this.icon != null) {
- this.createIcon(this.icon)
- if (this.subIcon != null) {
- this.createIcon(this.subIcon)
- }
- }
- }
- }
-}
-
-/**
- * Declare type OperateIcon
- * @typedef OperationOption
- * @syscap SystemCapability.ArkUI.ArkUI.Full
- * @since 10
- */
-export declare type OperateIcon = {
- /**
- * The content of text or the address of icon.
- * @type { ResourceStr }.
- * @since 10
- */
- value: ResourceStr,
-
- /**
- * Callback function when operate the icon.
- * @type { () => void }.
- * @since 10
- */
- action?: () => void
-}
-
-export type OperateButton = {
- /**
- * The text on the button.
- * @type { ResourceStr }.
- * @since 10
- */
- text?: string
-}
-
-/**
- * Declare type OperateCheck
- * @typedef OperationOption
- * @syscap SystemCapability.ArkUI.ArkUI.Full
- * @since 10
- */
-export declare type OperateCheck = {
- /**
- * Whether is checked on default.
- * @type { ResourceStr }.
- * @since 10
- */
- isCheck?: boolean,
-
- /**
- * Callback function when operate the checkbox/switch/radio.
- * @type { () => void }.
- * @since 10
- */
- onChange?: (value: boolean) => void
-}
-
-@Component
-export struct ComposeListItem {
- @Prop contentItem: ContentItem = null;
- @Prop operateItem: OperateItem = null;
- @State frontColor: string = Color.Transparent.toString()
- @State borderSize: number = 0;
- private isActive: boolean = false
-
- build() {
- Column() {
- Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
- if (this.contentItem == null) {
- ContentItemStruct({
- title: null
- })
- }
- if (this.contentItem != null) {
- ContentItemStruct({
- icon: typeof this.contentItem.icon === 'string' ? null : this.contentItem.icon,
- iconStyle: this.contentItem.iconStyle,
- title: typeof this.contentItem.primaryText === 'string' ? this.contentItem.primaryText : null,
- subtitle: typeof this.contentItem.secondaryText === 'string' ? this.contentItem.secondaryText : null,
- description: typeof this.contentItem.description === 'string' ? this.contentItem.description : null
- })
- }
- if (this.operateItem != null) {
- OperateItemStruct({
- icon: this.operateItem.icon,
- subIcon: this.operateItem.subIcon,
- button: this.operateItem.button,
- switch: this.operateItem.switch,
- checkBox: this.operateItem.checkbox,
- radio: this.operateItem.radio,
- image: typeof this.operateItem.image === 'string' ? null : this.operateItem.image,
- text: typeof this.operateItem.text === 'string' ? this.operateItem.text : null,
- arrow: typeof this.operateItem.arrow === 'string' ? null : this.operateItem.arrow
- })
- }
- }
- .focusable(true)
- .border({
- width: this.borderSize,
- color: $r('sys.color.ohos_id_color_focused_outline')
- })
- .borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
- .backgroundColor(this.frontColor)
- .onFocus(() => {
- this.borderSize = LISTITEMCARD_BORDER_SHOWN
- })
- .onBlur(() => {
- this.borderSize = LISTITEMCARD_BORDER_HIDDEN
- })
- .onHover((isHover: boolean) => {
- this.frontColor = isHover ? HOVERING_COLOR : (this.isActive ? ACTIVED_COLOR : Color.Transparent.toString())
- })
- .onTouch((event: TouchEvent) => {
- if (event.type == TouchType.Down) {
- this.frontColor = TOUCH_DOWN_COLOR
- }
- if (event.type == TouchType.Up) {
- this.frontColor = this.isActive ? ACTIVED_COLOR : Color.Transparent.toString()
- }
- })
- .onClick(() => {
- this.isActive = !this.isActive
- this.frontColor = this.isActive ? ACTIVED_COLOR : Color.Transparent.toString()
- })
- }
- .padding({
- left: $r('sys.float.ohos_id_default_padding_start'),
- right: $r('sys.float.ohos_id_default_padding_end')
- })
- }
-}
\ No newline at end of file
diff --git a/source/ComposeTitleBar/ComposeTitleBar.ets b/source/ComposeTitleBar/ComposeTitleBar.ets
deleted file mode 100755
index 4e26592..0000000
--- a/source/ComposeTitleBar/ComposeTitleBar.ets
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-import { KeyCode } from '@ohos.multimodalInput.keyCode'
-
-export declare type ComposeTitleBarMenuItem = {
- value: ResourceStr
- isEnabled: boolean
- action?: () => void
-}
-
-const PUBLIC_MORE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAY' +
- 'AAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAA' +
- 'AAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuA' +
- 'xhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BI' +
- 'Cydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdY' +
- 'jJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5H' +
- 'nhkC9+zAA5YXXy8jBKV5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rm' +
- 'j79U74wCszuih+F/ljrSi/+uud8YBGA10rayqrnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70' +
- 'zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hkH4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln' +
- '/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ/N5Vjd0oTXKp9QcKF' +
- 'pD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fN' +
- 'Q1BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnX' +
- 'fo96DGYBRZD1ycpc/XzbmbvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jp' +
- 'yaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jv' +
- 'jACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrpVV1fXOOADLA10rq6rrnXEAVga6VlZV13u' +
- 'h8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5LP+r7veGQfgd+T' +
- '+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtU' +
- 'tTXit8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXv' +
- 'O9H8f1bfVPQ9FvQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC'
-
-const PUBLIC_BACK = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAY' +
- 'AAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAA' +
- 'XNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0G' +
- 'iIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr' +
- '+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07' +
- 'vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpg' +
- 'IzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPw' +
- 'IwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2A' +
- 'MtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/' +
- 'aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLn' +
- 'HedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm' +
- '8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+s' +
- 'Py9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE' +
- 'IAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAI' +
- 'EIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6z' +
- 'ELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1' +
- 'ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC'
-
-@Component
-export struct ComposeTitleBar {
- item: ComposeTitleBarMenuItem
- title: ResourceStr
- subtitle: ResourceStr
- menuItems: Array
-
- @State titleMaxWidth: number = 0
- @State isItemOnFocus: boolean = false
-
- private static readonly totalHeight = 56
- private static readonly leftPadding = 12
- private static readonly rightPadding = 12
- private static readonly portraitImageSize = 40
- private static readonly portraitImageLeftPadding = 4
- private static readonly portraitImageRightPadding = 16
-
- build() {
- Flex({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- }) {
- Row() {
- Navigator() {
- ImageMenuItem({ item: {
- value: PUBLIC_BACK,
- isEnabled: true
- } })
- }
- if (this.item !== undefined) {
- Image(this.item.value)
- .width(ComposeTitleBar.portraitImageSize)
- .height(ComposeTitleBar.portraitImageSize)
- .margin({
- left: $r('sys.float.ohos_id_text_paragraph_margin_xs'),
- right: $r('sys.float.ohos_id_text_paragraph_margin_m')
- })
- .focusable(this.item.isEnabled)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .onFocus(() => this.isItemOnFocus = true)
- .onBlur(() => this.isItemOnFocus = false)
- .border(this.isItemOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onClick(() => this.item.isEnabled && this.item.action && this.item.action())
- }
- Column() {
- if (this.title !== undefined) {
- Row() {
- Text(this.title)
- .fontWeight(FontWeight.Medium)
- .fontSize($r('sys.float.ohos_id_text_size_headline8'))
- .fontColor($r('sys.color.ohos_id_color_titlebar_text'))
- .maxLines(this.subtitle !== undefined ? 1 : 2)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ maxWidth: this.titleMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- }
- if (this.subtitle !== undefined) {
- Row() {
- Text(this.subtitle)
- .fontSize($r('sys.float.ohos_id_text_size_over_line'))
- .fontColor($r('sys.color.ohos_id_color_titlebar_subtitle_text'))
- .maxLines(1)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ maxWidth: this.titleMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- }
- }
- .justifyContent(FlexAlign.Start)
- .alignItems(HorizontalAlign.Start)
- .constraintSize({ maxWidth: this.titleMaxWidth })
- }
- .margin({ left: $r('sys.float.ohos_id_default_padding_start') })
- if (this.menuItems !== undefined && this.menuItems.length > 0) {
- CollapsibleMenuSection({ menuItems: this.menuItems })
- }
- }
- .width('100%')
- .height(ComposeTitleBar.totalHeight)
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- let newWidth = Number(newValue.width)
- if (this.menuItems !== undefined) {
- let menusLength = this.menuItems.length
- if (menusLength >= CollapsibleMenuSection.maxCountOfVisibleItems) {
- newWidth = newWidth - ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems
- } else if (menusLength > 0) {
- newWidth = newWidth - ImageMenuItem.imageHotZoneWidth * menusLength
- }
- }
- this.titleMaxWidth = newWidth
- this.titleMaxWidth -= ComposeTitleBar.leftPadding
- this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth
- if (this.item !== undefined) {
- this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding
- + ComposeTitleBar.portraitImageSize
- + ComposeTitleBar.portraitImageRightPadding
- }
- this.titleMaxWidth -= ComposeTitleBar.rightPadding
- })
- }
-}
-
-@Component
-struct CollapsibleMenuSection {
- menuItems: Array
-
- static readonly maxCountOfVisibleItems = 3
- private static readonly focusPadding = 4
- private static readonly marginsNum = 2
-
- @State isPopupShown: boolean = false
-
- @State isMoreIconOnFocus: boolean = false
- @State isMoreIconOnHover: boolean = false
- @State isMoreIconOnClick: boolean = false
-
- getMoreIconFgColor() {
- return this.isMoreIconOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getMoreIconBgColor() {
- if (this.isMoreIconOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isMoreIconOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Column() {
- Row() {
- if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) {
- ForEach(this.menuItems, (item) => {
- ImageMenuItem({ item: item })
- })
- } else {
- ForEach(this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (item) => {
- ImageMenuItem({ item: item })
- })
-
- Row() {
- Image(PUBLIC_MORE)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(true)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getMoreIconFgColor())
- .backgroundColor(this.getMoreIconBgColor())
- .justifyContent(FlexAlign.Center)
- .border(this.isMoreIconOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => this.isMoreIconOnFocus = true)
- .onBlur(() => this.isMoreIconOnFocus = false)
- .onHover((isOn) => this.isMoreIconOnHover = isOn)
- .onKeyEvent((event) => {
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onClick(() => this.isPopupShown = true)
- .bindPopup(this.isPopupShown, {
- builder: this.popupBuilder,
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: false,
- onStateChange: (e) => this.isPopupShown = e.isVisible
- })
- }
- }
- }
- .height('100%')
- .margin({ right: $r('sys.float.ohos_id_default_padding_end') })
- .justifyContent(FlexAlign.Center)
- }
-
- @Builder popupBuilder() {
- Column() {
- ForEach(this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), (item, _index?) => {
- ImageMenuItem({ item: item })
- })
- }
- .width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum)
- .margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding })
- }
-}
-
-@Component
-struct ImageMenuItem {
- item: ComposeTitleBarMenuItem
-
- static readonly imageSize = 24
- static readonly imageHotZoneWidth = 48
- static readonly buttonBorderRadius = 8
- static readonly focusBorderWidth = 2
- static readonly disabledImageOpacity = 0.4
-
- @State isOnFocus: boolean = false
- @State isOnHover: boolean = false
- @State isOnClick: boolean = false
-
- getFgColor() {
- return this.isOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getBgColor() {
- if (this.isOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Row() {
- Image(this.item.value)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(this.item.isEnabled)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getFgColor())
- .backgroundColor(this.getBgColor())
- .justifyContent(FlexAlign.Center)
- .opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity)
- .border(this.isOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnFocus = true
- })
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnHover = isOn
- })
- .onKeyEvent((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.item.isEnabled && this.item.action && this.item.action())
- }
-}
-
-export default {ComposeTitleBar}
\ No newline at end of file
diff --git a/source/EditableTitleBar/EditableTitleBar.ets b/source/EditableTitleBar/EditableTitleBar.ets
deleted file mode 100755
index fffa70e..0000000
--- a/source/EditableTitleBar/EditableTitleBar.ets
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-import { KeyCode } from '@ohos.multimodalInput.keyCode'
-
-export enum EditableLeftIconType {
- Back,
- Cancel
-}
-
-export declare type EditableTitleBarMenuItem = {
- value: ResourceStr
- isEnabled: boolean
- action?: () => void
-}
-
-const PUBLIC_CANCEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3Gw' +
- 'HAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IA' +
- 'rs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABKpJREFUeNrt3bFrlHccx/Ff4o2dgkOQ4' +
- 'JzR4SYJgksnbYcGOrTQsUPtpE4d/RNcFBeFlg7NUlTSTrXQQgsKGV0KHTs4ODiJSL8PdxaUGJK7pPc893m94TvleZLnnt' +
- '/7fcc9z5FrDQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnDQrPTuej2u2a87VvKp5XLNT87OlGiSf1lx' +
- '6Zz2/q3kkgLdZr7k5lX8/7tZ8XfOCU4OgW887U/n341bN9T6s56menLAfaj464OfdM8iF6XYv+dV7+X+pOX/ANuOatZqH' +
- 'Amjti5prh9jurAgGI//mIbbtIvi15u9FHvBqD07a50fYdqtmt+YDrg1a/jd8tuiD7kMA4yNuL4LlkH+WtV/KAEYz7COC4' +
- 'cs/69ovXQB7M+4ngmHLP8/aL1UAD+bYVwTDlX/etT8W+nAV6M82uQS6PuP+rg4NV/5vBNDa6za5HLY9xzO5CIYl/9OaT5' +
- 'obYf/xrE1uioggQ/6LNf/04QGd6tHJFQH5owMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH' +
- '54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDEAH54wMQAfnjAxAB+eMDSI6A/AKIjYD8AoiN' +
- 'gPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI2A/AKIj' +
- 'YD8AoiNgPwCiI2A/AKIjYD8AoiNgPwCiI1gjfyLY8UpmJnNqbjrc/yO32pOk98rQPIrwWnyCyA5AvILQATkF4AIyC8AEZ' +
- 'BfACIgvwBEQH4BiID8J8qqU3BiPJ8O+XuMO8Eng8/2CID85BcA+ckvAPKT35tg8h+n/KP2/3/2SADojfzf1+yKYH7cBxi' +
- 'm/N39hWX8RnsBkP9Q8r9BBAKIlV8EAoiXXwQCiJdfBAKIl18EAoiXXwQz4D5A/+Tv2KjZmuPvdfu6T+AVYJDyd3Qfo17G' +
- 'b7QXAPkPzTMRCCBVfhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RCCBefhEIIF5+EQggXn4RC' +
- 'CBefhEIIF5+EQggXn4RCCBefhEIwD+qFUFuAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0' +
- 'FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBbADkF0FsAOQXQWwA5BdBdAD3a8bkj4rgTM2PAmj' +
- 'ty5or5I+L4FzNHzV/LfKB9OGb4rfJP0iO49xvL/pB9CGAMfljIxgLoLUR+WMjGAmgtT3yx0awJ4DWdsgfG8HOog+6D1eB' +
- 'ntR8WLNB/sFzlKtDnfw3BNDa65rfp2+I3hfBo5rL5B9UBFttcoNzP35qk8vfLxZ9sCs9OnHdG6Kvps8e3TXiVzWPp88Ut' +
- '3k1OLr1vFpz6Z31/LbmntMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAO/wLvsR65mx80NAAAAABJRU' +
- '5ErkJggg=='
-
-const PUBLIC_OK = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3' +
- 'GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZ' +
- 'iS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA+lJREFUeNrt3bFrFgccx+GLlSDi4JDBITiJZHBwEBGRIoqKoIu6iVMd3' +
- 'OosCg6W0sm/wEFUDDgpCDoIDoqOKqIoHUrp4CDFoUMRB39HLotoeXMpMXff54EfFE0ivv1+kpQGrmkAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAIBJTHkJGIhddT/V7ajbUPey7l7dlbpPAmCs1tb9Wne2++cvPa07Vfd7nw/+g9eXVT7+m3Wn69Z8421m6w7WXa37KADGN' +
- 'v4TE7ztTN36uvtL/UPWeJ0Z+PgXnejzBwmAMYx/8VuhTQIgcfy9CYCxjP9D3TsBkPqZf95XAFLH3372vyAAEsf/T93Ruvd93tn/CWbo4z9' +
- 'c96jvBxAAseMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0' +
- 'eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eMXANHjFwDR4xcA0eP/HgG0z3f9uVl45uu2ZuGBBu3zXn9rej7mEuMfSgDtA46v1c195ff+rbt' +
- 'U94stGv9KWqnHpLaPsXxSt/k//iXsq9vY9HjUJca/2gNoH2e/c4K32yUC4x9bAOvqrjeTP41GBMY/qgC2151Z4vuIwPhXxEo8I2xdz/c7W' +
- '3fZXo1/6F8B/q471/N9fSUw/sEH8LEb8hYRGH9iAK3HdafrpkVg/IkBtA8yflt3bBn/3SEC4x9sAK3Xda9EYPypAYjA+OMDEIHxxwcgAuO' +
- 'PD0AExh8fgAiMPz4AERh/fAAiMP74AERg/PEBiMD44wMQgfHHByAC448PQATGHx+ACIw/PgARGH98AMkRGL8AYiMwfgHERmD8AoiNwPgFE' +
- 'BuB8QsgNgLjF0BsBMYvgNgIjF8AsREYvwBiIzB+AcRGYPwCiI3A+AUQG4HxCyA2AuMXQGwExi+A2AiMXwCxERi/AGIjMH4BjDaCTXUP6j5' +
- '9423aJ2PeMH4BjDWCHd24n9f9+cXvHa+7U7fb+Fe/qeC/ezvU+e5bleX40A11pm6u+xapMX5fARK+Eix+u7O1brbp/1Bw4xfAoCP4Pxi/A' +
- 'GIjMH4BxEZg/AKIjcD4BRAbgfELIDYC4xdAbATGL4DYCIxfAIOL4EXdkbrpZX6sd3WH6p56WQUwJG/qbtX92Cz8EFwfD+sO1L31cq4uU16' +
- 'CibU/M3Sy7nzdlgnf51ndxbrbXj4BjCmEPXX76/Y2Cz8DNNP9+l91f3Sf8e92AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAzKZwK1uX4kZ6mnAAAAAElFTkSuQmCC'
-
-const PUBLIC_BACK = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAY' +
- 'AAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAA' +
- 'XNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0G' +
- 'iIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr' +
- '+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07' +
- 'vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpg' +
- 'IzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPw' +
- 'IwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2A' +
- 'MtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/' +
- 'aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLn' +
- 'HedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm' +
- '8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+s' +
- 'Py9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE' +
- 'IAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAI' +
- 'EIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6z' +
- 'ELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1' +
- 'ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC'
-
-@Component
-export struct EditableTitleBar {
- leftIconStyle: EditableLeftIconType
- title: ResourceStr
- menuItems: Array
- onSave?: () => void
- onCancel?: () => void
-
- @State titleMaxWidth: number = 0
-
- static readonly maxCountOfExtraItems = 2
- private static readonly totalHeight = 56
- private static readonly leftPadding = 12
- private static readonly rightPadding = 12
- private static readonly titlePadding = 16
-
- build() {
- Flex({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- }) {
- Row() {
- if (this.leftIconStyle == EditableLeftIconType.Back) {
- Navigator() {
- ImageMenuItem({ item: {
- value: PUBLIC_BACK,
- isEnabled: true
- } })
- }
- } else {
- ImageMenuItem({ item: {
- value: PUBLIC_CANCEL,
- isEnabled: true,
- action: () => this.onCancel && this.onCancel()
- } })
- }
-
- Column() {
- Text(this.title)
- .fontWeight(FontWeight.Medium)
- .fontSize($r('sys.float.ohos_id_text_size_headline8'))
- .fontColor($r('sys.color.ohos_id_color_titlebar_text'))
- .maxLines(1)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ maxWidth: this.titleMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- .alignItems(HorizontalAlign.Start)
- .constraintSize({ maxWidth: this.titleMaxWidth })
- }
- .margin({ left: $r('sys.float.ohos_id_default_padding_start') })
-
- EditableTitleBarMenuSection({
- menuItems: this.menuItems,
- onSave: this.onSave
- })
- }
- .width('100%')
- .height(EditableTitleBar.totalHeight)
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- let nValue = Number(newValue.width)
- nValue = nValue - EditableTitleBar.leftPadding - EditableTitleBar.rightPadding - EditableTitleBar.titlePadding
- nValue = nValue - ImageMenuItem.imageHotZoneWidth - ImageMenuItem.imageHotZoneWidth
- if (this.menuItems === undefined) {
- this.titleMaxWidth = nValue
- return
- }
- if (this.menuItems.length > EditableTitleBar.maxCountOfExtraItems) {
- this.titleMaxWidth = nValue - ImageMenuItem.imageHotZoneWidth * EditableTitleBar.maxCountOfExtraItems
- } else {
- this.titleMaxWidth = nValue - ImageMenuItem.imageHotZoneWidth * this.menuItems.length
- }
- })
- }
-}
-
-@Component
-struct EditableTitleBarMenuSection {
- menuItems: Array
- onSave?: () => void
-
- build() {
- Column() {
- Row() {
- if (this.menuItems !== undefined && this.menuItems.length > 0) {
- ForEach(this.menuItems.slice(0, EditableTitleBar.maxCountOfExtraItems), (item: EditableTitleBarMenuItem) => {
- ImageMenuItem({ item: item })
- })
- }
- ImageMenuItem({ item: {
- value: PUBLIC_OK,
- isEnabled: true,
- action: () => this.onSave && this.onSave()
- } })
- }
- }
- .margin({
- left: $r('sys.float.ohos_id_elements_margin_vertical_l'),
- right: $r('sys.float.ohos_id_default_padding_end')
- })
- .justifyContent(FlexAlign.Center)
- }
-}
-
-@Component
-struct ImageMenuItem {
- item: EditableTitleBarMenuItem
-
- static readonly imageSize = 24
- static readonly imageHotZoneWidth = 48
- static readonly buttonBorderRadius = 8
- static readonly focusBorderWidth = 2
- static readonly disabledImageOpacity = 0.4
-
- @State isOnFocus: boolean = false
- @State isOnHover: boolean = false
- @State isOnClick: boolean = false
-
- getFgColor() {
- return this.isOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getBgColor() {
- if (this.isOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Row() {
- Image(this.item.value)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(this.item.isEnabled)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getFgColor())
- .backgroundColor(this.getBgColor())
- .justifyContent(FlexAlign.Center)
- .opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity)
- .border(this.isOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnFocus = true
- })
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnHover = isOn
- })
- .onKeyEvent((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.item.isEnabled && this.item.action && this.item.action())
- }
-}
-
-export default { EditableLeftIconType, EditableTitleBar }
\ No newline at end of file
diff --git a/source/Filter/Filter.ets b/source/Filter/Filter.ets
deleted file mode 100644
index eaddb3b..0000000
--- a/source/Filter/Filter.ets
+++ /dev/null
@@ -1,1025 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-import measure from '@ohos.measure'
-import curves from '@ohos.curves'
-
-const TEXT_HOT_AREA_WIDTH: number = 8
-const LIST_ROW_HEIGHT: number = 40
-const ARROW_IMG_SIZE: number = 24
-const MULTI_LINE_PADDING: number = 24
-const BAR_ANIMATION_DURATION: number = 150
-const ARROW_ANIMATION_DURATION: number = 200
-const ANIMATION_DURATION_250: number = 250
-const ANIMATION_DURATION_100: number = 100
-const FILTER_TOP_PADDING: number = 8
-const SEPARATOR_HEIGHT: number = 16
-const SEPARATOR_WIDTH: number = 1
-const FLOAT_OPACITY: number = 0.95
-const FILTER_FONT_SIZE = 12
-const FOCUS_BORDER_WIDTH = 2
-const ARROW_SHOW_DELAY = 300
-const PERCENT_100: Length = '100%'
-const SHARP_CUBIC_BEZIER = curves.cubicBezierCurve(0.33, 0, 0.67, 1)
-const INTER_POLATING_SPRING = curves.interpolatingSpring(0, 1, 328, 34)
-const FRICTION_CUBIC_BEZIER = curves.cubicBezierCurve(0.2, 0, 0.2, 1)
-const TRANS_COLOR: string = '#00FFFFFF'
-
-export enum FilterType {
- MULTI_LINE_FILTER,
- LIST_FILTER
-}
-
-export declare type FilterParams = {
- name: ResourceStr,
- options: Array
-}
-
-export declare type FilterResult = {
- name: ResourceStr,
- index: number,
- value: ResourceStr
-}
-
-@Observed
-class FontWeightArray extends Array {
-}
-
-@Observed
-class ResourceArray extends Array {
-}
-
-@Observed
-class BooleanArray extends Array {
-}
-
-@Observed
-export class ObservedBoolean {
- public value: boolean
-
- constructor(value: boolean) {
- this.value = value
- }
-}
-
-@Observed
-class ObservedNumber {
- public value: number
-
- constructor(value: number) {
- this.value = value
- }
-}
-
-@Component
-struct ListFilterRow {
- @ObjectLink colorRow: ResourceArray
- @ObjectLink fontWeightRow: FontWeightArray
- @ObjectLink backgroundColorRow: ResourceArray
- @ObjectLink isBackgroundHoverRow: BooleanArray
- filterRow: FilterParams
- onItemClick: (colIndex: number) => void
-
- build() {
- List() {
- ForEach(this.filterRow.options, (option, colIndex?: number) => {
- ListItem() {
- Text(option.toString())
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- .fontColor(this.colorRow[colIndex])
- .fontWeight(this.fontWeightRow[colIndex])
- .focusable(true)
- }
- .height(PERCENT_100)
- .onClick(() => {
- this.onItemClick(colIndex)
- })
- .focusable(true)
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .padding({
- left: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH,
- right: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH
- })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .padding({ left: TEXT_HOT_AREA_WIDTH, right: TEXT_HOT_AREA_WIDTH })
- }
- })
- .backgroundColor(this.isBackgroundHoverRow[colIndex] ? this.backgroundColorRow[colIndex] : TRANS_COLOR)
- .onHover((isHover: boolean) => {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- if (isHover) {
- this.backgroundColorRow[colIndex] = $r('sys.color.ohos_id_color_hover')
- this.isBackgroundHoverRow[colIndex] = true
- } else {
- this.isBackgroundHoverRow[colIndex] = false
- }
- })
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.backgroundColorRow[colIndex] = $r('sys.color.ohos_id_color_click_effect')
- this.isBackgroundHoverRow[colIndex] = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isBackgroundHoverRow[colIndex] = false
- })
- }
- })
- })
- }
- .listDirection(Axis.Horizontal)
- .margin({ left: -TEXT_HOT_AREA_WIDTH * 2 })
- .scrollBar(BarState.Off)
- .width(PERCENT_100)
- .height(LIST_ROW_HEIGHT)
- .align(Alignment.Start)
- }
-}
-
-@Component
-struct MultiFilterRow {
- @ObjectLink colorRow: ResourceArray
- @ObjectLink fontWeightRow: FontWeightArray
- @ObjectLink backgroundColorRow: ResourceArray
- @ObjectLink isBackgroundHoverRow: BooleanArray
- @ObjectLink twoLineModeItemNumRow: ObservedNumber
- @ObjectLink twoLineModeItemNumRecordRow: ObservedNumber
- @ObjectLink arrowShowStateRow: ObservedBoolean
- @ObjectLink isArrowIconDown: ObservedBoolean
- filterRow: FilterParams = null
- onItemClick: (colIndex: number) => void
- @State arrowBgColorRow: Resource = $r('sys.color.ohos_id_color_hover')
- @State isArrowBgHoverRow: boolean = false
- private filterColumnWidth: number = 0
-
- private calcMultiFilterRowItemNum() {
- var curLineRetainWidth = this.filterColumnWidth - vp2px(MULTI_LINE_PADDING)
- var curLineSum = 0
- var curLine = 1
- for (var i = 0; i < this.filterRow.options.length; i++) {
- let option = this.filterRow.options[i]
- let itemWidth = measure.measureText({
- textContent: option,
- fontSize: FILTER_FONT_SIZE
- })
- if (i === 0) {
- continue
- } else {
- itemWidth += vp2px(TEXT_HOT_AREA_WIDTH * 2)
- }
- if (curLineRetainWidth - itemWidth > 0) {
- curLineRetainWidth -= itemWidth
- curLineSum += 1
- } else {
- if (curLineSum === 0) {
- curLineSum++
- curLineRetainWidth = 0
- }
- if (curLine === 1) {
- curLine += 1
- curLineRetainWidth = this.filterColumnWidth - vp2px(ARROW_IMG_SIZE) - vp2px(MULTI_LINE_PADDING)
- i--
- } else {
- break
- }
- }
- }
- return curLineSum
- }
-
- @Builder DownAndUpArrow() {
- Row() {
- Image(this.isArrowIconDown.value ? $r('sys.media.ohos_ic_public_arrow_down') : $r('sys.media.ohos_ic_public_arrow_up'))
- .width(ARROW_IMG_SIZE)
- .height(LIST_ROW_HEIGHT)
- .fillColor($r('sys.color.ohos_id_color_tertiary'))
- .focusable(true)
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .width(ARROW_IMG_SIZE + FOCUS_BORDER_WIDTH * 2)
- .offset({ x: -FOCUS_BORDER_WIDTH })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .width(ARROW_IMG_SIZE)
- .offset({ x: 0 })
- }
- })
- }
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked')
- })
- .height(LIST_ROW_HEIGHT)
- .width(ARROW_IMG_SIZE)
- .backgroundColor(this.isArrowBgHoverRow ? this.arrowBgColorRow : TRANS_COLOR)
- .focusable(true)
- .visibility(this.arrowShowStateRow.value ? Visibility.Visible : Visibility.Hidden)
- .onHover((isHover: boolean) => {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- if (isHover) {
- this.arrowBgColorRow = $r('sys.color.ohos_id_color_hover')
- this.isArrowBgHoverRow = true
- } else {
- this.isArrowBgHoverRow = false
- }
- })
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.arrowBgColorRow = $r('sys.color.ohos_id_color_click_effect')
- this.isArrowBgHoverRow = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isArrowBgHoverRow = false
- })
- }
- })
- .onClick(() => {
- if (this.isArrowIconDown.value) {
- this.isArrowIconDown.value = false
- this.arrowShowStateRow.value = false
- animateTo({
- curve: INTER_POLATING_SPRING,
- }, () => {
- this.twoLineModeItemNumRow.value = this.filterRow.options.length
- })
-
- animateTo({
- delay: 300,
- duration: ARROW_ANIMATION_DURATION,
- curve: SHARP_CUBIC_BEZIER
- }, () => {
- this.arrowShowStateRow.value = true
- })
- } else {
- this.isArrowIconDown.value = true
- this.arrowShowStateRow.value = false
-
- animateTo({
- curve: INTER_POLATING_SPRING,
- }, () => {
- this.twoLineModeItemNumRow.value = this.twoLineModeItemNumRecordRow.value
- })
- animateTo({
- delay: ARROW_SHOW_DELAY,
- duration: ARROW_ANIMATION_DURATION,
- curve: SHARP_CUBIC_BEZIER
- }, () => {
- this.arrowShowStateRow.value = true
- })
- }
-
- })
-
- }
-
- build() {
- Row() {
- if (this.filterRow.options && this.filterRow.options.length > 0) {
- Text(this.filterRow.options[0].toString())
- .height(LIST_ROW_HEIGHT)
- .width(px2vp(measure.measureText({
- textContent: this.filterRow.options[0].toString(),
- fontSize: FILTER_FONT_SIZE
- })) + (TEXT_HOT_AREA_WIDTH * 2))
- .margin({ left: -TEXT_HOT_AREA_WIDTH })
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- .fontColor(this.colorRow[0])
- .fontWeight(this.fontWeightRow[0])
- .backgroundColor(this.isBackgroundHoverRow[0] ? this.backgroundColorRow[0] : TRANS_COLOR)
- .onClick(() => {
- this.onItemClick(0)
- })
- .focusable(true)
- .onHover((isHover: boolean) => {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- if (isHover) {
- this.backgroundColorRow[0] = $r('sys.color.ohos_id_color_hover')
- this.isBackgroundHoverRow[0] = true
- } else {
- this.isBackgroundHoverRow[0] = false
- }
- })
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.backgroundColorRow[0] = $r('sys.color.ohos_id_color_click_effect')
- this.isBackgroundHoverRow[0] = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isBackgroundHoverRow[0] = false
- })
- }
- })
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .padding({
- left: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH,
- right: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH
- })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .padding({ left: TEXT_HOT_AREA_WIDTH, right: TEXT_HOT_AREA_WIDTH })
- }
- })
- }
- Row() {
- Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap }) {
- ForEach(this.filterRow.options.slice(0, this.twoLineModeItemNumRow.value + 1), (option, colIndex?: number) => {
- if (colIndex > 0) {
- Text(option.toString())
- .transition(TransitionEffect.OPACITY)
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- .height(LIST_ROW_HEIGHT)
- .fontColor(this.colorRow[colIndex])
- .fontWeight(this.fontWeightRow[colIndex])
- .backgroundColor(this.isBackgroundHoverRow[colIndex] ? this.backgroundColorRow[colIndex] : TRANS_COLOR)
- .onClick(() => {
- this.onItemClick(colIndex)
- })
- .onHover((isHover: boolean) => {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- if (isHover) {
- this.backgroundColorRow[colIndex] = $r('sys.color.ohos_id_color_hover')
- this.isBackgroundHoverRow[colIndex] = true
- } else {
- this.isBackgroundHoverRow[colIndex] = false
- }
- })
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.backgroundColorRow[colIndex] = $r('sys.color.ohos_id_color_click_effect')
- this.isBackgroundHoverRow[colIndex] = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isBackgroundHoverRow[colIndex] = false
- })
- }
- })
- .focusable(true)
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .padding({
- left: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH,
- right: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH
- })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .padding({ left: TEXT_HOT_AREA_WIDTH, right: TEXT_HOT_AREA_WIDTH })
- }
- })
- }
- })
- this.DownAndUpArrow()
- }.alignSelf(ItemAlign.Stretch)
- }.width(PERCENT_100)
- .padding({ right: $r('sys.float.ohos_id_max_padding_end') })
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- this.filterColumnWidth = vp2px(parseInt(newValue.width.toString(), 0))
- if (this.twoLineModeItemNumRow.value === 0) {
- var curLineSum = this.calcMultiFilterRowItemNum()
- this.twoLineModeItemNumRow.value = curLineSum
- this.twoLineModeItemNumRecordRow.value = curLineSum
- if (curLineSum < this.filterRow.options.length - 1) {
- this.arrowShowStateRow.value = true
- } else {
- this.arrowShowStateRow.value = false
- }
- }
- })
-
- }.width(PERCENT_100)
- .alignItems(VerticalAlign.Top)
- .padding({ left: $r('sys.float.ohos_id_max_padding_start'), right: $r('sys.float.ohos_id_max_padding_end') })
- }
-}
-
-
-@Component
-export struct Filter {
- @BuilderParam container: () => void
- @Prop multiFilters: Array = []
- @Prop additionFilters: FilterParams = null
- onFilterChanged: (filterResults: Array) => void = null
- @Prop filterType: FilterType = FilterType.LIST_FILTER
- private selectedFilters: Array = null
- @State private colorArr: Array = null
- @State private fontWeightArr: Array = null
- @State private backgroundColorArr: Array = null
- @State private isBackgroundHover: Array = null
- @State private floatArrowBgColor: Resource = null
- @State private isFloatArrowBgHover: boolean = false
- @State private isArrowIconDownArr: Array = null
- @State private additionColorArr: Array = null
- @State private additionFontWeightArr: Array = null
- @State private additionBackgroundColorArr: Array = null
- @State private isAdditionBackgroundHover: Array = null
- @State colorRefresh: boolean = false
- @State isFloatBarShow: boolean = false
- isFloatBarShowWithoutAnimation: boolean = false
- @State isFloatShowAllFilter: boolean = false
- isFloatShowAllFilterWithoutAnimation: boolean = false
- @State floatFilterPosition: number = 0
- @State floatFilterBarHeight: number = 0
- @State floatFilterBarPosition: number = 0
- filterDynamicHeight: number = 0
- @State twoLineModeItemNum: Array = null
- @State twoLineModeItemNumRecord: Array = null
- @State downArrowShowState: Array = null
-
- textColor(rowIndex: number, colIndex: number) {
- if (this.selectedFilters.length > rowIndex && this.selectedFilters[rowIndex].index === colIndex) {
- return $r('sys.color.ohos_id_color_text_primary_activated')
- }
- return $r('sys.color.ohos_id_color_text_primary')
- }
-
- aboutToAppear() {
- this.initParams()
- }
-
- private filterItemClick(rowIndex: number, colIndex: number) {
- let selectedFilterValue = this.multiFilters[rowIndex].options[colIndex]
- if (colIndex != this.selectedFilters[rowIndex].index) {
- this.colorArr[rowIndex][colIndex] = $r('sys.color.ohos_id_color_text_primary_activated')
- this.colorArr[rowIndex][this.selectedFilters[rowIndex].index] = $r('sys.color.ohos_id_color_text_primary')
- this.fontWeightArr[rowIndex][colIndex] = FontWeight.Medium
- this.fontWeightArr[rowIndex][this.selectedFilters[rowIndex].index] = FontWeight.Regular
- this.colorRefresh = !this.colorRefresh
- this.selectedFilters[rowIndex].value = selectedFilterValue
- this.selectedFilters[rowIndex].index = colIndex
- this.onFilterChanged && this.onFilterChanged(this.selectedFilters);
- }
- }
-
- private initParams() {
- if (!this.selectedFilters) {
- this.selectedFilters = []
- for (let filter of this.multiFilters) {
- var result: FilterResult = { name: filter.name, index: -1, value: null }
- if (filter.options.length > 0) {
- result.index = 0
- result.value = filter.options[0]
- }
- this.selectedFilters.push(result)
- }
- if (this.additionFilters && this.additionFilters.name) {
- var result: FilterResult = { name: this.additionFilters.name, index: -1, value: null }
- this.selectedFilters.push(result)
- }
- }
- if (!this.colorArr) {
- this.colorArr = []
- this.backgroundColorArr = []
- this.isBackgroundHover = []
- this.fontWeightArr = []
- this.isArrowIconDownArr = []
- this.floatArrowBgColor = $r('sys.color.ohos_id_color_hover')
- for (let filter of this.multiFilters) {
- var colorRow = new ResourceArray()
- var fontWeightRow = new FontWeightArray()
- var backgroundColorRow = new ResourceArray()
- var isBackgroundHoverRow = new BooleanArray()
- for (let index of filter.options.keys()) {
- if (index === 0) {
- colorRow.push($r('sys.color.ohos_id_color_text_primary_activated'))
- fontWeightRow.push(FontWeight.Medium)
- } else {
- colorRow.push($r('sys.color.ohos_id_color_text_primary'))
- fontWeightRow.push(FontWeight.Regular)
- }
- backgroundColorRow.push($r('sys.color.ohos_id_color_hover'))
- }
- this.colorArr.push(colorRow)
- this.fontWeightArr.push(fontWeightRow)
- this.backgroundColorArr.push(backgroundColorRow)
- this.isBackgroundHover.push(isBackgroundHoverRow)
- this.isArrowIconDownArr.push(new ObservedBoolean(true))
- }
- }
- if (this.additionFilters && this.additionFilters.options) {
- this.additionColorArr = []
- this.additionFontWeightArr = []
- this.additionBackgroundColorArr = []
- this.isAdditionBackgroundHover = []
- for (let i = 0; i < this.additionFilters.options.length; i++) {
- this.additionColorArr.push($r('sys.color.ohos_id_color_text_primary'))
- this.additionFontWeightArr.push(FontWeight.Regular)
- this.additionBackgroundColorArr.push($r('sys.color.ohos_id_color_hover'))
- this.isAdditionBackgroundHover.push(false)
- }
- }
- if (!this.twoLineModeItemNum) {
- this.twoLineModeItemNum = []
- this.twoLineModeItemNumRecord = []
- this.downArrowShowState = []
- for (let i = 0; i < this.multiFilters.length; i++) {
- this.twoLineModeItemNum.push(new ObservedNumber(0))
- this.twoLineModeItemNumRecord.push(new ObservedNumber(0))
- this.downArrowShowState.push(new ObservedBoolean(false))
- }
- }
- }
-
- @Builder ListFilter() {
- Column() {
- ForEach(this.multiFilters, (filter: FilterParams, rowIndex?: number) => {
- ListFilterRow({
- colorRow: this.colorArr[rowIndex],
- fontWeightRow: this.fontWeightArr[rowIndex],
- backgroundColorRow: this.backgroundColorArr[rowIndex],
- isBackgroundHoverRow: this.isBackgroundHover[rowIndex],
- filterRow: filter,
- onItemClick: (colIndex: number) => {
- this.filterItemClick(rowIndex, colIndex);
- }
- })
- })
- }.width(PERCENT_100)
- .align(Alignment.Start)
- .padding({ left: $r('sys.float.ohos_id_max_padding_start') })
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- if (!this.isFloatShowAllFilterWithoutAnimation && !this.isFloatBarShowWithoutAnimation) {
- if (this.additionFilters != null) {
- this.filterDynamicHeight = parseInt(newValue.height.toString(), 0) + LIST_ROW_HEIGHT + FILTER_TOP_PADDING
- } else {
- this.filterDynamicHeight = parseInt(newValue.height.toString(), 0) + FILTER_TOP_PADDING
- }
- this.floatFilterPosition = -this.filterDynamicHeight
- }
- })
- }
-
- @Builder MultiLineFilter() {
- Column() {
- ForEach(this.multiFilters, (filterItem: FilterParams, rowIndex?: number) => {
- MultiFilterRow({
- colorRow: this.colorArr[rowIndex],
- fontWeightRow: this.fontWeightArr[rowIndex],
- backgroundColorRow: this.backgroundColorArr[rowIndex],
- isBackgroundHoverRow: this.isBackgroundHover[rowIndex],
- arrowShowStateRow: this.downArrowShowState[rowIndex],
- twoLineModeItemNumRow: this.twoLineModeItemNum[rowIndex],
- twoLineModeItemNumRecordRow: this.twoLineModeItemNumRecord[rowIndex],
- isArrowIconDown: this.isArrowIconDownArr[rowIndex],
- filterRow: filterItem,
- onItemClick: (colIndex: number) => {
- this.filterItemClick(rowIndex, colIndex);
- }
- })
- })
- }.width(PERCENT_100)
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- if (this.additionFilters != null) {
- this.filterDynamicHeight = parseInt(newValue.height.toString(), 0) + LIST_ROW_HEIGHT + FILTER_TOP_PADDING
- } else {
- this.filterDynamicHeight = parseInt(newValue.height.toString(), 0) + FILTER_TOP_PADDING
- }
- if (!this.isFloatBarShowWithoutAnimation && !this.isFloatShowAllFilterWithoutAnimation) {
- this.floatFilterPosition = -this.filterDynamicHeight
- }
- })
- }
-
- private additionItemClick(index: number) {
- let additionRowIndex = this.multiFilters.length
- if (this.selectedFilters[additionRowIndex].index != index) {
- if (this.selectedFilters[additionRowIndex].index === -1) {
- this.additionColorArr[index] = $r('sys.color.ohos_id_color_text_primary_activated')
- this.additionFontWeightArr[index] = FontWeight.Medium
- this.selectedFilters[additionRowIndex].value = this.additionFilters.options[index]
- this.selectedFilters[additionRowIndex].index = index
- } else {
- let lastIndex = this.selectedFilters[additionRowIndex].index
- this.additionColorArr[lastIndex] = $r('sys.color.ohos_id_color_text_primary')
- this.additionColorArr[index] = $r('sys.color.ohos_id_color_text_primary_activated')
- this.additionFontWeightArr[lastIndex] = FontWeight.Regular
- this.additionFontWeightArr[index] = FontWeight.Medium
- this.selectedFilters[additionRowIndex].value = this.additionFilters.options[index]
- this.selectedFilters[additionRowIndex].index = index
- }
- } else {
- this.additionColorArr[index] = $r('sys.color.ohos_id_color_text_primary')
- this.additionFontWeightArr[index] = FontWeight.Regular
- this.selectedFilters[additionRowIndex].value = null
- this.selectedFilters[additionRowIndex].index = -1
- }
- this.onFilterChanged && this.onFilterChanged(this.selectedFilters)
- this.colorRefresh = !this.colorRefresh
- }
-
- @Builder AdditionFilterList() {
- if (this.additionFilters && this.additionFilters.name && this.additionFilters.options && this.additionFilters.options.length != 0) {
- List() {
- ListItem() {
- Row() {
- Text(this.additionFilters.name.toString())
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .margin({ left: TEXT_HOT_AREA_WIDTH, right: TEXT_HOT_AREA_WIDTH })
- Row()
- .width(SEPARATOR_WIDTH)
- .height(SEPARATOR_HEIGHT)
- .backgroundColor($r('sys.color.ohos_id_color_list_separator'))
- }
- }.height(PERCENT_100)
-
- ForEach(this.additionFilters.options, (option, index?: number) => {
- ListItem() {
- Text(option.toString())
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- .fontColor(this.additionColorArr[index])
- .fontWeight(this.additionFontWeightArr[index])
- .focusable(true)
- }
- .height(PERCENT_100)
- .backgroundColor(this.isAdditionBackgroundHover[index] ? this.additionBackgroundColorArr[index] : TRANS_COLOR)
- .onHover((isHover: boolean) => {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- if (isHover) {
- this.additionBackgroundColorArr[index] = $r('sys.color.ohos_id_color_hover')
- this.isAdditionBackgroundHover[index] = true
- } else {
- this.isAdditionBackgroundHover[index] = false
- }
- })
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.additionBackgroundColorArr[index] = $r('sys.color.ohos_id_color_click_effect')
- this.isAdditionBackgroundHover[index] = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isAdditionBackgroundHover[index] = false
- })
- }
- })
- .focusable(true)
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .padding({
- left: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH,
- right: TEXT_HOT_AREA_WIDTH - FOCUS_BORDER_WIDTH
- })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .padding({ left: TEXT_HOT_AREA_WIDTH, right: TEXT_HOT_AREA_WIDTH })
- }
- })
- .onClick(() => {
- this.additionItemClick(index)
- })
- })
- }
- .listDirection(Axis.Horizontal)
- .scrollBar(BarState.Off)
- .padding({ left: $r('sys.float.ohos_id_max_padding_start') })
- .margin({ left: -TEXT_HOT_AREA_WIDTH * 2 })
- .width(PERCENT_100)
- .height(LIST_ROW_HEIGHT)
- }
-
- }
-
- @Builder FilterHeader() {
- Column() {
- if (this.filterType === FilterType.LIST_FILTER) {
- this.ListFilter()
- } else {
- this.MultiLineFilter()
- }
- this.AdditionFilterList()
- }.padding({ top: FILTER_TOP_PADDING })
- .onVisibleAreaChange([0.0, 1.0], (_isVisible: boolean, currentRatio: number) => {
- if (currentRatio > 0) {
- this.isFloatShowAllFilter = false
- this.isFloatShowAllFilterWithoutAnimation = false
- this.isFloatBarShowWithoutAnimation = false
- animateTo({
- curve: INTER_POLATING_SPRING,
- onFinish: () => {
- if (!this.isFloatBarShowWithoutAnimation) {
- this.isFloatBarShow = false
- }
- }
- }, () => {
- this.floatFilterBarHeight = 0
- })
- } else {
- this.isFloatBarShow = true
- this.isFloatBarShowWithoutAnimation = true
- animateTo({
- curve: INTER_POLATING_SPRING
- }, () => {
- this.floatFilterBarHeight = LIST_ROW_HEIGHT + FILTER_TOP_PADDING
- })
- }
- })
- }
-
- @Builder FloatFilterHeader() {
- Column() {
- if (this.filterType === FilterType.LIST_FILTER) {
- this.ListFilter()
- } else {
- this.MultiLineFilter()
- }
- this.AdditionFilterList()
- }
- .padding({ top: FILTER_TOP_PADDING })
- .width(PERCENT_100)
- .clip(true)
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .opacity(FLOAT_OPACITY)
- .backgroundBlurStyle(BlurStyle.Thin)
- .visibility(this.isFloatShowAllFilter ? Visibility.Visible : Visibility.Hidden)
- .position({ x: 0, y: this.floatFilterPosition })
- .zIndex(2)
- }
-
- @Builder FloatFilterBar() {
- Row() {
- Column() {
- Row() {
- ForEach(this.selectedFilters.slice(0, this.colorRefresh ? this.selectedFilters.length : this.selectedFilters.length), (selected, index?: number) => {
- if (index != 0 && selected.value != null) {
- Text('/')
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- }
- Text(selected.value)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .fontSize($r('sys.float.ohos_id_text_size_body3'))
- })
- }.height(PERCENT_100)
- .alignItems(VerticalAlign.Center)
- }
- .alignItems(HorizontalAlign.Center)
- .width(PERCENT_100)
- .height(LIST_ROW_HEIGHT)
-
- Row() {
- Image($r('sys.media.ohos_ic_public_arrow_down'))
- .width(ARROW_IMG_SIZE)
- .height(ARROW_IMG_SIZE)
- .fillColor($r('sys.color.ohos_id_color_tertiary'))
- .focusable(true)
- }
- .height(LIST_ROW_HEIGHT)
- .margin({ left: -ARROW_IMG_SIZE })
- .backgroundColor(this.isFloatArrowBgHover ? this.floatArrowBgColor : TRANS_COLOR)
- .focusable(true)
- .stateStyles({
- focused: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: FOCUS_BORDER_WIDTH,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- })
- .width(ARROW_IMG_SIZE + FOCUS_BORDER_WIDTH * 2)
- .offset({ x: -FOCUS_BORDER_WIDTH })
- },
- normal: {
- .border({
- radius: $r('sys.float.ohos_id_corner_radius_clicked'),
- width: 0 })
- .width(ARROW_IMG_SIZE)
- .offset({ x: 0 })
- }
- })
- .onHover((isHover: boolean) => {
- if (isHover) {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- this.floatArrowBgColor = $r('sys.color.ohos_id_color_hover')
- this.isFloatArrowBgHover = true
- })
- } else {
- animateTo({
- curve: FRICTION_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_250
- }, () => {
- this.isFloatArrowBgHover = false
- })
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.floatArrowBgColor = $r('sys.color.ohos_id_color_click_effect')
- this.isFloatArrowBgHover = true
- })
- } else if (event.type === TouchType.Up) {
- animateTo({
- curve: SHARP_CUBIC_BEZIER,
- duration: ANIMATION_DURATION_100
- }, () => {
- this.isFloatArrowBgHover = false
- })
- }
- })
- .onClick(() => {
- animateTo({
- duration: BAR_ANIMATION_DURATION,
- curve: SHARP_CUBIC_BEZIER
- }, () => {
- this.isFloatBarShow = false
- this.isFloatBarShowWithoutAnimation = false
- })
- this.isFloatShowAllFilter = true
- this.isFloatShowAllFilterWithoutAnimation = true
- animateTo({
- curve: INTER_POLATING_SPRING
- }, () => {
- this.floatFilterPosition = 0
- this.floatFilterBarPosition = this.filterDynamicHeight
- })
- })
- }
- .width(PERCENT_100)
- .padding({ right: $r('sys.float.ohos_id_max_padding_end') })
- .height(this.floatFilterBarHeight)
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .opacity(FLOAT_OPACITY)
- .clip(true)
- .backgroundBlurStyle(BlurStyle.Thin)
- .visibility(this.isFloatBarShow ? Visibility.Visible : Visibility.Hidden)
- .alignItems(VerticalAlign.Bottom)
- .position({ x: 0, y: this.floatFilterBarPosition })
- .zIndex(1)
- }
-
- private listScroller: Scroller = new Scroller()
-
- build() {
- Stack({ alignContent: Alignment.Top }) {
- this.FloatFilterBar();
- this.FloatFilterHeader();
- Column() {
- List({ initialIndex: 0, scroller: this.listScroller }) {
- ListItem() {
- this.FilterHeader()
- }.focusable(true)
- .onFocus(() => {
- this.listScroller.scrollToIndex(0, true)
- })
-
- ListItem() {
- this.container()
- }.focusable(true)
- .onFocus(() => {
- this.listScroller.scrollToIndex(1, true)
- })
- }
- .listDirection(Axis.Vertical)
- .width(PERCENT_100)
- .height(PERCENT_100)
- .edgeEffect(EdgeEffect.Spring)
- .onScroll((_scrollOffset: number, scrollState: ScrollState) => {
- if (this.isFloatShowAllFilterWithoutAnimation && scrollState == ScrollState.Scroll) {
- this.isFloatBarShowWithoutAnimation = true
- this.isFloatShowAllFilterWithoutAnimation = false
- animateTo({
- duration: BAR_ANIMATION_DURATION,
- curve: SHARP_CUBIC_BEZIER
- }, () => {
- this.isFloatBarShow = true
- })
-
- animateTo({
- curve: INTER_POLATING_SPRING,
- onFinish: () => {
- if (!this.isFloatShowAllFilterWithoutAnimation) {
- this.isFloatShowAllFilter = false
- }
- }
- }, () => {
- this.floatFilterPosition = -this.filterDynamicHeight
- this.floatFilterBarPosition = 0
- })
- }
- })
- }.zIndex(0)
- }.clip(true)
- }
-}
\ No newline at end of file
diff --git a/source/ProgressButton/ProgressButton.ets b/source/ProgressButton/ProgressButton.ets
deleted file mode 100644
index 82f0d43..0000000
--- a/source/ProgressButton/ProgressButton.ets
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const EMPTY_STRING: string = ''
-const MAX_PROGRESS: number = 100
-const MAX_PERCENTAGE: string = '100%'
-const MIN_PERCENTAGE: string = '0%'
-
-@Component
-export struct ProgressButton {
- @Prop @Watch('getProgressContext') progress: number
- @State textProgress: string = EMPTY_STRING
- @Prop content: string = EMPTY_STRING
- @State isLoading: boolean = false
- progressButtonWidth?: Length = 44
- clickCallback: () => void = null
- @Prop enable: boolean = true
-
- private getButtonProgress(): number {
- if (this.progress < 0) {
- return 0
- } else if (this.progress > MAX_PROGRESS) {
- return MAX_PROGRESS
- }
- return this.progress
- }
-
- private getProgressContext() {
- if (this.progress < 0) {
- this.isLoading = false
- this.textProgress = MIN_PERCENTAGE
- } else if (this.progress >= MAX_PROGRESS) {
- this.isLoading = false
- this.textProgress = MAX_PERCENTAGE
- } else {
- this.textProgress = Math.floor(this.progress / MAX_PROGRESS * MAX_PROGRESS).toString() + "%"
- }
- }
-
- build() {
- Button() {
- Stack(){
- Progress({ value: this.getButtonProgress(), total: MAX_PROGRESS,
- style: ProgressStyle.Capsule })
- .height(28)
- .borderRadius(14)
- .width('100%')
- .hoverEffect(HoverEffect.None)
- .clip(false)
- .enabled(this.enable)
- Row() {
- Text(this.isLoading? this.textProgress: this.content)
- .fontSize($r('sys.float.ohos_id_text_size_button3'))
- .fontWeight(FontWeight.Medium)
- .fontColor(this.isLoading? $r('sys.color.ohos_id_color_text_primary')
- :$r('sys.color.ohos_id_color_emphasize'))
- .maxLines(1)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .padding({left: 8, right: 8})
- .opacity(this.enable? 1.0: 0.4)
- }
- }
- }
- .borderRadius(14)
- .clip(false)
- .hoverEffect(HoverEffect.None)
- .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
- .border({ width: 0.5, color: this.enable ? $r("sys.color.ohos_id_color_toolbar_text_actived")
- : $r('sys.color.ohos_id_color_foreground_contrary_disable') })
- .constraintSize({minWidth: 44})
- .width(this.progressButtonWidth < 44? 44: this.progressButtonWidth)
- .stateEffect(this.enable)
- .onClick(() => {
- if(!this.enable){
- return
- }
- if (this.progress < MAX_PROGRESS) {
- this.isLoading = !this.isLoading
- }
- this.clickCallback && this.clickCallback()
- })
- }
-}
\ No newline at end of file
diff --git a/source/SelectTitleBar/SelectTitleBar.ets b/source/SelectTitleBar/SelectTitleBar.ets
deleted file mode 100755
index 15d82bb..0000000
--- a/source/SelectTitleBar/SelectTitleBar.ets
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-import { KeyCode } from '@ohos.multimodalInput.keyCode'
-
-export declare type SelectTitleBarMenuItem = {
- value: ResourceStr
- isEnabled: boolean
- action?: () => void
-}
-
-const PUBLIC_MORE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAY' +
- 'AAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAA' +
- 'AAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuA' +
- 'xhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhYWnstMINgYsh+cmfs88BI' +
- 'Cydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRdY' +
- 'jJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5H' +
- 'nhkC9+zAA5YXXy8jBKV5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rm' +
- 'j79U74wCszuih+F/ljrSi/+uud8YBGA10rayqrnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70' +
- 'zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hkH4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln' +
- '/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ/N5Vjd0oTXKp9QcKF' +
- 'pD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fN' +
- 'Q1BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnX' +
- 'fo96DGYBRZD1ycpc/XzbmbvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jp' +
- 'yaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jv' +
- 'jACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrpVV1fXOOADLA10rq6rrnXEAVga6VlZV13u' +
- 'h8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5LP+r7veGQfgd+T' +
- '+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtU' +
- 'tTXit8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXv' +
- 'O9H8f1bfVPQ9FvQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC'
-
-const PUBLIC_BACK = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAY' +
- 'AAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAA' +
- 'XNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8VJREFUeNrt3LFLlHEYwPFXz0G' +
- 'iIZpEoikkwsFRIiK3gqCigxIC/4Kmhv6OoChouaGoqKCgCKducGh0cDAIamhwiCaHCIeelztpUszee/vl8/nAM3Vd8nufr' +
- '+fddVYVAAAAAAAAAAAAAAAAAAAAAABQijFH0KhrMd2Y2ZitmNWYRzHLjkYAB9lUzMOYizv8eS/mZsymoypLxxE0svzvY07' +
- 'vcpu5mOmY145LAAdx+U/u4bZzwx+JPjq2cow7glaWf1vXsQkg6/JvPwoggJTLjwDSL/8nRyiAzN/5nzpGAWRd/n7MM0cpg' +
- 'IzLvx6z6CjL453gdpZ/IWbDcQrA8iMAy48ALD8CsPwIwPIjAMuPACw/ArD8CMDyIwDLjwAsPwKw/AjA8iMAy48ALD8CsPw' +
- 'IwPIjAMuPACw/ArD85A3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2A' +
- 'MtP2gAsP2kDsPykDcDykzYAy0/aACw/aQOw/KQNwPKTNgDLT9oALD9pA7D8pA3A8pM2AMtP2gAsP2kDsPykDcDykzYAy0/' +
- 'aACw/aQOw/KQNwPLz3xlv6H4mYp5YfrI+AizF9BwnI/AlZi3mbsxy03feaeh+HsQcc60YgSMxMzE3YmZj3sX8LOlHoPoLn' +
- 'HedaEE35n5pzwF856dN9SPBpZICmHRNaNnlkgL46nrQsvmSAqhftlx1TWjR4ZICqPVcE1q0XloA96rBa7XQhl5pAWzFXKm' +
- '8i8vo9WMeN3VnnQa/sO8xL2POxEy7Toxo+RdjNpu6w1F9HuBqNXi99lw1eKMM9utHzIeYV8MftbccCQAAAAAAsBdt/XLc+s' +
- 'Py9W+MmPqL+1iJuVA1+C4gdFr6d77FvK0GH2nb739lPR5zNuZ51eBnQhFAJQIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE' +
- 'IAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAI' +
- 'EIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIEIAIE8M8jmBlGgABSRnAqZiXms+MUQNYIDnkUKMu4I/gj6z' +
- 'ELMRv7/PsnHKEAMkcw6fgEkDmCNUcngMwRvHFsngRnfWJcL/9tRyaAgxrB+ZijO9ymH7MUs+m4yjLmCBozEXMr5nr1+9We1' +
- 'ZgXMXccDwAAAAAAAAAAAAAAAAAAAAAAwO5+AfVgtqHKRnawAAAAAElFTkSuQmCC'
-
-@Component
-export struct SelectTitleBar {
- @State selected: number = 0
-
- options: Array
- menuItems: Array
-
- subtitle: ResourceStr
- badgeValue: number
- hidesBackButton: boolean
-
- onSelected: ((index: number) => void)
-
- private static readonly badgeSize = 16
- private static readonly totalHeight = 56
- private static readonly leftPadding = 24
- private static readonly leftPaddingWithBack = 12
- private static readonly rightPadding = 24
- private static readonly badgePadding = 16
- private static readonly subtitleLeftPadding = 8
-
- @State selectMaxWidth: number = 0
-
- build() {
- Flex({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- }) {
- Row() {
- if (!this.hidesBackButton) {
- Navigator() {
- ImageMenuItem({ item: {
- value: PUBLIC_BACK,
- isEnabled: true
- } })
- }
- }
- Column() {
- if (this.badgeValue !== undefined) {
- Badge({
- count: this.badgeValue,
- position: BadgePosition.Right,
- style: {
- badgeSize: SelectTitleBar.badgeSize,
- badgeColor: $r('sys.color.ohos_id_color_emphasize'),
- borderColor: $r('sys.color.ohos_id_color_emphasize'),
- borderWidth: 0
- }
- }) {
- Row() {
- Select(this.options)
- .selected(this.selected)
- .value(this.selected < this.options.length ? this.options[this.selected].value.toString() : "")
- .font({ size: $r('sys.float.ohos_id_text_size_headline8') })
- .fontColor($r('sys.color.ohos_id_color_titlebar_text'))
- .onSelect(this.onSelected)
- .constraintSize({ maxWidth: this.selectMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- .margin({ right: $r('sys.float.ohos_id_elements_margin_horizontal_l') })
- }
- } else {
- Row() {
- Select(this.options)
- .selected(this.selected)
- .value(this.selected < this.options.length ? this.options[this.selected].value.toString() : "")
- .font({ size: $r('sys.float.ohos_id_text_size_headline8') })
- .fontColor($r('sys.color.ohos_id_color_titlebar_text'))
- .onSelect(this.onSelected)
- .constraintSize({ maxWidth: this.selectMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- }
- if (this.subtitle !== undefined) {
- Row() {
- Text(this.subtitle)
- .fontSize($r('sys.float.ohos_id_text_size_over_line'))
- .fontColor($r('sys.color.ohos_id_color_titlebar_subtitle_text'))
- .maxLines(1)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ maxWidth: this.selectMaxWidth })
- }
- .justifyContent(FlexAlign.Start)
- .margin({ left: SelectTitleBar.subtitleLeftPadding })
- }
- }
- .justifyContent(FlexAlign.Start)
- .alignItems(HorizontalAlign.Start)
- .constraintSize({ maxWidth: this.selectMaxWidth })
- }
- .margin({ left: this.hidesBackButton ? $r('sys.float.ohos_id_max_padding_start') : $r('sys.float.ohos_id_default_padding_start') })
- if (this.menuItems !== undefined && this.menuItems.length > 0) {
- CollapsibleMenuSection({ menuItems: this.menuItems })
- }
- }
- .width('100%')
- .height(SelectTitleBar.totalHeight)
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- let newWidth = Number(newValue.width)
- if (!this.hidesBackButton) {
- newWidth -= ImageMenuItem.imageHotZoneWidth
- newWidth += SelectTitleBar.leftPadding
- newWidth -= SelectTitleBar.leftPaddingWithBack
- }
- if (this.menuItems !== undefined) {
- let menusLength = this.menuItems.length
- if (menusLength >= CollapsibleMenuSection.maxCountOfVisibleItems) {
- newWidth -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems
- } else if (menusLength > 0) {
- newWidth -= ImageMenuItem.imageHotZoneWidth * menusLength
- }
- }
- if (this.badgeValue !== undefined) {
- this.selectMaxWidth = newWidth - SelectTitleBar.badgeSize - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding - SelectTitleBar.badgePadding
- } else {
- this.selectMaxWidth = newWidth - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding
- }
- })
- }
-}
-
-@Component
-struct CollapsibleMenuSection {
- menuItems: Array
-
- static readonly maxCountOfVisibleItems = 3
- private static readonly focusPadding = 4
- private static readonly marginsNum = 2
-
- @State isPopupShown: boolean = false
-
- @State isMoreIconOnFocus: boolean = false
- @State isMoreIconOnHover: boolean = false
- @State isMoreIconOnClick: boolean = false
-
- getMoreIconFgColor() {
- return this.isMoreIconOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getMoreIconBgColor() {
- if (this.isMoreIconOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isMoreIconOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Column() {
- Row() {
- if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) {
- ForEach(this.menuItems, (item) => {
- ImageMenuItem({ item: item })
- })
- } else {
- ForEach(this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (item) => {
- ImageMenuItem({ item: item })
- })
-
- Row() {
- Image(PUBLIC_MORE)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(true)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getMoreIconFgColor())
- .backgroundColor(this.getMoreIconBgColor())
- .justifyContent(FlexAlign.Center)
- .border(this.isMoreIconOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => this.isMoreIconOnFocus = true)
- .onBlur(() => this.isMoreIconOnFocus = false)
- .onHover((isOn) => this.isMoreIconOnHover = isOn)
- .onKeyEvent((event) => {
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onClick(() => this.isPopupShown = true)
- .bindPopup(this.isPopupShown, {
- builder: this.popupBuilder,
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: false,
- onStateChange: (e) => this.isPopupShown = e.isVisible
- })
- }
- }
- }
- .height('100%')
- .margin({ right: $r('sys.float.ohos_id_default_padding_end') })
- .justifyContent(FlexAlign.Center)
- }
-
- @Builder popupBuilder() {
- Column() {
- ForEach(this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), (item, _index?) => {
- ImageMenuItem({ item: item })
- })
- }
- .width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum)
- .margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding })
- }
-}
-
-@Component
-struct ImageMenuItem {
- item: SelectTitleBarMenuItem
-
- static readonly imageSize = 24
- static readonly imageHotZoneWidth = 48
- static readonly buttonBorderRadius = 8
- static readonly focusBorderWidth = 2
- static readonly disabledImageOpacity = 0.4
-
- @State isOnFocus: boolean = false
- @State isOnHover: boolean = false
- @State isOnClick: boolean = false
-
- getFgColor() {
- return this.isOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getBgColor() {
- if (this.isOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Row() {
- Image(this.item.value)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(this.item.isEnabled)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getFgColor())
- .backgroundColor(this.getBgColor())
- .justifyContent(FlexAlign.Center)
- .opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity)
- .border(this.isOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnFocus = true
- })
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnHover = isOn
- })
- .onKeyEvent((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.item.isEnabled && this.item.action && this.item.action())
- }
-}
-
-export default { SelectTitleBar }
\ No newline at end of file
diff --git a/source/SplitLayout/SplitLayout.ets b/source/SplitLayout/SplitLayout.ets
deleted file mode 100644
index 9fb74a2..0000000
--- a/source/SplitLayout/SplitLayout.ets
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-@Component
-export struct splitlayout {
- @BuilderParam container: () => void
- @State sizeValue: string = ''
- @State areaWidth: number = 0
- @State imageBackgroundColor: string = "#19000000"
- @Prop mainImage: Resource = $r("app.media.music")
- @Prop primaryText: string = "新歌推荐"
- secondaryText?: string = "私人订制新歌精选站,为你推荐专属优质新歌;为你推荐专属优质新歌"
- tertiaryText?: string = "每日更新"
-
- build() {
- Column() {
- if (this.areaWidth < 600) {
- GridRow({
- columns: 4,
- breakpoints: {
- reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- }) {
- GridCol({ span: { xs: 4, sm: 4, md: 4, lg: 4 } }) {
- Column() {
- Stack({ alignContent: Alignment.Bottom }) {
- Image(this.mainImage)
-
- Column() {
- Text(this.primaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_headline7'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- Text(this.secondaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .margin({ top: 4, bottom: 8 })
- Text(this.tertiaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_caption'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .margin({ bottom: 24 })
- }
- .alignItems(HorizontalAlign.Center)
- .margin({
- left: $r('sys.float.ohos_id_max_padding_start'),
- right: $r('sys.float.ohos_id_max_padding_end'), })
- }
- .height('34%')
- .width('100%')
-
- Column() {
- this.container()
- }
- .height('66%')
- .width('100%')
- }
- }
- }
- } else if (600 < this.areaWidth && this.areaWidth < 840) {
- // 形态二
- GridRow({
- columns: 8,
- breakpoints: {
- reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- }) {
- GridCol({ span: { xs: 8, sm: 8, md: 8, lg: 8 } }) {
- Column() {
- Row() {
- Image(this.mainImage)
- .margin({ left: 96, right: 36 })
- .height('60%')
- .width('20%')
- Column() {
- Text(this.primaryText)
- .fontSize($r('sys.float.ohos_id_text_size_headline7'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- Text(this.secondaryText)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .margin({ top: 4, bottom: 8 })
- Text(this.tertiaryText)
- .fontSize($r('sys.float.ohos_id_text_size_caption'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- }
- .alignItems(HorizontalAlign.Start)
- .margin({ right: 96 })
- }
- .backgroundColor(this.imageBackgroundColor)
- .height('34%')
-
- Column() {
- this.container()
- }
- .height('66%')
- }
-
- }
- }
-
- } else if (this.areaWidth > 840) {
- GridRow({
- columns: 12,
- breakpoints: {
- reference: BreakpointsReference.WindowSize },
- direction: GridRowDirection.Row
- }) {
- GridCol({ span: { xs: 4, sm: 4, md: 4, lg: 4 } }) {
- Column() {
- Image(this.mainImage)
- .height('17%')
- .width('34%')
- .margin({ bottom: 36 })
- Text(this.primaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_headline7'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .margin({ left: 48, right: 48 })
- Text(this.secondaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_body1'))
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .margin({ top: 4, bottom: 8, left: 48, right: 48 })
- Text(this.tertiaryText)
- .textAlign(TextAlign.Center)
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .margin({ bottom: 24, left: 48, right: 48 })
- }
- .height('100%')
- .backgroundColor(this.imageBackgroundColor)
- .justifyContent(FlexAlign.Center)
- .alignItems(HorizontalAlign.Center)
- }
- .height('100%')
-
- GridCol({ span: { xs: 8, sm: 8, md: 8, lg: 8 } }) {
- this.container()
- }
-
- }
- }
- }
-
- .onAreaChange((oldValue: Area, newValue: Area) => {
- console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`)
- this.sizeValue = JSON.stringify(newValue)
- this.areaWidth = parseInt(newValue.width.toString(), 0);
- console.info(`pingAce: on area change, oldValue is` + this.areaWidth)
- console.info(`pingAce: on area change, oldValue is` + parseInt(newValue.height.toString(), 0))
- })
- }
-}
diff --git a/source/SubHeader/SubHeader.ets b/source/SubHeader/SubHeader.ets
deleted file mode 100644
index da40ac5..0000000
--- a/source/SubHeader/SubHeader.ets
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const SPACE_MARGIN: number = 8
-const MARGIN_NUM: number = 4
-const IMAGE_WIDTH_NUM: number = 16
-const IMAGE_HEIGHT_NUM: number = 24
-const BUTTON_SIZE: number = 32
-const SINGLE_LINE_HEIGHT: number = 48
-const DOUBLE_LINE_HEIGHT: number = 64
-const BUTTON_HEIGHT: number = 28
-const IMAGE_WIDTH: number = 12
-const BORDER_WIDTH = 2
-const DIVIDEND_WIDTH = 3
-const SINGLE_LINE_NUM: number = 1
-const DOUBLE_LINE_NUM: number = 2
-const MIN_FONT_SIZE: number = 14
-const MAIN_TEXT_SIZE: number = 10
-const CONSTRAINT_WIDTH: number = 40
-const CONSTRAINT_NUM: number = 44
-
-export enum OperationType {
- TEXT_ARROW = 0,
- BUTTON = 1,
- ICON_GROUP = 2,
- LOADING = 3,
-}
-
-export declare type OperationOption = {
- value: ResourceStr;
- action?: () => void;
-}
-
-export declare type SelectOptions = {
- options: Array;
- selected?: number;
- value?: string;
- onSelect?: (index: number, value?: string) => void;
-}
-
-@Component
-struct IconGroup {
- @State bgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State isFocus: boolean = false
- item: OperationOption
- focusBorderWidth = BORDER_WIDTH
-
- build() {
- Row() {
- Image(this.item.value)
- .fillColor($r('sys.color.ohos_id_color_primary'))
- .width(IMAGE_HEIGHT_NUM)
- .height(IMAGE_HEIGHT_NUM)
- .focusable(true)
- }
- .focusable(true)
- .width(BUTTON_SIZE)
- .height(BUTTON_SIZE)
- .margin({ right: SPACE_MARGIN, bottom: MARGIN_NUM })
- .justifyContent(FlexAlign.Center)
- .borderRadius($r('sys.float.ohos_id_corner_radius_clicked'))
- .backgroundColor(this.bgColor)
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.item.action && this.item.action()
- this.bgColor = $r('sys.color.ohos_id_color_click_effect')
- }
- if (event.type === TouchType.Up) {
- this.bgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .onHover((isHover: boolean) => {
- if (isHover) {
- this.bgColor = $r('sys.color.ohos_id_color_hover')
- } else {
- this.bgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .border(this.isFocus ?
- { width: this.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- this.isFocus = true;
- })
- .onBlur(() => {
- this.isFocus = false;
- })
- .onKeyEvent((event) => {
- if (event.keyCode === 2054 || event.keyCode === 2050) {
- this.item.action && this.item.action()
- }
- })
- }
-}
-
-@Component
-export struct SubHeader1 {
- @Prop icon: Resource
- @Prop primaryTitle: string
- @Prop secondaryTitle: string
- @Prop select: SelectOptions
- @Prop operationType: OperationType = OperationType.BUTTON
- operationItem: Array
- @State isDuplicateLine: boolean = false
- @State textArrowBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State buttonBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State iconBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State firstIconBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State SecondaryIconBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State thirdIconBgColor: Resource = $r('sys.color.ohos_id_color_background')
- @State flag: boolean = false
- @State isTextArrowFocus: boolean = false
- @State flexWidth: number = 0
- @State titleWidth: number = 0
- @State titleWidth1: number = 0
- @State isButtonFocus: boolean = false
- focusBorderWidth = BORDER_WIDTH
-
- @Builder ListTextStyle($$: { content: ResourceStr }) {
- Text($$.content)
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .fontSize($r('sys.float.ohos_id_text_size_sub_title3'))
- .fontWeight(FontWeight.Medium)
- .maxLines(DOUBLE_LINE_NUM)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ minWidth: this.titleWidth })
- .margin({ left: $r('sys.float.ohos_id_max_padding_end'), bottom: SPACE_MARGIN, right: MARGIN_NUM }).borderWidth(1)
- }
-
- @Builder ListIconStyle($$: { content: ResourceStr }, icon: ResourceStr) {
- Row() {
- Image(icon)
- .width(IMAGE_WIDTH_NUM)
- .height(IMAGE_WIDTH_NUM)
- .margin({ right: SPACE_MARGIN })
- Text($$.content)
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .fontSize($r('sys.float.ohos_id_text_size_sub_title3'))
- .fontWeight(FontWeight.Medium)
- .maxLines(DOUBLE_LINE_NUM)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ minWidth: this.titleWidth - CONSTRAINT_WIDTH })
- }
- .margin({ left: $r('sys.float.ohos_id_max_padding_end'), bottom: SPACE_MARGIN, right: MARGIN_NUM })
- }
-
- @Builder ContentTextStyle($$: { content: ResourceStr }) {
- Text($$.content)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .fontSize($r('sys.float.ohos_id_text_size_sub_title2'))
- .fontWeight(FontWeight.Medium)
- .maxLines(DOUBLE_LINE_NUM)
- .maxFontSize($r('sys.float.ohos_id_text_size_sub_title2'))
- .minFontSize(MIN_FONT_SIZE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .constraintSize({ maxWidth: this.titleWidth })
- .margin({ left: $r('sys.float.ohos_id_max_padding_start'),
- right: MARGIN_NUM, bottom: SPACE_MARGIN })
- }
-
- @Builder SubTextStyle($$: { content: ResourceStr, subContent: ResourceStr }) {
- Column() {
- Text($$.content)
- .fontColor($r('sys.color.ohos_id_color_text_primary'))
- .fontSize($r('sys.float.ohos_id_text_size_sub_title2'))
- .fontWeight(FontWeight.Medium)
- .maxLines(SINGLE_LINE_NUM)
- .maxFontSize($r('sys.float.ohos_id_text_size_sub_title2'))
- .minFontSize(MIN_FONT_SIZE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- Text($$.subContent)
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .fontSize($r('sys.float.ohos_id_text_size_sub_title3'))
- .fontWeight(FontWeight.Medium)
- .maxLines(SINGLE_LINE_NUM)
- .maxFontSize($r('sys.float.ohos_id_text_size_sub_title3'))
- .minFontSize(MAIN_TEXT_SIZE)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- }
- .constraintSize({ maxWidth: this.titleWidth })
- .alignItems(HorizontalAlign.Start)
- .onAppear(() => {
- this.isDuplicateLine = true
- })
- .margin({ left: $r('sys.float.ohos_id_max_padding_start'),
- right: MARGIN_NUM, bottom: SPACE_MARGIN })
- }
-
- @Builder SelectStyle(selectParam: SelectOptions) {
- Select(selectParam.options)
- .selected(selectParam.selected)
- .value(selectParam.value)
- .onSelect((index: number, value?: string) => {
- if (selectParam.onSelect) {
- selectParam.onSelect(index, value)
- }
- })
- .constraintSize({ maxWidth: this.titleWidth })
- .margin({ left: $r('sys.float.ohos_id_default_padding_start'), right: MARGIN_NUM})
- }
-
- @Builder LoadingProcessStyle() {
- LoadingProgress()
- .width(IMAGE_HEIGHT_NUM)
- .height(IMAGE_HEIGHT_NUM)
- .focusable(true)
- .margin({ right: $r('sys.float.ohos_id_default_padding_end'), bottom: MARGIN_NUM })
- }
-
- @Builder TextArrowStyle(textArrow: OperationOption) {
- Row() {
- Row() {
- if (textArrow != null) {
- Text(textArrow.value)
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- .margin({ right: MARGIN_NUM })
- .focusable(true)
- .maxLines(DOUBLE_LINE_NUM)
- }
- Image($r('sys.media.ohos_ic_public_arrow_right'))
- .fillColor($r('sys.color.ohos_id_color_tertiary'))
- .width(IMAGE_WIDTH)
- .height(IMAGE_HEIGHT_NUM)
- .focusable(true)
- }.margin({ left: SPACE_MARGIN, right: SPACE_MARGIN })
- }
- .justifyContent(FlexAlign.End)
- .focusable(true)
- .margin({ left:MARGIN_NUM, right: MARGIN_NUM, bottom: MARGIN_NUM })
- .borderRadius($r('sys.float.ohos_id_corner_radius_subtab'))
- .backgroundColor(this.textArrowBgColor)
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- if (textArrow.action) {
- textArrow.action()
- }
- this.textArrowBgColor = $r('sys.color.ohos_id_color_click_effect')
- }
- if (event.type === TouchType.Up) {
- this.textArrowBgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .onHover((isHover: boolean) => {
- if (isHover) {
- this.textArrowBgColor = $r('sys.color.ohos_id_color_hover')
- } else {
- this.textArrowBgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .border(this.isTextArrowFocus ?
- { width: this.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- this.isTextArrowFocus = true;
- })
- .onBlur(() => {
- this.isTextArrowFocus = false;
- })
- .onKeyEvent((event) => {
- if (event.keyCode === 2054 || event.keyCode === 2050) {
- textArrow.action && textArrow.action()
- }
- })
- }
-
- @Builder ButtonStyle(button: OperationOption) {
- Row() {
- if (button != null) {
- Text(button.value)
- .maxLines(1)
- .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
- .fontSize($r('sys.float.ohos_id_text_size_button2'))
- .fontWeight(FontWeight.Medium)
- .margin({ left: SPACE_MARGIN, right: SPACE_MARGIN })
- .focusable(true)
- }
- }
- .onAreaChange((oldValue: Area, newValue: Area) => {
- Number(parseInt(newValue.width.toString(), 0))
- console.log('wy buttonStyle1'+Number(parseInt(newValue.width.toString(), 0)))
- })
- .justifyContent(FlexAlign.End)
- .alignItems(VerticalAlign.Center)
- .constraintSize({ maxWidth: this.flexWidth-this.titleWidth1 + 36 })
- .focusable(true)
- .height(BUTTON_HEIGHT)
- .margin({ left: SPACE_MARGIN, right: MARGIN_NUM })
- .borderRadius(IMAGE_WIDTH_NUM)
- .backgroundColor(this.buttonBgColor)
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- if (button.action) {
- button.action()
- }
- this.buttonBgColor = $r('sys.color.ohos_id_color_click_effect')
- }
- if (event.type === TouchType.Up) {
- this.buttonBgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .onHover((isHover: boolean) => {
- if (isHover) {
- this.buttonBgColor = $r('sys.color.ohos_id_color_hover')
- } else {
- this.buttonBgColor = $r('sys.color.ohos_id_color_background')
- }
- })
- .border(this.isButtonFocus ?
- { width: this.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_focused_outline'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- this.isButtonFocus = true;
- })
- .onBlur(() => {
- this.isButtonFocus = false;
- })
- .onKeyEvent((event) => {
- if (event.keyCode === 2054 || event.keyCode === 2050) {
- button.action && button.action()
- }
- })
- }
-
- build() {
- Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.End }) {
- Row() {
- if (this.secondaryTitle != null && this.icon != null) {
- this.ListIconStyle({ content: this.secondaryTitle }, this.icon)
- } else if (this.secondaryTitle != null && this.primaryTitle != null) {
- this.SubTextStyle({ content: this.primaryTitle, subContent: this.secondaryTitle })
- } else if (this.secondaryTitle != null) {
- this.ListTextStyle({ content: this.secondaryTitle })
- } else if (this.select != null) {
- this.SelectStyle(this.select)
- } else if (this.primaryTitle != null) {
- this.ContentTextStyle({ content: this.primaryTitle })
- }
- }
- .onAreaChange((oldValue: Area, newValue: Area) => {
- this.titleWidth1 = Number(parseInt(newValue.width.toString(), 0))
- console.log('wy titleWidth1'+this.titleWidth.toString())
- })
-
- Row() {
- if (this.operationType === OperationType.BUTTON && this.operationItem != null) {
- this.ButtonStyle(this.operationItem[0] )
- }
- if (this.operationType === OperationType.ICON_GROUP && this.operationItem != null) {
- Row() {
- ForEach(this.operationItem, (item, index?: number) => {
- if (index == 0) {
- IconGroup({ item: item })
- }
- if (index == 1) {
- IconGroup({ item: item })
- }
- if (index == 2) { // Image count
- IconGroup({ item: item })
- }
- })
- }
- }
- if (this.operationType === OperationType.TEXT_ARROW && this.operationItem != null) {
- this.TextArrowStyle(this.operationItem[0])
- }
- if (this.operationType === OperationType.LOADING) {
- this.LoadingProcessStyle()
- }
- }
- }
- .onAreaChange((oldValue: Area, newValue: Area) => {
- let flexWidth = Number(parseInt(newValue.width.toString(), 0))
- this.flexWidth = flexWidth - CONSTRAINT_NUM
- this.titleWidth = this.flexWidth / DIVIDEND_WIDTH * BORDER_WIDTH
- console.log('wy flexWidth'+this.flexWidth.toString())
- })
- .padding({ right: $r('sys.float.ohos_id_default_padding_end') })
- .height(this.isDuplicateLine ? DOUBLE_LINE_HEIGHT : SINGLE_LINE_HEIGHT)
- }
-}
\ No newline at end of file
diff --git a/source/Swiperefresher/SwipeRefresher.ets b/source/Swiperefresher/SwipeRefresher.ets
deleted file mode 100644
index 141a8cf..0000000
--- a/source/Swiperefresher/SwipeRefresher.ets
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-const LOADINGPROGRESS_SIZE = 24
-const DEFAULT_MARGIN = 16
-const ITEM_SPACE = 4
-
-@Component
-export struct SwipeRefresher {
- @Prop
- content: string = null
-
- @Prop
- isLoading: boolean = false;
-
- build() {
- Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
- if (this.isLoading) {
- LoadingProgress()
- .height(LOADINGPROGRESS_SIZE)
- .width(LOADINGPROGRESS_SIZE)
- .margin({
- right: ITEM_SPACE
- })
- }
- Text(this.content)
- .fontColor($r('sys.color.ohos_id_color_text_secondary'))
- .fontSize($r('sys.float.ohos_id_text_size_body2'))
- }
- .margin({
- top: DEFAULT_MARGIN,
- bottom: DEFAULT_MARGIN
- })
- }
-}
\ No newline at end of file
diff --git a/source/TabTitleBar/TabTitleBar.ets b/source/TabTitleBar/TabTitleBar.ets
deleted file mode 100755
index ae5217b..0000000
--- a/source/TabTitleBar/TabTitleBar.ets
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-import { KeyCode } from '@ohos.multimodalInput.keyCode'
-
-export declare type TabTitleBarMenuItem = {
- value: ResourceStr
- isEnabled: boolean
- action?: () => void
-}
-
-export declare type TabTitleBarTabItem = {
- title: ResourceStr
- icon?: ResourceStr
-}
-
-const PUBLIC_MORE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAAIGNIUk0AAHomAACAhAAA+' +
- 'gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAO' +
- 'xAAADsQBlSsOGwAABEZJREFUeNrt3D1rFFEUBuAxhmAhFlYpUohYiYWFRcAmKAhWK2pjo1iKf8BCMIKFf8BarCyMhVj4VZhGSKEg2FqJyCKWIhY' +
- 'WnstMINgYsh+cmfs88BICydxw7jmzu2HvNg0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBN+3r6dx+LXIqsRpa7FF8j48hm5Fn3Peo9mAEYRd' +
- 'YjJ3f582Vj7nZfUe/eDsCRyMPI2h5/fyNyI/JDT6v3Tvt7sBllE15ETkxwjeORi5G3ke/6W737MgBnI68jh6ZwrcORq5HnhkC9+zAA5YXXy8jBK' +
- 'V5zKXIu8jjyS7+rd+YBeNVtyrSVO9PRyBM9r94LSTfjWuTUDK9/eYIXeENUbb0zDsBi5PYc1rmj79U74wCszuih+F/ljrSi/+uud8YBGA10rayq' +
- 'rnfGAVgb6FpZVV3vjAOwPNC1sqq63hkHYGWga2VVdb0XKt/8Rf1fd70zDsB4jmt5u3Tl9a59AMb6v+56ZxyArYGulVXV9c44ABtzXOup/q+73hk' +
- 'H4N2cHio/Rj7r/7rrnXEAfkfuz2Gddb2v3ln/DfpgxneLzaY9xE3l9c46AH8iVyI/Z3Dt8nB/Xc+rd5H5QMy3yJemPVs6zY0edc9HUe/0Z4I/dQ' +
- '/N5Vjd0oTXKp9QcKFpD2qj3r0YgO1NeRM507TH6/bifeR85IMeV++d+vTBWOV9JDcjt5rdv6uw3M3uRR7pa/Xu+wBsOxA53bTnTP/3UX1b3fNQ1' +
- 'BsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqyr6d/97HIpchqZLlL8TUyjmxGnnXfo96DGYBRZD1ycpc/Xzbm' +
- 'bvcV9e7tAByJPIys7fH3NyI3Ij/0tHrvtL8Hm1E24UXkxATXOB65GHkb+a6/1bsvA3A28jpyaArXOhy5GnluCNS7DwNQXni9jByc4jWXIucijyO' +
- '/9Lt6Zx6AV92mTFu5Mx2NPNHz6r2QdDOuRU7N8PqXJ3iBN0TV1jvjACxGbs9hnTv6Xr0zDsDqjB6K/1XuSCv6v+56ZxyA0UDXyqrqemccgLWBrp' +
- 'VV1fXOOADLA10rq6rrnXEAVga6VlZV13uh8s1f1P911zvjAIznuJa3S1de79oHYKz/6653xgHYGuhaWVVd74wDsDHHtZ7q/7rrnXEA3s3pofJj5' +
- 'LP+r7veGQfgd+T+HNZZ1/vqnfXfoA9mfLfYbNpD3FRe76wD8CdyJfJzBtcuD/fX9bx6F5kPxHyLfGnas6XT3OhR93wU9U5/JvhT99BcjtUtTXit' +
- '8gkFF5r2oDbq3YsB2N6UN5EzTXu8bi/eR85HPuhx9d6pTx+MVd5HcjNyq9n9uwrL3exe5JG+Vu++D8C2A5HTTXvO9H8f1bfVPQ9FvQEAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgCn7C9HjBtwWfXpKAAAAAElFTkSuQmCC'
-
-@Component
-export struct TabTitleBar {
- tabItems: Array
- menuItems: Array
- @BuilderParam swiperContent: () => void
-
- @State tabWidth: number = 0
- @State currentIndex: number = 0
-
- static readonly totalHeight = 56
- static readonly correctionOffset = -40.0
- static readonly gradientMaskWidth = 24
- private menuSectionWidth = 0
-
- private scroller: Scroller = new Scroller()
- private swiperController: SwiperController = new SwiperController()
- private settings: RenderingContextSettings = new RenderingContextSettings(true)
- private leftContext2D: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
- private rightContext2D: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
-
- @Builder GradientMask(context2D: CanvasRenderingContext2D, x0: number, y0: number, x1: number, y1: number) {
- Column() {
- Canvas(context2D)
- .width(TabTitleBar.gradientMaskWidth)
- .height(TabTitleBar.totalHeight)
- .onReady(() => {
- var grad = context2D.createLinearGradient(x0, y0, x1, y1)
- grad.addColorStop(0.0, '#ffffffff')
- grad.addColorStop(1, '#00ffffff')
- context2D.fillStyle = grad
- context2D.fillRect(0, 0, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight)
- })
- }
- .width(TabTitleBar.gradientMaskWidth)
- .height(TabTitleBar.totalHeight)
- }
-
- build() {
- Column() {
- Flex({
- justifyContent: FlexAlign.SpaceBetween,
- alignItems: ItemAlign.Stretch
- }) {
- Stack({ alignContent: Alignment.End }) {
- Stack({ alignContent: Alignment.Start }) {
- Column() {
- List({ initialIndex: 0, scroller: this.scroller, space: 0 }) {
- ForEach(this.tabItems, (tabItem, index?: number) => {
- ListItem() {
- TabContentItem({
- item: tabItem,
- index: index,
- maxIndex: this.tabItems.length - 1,
- currentIndex: this.currentIndex,
- onCustomClick: () => this.currentIndex = index
- })
- }
- })
- }
- .width('100%')
- .height(TabTitleBar.totalHeight)
- .constraintSize({ maxWidth: this.tabWidth })
- .edgeEffect(EdgeEffect.Spring)
- .listDirection(Axis.Horizontal)
- .scrollBar(BarState.Off)
- }
- this.GradientMask(this.leftContext2D, 0, TabTitleBar.totalHeight / 2,
- TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2)
- }
- this.GradientMask(this.rightContext2D, TabTitleBar.gradientMaskWidth,
- TabTitleBar.totalHeight / 2, 0, TabTitleBar.totalHeight / 2)
- }
-
- if (this.menuItems !== undefined && this.menuItems.length > 0) {
- CollapsibleMenuSection({ menuItems: this.menuItems })
- .height(TabTitleBar.totalHeight)
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- this.menuSectionWidth = Number(newValue.width)
- })
- }
- }
- .backgroundColor($r('sys.color.ohos_id_color_background'))
- .margin({ right: $r('sys.float.ohos_id_max_padding_end') })
- .onAreaChange((_oldValue: Area, newValue: Area) => {
- this.tabWidth = Number(newValue.width) - this.menuSectionWidth
- })
-
- Column() {
- Swiper(this.swiperController) { this.swiperContent() }
- .index(this.currentIndex)
- .itemSpace(0)
- .indicator(false)
- .width('100%')
- .height('100%')
- .curve(Curve.Friction)
- .onChange((index) => {
- this.currentIndex = index
- this.scroller.scrollToIndex(this.currentIndex)
- this.scroller.scrollBy(TabTitleBar.correctionOffset, 0)
- })
- .onAppear(() => {
- this.scroller.scrollToIndex(this.currentIndex)
- this.scroller.scrollBy(TabTitleBar.correctionOffset, 0)
- })
- }
- }
- }
-}
-
-@Component
-struct CollapsibleMenuSection {
- menuItems: Array
-
- static readonly maxCountOfVisibleItems = 1
- private static readonly focusPadding = 4
- private static readonly marginsNum = 2
-
- @State isPopupShown: boolean = false
-
- @State isMoreIconOnFocus: boolean = false
- @State isMoreIconOnHover: boolean = false
- @State isMoreIconOnClick: boolean = false
-
- getMoreIconFgColor() {
- return this.isMoreIconOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getMoreIconBgColor() {
- if (this.isMoreIconOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isMoreIconOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Column() {
- Row() {
- if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) {
- ForEach(this.menuItems, (item) => {
- ImageMenuItem({ item: item })
- })
- } else {
- ForEach(this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), (item) => {
- ImageMenuItem({ item: item })
- })
-
- Row() {
- Image(PUBLIC_MORE)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(true)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getMoreIconFgColor())
- .backgroundColor(this.getMoreIconBgColor())
- .justifyContent(FlexAlign.Center)
- .border(this.isMoreIconOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => this.isMoreIconOnFocus = true)
- .onBlur(() => this.isMoreIconOnFocus = false)
- .onHover((isOn) => this.isMoreIconOnHover = isOn)
- .onKeyEvent((event) => {
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.isMoreIconOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isMoreIconOnClick = false
- }
- })
- .onClick(() => this.isPopupShown = true)
- .bindPopup(this.isPopupShown, {
- builder: this.popupBuilder,
- placement: Placement.Bottom,
- popupColor: Color.White,
- enableArrow: false,
- onStateChange: (e) => this.isPopupShown = e.isVisible
- })
- }
- }
- }
- .height('100%')
- // .margin({ right: $r('sys.float.ohos_id_default_padding_end') })
- .justifyContent(FlexAlign.Center)
- }
-
- @Builder popupBuilder() {
- Column() {
- ForEach(this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), (item, _index?) => {
- ImageMenuItem({ item: item })
- })
- }
- .width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum)
- .margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding })
- }
-}
-
-@Component
-struct TabContentItem {
- item: TabTitleBarTabItem
- index: number
- maxIndex: number
- onCustomClick?: () => void
-
- @Prop currentIndex: number
-
- @State isOnFocus: boolean = false
- @State isOnHover: boolean = false
- @State isOnClick: boolean = false
-
- static readonly imageSize = 24
- static readonly imageHotZoneWidth = 48
- static readonly imageMagnificationFactor = 1.4
- static readonly buttonBorderRadius = 8
- static readonly focusBorderWidth = 2
-
- getBgColor() {
- if (this.isOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Row() {
- Column() {
- if (this.item.icon === undefined) {
- Text(this.item.title)
- .fontSize(this.index === this.currentIndex
- ? $r('sys.float.ohos_id_text_size_headline7')
- : $r('sys.float.ohos_id_text_size_headline9'))
- .fontColor(this.index === this.currentIndex
- ? $r('sys.color.ohos_id_color_titlebar_text')
- : $r('sys.color.ohos_id_color_titlebar_text_off'))
- .fontWeight(FontWeight.Medium)
- .focusable(true)
- .padding({ top: this.index === this.currentIndex ? 6 : 10, left: 8, bottom: 2, right: 8 })
- .onFocus(() => this.isOnFocus = true)
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => this.isOnHover = isOn)
- .onKeyEvent((event) => {
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.onCustomClick && this.onCustomClick())
- } else {
- Row() {
- Image(this.item.icon)
- .alt(this.item.title)
- .height(TabContentItem.imageSize)
- .focusable(true)
- .scale({
- x: this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1,
- y: this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1
- })
- }
- .width(TabContentItem.imageHotZoneWidth)
- .height(TabContentItem.imageHotZoneWidth)
- .justifyContent(FlexAlign.Center)
- .onFocus(() => this.isOnFocus = true)
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => this.isOnHover = isOn)
- .onKeyEvent((event) => {
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.onCustomClick && this.onCustomClick())
- }
- }
- .justifyContent(FlexAlign.Center)
- }
- .height(TabTitleBar.totalHeight)
- .alignItems(VerticalAlign.Center)
- .justifyContent(FlexAlign.Center)
- .margin({
- left: this.index === 0 ? 16 : 0,
- right: this.index === this.maxIndex ? 12 : 0
- }) // sys.float.ohos_id_max_padding_start - 8
- .borderRadius(TabContentItem.buttonBorderRadius)
- .backgroundColor(this.getBgColor())
- .border(this.isOnFocus ?
- { width: TabContentItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- }
-}
-
-@Component
-struct ImageMenuItem {
- item: TabTitleBarMenuItem
-
- static readonly imageSize = 24
- static readonly imageHotZoneWidth = 48
- static readonly buttonBorderRadius = 8
- static readonly focusBorderWidth = 2
- static readonly disabledImageOpacity = 0.4
-
- @State isOnFocus: boolean = false
- @State isOnHover: boolean = false
- @State isOnClick: boolean = false
-
- getFgColor() {
- return this.isOnClick
- ? $r('sys.color.ohos_id_color_titlebar_icon_pressed')
- : $r('sys.color.ohos_id_color_titlebar_icon')
- }
-
- getBgColor() {
- if (this.isOnClick) {
- return $r('sys.color.ohos_id_color_click_effect')
- } else if (this.isOnHover) {
- return $r('sys.color.ohos_id_color_hover')
- } else {
- return Color.Transparent
- }
- }
-
- build() {
- Row() {
- Image(this.item.value)
- .width(ImageMenuItem.imageSize)
- .height(ImageMenuItem.imageSize)
- .focusable(this.item.isEnabled)
- }
- .width(ImageMenuItem.imageHotZoneWidth)
- .height(ImageMenuItem.imageHotZoneWidth)
- .borderRadius(ImageMenuItem.buttonBorderRadius)
- .foregroundColor(this.getFgColor())
- .backgroundColor(this.getBgColor())
- .justifyContent(FlexAlign.Center)
- .opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity)
- .border(this.isOnFocus ?
- { width: ImageMenuItem.focusBorderWidth,
- color: $r('sys.color.ohos_id_color_emphasize'),
- style: BorderStyle.Solid
- } : { width: 0 })
- .onFocus(() => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnFocus = true
- })
- .onBlur(() => this.isOnFocus = false)
- .onHover((isOn) => {
- if (!this.item.isEnabled) {
- return
- }
- this.isOnHover = isOn
- })
- .onKeyEvent((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
- return
- }
- if (event.type === KeyType.Down) {
- this.isOnClick = true
- }
- if (event.type === KeyType.Up) {
- this.isOnClick = false
- }
- })
- .onTouch((event) => {
- if (!this.item.isEnabled) {
- return
- }
- if (event.type === TouchType.Down) {
- this.isOnClick = true
- }
- if (event.type === TouchType.Up) {
- this.isOnClick = false
- }
- })
- .onClick(() => this.item.isEnabled && this.item.action && this.item.action())
- }
-}
-
-export default { TabTitleBar }
\ No newline at end of file
diff --git a/source/ToolBar/ToolBar.ets b/source/ToolBar/ToolBar.ets
deleted file mode 100644
index 06bf3fd..0000000
--- a/source/ToolBar/ToolBar.ets
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-export enum ItemState {
- ENABLE = 1,
- DISABLE = 2,
- ACTIVATE = 3
-}
-
-const PUBLIC_MORE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAIGNIUk0AAHomAACAhAAA" +
- "+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzA" +
- "AAOxAAADsQBlSsOGwAAAYFJREFUeNrt3CFLQ1EUB/CpCwYRo8G4j2IwCNrUYjH4AfwcfgBBwWZRMNgtFqPdILJgEhGDweAZvDjmJnfv3I" +
- "3fD/5l3DfOfWdv23vhdDoAAAAAAAAwzxam9L5rkePIdmSjee05chu5iHxXej5ar3saDdiJXDabGaYfOYg8VHbyU+peKryJvch1ZHnEmtXIY" +
- "eQ+8lrJyU+re7HgJtYj52Ou7Uau/thwW1LrLtmAk8jKBOsH37FHFTQgte6SDdht6ZjSUusu2YBeS8eUllr3YvLmuzP6971bYwP6/zjmpYKT" +
- "mVp3yQbctXRMaal1l2zAaeRngvUfkbMKGpBad8kbsffIZ2RrzPX7kacKGpBad+k74cfmE7I54ur6au4obyr6UU2re1oP43rNDc6wh1qDS/6t0" +
- "n83s1o3AAAAAAAAAAAAAEAysyKS6zYrIrlusyKS6zYrwqyIdGZFJDMrIplZETPIrIh5qdusCLMi0pkVkcysiAqYFVEJsyIAAAAAAAAAKOYXUlF" +
- "8EUcdfbsAAAAASUVORK5CYII=";
-
-@Observed
-export class ToolBarOption {
- content: string;
- action?: () => void;
- icon?: Resource;
- state?: ItemState = 1;
-}
-
-@Observed
-export class ToolBarOptions extends Array {
-}
-
-@Component
-export struct ToolBar {
- @ObjectLink toolBarList: ToolBarOptions
- controller: TabsController
- @Prop activateIndex: number = -1
- @State menuContent: { value: string, action: () => void }[] = []
- toolBarItemBackground: Resource[] = []
- @State itemBackground: Resource = $r('sys.color.ohos_id_color_toolbar_bg')
- @Builder MoreTabBuilder(index: number) {
- Column() {
- Image(PUBLIC_MORE)
- .width(24)
- .height(24)
- .fillColor($r('sys.color.ohos_id_color_toolbar_icon'))
- .margin({ top: 8, bottom: 2 })
- .objectFit(ImageFit.Contain)
- Text($r('app.string.id_string_more'))
- .fontColor($r('sys.color.ohos_id_color_toolbar_text'))
- .fontSize($r('sys.float.ohos_id_text_size_caption'))
- .fontWeight(FontWeight.Medium)
- }.width('100%').height('100%').bindMenu(this.menuContent, { offset: { x: 5, y : -10}})
- .padding({left: 4, right: 4})
- .borderRadius($r('sys.float.ohos_id_corner_radius_clicked'))
- }
-
- @Builder TabBuilder(index: number) {
- Column() {
- Image(this.toolBarList[index].icon)
- .width(24)
- .height(24)
- .fillColor(this.activateIndex === index && !(this.toolBarList[index].state === 2)
- ? $r('sys.color.ohos_id_color_text_primary_activated') : $r('sys.color.ohos_id_color_primary'))
- .opacity((this.toolBarList[index].state === 2) ? 0.4 : 1)
- .margin({ top: 8, bottom: 2 })
- .objectFit(ImageFit.Contain)
- Text(this.toolBarList[index].content)
- .fontColor(this.activateIndex === index && !(this.toolBarList[index].state === 2)
- ? $r('sys.color.ohos_id_color_toolbar_text_actived') : $r('sys.color.ohos_id_color_toolbar_text'))
- .fontSize($r('sys.float.ohos_id_text_size_caption'))
- .maxFontSize($r('sys.float.ohos_id_text_size_caption'))
- .minFontSize(9)
- .fontWeight(FontWeight.Medium)
- .maxLines(2)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .opacity((this.toolBarList[index].state === 2) ? 0.4 : 1)
- }
- .width('100%').height('100%')
- .focusable(!(this.toolBarList[index].state === 2))
- .focusOnTouch(!(this.toolBarList[index].state === 2))
- .padding({left: 4, right: 4})
- .borderRadius($r('sys.float.ohos_id_corner_radius_clicked'))
- .backgroundColor(this.itemBackground)
- .onClick(() => {
- if (this.toolBarList[index].state === 3) {
- if (this.activateIndex === index)
- this.activateIndex = -1
- else {
- this.activateIndex = index
- }
- }
- if (!(this.toolBarList[index].state === 2)) {
- this.toolBarList[index].action && this.toolBarList[index].action()
- }
- })
- .onHover((isHover: boolean) => {
- if (isHover ) {
- this.toolBarItemBackground[index] = (this.toolBarList[index].state === 2)
- ? $r('sys.color.ohos_id_color_toolbar_bg'): $r('sys.color.ohos_id_color_hover')
- } else {
- this.toolBarItemBackground[index] = $r('sys.color.ohos_id_color_toolbar_bg')
- }
- this.itemBackground = this.toolBarItemBackground[index]
- })
- .stateStyles({
- pressed: {
- .backgroundColor((this.toolBarList[index].state === 2) ? this.toolBarItemBackground[index] : $r('sys.color.ohos_id_color_click_effect'))
- },
- normal: {
- .backgroundColor(this.toolBarItemBackground[index])
- }
- })
- }
-
- refreshData() {
- this.menuContent = []
- for (let i = 0; i < this.toolBarList.length; i++) {
- if (i >= 4 && this.toolBarList.length > 5) {
- this.menuContent[i - 4] = {
- value: this.toolBarList[i].content,
- action: this.toolBarList[i].action
- }
- } else {
- this.toolBarItemBackground[i] = $r('sys.color.ohos_id_color_toolbar_bg')
- this.menuContent = []
- }
- }
- return true
- }
-
- aboutToAppear() {
- this.refreshData()
- }
- build() {
- Column() {
- Divider().width('100%').height(1)
- Column() {
- Tabs({ barPosition: BarPosition.End, controller: this.controller}) {
- ForEach(this.toolBarList, (item: ToolBarOption, index: number) => {
- if (this.toolBarList.length <= 5) {
- TabContent() {
- }.tabBar(this.TabBuilder(index))
- .enabled(!(this.toolBarList[index].state === 2))
- .focusOnTouch(!(this.toolBarList[index].state === 2))
- } else if (index < 4){
- TabContent() {
- }.tabBar(this.TabBuilder(index))
- .enabled(!(this.toolBarList[index].state === 2))
- .focusOnTouch(!(this.toolBarList[index].state === 2))
- }
- })
- if (this.refreshData() && this.toolBarList.length > 5) {
- TabContent() {
- }.tabBar(this.MoreTabBuilder(4))
- }
- }
- .vertical(false)
- .constraintSize({ minHeight: 56, maxHeight: 56})
- .barMode(BarMode.Fixed)
- .onChange((index: number) => {
- })
- .width('100%')
- .backgroundColor($r('sys.color.ohos_id_color_toolbar_bg'))
- }.width('100%')
- }
- }
-}
\ No newline at end of file
diff --git a/source/TreeView/TreeView.ets b/source/TreeView/TreeView.ets
deleted file mode 100644
index 8f56915..0000000
--- a/source/TreeView/TreeView.ets
+++ /dev/null
@@ -1,3327 +0,0 @@
-/*
- * Copyright (c) 2023-2023 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.
- */
-
-export namespace TreeView {
- const IMAGE_NODE_HEIGHT: number = 24
- const IMAGE_NODE_WIDTH: number = 24
- const ITEM_WIDTH: number = 0
- const ITEM_HEIGHT: number = 44
- const ITEM_HEIGHT_INPUT: number = 32
- const BORDER_WIDTH_HAS: number = 2
- const BORDER_WIDTH_NONE: number = 0
- const NODE_HEIGHT: number = 44
- const LIST_ITEM_HEIGHT_NONE: number = 0
- const LIST_ITEM_HEIGHT: number = 48
- const SHADOW_OFFSETY: number = 10
- const FLAG_NUMBER: number = 2
- const DRAG_OPACITY: number = 0.4
- const DRAG_OPACITY_NONE: number = 1
- const FLAG_LINE_HEIGHT: string = '1.5vp'
- const X_OFF_SET: string = '0vp'
- const Y_OFF_SET: string = '2.75vp'
- const Y_BOTTOM_OFF_SET: string = '-1.25vp'
- const Y_BASE_PLATE_OFF_SET: string = '1.5vp'
- const COLOR_SELECT: string = '#1A0A59F7'
- const COLOR_IMAGE_ROW: string = '#00000000'
- const COLOR_IMAGE_EDIT: string = '#FFFFFF'
- const SHADOW_COLOR: string = '#00001E'
- const GRAG_POP_UP_HEIGHT: string = '48'
- const LEFT_PADDING: string = '8vp'
- const RIGHT_PADDING: string = '8vp'
- const FLOOR_MIN_WIDTH: string = '128vp'
- const FLOOR_MAX_WIDTH: string = '208vp'
- const TEXT_MIN_WIDTH: string = '80vp'
- const TEXT_MAX_WIDTH: string = '160vp'
- const MIN_WIDTH: string = '112vp'
- const MAX_WIDTH: string = '192vp'
-
- export class TreeListener {
- _events = []
-
- constructor() {
- }
-
- /*
- * Event registration and processing.
- *
- * The event will not be destroyed after being processed.
- *
- * @param type Registered Events.
- * @param callback Event callback.
- * @since 10
- */
- public on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void) {
- if (Array.isArray(type)) {
- for (let i = 0, l = type.length; i < l; i++) {
- this.on(type[i], callback)
- }
- } else {
- (this._events[type] || (this._events[type] = [])).push(callback)
- }
- }
-
- /*
- * Event registration and processing.
- *
- * After the event is processed once, it will be destroyed.
- *
- * @param type Registered Events.
- * @param callback Event callback.
- * @since 10
- */
- public once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void) {
- let _self = this;
- function handler() {
- _self.off(type, handler);
- callback.apply(null, [type, callback]);
- }
-
- handler.callback = callback;
- this.on(type, handler);
- }
-
- /*
- * Destroy event.
- *
- * @param type Registered Events.
- * @param callback Event callback.
- * @since 10
- */
- public off(type: TreeListenType, callback: (callbackParam: CallbackParam) => void) {
- if (type == null) {
- this._events = [];
- }
- if (Array.isArray(type)) {
- for (let i = 0, l = type.length; i < l; i++) {
- this.off(type[i], callback)
- }
- }
- const cbs = this._events[type];
- if (!cbs) {
- return;
- }
- if (callback == null) {
- this._events[type] = null
- }
- let cb, i = cbs.length
- while (i--) {
- cb = cbs[i]
- if (cb === callback || cb.callback === callback) {
- cbs.splice(i, 1)
- break
- }
- }
- }
-
- /*
- * Triggers all callbacks of an event with parameters.
- *
- * @param event Registered Events.
- * @param argument Parameters returned by the callback event.
- * @since 10
- */
- public emit(event, argument: any[]) {
- let _self = this
- if (!this._events[event]) {
- return
- }
- let cbs = [...this._events[event]];
- if (cbs) {
- for (let i = 0, l = cbs.length; i < l; i++) {
- try {
- cbs[i].apply(_self,argument)
- } catch (e) {
- new Error(e)
- }
- }
- }
- }
- }
-
- /*
- * TreeListenType listen type.
- *
- * @since 10
- */
- export enum TreeListenType {
- NODE_ADD = "NodeAdd",
- NODE_DELETE = "NodeDelete",
- NODE_MODIFY = "NodeModify",
- NODE_MOVE = "NodeMove",
- NODE_CLICK = 'NodeClick',
- }
-
- /*
- * TreeListenerManager.
- *
- * @since 10
- */
- export class TreeListenerManager {
- static readonly APP_KEY_EVENT_BUS = "app_key_event_bus";
- private appEventBus: TreeListener;
- private constructor() {
- this.appEventBus = new TreeListener();
- }
-
- /*
- * Obtains the EventBusManager object.
- *
- * @since 10
- */
- public static getInstance(): TreeListenerManager {
- if (AppStorage.Get(this.APP_KEY_EVENT_BUS) == null) {
- AppStorage.SetOrCreate(this.APP_KEY_EVENT_BUS, new TreeListenerManager())
- }
- return AppStorage.Get(this.APP_KEY_EVENT_BUS);
- }
-
- /*
- * Obtains the EventBus object.
- *
- * @since 10
- */
- public getTreeListener(): TreeListener {
- return this.appEventBus;
- }
- }
-
- class BasicDataSource implements IDataSource {
- private listeners: DataChangeListener[] = []
-
- public totalCount(): number {
- return 0
- }
- public getData(index: number): any {
- return undefined
- }
-
- registerDataChangeListener(listener: DataChangeListener): void {
- if (this.listeners.indexOf(listener) < 0) {
- this.listeners.push(listener)
- }
- }
- unregisterDataChangeListener(listener: DataChangeListener): void {
- const pos = this.listeners.indexOf(listener);
- if (pos >= 0) {
- this.listeners.splice(pos, 1)
- }
- }
-
- notifyDataReload(): void {
- this.listeners.forEach(listener => {
- listener.onDataReloaded()
- })
- }
- notifyDataAdd(index: number): void {
- this.listeners.forEach(listener => {
- listener.onDataAdd(index)
- })
- }
- notifyDataChange(index: number): void {
- this.listeners.forEach(listener => {
- listener.onDataChange(index)
- })
- }
- notifyDataDelete(index: number): void {
- this.listeners.forEach(listener => {
- listener.onDataDelete(index)
- })
- }
- notifyDataMove(from: number, to: number): void {
- this.listeners.forEach(listener => {
- listener.onDataMove(from, to)
- })
- }
- }
-
- export enum Event {
- TOUCH_DOWN = 0,
- TOUCH_UP = 1,
- HOVER = 3,
- HOVER_OVER = 4,
- FOCUS = 5,
- BLUR = 6,
- MOUSE_BUTTON_RIGHT = 7,
- DRAG = 8
- }
-
- export enum MenuOperation {
- ADD_NODE = 0,
- REMOVE_NODE = 1,
- MODIFY_NODE = 2,
- COMMIT_NODE = 3
- }
-
- export enum PopUpType {
- HINTS = 0,
- WARNINGS = 1
- }
-
- export enum InputError {
- INVALID_ERROR = 0,
- LENGTH_ERROR = 1,
- NONE = 2
- }
-
- export enum Flag {
- DOWN_FLAG = 0,
- UP_FLAG = 1,
- NONE = 2
- }
-
- export class NodeItem {
- private nodeItem: { imageNode?: ImageNode,
- mainTitleNode?: MainTitleNode,
- imageCollapse?: ImageNode};
- private childNodeInfo: { isHasChildNode: boolean, childNum: number, allChildNum: number };
- menu: () => void;
- nodeLevel: number;
- parentNodeId: number;
- currentNodeId: number;
- children: Array;
- data: { isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon?: Resource,
- primaryTitle?: string,
- menu?: () => void,
- objectCount?: number | string }
-
- constructor(data: { isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon?: Resource,
- primaryTitle?: string,
- menu?: () => void,
- objectCount?: number | string }) {
- this.data = data;
- this.nodeLevel = -1;
- this.parentNodeId = -1;
- this.nodeItem = { imageNode: null, mainTitleNode: null, imageCollapse: null };
- this.childNodeInfo = { isHasChildNode: false, childNum: 0, allChildNum: 0 };
- this.menu = data.menu;
- if (data.icon) {
- this.nodeItem.imageNode = new ImageNode(data.icon, data.selectedIcon, data.editIcon,
- $r('sys.float.ohos_id_alpha_content_fourth'),
- IMAGE_NODE_HEIGHT,
- IMAGE_NODE_WIDTH);
- }
- if (data.primaryTitle) {
- this.nodeItem.mainTitleNode = new MainTitleNode(data.primaryTitle);
- }
- this.children = [];
- }
-
- addImageCollapse(isHasChildNode: boolean) {
- if (isHasChildNode) {
- this.nodeItem.imageCollapse = new ImageNode($r('sys.media.ohos_ic_public_arrow_right'), null, null,
- $r('sys.float.ohos_id_alpha_content_tertiary'),
- IMAGE_NODE_HEIGHT,
- IMAGE_NODE_WIDTH);
- this.nodeItem.imageCollapse.itemRightMargin = ($r('sys.float.ohos_id_text_paragraph_margin_xs'));
- } else {
- this.nodeItem.imageCollapse = null;
- }
- }
-
- getNodeItem() {
- return this.nodeItem;
- }
-
- getChildNodeInfo() {
- return this.childNodeInfo;
- }
-
- getMenu(): () => void {
- return this.menu;
- }
-
- getCurrentNodeId() {
- return this.currentNodeId;
- }
-
- getIsFolder() {
- return this.data.isFolder;
- }
- }
-
- class NodeBaseInfo {
- public rightMargin: Resource | number;
- private width: number;
- private height: number;
- constructor() {
- }
-
- set itemWidth(width: number) {
- this.width = width;
- }
-
- get itemWidth(): number {
- return this.width;
- }
-
- set itemHeight(height: number) {
- this.height = height;
- }
-
- get itemHeight(): number {
- return this.height;
- }
-
- set itemRightMargin(rightMargin: Resource | number) {
- this.rightMargin = rightMargin;
- }
-
- get itemRightMargin() {
- return this.rightMargin;
- }
- }
-
- export enum NodeStatus {
- Expand = 0,
- Collapse
- }
-
- export enum InteractionStatus {
- Normal = 0,
- Selected,
- Edit,
- FinishEdit,
- DragInsert,
- FinishDragInsert
- }
-
- export class ImageNode extends NodeBaseInfo {
- private imageSource: Resource;
- private imageNormalSource: Resource;
- private imageSelectedSource: Resource;
- private imageEditSource: Resource;
- private imageOpacity: Resource;
- private currentInteractionStatus: InteractionStatus;
- private imageCollapseSource: Resource;
- private imageCollapseDownSource: Resource;
- private isImageCollapse: boolean;
- private imageCollapseRightSource: Resource;
- constructor(imageSource: Resource, itemSelectedIcon: Resource, itemEditIcon: Resource,
- imageOpacity: Resource, itemWidth: number, itemHeight: number) {
- super();
- this.rightMargin = $r('sys.float.ohos_id_elements_margin_horizontal_m');
- this.imageSource = imageSource;
- this.imageNormalSource = imageSource;
- if (itemSelectedIcon != null) {
- this.imageSelectedSource = itemSelectedIcon;
- } else {
- this.imageSelectedSource = this.imageNormalSource;
- }
- if (itemEditIcon != null) {
- this.imageEditSource = itemEditIcon;
- } else {
- this.imageEditSource = this.imageNormalSource;
- }
- this.imageOpacity = imageOpacity;
- this.itemWidth = itemWidth;
- this.itemHeight = itemHeight;
- this.imageCollapseSource = imageSource;
- this.imageCollapseDownSource = $r('sys.media.ohos_ic_public_arrow_down');
- this.imageCollapseRightSource = $r('sys.media.ohos_ic_public_arrow_right');
- this.isImageCollapse = true;
- }
-
- get source() {
- return this.imageSource;
- }
-
- get normalSource() {
- return this.imageNormalSource;
- }
-
- get selectedSource() {
- return this.imageSelectedSource;
- }
-
- get editSource() {
- return this.imageEditSource;
- }
-
- get opacity() {
- return this.imageOpacity;
- }
-
- get noOpacity() {
- return 1;
- }
-
- get collapseSource() {
- return this.imageCollapseSource;
- }
-
- get isCollapse() {
- return this.isImageCollapse;
- }
-
- changeImageCollapseSource(nodeStatus: NodeStatus) {
- if (nodeStatus == NodeStatus.Expand) {
- this.imageCollapseSource = this.imageCollapseDownSource;
- } else if (nodeStatus == NodeStatus.Collapse) {
- this.imageCollapseSource = this.imageCollapseRightSource;
- }
- }
-
- setImageCollapseSource(interactionStatus: InteractionStatus, nodeStatus: NodeStatus) {
- if (interactionStatus === InteractionStatus.Edit || interactionStatus === InteractionStatus.DragInsert) {
- this.imageCollapseDownSource = $r('sys.media.ohos_ic_public_arrow_down');
- this.imageCollapseRightSource = $r('sys.media.ohos_ic_public_arrow_right');
- this.isImageCollapse = false;
- } else if (interactionStatus === InteractionStatus.FinishEdit ||
- interactionStatus === InteractionStatus.FinishDragInsert) {
- this.imageCollapseDownSource = $r('sys.media.ohos_ic_public_arrow_down');
- this.imageCollapseRightSource = $r('sys.media.ohos_ic_public_arrow_right');
- this.isImageCollapse = true;
- }
- this.imageCollapseSource = (nodeStatus == NodeStatus.Collapse) ?
- this.imageCollapseRightSource : this.imageCollapseDownSource;
- }
-
- setImageSource(interactionStatus: InteractionStatus) {
- switch (interactionStatus) {
- case InteractionStatus.Normal:
- this.imageSource = this.imageNormalSource;
- this.currentInteractionStatus = interactionStatus;
- break;
- case InteractionStatus.Selected:
- if (this.currentInteractionStatus !== InteractionStatus.Edit) {
- this.imageSource = this.imageSelectedSource;
- this.currentInteractionStatus = interactionStatus;
- }
- break;
- case InteractionStatus.Edit:
- this.imageSource = this.imageEditSource;
- this.currentInteractionStatus = interactionStatus;
- break;
- case InteractionStatus.FinishEdit:
- this.imageSource = this.imageSelectedSource;
- this.currentInteractionStatus = interactionStatus;
- break;
- case InteractionStatus.DragInsert:
- this.imageSource = this.imageEditSource;
- this.currentInteractionStatus = interactionStatus;
- break;
- case InteractionStatus.FinishDragInsert:
- this.imageSource = this.imageNormalSource;
- this.currentInteractionStatus = interactionStatus;
- break;
- default:
- break;
- }
- }
- }
-
- export class MainTitleNode extends NodeBaseInfo {
- private mainTitleName: string;
- private mainTitleSetting: { fontColor: Resource, fontSize: Resource, fontWeight: FontWeight }
- private showPopUpTimeout: number;
- constructor(mainTitleName: string) {
- super();
- this.mainTitleName = mainTitleName;
- this.itemWidth = ITEM_WIDTH;
- this.itemHeight = ITEM_HEIGHT;
- this.rightMargin = $r('sys.float.ohos_id_text_paragraph_margin_xs');
- this.mainTitleSetting = { fontColor: $r('sys.color.ohos_id_color_primary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Normal };
- this.showPopUpTimeout = 0;
- }
- setMainTitleSelected(isSelected: boolean): void {
- if (isSelected) {
- this.mainTitleSetting = { fontColor: $r('sys.color.ohos_id_color_text_primary_activated'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Regular };
- } else {
- this.mainTitleSetting = { fontColor: $r('sys.color.ohos_id_color_primary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Normal };
- }
- }
- set title(text: string) {
- this.mainTitleName = text;
- }
- get title(): string {
- return this.mainTitleName;
- }
-
- set popUpTimeout(showPopUpTimeout: number) {
- this.showPopUpTimeout = showPopUpTimeout;
- }
-
- get popUpTimeout() {
- return this.showPopUpTimeout;
- }
-
- get color(): Resource {
- return this.mainTitleSetting.fontColor;
- }
-
-
- get size(): Resource {
- return this.mainTitleSetting.fontSize;
- }
-
- get weight(): FontWeight {
- return this.mainTitleSetting.fontWeight;
- }
-
- setMainTitleHighLight(isHighLight: boolean): void {
- if (isHighLight) {
- this.mainTitleSetting = { fontColor: $r('sys.color.ohos_id_color_primary_contrary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Regular };
- } else {
- this.mainTitleSetting = { fontColor: $r('sys.color.ohos_id_color_primary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Normal };
- }
- }
-
- }
-
- export class InputText extends NodeBaseInfo {
- private inputTextSetting: { fontColor: Resource, fontSize: Resource, fontWeight: FontWeight }
- private status: { normal: Resource, hover: Resource, press: Resource };
- private statusColor: Resource = $r('sys.color.ohos_id_color_background');
- private editItemColor: Resource = $r('sys.color.ohos_id_color_emphasize');
- private radius: Resource = $r('sys.float.ohos_id_corner_radius_default_xs')
- constructor() {
- super();
- this.itemWidth = ITEM_WIDTH;
- this.itemHeight = ITEM_HEIGHT_INPUT;
- this.rightMargin = $r('sys.float.ohos_id_text_paragraph_margin_xs');
- this.inputTextSetting = {
- fontColor: $r('sys.color.ohos_id_color_text_primary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Normal };
- }
-
- get color(): Resource {
- return this.inputTextSetting.fontColor;
- }
-
- get size(): Resource {
- return this.inputTextSetting.fontSize;
- }
-
- get weight(): FontWeight {
- return this.inputTextSetting.fontWeight;
- }
-
- get borderRadius(): Resource {
- return this.radius;
- }
-
- get backgroundColor() {
- return this.statusColor;
- }
-
- get editColor() {
- return this.editItemColor;
- }
-
- get textInputStatusColor() {
- return this.status;
- }
- }
-
- export class NodeInfo {
- private childNodeInfo: { isHasChildNode: boolean, childNum: number, allChildNum: number };
- private parentNodeId: number;
- private currentNodeId: number;
- private nodeHeight: Resource | number;
- private nodeLevel: number;
- private nodeItem: { imageNode?: ImageNode,
- inputText: InputText,
- mainTitleNode?: MainTitleNode,
- imageCollapse?: ImageNode };
- private nodeLeftPadding: number;
- private nodeColor: Resource | string;
- private nodeIsShow: boolean;
- private status: { normal: Resource, hover: Resource, press: Resource, selected: string, highLight: Resource };
- private nodeBorder: { borderWidth: Resource | number, borderColor: Resource, borderRadius: Resource };
- private popUpInfo: { popUpIsShow: boolean,
- popUpEnableArrow: boolean,
- popUpColor: Resource,
- popUpText: string | Resource,
- popUpTextColor: Resource};
- private listItemHeight: number;
- private menu: () => void;
- private isShowTitle: boolean;
- private isShowInputText: boolean;
- private isSelected: boolean;
- readonly borderWidth: {has: Resource | number, none: Resource | number } =
- {has: BORDER_WIDTH_HAS/* 2vp */, none: BORDER_WIDTH_NONE/* 0vp */}
-
- /* parameter of the drag event.*/
- private nodeParam: {
- isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon?: Resource,
- primaryTitle?: string,
- menu?: () => void,
- secondaryTitle?: number | string
- };
- private node: NodeItem;
- private canShowFlagLine: boolean = false;
- private isOverBorder: boolean = false;
- private canShowBottomFlagLine: boolean = false;
- private isHighLight: boolean = false;
- private flagLineLeftMargin: number;
- private isModify: boolean = false;
-
- constructor(node: NodeItem) {
- this.childNodeInfo = node.getChildNodeInfo();
- this.nodeItem = { imageNode: null, inputText: null, mainTitleNode: null, imageCollapse: null };
- this.popUpInfo = { popUpIsShow: false,
- popUpEnableArrow: false,
- popUpColor: null,
- popUpText: '',
- popUpTextColor: null };
- this.nodeItem.imageNode = node.getNodeItem().imageNode;
- this.nodeItem.inputText = new InputText();
- this.nodeItem.mainTitleNode = node.getNodeItem().mainTitleNode;
- this.nodeItem.imageCollapse = node.getNodeItem().imageCollapse;
- this.menu = node.menu;
- this.parentNodeId = node.parentNodeId;
- this.currentNodeId = node.currentNodeId;
- this.nodeHeight = NODE_HEIGHT;
- this.nodeLevel = node.nodeLevel;
- this.nodeLeftPadding = node.nodeLevel * 12 + 8; // calculate left padding
- this.nodeColor = $r('sys.color.ohos_id_color_background');
- this.nodeIsShow = (this.nodeLevel > 0) ? false : true;
- this.listItemHeight = (this.nodeLevel > 0) ? LIST_ITEM_HEIGHT_NONE : LIST_ITEM_HEIGHT;
- this.isShowTitle = true;
- this.isShowInputText = false;
- this.isSelected = false;
- this.status = { normal: $r('sys.color.ohos_id_color_background_transparent'),
- hover: $r('sys.color.ohos_id_color_hover'),
- press: $r('sys.color.ohos_id_color_click_effect'),
- selected: COLOR_SELECT,
- highLight: $r('sys.color.ohos_id_color_activated')
- };
- this.nodeBorder = { borderWidth: BORDER_WIDTH_NONE,
- borderColor: $r('sys.color.ohos_id_color_focused_outline'),
- borderRadius: $r('sys.float.ohos_id_corner_radius_clicked')
- };
- this.flagLineLeftMargin = node.nodeLevel * 12 + 8;
- this.node = node;
- this.nodeParam = node.data;
- }
-
- getPopUpInfo() {
- return this.popUpInfo;
- }
-
- setPopUpIsShow(isShow: boolean) {
- this.popUpInfo.popUpIsShow = isShow;
- }
-
- setPopUpEnableArrow(popUpEnableArrow: boolean) {
- this.popUpInfo.popUpEnableArrow = popUpEnableArrow;
- }
-
- setPopUpColor(color: Resource) {
- this.popUpInfo.popUpColor = color;
- }
-
- setPopUpText(text: string | Resource) {
- this.popUpInfo.popUpText = text;
- }
-
- setPopUpTextColor(popUpTextColor: Resource) {
- this.popUpInfo.popUpTextColor = popUpTextColor;
- }
-
- getIsShowTitle() {
- return this.isShowTitle;
- }
-
- getIsShowInputText() {
- return this.isShowInputText;
- }
-
- setTitleAndInputTextStatus(isModify: boolean) {
- if (isModify) {
- this.isShowTitle = false;
- this.isShowInputText = true;
- } else {
- this.isShowTitle = true;
- this.isShowInputText = false;
- }
- }
-
- handleImageCollapseAfterAddNode(isAddImageCollapse: boolean) {
- // listTree this node already has ImageCollapse.
- if (isAddImageCollapse) {
- this.nodeItem.imageCollapse = new ImageNode($r('sys.media.ohos_ic_public_arrow_down'), null, null,
- $r('sys.float.ohos_id_alpha_content_tertiary'),
- IMAGE_NODE_HEIGHT,
- IMAGE_NODE_WIDTH);
- this.nodeItem.imageCollapse.itemRightMargin = ($r('sys.float.ohos_id_text_paragraph_margin_xs'));
- } else {
- this.nodeItem.imageCollapse = null;
- }
- }
-
- setNodeColor(nodeColor: Resource | string): void {
- this.nodeColor = nodeColor;
- }
-
- getNodeColor(): Resource | string {
- return this.nodeColor;
- }
-
- setListItemHeight(listItemHeight: number): void {
- this.listItemHeight = listItemHeight;
- }
-
- getListItemHeight(): number {
- return this.listItemHeight;
- }
-
- getNodeCurrentNodeId(): number {
- return this.currentNodeId;
- }
-
- getNodeParentNodeId(): number {
- return this.parentNodeId;
- }
-
- getNodeLeftPadding(): number {
- return this.nodeLeftPadding;
- }
-
- getNodeHeight(): Resource | number {
- return this.nodeHeight;
- }
-
- setNodeIsShow(nodeIsShow: boolean): void {
- this.nodeIsShow = nodeIsShow;
- }
-
- getNodeIsShow(): boolean {
- return this.nodeIsShow;
- }
-
- getNodeItem() {
- return this.nodeItem;
- }
-
- getNodeStatus() {
- return this.status;
- }
-
- getNodeBorder() {
- return this.nodeBorder;
- }
-
- setNodeBorder(isClearFocusStatus: boolean): void {
- this.nodeBorder.borderWidth = isClearFocusStatus ? this.borderWidth.has : this.borderWidth.none;
- }
-
- getChildNodeInfo() {
- return this.childNodeInfo;
- }
-
- getCurrentNodeId() {
- return this.currentNodeId;
- }
-
- getMenu() {
- return this.menu;
- }
-
- setIsSelected(isSelected: boolean) {
- this.isSelected = isSelected;
- }
-
- getIsSelected() {
- return this.isSelected;
- }
-
- /* To gain the information while to alter node. */
- getNodeInfoData() {
- return this.nodeParam;
- }
-
- /* To gain the tree Node(NodeItem) while to alter node. */
- public getNodeInfoNode() {
- return this.node;
- }
-
- public getIsFolder() {
- return this.nodeParam.isFolder;
- }
-
- public setCanShowFlagLine(canShowFlagLine: boolean) {
- this.canShowFlagLine = canShowFlagLine;
- }
-
- public getCanShowFlagLine(): boolean {
- return this.canShowFlagLine;
- }
-
- public setFlagLineLeftMargin(currentNodeLevel: number) {
- this.flagLineLeftMargin = currentNodeLevel * 12 + 8; // calculate
- }
-
- public getFlagLineLeftMargin(): number {
- return this.flagLineLeftMargin;
- }
-
- public getNodeLevel(): number {
- return this.nodeLevel;
- }
-
- public setIsOverBorder(isOverBorder: boolean) {
- this.isOverBorder = isOverBorder;
- }
-
- public getIsOverBorder() {
- return this.isOverBorder;
- }
-
- public setCanShowBottomFlagLine(canShowBottomFlagLine: boolean) {
- this.canShowBottomFlagLine = canShowBottomFlagLine;
- }
-
- public getCanShowBottomFlagLine() {
- return this.canShowBottomFlagLine;
- }
-
- public setIsHighLight(isHighLight: boolean) {
- this.isHighLight = isHighLight;
- }
-
- public getIsHighLight(): boolean {
- return this.isHighLight;
- }
-
- public setIsModify(isModify: boolean) {
- this.isModify = isModify;
- }
-
- public getIsModify(): boolean {
- return this.isModify;
- }
-
- }
-
-
- export class ListNodeUtils {
- private _root: NodeItem;
- public addNewNodeId: number;
- private readonly MaxNodeLevel = 50;
- private readonly MAX_CN_LENGTH: number = 254;
- private readonly MAX_EN_LENGTH: number = 255;
- private readonly INITIAL_INVALID_VALUE = -1;
- constructor() {
- this._root = new NodeItem({});
- this._root.nodeLevel = -1;
- this._root.parentNodeId = -1;
- this._root.currentNodeId = -1;
- }
-
- getNewNodeId() {
- return this.addNewNodeId;
- }
-
- traverseNodeDF(callback, root: NodeItem = this._root) {
- let stack = [], found = false;
- stack.unshift(root);
- let currentNode = stack.shift();
- while(!found && currentNode) {
- found = callback(currentNode) === true;
- if (!found) {
- stack.unshift(...currentNode.children);
- currentNode = stack.shift();
- }
- }
- }
-
- traverseNodeBF(callback) {
- let queue = [];
- let found: boolean = false;
- queue.push(this._root);
- let currentNode: NodeItem = queue.shift();
- while(!found && currentNode) {
- try {
- found = callback(currentNode);
- } catch(err) {
- var e = err.name + " == " + err.message;
- }
- if (!found) {
- queue.push(...currentNode.children)
- currentNode = queue.shift();
- }
- }
- }
-
- private contains(callback, traversal) {
- traversal.call(this, callback, true);
- }
-
- private updateParentChildNum(parentNode: NodeItem, isAdd: boolean, count: number) {
- let parentNodeId: number = parentNode.parentNodeId;
- while(parentNodeId >= 0) {
- this.traverseNodeDF((node: NodeItem): boolean => {
- if (node.currentNodeId == parentNodeId) {
- node.getChildNodeInfo().allChildNum =
- isAdd ? node.getChildNodeInfo().allChildNum + count : node.getChildNodeInfo().allChildNum - count;
- parentNodeId = node.parentNodeId;
- return false;
- }
- return false;
- })
- }
- }
-
- findParentNodeId(currentNodeId: number): number {
- let current = null,
- callback = function(node): boolean {
- if (node.currentNodeId == currentNodeId ) {
- current = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- return current.parentNodeId;
- }
-
- addNode(parentNodeId: number,
- currentNodeId: number,
- data: { isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon?: Resource,
- primaryTitle?: string,
- secondaryTitle?: number | string,
- menu?: () => void,
- }): ListNodeUtils {
- if (this._root === null) {
- this._root = new NodeItem({});
- this._root.nodeLevel = -1;
- this._root.parentNodeId = -1;
- this._root.currentNodeId = -1;
- }
-
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == parentNodeId ) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- if (parent) {
- let currentNode: NodeItem = new NodeItem(data);
- if (parent.nodeLevel > this.MaxNodeLevel) {
- throw new Error('ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.');
- }
- currentNode.nodeLevel = parent.nodeLevel + 1; // nodeLevel
- currentNode.parentNodeId = parentNodeId;
- currentNode.currentNodeId = currentNodeId;
- parent.children.push(currentNode);
- parent.getChildNodeInfo().isHasChildNode = true;
- parent.getChildNodeInfo().childNum = parent.children.length;
- parent.getChildNodeInfo().allChildNum += 1; // childNum
- parent.addImageCollapse(parent.getChildNodeInfo().isHasChildNode);
- this.updateParentChildNum(parent, true, 1);
- return this;
- } else {
- throw new Error('ListNodeUtils[addNode]: Parent node not found.');
- }
- }
-
- findNodeIndex(children, currentNodeId: number) {
- let index = this.INITIAL_INVALID_VALUE;
- for (let i = 0, len = children.length; i < len; i++) {
- if (children[i].currentNodeId === currentNodeId) {
- index = i;
- break;
- }
- }
- return index;
- }
-
- private freeNodeMemory(rootNode: NodeItem, removeNodeIdList: number[]) {
- let deleteNode: NodeItem[] = [];
- let callback = function(node): boolean {
- deleteNode.push(node);
- return false;
- };
- this.traverseNodeDF(callback, rootNode);
- deleteNode.forEach((value)=>{
- removeNodeIdList.push(value.currentNodeId);
- value = null;
- })
- }
-
- removeNode(currentNodeId: number, parentNodeId: number, traversal: any) {
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == parentNodeId) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, traversal);
-
- if (parent) {
- let removeNodeIdList: number[] = [];
- let index = this.findNodeIndex(parent.children, currentNodeId);
- if (index < 0) {
- throw new Error('Node does not exist.');
- } else {
- var deleteNodeAllChildNum = parent.children[index].getChildNodeInfo().allChildNum + 1;
- this.freeNodeMemory(parent.children[index], removeNodeIdList);
- let node = parent.children.splice(index, 1);
- node = null;
- if (parent.children.length == 0) {
- parent.addImageCollapse(false);
- }
- }
- parent.getChildNodeInfo().childNum = parent.children.length;
- parent.getChildNodeInfo().allChildNum -= (deleteNodeAllChildNum);
- this.updateParentChildNum(parent, false, deleteNodeAllChildNum);
- return removeNodeIdList;
- } else {
- throw new Error('Parent does not exist.');
- }
- }
-
- getNewNodeInfo(nodeId: number) {
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == nodeId) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- let newNodeInfo: { isFolder: boolean, icon: Resource, selectedIcon: Resource, editIcon: Resource, menu: () => any, secondaryTitle: number | string } =
- { isFolder: true, icon: null, selectedIcon: null, editIcon: null, menu: null, secondaryTitle: '' };
- if (parent) {
- if (parent.children.length === 0) {
- if (parent.getNodeItem().imageNode != null) {
- newNodeInfo.icon = parent.getNodeItem().imageNode.normalSource;
- newNodeInfo.selectedIcon = parent.getNodeItem().imageNode.selectedSource;
- newNodeInfo.editIcon = parent.getNodeItem().imageNode.editSource;
- newNodeInfo.menu = parent.getMenu();
- } else {
- newNodeInfo.icon = null;
- newNodeInfo.selectedIcon = null;
- newNodeInfo.editIcon = null;
- newNodeInfo.menu = parent.getMenu();
- }
- } else if (parent.children.length > 0) {
- if (parent.getNodeItem().imageNode != null) {
- newNodeInfo.icon = (parent.children[0].getNodeItem().imageNode != null) ?
- parent.children[0].getNodeItem().imageNode.normalSource : null;
- newNodeInfo.selectedIcon = (parent.children[0].getNodeItem().imageNode != null) ?
- parent.children[0].getNodeItem().imageNode.selectedSource : null;
- newNodeInfo.editIcon = (parent.children[0].getNodeItem().imageNode != null) ?
- parent.children[0].getNodeItem().imageNode.editSource : null;
- newNodeInfo.menu = parent.children[0].getMenu();
- } else {
- newNodeInfo.icon = null;
- newNodeInfo.selectedIcon = null;
- newNodeInfo.editIcon = null;
- newNodeInfo.menu = parent.children[0].getMenu();
- }
- }
- }
- return newNodeInfo;
- }
-
- getClickChildId(nodeId: number) {
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == nodeId) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- if (parent) {
- if (parent.children.length === 0) {
- return [];
- } else if (parent.children.length > 0) {
- var nodeInfo: { itemId: number, itemIcon: Resource, itemTitle: string } =
- { itemId: null, itemIcon: null, itemTitle: null }
- var childrenNodeInfo: Array = new Array(parent.children.length);
- for (let i = 0; i < childrenNodeInfo.length; i++) {
- childrenNodeInfo[i] = 0;
- }
- for (let i = 0; i < parent.children.length && i < childrenNodeInfo.length; i++) {
- childrenNodeInfo[i] = parent.children[i].currentNodeId;
- }
- return childrenNodeInfo;
- }
- }
- return [];
- }
-
- getClickNodeChildrenInfo(nodeId: number) {
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == nodeId) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- if (parent) {
- if (parent.children.length === 0) {
- return [];
- } else if (parent.children.length > 0) {
- var nodeInfo: { itemId: number, itemIcon: Resource, itemTitle: string } =
- { itemId: null, itemIcon: null, itemTitle: null }
- var childrenNodeInfo: Array<{ itemId: number, itemIcon: Resource, itemTitle: string, isFolder: boolean }> = new Array(parent.children.length);
- for (let i = 0; i < childrenNodeInfo.length; i++) {
- childrenNodeInfo[i] = { itemId: null, itemIcon: null, itemTitle: null, isFolder: null };
- }
- for (let i = 0; i < parent.children.length && i < childrenNodeInfo.length; i++) {
- childrenNodeInfo[i].itemId = parent.children[i].currentNodeId;
- if (parent.children[i].getNodeItem().imageNode) {
- childrenNodeInfo[i].itemIcon = parent.children[i].getNodeItem().imageNode.source;
- }
- if (parent.children[i].getNodeItem().mainTitleNode) {
- childrenNodeInfo[i].itemTitle = parent.children[i].getNodeItem().mainTitleNode.title;
- }
- childrenNodeInfo[i].isFolder = parent.children[i].getIsFolder();
- }
- return childrenNodeInfo;
- }
- }
- return [];
- }
-
- public checkMainTitleIsValid(title: string) : boolean {
- let invalid = /[\\\/:*?"<>|]/;
- let invalidLength = /^[\u4e00-\u9fa5]+$/;
- if (invalid.test(title)) {
- return false;
- }
- if ((invalidLength.test(title) && title.length > this.MAX_CN_LENGTH) ||
- (!invalidLength.test(title) && title.length > this.MAX_EN_LENGTH)) {
- return false;
- }
- return true;
- }
-
- /*
- * DFS: Depth first traversal in drag event.
- * @param callback
- */
- dragTraverseNodeDF(callback, root: NodeItem = this._root, listNode) {
- let stack = [], found = false;
- stack.unshift(root);
- let currentNode = stack.shift();
- while(!found && currentNode) {
- found = callback(currentNode, listNode) === true;
- if (!found) {
- stack.unshift(...currentNode.children);
- currentNode = stack.shift();
- }
- }
- }
-
- /*
- * Add the first dragging node in dragging nodes
- * 1.the first dragging node needs to distinguish the position to insert
- */
- addDragNode(parentNodeId: number,
- currentNodeId: number,
- insertCurrentNodeId: number,
- isAfter: boolean,
- data: { isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon?: Resource,
- primaryTitle?: string,
- menu?: () => any,
- objectCount?: number }): ListNodeUtils {
-
- if (this._root === null) {
- this._root = new NodeItem({});
- this._root.nodeLevel = this.INITIAL_INVALID_VALUE;
- this._root.parentNodeId = this.INITIAL_INVALID_VALUE;
- this._root.currentNodeId = this.INITIAL_INVALID_VALUE;
- }
-
- let parent = null,
- callback = function(node): boolean {
- if (node.currentNodeId == parentNodeId ) {
- parent = node;
- return true;
- }
- return false;
- };
- this.contains(callback, this.traverseNodeBF);
- if (parent) {
- let currentNode: NodeItem = new NodeItem(data);
- if (parent.nodeLevel > this.MaxNodeLevel) {
- throw new Error('ListNodeUtils[addNode]: The level of the tree view cannot exceed 50.');
- }
- currentNode.nodeLevel = parent.nodeLevel + 1;
- currentNode.parentNodeId = parentNodeId;
- currentNode.currentNodeId = currentNodeId;
- let insertIndex: number = this.INITIAL_INVALID_VALUE;
- if (parent.children.length) {
- for (let i = 0; i < parent.children.length; i++) {
- if ( parent.children[i].getCurrentNodeId() == insertCurrentNodeId) {
- insertIndex = i;
- break;
- }
- }
- if (isAfter) {
- parent.children.splice(insertIndex + 1, 0, currentNode);
- } else {
- parent.children.splice(insertIndex, 0, currentNode);
- }
- } else {
- parent.children.push(currentNode);
- }
- parent.getChildNodeInfo().isHasChildNode = true;
- parent.getChildNodeInfo().childNum = parent.children.length;
- parent.getChildNodeInfo().allChildNum += 1;
- parent.addImageCollapse(parent.getChildNodeInfo().isHasChildNode);
- this.updateParentChildNum(parent, true, 1);
- return this;
- } else {
- throw new Error('ListNodeUtils[addNode]: Parent node not found.');
- }
- }
-
- }
-
-
- export class ListNodeDataSource extends BasicDataSource {
- readonly ROOT_NODE_ID = -1;
- private listNodeUtils: ListNodeUtils = new ListNodeUtils();
- private listNode: NodeInfo[] = [];
- private readonly INITIAL_INVALID_VALUE = -1;
- private lastIndex: number = -1; // record the last focused node.
- thisIndex: number = -1; // records clicked nodes in the current period.
- private modifyNodeIndex: number = -1; // records the nodes edited in the current period.
- modifyNodeId: number = -1
- private currentOperation: MenuOperation;
- private expandAndCollapseInfo = new Map();
- private loadedNodeIdAndIndexMap = new Map(); // [currentNodeId, index]
- private isTouchDown: boolean = false;
- private appEventBus: TreeListener = TreeListenerManager.getInstance().getTreeListener();
-
- /* parameter of the drag event. */
- private isInnerDrag: boolean = false; // Judge whether it is an internal drag event.
- private isDrag: boolean = false; // It is used to handle events(For example, prevent press events) during global drag.
- private draggingCurrentNodeId: number = this.INITIAL_INVALID_VALUE; // Record the current ID of the dragged node.
- private draggingParentNodeId: number = this.INITIAL_INVALID_VALUE; // Record the parent ID of the dragged node.
- private currentNodeInfo: NodeInfo = null; // To solve the problem of currentIndex missed in onDrop event.
- private listItemOpacity : number = 1; // It is used to set the opacity of the node when dragged.
- private lastPassIndex: number = this.INITIAL_INVALID_VALUE; // record the last passing node index in drag.
- private lastPassId: number = this.INITIAL_INVALID_VALUE; // record the last passing node Id in drag.
- private thisPassIndex: number = this.INITIAL_INVALID_VALUE; // record the current passing node in drag.
- private lastDelayExpandIndex: number = this.INITIAL_INVALID_VALUE; // record last passing node in delay expand event.
- private timeoutExpandId: number = this.INITIAL_INVALID_VALUE;
- private lastTimeoutExpandId: number = this.INITIAL_INVALID_VALUE;
- private clearTimeoutExpandId: number = this.INITIAL_INVALID_VALUE;
- private timeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
- private lastTimeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
- private clearTimeoutHighLightId: number = this.INITIAL_INVALID_VALUE;
- private lastDelayHighLightIndex: number = this.INITIAL_INVALID_VALUE; // record last passing node in HighLight event.
- private lastDelayHighLightId: number = this.INITIAL_INVALID_VALUE; //record last passing node Id in HighLight event.
- private nodeIdAndSubtitleMap = new Map(); // [currentNodeId, subtitle]
- private flag: Flag = Flag.NONE;
- private selectedParentNodeId: number = this.INITIAL_INVALID_VALUE;
- private selectedParentNodeSubtitle: any = '';
- private insertNodeSubtitle: any = '';
- private currentFocusNodeId: number = this.INITIAL_INVALID_VALUE;
- private lastFocusNodeId: number = this.INITIAL_INVALID_VALUE;
- private addFocusNodeId: number = this.INITIAL_INVALID_VALUE;
-
- readonly FLAG_LINE: { flagLineHeight: string,
- flagLineColor: Resource,
- xOffset: string,
- yTopOffset: string,
- yBottomOffset: string,
- yBasePlateOffset: string } = {
- flagLineHeight: FLAG_LINE_HEIGHT,
- flagLineColor: $r('sys.color.ohos_id_color_activated'),
- xOffset: X_OFF_SET,
- yTopOffset: Y_OFF_SET,
- yBottomOffset: Y_BOTTOM_OFF_SET,
- yBasePlateOffset: Y_BASE_PLATE_OFF_SET
- }
-
- private readonly DRAG_POPUP: { floorConstraintSize: { minWidth: string, maxWidth: string },
- textConstraintSize: { minWidth1: string, maxWidth1: string,
- minWidth2: string, maxWidth2: string },
- padding: { left: string, right: string },
- backgroundColor: ResourceColor,
- height: string,
- shadow: { radius: Resource, color: ResourceColor, offsetX?: number, offsetY?: number },
- borderRadius : Resource,
- fontColor: Resource,
- fontSize: Resource,
- fontWeight: FontWeight
- imageOpacity: Resource } = {
- floorConstraintSize: { minWidth: FLOOR_MIN_WIDTH, maxWidth: FLOOR_MAX_WIDTH },
- textConstraintSize: { minWidth1: TEXT_MIN_WIDTH, maxWidth1: TEXT_MAX_WIDTH, minWidth2: MIN_WIDTH, maxWidth2: MAX_WIDTH },
- padding: { left: LEFT_PADDING, right: RIGHT_PADDING },
- backgroundColor: COLOR_IMAGE_EDIT,
- height: GRAG_POP_UP_HEIGHT,
- shadow: { radius: $r('sys.float.ohos_id_corner_radius_default_m'), color: SHADOW_COLOR, offsetX: 0, offsetY: SHADOW_OFFSETY },
- borderRadius: $r('sys.float.ohos_id_corner_radius_clicked'),
- fontColor: $r('sys.color.ohos_id_color_primary'),
- fontSize: $r('sys.float.ohos_id_text_size_body1'),
- fontWeight: FontWeight.Regular,
- imageOpacity: $r('sys.float.ohos_id_alpha_content_fourth')
- }
-
- private readonly subTitle: { normalFontColor: Resource,
- highLightFontColor: Resource,
- fontSize: Resource,
- fontWeight: FontWeight,
- margin: { left: string, right: string } } = {
- normalFontColor: $r('sys.color.ohos_id_color_secondary'),
- highLightFontColor: $r('sys.color.ohos_id_color_primary_contrary'),
- fontSize: $r('sys.float.ohos_id_text_size_body2'),
- fontWeight: FontWeight.Regular,
- margin: { left: '4vp', right: '24' }
- }
-
- private changeNodeColor(index: number, color: Resource | string): void {
- this.listNode[index].setNodeColor(color);
- }
-
- private getNodeColor(index) {
- return this.listNode[index].getNodeColor();
- }
-
- private handleFocusEffect(index: number, isClearFocusStatus: boolean) {
- if (this.listNode[index].getNodeIsShow()) {
- this.listNode[index].setNodeBorder(isClearFocusStatus);
- }
- }
-
- private setImageSource(index: number, interactionStatus: InteractionStatus) {
- let nodeInfo: NodeInfo = this.listNode[index];
- nodeInfo.setIsSelected(interactionStatus === InteractionStatus.Selected ||
- interactionStatus === InteractionStatus.Edit || interactionStatus === InteractionStatus.FinishEdit);
- if (nodeInfo.getNodeItem().mainTitleNode != null && interactionStatus != InteractionStatus.DragInsert &&
- interactionStatus != InteractionStatus.FinishDragInsert) {
- nodeInfo.getNodeItem().mainTitleNode.setMainTitleSelected(interactionStatus === InteractionStatus.Selected ||
- interactionStatus === InteractionStatus.FinishEdit);
- }
- if (nodeInfo.getNodeItem().imageNode != null) {
- nodeInfo.getNodeItem().imageNode.setImageSource(interactionStatus);
- }
- }
-
- private setImageCollapseSource(index: number, interactionStatus: InteractionStatus) {
- let nodeInfo: NodeInfo = this.listNode[index];
- if (nodeInfo.getNodeItem().imageCollapse != null) {
- nodeInfo.getNodeItem().imageCollapse.setImageCollapseSource(interactionStatus,
- this.expandAndCollapseInfo.get(nodeInfo.getCurrentNodeId()));
- }
- }
-
- public clearLastIndexStatus() {
- if (this.lastIndex == -1 || this.lastIndex >= this.listNode.length) {
- return;
- }
- this.setImageSource(this.lastIndex, InteractionStatus.Normal);
- this.changeNodeColor(this.lastIndex, this.listNode[this.lastIndex].getNodeStatus().normal);
- this.handleFocusEffect(this.lastIndex, false);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastIndex].getCurrentNodeId()));
- }
-
- private changeNodeStatus(clickIndex: number): void {
- let thisIndex: number = clickIndex;
- let tmp: NodeInfo[] = this.ListNode;
- let nodeId = tmp[clickIndex].getCurrentNodeId();
- if (this.expandAndCollapseInfo.get(nodeId) == NodeStatus.Expand) {
- this.expandAndCollapseInfo.set(nodeId, NodeStatus.Collapse);
- tmp[thisIndex].getNodeItem().imageCollapse.changeImageCollapseSource(NodeStatus.Collapse);
- } else if (this.expandAndCollapseInfo.get(nodeId) == NodeStatus.Collapse) {
- this.expandAndCollapseInfo.set(nodeId, NodeStatus.Expand);
- tmp[thisIndex].getNodeItem().imageCollapse.changeImageCollapseSource(NodeStatus.Expand);
- }
- }
-
- private handleExpandAndCollapse(clickIndex: number) {
- let thisIndex: number = clickIndex;
- let tmp: NodeInfo[] = this.ListNode;
- let nodeId = tmp[thisIndex].getCurrentNodeId();
- if (!this.expandAndCollapseInfo.has(nodeId)) {
- return;
- }
-
- let rootNodeStatus: NodeStatus = this.expandAndCollapseInfo.get(nodeId);
- if (tmp[thisIndex].getChildNodeInfo().isHasChildNode && rootNodeStatus == NodeStatus.Collapse) {
- for(var i = 0; i < tmp[thisIndex].getChildNodeInfo().allChildNum; i++) {
- tmp[thisIndex + 1 + i].setNodeIsShow(false);
- tmp[thisIndex + 1 + i].setListItemHeight(LIST_ITEM_HEIGHT_NONE);
- }
- this.notifyDataReload();
- return;
- }
-
- let childNum: number[] = new Array(tmp[thisIndex].getChildNodeInfo().childNum);
- childNum[0] = thisIndex + 1;
- let index = 1;
- while(index < tmp[thisIndex].getChildNodeInfo().childNum) {
- childNum[index] = childNum[index -1] + tmp[childNum[index - 1]].getChildNodeInfo().allChildNum + 1;
- index++;
- }
- if (rootNodeStatus == NodeStatus.Expand) {
- for(var i = 0; i < childNum.length; i++) {
- tmp[childNum[i]].setNodeIsShow(true);
- tmp[childNum[i]].setListItemHeight(LIST_ITEM_HEIGHT);
- let nodeId = tmp[childNum[i]].getCurrentNodeId();
- if(this.expandAndCollapseInfo.get(nodeId) == NodeStatus.Expand) {
- this.handleExpandAndCollapse(childNum[i]);
- }
- }
- }
- childNum = null;
- this.notifyDataReload();
- }
-
- public init(listNodeUtils: ListNodeUtils) {
- let index = 0;
- this.listNode = [];
- this.listNodeUtils = listNodeUtils;
- this.loadedNodeIdAndIndexMap.clear();
- this.listNodeUtils.traverseNodeDF((node: NodeItem): boolean => {
- if (node.currentNodeId >= 0) {
- var nodeInfo: NodeInfo = new NodeInfo(node);
- this.listNode.push(nodeInfo);
- if (nodeInfo.getChildNodeInfo().isHasChildNode) {
- this.expandAndCollapseInfo.set(nodeInfo.getCurrentNodeId(), NodeStatus.Collapse);
- }
- if (nodeInfo.getNodeIsShow()) {
- this.loadedNodeIdAndIndexMap.set(nodeInfo.getCurrentNodeId(), index++);
- }
- if (nodeInfo.getIsFolder()) {
- this.nodeIdAndSubtitleMap.set(nodeInfo.getCurrentNodeId(),
- nodeInfo.getNodeInfoData().secondaryTitle || nodeInfo.getNodeInfoData().secondaryTitle == 0 ?
- nodeInfo.getNodeInfoData().secondaryTitle : '');
- }
- }
- return false;
- });
- }
-
- private refreshRemoveNodeData(removeNodeIdList: number[], parentNodeInfo: NodeInfo) {
- let deleteIndexList: number[] = [];
- for (let i = 0; i < removeNodeIdList.length; i++) {
- for (let j = 0; j < this.listNode.length; j++) {
- if (this.listNode[j].getNodeCurrentNodeId() == removeNodeIdList[i]) {
- let currentNodeId = this.listNode[j].getNodeCurrentNodeId();
- if (this.loadedNodeIdAndIndexMap.has(currentNodeId)) {
- // this.listNode index to lazyForEach index.
- deleteIndexList.push(this.loadedNodeIdAndIndexMap.get(currentNodeId));
- }
- let deleteNode = this.listNode.splice(j, 1);
- deleteNode = null; // free memory
- if (this.expandAndCollapseInfo.has(removeNodeIdList[i])) {
- this.expandAndCollapseInfo.delete(removeNodeIdList[i]); // delete deleteNode expandAndCollapseInfo.
- }
- break;
- }
- }
- }
- deleteIndexList.forEach((value)=>{
- this.notifyDataDelete(value); // notifyDataDelete do not update data.
- this.notifyDataChange(value); // call notifyDataChange to update data.
- })
- let index: number = 0;
- for (let i = 0; i < this.listNode.length; i++) {
- if (this.listNode[i].getNodeCurrentNodeId() == parentNodeInfo.getNodeCurrentNodeId()) {
- if (parentNodeInfo.getNodeItem().imageCollapse == null) {
- this.listNode[i].handleImageCollapseAfterAddNode(false);
- // delete deleteNode parentNode expandAndCollapseInfo.
- this.expandAndCollapseInfo.delete(parentNodeInfo.getNodeCurrentNodeId());
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[i].getNodeCurrentNodeId()));
- }
- break;
- }
- }
- let callbackParam: CallbackParam = {currentNodeId: parentNodeInfo.getNodeCurrentNodeId(), parentNodeId: parentNodeInfo.getNodeParentNodeId()};
- this.appEventBus.emit(TreeListenType.NODE_DELETE, [callbackParam]);
- }
-
- private refreshAddNodeData(addNodeIdList: number[]) {
- var addNodeInfo: NodeInfo;
- this.listNodeUtils.traverseNodeDF((node: NodeItem): boolean => {
- if (node.currentNodeId === addNodeIdList[0]) {
- addNodeInfo = new NodeInfo(node);
- return true;
- }
- return false;
- });
- addNodeInfo.setIsModify(true);
-
- let index: number = 0;
- for (let i = 0; i < this.listNode.length; i++) {
- if (this.listNode[i].getNodeCurrentNodeId() == addNodeInfo.getNodeParentNodeId()) {
- index = i;
- if (this.listNode[i].getNodeItem().imageCollapse == null) {
- this.listNode[i].handleImageCollapseAfterAddNode(true);
- this.notifyDataChange(index);
- } else if (this.expandAndCollapseInfo.get(this.listNode[i].getNodeCurrentNodeId()) == NodeStatus.Collapse) {
- this.changeNodeStatus(index);
- }
- this.listNode.splice(i + 1, 0, addNodeInfo);
- this.listNode[i + 1].setTitleAndInputTextStatus(true); // false->true: realize inner Interaction.
- this.listNode[i + 1].setNodeIsShow(true);
- this.listNode[i + 1].setListItemHeight(LIST_ITEM_HEIGHT);
- this.setImageSource(i + 1, InteractionStatus.Edit); // Normal->Edit : realize inner Interaction.
- this.currentOperation = MenuOperation.ADD_NODE;
- this.notifyDataAdd(i + 1);
- this.notificationNodeInfo(i+1, this.currentOperation);
- break;
- }
- }
- this.modifyNodeIndex = index + 1;
- this.expandAndCollapseInfo.set(addNodeInfo.getNodeParentNodeId(), NodeStatus.Expand);
- this.handleExpandAndCollapse(index);
- }
-
- public refreshData(listNodeUtils: ListNodeUtils, operation: MenuOperation,
- parentNodeId: number, changeNodeIdList: number[]) {
- let parentNodeInfo: NodeInfo;
- this.listNodeUtils = listNodeUtils;
- this.listNodeUtils.traverseNodeDF((node: NodeItem): boolean => {
- if (node.currentNodeId == parentNodeId) {
- parentNodeInfo = new NodeInfo(node);
- return true;
- }
- return false;
- });
-
- if (operation === MenuOperation.REMOVE_NODE) {
- this.nodeIdAndSubtitleMap.set(parentNodeId, this.selectedParentNodeSubtitle);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(parentNodeId));
- this.refreshRemoveNodeData(changeNodeIdList, parentNodeInfo);
- }
-
- if (operation === MenuOperation.ADD_NODE) {
- this.addFocusNodeId = changeNodeIdList[0];
- this.nodeIdAndSubtitleMap.set(this.getClickNodeId(), this.selectedParentNodeSubtitle);
- this.nodeIdAndSubtitleMap.set(changeNodeIdList[0], this.insertNodeSubtitle);
- this.refreshAddNodeData(changeNodeIdList);
- }
- }
-
- public setClickIndex(index: number) {
- this.thisIndex = index;
- }
-
- public getClickNodeId(): number {
- if (this.thisIndex < 0 || this.thisIndex >= this.ListNode.length) {
- return -1;
- }
- return this.ListNode[this.thisIndex].getCurrentNodeId();
- }
-
- public expandAndCollapseNode(clickIndex: number) {
- this.changeNodeStatus(clickIndex);
- this.handleExpandAndCollapse(clickIndex)
- }
-
- public getIsTouchDown(): boolean {
- return this.isTouchDown;
- }
-
- public getLastIndex(): number {
- return this.lastIndex;
- }
-
- public handleEvent(event: Event, index: number) {
- /* Return while the event is dragging event. */
- if (this.isDrag) {
- return;
- }
-
- if (event === Event.TOUCH_DOWN || event === Event.TOUCH_UP || event === Event.MOUSE_BUTTON_RIGHT) {
- if (index != this.lastIndex) {
- this.clearLastIndexStatus();
- }
- }
- let lazyForEachIndex = this.loadedNodeIdAndIndexMap.get(this.listNode[index].getCurrentNodeId());
- switch(event) {
- case Event.TOUCH_DOWN:
- this.isTouchDown = true;
- this.changeNodeColor(index, this.listNode[index].getNodeStatus().press);
- break;
- case Event.TOUCH_UP: {
- if (this.isInnerDrag) {
- this.isInnerDrag = false;
- }
- this.isTouchDown = false;
- let nodeInfo: NodeInfo = this.listNode[index];
- this.setImageSource(index, InteractionStatus.Selected);
- this.lastIndex = index;
- this.changeNodeColor(index, nodeInfo.getNodeStatus().selected);
- this.notifyDataChange(lazyForEachIndex);
- break;
- }
- case Event.HOVER:
- if (this.getNodeColor(index) != this.listNode[index].getNodeStatus().selected) {
- this.changeNodeColor(index, this.listNode[index].getNodeStatus().hover);
- this.notifyDataChange(lazyForEachIndex);
- }
- break;
- case Event.HOVER_OVER:
- if (this.getNodeColor(index) != this.listNode[index].getNodeStatus().selected) {
- this.changeNodeColor(index, this.listNode[index].getNodeStatus().normal);
- this.notifyDataChange(lazyForEachIndex);
- }
- break;
- case Event.FOCUS:
- this.handleFocusEffect(index, true);
- this.notifyDataChange(lazyForEachIndex);
- break;
- case Event.BLUR:
- this.handleFocusEffect(index, false);
- this.notifyDataChange(lazyForEachIndex);
- break;
- case Event.MOUSE_BUTTON_RIGHT:
- this.lastIndex = index;
- this.finishEditing();
- break;
- case Event.DRAG:
- this.isTouchDown = false;
- let nodeInfo: NodeInfo = this.listNode[index];
- this.setImageSource(index, InteractionStatus.Selected);
- this.lastIndex = index;
- this.changeNodeColor(index, nodeInfo.getNodeStatus().selected);
- this.notifyDataChange(lazyForEachIndex);
- break;
- default:
- break;
- }
- }
-
- private notificationNodeInfo(addNodeId: number, operation: MenuOperation) {
- if (operation === MenuOperation.MODIFY_NODE) {
- let modifyNodeInfo: NodeInfo = this.listNode[this.modifyNodeIndex];
- let backParamModify: CallbackParam = { currentNodeId: modifyNodeInfo.getNodeCurrentNodeId(),
- parentNodeId: modifyNodeInfo.getNodeParentNodeId() }
- this.appEventBus.emit(TreeListenType.NODE_MODIFY,
- [backParamModify]);
- } else if (operation === MenuOperation.ADD_NODE) {
- let addNodeInfo: NodeInfo = this.listNode[addNodeId];
- let icon: Resource = (addNodeInfo.getNodeItem().imageNode != null) ?
- addNodeInfo.getNodeItem().imageNode.source : null;
- let selectedIcon: Resource = (addNodeInfo.getNodeItem().imageNode != null) ?
- addNodeInfo.getNodeItem().imageNode.selectedSource : null;
- let editIcon: Resource = (addNodeInfo.getNodeItem().imageNode != null) ?
- addNodeInfo.getNodeItem().imageNode.editSource : null;
- let callbackParam: CallbackParam = { currentNodeId: addNodeInfo.getNodeCurrentNodeId(),
- parentNodeId: addNodeInfo.getNodeParentNodeId() }
- this.appEventBus.emit(TreeListenType.NODE_ADD,
- [callbackParam]);
- }
- }
-
- public finishEditing() {
- if (this.modifyNodeIndex!= -1) {
- this.setImageSource(this.modifyNodeIndex, InteractionStatus.FinishEdit);
- this.setImageCollapseSource(this.modifyNodeIndex, InteractionStatus.FinishEdit);
- this.listNode[this.modifyNodeIndex].setIsModify(false);
- this.listNode[this.modifyNodeIndex].setTitleAndInputTextStatus(false);
- this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
- this.notifyDataChange(this.modifyNodeIndex);
- }
- }
-
- public setItemVisibilityOnEdit(nodeId: number, operation: MenuOperation) {
- let index: number = -1;
- if (nodeId == -1) {
- return;
- }
- if (operation === MenuOperation.MODIFY_NODE) {
- for (let i = 0; i < this.listNode.length; i++) { // nodeId to find index
- if (this.listNode[i].getCurrentNodeId() == nodeId) {
- index = i;
- break;
- }
- }
- let nodeInfo: NodeInfo = this.listNode[index];
- nodeInfo.setIsModify(true);
- if (nodeInfo.getNodeItem().mainTitleNode === null) {
- return; // no title
- }
-
- this.currentOperation = MenuOperation.MODIFY_NODE;
- nodeInfo.setTitleAndInputTextStatus(true);
- this.setImageSource(index, InteractionStatus.Edit);
- this.setImageCollapseSource(index, InteractionStatus.Edit);
- this.modifyNodeIndex = index;
- if (nodeInfo.getNodeItem().inputText) {
- if (nodeInfo.getNodeItem().imageCollapse != null) {
- nodeInfo.getNodeItem().inputText.rightMargin =
- $r('sys.float.ohos_id_text_paragraph_margin_xs')
- } else {
- nodeInfo.getNodeItem().inputText.rightMargin =
- $r('sys.float.ohos_id_elements_margin_horizontal_m')
- }
- }
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(nodeId));
- }
- index = nodeId;
- if (operation === MenuOperation.COMMIT_NODE) {
- let nodeInfo: NodeInfo = this.listNode[index];
- nodeInfo.setTitleAndInputTextStatus(false);
- nodeInfo.setIsModify(false);
- this.setImageSource(index, InteractionStatus.FinishEdit);
- this.setImageCollapseSource(index, InteractionStatus.FinishEdit);
- this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(nodeInfo.getCurrentNodeId()));
- }
- }
-
- public setPopUpInfo(popUpType: PopUpType, inputError: InputError, isShow: boolean, index: number) {
- let nodeInfo: NodeInfo = this.listNode[index];
- nodeInfo.setPopUpIsShow(isShow);
- // this.listNode index to lazyForEach index.
- let lazyForEachIndex = this.loadedNodeIdAndIndexMap.get(nodeInfo.getCurrentNodeId());
- if (!isShow) {
- this.notifyDataChange(lazyForEachIndex);
- return;
- }
- if (popUpType === PopUpType.HINTS) {
- if (nodeInfo.getNodeItem().mainTitleNode != null) {
- nodeInfo.setPopUpText(nodeInfo.getNodeItem().mainTitleNode.title);
- } else {
- nodeInfo.setPopUpText('');
- nodeInfo.setPopUpIsShow(false);
- }
- nodeInfo.setPopUpEnableArrow(false);
- nodeInfo.setPopUpColor($r('sys.color.ohos_id_color_background'));
- nodeInfo.setPopUpTextColor($r('sys.color.ohos_id_color_text_secondary'));
- } else if (popUpType === PopUpType.WARNINGS) {
- if (nodeInfo.getNodeItem().inputText != null) {
- if (inputError === InputError.INVALID_ERROR) {
- nodeInfo.setPopUpText("invalid error");
- } else if (inputError === InputError.LENGTH_ERROR) {
- nodeInfo.setPopUpText("length error");
- }
- nodeInfo.setPopUpEnableArrow(true);
- nodeInfo.setPopUpColor($r('sys.color.ohos_id_color_help_tip_bg'));
- nodeInfo.setPopUpTextColor($r('sys.color.ohos_id_color_text_hint_contrary'));
- }
- }
- this.notifyDataChange(lazyForEachIndex);
- }
-
- public setShowPopUpTimeout(timeout: number, index: number) {
- if (this.listNode[index].getNodeItem().mainTitleNode != null) {
- this.listNode[index].getNodeItem().mainTitleNode.popUpTimeout = timeout;
- }
- // this.notifyDataChange(index) lazyForEachIndex;
- let lazyForEachIndex = this.loadedNodeIdAndIndexMap.get(this.listNode[index].getCurrentNodeId());
- this.notifyDataChange(lazyForEachIndex);
- }
-
- public setMainTitleNameOnEdit(index: number, text: string) {
- this.modifyNodeIndex = index;
- if (this.listNode[index].getNodeItem().mainTitleNode != null) {
- this.listNode[index].getNodeItem().mainTitleNode.title = text;
- // this.listNode index to lazyForEach index.
- let lazyForEachIndex = this.loadedNodeIdAndIndexMap.get(this.listNode[index].getCurrentNodeId());
- this.notifyDataChange(lazyForEachIndex);
- }
- }
-
- public get ListNode(): NodeInfo[] {
- return this.listNode;
- }
-
- public totalCount(): number {
- let count: number = 0;
- let index: number = 0;
- this.loadedNodeIdAndIndexMap.clear();
- for (let i =0 ; i < this.listNode.length; i++) {
- if (this.listNode[i].getNodeIsShow()) {
- this.loadedNodeIdAndIndexMap.set(this.listNode[i].getCurrentNodeId(), index++);
- count++;
- }
- }
- return count;
- }
-
- public getData(index: number): any {
- let count = 0;
- for (let i = 0; i < this.listNode.length; i++) {
- if (this.listNode[i].getNodeIsShow()) {
- if (index == count) {
- return this.listNode[i];
- }
- count++;
- }
- }
- return null;
- }
-
- public addData(index: number, data: NodeInfo): void {
- this.listNode.splice(index, 0, data)
- this.notifyDataAdd(index)
- }
-
- public pushData(data: NodeInfo): void {
- this.listNode.push(data)
- this.notifyDataAdd(this.listNode.length - 1)
- }
-
- public setIsInnerDrag(isInnerDrag: boolean) {
- this.isInnerDrag = isInnerDrag;
- }
-
- public getIsInnerDrag(): boolean {
- return this.isInnerDrag;
- }
-
- public setIsDrag(isDrag: boolean) {
- this.isDrag = isDrag;
- }
-
- public getIsDrag(): boolean {
- return this.isDrag;
- }
-
- public setCurrentNodeInfo(currentNodeInfo: NodeInfo) {
- this.currentNodeInfo = currentNodeInfo;
- }
-
- public getCurrentNodeInfo() {
- return this.currentNodeInfo;
- }
-
- public setDraggingParentNodeId(draggingParentNodeId: number) {
- this.draggingParentNodeId = draggingParentNodeId;
- }
-
- public getDraggingParentNodeId() {
- return this.draggingParentNodeId;
- }
-
- public getDraggingCurrentNodeId() {
- return this.draggingCurrentNodeId;
- }
-
- public setDraggingCurrentNodeId(draggingCurrentNodeId: number) {
- this.draggingCurrentNodeId = draggingCurrentNodeId;
- }
-
- public setListItemOpacity(listItemOpacity: number) {
- this.listItemOpacity = listItemOpacity;
- }
-
- public getListItemOpacity(item: NodeInfo) {
- return item.getCurrentNodeId() == this.getDraggingCurrentNodeId() ? this.listItemOpacity : 1;
- }
-
- public getDragPopupPara() {
- return this.DRAG_POPUP;
- }
-
- public setLastPassIndex(lastPassIndex: number) {
- this.lastPassIndex = lastPassIndex;
- }
-
- public getLastPassIndex(): number {
- return this.lastPassIndex;
- }
-
- public getIsParentOfInsertNode(insertNodeId: number): boolean {
- let selectedNodeItem: NodeItem = this.currentNodeInfo.getNodeInfoNode();
- let isParentNodeOfInsertNode = false,
- callback = function(node): boolean {
- if (node.currentNodeId == insertNodeId ) {
- isParentNodeOfInsertNode = true;
- return true;
- }
- return false;
- };
- this.listNodeUtils.traverseNodeDF(callback, selectedNodeItem);
- return isParentNodeOfInsertNode;
- }
-
- public setPassIndex(thisPassIndex: number) {
- this.thisPassIndex = thisPassIndex;
- }
-
- public getPassIndex(): number {
- return this.thisPassIndex;
- }
-
- public clearTimeOutAboutDelayHighLightAndExpand(currentIndex: number) {
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let index: number = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- let that =this;
- this.ListNode.forEach(function(value) {
- if (value.getNodeCurrentNodeId() == that.lastPassId) {
- value.setCanShowFlagLine(false);
- }
- })
- this.notifyDataChange(index);
- }
-
- if ((this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutHighLightId != this.lastTimeoutHighLightId)) {
- clearTimeout(this.lastTimeoutHighLightId);
- if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) {
- this.clearHighLight(this.lastDelayHighLightIndex);
- let index: number = this.loadedNodeIdAndIndexMap
- .get(this.listNode[this.lastDelayHighLightIndex].getCurrentNodeId());
- this.notifyDataChange(index);
- }
- this.clearTimeoutHighLightId = this.lastTimeoutHighLightId;
- }
- this.lastTimeoutHighLightId = this.timeoutHighLightId;
- this.lastDelayHighLightIndex = currentIndex;
-
- if ((this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutExpandId != this.lastTimeoutExpandId)) {
- clearTimeout(this.lastTimeoutExpandId);
- this.clearTimeoutExpandId = this.lastTimeoutExpandId;
- }
- this.lastTimeoutExpandId = this.timeoutExpandId;
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
- }
-
- public clearHighLight(currentIndex: number) {
- this.changeNodeColor(currentIndex, this.listNode[currentIndex].getNodeStatus().normal);
- this.changeNodeHighLightColor(currentIndex, false);
- this.setImageSource(currentIndex, InteractionStatus.FinishDragInsert);
- this.setImageCollapseSource(currentIndex, InteractionStatus.FinishDragInsert);
- this.listNode[currentIndex].setIsHighLight(false);
- }
-
- private changeNodeHighLightColor(index: number, isHighLight: boolean): void {
- if (this.listNode[index].getNodeItem().mainTitleNode && this.listNode[index].getIsShowTitle()) {
- this.listNode[index].getNodeItem().mainTitleNode.setMainTitleHighLight(isHighLight);
- }
- }
-
- public setVisibility(flag: Flag, index: number, isOverBorder: boolean) {
- let isChanged: boolean = (this.thisPassIndex != index || this.flag != flag) ? true : false;
- this.thisPassIndex = index;
- if ((isChanged || isOverBorder) && this.isInnerDrag) {
- this.flag = flag;
- let currentNodeId: number = this.getData(index).getCurrentNodeId();
- let currentNodeLevel: number = this.expandAndCollapseInfo.get(currentNodeId) == NodeStatus.Expand &&
- this.flag == Flag.DOWN_FLAG ? this.getData(index).getNodeLevel() + 1 : this.getData(index).getNodeLevel();
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let lastIndex: number = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- let that = this;
- this.ListNode.forEach(function (value) {
- if (value.getNodeCurrentNodeId() == that.lastPassId) {
- value.setCanShowFlagLine(false);
- }
- })
- this.notifyDataChange(lastIndex);
- }
- if (this.flag == Flag.DOWN_FLAG && index < this.totalCount() - 1) {
- this.getData(index).setCanShowFlagLine(false);
- this.getData(index+1).setCanShowFlagLine(true);
- this.getData(index).setCanShowBottomFlagLine(false);
- this.getData(index+1).setFlagLineLeftMargin(currentNodeLevel);
- this.notifyDataChange(index);
- this.notifyDataChange(index + 1);
- this.lastPassId = this.getData(index + 1).getNodeCurrentNodeId();
- } else if (this.flag == Flag.UP_FLAG && index < this.totalCount() - 1) {
- this.getData(index).setCanShowFlagLine(true);
- this.getData(index+1).setCanShowFlagLine(false);
- this.getData(index).setCanShowBottomFlagLine(false);
- this.getData(index).setFlagLineLeftMargin(currentNodeLevel);
- this.notifyDataChange(index);
- this.notifyDataChange(index + 1);
- this.lastPassId = this.getData(index).getNodeCurrentNodeId();
- } else if (index >= this.totalCount() - 1) {
- if (this.flag == Flag.DOWN_FLAG) {
- this.getData(index).setCanShowFlagLine(false);
- this.getData(index).setCanShowBottomFlagLine(true);
- } else {
- this.getData(index).setCanShowFlagLine(true);
- this.getData(index).setCanShowBottomFlagLine(false);
- }
- this.getData(index).setFlagLineLeftMargin(currentNodeLevel);
- this.notifyDataChange(index);
- this.lastPassId = this.getData(index).getNodeCurrentNodeId();
- }
- }
- }
-
- public delayHighLightAndExpandNode(currentIndex: number, currentNodeId: number, showIndex: number) {
- let isChangIndex: boolean = currentIndex != this.lastDelayExpandIndex ? true : false;
- let isOverBorder: boolean = this.getData(showIndex).getIsOverBorder();
- if (isOverBorder) {
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
- } else {
- this.lastDelayExpandIndex = currentIndex;
- }
- if (isOverBorder || isChangIndex) {
- let that = this;
-
- /* highLight node time-out. */
- let canDelayHighLight: boolean = !isOverBorder && (!this.isInnerDrag ||
- (this.expandAndCollapseInfo.get(currentNodeId) == NodeStatus.Collapse && this.isInnerDrag) ||
- (!this.expandAndCollapseInfo.has(currentNodeId) && this.listNode[currentIndex].getIsFolder()));
- if (canDelayHighLight) {
- /* set hoverState color before highLight. */
- this.changeNodeColor(currentIndex, this.listNode[currentIndex].getNodeStatus().hover);
- this.notifyDataChange(showIndex);
-
- let delayHighLightTime: number = this.isInnerDrag ? 1000 : 0; // ms
- this.timeoutHighLightId = setTimeout(function() {
- that.delayHighLight(currentIndex);
- }, delayHighLightTime)
- }
- if (isOverBorder || (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutHighLightId != this.lastTimeoutHighLightId)) {
- clearTimeout(this.lastTimeoutHighLightId);
- if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) {
- this.clearHighLight(this.lastDelayHighLightIndex);
- this.notifyDataReload();
- }
- this.clearTimeoutHighLightId = this.lastTimeoutHighLightId;
- }
- this.lastTimeoutHighLightId = this.timeoutHighLightId;
- this.lastDelayHighLightIndex = currentIndex;
-
- /* alter flagLine and expand node time-out. */
- if (!isOverBorder && this.expandAndCollapseInfo.get(currentNodeId) == NodeStatus.Collapse) {
- let firstChildNodeId: number = this.getData(showIndex).getNodeInfoNode().children[0].currentNodeId;
- let delayAlterFlagLineAndExpandNodeTime: number = 2000; // ms
- this.timeoutExpandId = setTimeout(function() {
- that.clearHighLight(that.lastDelayHighLightIndex);
- that.alterFlagLineAndExpandNode(currentIndex, firstChildNodeId);
- }, delayAlterFlagLineAndExpandNodeTime)
- }
- if (isOverBorder || (this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutExpandId != this.lastTimeoutExpandId)) {
- clearTimeout(this.lastTimeoutExpandId);
- this.clearTimeoutExpandId = this.lastTimeoutExpandId;
- }
- this.lastTimeoutExpandId = this.timeoutExpandId;
- }
- }
-
- public delayHighLight(currentIndex: number) {
- let that =this;
- this.ListNode.forEach(function (value) {
- if (value.getNodeCurrentNodeId() == that.lastPassId) {
- value.setCanShowFlagLine(false);
- value.setCanShowBottomFlagLine(false);
- }
- })
- this.changeNodeColor(currentIndex, this.listNode[currentIndex].getNodeStatus().highLight);
- this.listNode[currentIndex].setIsHighLight(true);
- this.changeNodeHighLightColor(currentIndex, true);
- this.setImageSource(currentIndex, InteractionStatus.DragInsert);
- this.setImageCollapseSource(currentIndex, InteractionStatus.DragInsert);
- this.notifyDataReload();
- }
-
- public alterFlagLineAndExpandNode(currentIndex: number, firstChildNodeId: number) {
- let that =this;
- this.ListNode.forEach(function (value) {
- if (value.getNodeCurrentNodeId() == that.lastPassId) {
- value.setCanShowFlagLine(false);
- value.setCanShowBottomFlagLine(false);
- }
- })
- this.ListNode.forEach(function (value) {
- if (that.isInnerDrag && value.getNodeCurrentNodeId() == firstChildNodeId) {
- value.setCanShowFlagLine(true);
- }
- })
- this.changeNodeStatus(currentIndex);
- this.handleExpandAndCollapse(currentIndex);
- this.lastPassId = firstChildNodeId;
- }
-
- public hideLastLine() {
- if (this.lastPassId != this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
- let that = this;
- this.ListNode.forEach(function (value) {
- if (value.getNodeCurrentNodeId() == that.lastPassId) {
- value.setCanShowFlagLine(false);
- value.setCanShowBottomFlagLine(false);
- }
- })
- let index: number = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
- this.notifyDataChange(index);
- }
- }
-
- public clearLastTimeoutHighLight() {
- if (this.lastTimeoutHighLightId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutHighLightId != this.lastTimeoutHighLightId) {
- clearTimeout(this.lastTimeoutHighLightId);
- if (this.lastDelayHighLightIndex != this.INITIAL_INVALID_VALUE) {
- this.clearHighLight(this.lastDelayHighLightIndex);
- }
- }
- }
-
- public clearLastTimeoutExpand() {
- if (this.lastTimeoutExpandId != this.INITIAL_INVALID_VALUE &&
- this.clearTimeoutExpandId != this.lastTimeoutExpandId) {
- clearTimeout(this.lastTimeoutExpandId);
- }
- }
-
- public getSubtitle(currentNodeId: number): string {
- if (this.nodeIdAndSubtitleMap.has(currentNodeId)) {
- if (typeof this.nodeIdAndSubtitleMap.get(currentNodeId) == "number") {
- return this.nodeIdAndSubtitleMap.get(currentNodeId).toString();
- } else {
- return this.nodeIdAndSubtitleMap.get(currentNodeId)
- }
- } else {
- return '';
- }
- }
-
- public hasSubtitle(currentNodeId: number) {
- return this.nodeIdAndSubtitleMap.has(currentNodeId);
- }
-
- public initialParameterAboutDelayHighLightAndExpandIndex() {
- this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE;
- this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
- this.lastPassIndex = this.INITIAL_INVALID_VALUE;
- this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE;
- this.flag = Flag.NONE;
- }
-
- public refreshSubtitle(insertNodeCurrentNodeId: number) {
- this.nodeIdAndSubtitleMap.set(this.selectedParentNodeId, this.selectedParentNodeSubtitle);
- this.nodeIdAndSubtitleMap.set(insertNodeCurrentNodeId, this.insertNodeSubtitle);
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.selectedParentNodeId));
- this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(insertNodeCurrentNodeId));
- }
-
- public setNodeSubtitlePara(
- selectedParentNodeId: number,
- selectedParentNodeSubtitle: ResourceStr,
- insertNodeSubtitle: ResourceStr
- ) {
- this.selectedParentNodeId = selectedParentNodeId;
- this.selectedParentNodeSubtitle = selectedParentNodeSubtitle;
- this.insertNodeSubtitle = insertNodeSubtitle;
- }
-
- public getInsertNodeSubtitle() {
- return this.insertNodeSubtitle;
- }
-
- public getExpandAndCollapseInfo(currentNodeId: number) {
- return this.expandAndCollapseInfo.get(currentNodeId);
- }
-
- public getLastDelayHighLightId() {
- return this.lastDelayHighLightId;
- }
-
- public setLastDelayHighLightId() {
- this.ListNode.forEach((value, index) => {
- if (index == this.lastDelayHighLightIndex) {
- this.lastDelayHighLightId = value.getCurrentNodeId();
- }
- })
- }
-
- public setLastPassId(lastPassId: number) {
- this.lastPassId = lastPassId;
- }
-
- public setLastDelayHighLightIndex(lastDelayHighLightIndex) {
- this.lastDelayHighLightIndex = lastDelayHighLightIndex;
- }
-
- /*
- * Alter the current node location to a needful position.
- * 1.Create an array named 'dragNodeParam' to store dragging node information.
- * 2.Delete the dragging node from the tree.
- * 3.Add the dragging node to the tree.
- */
- public alterDragNode(rearParentNodeId: number, rearCurrentNodeId: number, insertNodeInfo: NodeInfo,
- dragParentNodeId: number, dragCurrentNodeId: number, frontNodeInfoItem: NodeInfo) {
- let dragNodeParam: { parentId: number, currentId: number, data: any }[] = [];
- let parentNodeId: number = rearParentNodeId;
- let currentNodeId: number = dragCurrentNodeId;
- let nodeParam = frontNodeInfoItem.getNodeInfoData();
- let nodeInfo: NodeInfo = null;
- let nodeInfoNode: NodeItem = frontNodeInfoItem.getNodeInfoNode();
- let isHighLight : boolean = false;
- let insertChildIndex: number = this.INITIAL_INVALID_VALUE;
- let currentChildIndex: number = this.INITIAL_INVALID_VALUE;
- let isDownFlag: boolean = this.flag == Flag.DOWN_FLAG ? true : false;
-
- currentChildIndex = this.getChildIndex(dragParentNodeId, dragCurrentNodeId);
- insertChildIndex = this.getChildIndex(rearParentNodeId, rearCurrentNodeId);
-
- if (rearParentNodeId != dragParentNodeId) {
- insertChildIndex = isDownFlag ? insertChildIndex + 1 : insertChildIndex;
- } else {
- if (insertChildIndex > currentChildIndex) {
- insertChildIndex = isDownFlag ? insertChildIndex : insertChildIndex - 1;
- } else {
- insertChildIndex = isDownFlag ? insertChildIndex + 1 : insertChildIndex;
- }
- }
-
- for (let i = 0; i < this.listNode.length; i++) {
- if (this.listNode[i].getCurrentNodeId() == rearCurrentNodeId) {
- isHighLight = this.listNode[i].getIsHighLight();
- if (this.flag == Flag.DOWN_FLAG && this.expandAndCollapseInfo.get(rearCurrentNodeId) == NodeStatus.Expand) {
- parentNodeId = rearCurrentNodeId;
- insertChildIndex = 0;
- } else if (this.flag == Flag.UP_FLAG && this.expandAndCollapseInfo.get(rearCurrentNodeId) == NodeStatus.Expand
- && this.listNode[i].getCanShowFlagLine() == false) {
- parentNodeId = rearCurrentNodeId;
- insertChildIndex = 0;
- } else if (isHighLight) {
- parentNodeId = rearCurrentNodeId;
- insertChildIndex = 0;
- }
- break;
- }
- }
-
- let callbackParam: CallbackParam = { currentNodeId: currentNodeId, parentNodeId: parentNodeId, childIndex: insertChildIndex }
-
- /* export inner drag node Id. */
- this.appEventBus.emit(TreeListenType.NODE_MOVE, [callbackParam]);
-
- /* To store dragging node information by the array named 'dragNodeParam'. */
- dragNodeParam.push({parentId: parentNodeId, currentId: currentNodeId, data: nodeParam});
-
- let oneself = null,
- callback = function(node, listNode): boolean {
- if (node) {
- oneself = node;
- parentNodeId = oneself.parentNodeId;
- currentNodeId = oneself.currentNodeId;
- for (let i = 0; i < listNode.length; i++) {
- if (listNode[i].getNodeCurrentNodeId() == currentNodeId) {
- nodeInfo = listNode[i];
- break;
- }
- }
- nodeParam = nodeInfo.getNodeInfoData();
- if (parentNodeId != dragParentNodeId) {
- dragNodeParam.push({parentId: parentNodeId, currentId: currentNodeId, data: nodeParam});
- }
- return false;
- }
- return false;
- }
- this.listNodeUtils.dragTraverseNodeDF(callback, nodeInfoNode, this.listNode);
-
- /* Delete the dragging node from the tree. */
- this.listNodeUtils.removeNode(dragCurrentNodeId, dragParentNodeId, this.listNodeUtils.traverseNodeBF);
-
- /*
- * Add the dragging node to the tree
- * 1.The first dragging node is added singly, because it needs to distinguish the position to insert
- *
- * Add first node.
- */
- let insertCurrentNodeId: number = rearCurrentNodeId;
- let isAfter: boolean = isDownFlag;
- if (this.expandAndCollapseInfo.get(rearCurrentNodeId) == NodeStatus.Expand) {
- isAfter = false;
- this.listNode.forEach((value) => {
- if (value.getCurrentNodeId() == rearCurrentNodeId && value.getCanShowFlagLine() == false) {
- if (value.getNodeInfoNode().children.length) {
- insertCurrentNodeId = value.getNodeInfoNode().children[0].currentNodeId;
- } else {
- insertCurrentNodeId = this.INITIAL_INVALID_VALUE;
- }
- }
- })
- } else if (!this.expandAndCollapseInfo.get(rearCurrentNodeId) && isHighLight) {
- this.expandAndCollapseInfo.set(rearCurrentNodeId, NodeStatus.Expand);
- }
-
- this.listNodeUtils.addDragNode(dragNodeParam[0].parentId, dragNodeParam[0].currentId, insertCurrentNodeId,
- isAfter, dragNodeParam[0].data);
-
- /* Add remaining node. */
- for (let j = 1; j < dragNodeParam.length; j++) {
- this.listNodeUtils.addNode(dragNodeParam[j].parentId, dragNodeParam[j].currentId, dragNodeParam[j].data);
- }
-
- /* Update node data and reload the array named 'listNode'. */
- for (let i = 0; i < this.listNode.length; i++) {
- if (this.listNode[i].getCurrentNodeId() == dragParentNodeId) {
- if (this.listNode[i].getNodeInfoNode().getNodeItem().imageCollapse == null) {
- this.listNode[i].handleImageCollapseAfterAddNode(false);
- this.expandAndCollapseInfo.delete(dragParentNodeId);
- break;
- }
- }
- }
- let tmp: NodeInfo[] = [...this.listNode];
- this.reloadListNode(this.listNodeUtils, tmp);
-
- }
-
- /*
- * Reload the array named 'listNode'
- * @param listNodeUtils
- * @param tmp
- */
- public reloadListNode(listNodeUtils: ListNodeUtils, tmp: NodeInfo[]) {
- let index = 0;
- this.listNode = [];
- this.listNodeUtils = listNodeUtils;
- this.loadedNodeIdAndIndexMap.clear();
- this.listNodeUtils.traverseNodeDF((node: NodeItem): boolean => {
- if (node.currentNodeId >= 0) {
- var nodeInfo: NodeInfo = new NodeInfo(node);
- this.listNode.push(nodeInfo);
-
- if (this.expandAndCollapseInfo.get(node.currentNodeId) == NodeStatus.Expand) {
- nodeInfo.getNodeItem().imageCollapse.changeImageCollapseSource(NodeStatus.Expand);
- } else if (this.expandAndCollapseInfo.get(node.currentNodeId) == NodeStatus.Collapse) {
- nodeInfo.getNodeItem().imageCollapse.changeImageCollapseSource(NodeStatus.Collapse);
- }
-
- for (let i = 0; i < tmp.length; i++){
- if (tmp[i].getCurrentNodeId() == nodeInfo.getCurrentNodeId()) {
- nodeInfo.setNodeIsShow(tmp[i].getNodeIsShow());
- nodeInfo.setListItemHeight(tmp[i].getListItemHeight());
- if (nodeInfo.getNodeItem().mainTitleNode && nodeInfo.getIsShowTitle()) {
- nodeInfo.getNodeItem().mainTitleNode.title = tmp[i].getNodeItem().mainTitleNode.title;
- }
- break;
- }
- }
- if (nodeInfo.getNodeIsShow()) {
- this.loadedNodeIdAndIndexMap.set(nodeInfo.getCurrentNodeId(), index++);
- }
- }
- return false;
- });
- }
-
- public getFlagLine() {
- return this.FLAG_LINE;
- }
-
- public getVisibility(nodeInfo: NodeInfo): any {
- let lastShowIndex: number = this.loadedNodeIdAndIndexMap.get(nodeInfo.getCurrentNodeId()) - 1;
- if (lastShowIndex > this.INITIAL_INVALID_VALUE) {
- let lastNodeInfo: NodeInfo = this.getData(lastShowIndex);
- return (nodeInfo.getCanShowFlagLine() == true && !nodeInfo.getIsHighLight() && !lastNodeInfo.getIsHighLight()) ?
- Visibility.Visible : Visibility.Hidden;
- } else {
- return (nodeInfo.getCanShowFlagLine() == true && !nodeInfo.getIsHighLight()) ?
- Visibility.Visible : Visibility.Hidden;
- }
- }
-
- public getSubTitlePara() {
- return this.subTitle;
- }
-
- public getIsFolder(nodeId: number) {
- if (this.loadedNodeIdAndIndexMap.has(nodeId)) {
- return this.getData(this.loadedNodeIdAndIndexMap.get(nodeId)).getIsFolder();
- }
- return false;
- }
-
- public getSubTitleFontColor(isHighLight: boolean) {
- return isHighLight ? this.subTitle.highLightFontColor : this.subTitle.normalFontColor;
- }
-
- private getChildIndex(rearParentNodeId: number, rearCurrentNodeId: number) {
- let insertChildIndex: number = this.INITIAL_INVALID_VALUE;
- this.listNodeUtils.traverseNodeBF(function(node): boolean {
- if (node.getCurrentNodeId() == rearParentNodeId) {
- node.children.forEach((value, index) => {
- if (value.getCurrentNodeId() == rearCurrentNodeId) {
- insertChildIndex = index;
- }
- })
- return true;
- }
- return false;
- });
- return insertChildIndex;
- }
-
- public setCurrentFocusNodeId(focusNodeId: number) {
- this.currentFocusNodeId = focusNodeId;
- }
-
- public getCurrentFocusNodeId(): number {
- return this.currentFocusNodeId;
- }
-
- public setLastFocusNodeId(focusNodeId: number) {
- this.lastFocusNodeId = focusNodeId;
- }
-
- public getLastFocusNodeId(): number {
- return this.lastFocusNodeId;
- }
-
- public getAddFocusNodeId(): number {
- return this.addFocusNodeId;
- }
-
- public setFlag(flag: Flag) {
- this.flag = flag;
- }
- }
-
- /* nodeId to find index */
- function findCurrentNodeIndex(this, currentNodeId: number): number {
- let thisIndex: number = 0;
- this.listNodeDataSource.ListNode.forEach(function (value, index) {
- if (value.getNodeCurrentNodeId() == currentNodeId) {
- thisIndex = index;
- }
- })
- return thisIndex;
- }
-
- /**
- * Tree view control, which is created by using the TreeController class.
- *
- * When you create this component, you must initialize the listNodeDataSource.
- * You can run the listTreeViewWidth command to set the width of the component.
- * The default width is 200vp.
- *
- * @since 10
- */
- @Component
- export struct TreeView {
- listNodeDataSource: ListNodeDataSource;
- treeController: TreeController;
- @State dropSelectedIndex: number = 0;
- @BuilderParam private listTreeViewMenu: () => void = null;
- @Prop listTreeViewWidth: string | number;
- @Prop listTreeViewHeight: number | string;
- private readonly MAX_CN_LENGTH: number = 254;
- private readonly MAX_EN_LENGTH: number = 255;
- private readonly INITIAL_INVALID_VALUE = -1;
- private readonly MAX_TOUCH_DOWN_COUNT = 0;
- private isMultiPress: boolean = false;
- private touchDownCount: number = this.INITIAL_INVALID_VALUE;
- private appEventBus: TreeListener = TreeListenerManager.getInstance().getTreeListener();
- private readonly itemPadding: { left: Resource, right: Resource, top: Resource, bottom: Resource } =
- { left: $r('sys.float.ohos_id_card_margin_middle'),
- right: $r('sys.float.ohos_id_card_margin_middle'),
- top: $r('sys.float.ohos_id_text_margin_vertical'),
- bottom: $r('sys.float.ohos_id_text_margin_vertical')};
- /* { left: '12vp', right: '12vp', top: '2vp', bottom: '2vp' } */
- private readonly textInputPadding: { left : string, right: string, top: string, bottom: string } =
- { left : '0vp', right: '0vp', top: '0vp', bottom: '0vp'}
- aboutToAppear(): void {
- this.listTreeViewWidth = (this.listTreeViewWidth === undefined) ? 200 : this.listTreeViewWidth;
- this.listNodeDataSource = this.treeController.getListNodeDataSource();
- }
-
- private checkInvalidPattern(title: string): boolean {
- let pattern = /[\\\/:*?"<>|]/;
- return pattern.test(title)
- }
-
- private checkIsAllCN(title: string): boolean {
- let pattern = /^[\u4e00-\u9fa5]+$/;
- return pattern.test(title)
- }
-
- @Builder popupForShowTitle(text: string | Resource, backgroundColor: Resource, fontColor: Resource ) {
- Row() {
- Text(text).fontSize($r('sys.float.ohos_id_text_size_body2')).fontWeight('regular').fontColor(fontColor)
- }.backgroundColor(backgroundColor)
- .border({radius: $r('sys.float.ohos_id_elements_margin_horizontal_l')})
- .padding({left: $r('sys.float.ohos_id_elements_margin_horizontal_l'),
- right: $r('sys.float.ohos_id_elements_margin_horizontal_l'),
- top: $r('sys.float.ohos_id_card_margin_middle'),
- bottom: $r('sys.float.ohos_id_card_margin_middle')})
- }
-
- @Builder builder() {
- this.listTreeViewMenu()
- }
-
- /* Set the popup of dragging node. */
- @Builder draggingPopup(item: NodeInfo) {
- Row() {
- if (item.getNodeItem().imageNode) {
- Row() {
- Image(item.getNodeItem().imageNode.normalSource)
- .objectFit(ImageFit.Contain)
- .height(item.getNodeItem().imageNode.itemHeight)
- .width(item.getNodeItem().imageNode.itemWidth)
- .opacity(this.listNodeDataSource.getDragPopupPara().imageOpacity)
- }
- .backgroundColor(COLOR_IMAGE_ROW)
- .margin({ right: item.getNodeItem().imageNode.itemRightMargin })
- .height(item.getNodeItem().imageNode.itemHeight)
- .width(item.getNodeItem().imageNode.itemWidth)
- }
- Row() {
- if (item.getNodeItem().mainTitleNode && item.getIsShowTitle()) {
- Text(item.getNodeItem().mainTitleNode.title)
- .maxLines(1)
- .fontSize(item.getNodeItem().mainTitleNode.size)
- .fontColor(this.listNodeDataSource.getDragPopupPara().fontColor)
- .fontWeight(this.listNodeDataSource.getDragPopupPara().fontWeight)
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- }
- }
- .constraintSize({
- minWidth: item.getNodeItem().imageNode ?
- this.listNodeDataSource.getDragPopupPara().textConstraintSize.minWidth1 :
- this.listNodeDataSource.getDragPopupPara().textConstraintSize.minWidth2,
- maxWidth: item.getNodeItem().imageNode ?
- this.listNodeDataSource.getDragPopupPara().textConstraintSize.maxWidth1 :
- this.listNodeDataSource.getDragPopupPara().textConstraintSize.maxWidth2 })
- }
- .constraintSize({ minWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.minWidth,
- maxWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.maxWidth })
- .height(this.listNodeDataSource.getDragPopupPara().height)
- .backgroundColor(this.listNodeDataSource.getDragPopupPara().backgroundColor)
- .padding({ left: this.listNodeDataSource.getDragPopupPara().padding.left,
- right: this.listNodeDataSource.getDragPopupPara().padding.right })
- .shadow({ radius: this.listNodeDataSource.getDragPopupPara().shadow.radius,
- color: this.listNodeDataSource.getDragPopupPara().shadow.color,
- offsetY: this.listNodeDataSource.getDragPopupPara().shadow.offsetY })
- .borderRadius(this.listNodeDataSource.getDragPopupPara().borderRadius) // need to doubleCheck.
- }
-
- build() {
- List({ }) {
- LazyForEach(this.listNodeDataSource, (item: NodeInfo) => {
- ListItem() {
- if (item.getNodeIsShow()) {
- Column() {
- Divider()
- .height(this.listNodeDataSource.getFlagLine().flagLineHeight)
- .color(this.listNodeDataSource.getFlagLine().flagLineColor)
- .visibility(this.listNodeDataSource.getVisibility(item))
- .lineCap(LineCapStyle.Round)
- .margin({ left: item.getFlagLineLeftMargin() })
- .markAnchor({ x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yTopOffset })
- Row({}) {
- Row({}) {
- if (item.getNodeItem().imageNode) {
- Row() {
- Image(item.getNodeItem().imageNode.source)
- .objectFit(ImageFit.Contain)
- .height(item.getNodeItem().imageNode.itemHeight)
- .width(item.getNodeItem().imageNode.itemWidth)
- .opacity(!item.getIsSelected() && !item.getIsHighLight() ?
- item.getNodeItem().imageNode.opacity : item.getNodeItem().imageNode.noOpacity)
- .focusable(item.getNodeItem().mainTitleNode != null ? false : true)
- .onFocus(() => {
- let that = this;
- that.listNodeDataSource.handleEvent(Event.FOCUS,
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- })
- .onBlur(() => {
- let that = this;
- that.listNodeDataSource.handleEvent(Event.BLUR,
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- })
- }
- .backgroundColor(COLOR_IMAGE_ROW)
- .margin({ right: item.getNodeItem().imageNode.itemRightMargin })
- .height(item.getNodeItem().imageNode.itemHeight)
- .width(item.getNodeItem().imageNode.itemWidth)
- }
- Row() {
- if (item.getNodeItem().mainTitleNode && item.getIsShowTitle()) {
- Text(item.getNodeItem().mainTitleNode.title)
- .maxLines(1) // max line
- .fontSize(item.getNodeItem().mainTitleNode.size)
- .fontColor(item.getNodeItem().mainTitleNode.color)
- .margin({ right: item.getNodeItem().mainTitleNode.itemRightMargin })
- .textOverflow({ overflow: TextOverflow.Ellipsis })
- .fontWeight(item.getNodeItem().mainTitleNode.weight)
- .focusable(true)
- .onFocus(() => {
- let that = this;
- this.listNodeDataSource.handleEvent(Event.FOCUS,
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- })
- .onBlur(() => {
- let that = this;
- that.listNodeDataSource.handleEvent(Event.BLUR,
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- })
- }
- if (item.getNodeItem().mainTitleNode &&
- item.getNodeItem().inputText &&
- item.getIsShowInputText()) {
- Row() {
- TextInput({ text: item.getNodeItem().mainTitleNode.title })
- .height(item.getNodeItem().inputText.itemHeight)
- .fontSize(item.getNodeItem().inputText.size)
- .fontColor(item.getNodeItem().inputText.color)
- .borderRadius(item.getNodeItem().inputText.borderRadius)
- .backgroundColor(item.getNodeItem().inputText.backgroundColor)
- .enterKeyType(EnterKeyType.Done)
- .padding({ left: this.textInputPadding.left, right: this.textInputPadding.right,
- top: this.textInputPadding.top, bottom: this.textInputPadding.bottom })
- .onChange((value: string) => {
- let that = this;
- var thisIndex = findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId());
- let res: string = '';
- let isInvalidError: boolean = false;
- let isLengthError: boolean = false;
- if (that.checkInvalidPattern(value)) {
- for (let i = 0; i < value.length; i++) {
- if (!that.checkInvalidPattern(value[i])) {
- res += value[i];
- }
- }
- isInvalidError = true;
- that.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
- InputError.INVALID_ERROR, true, thisIndex);
- } else {
- res = value;
- isInvalidError = false;
- that.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
- InputError.INVALID_ERROR, false, thisIndex);
- }
- if ((that.checkIsAllCN(res) && res.length > this.MAX_CN_LENGTH) ||
- (!that.checkIsAllCN(res) && res.length > this.MAX_EN_LENGTH)) {
- res = that.checkIsAllCN(res) ?
- res.substr(0, this.MAX_CN_LENGTH) : res.substr(0, this.MAX_EN_LENGTH);
- isLengthError = true;
- that.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
- InputError.LENGTH_ERROR, true, thisIndex);
- } else {
- isLengthError = false;
- }
- if (!isLengthError && !isInvalidError) {
- that.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
- InputError.LENGTH_ERROR, false, thisIndex);
- that.listNodeDataSource.setMainTitleNameOnEdit(thisIndex, res);
- }
-
- })
- .onSubmit((enterKey: EnterKeyType) => {
- let that = this;
- var thisIndex = findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId());
- that.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false, thisIndex);
- that.listNodeDataSource.setItemVisibilityOnEdit(thisIndex, MenuOperation.COMMIT_NODE);
- })
- }.backgroundColor(item.getNodeItem().inputText.backgroundColor)
- .borderRadius(item.getNodeItem().inputText.borderRadius)
- .margin({ right: item.getNodeItem().inputText.itemRightMargin })
- }
- Blank()
- }.layoutWeight(1)
-
- if (this.listNodeDataSource.hasSubtitle(item.getCurrentNodeId())) {
- Row() {
- Text(this.listNodeDataSource.getSubtitle(item.getCurrentNodeId()))
- .fontSize(this.listNodeDataSource.getSubTitlePara().fontSize)
- .fontColor(this.listNodeDataSource.getSubTitleFontColor(item.getIsHighLight() || item.getIsModify()))
- .fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight)
- }
- .margin({ left: this.listNodeDataSource.getSubTitlePara().margin.left,
- right: item.getNodeItem().imageCollapse ?
- 0 : this.listNodeDataSource.getSubTitlePara().margin.right })
- }
-
- if (item.getNodeItem().imageCollapse) {
- Row() {
- Image(item.getNodeItem().imageCollapse.collapseSource)
- .fillColor(item.getNodeItem().imageCollapse.isCollapse ? COLOR_IMAGE_ROW : COLOR_IMAGE_EDIT)
- .align(Alignment.End)
- .objectFit(ImageFit.Contain)
- .height(item.getNodeItem().imageCollapse.itemHeight)
- .width(item.getNodeItem().imageCollapse.itemWidth)
- .opacity(!item.getIsHighLight() ?
- item.getNodeItem().imageCollapse.opacity : item.getNodeItem().imageCollapse.noOpacity)
- .onTouch((event: TouchEvent) => {
- if (event.type === TouchType.Down) {
- let that = this;
- that.listNodeDataSource.expandAndCollapseNode(
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- this.listNodeDataSource.setCurrentFocusNodeId(item.getCurrentNodeId());
- }
- event.stopPropagation();
- })
- }
- .backgroundColor(COLOR_IMAGE_ROW)
- .height(item.getNodeItem().imageCollapse.itemHeight)
- .width(item.getNodeItem().imageCollapse.itemWidth)
- }
- }
- .width('100%')
- .onTouch((event: TouchEvent) => {
- let that = this;
- let index = findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId());
- let currentId = item.getNodeCurrentNodeId();
- that.listNodeDataSource.setClickIndex(index);
- if (event.type === TouchType.Down) {
- this.touchDownCount ++;
- this.isMultiPress = this.touchDownCount > this.MAX_TOUCH_DOWN_COUNT ? true : false;
- if (!this.listNodeDataSource.getIsTouchDown()) {
- that.listNodeDataSource.handleEvent(Event.TOUCH_DOWN, index);
- }
- }
- if (event.type === TouchType.Up) {
- this.touchDownCount--;
- if (this.touchDownCount < this.MAX_TOUCH_DOWN_COUNT) {
- this.isMultiPress = false;
- }
- let callbackParam = { currentNodeId: currentId }
- this.appEventBus.emit(TreeListenType.NODE_CLICK, [callbackParam]);
- that.listNodeDataSource.handleEvent(Event.TOUCH_UP, index);
- }
- })
- .onHover((isHover: boolean) => {
- let that = this;
- let index = findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId())
- if (isHover) {
- that.listNodeDataSource.handleEvent(Event.HOVER, index);
- } else {
- if (!that.listNodeDataSource.getIsTouchDown()) {
- that.listNodeDataSource.handleEvent(Event.HOVER_OVER, index);
- }
- }
- })
- .gesture(
- TapGesture({ count: 2 }) // doubleClick
- .onAction((event: GestureEvent) => {
- let that = this;
- that.listNodeDataSource.expandAndCollapseNode(
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- })
- )
- .height(item.getNodeHeight())
- .padding({ left: item.getNodeLeftPadding() })
- /* backgroundColor when editing and in other states. */
- .backgroundColor((item.getNodeItem().mainTitleNode && item.getNodeItem().inputText &&
- item.getIsShowInputText()) ? item.getNodeItem().inputText.editColor : item.getNodeColor())
- .border({
- width: item.getNodeBorder().borderWidth,
- color: item.getNodeBorder().borderColor,
- radius: item.getNodeBorder().borderRadius
- })
- .bindContextMenu(this.builder, ResponseType.RightClick)
- }
- .opacity(this.listNodeDataSource.getListItemOpacity(item))
- .markAnchor({ x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBasePlateOffset })
- if (item.getCanShowBottomFlagLine()) {
- if (this.listNodeDataSource.getPassIndex() == this.listNodeDataSource.totalCount() - 1 &&
- !item.getIsHighLight()) {
- Divider()
- .height(this.listNodeDataSource.getFlagLine().flagLineHeight)
- .color(this.listNodeDataSource.getFlagLine().flagLineColor)
- .visibility(Visibility.Visible)
- .lineCap(LineCapStyle.Round)
- .margin({ left: item.getFlagLineLeftMargin() })
- .markAnchor({ x: this.listNodeDataSource.getFlagLine().xOffset,
- y: this.listNodeDataSource.getFlagLine().yBottomOffset })
- }
- }
- }
- .focusable(true)
- .onMouse((event: MouseEvent) => {
- let that = this;
- let thisIndex = findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId());
- if (event.button == MouseButton.Right) {
- that.listNodeDataSource.handleEvent(Event.MOUSE_BUTTON_RIGHT,
- findCurrentNodeIndex.call(that, item.getNodeCurrentNodeId()));
- this.listTreeViewMenu = item.getMenu();
- that.listNodeDataSource.setClickIndex(thisIndex);
- that.listNodeDataSource.setPopUpInfo(PopUpType.HINTS, InputError.NONE, false, thisIndex);
- clearTimeout(item.getNodeItem().mainTitleNode.popUpTimeout);
- }
- event.stopPropagation();
- })
- .padding({ top: this.itemPadding.top, bottom: this.itemPadding.bottom })
- .bindPopup(item.getPopUpInfo().popUpIsShow, {
- builder: this.popupForShowTitle(item.getPopUpInfo().popUpText, item.getPopUpInfo().popUpColor,
- item.getPopUpInfo().popUpTextColor),
- placement: Placement.BottomLeft,
- placementOnTop: false,
- popupColor: item.getPopUpInfo().popUpColor,
- autoCancel: true,
- enableArrow: item.getPopUpInfo().popUpEnableArrow
- })
- }
-
- }
- .width('100%').height(item.getListItemHeight())
- .padding({ left: this.itemPadding.left, right: this.itemPadding.right})
- .align(Alignment.Start)
- .onDragStart((event: DragEvent, extraParams: string) => {
- if (this.listNodeDataSource.getIsDrag() || this.listNodeDataSource.getIsInnerDrag() || this.isMultiPress) {
- console.error('drag error, a item has been dragged');
- return;
- }
- this.dropSelectedIndex = JSON.parse(extraParams).selectedIndex;
- let currentNodeIndex = JSON.parse(extraParams).selectedIndex;
- let currentNodeInfo = this.listNodeDataSource.getData(currentNodeIndex);
- let currentItemNodeId = item.getNodeCurrentNodeId();
-
- /* handle the situation of drag error, currentNodeIndex is not found in onDragStart. */
- if (currentNodeIndex >= this.listNodeDataSource.totalCount() || currentNodeIndex == undefined) {
- console.error('drag error, currentNodeIndex is not found in onDragStart');
- return;
- }
-
- this.listNodeDataSource.setIsInnerDrag(true);
- this.listNodeDataSource.setIsDrag(true);
- this.listNodeDataSource.setCurrentNodeInfo(currentNodeInfo);
- this.listNodeDataSource.setDraggingCurrentNodeId(currentNodeInfo.getNodeCurrentNodeId());
- this.listNodeDataSource.setDraggingParentNodeId(currentNodeInfo.getNodeParentNodeId());
-
- /* set the opacity of the dragging node. */
- let draggingNodeOpacity: number = DRAG_OPACITY;
- this.listNodeDataSource.setListItemOpacity(draggingNodeOpacity);
- this.listNodeDataSource.notifyDataChange(currentNodeIndex);
-
- /*
- * handle the situation of drag is too fast,it attribute a fault to OH.
- * OH has Solved on real machine.
- */
- if (currentItemNodeId != currentNodeInfo.getNodeCurrentNodeId()) {
- console.error('drag is too fast,it attribute a fault to OH');
- this.listNodeDataSource.setIsDrag(false);
- return;
- }
- return this.draggingPopup(currentNodeInfo);
- })
- }, item => JSON.stringify(item))
- }.width(this.listTreeViewWidth).height(this.listTreeViewHeight)
-
- /* Move the dragged node. */
- .onDragMove((event: DragEvent) => {
- if (this.isMultiPress) {
- console.error('drag error, a item has been dragged');
- return;
- }
- let nodeHeight: number = LIST_ITEM_HEIGHT;
-
- /* flag the position of the focus on the node. */
- let flag: Flag = Math.floor(event.getY() / (nodeHeight / FLAG_NUMBER)) % FLAG_NUMBER ? Flag.DOWN_FLAG : Flag.UP_FLAG;
-
- /* Record the node position to which the dragged node moves. */
- let index: number = Math.floor(event.getY() / nodeHeight);
-
- /* Handle the situation where the focus(index) exceeds the list area. */
- let isOverBorder: boolean = false;
- if (index >= this.listNodeDataSource.totalCount()) {
- flag = Flag.DOWN_FLAG;
- index = this.listNodeDataSource.totalCount() - 1;
- this.listNodeDataSource.getData(index).setIsOverBorder(true);
- isOverBorder = true;
- } else {
- this.listNodeDataSource.getData(index).setIsOverBorder(false);
- }
-
- let currentNodeInfo: NodeInfo = this.listNodeDataSource.getData(index);
- let currentNodeId: number = currentNodeInfo.getCurrentNodeId();
-
- /*
- * handle a situation that "draggingCurrentNodeId" is parent of "insertNodeCurrentNodeId";
- * do not perform some functions.
- */
- if (index != this.listNodeDataSource.getLastPassIndex() && this.listNodeDataSource.getIsInnerDrag()) {
- let isParentNodeOfInsertNode: boolean = this.listNodeDataSource.getIsParentOfInsertNode(currentNodeId);
- if (isParentNodeOfInsertNode) {
- this.listNodeDataSource.setPassIndex(index);
- let that = this;
- this.listNodeDataSource.clearTimeOutAboutDelayHighLightAndExpand(findCurrentNodeIndex.call(that,
- currentNodeId));
- this.listNodeDataSource.setFlag(Flag.NONE);
- return;
- }
- }
- this.listNodeDataSource.setLastPassIndex(index);
-
- /* Set the visibility of the flag line. */
- this.listNodeDataSource.setVisibility(flag, index, isOverBorder);
-
- /* Automatically HighLight one second delay and expand after two second delay. */
- if (currentNodeId != this.listNodeDataSource.getDraggingCurrentNodeId()) {
- let that = this;
- this.listNodeDataSource.delayHighLightAndExpandNode(findCurrentNodeIndex.call(that, currentNodeId),
- currentNodeId, index);
- }
- })
-
- /* DragEvent Enter. */
- .onDragEnter((event: DragEvent, extraParams: string) => {
- if (this.listNodeDataSource.getIsInnerDrag()) {
- this.listNodeDataSource.setIsDrag(true);
-
- /* set the opacity of the dragging node. */
- let draggingNodeOpacity: number = DRAG_OPACITY;
- this.listNodeDataSource.setListItemOpacity(draggingNodeOpacity);
- }
- })
-
- /* DragEvent Leave. */
- .onDragLeave((event: DragEvent, extraParams: string) => {
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.clearLastTimeoutExpand();
- let draggingNodeOpacity: number = DRAG_OPACITY_NONE;
- this.listNodeDataSource.setListItemOpacity(draggingNodeOpacity);
- this.listNodeDataSource.setIsDrag(false);
- this.listNodeDataSource.notifyDataReload();
- })
-
- /* DragEvent Drop. */
- .onDrop((event: DragEvent, extraParams: string) => {
- this.listNodeDataSource.clearLastTimeoutExpand();
- let draggingNodeOpacity: number = DRAG_OPACITY_NONE;
- this.listNodeDataSource.setListItemOpacity(draggingNodeOpacity);
- let insertNodeIndex: number = this.listNodeDataSource.getPassIndex();
- let currentNodeIndex: number = this.dropSelectedIndex;
-
- if (currentNodeIndex - 1 > this.listNodeDataSource.totalCount() || currentNodeIndex == undefined) {
- console.error('drag error, currentNodeIndex is not found');
- this.listNodeDataSource.setIsDrag(false);
- return;
- }
-
- if (insertNodeIndex == this.listNodeDataSource.totalCount()) {
- console.log('need to insert into the position of the last line, now insertNodeIndex = insertNodeIndex - 1');
- insertNodeIndex -= 1;
- }
-
- let insertNodeInfo: NodeInfo = this.listNodeDataSource.getData(insertNodeIndex);
- let insertNodeCurrentNodeId: number = insertNodeInfo.getNodeCurrentNodeId();
-
- /* outer node is move in. */
- if (!this.listNodeDataSource.getIsDrag() || !this.listNodeDataSource.getIsInnerDrag()) {
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.setIsInnerDrag(false);
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.refreshSubtitle(insertNodeCurrentNodeId);
- this.listNodeDataSource.notifyDataReload();
- return;
- }
-
- let currentNodeInfo: NodeInfo = this.listNodeDataSource.getCurrentNodeInfo();
- let insertNodeParentNodeId: number = insertNodeInfo.getNodeParentNodeId();
- let draggingCurrentNodeId: number = this.listNodeDataSource.getDraggingCurrentNodeId();
- let draggingParentNodeId: number = this.listNodeDataSource.getDraggingParentNodeId();
-
- /*
- * handle a situation that "draggingCurrentNodeId" is parent of "insertNodeCurrentNodeId".
- * drag is fail.
- */
- let isParentNodeOfInsertNode: boolean = this.listNodeDataSource.getIsParentOfInsertNode(insertNodeCurrentNodeId);
- if (isParentNodeOfInsertNode) {
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.setIsInnerDrag(false);
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.notifyDataChange(insertNodeIndex);
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.setIsDrag(false);
-
- /* set the position of focus. */
- let that = this;
- let currentFocusIndex: number = findCurrentNodeIndex.call(that, draggingCurrentNodeId);
- this.listNodeDataSource.setClickIndex(currentFocusIndex);
- this.listNodeDataSource.handleEvent(Event.DRAG, currentFocusIndex);
- return;
- }
-
- /* Collapse drag node. */
- if (this.listNodeDataSource.getExpandAndCollapseInfo(draggingCurrentNodeId) == NodeStatus.Expand) {
- let that = this;
- this.listNodeDataSource.expandAndCollapseNode(
- findCurrentNodeIndex.call(that, draggingCurrentNodeId));
- }
-
- /* Expand insert node. */
- if (this.listNodeDataSource.getExpandAndCollapseInfo(insertNodeCurrentNodeId) == NodeStatus.Collapse) {
- let that = this;
- let currentIndex: number = findCurrentNodeIndex.call(that, insertNodeCurrentNodeId);
- if (this.listNodeDataSource.ListNode[currentIndex].getIsHighLight()) {
- this.listNodeDataSource.expandAndCollapseNode(currentIndex);
- }
- }
-
- /* alter dragNode. */
- this.listNodeDataSource.setLastDelayHighLightId();
- if (draggingCurrentNodeId != insertNodeCurrentNodeId) {
- this.listNodeDataSource.alterDragNode(insertNodeParentNodeId, insertNodeCurrentNodeId, insertNodeInfo,
- draggingParentNodeId, draggingCurrentNodeId, currentNodeInfo);
- this.listNodeDataSource.hideLastLine();
- } else {
- /*the position of dragNode is equal with the position of insertNode. */
- this.listNodeDataSource.hideLastLine();
- this.listNodeDataSource.setLastPassId(draggingCurrentNodeId);
- this.listNodeDataSource.hideLastLine();
- }
-
- let that = this;
- let lastDelayHighLightIndex: number = findCurrentNodeIndex.call(that,
- this.listNodeDataSource.getLastDelayHighLightId());
- this.listNodeDataSource.setLastDelayHighLightIndex(lastDelayHighLightIndex);
- this.listNodeDataSource.clearLastTimeoutHighLight();
- this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
- this.listNodeDataSource.setIsDrag(false);
-
- /* set the position of focus. */
- let currentFocusIndex: number = findCurrentNodeIndex.call(that, draggingCurrentNodeId);
- this.listNodeDataSource.setClickIndex(currentFocusIndex);
- this.listNodeDataSource.handleEvent(Event.DRAG, currentFocusIndex);
-
- /* innerDrag is over. */
- this.listNodeDataSource.setIsInnerDrag(false);
- this.listNodeDataSource.notifyDataReload();
- })
- }
- }
-
- // Declare NodeParam
- export interface NodeParam {
- parentNodeId?: number,
- currentNodeId?: number,
- isFolder?: boolean,
- icon?: Resource,
- selectedIcon?: Resource,
- editIcon? : Resource,
- primaryTitle?: string,
- secondaryTitle?: number | string,
- menu?: () => void,
- }
-
-
- // Declare CallbackParam
- export interface CallbackParam {
- currentNodeId: number,
- parentNodeId?: number,
- childIndex?: number,
- }
-
- /**
- * Create a tree view control proxy class to generate a tree view.
- *
- * @since 10
- */
- export class TreeController {
- readonly ROOT_NODE_ID: number = -1;
- private nodeIdList: number[] = [];
- private listNodeUtils : ListNodeUtils = new ListNodeUtils();
- private listNodeDataSource : ListNodeDataSource = new ListNodeDataSource();
-
- /**
- * After the addNode interface is invoked,
- * this interface is used to obtain the initialization data of
- * the tree view component for creating a tree view component.
- *
- * @return ListNodeDataSource Obtains the initialization data of the tree view component.
- *
- * @since 10
- */
- public getListNodeDataSource(): ListNodeDataSource {
- return this.listNodeDataSource;
- }
-
- /**
- * Obtains the subNode information of the currently clicked node.
- *
- * @return Array Returns an array that stores the configuration information of each node.
- * If there is no child node, an empty array is returned.
- *
- * @since 10
- */
- public getClickNodeChildrenInfo(): Array<{ itemId: number, itemIcon: Resource, itemTitle: string,
- isFolder: boolean }> {
- let clickNodeId = this.listNodeDataSource.getClickNodeId();
- return this.listNodeUtils.getClickNodeChildrenInfo(clickNodeId);
- }
-
- public getChildrenId(): Array {
- let clickNodeId = this.listNodeDataSource.getClickNodeId();
- return this.listNodeUtils.getClickChildId(clickNodeId);
- }
-
- /**
- * Delete a node.
- *
- * Register an ON_ITEM_DELETE callback through the EventBus mechanism to obtain the IDs of all deleted nodes.
- *
- * @since 10
- */
- public removeNode(): void {
- let clickNodeId = this.listNodeDataSource.getClickNodeId();
- let parentNodeId = this.listNodeUtils.findParentNodeId(clickNodeId);
- let removeNodeIdList: number[] = this.listNodeUtils.removeNode(clickNodeId,
- parentNodeId, this.listNodeUtils.traverseNodeBF);
- this.listNodeDataSource.refreshData(this.listNodeUtils, MenuOperation.REMOVE_NODE, parentNodeId, removeNodeIdList);
- this.nodeIdList.splice(this.nodeIdList.indexOf(clickNodeId), 1);
- }
-
- /**
- * Modify the node name.
- *
- * Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node.
- *
- * @since 10
- */
- public modifyNode(): void {
- let clickNodeId = this.listNodeDataSource.getClickNodeId();
- this.listNodeDataSource.setItemVisibilityOnEdit(clickNodeId, MenuOperation.MODIFY_NODE);
- }
-
- /**
- * Add a node.
- *
- * Icon of a new node, which is generated by the system by default.
- * If there is a same-level node, the icon of the first node of the same-level node is used.
- * If no icon is set for the first node of the same-level node, the new node does not have an icon.
- * If there is no peer node, the icon of the parent node is used.
- * If no icon is set for the parent node, the new node does not have an icon.
- * The system generates an ID for the new node and registers an ON_ITEM_ADD callback through
- * the EventBus mechanism to obtain the ID, parent node ID, node name, normal icon, selected icon,
- * edit icon of the new node.
- *
- * @since 10
- */
- public add(): void {
- let clickNodeId: number = this.listNodeDataSource.getClickNodeId();
- if (clickNodeId == this.listNodeDataSource.ROOT_NODE_ID || !this.listNodeDataSource.getIsFolder(clickNodeId)) {
- return;
- }
- let newNodeInfo: { isFolder: boolean, icon: Resource, selectedIcon: Resource, editIcon: Resource,
- menu: () =>any, secondaryTitle: number | string } =
- { isFolder: true, icon: null, selectedIcon: null, editIcon: null, menu: null, secondaryTitle: '' };
- newNodeInfo = this.listNodeUtils.getNewNodeInfo(clickNodeId);
- this.nodeIdList.push(this.nodeIdList[this.nodeIdList.length - 1] + 1);
- let newNodeId: number = this.nodeIdList[this.nodeIdList.length - 1];
- this.listNodeUtils.addNewNodeId = newNodeId;
- this.listNodeUtils.addNode(clickNodeId, newNodeId,
- { isFolder: newNodeInfo.isFolder, icon: newNodeInfo.icon, selectedIcon: newNodeInfo.selectedIcon,
- editIcon: newNodeInfo.editIcon, primaryTitle: '新建文件夹', menu: newNodeInfo.menu,
- secondaryTitle: newNodeInfo.secondaryTitle });
- this.listNodeDataSource.refreshData(this.listNodeUtils, MenuOperation.ADD_NODE, clickNodeId, [newNodeId]);
- }
-
- public addNodeParam(nodeParam: NodeParam): TreeController {
- if (nodeParam.primaryTitle != null &&
- !this.listNodeUtils.checkMainTitleIsValid(nodeParam.primaryTitle)) {
- throw new Error('ListTreeNode[addNode]: ' +
- 'The directory name cannot contain the following characters\ /: *? "< > | or exceeds the maximum length.');
- return null;
- }
- if (nodeParam.primaryTitle == null && nodeParam.icon == null) {
- throw new Error('ListTreeNode[addNode]: ' +
- 'The icon and directory name cannot be empty at the same time.');
- return null;
- }
- if (nodeParam.currentNodeId === this.ROOT_NODE_ID || nodeParam.currentNodeId === null) {
- throw new Error('ListTreeNode[addNode]: currentNodeId can not be -1 or null.');
- return null;
- }
- this.nodeIdList.push(nodeParam.currentNodeId);
- this.listNodeUtils.addNode(nodeParam.parentNodeId, nodeParam.currentNodeId, nodeParam);
- return this;
- }
-
- /**
- * Initialize the interface of the tree view. This interface is used to generate ListNodeDataSource data.
- * addNode is only designed for initialization. It can only be invoked during initialization.
- *
- * A maximum of 50 directory levels can be added.
- *
- * @param parentNodeId ID of the parent node.
- * @param currentNodeId ID of the new node. The value cannot be -1 or null.
- * @param nodeParam Configuration information of the newly added node.
- * For details, see the comment description of NodeParam.
- * @return ListTreeNode Tree view component proxy class.
- *
- * @since 10
- */
- public addNode(nodeParam?: NodeParam): TreeController {
- if (nodeParam == null) {
- this.add();
- } else {
- if (nodeParam.primaryTitle != null &&
- !this.listNodeUtils.checkMainTitleIsValid(nodeParam.primaryTitle)) {
- throw new Error('ListTreeNode[addNode]: ' +
- 'The directory name cannot contain the following characters\ /: *? "< > | or exceeds the maximum length.');
- return null;
- }
- if (nodeParam.primaryTitle == null && nodeParam.icon == null) {
- throw new Error('ListTreeNode[addNode]: ' +
- 'The icon and directory name cannot be empty at the same time.');
- return null;
- }
- if (nodeParam.currentNodeId === this.ROOT_NODE_ID || nodeParam.currentNodeId === null) {
- throw new Error('ListTreeNode[addNode]: currentNodeId can not be -1 or null.');
- return null;
- }
- this.nodeIdList.push(nodeParam.currentNodeId);
- this.listNodeUtils.addNode(nodeParam.parentNodeId, nodeParam.currentNodeId, nodeParam);
- return this;
- }
- }
-
- /**
- * After the initialization is complete by calling the addNode interface,
- * call this interface to complete initialization.
- *
- * This interface must be called when you finish initializing the ListTreeView by addNode.
- * @since 10
- */
- public buildDone() {
- this.listNodeDataSource.init(this.listNodeUtils);
- this.nodeIdList.sort((a, b) => a - b);
- }
-
- public refreshNode(parentId: number, parentSubTitle: ResourceStr = '',
- currentSubtitle: ResourceStr = '') {
- this.listNodeDataSource.setNodeSubtitlePara(parentId, parentSubTitle, currentSubtitle);
- }
- }
-}
\ No newline at end of file