From 13e08a8d1b32ea9df86afcae394ed7dee70939eb Mon Sep 17 00:00:00 2001
From: * <8>
Date: Wed, 30 Mar 2022 14:14:42 +0800
Subject: [PATCH] Match-id-73ae28dbb8f2748c5398680c325a7ec24cee005a
---
libs/extension/src/components/VTree.less | 44 ++++++++++++++---------
libs/extension/src/components/VTree.tsx | 44 ++++++++++++++++++-----
libs/extension/src/components/assets.less | 1 +
3 files changed, 64 insertions(+), 25 deletions(-)
diff --git a/libs/extension/src/components/VTree.less b/libs/extension/src/components/VTree.less
index bf2fb88c..e83125e3 100644
--- a/libs/extension/src/components/VTree.less
+++ b/libs/extension/src/components/VTree.less
@@ -5,26 +5,36 @@
width: 100%;
height: 100%;
overflow-y: auto;
-}
+ .treeItem {
+ width: 100%;
+ position: absolute;
+ line-height: 18px;
+ &:hover {
+ background-color: @select-color;
+ }
-.treeItem {
- width: 100%;
- position: absolute;
+ .treeIcon {
+ color: @arrow-color;
+ display: inline-block;
+ width: 12px;
+ padding-left: 0.5rem;
+ }
-.treeIcon {
- color: @arrow-color;
- display: inline-block;
- width: 12px;
- padding-left: 0.5rem;
-}
- .componentName {
- color: @component-name-color;
+ .componentName {
+ color: @component-name-color;
+ }
+
+ .componentKeyName {
+ color: @component-key-color;
+ }
+
+ .componentKeyValue {
+ color: @componentKeyValue-color;
+ }
}
- .componentKeyName {
- color: @component-key-color;
- }
- .componentKeyValue {
- color: @componentKeyValue-color;
+
+ .select {
+ background-color: rgb(141 199 248 / 60%);
}
}
diff --git a/libs/extension/src/components/VTree.tsx b/libs/extension/src/components/VTree.tsx
index 3a2c5360..6e594539 100644
--- a/libs/extension/src/components/VTree.tsx
+++ b/libs/extension/src/components/VTree.tsx
@@ -13,23 +13,45 @@ type IItem = {
style: any,
hasChild: boolean,
onCollapse: (id: string) => void,
+ onClick: (id: string) => void,
isCollapsed: boolean,
+ isSelect: boolean,
} & IData
// TODO: 计算可以展示的最多数量,并且监听显示器高度变化修改数值
-const showNum = 50;
-const divHeight = 21;
+const showNum = 70;
+const lineHeight = 18;
const indentationLength = 20;
-function Item({ name, style, userKey, hasChild, onCollapse, isCollapsed, id, indentation }: IItem) {
+function Item(props: IItem) {
+ const {
+ name,
+ style,
+ userKey,
+ hasChild,
+ onCollapse,
+ isCollapsed,
+ id,
+ indentation,
+ onClick,
+ isSelect,
+ } = props;
const isShowKey = userKey !== '';
const showIcon = hasChild ?