@tmagic/editor 1.2.14 → 1.2.15
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/style.css +141 -80
- package/dist/tmagic-editor.js +32 -43
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +30 -41
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +9 -9
- package/src/components/SearchInput.vue +6 -3
- package/src/icons/AppManageIcon.vue +1 -1
- package/src/icons/CodeIcon.vue +1 -10
- package/src/layouts/sidebar/Sidebar.vue +10 -9
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +4 -4
- package/src/services/props.ts +2 -15
- package/src/theme/code-block.scss +4 -66
- package/src/theme/dep-list.scss +59 -0
- package/src/theme/sidebar.scss +26 -6
- package/src/theme/theme.scss +1 -0
- package/types/services/props.d.ts +15 -9
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.
|
|
2
|
+
"version": "1.2.15",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/core": "^7.18.0",
|
|
48
48
|
"@element-plus/icons-vue": "^2.0.9",
|
|
49
|
-
"@tmagic/core": "1.2.
|
|
50
|
-
"@tmagic/design": "1.2.
|
|
51
|
-
"@tmagic/form": "1.2.
|
|
52
|
-
"@tmagic/schema": "1.2.
|
|
53
|
-
"@tmagic/stage": "1.2.
|
|
54
|
-
"@tmagic/utils": "1.2.
|
|
49
|
+
"@tmagic/core": "1.2.15",
|
|
50
|
+
"@tmagic/design": "1.2.15",
|
|
51
|
+
"@tmagic/form": "1.2.15",
|
|
52
|
+
"@tmagic/schema": "1.2.15",
|
|
53
|
+
"@tmagic/stage": "1.2.15",
|
|
54
|
+
"@tmagic/utils": "1.2.15",
|
|
55
55
|
"buffer": "^6.0.3",
|
|
56
56
|
"color": "^3.1.3",
|
|
57
57
|
"events": "^3.3.0",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"vue": "^3.2.37"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@tmagic/design": "1.2.
|
|
67
|
-
"@tmagic/form": "1.2.
|
|
66
|
+
"@tmagic/design": "1.2.15",
|
|
67
|
+
"@tmagic/form": "1.2.15",
|
|
68
68
|
"monaco-editor": "^0.34.0",
|
|
69
69
|
"vue": "^3.2.37"
|
|
70
70
|
},
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
size="small"
|
|
6
6
|
placeholder="输入关键字进行过滤"
|
|
7
7
|
clearable
|
|
8
|
-
:prefix-icon="Search"
|
|
9
8
|
@input="filterTextChangeHandler"
|
|
10
|
-
|
|
9
|
+
>
|
|
10
|
+
<template #prefix>
|
|
11
|
+
<TMagicIcon><Search /></TMagicIcon>
|
|
12
|
+
</template>
|
|
13
|
+
</TMagicInput>
|
|
11
14
|
</template>
|
|
12
15
|
|
|
13
16
|
<script setup lang="ts">
|
|
14
17
|
import { ref } from 'vue';
|
|
15
18
|
import { Search } from '@element-plus/icons-vue';
|
|
16
19
|
|
|
17
|
-
import { TMagicInput } from '@tmagic/design';
|
|
20
|
+
import { TMagicIcon, TMagicInput } from '@tmagic/design';
|
|
18
21
|
|
|
19
22
|
const emit = defineEmits(['search']);
|
|
20
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- app-manage cdn链接:https://cloudcache.tencent-cloud.com/qcloud/ui/static/console_aside_v4/6638c8a5-2e7f-477a-83b1-a413a0e4ba39.svg -->
|
|
3
|
-
<svg
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
4
4
|
<g fill="#7C878E" fill-rule="evenodd">
|
|
5
5
|
<path d="M15.3,5.5 L8,0 L0.7,5.5 L8,11 L15.3,5.5 Z M8,2.5 L12,5.5 L8,8.5 L4,5.5 L8,2.5 Z" fill-rule="nonzero" />
|
|
6
6
|
<path d="M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" />
|
package/src/icons/CodeIcon.vue
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 代码icon,cdn链接:https://cloudcache.tencent-cloud.com/qcloud/ui/static/government/0d463ed5-6407-4498-8865-3d05b5e70115.svg -->
|
|
3
|
-
<svg
|
|
4
|
-
width="32px"
|
|
5
|
-
height="32px"
|
|
6
|
-
viewBox="0 0 32 32"
|
|
7
|
-
version="1.1"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
10
|
-
>
|
|
3
|
+
<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
11
4
|
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
|
|
12
|
-
<title>gsd-icon-line-Universal-code</title>
|
|
13
|
-
<desc>Created with Sketch.</desc>
|
|
14
5
|
<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs>
|
|
15
6
|
<g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
16
7
|
<g id="03图标" transform="translate(-561.000000, -2356.000000)">
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
3
|
v-if="data.type === 'tabs' && data.items.length"
|
|
4
|
-
class="m-editor-sidebar"
|
|
5
4
|
v-model="activeTabName"
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
class="m-editor-sidebar tmagic-design-tabs"
|
|
6
|
+
v-bind="tabsComponent.props({ type: 'card', tabPosition: 'left' })"
|
|
7
|
+
:is="tabsComponent.component"
|
|
8
8
|
>
|
|
9
9
|
<component
|
|
10
|
-
:is="uiComponent.component"
|
|
11
10
|
v-for="(config, index) in sideBarItems"
|
|
11
|
+
v-bind="tabPaneComponent.props({ name: config.text })"
|
|
12
|
+
:is="tabPaneComponent.component"
|
|
12
13
|
:key="config.$key || index"
|
|
13
|
-
:name="config.text"
|
|
14
14
|
>
|
|
15
15
|
<template #label>
|
|
16
16
|
<div :key="config.text">
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
</template>
|
|
81
81
|
</component>
|
|
82
82
|
</component>
|
|
83
|
-
</
|
|
83
|
+
</component>
|
|
84
84
|
</template>
|
|
85
85
|
|
|
86
86
|
<script lang="ts" setup name="MEditorSidebar">
|
|
87
87
|
import { computed, ref, watch } from 'vue';
|
|
88
88
|
import { Coin, EditPen, Files } from '@element-plus/icons-vue';
|
|
89
89
|
|
|
90
|
-
import { getConfig
|
|
90
|
+
import { getConfig } from '@tmagic/design';
|
|
91
91
|
|
|
92
92
|
import MIcon from '@editor/components/Icon.vue';
|
|
93
93
|
import type { MenuButton, MenuComponent, SideComponent, SideItem } from '@editor/type';
|
|
@@ -107,7 +107,8 @@ const props = withDefaults(
|
|
|
107
107
|
},
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const tabPaneComponent = getConfig('components').tabPane;
|
|
111
|
+
const tabsComponent = getConfig('components').tabs;
|
|
111
112
|
|
|
112
113
|
const activeTabName = ref(props.data?.status);
|
|
113
114
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<TMagicScrollbar class="m-editor-code-block-list">
|
|
2
|
+
<TMagicScrollbar class="m-editor-code-block-list m-editor-dep-list-panel">
|
|
3
3
|
<slot name="code-block-panel-header">
|
|
4
|
-
<div class="
|
|
4
|
+
<div class="search-wrapper">
|
|
5
5
|
<SearchInput @search="filterTextChangeHandler"></SearchInput>
|
|
6
6
|
<TMagicButton class="create-code-button" type="primary" size="small" @click="createCodeBlock" v-if="editable"
|
|
7
7
|
>新增</TMagicButton
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
<div class="list-item">
|
|
28
28
|
<CodeIcon v-if="data.type === 'code'" class="codeIcon"></CodeIcon>
|
|
29
29
|
<AppManageIcon v-if="data.type === 'node'" class="compIcon"></AppManageIcon>
|
|
30
|
-
<span class="
|
|
31
|
-
>{{ data.name }}
|
|
30
|
+
<span class="name" :class="{ code: data.type === 'code', hook: data.type === 'key' }"
|
|
31
|
+
>{{ data.name }} ({{ data.id }})</span
|
|
32
32
|
>
|
|
33
33
|
<!-- 右侧工具栏 -->
|
|
34
34
|
<div class="right-tool" v-if="data.type === 'code'">
|
package/src/services/props.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { cloneDeep, mergeWith } from 'lodash-es';
|
|
|
21
21
|
|
|
22
22
|
import type { FormConfig } from '@tmagic/form';
|
|
23
23
|
import type { MComponent, MNode } from '@tmagic/schema';
|
|
24
|
-
import { toLine } from '@tmagic/utils';
|
|
24
|
+
import { guid, toLine } from '@tmagic/utils';
|
|
25
25
|
|
|
26
26
|
import type { PropsState } from '@editor/type';
|
|
27
27
|
import { fillConfig } from '@editor/utils/props';
|
|
@@ -130,7 +130,7 @@ class Props extends BaseService {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
public async createId(type: string | number): Promise<string> {
|
|
133
|
-
return `${type}_${
|
|
133
|
+
return `${type}_${guid()}`;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
@@ -181,19 +181,6 @@ class Props extends BaseService {
|
|
|
181
181
|
this.removeAllListeners();
|
|
182
182
|
this.removeAllPlugins();
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* 生成指定位数的GUID,无【-】格式
|
|
187
|
-
* @param digit 位数,默认值8
|
|
188
|
-
* @returns
|
|
189
|
-
*/
|
|
190
|
-
private guid(digit = 8): string {
|
|
191
|
-
return 'x'.repeat(digit).replace(/[xy]/g, (c) => {
|
|
192
|
-
const r = (Math.random() * 16) | 0;
|
|
193
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
194
|
-
return v.toString(16);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
184
|
}
|
|
198
185
|
|
|
199
186
|
export type PropsService = Props;
|
|
@@ -1,81 +1,19 @@
|
|
|
1
1
|
.m-editor-code-block-list {
|
|
2
2
|
height: 100%;
|
|
3
3
|
|
|
4
|
-
.magic-editor-layer-tree {
|
|
5
|
-
padding-top: 48px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.code-header-wrapper {
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 0;
|
|
14
|
-
width: 100%;
|
|
15
|
-
z-index: 1;
|
|
16
|
-
|
|
17
|
-
.search-input {
|
|
18
|
-
flex: 1;
|
|
19
|
-
position: relative;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.create-code-button {
|
|
23
|
-
margin-left: 2px;
|
|
24
|
-
margin-right: 10px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.divider {
|
|
29
|
-
margin: 10px 0 0 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
4
|
.list-container {
|
|
33
|
-
width: 100%;
|
|
34
|
-
overflow: hidden;
|
|
35
5
|
.list-item {
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
width: 100%;
|
|
39
|
-
align-items: center;
|
|
40
|
-
|
|
41
|
-
.right-tool {
|
|
42
|
-
display: flex;
|
|
43
|
-
width: fit-content !important;
|
|
44
|
-
align-items: center;
|
|
45
|
-
margin-right: 10px;
|
|
46
|
-
.edit-icon {
|
|
47
|
-
margin: 0 5px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
6
|
.codeIcon {
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
7
|
+
width: 22px;
|
|
8
|
+
height: 22px;
|
|
54
9
|
margin-right: 5px;
|
|
55
10
|
}
|
|
56
11
|
|
|
57
12
|
.compIcon {
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
13
|
+
width: 22px;
|
|
14
|
+
height: 22px;
|
|
60
15
|
margin-right: 5px;
|
|
61
16
|
}
|
|
62
|
-
|
|
63
|
-
.code-name {
|
|
64
|
-
white-space: nowrap;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
text-overflow: ellipsis;
|
|
67
|
-
width: 0 !important;
|
|
68
|
-
flex: 1;
|
|
69
|
-
line-height: 22px;
|
|
70
|
-
|
|
71
|
-
&.code {
|
|
72
|
-
color: #000;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.hook {
|
|
76
|
-
color: #909399;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
17
|
}
|
|
80
18
|
}
|
|
81
19
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.m-editor-dep-list-panel {
|
|
2
|
+
.magic-editor-layer-tree {
|
|
3
|
+
padding-top: 48px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.search-wrapper {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
|
|
15
|
+
.search-input {
|
|
16
|
+
flex: 1;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tmagic-design-button {
|
|
21
|
+
margin-right: 10px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.list-container {
|
|
26
|
+
width: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
.list-item {
|
|
29
|
+
display: flex;
|
|
30
|
+
width: 100%;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
.right-tool {
|
|
34
|
+
display: flex;
|
|
35
|
+
width: fit-content !important;
|
|
36
|
+
align-items: center;
|
|
37
|
+
.edit-icon {
|
|
38
|
+
margin: 0 5px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.name {
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
width: 0 !important;
|
|
46
|
+
flex: 1;
|
|
47
|
+
line-height: 22px;
|
|
48
|
+
|
|
49
|
+
&.code {
|
|
50
|
+
color: #000;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.hook {
|
|
54
|
+
color: #909399;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/theme/sidebar.scss
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
.m-editor-sidebar {
|
|
1
|
+
.m-editor-sidebar.tmagic-design-tabs {
|
|
2
2
|
height: 100%;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
.el-tabs__header,
|
|
5
|
+
.t-tabs__header {
|
|
5
6
|
background: $--sidebar-heder-background-color;
|
|
6
7
|
border: 0;
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
10
|
+
.t-tabs__nav--card {
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
}
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
.t-tabs__nav--card.t-tabs__nav-item:not(.t-is-disabled):not(
|
|
15
|
+
.t-is-active
|
|
16
|
+
):hover {
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.is-left,
|
|
21
|
+
&.t-is-left {
|
|
9
22
|
width: 40px;
|
|
10
23
|
margin-right: 0;
|
|
11
24
|
}
|
|
@@ -23,7 +36,8 @@
|
|
|
23
36
|
margin-left: 2px;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
.el-tabs__item.is-left
|
|
39
|
+
.el-tabs__item.is-left,
|
|
40
|
+
.t-tabs__nav-item {
|
|
27
41
|
line-height: 15px;
|
|
28
42
|
border: 0;
|
|
29
43
|
height: auto;
|
|
@@ -31,8 +45,10 @@
|
|
|
31
45
|
color: rgb(255, 255, 255);
|
|
32
46
|
box-sizing: border-box;
|
|
33
47
|
|
|
34
|
-
&.is-left
|
|
35
|
-
|
|
48
|
+
&.is-left,
|
|
49
|
+
&.t-is-left {
|
|
50
|
+
&.is-active,
|
|
51
|
+
&.t-is-active {
|
|
36
52
|
background: $--sidebar-content-background-color;
|
|
37
53
|
border: 0;
|
|
38
54
|
|
|
@@ -51,6 +67,10 @@
|
|
|
51
67
|
}
|
|
52
68
|
}
|
|
53
69
|
|
|
70
|
+
.t-tabs__nav-item {
|
|
71
|
+
padding: 7px;
|
|
72
|
+
}
|
|
73
|
+
|
|
54
74
|
i {
|
|
55
75
|
font-size: 25px;
|
|
56
76
|
color: rgba(255, 255, 255, 0.6);
|
package/src/theme/theme.scss
CHANGED
|
@@ -25,7 +25,11 @@ declare class Props extends BaseService {
|
|
|
25
25
|
items: ({
|
|
26
26
|
name: string;
|
|
27
27
|
type: string;
|
|
28
|
-
activeValue: string;
|
|
28
|
+
activeValue: string; /**
|
|
29
|
+
* 为指定类型组件设置组件属性表单配置
|
|
30
|
+
* @param type 组件类型
|
|
31
|
+
* @param config 组件属性表单配置
|
|
32
|
+
*/
|
|
29
33
|
inactiveValue: string;
|
|
30
34
|
defaultValue: string;
|
|
31
35
|
text: string;
|
|
@@ -34,7 +38,11 @@ declare class Props extends BaseService {
|
|
|
34
38
|
name: string;
|
|
35
39
|
text: string;
|
|
36
40
|
type?: undefined;
|
|
37
|
-
activeValue?: undefined;
|
|
41
|
+
activeValue?: undefined; /**
|
|
42
|
+
* 为指定类型组件设置组件属性表单配置
|
|
43
|
+
* @param type 组件类型
|
|
44
|
+
* @param config 组件属性表单配置
|
|
45
|
+
*/
|
|
38
46
|
inactiveValue?: undefined;
|
|
39
47
|
defaultValue?: undefined;
|
|
40
48
|
disabled?: undefined;
|
|
@@ -43,7 +51,11 @@ declare class Props extends BaseService {
|
|
|
43
51
|
text: string;
|
|
44
52
|
disabled: (vm: import("@tmagic/form").FormState, { model }: any) => boolean;
|
|
45
53
|
type?: undefined;
|
|
46
|
-
activeValue?: undefined;
|
|
54
|
+
activeValue?: undefined; /**
|
|
55
|
+
* 为指定类型组件设置组件属性表单配置
|
|
56
|
+
* @param type 组件类型
|
|
57
|
+
* @param config 组件属性表单配置
|
|
58
|
+
*/
|
|
47
59
|
inactiveValue?: undefined;
|
|
48
60
|
defaultValue?: undefined;
|
|
49
61
|
})[];
|
|
@@ -162,12 +174,6 @@ declare class Props extends BaseService {
|
|
|
162
174
|
}>;
|
|
163
175
|
resetState(): void;
|
|
164
176
|
destroy(): void;
|
|
165
|
-
/**
|
|
166
|
-
* 生成指定位数的GUID,无【-】格式
|
|
167
|
-
* @param digit 位数,默认值8
|
|
168
|
-
* @returns
|
|
169
|
-
*/
|
|
170
|
-
private guid;
|
|
171
177
|
}
|
|
172
178
|
export type PropsService = Props;
|
|
173
179
|
declare const _default: Props;
|