-
-
{{ data.name }}({{ data.id }})
+
+
+
{{ data.name }}({{ data.id }})
@@ -59,9 +62,10 @@ import { TMagicButton, tMagicMessage, TMagicScrollbar, TMagicTooltip, TMagicTree
import { ColumnConfig } from '@tmagic/form';
import { CodeBlockContent, Id } from '@tmagic/schema';
-import CodeIcon from '@editor/components/CodeIcon.vue';
import Icon from '@editor/components/Icon.vue';
import SearchInput from '@editor/components/SearchInput.vue';
+import AppManageIcon from '@editor/icons/AppManageIcon.vue';
+import CodeIcon from '@editor/icons/CodeIcon.vue';
import { CodeDeleteErrorType, CodeDslItem, Services } from '@editor/type';
import CodeBlockEditor from './CodeBlockEditor.vue';
@@ -75,21 +79,25 @@ const { codeBlockService, depService, editorService } = inject('servic
// 代码块列表
const codeList = computed(() =>
- Object.values(depService?.targets['code-block'] || {}).map((target) => ({
- id: target.id,
- name: target.name,
- type: 'code',
- codeBlockContent: codeBlockService?.getCodeContentById(target.id),
- children: Object.entries(target.deps).map(([id, dep]) => ({
+ Object.values(depService?.targets['code-block'] || {}).map((target) => {
+ // 组件节点
+ const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
name: dep.name,
type: 'node',
id,
children: dep.keys.map((key) => ({ name: key, id: key, type: 'key' })),
- })),
- })),
+ }));
+ return {
+ id: target.id,
+ name: target.name,
+ type: 'code',
+ codeBlockContent: codeBlockService?.getCodeContentById(target.id),
+ children: compNodes,
+ };
+ }),
);
-// 默认展开节点
+// 默认展开组件层级的节点
const expandedKeys = computed(() => codeList.value.map((item) => item.id));
const editable = computed(() => codeBlockService?.getEditStatus());
diff --git a/packages/editor/src/theme/code-block.scss b/packages/editor/src/theme/code-block.scss
index 80be261c..6a0f7a08 100644
--- a/packages/editor/src/theme/code-block.scss
+++ b/packages/editor/src/theme/code-block.scss
@@ -36,21 +36,45 @@
display: flex;
align-items: center;
width: 100%;
+ align-items: center;
.right-tool {
display: flex;
width: fit-content !important;
+ align-items: center;
+ margin-right: 10px;
.edit-icon {
margin: 0 5px;
}
}
+
+ .codeIcon {
+ width: 20px;
+ height: 20px;
+ margin-right: 5px;
+ }
+
+ .compIcon {
+ width: 15px;
+ height: 15px;
+ margin-right: 5px;
+ }
+
.code-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 0 !important;
flex: 1;
- line-height: 18px;
+ line-height: 22px;
+
+ &.code {
+ color: #000;
+ }
+
+ &.hook {
+ color: #909399;
+ }
}
}
}
@@ -58,9 +82,8 @@
.m-fields-code-select {
width: 100%;
- .edit-icon {
- cursor: pointer;
- margin-right: 5px;
+ .el-card__header {
+ display: none;
}
}
diff --git a/packages/editor/src/theme/event.scss b/packages/editor/src/theme/event.scss
index aee5bf71..2c52ab10 100644
--- a/packages/editor/src/theme/event.scss
+++ b/packages/editor/src/theme/event.scss
@@ -21,4 +21,16 @@
}
.m-fields-code-select-col {
width: 100%;
+ .code-select-container {
+ display: flex;
+ align-items: center;
+ .select {
+ flex: 10 0 100px;
+ }
+ .icon {
+ flex: 1 0 20px;
+ cursor: pointer;
+ margin-right: 5px;
+ }
+ }
}
diff --git a/playground/src/configs/dsl.ts b/playground/src/configs/dsl.ts
index 275c7bfe..1717c963 100644
--- a/playground/src/configs/dsl.ts
+++ b/playground/src/configs/dsl.ts
@@ -29,10 +29,12 @@ export default {
{
name: 'age',
type: 'number',
+ tip: '年纪',
},
{
name: 'studentName',
type: 'text',
+ tip: '学生姓名',
},
],
},