diff --git a/packages/editor/src/layouts/sidebar/layer/LayerPanel.vue b/packages/editor/src/layouts/sidebar/layer/LayerPanel.vue
index 94669d691..cdb3d14cb 100644
--- a/packages/editor/src/layouts/sidebar/layer/LayerPanel.vue
+++ b/packages/editor/src/layouts/sidebar/layer/LayerPanel.vue
@@ -8,7 +8,7 @@
v-if="page && nodeStatusMap"
tabindex="-1"
ref="tree"
- :data="[page]"
+ :data="nodeData"
:node-status-map="nodeStatusMap"
@node-dragover="handleDragOver"
@node-dragstart="handleDragStart"
@@ -18,14 +18,18 @@
@node-mouseenter="mouseenterHandler"
@node-click="nodeClickHandler"
>
+
+
+
+
-
-
+
+
@@ -43,13 +47,13 @@ import type { MNode } from '@tmagic/schema';
import SearchInput from '@editor/components/SearchInput.vue';
import Tree from '@editor/components/Tree.vue';
-import type { LayerPanelSlots, MenuButton, MenuComponent, Services } from '@editor/type';
+import { useFilter } from '@editor/hooks/use-filter';
+import { LayerPanelSlots, MenuButton, MenuComponent, Services, TreeNodeData } from '@editor/type';
import LayerMenu from './LayerMenu.vue';
import LayerNodeTool from './LayerNodeTool.vue';
import { useClick } from './use-click';
import { useDrag } from './use-drag';
-import { useFilter } from './use-filter';
import { useKeybinding } from './use-keybinding';
import { useNodeStatus } from './use-node-status';
@@ -69,6 +73,7 @@ const editorService = services?.editorService;
const tree = ref>();
const page = computed(() => editorService?.get('page'));
+const nodeData = computed(() => (!page.value ? [] : [page.value]));
const { nodeStatusMap } = useNodeStatus(services);
const { isCtrlKeyDown } = useKeybinding(services, tree);
@@ -84,7 +89,7 @@ const filterNodeMethod = (v: string, data: MNode): boolean => {
return `${data.id}${name}${data.type}`.includes(v);
};
-const { filterTextChangeHandler } = useFilter(services, nodeStatusMap, filterNodeMethod);
+const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
const collapseAllHandler = () => {
if (!page.value || !nodeStatusMap.value) return;
diff --git a/packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue b/packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue
index 2105b3ef1..846e1dd37 100644
--- a/packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue
+++ b/packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue
@@ -12,7 +12,7 @@
@@ -28,7 +28,7 @@ import type { MNode } from '@tmagic/schema';
import FloatingBox from '@editor/components/FloatingBox.vue';
import Tree from '@editor/components/Tree.vue';
-import { useFilter } from '@editor/layouts/sidebar/layer/use-filter';
+import { useFilter } from '@editor/hooks/use-filter';
import { useNodeStatus } from '@editor/layouts/sidebar/layer/use-node-status';
import type { Services, TreeNodeData } from '@editor/type';
@@ -42,12 +42,13 @@ const box = ref>();
const stage = computed(() => editorService?.get('stage'));
const page = computed(() => editorService?.get('page'));
const nodes = computed(() => editorService?.get('nodes') || []);
+const nodeData = computed(() => (!page.value ? [] : [page.value]));
const { nodeStatusMap } = useNodeStatus(services);
const filterNodeMethod = (value: string, data: MNode): boolean => data.id === value;
-const { filterTextChangeHandler } = useFilter(services, nodeStatusMap, filterNodeMethod);
+const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
const unWatch = watch(
stage,
diff --git a/packages/editor/src/theme/dep-list.scss b/packages/editor/src/theme/dep-list.scss
deleted file mode 100644
index 19c8a4ec3..000000000
--- a/packages/editor/src/theme/dep-list.scss
+++ /dev/null
@@ -1,59 +0,0 @@
-.m-editor-dep-list-panel {
- .magic-editor-layer-tree {
- padding-top: 48px;
- }
-
- .search-wrapper {
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- top: 0;
- width: 100%;
- z-index: 1;
-
- .search-input {
- flex: 1;
- position: relative;
- }
-
- .tmagic-design-button {
- margin-right: 10px;
- }
- }
-
- .list-container {
- width: 100%;
- overflow: hidden;
- .list-item {
- display: flex;
- width: 100%;
- align-items: center;
-
- .right-tool {
- display: flex;
- width: fit-content !important;
- align-items: center;
- .edit-icon {
- margin: 0 5px;
- }
- }
- .name {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 0 !important;
- flex: 1;
- line-height: 22px;
-
- &.code {
- color: #000;
- }
-
- &.hook {
- color: #909399;
- }
- }
- }
- }
-}
diff --git a/packages/editor/src/theme/layer-panel.scss b/packages/editor/src/theme/layer-panel.scss
index 70433a09c..f54311759 100644
--- a/packages/editor/src/theme/layer-panel.scss
+++ b/packages/editor/src/theme/layer-panel.scss
@@ -4,4 +4,23 @@
.m-editor-tree {
padding-top: 48px;
}
+
+ .search-wrapper {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ z-index: 1;
+
+ .search-input {
+ flex: 1;
+ position: relative;
+ }
+
+ .tmagic-design-button {
+ margin-right: 10px;
+ }
+ }
}
diff --git a/packages/editor/src/theme/theme.scss b/packages/editor/src/theme/theme.scss
index 3efeed546..7a0608e17 100644
--- a/packages/editor/src/theme/theme.scss
+++ b/packages/editor/src/theme/theme.scss
@@ -16,7 +16,6 @@
@import "./event.scss";
@import "./layout.scss";
@import "./breadcrumb.scss";
-@import "./dep-list.scss";
@import "./data-source.scss";
@import "./data-source-fields.scss";
@import "./data-source-methods.scss";
diff --git a/packages/editor/src/theme/tree.scss b/packages/editor/src/theme/tree.scss
index 24d5ca853..c9542dce9 100644
--- a/packages/editor/src/theme/tree.scss
+++ b/packages/editor/src/theme/tree.scss
@@ -59,13 +59,24 @@
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
+
+ .disabled {
+ cursor: default;
+ }
+
+ .hook {
+ color: #999;
+ }
}
}
.tree-node-tool {
- margin-right: 15px;
display: flex;
align-items: center;
+
+ .tmagic-design-icon {
+ margin-right: 10px;
+ }
}
}
}
diff --git a/packages/editor/src/type.ts b/packages/editor/src/type.ts
index c145a4346..ca0bcd02b 100644
--- a/packages/editor/src/type.ts
+++ b/packages/editor/src/type.ts
@@ -81,12 +81,12 @@ export interface DataSourceListSlots {
export interface LayerNodeSlots {
'layer-node-content'(props: { data: MNode }): any;
+ 'layer-node-tool'(props: { data: MNode }): any;
+ 'layer-node-label'(props: { data: MNode }): any;
}
export interface LayerPanelSlots extends LayerNodeSlots {
'layer-panel-header'(props: {}): any;
- 'layer-node-tool'(props: { data: MNode }): any;
- 'layer-node-content'(props: { data: MNode }): any;
}
export interface PropsPanelSlots {