@tmagic/editor 1.2.0-beta.2 → 1.2.0-beta.4
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.
- package/dist/tmagic-editor.mjs +415 -400
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +417 -402
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/components/ContentMenu.vue +2 -2
- package/src/components/Icon.vue +6 -4
- package/src/components/ToolButton.vue +29 -14
- package/src/fields/CodeSelect.vue +6 -6
- package/src/fields/UISelect.vue +8 -7
- package/src/layouts/AddPageBox.vue +2 -1
- package/src/layouts/Framework.vue +3 -2
- package/src/layouts/PropsPanel.vue +3 -8
- package/src/layouts/sidebar/ComponentListPanel.vue +13 -11
- package/src/layouts/sidebar/LayerPanel.vue +252 -162
- package/src/layouts/sidebar/Sidebar.vue +4 -2
- package/src/layouts/sidebar/TabPane.vue +4 -2
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +21 -16
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +19 -19
- package/src/layouts/workspace/PageBar.vue +11 -10
- package/types/Editor.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +16 -883
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
<div class="m-editor-code-block-list">
|
|
3
3
|
<slot name="code-block-panel-header">
|
|
4
4
|
<div class="code-header-wrapper">
|
|
5
|
-
<
|
|
5
|
+
<TMagicInput
|
|
6
6
|
:class="[editable ? 'code-filter-input' : 'code-filter-input-no-btn']"
|
|
7
7
|
size="small"
|
|
8
8
|
placeholder="输入关键字进行过滤"
|
|
9
9
|
clearable
|
|
10
10
|
v-model="filterText"
|
|
11
11
|
@input="filterTextChangeHandler"
|
|
12
|
-
></
|
|
13
|
-
<
|
|
14
|
-
>新增</
|
|
12
|
+
></TMagicInput>
|
|
13
|
+
<TMagicButton class="create-code-button" type="primary" size="small" @click="createCodeBlock" v-if="editable"
|
|
14
|
+
>新增</TMagicButton
|
|
15
15
|
>
|
|
16
16
|
</div>
|
|
17
17
|
</slot>
|
|
18
18
|
|
|
19
19
|
<!-- 代码块列表 -->
|
|
20
|
-
<
|
|
20
|
+
<TMagicTree
|
|
21
21
|
v-if="!isEmpty(state.codeList)"
|
|
22
22
|
ref="tree"
|
|
23
23
|
node-key="id"
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
<div class="code-name">{{ data.name }}({{ data.id }})</div>
|
|
34
34
|
<!-- 右侧工具栏 -->
|
|
35
35
|
<div class="right-tool">
|
|
36
|
-
<
|
|
36
|
+
<TMagicTooltip effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
|
|
37
37
|
<Icon :icon="editable ? Edit : View" class="edit-icon" @click.stop="editCode(`${data.id}`)"></Icon>
|
|
38
|
-
</
|
|
39
|
-
<
|
|
38
|
+
</TMagicTooltip>
|
|
39
|
+
<TMagicTooltip
|
|
40
40
|
effect="dark"
|
|
41
41
|
content="查看绑定关系"
|
|
42
42
|
placement="bottom"
|
|
43
43
|
v-if="state.bindComps[data.id] && state.bindComps[data.id].length > 0"
|
|
44
44
|
>
|
|
45
45
|
<Icon :icon="Link" class="edit-icon" @click.stop="toggleCombineRelation(data)"></Icon>
|
|
46
|
-
</
|
|
47
|
-
<
|
|
46
|
+
</TMagicTooltip>
|
|
47
|
+
<TMagicTooltip effect="dark" content="删除" placement="bottom" v-if="editable">
|
|
48
48
|
<Icon :icon="Close" class="edit-icon" @click.stop="deleteCode(`${data.id}`)"></Icon>
|
|
49
|
-
</
|
|
49
|
+
</TMagicTooltip>
|
|
50
50
|
<slot name="code-block-panel-tool" :id="data.id" :data="data.codeBlockContent"></slot>
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
@@ -62,27 +62,27 @@
|
|
|
62
62
|
></path>
|
|
63
63
|
</svg>
|
|
64
64
|
<!-- todo 功能暂时隐藏 -->
|
|
65
|
-
<!-- <
|
|
65
|
+
<!-- <TMagicButton
|
|
66
66
|
v-for="(comp, index) in state.bindComps[data.id]"
|
|
67
67
|
:key="index"
|
|
68
68
|
class="code-comp"
|
|
69
69
|
size="small"
|
|
70
70
|
:plain="true"
|
|
71
71
|
>{{ comp.name }}<Icon :icon="Close" class="comp-delete-icon" @click.stop="unbind(comp.id, data.id)"></Icon
|
|
72
|
-
></
|
|
73
|
-
<
|
|
72
|
+
></TMagicButton> -->
|
|
73
|
+
<TMagicButton
|
|
74
74
|
v-for="(comp, index) in state.bindComps[data.id]"
|
|
75
75
|
:key="index"
|
|
76
76
|
class="code-comp"
|
|
77
77
|
size="small"
|
|
78
78
|
:plain="true"
|
|
79
79
|
@click.stop="selectComp(comp.id)"
|
|
80
|
-
>{{ comp.name }}</
|
|
80
|
+
>{{ comp.name }}</TMagicButton
|
|
81
81
|
>
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
</template>
|
|
85
|
-
</
|
|
85
|
+
</TMagicTree>
|
|
86
86
|
|
|
87
87
|
<!-- 代码块编辑区 -->
|
|
88
88
|
<code-block-editor>
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
<script lang="ts" setup>
|
|
97
97
|
import { computed, inject, reactive, ref, watch } from 'vue';
|
|
98
98
|
import { Close, Edit, Link, View } from '@element-plus/icons-vue';
|
|
99
|
-
import { ElMessage } from 'element-plus';
|
|
100
99
|
import { forIn, isEmpty } from 'lodash-es';
|
|
101
100
|
|
|
101
|
+
import { TMagicButton, TMagicInput, tMagicMessage, TMagicTooltip, TMagicTree } from '@tmagic/design';
|
|
102
102
|
import { Id } from '@tmagic/schema';
|
|
103
103
|
import StageCore from '@tmagic/stage';
|
|
104
104
|
|
|
@@ -184,7 +184,7 @@ watch(
|
|
|
184
184
|
const createCodeBlock = async () => {
|
|
185
185
|
const { codeBlockService } = services || {};
|
|
186
186
|
if (!codeBlockService) {
|
|
187
|
-
|
|
187
|
+
tMagicMessage.error('新增代码块失败');
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
const codeConfig: CodeBlockContent = {
|
|
@@ -214,7 +214,7 @@ const deleteCode = (key: string) => {
|
|
|
214
214
|
if (typeof props.customError === 'function') {
|
|
215
215
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
216
216
|
} else {
|
|
217
|
-
|
|
217
|
+
tMagicMessage.error('代码块删除失败');
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
};
|
|
@@ -9,39 +9,39 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div class="m-editor-page-bar-title">
|
|
11
11
|
<slot name="page-bar-title" :page="item">
|
|
12
|
-
<
|
|
12
|
+
<TMagicTooltip effect="dark" placement="top-start" :content="item.name">
|
|
13
13
|
<span>{{ item.name || item.id }}</span>
|
|
14
|
-
</
|
|
14
|
+
</TMagicTooltip>
|
|
15
15
|
</slot>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
<
|
|
18
|
+
<TMagicPopover popper-class="page-bar-popover" placement="top" :width="160" trigger="hover">
|
|
19
19
|
<div>
|
|
20
20
|
<slot name="page-bar-popover" :page="item">
|
|
21
|
-
<
|
|
21
|
+
<ToolButton
|
|
22
22
|
:data="{
|
|
23
23
|
type: 'button',
|
|
24
24
|
text: '复制',
|
|
25
25
|
icon: DocumentCopy,
|
|
26
26
|
handler: () => copy(item),
|
|
27
27
|
}"
|
|
28
|
-
></
|
|
29
|
-
<
|
|
28
|
+
></ToolButton>
|
|
29
|
+
<ToolButton
|
|
30
30
|
:data="{
|
|
31
31
|
type: 'button',
|
|
32
32
|
text: '删除',
|
|
33
33
|
icon: Delete,
|
|
34
34
|
handler: () => remove(item),
|
|
35
35
|
}"
|
|
36
|
-
></
|
|
36
|
+
></ToolButton>
|
|
37
37
|
</slot>
|
|
38
38
|
</div>
|
|
39
39
|
<template #reference>
|
|
40
|
-
<
|
|
40
|
+
<TMagicIcon class="m-editor-page-bar-menu-icon">
|
|
41
41
|
<CaretBottom></CaretBottom>
|
|
42
|
-
</
|
|
42
|
+
</TMagicIcon>
|
|
43
43
|
</template>
|
|
44
|
-
</
|
|
44
|
+
</TMagicPopover>
|
|
45
45
|
</div>
|
|
46
46
|
</PageBarScrollContainer>
|
|
47
47
|
</template>
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
import { computed, inject } from 'vue';
|
|
51
51
|
import { CaretBottom, Delete, DocumentCopy } from '@element-plus/icons-vue';
|
|
52
52
|
|
|
53
|
+
import { TMagicIcon, TMagicPopover, TMagicTooltip } from '@tmagic/design';
|
|
53
54
|
import type { MApp, MPage } from '@tmagic/schema';
|
|
54
55
|
|
|
55
56
|
import ToolButton from '../../components/ToolButton.vue';
|
package/types/Editor.vue.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
97
97
|
updateDragEl: {
|
|
98
98
|
type: PropType<(el: HTMLDivElement, target: HTMLElement) => void>;
|
|
99
99
|
};
|
|
100
|
-
}, Services, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("props-panel-mounted"
|
|
100
|
+
}, Services, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "props-panel-mounted")[], "update:modelValue" | "props-panel-mounted", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
101
101
|
/** 页面初始值 */
|
|
102
102
|
modelValue: {
|
|
103
103
|
type: PropType<MApp>;
|
|
@@ -191,8 +191,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
191
191
|
type: PropType<(el: HTMLDivElement, target: HTMLElement) => void>;
|
|
192
192
|
};
|
|
193
193
|
}>> & {
|
|
194
|
-
"onProps-panel-mounted"?: ((...args: any[]) => any) | undefined;
|
|
195
194
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
195
|
+
"onProps-panel-mounted"?: ((...args: any[]) => any) | undefined;
|
|
196
196
|
}, {
|
|
197
197
|
menu: MenuBarData;
|
|
198
198
|
codeOptions: Record<string, any>;
|