Skip to content

Commit

Permalink
feat(editor): 代码块与数据源列表节点中新增依赖收集中tag
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Nov 25, 2024
1 parent a0dd484 commit 8a8ccae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
</template>

<template #tree-node-tool="{ data }">
<TMagicTag v-if="collecting && data.type === 'code'" type="info" size="small" style="margin-right: 5px"
>依赖收集中</TMagicTag
>
<TMagicTooltip v-if="data.type === 'code'" effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
<Icon :icon="editable ? Edit : View" class="edit-icon" @click.stop="editCode(`${data.key}`)"></Icon>
</TMagicTooltip>
Expand All @@ -36,7 +39,7 @@ import { Close, Edit, View } from '@element-plus/icons-vue';
import type { Id, MNode } from '@tmagic/core';
import { DepTargetType } from '@tmagic/core';
import { tMagicMessage, tMagicMessageBox, TMagicTooltip } from '@tmagic/design';
import { tMagicMessage, tMagicMessageBox, TMagicTag, TMagicTooltip } from '@tmagic/design';
import Icon from '@editor/components/Icon.vue';
import Tree from '@editor/components/Tree.vue';
Expand Down Expand Up @@ -64,6 +67,8 @@ const emit = defineEmits<{
const services = inject<Services>('services');
const { codeBlockService, depService, editorService } = services || {};
const collecting = computed(() => depService?.get('collecting'));
// 代码块列表
const codeList = computed<TreeNodeData[]>(() =>
Object.entries(codeBlockService?.getCodeDsl() || {}).map(([codeId, code]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
</div>
</template>
<template #tree-node-tool="{ data }">
<TMagicTag v-if="collecting && data.type === 'ds'" type="info" size="small" style="margin-right: 5px"
>依赖收集中</TMagicTag
>
<TMagicTooltip v-if="data.type === 'ds'" effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
<Icon :icon="editable ? Edit : View" class="edit-icon" @click.stop="editHandler(`${data.key}`)"></Icon>
</TMagicTooltip>
Expand All @@ -34,7 +37,7 @@ import { computed, inject } from 'vue';
import { Close, Edit, View } from '@element-plus/icons-vue';
import { DepData, DepTargetType, Id, MNode } from '@tmagic/core';
import { tMagicMessageBox, TMagicTooltip } from '@tmagic/design';
import { tMagicMessageBox, TMagicTag, TMagicTooltip } from '@tmagic/design';
import Icon from '@editor/components/Icon.vue';
import Tree from '@editor/components/Tree.vue';
Expand All @@ -60,6 +63,8 @@ const emit = defineEmits<{
const { depService, editorService, dataSourceService } = inject<Services>('services') || {};
const collecting = computed(() => depService?.get('collecting'));
const editable = computed(() => dataSourceService?.get('editable') ?? true);
const dataSources = computed(() => dataSourceService?.get('dataSources') || []);
Expand Down

0 comments on commit 8a8ccae

Please sign in to comment.