@tmagic/editor 1.2.0-beta.9 → 1.2.1
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 +62 -34
- package/dist/{tmagic-editor.mjs → tmagic-editor.js} +1641 -1266
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +1649 -1270
- package/dist/tmagic-editor.umd.cjs.map +1 -0
- package/package.json +16 -14
- package/src/Editor.vue +66 -40
- package/src/components/CodeDraftEditor.vue +137 -0
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +190 -0
- package/src/components/Icon.vue +1 -1
- package/src/{layouts → components}/Layout.vue +54 -15
- package/src/components/ScrollBar.vue +1 -1
- package/src/components/ScrollViewer.vue +10 -1
- package/src/components/ToolButton.vue +1 -1
- package/src/fields/Code.vue +1 -1
- package/src/fields/CodeLink.vue +1 -1
- package/src/fields/CodeSelect.vue +102 -99
- package/src/fields/UISelect.vue +3 -3
- package/src/index.ts +2 -1
- package/src/layouts/AddPageBox.vue +5 -2
- package/src/layouts/CodeEditor.vue +2 -3
- package/src/layouts/Framework.vue +12 -10
- package/src/layouts/NavMenu.vue +11 -8
- package/src/layouts/PropsPanel.vue +12 -9
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +2 -3
- package/src/layouts/sidebar/LayerMenu.vue +9 -7
- package/src/layouts/sidebar/LayerPanel.vue +130 -178
- package/src/layouts/sidebar/Sidebar.vue +110 -26
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +33 -118
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +93 -126
- package/src/layouts/workspace/Breadcrumb.vue +6 -7
- package/src/layouts/workspace/PageBar.vue +3 -3
- package/src/layouts/workspace/PageBarScrollContainer.vue +5 -3
- package/src/layouts/workspace/Stage.vue +36 -18
- package/src/layouts/workspace/ViewerMenu.vue +16 -15
- package/src/layouts/workspace/Workspace.vue +9 -6
- package/src/services/BaseService.ts +11 -2
- package/src/services/codeBlock.ts +136 -146
- package/src/services/componentList.ts +7 -2
- package/src/services/editor.ts +161 -85
- package/src/services/events.ts +7 -2
- package/src/services/history.ts +8 -17
- package/src/services/props.ts +8 -3
- package/src/services/storage.ts +1 -0
- package/src/services/ui.ts +20 -10
- package/src/theme/code-block.scss +46 -23
- package/src/theme/component-list-panel.scss +8 -5
- package/src/type.ts +84 -63
- package/src/utils/config.ts +1 -1
- package/src/utils/editor.ts +17 -3
- package/src/utils/index.ts +2 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/operator.ts +12 -12
- package/src/utils/props.ts +3 -3
- package/src/utils/scroll-viewer.ts +18 -2
- package/src/utils/stage.ts +10 -9
- package/src/utils/undo-redo.ts +1 -1
- package/types/Editor.vue.d.ts +48 -28
- package/types/components/CodeDraftEditor.vue.d.ts +55 -0
- package/types/components/ContentMenu.vue.d.ts +11 -87
- package/types/components/FunctionEditor.vue.d.ts +60 -0
- package/types/components/Icon.vue.d.ts +4 -50
- package/types/{layouts → components}/Layout.vue.d.ts +12 -1
- package/types/components/ScrollBar.vue.d.ts +7 -65
- package/types/components/ScrollViewer.vue.d.ts +45 -1
- package/types/components/ToolButton.vue.d.ts +12 -78
- package/types/fields/Code.vue.d.ts +11 -77
- package/types/fields/CodeLink.vue.d.ts +12 -82
- package/types/fields/CodeSelect.vue.d.ts +13 -77
- package/types/fields/UISelect.vue.d.ts +7 -65
- package/types/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +1 -43
- package/types/layouts/CodeEditor.vue.d.ts +22 -130
- package/types/layouts/NavMenu.vue.d.ts +9 -69
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +16 -48
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +24 -7
- package/types/layouts/sidebar/Sidebar.vue.d.ts +10 -5
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +24 -6
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +11 -5
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -43
- package/types/layouts/workspace/Stage.vue.d.ts +15 -43
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +11 -66
- package/types/layouts/workspace/Workspace.vue.d.ts +25 -8
- package/types/services/BaseService.d.ts +2 -1
- package/types/services/codeBlock.d.ts +56 -47
- package/types/services/componentList.d.ts +1 -0
- package/types/services/editor.d.ts +10 -11
- package/types/services/events.d.ts +1 -0
- package/types/services/history.d.ts +5 -15
- package/types/services/props.d.ts +3 -2
- package/types/services/ui.d.ts +24 -24
- package/types/type.d.ts +70 -59
- package/types/utils/editor.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +1 -1
- package/types/utils/scroll-viewer.d.ts +5 -0
- package/dist/tmagic-editor.mjs.map +0 -1
- package/dist/tmagic-editor.umd.js.map +0 -1
- package/src/layouts/sidebar/TabPane.vue +0 -118
- package/types/layouts/sidebar/TabPane.vue.d.ts +0 -82
package/src/utils/operator.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { toRaw } from 'vue';
|
|
2
2
|
import { isEmpty } from 'lodash-es';
|
|
3
3
|
|
|
4
|
-
import { Id,
|
|
5
|
-
import StageCore from '@tmagic/stage';
|
|
4
|
+
import { Id, MContainer, MNode } from '@tmagic/schema';
|
|
6
5
|
import { isPage } from '@tmagic/utils';
|
|
7
6
|
|
|
8
7
|
import editorService from '../services/editor';
|
|
@@ -18,7 +17,7 @@ import { generatePageNameByApp, getInitPositionStyle } from '../utils/editor';
|
|
|
18
17
|
*/
|
|
19
18
|
export const beforePaste = async (position: PastePosition, config: MNode[]): Promise<MNode[]> => {
|
|
20
19
|
if (!config[0]?.style) return config;
|
|
21
|
-
const curNode = editorService.get
|
|
20
|
+
const curNode = editorService.get('node');
|
|
22
21
|
// 将数组中第一个元素的坐标作为参照点
|
|
23
22
|
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
24
23
|
// 坐标校准后的粘贴数据
|
|
@@ -28,7 +27,7 @@ export const beforePaste = async (position: PastePosition, config: MNode[]): Pro
|
|
|
28
27
|
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
29
28
|
let pastePosition = positionClone;
|
|
30
29
|
|
|
31
|
-
if (!isEmpty(pastePosition) && curNode
|
|
30
|
+
if (!isEmpty(pastePosition) && curNode?.items) {
|
|
32
31
|
// 如果没有传入粘贴坐标则可能为键盘操作,不再转换
|
|
33
32
|
// 如果粘贴时选中了容器,则将元素粘贴到容器内,坐标需要转换为相对于容器的坐标
|
|
34
33
|
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
@@ -59,8 +58,9 @@ export const beforePaste = async (position: PastePosition, config: MNode[]): Pro
|
|
|
59
58
|
...pastePosition,
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const root = editorService.get('root');
|
|
62
|
+
if (isPage(pasteConfig) && root) {
|
|
63
|
+
pasteConfig.name = generatePageNameByApp(root);
|
|
64
64
|
}
|
|
65
65
|
return pasteConfig as MNode;
|
|
66
66
|
}),
|
|
@@ -76,7 +76,7 @@ export const beforePaste = async (position: PastePosition, config: MNode[]): Pro
|
|
|
76
76
|
*/
|
|
77
77
|
export const getPositionInContainer = (position: PastePosition = {}, id: Id) => {
|
|
78
78
|
let { left = 0, top = 0 } = position;
|
|
79
|
-
const parentEl = editorService.get
|
|
79
|
+
const parentEl = editorService.get('stage')?.renderer?.contentWindow?.document.getElementById(`${id}`);
|
|
80
80
|
const parentElRect = parentEl?.getBoundingClientRect();
|
|
81
81
|
left = left - (parentElRect?.left || 0);
|
|
82
82
|
top = top - (parentElRect?.top || 0);
|
|
@@ -87,14 +87,14 @@ export const getPositionInContainer = (position: PastePosition = {}, id: Id) =>
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
export const getAddParent = (node: MNode) => {
|
|
90
|
-
const curNode = editorService.get
|
|
90
|
+
const curNode = editorService.get('node');
|
|
91
91
|
|
|
92
92
|
let parentNode;
|
|
93
93
|
if (isPage(node)) {
|
|
94
|
-
parentNode = editorService.get
|
|
95
|
-
} else if (curNode
|
|
96
|
-
parentNode = curNode;
|
|
97
|
-
} else {
|
|
94
|
+
parentNode = editorService.get('root');
|
|
95
|
+
} else if (curNode?.items) {
|
|
96
|
+
parentNode = curNode as MContainer;
|
|
97
|
+
} else if (curNode?.id) {
|
|
98
98
|
parentNode = editorService.getParentById(curNode.id, false);
|
|
99
99
|
}
|
|
100
100
|
return parentNode;
|
package/src/utils/props.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -226,14 +226,14 @@ export const fillConfig = (config: FormConfig = []) => [
|
|
|
226
226
|
{
|
|
227
227
|
name: 'created',
|
|
228
228
|
text: 'created',
|
|
229
|
-
type: 'code-select',
|
|
230
229
|
labelWidth: '100px',
|
|
230
|
+
type: 'code-select',
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
name: 'mounted',
|
|
234
234
|
text: 'mounted',
|
|
235
|
-
type: 'code-select',
|
|
236
235
|
labelWidth: '100px',
|
|
236
|
+
type: 'code-select',
|
|
237
237
|
},
|
|
238
238
|
],
|
|
239
239
|
},
|
|
@@ -4,6 +4,10 @@ interface ScrollViewerOptions {
|
|
|
4
4
|
container: HTMLDivElement;
|
|
5
5
|
target: HTMLDivElement;
|
|
6
6
|
zoom: number;
|
|
7
|
+
correctionScrollSize?: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
export class ScrollViewer extends EventEmitter {
|
|
@@ -23,6 +27,11 @@ export class ScrollViewer extends EventEmitter {
|
|
|
23
27
|
private translateXCorrectionValue = 0;
|
|
24
28
|
private translateYCorrectionValue = 0;
|
|
25
29
|
|
|
30
|
+
private correctionScrollSize = {
|
|
31
|
+
width: 0,
|
|
32
|
+
height: 0,
|
|
33
|
+
};
|
|
34
|
+
|
|
26
35
|
private resizeObserver = new ResizeObserver(() => {
|
|
27
36
|
this.setSize();
|
|
28
37
|
this.setScrollSize();
|
|
@@ -35,6 +44,13 @@ export class ScrollViewer extends EventEmitter {
|
|
|
35
44
|
this.target = options.target;
|
|
36
45
|
this.zoom = options.zoom;
|
|
37
46
|
|
|
47
|
+
if (this.correctionScrollSize) {
|
|
48
|
+
this.correctionScrollSize = {
|
|
49
|
+
...this.correctionScrollSize,
|
|
50
|
+
...options.correctionScrollSize,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
38
54
|
this.container.addEventListener('wheel', this.wheelHandler, false);
|
|
39
55
|
|
|
40
56
|
this.setSize();
|
|
@@ -109,9 +125,9 @@ export class ScrollViewer extends EventEmitter {
|
|
|
109
125
|
|
|
110
126
|
private setScrollSize = () => {
|
|
111
127
|
const targetRect = this.target.getBoundingClientRect();
|
|
112
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
128
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
113
129
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
114
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
130
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
115
131
|
|
|
116
132
|
let left: number | undefined;
|
|
117
133
|
let top: number | undefined;
|
package/src/utils/stage.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
2
|
|
|
3
|
-
import { MApp, MPage } from '@tmagic/schema';
|
|
4
3
|
import StageCore, { GuidesType, SortEventData, UpdateEventData } from '@tmagic/stage';
|
|
5
4
|
|
|
6
5
|
import editorService from '../services/editor';
|
|
@@ -9,10 +8,10 @@ import { H_GUIDE_LINE_STORAGE_KEY, StageOptions, V_GUIDE_LINE_STORAGE_KEY } from
|
|
|
9
8
|
|
|
10
9
|
import { getGuideLineFromCache } from './editor';
|
|
11
10
|
|
|
12
|
-
const root = computed(() => editorService.get
|
|
13
|
-
const page = computed(() => editorService.get
|
|
14
|
-
const zoom = computed(() => uiService.get
|
|
15
|
-
const uiSelectMode = computed(() => uiService.get
|
|
11
|
+
const root = computed(() => editorService.get('root'));
|
|
12
|
+
const page = computed(() => editorService.get('page'));
|
|
13
|
+
const zoom = computed(() => uiService.get('zoom') || 1);
|
|
14
|
+
const uiSelectMode = computed(() => uiService.get('uiSelectMode'));
|
|
16
15
|
|
|
17
16
|
const getGuideLineKey = (key: string) => `${key}_${root.value?.id}_${page.value?.id}`;
|
|
18
17
|
|
|
@@ -26,6 +25,7 @@ export const useStage = (stageOptions: StageOptions) => {
|
|
|
26
25
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
|
27
26
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
28
27
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
28
|
+
disabledDragStart: stageOptions.disabledDragStart,
|
|
29
29
|
canSelect: (el, event, stop) => {
|
|
30
30
|
const elCanSelect = stageOptions.canSelect(el);
|
|
31
31
|
// 在组件联动过程中不能再往下选择,返回并触发 ui-select
|
|
@@ -46,7 +46,7 @@ export const useStage = (stageOptions: StageOptions) => {
|
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
48
|
stage.on('select', (el: HTMLElement) => {
|
|
49
|
-
if (`${editorService.get('node')?.id}` === el.id) return;
|
|
49
|
+
if (`${editorService.get('node')?.id}` === el.id && editorService.get('nodes').length === 1) return;
|
|
50
50
|
editorService.select(el.id);
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ export const useStage = (stageOptions: StageOptions) => {
|
|
|
54
54
|
editorService.highlight(el.id);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
stage.on('
|
|
57
|
+
stage.on('multi-select', (els: HTMLElement[]) => {
|
|
58
58
|
editorService.multiSelect(els.map((el) => el.id));
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -75,11 +75,12 @@ export const useStage = (stageOptions: StageOptions) => {
|
|
|
75
75
|
|
|
76
76
|
stage.on('select-parent', () => {
|
|
77
77
|
const parent = editorService.get('parent');
|
|
78
|
+
if (!parent) throw new Error('父节点为空');
|
|
78
79
|
editorService.select(parent);
|
|
79
|
-
editorService.get
|
|
80
|
+
editorService.get('stage')?.select(parent.id);
|
|
80
81
|
});
|
|
81
82
|
|
|
82
|
-
stage.on('
|
|
83
|
+
stage.on('change-guides', (e) => {
|
|
83
84
|
uiService.set('showGuides', true);
|
|
84
85
|
|
|
85
86
|
if (!root.value || !page.value) return;
|
package/src/utils/undo-redo.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
3
|
*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
package/types/Editor.vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
import { EventOption } from '@tmagic/core';
|
|
2
3
|
import type { FormConfig } from '@tmagic/form';
|
|
3
4
|
import type { MApp, MNode } from '@tmagic/schema';
|
|
4
|
-
import
|
|
5
|
-
import { ContainerHighlightType, MoveableOptions } from '@tmagic/stage';
|
|
5
|
+
import StageCore, { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
|
|
6
6
|
import type { ComponentGroup, MenuBarData, MenuButton, MenuComponent, Services, SideBarData, StageRect } from './type';
|
|
7
7
|
declare const _default: import("vue").DefineComponent<{
|
|
8
8
|
/** 页面初始值 */
|
|
@@ -20,14 +20,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
20
20
|
sidebar: {
|
|
21
21
|
type: PropType<SideBarData>;
|
|
22
22
|
};
|
|
23
|
-
layerContentMenu: {
|
|
24
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
25
|
-
default: () => never[];
|
|
26
|
-
};
|
|
27
|
-
stageContentMenu: {
|
|
28
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
29
|
-
default: () => never[];
|
|
30
|
-
};
|
|
31
23
|
/** 顶部工具栏配置 */
|
|
32
24
|
menu: {
|
|
33
25
|
type: PropType<MenuBarData>;
|
|
@@ -36,9 +28,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
28
|
right: never[];
|
|
37
29
|
};
|
|
38
30
|
};
|
|
31
|
+
/** 组件树右键菜单 */
|
|
32
|
+
layerContentMenu: {
|
|
33
|
+
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
34
|
+
default: () => never[];
|
|
35
|
+
};
|
|
36
|
+
/** 画布右键菜单 */
|
|
37
|
+
stageContentMenu: {
|
|
38
|
+
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
39
|
+
default: () => never[];
|
|
40
|
+
};
|
|
39
41
|
/** 中间工作区域中画布渲染的内容 */
|
|
40
42
|
render: {
|
|
41
|
-
type: PropType<() => HTMLDivElement
|
|
43
|
+
type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
|
|
42
44
|
};
|
|
43
45
|
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
44
46
|
runtimeUrl: StringConstructor;
|
|
@@ -56,12 +58,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
58
|
};
|
|
57
59
|
/** 组件联动事件选项列表 */
|
|
58
60
|
eventMethodList: {
|
|
59
|
-
type:
|
|
61
|
+
type: PropType<Record<string, {
|
|
62
|
+
events: EventOption[];
|
|
63
|
+
methods: EventOption[];
|
|
64
|
+
}>>;
|
|
60
65
|
default: () => {};
|
|
61
66
|
};
|
|
62
67
|
/** 画布中组件选中框的移动范围 */
|
|
63
68
|
moveableOptions: {
|
|
64
|
-
type: PropType<MoveableOptions | ((
|
|
69
|
+
type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
|
|
65
70
|
};
|
|
66
71
|
/** 编辑器初始化时默认选中的组件ID */
|
|
67
72
|
defaultSelected: {
|
|
@@ -95,7 +100,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
95
100
|
default: () => {};
|
|
96
101
|
};
|
|
97
102
|
updateDragEl: {
|
|
98
|
-
type: PropType<
|
|
103
|
+
type: PropType<UpdateDragEl>;
|
|
104
|
+
};
|
|
105
|
+
disabledDragStart: {
|
|
106
|
+
type: BooleanConstructor;
|
|
99
107
|
};
|
|
100
108
|
}, 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
109
|
/** 页面初始值 */
|
|
@@ -113,14 +121,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
113
121
|
sidebar: {
|
|
114
122
|
type: PropType<SideBarData>;
|
|
115
123
|
};
|
|
116
|
-
layerContentMenu: {
|
|
117
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
118
|
-
default: () => never[];
|
|
119
|
-
};
|
|
120
|
-
stageContentMenu: {
|
|
121
|
-
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
122
|
-
default: () => never[];
|
|
123
|
-
};
|
|
124
124
|
/** 顶部工具栏配置 */
|
|
125
125
|
menu: {
|
|
126
126
|
type: PropType<MenuBarData>;
|
|
@@ -129,9 +129,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
129
129
|
right: never[];
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
+
/** 组件树右键菜单 */
|
|
133
|
+
layerContentMenu: {
|
|
134
|
+
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
135
|
+
default: () => never[];
|
|
136
|
+
};
|
|
137
|
+
/** 画布右键菜单 */
|
|
138
|
+
stageContentMenu: {
|
|
139
|
+
type: PropType<(MenuButton | MenuComponent)[]>;
|
|
140
|
+
default: () => never[];
|
|
141
|
+
};
|
|
132
142
|
/** 中间工作区域中画布渲染的内容 */
|
|
133
143
|
render: {
|
|
134
|
-
type: PropType<() => HTMLDivElement
|
|
144
|
+
type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
|
|
135
145
|
};
|
|
136
146
|
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
137
147
|
runtimeUrl: StringConstructor;
|
|
@@ -149,12 +159,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
149
159
|
};
|
|
150
160
|
/** 组件联动事件选项列表 */
|
|
151
161
|
eventMethodList: {
|
|
152
|
-
type:
|
|
162
|
+
type: PropType<Record<string, {
|
|
163
|
+
events: EventOption[];
|
|
164
|
+
methods: EventOption[];
|
|
165
|
+
}>>;
|
|
153
166
|
default: () => {};
|
|
154
167
|
};
|
|
155
168
|
/** 画布中组件选中框的移动范围 */
|
|
156
169
|
moveableOptions: {
|
|
157
|
-
type: PropType<MoveableOptions | ((
|
|
170
|
+
type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
|
|
158
171
|
};
|
|
159
172
|
/** 编辑器初始化时默认选中的组件ID */
|
|
160
173
|
defaultSelected: {
|
|
@@ -188,26 +201,33 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
188
201
|
default: () => {};
|
|
189
202
|
};
|
|
190
203
|
updateDragEl: {
|
|
191
|
-
type: PropType<
|
|
204
|
+
type: PropType<UpdateDragEl>;
|
|
205
|
+
};
|
|
206
|
+
disabledDragStart: {
|
|
207
|
+
type: BooleanConstructor;
|
|
192
208
|
};
|
|
193
209
|
}>> & {
|
|
194
210
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
195
211
|
"onProps-panel-mounted"?: ((...args: any[]) => any) | undefined;
|
|
196
212
|
}, {
|
|
197
213
|
menu: MenuBarData;
|
|
214
|
+
autoScrollIntoView: boolean;
|
|
198
215
|
codeOptions: Record<string, any>;
|
|
199
216
|
modelValue: MApp;
|
|
200
217
|
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
201
218
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
202
219
|
componentGroupList: ComponentGroup[];
|
|
203
|
-
autoScrollIntoView: boolean;
|
|
204
220
|
propsConfigs: Record<string, FormConfig>;
|
|
205
221
|
propsValues: Record<string, MNode>;
|
|
206
|
-
eventMethodList: Record<string,
|
|
222
|
+
eventMethodList: Record<string, {
|
|
223
|
+
events: EventOption[];
|
|
224
|
+
methods: EventOption[];
|
|
225
|
+
}>;
|
|
207
226
|
canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
208
227
|
isContainer: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
209
228
|
containerHighlightClassName: string;
|
|
210
229
|
containerHighlightDuration: number;
|
|
211
230
|
containerHighlightType: ContainerHighlightType;
|
|
231
|
+
disabledDragStart: boolean;
|
|
212
232
|
}>;
|
|
213
233
|
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Id } from '@tmagic/schema';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
/** 代码id */
|
|
4
|
+
id: Id;
|
|
5
|
+
/** 代码内容 */
|
|
6
|
+
content: string;
|
|
7
|
+
/** 是否可编辑 */
|
|
8
|
+
editable?: boolean | undefined;
|
|
9
|
+
/** 是否自动保存草稿 */
|
|
10
|
+
autoSaveDraft?: boolean | undefined;
|
|
11
|
+
/** 编辑器参数 */
|
|
12
|
+
codeOptions?: Object | undefined;
|
|
13
|
+
/** 编辑器语言 */
|
|
14
|
+
language?: string | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
editable: boolean;
|
|
17
|
+
autoSaveDraft: boolean;
|
|
18
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "saveAndClose")[], "close" | "saveAndClose", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
19
|
+
/** 代码id */
|
|
20
|
+
id: Id;
|
|
21
|
+
/** 代码内容 */
|
|
22
|
+
content: string;
|
|
23
|
+
/** 是否可编辑 */
|
|
24
|
+
editable?: boolean | undefined;
|
|
25
|
+
/** 是否自动保存草稿 */
|
|
26
|
+
autoSaveDraft?: boolean | undefined;
|
|
27
|
+
/** 编辑器参数 */
|
|
28
|
+
codeOptions?: Object | undefined;
|
|
29
|
+
/** 编辑器语言 */
|
|
30
|
+
language?: string | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
editable: boolean;
|
|
33
|
+
autoSaveDraft: boolean;
|
|
34
|
+
}>>> & {
|
|
35
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
onSaveAndClose?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
editable: boolean;
|
|
39
|
+
autoSaveDraft: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
export default _default;
|
|
42
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
43
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
44
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
45
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
46
|
+
} : {
|
|
47
|
+
type: import('vue').PropType<T[K]>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
52
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
53
|
+
default: D[K];
|
|
54
|
+
} : P[K];
|
|
55
|
+
};
|
|
@@ -1,87 +1,14 @@
|
|
|
1
|
-
import { nextTick } from 'vue';
|
|
2
1
|
import { MenuButton, MenuComponent } from '../type';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}>, {
|
|
14
|
-
menuData: () => never[];
|
|
15
|
-
isSubMenu: boolean;
|
|
16
|
-
}>>> & {
|
|
17
|
-
onHide?: ((...args: any[]) => any) | undefined;
|
|
18
|
-
onShow?: ((...args: any[]) => any) | undefined;
|
|
19
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "menuData" | "isSubMenu">;
|
|
20
|
-
$attrs: {
|
|
21
|
-
[x: string]: unknown;
|
|
22
|
-
};
|
|
23
|
-
$refs: {
|
|
24
|
-
[x: string]: unknown;
|
|
25
|
-
};
|
|
26
|
-
$slots: Readonly<{
|
|
27
|
-
[name: string]: import("vue").Slot | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
30
|
-
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
31
|
-
$emit: (event: "hide" | "show", ...args: any[]) => void;
|
|
32
|
-
$el: any;
|
|
33
|
-
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
34
|
-
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
35
|
-
isSubMenu?: boolean | undefined;
|
|
36
|
-
}>, {
|
|
37
|
-
menuData: () => never[];
|
|
38
|
-
isSubMenu: boolean;
|
|
39
|
-
}>>> & {
|
|
40
|
-
onHide?: ((...args: any[]) => any) | undefined;
|
|
41
|
-
onShow?: ((...args: any[]) => any) | undefined;
|
|
42
|
-
}, {
|
|
43
|
-
hide: () => void;
|
|
44
|
-
show: (e: MouseEvent) => void;
|
|
45
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("hide" | "show")[], string, {
|
|
46
|
-
menuData: (MenuButton | MenuComponent)[];
|
|
47
|
-
isSubMenu: boolean;
|
|
48
|
-
}> & {
|
|
49
|
-
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
50
|
-
created?: ((() => void) | (() => void)[]) | undefined;
|
|
51
|
-
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
52
|
-
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
53
|
-
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
54
|
-
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
55
|
-
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
56
|
-
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
57
|
-
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
58
|
-
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
59
|
-
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
60
|
-
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
61
|
-
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
62
|
-
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
63
|
-
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
|
|
64
|
-
};
|
|
65
|
-
$forceUpdate: () => void;
|
|
66
|
-
$nextTick: typeof nextTick;
|
|
67
|
-
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
68
|
-
} & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
69
|
-
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
70
|
-
isSubMenu?: boolean | undefined;
|
|
71
|
-
}>, {
|
|
72
|
-
menuData: () => never[];
|
|
73
|
-
isSubMenu: boolean;
|
|
74
|
-
}>>> & {
|
|
75
|
-
onHide?: ((...args: any[]) => any) | undefined;
|
|
76
|
-
onShow?: ((...args: any[]) => any) | undefined;
|
|
77
|
-
} & import("vue").ShallowUnwrapRef<{
|
|
78
|
-
hide: () => void;
|
|
79
|
-
show: (e: MouseEvent) => void;
|
|
80
|
-
}> & {} & import("vue").ComponentCustomProperties;
|
|
81
|
-
__isFragment?: undefined;
|
|
82
|
-
__isTeleport?: undefined;
|
|
83
|
-
__isSuspense?: undefined;
|
|
84
|
-
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
4
|
+
isSubMenu?: boolean | undefined;
|
|
5
|
+
}>, {
|
|
6
|
+
menuData: () => never[];
|
|
7
|
+
isSubMenu: boolean;
|
|
8
|
+
}>, {
|
|
9
|
+
hide: () => void;
|
|
10
|
+
show: (e: MouseEvent) => void;
|
|
11
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("hide" | "show")[], "hide" | "show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
85
12
|
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
86
13
|
isSubMenu?: boolean | undefined;
|
|
87
14
|
}>, {
|
|
@@ -91,12 +18,9 @@ declare const _default: {
|
|
|
91
18
|
onHide?: ((...args: any[]) => any) | undefined;
|
|
92
19
|
onShow?: ((...args: any[]) => any) | undefined;
|
|
93
20
|
}, {
|
|
94
|
-
hide: () => void;
|
|
95
|
-
show: (e: MouseEvent) => void;
|
|
96
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("hide" | "show")[], "hide" | "show", {
|
|
97
21
|
menuData: (MenuButton | MenuComponent)[];
|
|
98
22
|
isSubMenu: boolean;
|
|
99
|
-
}
|
|
23
|
+
}>;
|
|
100
24
|
export default _default;
|
|
101
25
|
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
102
26
|
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ColumnConfig } from '@tmagic/form';
|
|
2
|
+
import { Id } from '@tmagic/schema';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 代码块id */
|
|
5
|
+
id: Id;
|
|
6
|
+
/** 代码块名称 */
|
|
7
|
+
name: string;
|
|
8
|
+
/** 代码内容 */
|
|
9
|
+
content: string;
|
|
10
|
+
/** 是否可编辑 */
|
|
11
|
+
editable?: boolean | undefined;
|
|
12
|
+
/** 是否自动保存草稿 */
|
|
13
|
+
autoSaveDraft?: boolean | undefined;
|
|
14
|
+
/** 编辑器扩展参数 */
|
|
15
|
+
codeOptions?: object | undefined;
|
|
16
|
+
/** 代码参数扩展配置 */
|
|
17
|
+
paramsColConfig?: ColumnConfig | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
editable: boolean;
|
|
20
|
+
autoSaveDraft: boolean;
|
|
21
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "field-input")[], "change" | "field-input", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
22
|
+
/** 代码块id */
|
|
23
|
+
id: Id;
|
|
24
|
+
/** 代码块名称 */
|
|
25
|
+
name: string;
|
|
26
|
+
/** 代码内容 */
|
|
27
|
+
content: string;
|
|
28
|
+
/** 是否可编辑 */
|
|
29
|
+
editable?: boolean | undefined;
|
|
30
|
+
/** 是否自动保存草稿 */
|
|
31
|
+
autoSaveDraft?: boolean | undefined;
|
|
32
|
+
/** 编辑器扩展参数 */
|
|
33
|
+
codeOptions?: object | undefined;
|
|
34
|
+
/** 代码参数扩展配置 */
|
|
35
|
+
paramsColConfig?: ColumnConfig | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
editable: boolean;
|
|
38
|
+
autoSaveDraft: boolean;
|
|
39
|
+
}>>> & {
|
|
40
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
41
|
+
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
editable: boolean;
|
|
44
|
+
autoSaveDraft: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
export default _default;
|
|
47
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
48
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
49
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
50
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
51
|
+
} : {
|
|
52
|
+
type: import('vue').PropType<T[K]>;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
57
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
58
|
+
default: D[K];
|
|
59
|
+
} : P[K];
|
|
60
|
+
};
|