@tmagic/editor 1.2.0-beta.15 → 1.2.0-beta.17
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.0-beta.
|
|
2
|
+
"version": "1.2.0-beta.17",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"dist/*",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/core": "^7.18.0",
|
|
47
47
|
"@element-plus/icons-vue": "^2.0.9",
|
|
48
|
-
"@tmagic/core": "1.2.0-beta.
|
|
49
|
-
"@tmagic/design": "1.2.0-beta.
|
|
50
|
-
"@tmagic/form": "1.2.0-beta.
|
|
51
|
-
"@tmagic/schema": "1.2.0-beta.
|
|
52
|
-
"@tmagic/stage": "1.2.0-beta.
|
|
53
|
-
"@tmagic/utils": "1.2.0-beta.
|
|
48
|
+
"@tmagic/core": "1.2.0-beta.17",
|
|
49
|
+
"@tmagic/design": "1.2.0-beta.17",
|
|
50
|
+
"@tmagic/form": "1.2.0-beta.17",
|
|
51
|
+
"@tmagic/schema": "1.2.0-beta.17",
|
|
52
|
+
"@tmagic/stage": "1.2.0-beta.17",
|
|
53
|
+
"@tmagic/utils": "1.2.0-beta.17",
|
|
54
54
|
"buffer": "^6.0.3",
|
|
55
55
|
"color": "^3.1.3",
|
|
56
56
|
"events": "^3.3.0",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"vue": "^3.2.37"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@tmagic/design": "1.2.0-beta.
|
|
66
|
-
"@tmagic/form": "1.2.0-beta.
|
|
65
|
+
"@tmagic/design": "1.2.0-beta.17",
|
|
66
|
+
"@tmagic/form": "1.2.0-beta.17",
|
|
67
67
|
"monaco-editor": "^0.34.0",
|
|
68
68
|
"vue": "^3.2.37"
|
|
69
69
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-editor-props-panel">
|
|
3
3
|
<slot name="props-panel-header"></slot>
|
|
4
|
-
<
|
|
4
|
+
<MForm
|
|
5
5
|
ref="configForm"
|
|
6
6
|
:class="`m-editor-props-panel ${propsPanelSize}`"
|
|
7
7
|
:popper-class="`m-editor-props-panel-popper ${propsPanelSize}`"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:init-values="values"
|
|
10
10
|
:config="curFormConfig"
|
|
11
11
|
@change="submit"
|
|
12
|
-
></
|
|
12
|
+
></MForm>
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
import { computed, getCurrentInstance, inject, onMounted, ref, watchEffect } from 'vue';
|
|
18
18
|
|
|
19
19
|
import { tMagicMessage } from '@tmagic/design';
|
|
20
|
-
import type { FormValue
|
|
20
|
+
import type { FormValue } from '@tmagic/form';
|
|
21
|
+
import { MForm } from '@tmagic/form';
|
|
21
22
|
import type { MNode } from '@tmagic/schema';
|
|
22
23
|
import type StageCore from '@tmagic/stage';
|
|
23
24
|
|
|
@@ -32,7 +33,9 @@ const configForm = ref<InstanceType<typeof MForm>>();
|
|
|
32
33
|
const curFormConfig = ref<any>([]);
|
|
33
34
|
const services = inject<Services>('services');
|
|
34
35
|
const node = computed(() => services?.editorService.get<MNode | null>('node'));
|
|
35
|
-
const propsPanelSize = computed(
|
|
36
|
+
const propsPanelSize = computed(
|
|
37
|
+
() => services?.uiService.get<'large' | 'default' | 'small'>('propsPanelSize') || 'small',
|
|
38
|
+
);
|
|
36
39
|
const stage = computed(() => services?.editorService.get<StageCore>('stage'));
|
|
37
40
|
|
|
38
41
|
const init = async () => {
|
|
@@ -1,67 +1,68 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
2
|
+
<TMagicScrollbar class="magic-editor-layer-panel">
|
|
3
|
+
<slot name="layer-panel-header"></slot>
|
|
4
|
+
|
|
5
|
+
<TMagicInput
|
|
6
|
+
v-model="filterText"
|
|
7
|
+
class="search-input"
|
|
8
|
+
size="small"
|
|
9
|
+
placeholder="输入关键字进行过滤"
|
|
10
|
+
clearable
|
|
11
|
+
:prefix-icon="Search"
|
|
12
|
+
@change="filterTextChangeHandler"
|
|
13
|
+
></TMagicInput>
|
|
14
|
+
|
|
15
|
+
<TMagicTree
|
|
16
|
+
v-if="values.length"
|
|
17
|
+
tabindex="-1"
|
|
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
|
+
:default-expand-all="true"
|
|
27
|
+
:expand-on-click-node="false"
|
|
28
|
+
:highlight-current="true"
|
|
29
|
+
:props="{
|
|
30
|
+
children: 'items',
|
|
31
|
+
}"
|
|
32
|
+
:filter-node-method="filterNode"
|
|
33
|
+
:allow-drop="allowDrop"
|
|
34
|
+
:show-checkbox="isMultiSelectStatus || selectedIds.length > 1"
|
|
35
|
+
@node-click="clickHandler"
|
|
36
|
+
@node-contextmenu="contextmenu"
|
|
37
|
+
@node-drag-end="handleDragEnd"
|
|
38
|
+
@node-collapse="handleCollapse"
|
|
39
|
+
@node-expand="handleExpand"
|
|
40
|
+
@check="multiClickHandler"
|
|
41
|
+
@mousedown="toggleClickFlag"
|
|
42
|
+
@mouseup="toggleClickFlag"
|
|
43
|
+
@mouseenter="mouseenterHandler"
|
|
44
|
+
@mouseleave="mouseleaveHandler"
|
|
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>
|
|
65
66
|
</template>
|
|
66
67
|
|
|
67
68
|
<script lang="ts" setup name="MEditorLayerPanel">
|
|
@@ -263,24 +264,19 @@ watch([selectedIds, tree], async () => {
|
|
|
263
264
|
setTreeKeyStatus();
|
|
264
265
|
});
|
|
265
266
|
|
|
266
|
-
const layerPanel = ref<HTMLDivElement>();
|
|
267
267
|
const mouseenterHandler = () => {
|
|
268
|
-
|
|
268
|
+
tree.value?.$el.focus();
|
|
269
269
|
};
|
|
270
270
|
|
|
271
271
|
const mouseleaveHandler = () => {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (selectedIds.value.length === 1) isMultiSelectStatus.value = false;
|
|
272
|
+
tree.value?.$el.blur();
|
|
273
|
+
isMultiSelectStatus.value = false;
|
|
275
274
|
};
|
|
276
275
|
|
|
277
276
|
let keycon: KeyController;
|
|
278
277
|
|
|
279
278
|
onMounted(() => {
|
|
280
|
-
|
|
281
|
-
layerPanel.value?.addEventListener('mouseleave', mouseleaveHandler);
|
|
282
|
-
|
|
283
|
-
keycon = new KeyController(layerPanel.value);
|
|
279
|
+
keycon = new KeyController(tree.value?.$el);
|
|
284
280
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
285
281
|
const ctrl = isMac ? 'meta' : 'ctrl';
|
|
286
282
|
|
|
@@ -289,9 +285,6 @@ onMounted(() => {
|
|
|
289
285
|
e.inputEvent.preventDefault();
|
|
290
286
|
isMultiSelectStatus.value = true;
|
|
291
287
|
})
|
|
292
|
-
.on('blur', () => {
|
|
293
|
-
isMultiSelectStatus.value = false;
|
|
294
|
-
})
|
|
295
288
|
.keyup(ctrl, (e) => {
|
|
296
289
|
e.inputEvent.preventDefault();
|
|
297
290
|
isMultiSelectStatus.value = false;
|
|
@@ -299,8 +292,6 @@ onMounted(() => {
|
|
|
299
292
|
});
|
|
300
293
|
|
|
301
294
|
onUnmounted(() => {
|
|
302
|
-
layerPanel.value?.removeEventListener('mouseenter', mouseenterHandler);
|
|
303
|
-
layerPanel.value?.removeEventListener('mouseleave', mouseleaveHandler);
|
|
304
295
|
keycon.destroy();
|
|
305
296
|
});
|
|
306
297
|
|