@tmagic/editor 1.2.0-beta.11 → 1.2.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +1,70 @@
1
1
  <template>
2
- <TMagicScrollbar
3
- class="magic-editor-layer-panel"
4
- @mouseenter="addSelectModeListener"
5
- @mouseleave="removeSelectModeListener"
6
- >
7
- <slot name="layer-panel-header"></slot>
8
-
9
- <TMagicInput
10
- v-model="filterText"
11
- class="search-input"
12
- size="small"
13
- placeholder="输入关键字进行过滤"
14
- clearable
15
- :prefix-icon="Search"
16
- @change="filterTextChangeHandler"
17
- ></TMagicInput>
18
-
19
- <TMagicTree
20
- v-if="values.length"
21
- class="magic-editor-layer-tree"
22
- ref="tree"
23
- node-key="id"
24
- empty-text="页面空荡荡的"
25
- draggable
26
- :default-expanded-keys="defaultExpandedKeys"
27
- :load="loadItems"
28
- :data="values"
29
- :expand-on-click-node="false"
30
- :highlight-current="true"
31
- :props="{
32
- children: 'items',
33
- }"
34
- :filter-node-method="filterNode"
35
- :allow-drop="allowDrop"
36
- :show-checkbox="isMultiSelectStatus || selectedIds.length > 1"
37
- @node-click="clickHandler"
38
- @node-contextmenu="contextmenu"
39
- @node-drag-end="handleDragEnd"
40
- @node-collapse="handleCollapse"
41
- @node-expand="handleExpand"
42
- @check="multiClickHandler"
43
- @mousedown="toggleClickFlag"
44
- @mouseup="toggleClickFlag"
45
- >
46
- <template #default="{ node, data }">
47
- <div
48
- :id="data.id"
49
- class="cus-tree-node"
50
- @mouseenter="highlightHandler(data)"
51
- :class="{ 'cus-tree-node-hover': canHighlight(data) }"
52
- >
53
- <slot name="layer-node-content" :node="node" :data="data">
54
- <span>
55
- {{ `${data.name} (${data.id})` }}
56
- </span>
57
- </slot>
58
- </div>
59
- </template>
60
- </TMagicTree>
61
-
62
- <Teleport to="body">
63
- <LayerMenu ref="menu" :layer-content-menu="layerContentMenu"></LayerMenu>
64
- </Teleport>
65
- </TMagicScrollbar>
2
+ <div ref="layerPanel">
3
+ <TMagicScrollbar class="magic-editor-layer-panel">
4
+ <slot name="layer-panel-header"></slot>
5
+
6
+ <TMagicInput
7
+ v-model="filterText"
8
+ class="search-input"
9
+ size="small"
10
+ placeholder="输入关键字进行过滤"
11
+ clearable
12
+ :prefix-icon="Search"
13
+ @change="filterTextChangeHandler"
14
+ ></TMagicInput>
15
+
16
+ <TMagicTree
17
+ v-if="values.length"
18
+ class="magic-editor-layer-tree"
19
+ ref="tree"
20
+ node-key="id"
21
+ empty-text="页面空荡荡的"
22
+ draggable
23
+ :default-expanded-keys="defaultExpandedKeys"
24
+ :load="loadItems"
25
+ :data="values"
26
+ :expand-on-click-node="false"
27
+ :highlight-current="true"
28
+ :props="{
29
+ children: 'items',
30
+ }"
31
+ :filter-node-method="filterNode"
32
+ :allow-drop="allowDrop"
33
+ :show-checkbox="isMultiSelectStatus || selectedIds.length > 1"
34
+ @node-click="clickHandler"
35
+ @node-contextmenu="contextmenu"
36
+ @node-drag-end="handleDragEnd"
37
+ @node-collapse="handleCollapse"
38
+ @node-expand="handleExpand"
39
+ @check="multiClickHandler"
40
+ @mousedown="toggleClickFlag"
41
+ @mouseup="toggleClickFlag"
42
+ >
43
+ <template #default="{ node, data }">
44
+ <div
45
+ :id="data.id"
46
+ class="cus-tree-node"
47
+ @mouseenter="highlightHandler(data)"
48
+ :class="{ 'cus-tree-node-hover': canHighlight(data) }"
49
+ >
50
+ <slot name="layer-node-content" :node="node" :data="data">
51
+ <span>
52
+ {{ `${data.name} (${data.id})` }}
53
+ </span>
54
+ </slot>
55
+ </div>
56
+ </template>
57
+ </TMagicTree>
58
+
59
+ <Teleport to="body">
60
+ <LayerMenu ref="menu" :layer-content-menu="layerContentMenu"></LayerMenu>
61
+ </Teleport>
62
+ </TMagicScrollbar>
63
+ </div>
66
64
  </template>
67
65
 
68
66
  <script lang="ts" setup name="MEditorLayerPanel">
69
- import { computed, inject, nextTick, ref, watch } from 'vue';
67
+ import { computed, inject, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
70
68
  import { Search } from '@element-plus/icons-vue';
71
69
  import KeyController from 'keycon';
72
70
  import { throttle } from 'lodash-es';
@@ -264,32 +262,47 @@ watch([selectedIds, tree], async () => {
264
262
  setTreeKeyStatus();
265
263
  });
266
264
 
267
- const keycon = ref<KeyController>();
268
- // 监听模式选择
269
- const addSelectModeListener = () => {
270
- const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
271
- const ctrl = isMac ? 'meta' : 'ctrl';
272
- keycon.value = new KeyController();
273
- keycon.value.keydown(ctrl, (e) => {
274
- e.inputEvent.preventDefault();
275
- isMultiSelectStatus.value = true;
276
- });
277
- // ctrl+tab切到其他窗口,需要将多选状态置为false
278
- keycon.value.on('blur', () => {
279
- isMultiSelectStatus.value = false;
280
- });
281
- keycon.value.keyup(ctrl, (e) => {
282
- e.inputEvent.preventDefault();
283
- isMultiSelectStatus.value = false;
284
- });
265
+ const layerPanel = ref<HTMLDivElement>();
266
+ const mouseenterHandler = () => {
267
+ layerPanel.value?.focus();
285
268
  };
286
- // 移除监听
287
- const removeSelectModeListener = () => {
288
- keycon.value?.destroy();
269
+
270
+ const mouseleaveHandler = () => {
271
+ layerPanel.value?.blur();
289
272
  // 如果鼠标移出监听范围,且当前只选中了一个,置为单选模式(修复按住ctrl不放但鼠标移出的情况)
290
273
  if (selectedIds.value.length === 1) isMultiSelectStatus.value = false;
291
274
  };
292
275
 
276
+ let keycon: KeyController;
277
+
278
+ onMounted(() => {
279
+ layerPanel.value?.addEventListener('mouseenter', mouseenterHandler);
280
+ layerPanel.value?.addEventListener('mouseleave', mouseleaveHandler);
281
+
282
+ keycon = new KeyController(layerPanel.value);
283
+ const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
284
+ const ctrl = isMac ? 'meta' : 'ctrl';
285
+
286
+ keycon
287
+ .keydown(ctrl, (e) => {
288
+ e.inputEvent.preventDefault();
289
+ isMultiSelectStatus.value = true;
290
+ })
291
+ .on('blur', () => {
292
+ isMultiSelectStatus.value = false;
293
+ })
294
+ .keyup(ctrl, (e) => {
295
+ e.inputEvent.preventDefault();
296
+ isMultiSelectStatus.value = false;
297
+ });
298
+ });
299
+
300
+ onUnmounted(() => {
301
+ layerPanel.value?.removeEventListener('mouseenter', mouseenterHandler);
302
+ layerPanel.value?.removeEventListener('mouseleave', mouseleaveHandler);
303
+ keycon.destroy();
304
+ });
305
+
293
306
  // 鼠标是否按下标志,用于高亮状态互斥
294
307
  const clicked = ref(false);
295
308
  // 高亮的节点
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <TMagicDialog
3
- v-model="isShowCodeBlockEditor"
3
+ :model-value="true"
4
4
  class="code-editor-dialog"
5
5
  :title="currentTitle"
6
6
  :fullscreen="true"
7
- :before-close="saveAndClose"
7
+ :close-on-press-escape="false"
8
8
  :append-to-body="true"
9
+ :show-close="false"
9
10
  >
10
11
  <Layout v-model:left="left" :min-left="45" class="code-editor-layout">
11
12
  <!-- 左侧列表 -->
@@ -40,41 +41,15 @@
40
41
  ]"
41
42
  >
42
43
  <slot name="code-block-edit-panel-header" :id="id"></slot>
43
- <TMagicCard shadow="never">
44
- <template #header>
45
- <div class="code-name-wrapper">
46
- <div class="code-name-label">代码块名称</div>
47
- <TMagicInput
48
- v-if="codeConfig"
49
- class="code-name-input"
50
- v-model="codeConfig.name"
51
- :disabled="!editable"
52
- />
53
- </div>
54
- </template>
55
- <div class="m-editor-wrapper">
56
- <MagicCodeEditor
57
- v-if="codeConfig"
58
- ref="codeEditor"
59
- class="m-editor-container"
60
- :init-values="`${codeConfig.content}`"
61
- @save="saveCode"
62
- :options="{
63
- tabSize: 2,
64
- fontSize: 16,
65
- formatOnPaste: true,
66
- readOnly: !editable,
67
- }"
68
- ></MagicCodeEditor>
69
- <div class="m-editor-content-bottom" v-if="editable">
70
- <TMagicButton type="primary" class="button" @click="saveCode">保存</TMagicButton>
71
- <TMagicButton type="primary" class="button" @click="saveAndClose">关闭</TMagicButton>
72
- </div>
73
- <div class="m-editor-content-bottom" v-else>
74
- <TMagicButton type="primary" class="button" @click="saveAndClose">关闭</TMagicButton>
75
- </div>
76
- </div>
77
- </TMagicCard>
44
+ <FunctionEditor
45
+ v-if="codeConfig"
46
+ :id="id"
47
+ :name="codeConfig.name"
48
+ :content="codeConfig.content"
49
+ :editable="!!editable"
50
+ :autoSaveDraft="mode === CodeEditorMode.EDITOR"
51
+ :codeOptions="codeOptions"
52
+ ></FunctionEditor>
78
53
  </div>
79
54
  </template>
80
55
  </Layout>
@@ -83,19 +58,20 @@
83
58
 
84
59
  <script lang="ts" setup name="MEditorCodeBlockEditor">
85
60
  import { computed, inject, reactive, ref, watchEffect } from 'vue';
86
- import { forIn, isEmpty } from 'lodash-es';
87
- import type * as monaco from 'monaco-editor';
61
+ import { cloneDeep, forIn, isEmpty } from 'lodash-es';
88
62
 
89
- import { TMagicButton, TMagicCard, TMagicDialog, TMagicInput, tMagicMessage, TMagicTree } from '@tmagic/design';
63
+ import { TMagicDialog, TMagicTree } from '@tmagic/design';
64
+ import { CodeBlockContent } from '@tmagic/schema';
90
65
 
66
+ import FunctionEditor from '../../../components/FunctionEditor.vue';
91
67
  import Layout from '../../../components/Layout.vue';
92
- import type { CodeBlockContent, CodeDslList, ListState, Services } from '../../../type';
68
+ import type { CodeDslItem, ListState, Services } from '../../../type';
93
69
  import { CodeEditorMode } from '../../../type';
94
- import MagicCodeEditor from '../../CodeEditor.vue';
70
+ import { serializeConfig } from '../../../utils/editor';
95
71
 
96
72
  const services = inject<Services>('services');
73
+ const codeOptions = inject('codeOptions', {});
97
74
 
98
- const codeEditor = ref<InstanceType<typeof MagicCodeEditor>>();
99
75
  const left = ref(200);
100
76
  const currentTitle = ref('');
101
77
  // 编辑器当前需展示的代码块内容
@@ -105,10 +81,6 @@ const state = reactive<ListState>({
105
81
  codeList: [],
106
82
  });
107
83
 
108
- // 是否展示代码编辑区
109
- const isShowCodeBlockEditor = computed(
110
- () => (codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus()) || false,
111
- );
112
84
  const mode = computed(() => services?.codeBlockService.getMode());
113
85
  const id = computed(() => services?.codeBlockService.getId() || '');
114
86
  const editable = computed(() => services?.codeBlockService.getEditStatus());
@@ -116,7 +88,9 @@ const editable = computed(() => services?.codeBlockService.getEditStatus());
116
88
  const selectedIds = computed(() => services?.codeBlockService.getCombineIds() || []);
117
89
 
118
90
  watchEffect(async () => {
119
- codeConfig.value = (await services?.codeBlockService.getCodeContentById(id.value)) || null;
91
+ codeConfig.value = cloneDeep(await services?.codeBlockService.getCodeContentById(id.value)) || null;
92
+ if (!codeConfig.value) return;
93
+ codeConfig.value.content = serializeConfig(codeConfig.value.content);
120
94
  });
121
95
 
122
96
  watchEffect(async () => {
@@ -132,37 +106,7 @@ watchEffect(async () => {
132
106
  currentTitle.value = state.codeList[0]?.name || '';
133
107
  });
134
108
 
135
- // 保存代码
136
- const saveCode = async (): Promise<boolean> => {
137
- if (!codeEditor.value || !codeConfig.value || !editable.value) return true;
138
-
139
- try {
140
- // 代码内容
141
- const codeContent = (codeEditor.value.getEditor() as monaco.editor.IStandaloneCodeEditor)?.getValue();
142
- /* eslint no-eval: "off" */
143
- codeConfig.value.content = eval(codeContent);
144
- } catch (e: any) {
145
- tMagicMessage.error(e.stack);
146
- return false;
147
- }
148
- // 存入dsl
149
- await services?.codeBlockService.setCodeDslById(id.value, {
150
- name: codeConfig.value.name,
151
- content: codeConfig.value.content,
152
- });
153
- tMagicMessage.success('代码保存成功');
154
- return true;
155
- };
156
-
157
- // 保存并关闭
158
- const saveAndClose = async () => {
159
- const saveRes = await saveCode();
160
- if (saveRes) {
161
- await services?.codeBlockService.setCodeEditorShowStatus(false);
162
- }
163
- };
164
-
165
- const selectHandler = (data: CodeDslList) => {
109
+ const selectHandler = (data: CodeDslItem) => {
166
110
  services?.codeBlockService.setId(data.id);
167
111
  currentTitle.value = data.name;
168
112
  };
@@ -30,7 +30,7 @@
30
30
  <template #default="{ data }">
31
31
  <div :id="data.id" class="list-container">
32
32
  <div class="list-item">
33
- <div class="code-name">{{ data.name }}({{ data.id }})</div>
33
+ <span class="code-name">{{ data.name }}({{ data.id }})</span>
34
34
  <!-- 右侧工具栏 -->
35
35
  <div class="right-tool">
36
36
  <TMagicTooltip effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
@@ -40,7 +40,7 @@
40
40
  effect="dark"
41
41
  content="查看绑定关系"
42
42
  placement="bottom"
43
- v-if="state.bindComps[data.id] && state.bindComps[data.id].length > 0"
43
+ v-if="data.combineInfo && data.combineInfo.length > 0"
44
44
  >
45
45
  <Icon :icon="Link" class="edit-icon" @click.stop="toggleCombineRelation(data)"></Icon>
46
46
  </TMagicTooltip>
@@ -53,7 +53,7 @@
53
53
  <!-- 展示代码块下绑定的组件 -->
54
54
  <div
55
55
  class="code-comp-map-wrapper"
56
- v-if="data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0"
56
+ v-if="data.showRelation && data.combineInfo && data.combineInfo.length > 0"
57
57
  >
58
58
  <svg class="arrow-left" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-029747aa="">
59
59
  <path
@@ -61,23 +61,14 @@
61
61
  d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
62
62
  ></path>
63
63
  </svg>
64
- <!-- todo 功能暂时隐藏 -->
65
- <!-- <TMagicButton
66
- v-for="(comp, index) in state.bindComps[data.id]"
67
- :key="index"
68
- class="code-comp"
69
- size="small"
70
- :plain="true"
71
- >{{ comp.name }}<Icon :icon="Close" class="comp-delete-icon" @click.stop="unbind(comp.id, data.id)"></Icon
72
- ></TMagicButton> -->
73
64
  <TMagicButton
74
- v-for="(comp, index) in state.bindComps[data.id]"
65
+ v-for="(comp, index) in data.combineInfo"
75
66
  :key="index"
76
67
  class="code-comp"
77
68
  size="small"
78
69
  :plain="true"
79
- @click.stop="selectComp(comp.id)"
80
- >{{ comp.name }}</TMagicButton
70
+ @click.stop="selectComp(comp.compId)"
71
+ >{{ comp.compName }}</TMagicButton
81
72
  >
82
73
  </div>
83
74
  </div>
@@ -85,7 +76,7 @@
85
76
  </TMagicTree>
86
77
 
87
78
  <!-- 代码块编辑区 -->
88
- <code-block-editor>
79
+ <code-block-editor v-if="isShowCodeBlockEditor">
89
80
  <template #code-block-edit-panel-header="{ id }">
90
81
  <slot name="code-block-edit-panel-header" :id="id"></slot>
91
82
  </template>
@@ -96,66 +87,65 @@
96
87
  <script lang="ts" setup name="MEditorCodeBlockList">
97
88
  import { computed, inject, reactive, ref, watch } from 'vue';
98
89
  import { Close, Edit, Link, View } from '@element-plus/icons-vue';
99
- import { forIn, isEmpty } from 'lodash-es';
90
+ import { cloneDeep, forIn, isEmpty } from 'lodash-es';
100
91
 
101
92
  import { TMagicButton, TMagicInput, tMagicMessage, TMagicTooltip, TMagicTree } from '@tmagic/design';
102
- import { Id } from '@tmagic/schema';
93
+ import { CodeBlockContent, Id } from '@tmagic/schema';
103
94
  import StageCore from '@tmagic/stage';
104
95
 
105
96
  import Icon from '../../../components/Icon.vue';
106
- import type { CodeBlockContent, CodeRelation, Services } from '../../../type';
107
- import { CodeDeleteErrorType, CodeDslList, CodeEditorMode, ListRelationState } from '../../../type';
97
+ import type { CodeRelation, Services } from '../../../type';
98
+ import { CodeDeleteErrorType, CodeDslItem, CodeEditorMode, ListState } from '../../../type';
108
99
 
109
100
  import codeBlockEditor from './CodeBlockEditor.vue';
110
101
 
111
102
  const props = defineProps<{
112
- customError?: (id: string, errorType: CodeDeleteErrorType) => any;
103
+ customError?: (id: Id, errorType: CodeDeleteErrorType) => any;
113
104
  }>();
114
105
 
115
106
  const services = inject<Services>('services');
116
107
 
117
108
  // 代码块列表
118
- const state = reactive<ListRelationState>({
109
+ const state = reactive<ListState>({
119
110
  codeList: [],
120
- bindComps: {},
121
111
  });
122
112
 
123
113
  const editable = computed(() => services?.codeBlockService.getEditStatus());
124
114
 
115
+ // 是否展示代码编辑区
116
+ const isShowCodeBlockEditor = computed(() => services?.codeBlockService.getCodeEditorShowStatus() || false);
117
+ // 获取绑定关系
118
+ const codeCombineInfo = ref<CodeRelation | null>(null);
119
+
125
120
  // 根据代码块ID获取其绑定的组件信息
126
- const getBindCompsByCodeId = (codeId: string, codeBlockContent: CodeBlockContent) => {
127
- if (isEmpty(codeBlockContent) || isEmpty(codeBlockContent.comps)) {
128
- state.bindComps[codeId] = [];
129
- return;
130
- }
131
- const compsField = codeBlockContent.comps as CodeRelation;
132
- const bindCompIds = Object.keys(compsField);
133
- const bindCompsFiltered = bindCompIds.filter((compId) => !isEmpty(compsField[compId]));
134
- const compsInfo = bindCompsFiltered.map((compId) => ({
135
- id: compId,
136
- name: getCompName(compId),
121
+ const getBindCompsByCodeId = (codeId: Id) => {
122
+ if (!codeCombineInfo.value || !codeCombineInfo.value[codeId]) return [];
123
+ const bindCompsId = Object.keys(codeCombineInfo.value[codeId]);
124
+ return bindCompsId.map((compId) => ({
125
+ compId,
126
+ compName: getCompName(compId),
137
127
  }));
138
- state.bindComps[codeId] = compsInfo;
139
128
  };
140
129
 
141
130
  // 初始化代码块列表
142
131
  const initList = async () => {
143
- const codeDsl = (await services?.codeBlockService.getCodeDsl()) || null;
144
- if (!codeDsl) return;
132
+ const codeDsl = cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
133
+ codeCombineInfo.value = cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
134
+ if (!codeDsl || !codeCombineInfo.value) return;
145
135
  state.codeList = [];
146
- forIn(codeDsl, (value: CodeBlockContent, codeId: string) => {
147
- getBindCompsByCodeId(codeId, value);
136
+ forIn(codeDsl, (value: CodeBlockContent, codeId: Id) => {
148
137
  state.codeList.push({
149
138
  id: codeId,
150
139
  name: value.name,
151
140
  codeBlockContent: value,
152
141
  showRelation: true,
142
+ combineInfo: getBindCompsByCodeId(codeId),
153
143
  });
154
144
  });
155
145
  };
156
146
 
157
147
  watch(
158
- () => services?.codeBlockService.getCodeDsl(),
148
+ [() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
159
149
  () => {
160
150
  initList();
161
151
  },
@@ -165,21 +155,6 @@ watch(
165
155
  },
166
156
  );
167
157
 
168
- // 监听组件名称修改,更新到代码块列表
169
- watch(
170
- () => services?.editorService.get('node'),
171
- (curNode) => {
172
- if (!curNode?.id) return;
173
- forIn(state.bindComps, (bindCompInfo) => {
174
- bindCompInfo.forEach((comp) => {
175
- if (comp.id === curNode.id) {
176
- comp.name = curNode.name;
177
- }
178
- });
179
- });
180
- },
181
- );
182
-
183
158
  // 新增代码块
184
159
  const createCodeBlock = async () => {
185
160
  const { codeBlockService } = services || {};
@@ -190,6 +165,7 @@ const createCodeBlock = async () => {
190
165
  const codeConfig: CodeBlockContent = {
191
166
  name: '代码块',
192
167
  content: `() => {\n // place your code here\n}`,
168
+ params: [],
193
169
  };
194
170
  await codeBlockService.setMode(CodeEditorMode.EDITOR);
195
171
  const id = await codeBlockService.getUniqueId();
@@ -198,14 +174,15 @@ const createCodeBlock = async () => {
198
174
  };
199
175
 
200
176
  // 编辑代码块
201
- const editCode = async (key: string) => {
177
+ const editCode = async (key: Id) => {
202
178
  await services?.codeBlockService.setMode(CodeEditorMode.EDITOR);
203
179
  services?.codeBlockService.setCodeEditorContent(true, key);
204
180
  };
205
181
 
206
182
  // 删除代码块
207
- const deleteCode = (key: string) => {
208
- const existBinds = !!(state.bindComps[key]?.length > 0);
183
+ const deleteCode = (key: Id) => {
184
+ const currentCode = state.codeList.find((codeItem: CodeDslItem) => codeItem.id === key);
185
+ const existBinds = !isEmpty(currentCode?.combineInfo);
209
186
  const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
210
187
  if (!existBinds && !undeleteableList.includes(key)) {
211
188
  // 无绑定关系,且不在不可删除列表中
@@ -222,7 +199,7 @@ const deleteCode = (key: string) => {
222
199
  const filterText = ref('');
223
200
  const tree = ref();
224
201
 
225
- const filterNode = (value: string, data: CodeDslList): boolean => {
202
+ const filterNode = (value: string, data: CodeDslItem): boolean => {
226
203
  if (!value) {
227
204
  return true;
228
205
  }
@@ -234,7 +211,7 @@ const filterTextChangeHandler = (val: string) => {
234
211
  };
235
212
 
236
213
  // 展示/隐藏组件绑定关系
237
- const toggleCombineRelation = (data: CodeDslList) => {
214
+ const toggleCombineRelation = (data: CodeDslItem) => {
238
215
  const { id } = data;
239
216
  const currentCode = state.codeList.find((item) => item.id === id);
240
217
  if (!currentCode) return;
@@ -247,17 +224,6 @@ const getCompName = (compId: Id): string => {
247
224
  return node?.name || String(compId);
248
225
  };
249
226
 
250
- // todo 功能暂时隐藏
251
- // 解除绑定
252
- // const unbind = async (compId: Id, codeId: string) => {
253
- // const res = await services?.codeBlockService.unbind(compId, codeId, codeHooks);
254
- // if (res) {
255
- // ElMessage.success('绑定关系解除成功');
256
- // } else {
257
- // ElMessage.error('绑定关系解除失败');
258
- // }
259
- // };
260
-
261
227
  // 选中组件
262
228
  const selectComp = (compId: Id) => {
263
229
  const stage = services?.editorService.get<StageCore | null>('stage');