@tmagic/editor 1.0.0-beta.7 → 1.0.0-rc.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/LICENSE +5432 -0
- package/README.md +1 -0
- package/coverage/clover.xml +1560 -0
- package/coverage/coverage-final.json +36 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +206 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/Editor.vue.html +787 -0
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +406 -0
- package/coverage/lcov-report/src/components/Icon.vue.html +172 -0
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +283 -0
- package/coverage/lcov-report/src/components/ToolButton.vue.html +772 -0
- package/coverage/lcov-report/src/components/index.html +161 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +214 -0
- package/coverage/lcov-report/src/layouts/Framework.vue.html +304 -0
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +208 -0
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +319 -0
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +268 -0
- package/coverage/lcov-report/src/layouts/index.html +176 -0
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +358 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +421 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +775 -0
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +226 -0
- package/coverage/lcov-report/src/layouts/sidebar/TabPane.vue.html +289 -0
- package/coverage/lcov-report/src/layouts/sidebar/index.html +176 -0
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +718 -0
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +757 -0
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +532 -0
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +586 -0
- package/coverage/lcov-report/src/layouts/workspace/index.html +161 -0
- package/coverage/lcov-report/src/services/BaseService.ts.html +643 -0
- package/coverage/lcov-report/src/services/componentList.ts.html +229 -0
- package/coverage/lcov-report/src/services/editor.ts.html +2077 -0
- package/coverage/lcov-report/src/services/events.ts.html +331 -0
- package/coverage/lcov-report/src/services/history.ts.html +478 -0
- package/coverage/lcov-report/src/services/index.html +206 -0
- package/coverage/lcov-report/src/services/props.ts.html +415 -0
- package/coverage/lcov-report/src/services/ui.ts.html +580 -0
- package/coverage/lcov-report/src/type.ts.html +850 -0
- package/coverage/lcov-report/src/utils/compose.ts.html +184 -0
- package/coverage/lcov-report/src/utils/config.ts.html +172 -0
- package/coverage/lcov-report/src/utils/editor.ts.html +838 -0
- package/coverage/lcov-report/src/utils/index.html +221 -0
- package/coverage/lcov-report/src/utils/index.ts.html +151 -0
- package/coverage/lcov-report/src/utils/logger.ts.html +226 -0
- package/coverage/lcov-report/src/utils/props.ts.html +796 -0
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +733 -0
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +313 -0
- package/coverage/lcov.info +3708 -0
- package/dist/style.css +94 -38
- package/dist/tmagic-editor.es.js +1474 -817
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +1475 -819
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +1 -1
- package/dist/types/src/components/ToolButton.vue.d.ts +12 -1
- package/dist/types/src/fields/UISelect.vue.d.ts +4 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/layouts/CodeEditor.vue.d.ts +13 -4
- package/dist/types/src/layouts/PropsPanel.vue.d.ts +2 -1
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -1
- package/dist/types/src/layouts/sidebar/Sidebar.vue.d.ts +2 -3
- package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +14 -0
- package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +10 -3
- package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +4 -6
- package/dist/types/src/services/BaseService.d.ts +4 -1
- package/dist/types/src/services/editor.d.ts +16 -6
- package/dist/types/src/services/history.d.ts +1 -0
- package/dist/types/src/services/props.d.ts +2 -2
- package/dist/types/src/services/ui.d.ts +2 -0
- package/dist/types/src/type.d.ts +16 -9
- package/dist/types/src/utils/editor.d.ts +5 -4
- package/dist/types/src/utils/polyfills.d.ts +0 -0
- package/package.json +37 -12
- package/src/components/ContentMenu.vue +107 -0
- package/src/components/ScrollViewer.vue +1 -1
- package/src/components/ToolButton.vue +72 -31
- package/src/fields/UISelect.vue +14 -6
- package/src/index.ts +2 -0
- package/src/layouts/AddPageBox.vue +3 -1
- package/src/layouts/CodeEditor.vue +20 -10
- package/src/layouts/Framework.vue +6 -6
- package/src/layouts/PropsPanel.vue +5 -3
- package/src/layouts/sidebar/ComponentListPanel.vue +25 -3
- package/src/layouts/sidebar/LayerMenu.vue +91 -96
- package/src/layouts/sidebar/LayerPanel.vue +80 -59
- package/src/layouts/sidebar/Sidebar.vue +13 -52
- package/src/layouts/sidebar/TabPane.vue +68 -0
- package/src/layouts/workspace/PageBar.vue +145 -17
- package/src/layouts/workspace/Stage.vue +55 -64
- package/src/layouts/workspace/ViewerMenu.vue +107 -68
- package/src/layouts/workspace/Workspace.vue +106 -18
- package/src/services/BaseService.ts +70 -22
- package/src/services/editor.ts +198 -63
- package/src/services/history.ts +7 -0
- package/src/services/props.ts +3 -3
- package/src/services/ui.ts +35 -5
- package/src/theme/common/var.scss +3 -2
- package/src/theme/component-list-panel.scss +2 -0
- package/src/theme/content-menu.scss +33 -26
- package/src/theme/layer-panel.scss +10 -0
- package/src/theme/nav-menu.scss +6 -2
- package/src/theme/page-bar.scss +42 -2
- package/src/theme/props-panel.scss +20 -6
- package/src/type.ts +17 -9
- package/src/utils/editor.ts +35 -9
- package/{vite.config.ts → src/utils/polyfills.ts} +4 -12
- package/src/utils/props.ts +20 -1
- package/dist/types/src/layouts/sidebar/LayerMenu.vue.d.ts +0 -31
- package/dist/types/src/layouts/sidebar/LayerPanel.vue.d.ts +0 -973
- package/dist/types/src/layouts/workspace/Stage.vue.d.ts +0 -192
- package/dist/types/src/layouts/workspace/ViewerMenu.vue.d.ts +0 -18
- package/tsconfig.json +0 -9
|
@@ -126,9 +126,9 @@ declare const _default: DefineComponent<{
|
|
|
126
126
|
"onProps-panel-mounted"?: ((...args: any[]) => any) | undefined;
|
|
127
127
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
128
128
|
}, {
|
|
129
|
-
componentGroupList: ComponentGroup[];
|
|
130
129
|
menu: MenuBarData;
|
|
131
130
|
modelValue: MApp;
|
|
131
|
+
componentGroupList: ComponentGroup[];
|
|
132
132
|
propsConfigs: Record<string, FormConfig>;
|
|
133
133
|
propsValues: Record<string, MNode>;
|
|
134
134
|
eventMethodList: Record<string, any>;
|
|
@@ -9,6 +9,10 @@ declare const _default: DefineComponent<{
|
|
|
9
9
|
display: boolean;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
+
eventType: {
|
|
13
|
+
type: PropType<"mousedown" | "mouseup" | "click">;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
12
16
|
}, {
|
|
13
17
|
ZoomIn: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
14
18
|
ZoomOut: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
@@ -19,7 +23,9 @@ declare const _default: DefineComponent<{
|
|
|
19
23
|
zoomInHandler: () => void | undefined;
|
|
20
24
|
zoomOutHandler: () => void | undefined;
|
|
21
25
|
dropdownHandler(command: any): void;
|
|
22
|
-
|
|
26
|
+
clickHandler(item: MenuButton | MenuComponent, event: MouseEvent): void;
|
|
27
|
+
mousedownHandler(item: MenuButton | MenuComponent, event: MouseEvent): void;
|
|
28
|
+
mouseupHandler(item: MenuButton | MenuComponent, event: MouseEvent): void;
|
|
23
29
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
24
30
|
data: {
|
|
25
31
|
type: PropType<string | MenuButton | MenuComponent>;
|
|
@@ -29,7 +35,12 @@ declare const _default: DefineComponent<{
|
|
|
29
35
|
display: boolean;
|
|
30
36
|
};
|
|
31
37
|
};
|
|
38
|
+
eventType: {
|
|
39
|
+
type: PropType<"mousedown" | "mouseup" | "click">;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
32
42
|
}>>, {
|
|
33
43
|
data: string | MenuButton | MenuComponent;
|
|
44
|
+
eventType: "mousedown" | "mouseup" | "click";
|
|
34
45
|
}>;
|
|
35
46
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefineComponent,
|
|
1
|
+
import type { DefineComponent, ComponentOptionsMixin, EmitsOptions, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComputedRef, Ref, ExtractPropTypes } from 'vue';
|
|
2
2
|
declare const _default: DefineComponent<{
|
|
3
3
|
labelWidth: StringConstructor;
|
|
4
4
|
config: ObjectConstructor;
|
|
@@ -9,6 +9,9 @@ declare const _default: DefineComponent<{
|
|
|
9
9
|
};
|
|
10
10
|
name: StringConstructor;
|
|
11
11
|
}, {
|
|
12
|
+
Delete: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
13
|
+
Pointer: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
14
|
+
Close: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
12
15
|
val: ComputedRef<any>;
|
|
13
16
|
uiSelectMode: Ref<boolean>;
|
|
14
17
|
toName: ComputedRef<string>;
|
|
@@ -13,6 +13,7 @@ export { default as uiService } from './services/ui';
|
|
|
13
13
|
export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
|
|
14
14
|
export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
|
|
15
15
|
export { default as PropsPanel } from './layouts/PropsPanel.vue';
|
|
16
|
+
export { default as ToolButton } from './components/ToolButton.vue';
|
|
16
17
|
declare const _default: {
|
|
17
18
|
install: (app: App, opt?: InstallOptions | undefined) => void;
|
|
18
19
|
};
|
|
@@ -8,13 +8,17 @@ declare const _default: DefineComponent<{
|
|
|
8
8
|
type: (StringConstructor | ObjectConstructor)[];
|
|
9
9
|
};
|
|
10
10
|
type: {
|
|
11
|
-
type: StringConstructor
|
|
11
|
+
type: StringConstructor;
|
|
12
12
|
default: () => string;
|
|
13
13
|
};
|
|
14
14
|
language: {
|
|
15
|
-
type: StringConstructor
|
|
15
|
+
type: StringConstructor;
|
|
16
16
|
default: () => string;
|
|
17
17
|
};
|
|
18
|
+
options: {
|
|
19
|
+
type: ObjectConstructor;
|
|
20
|
+
default: () => {};
|
|
21
|
+
};
|
|
18
22
|
}, {
|
|
19
23
|
values: Ref<string>;
|
|
20
24
|
loading: Ref<boolean>;
|
|
@@ -30,18 +34,23 @@ declare const _default: DefineComponent<{
|
|
|
30
34
|
type: (StringConstructor | ObjectConstructor)[];
|
|
31
35
|
};
|
|
32
36
|
type: {
|
|
33
|
-
type: StringConstructor
|
|
37
|
+
type: StringConstructor;
|
|
34
38
|
default: () => string;
|
|
35
39
|
};
|
|
36
40
|
language: {
|
|
37
|
-
type: StringConstructor
|
|
41
|
+
type: StringConstructor;
|
|
38
42
|
default: () => string;
|
|
39
43
|
};
|
|
44
|
+
options: {
|
|
45
|
+
type: ObjectConstructor;
|
|
46
|
+
default: () => {};
|
|
47
|
+
};
|
|
40
48
|
}>> & {
|
|
41
49
|
onInitd?: ((...args: any[]) => any) | undefined;
|
|
42
50
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
43
51
|
}, {
|
|
44
52
|
type: string;
|
|
45
53
|
language: string;
|
|
54
|
+
options: Record<string, any>;
|
|
46
55
|
}>;
|
|
47
56
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefineComponent, Ref, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue';
|
|
1
|
+
import type { DefineComponent, Ref, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue';
|
|
2
2
|
declare const _default: DefineComponent<{}, {
|
|
3
3
|
values: Ref<{
|
|
4
4
|
[x: string]: any;
|
|
@@ -6,6 +6,7 @@ declare const _default: DefineComponent<{}, {
|
|
|
6
6
|
}>;
|
|
7
7
|
configForm: Ref<any>;
|
|
8
8
|
curFormConfig: any;
|
|
9
|
+
propsPanelSize: ComputedRef<unknown>;
|
|
9
10
|
submit(): Promise<void>;
|
|
10
11
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "mounted"[], "mounted", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{}>> & {
|
|
11
12
|
onMounted?: ((...args: any[]) => any) | undefined;
|
|
@@ -7,6 +7,7 @@ declare const _default: DefineComponent<{}, {
|
|
|
7
7
|
items: ComponentItem[];
|
|
8
8
|
title: string;
|
|
9
9
|
}[] | undefined>;
|
|
10
|
-
appendComponent({ text, type,
|
|
10
|
+
appendComponent({ text, type, data }: ComponentItem): void;
|
|
11
|
+
dragstartHandler({ text, type, data }: ComponentItem, e: DragEvent): void;
|
|
11
12
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{}>>, {}>;
|
|
12
13
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DefineComponent, Ref,
|
|
2
|
-
import { SideBarData
|
|
1
|
+
import type { DefineComponent, Ref, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { SideBarData } from '../../type';
|
|
3
3
|
declare const _default: DefineComponent<{
|
|
4
4
|
data: {
|
|
5
5
|
type: PropType<SideBarData>;
|
|
@@ -11,7 +11,6 @@ declare const _default: DefineComponent<{
|
|
|
11
11
|
};
|
|
12
12
|
}, {
|
|
13
13
|
activeTabName: Ref<string>;
|
|
14
|
-
items: ComputedRef<SideComponent[] | Record<string, any>[]>;
|
|
15
14
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
16
15
|
data: {
|
|
17
16
|
type: PropType<SideBarData>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DefineComponent, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { SideComponent, SideItem } from '../../type';
|
|
3
|
+
declare const _default: DefineComponent<{
|
|
4
|
+
data: {
|
|
5
|
+
type: PropType<SideItem>;
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
config: ComputedRef<SideComponent | undefined>;
|
|
9
|
+
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
10
|
+
data: {
|
|
11
|
+
type: PropType<SideItem>;
|
|
12
|
+
};
|
|
13
|
+
}>>, {}>;
|
|
14
|
+
export default _default;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import type { DefineComponent,
|
|
2
|
-
import type { MNode, MPage } from '@tmagic/schema';
|
|
1
|
+
import type { DefineComponent, Ref, ComponentOptionsMixin, EmitsOptions, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, ComputedRef } from 'vue';
|
|
2
|
+
import type { MNode, MApp, MPage } from '@tmagic/schema';
|
|
3
3
|
declare const _default: DefineComponent<{}, {
|
|
4
|
-
root: ComputedRef<
|
|
4
|
+
root: ComputedRef<MApp | undefined>;
|
|
5
5
|
page: ComputedRef<MNode | undefined>;
|
|
6
6
|
switchPage(page: MPage): void;
|
|
7
7
|
addPage(): void;
|
|
8
8
|
copy(node: MPage): void;
|
|
9
9
|
remove(node: MPage): void;
|
|
10
|
+
pageBar: Ref<HTMLDivElement | undefined>;
|
|
11
|
+
itemsContainer: Ref<HTMLDivElement | undefined>;
|
|
12
|
+
canScroll: Ref<boolean>;
|
|
13
|
+
itemsContainerWidth: ComputedRef<number>;
|
|
14
|
+
scroll: (type: "left" | "right" | "start" | "end") => void;
|
|
15
|
+
Delete: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
16
|
+
DocumentCopy: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
10
17
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{}>>, {}>;
|
|
11
18
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DefineComponent, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type {
|
|
3
|
-
import type { MoveableOptions
|
|
1
|
+
import type { DefineComponent, Ref, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { MPage } from '@tmagic/schema';
|
|
3
|
+
import type { MoveableOptions } from '@tmagic/stage';
|
|
4
4
|
import StageCore from '@tmagic/stage';
|
|
5
5
|
declare const _default: DefineComponent<{
|
|
6
6
|
runtimeUrl: StringConstructor;
|
|
@@ -14,10 +14,8 @@ declare const _default: DefineComponent<{
|
|
|
14
14
|
type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
|
|
15
15
|
};
|
|
16
16
|
}, {
|
|
17
|
+
workspace: Ref<HTMLDivElement | undefined>;
|
|
17
18
|
page: ComputedRef<MPage | undefined>;
|
|
18
|
-
selectHandler(el: HTMLElement): void;
|
|
19
|
-
updateNodeHandler(node: MComponent | MContainer | MPage): void;
|
|
20
|
-
sortNodeHandler(ev: SortEventData): void;
|
|
21
19
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
22
20
|
runtimeUrl: StringConstructor;
|
|
23
21
|
render: {
|
|
@@ -50,7 +50,10 @@ import { EventEmitter } from 'events';
|
|
|
50
50
|
export default class extends EventEmitter {
|
|
51
51
|
private pluginOptionsList;
|
|
52
52
|
private middleware;
|
|
53
|
-
|
|
53
|
+
private taskList;
|
|
54
|
+
private doingTask;
|
|
55
|
+
constructor(methods?: string[], serialMethods?: string[]);
|
|
54
56
|
use(options: Record<string, Function>): void;
|
|
55
57
|
usePlugin(options: Record<string, Function>): void;
|
|
58
|
+
private doTask;
|
|
56
59
|
}
|
|
@@ -9,7 +9,7 @@ declare class Editor extends BaseService {
|
|
|
9
9
|
constructor();
|
|
10
10
|
/**
|
|
11
11
|
* 设置当前指点节点配置
|
|
12
|
-
* @param name 'root' | 'page' | 'parent' | 'node'
|
|
12
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode'
|
|
13
13
|
* @param value MNode
|
|
14
14
|
* @returns MNode
|
|
15
15
|
*/
|
|
@@ -41,20 +41,28 @@ declare class Editor extends BaseService {
|
|
|
41
41
|
/**
|
|
42
42
|
* 只有容器拥有布局
|
|
43
43
|
*/
|
|
44
|
-
getLayout(
|
|
44
|
+
getLayout(parent: MNode, node?: MNode): Promise<Layout>;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param config
|
|
46
|
+
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
47
|
+
* @param config 指定节点配置或者ID
|
|
48
48
|
* @returns 当前选中的节点配置
|
|
49
49
|
*/
|
|
50
|
-
select(config: MNode | Id): Promise<MNode
|
|
50
|
+
select(config: MNode | Id): Promise<MNode> | never;
|
|
51
|
+
selectNextNode(): Promise<MNode> | never;
|
|
52
|
+
selectNextPage(): Promise<MNode> | never;
|
|
53
|
+
/**
|
|
54
|
+
* 高亮指定节点
|
|
55
|
+
* @param config 指定节点配置或者ID
|
|
56
|
+
* @returns 当前高亮的节点配置
|
|
57
|
+
*/
|
|
58
|
+
highlight(config: MNode | Id): void;
|
|
51
59
|
/**
|
|
52
60
|
* 向指点容器添加组件节点
|
|
53
61
|
* @param addConfig 将要添加的组件节点配置
|
|
54
62
|
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
55
63
|
* @returns 添加后的节点
|
|
56
64
|
*/
|
|
57
|
-
add(
|
|
65
|
+
add(addNode: AddMNode, parent?: MContainer | null): Promise<MNode>;
|
|
58
66
|
/**
|
|
59
67
|
* 删除组件
|
|
60
68
|
* @param {Object} node
|
|
@@ -110,12 +118,14 @@ declare class Editor extends BaseService {
|
|
|
110
118
|
* @returns 下一步数据
|
|
111
119
|
*/
|
|
112
120
|
redo(): Promise<StepValue | null>;
|
|
121
|
+
move(left: number, top: number): Promise<void>;
|
|
113
122
|
destroy(): void;
|
|
114
123
|
resetModifiedNodeId(): void;
|
|
115
124
|
private addModifiedNodeId;
|
|
116
125
|
private pushHistoryState;
|
|
117
126
|
private changeHistoryState;
|
|
118
127
|
private toggleFixedPosition;
|
|
128
|
+
private selectedConfigExceptionHandler;
|
|
119
129
|
}
|
|
120
130
|
export declare type EditorService = Editor;
|
|
121
131
|
declare const _default: Editor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FormConfig } from '@tmagic/form';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MNode } from '@tmagic/schema';
|
|
3
3
|
import BaseService from './BaseService';
|
|
4
4
|
declare class Props extends BaseService {
|
|
5
5
|
private state;
|
|
@@ -29,7 +29,7 @@ declare class Props extends BaseService {
|
|
|
29
29
|
* @param type 组件类型
|
|
30
30
|
* @returns 组件初始值
|
|
31
31
|
*/
|
|
32
|
-
getPropsValue(type: string): Promise<
|
|
32
|
+
getPropsValue(type: string, defaultValue?: {}): Promise<any>;
|
|
33
33
|
}
|
|
34
34
|
export declare type PropsService = Props;
|
|
35
35
|
declare const _default: Props;
|
|
@@ -19,11 +19,13 @@ declare const state: {
|
|
|
19
19
|
};
|
|
20
20
|
showGuides: boolean;
|
|
21
21
|
showRule: boolean;
|
|
22
|
+
propsPanelSize: "small" | "default" | "large";
|
|
22
23
|
};
|
|
23
24
|
declare class Ui extends BaseService {
|
|
24
25
|
constructor();
|
|
25
26
|
set<T = any>(name: keyof UiState, value: T): void;
|
|
26
27
|
get<T>(name: keyof typeof state): T;
|
|
28
|
+
zoom(zoom: number): void;
|
|
27
29
|
private setColumnWidth;
|
|
28
30
|
private setStageRect;
|
|
29
31
|
private calcZoom;
|
package/dist/types/src/type.d.ts
CHANGED
|
@@ -26,8 +26,10 @@ export interface StoreState {
|
|
|
26
26
|
page: MPage | null;
|
|
27
27
|
parent: MContainer | null;
|
|
28
28
|
node: MNode | null;
|
|
29
|
+
highlightNode: MNode | null;
|
|
29
30
|
stage: StageCore | null;
|
|
30
31
|
modifiedNodeIds: Map<Id, Id>;
|
|
32
|
+
pageLength: number;
|
|
31
33
|
}
|
|
32
34
|
export interface PropsState {
|
|
33
35
|
propsConfigMap: Record<string, FormConfig>;
|
|
@@ -67,6 +69,8 @@ export interface UiState {
|
|
|
67
69
|
showGuides: boolean;
|
|
68
70
|
/** 是否显示标尺,true: 显示,false: 不显示,默认为true */
|
|
69
71
|
showRule: boolean;
|
|
72
|
+
/** 用于控制该属性配置表单内组件的尺寸 */
|
|
73
|
+
propsPanelSize: 'large' | 'default' | 'small';
|
|
70
74
|
}
|
|
71
75
|
export interface EditorNodeInfo {
|
|
72
76
|
node?: MNode;
|
|
@@ -91,6 +95,8 @@ export interface MenuButton {
|
|
|
91
95
|
* zoom: 放大缩小
|
|
92
96
|
*/
|
|
93
97
|
type: 'button' | 'dropdown' | 'text' | 'divider' | 'zoom';
|
|
98
|
+
/** 当type为divider时有效,分割线方向, 默认vertical */
|
|
99
|
+
direction?: 'horizontal' | 'vertical';
|
|
94
100
|
/** 展示的文案 */
|
|
95
101
|
text?: string;
|
|
96
102
|
/** 鼠标悬浮是显示的气泡中的文案 */
|
|
@@ -102,14 +108,9 @@ export interface MenuButton {
|
|
|
102
108
|
/** 是否显示,默认为true */
|
|
103
109
|
display?: boolean | ((data?: Services) => boolean);
|
|
104
110
|
/** type为button/dropdown时点击运行的方法 */
|
|
105
|
-
handler?: (data
|
|
106
|
-
/** type为dropdown
|
|
107
|
-
items?:
|
|
108
|
-
/** 展示的文案 */
|
|
109
|
-
text: string;
|
|
110
|
-
/** 点击运行的方法 */
|
|
111
|
-
handler(data: Services): any;
|
|
112
|
-
}[];
|
|
111
|
+
handler?: (data: Services, event: MouseEvent) => Promise<any> | any;
|
|
112
|
+
/** type为dropdown时,下拉的菜单列表, 或者有子菜单时 */
|
|
113
|
+
items?: MenuButton[];
|
|
113
114
|
}
|
|
114
115
|
export interface MenuComponent {
|
|
115
116
|
type: 'component';
|
|
@@ -168,7 +169,9 @@ export interface ComponentItem {
|
|
|
168
169
|
type: string;
|
|
169
170
|
/** element-plus icon class */
|
|
170
171
|
icon?: string | Component;
|
|
171
|
-
|
|
172
|
+
data?: {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
};
|
|
172
175
|
}
|
|
173
176
|
export interface ComponentGroup {
|
|
174
177
|
/** 显示文案 */
|
|
@@ -176,6 +179,10 @@ export interface ComponentGroup {
|
|
|
176
179
|
/** 组内列表 */
|
|
177
180
|
items: ComponentItem[];
|
|
178
181
|
}
|
|
182
|
+
export interface UpdateData {
|
|
183
|
+
id: Id;
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}
|
|
179
186
|
export declare enum LayerOffset {
|
|
180
187
|
TOP = "top",
|
|
181
188
|
BOTTOM = "bottom"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
1
|
+
import type { MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
2
|
+
import type StageCore from '@tmagic/stage';
|
|
2
3
|
import { Layout } from '../type';
|
|
3
4
|
export declare const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
4
5
|
export declare const generateId: (type: string | number) => string;
|
|
@@ -36,9 +37,9 @@ export declare const setNewItemId: (config: MNode, parent?: MPage | undefined) =
|
|
|
36
37
|
* @returns {boolean}
|
|
37
38
|
*/
|
|
38
39
|
export declare const isFixed: (node: MNode) => boolean;
|
|
39
|
-
export declare const getNodeIndex: (node: MNode, parent: MContainer) => number;
|
|
40
|
+
export declare const getNodeIndex: (node: MNode, parent: MContainer | MApp) => number;
|
|
40
41
|
export declare const toRelative: (node: MNode) => MNode;
|
|
41
|
-
export declare const initPosition: (node: MNode, layout: Layout) => MNode;
|
|
42
|
+
export declare const initPosition: (node: MNode, layout: Layout, parentNode: MNode, stage: StageCore) => MNode;
|
|
42
43
|
export declare const setLayout: (node: MNode, layout: Layout) => MNode;
|
|
43
44
|
export declare const change2Fixed: (node: MNode, root: MApp) => MNode;
|
|
44
|
-
export declare const Fixed2Other: (node: MNode, root: MApp, getLayout: (
|
|
45
|
+
export declare const Fixed2Other: (node: MNode, root: MApp, getLayout: (parent: MNode, node?: MNode | undefined) => Promise<Layout>) => Promise<MNode>;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-
|
|
2
|
+
"version": "1.0.0-rc.1",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
|
-
"sideEffects":
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"dist/*",
|
|
6
|
+
"src/theme/*"
|
|
7
|
+
],
|
|
5
8
|
"main": "dist/tmagic-editor.umd.js",
|
|
6
9
|
"module": "dist/tmagic-editor.es.js",
|
|
7
10
|
"style": "dist/style.css",
|
|
@@ -14,10 +17,14 @@
|
|
|
14
17
|
"./dist/style.css": {
|
|
15
18
|
"import": "./dist/style.css",
|
|
16
19
|
"require": "./dist/style.css"
|
|
17
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./*": "./*"
|
|
18
22
|
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
19
24
|
"scripts": {
|
|
20
|
-
"build": "vite build"
|
|
25
|
+
"build": "vite build",
|
|
26
|
+
"test": "jest --maxWorkers=8",
|
|
27
|
+
"test:coverage": "jest --maxWorkers=16 --coverage"
|
|
21
28
|
},
|
|
22
29
|
"engines": {
|
|
23
30
|
"node": ">=14"
|
|
@@ -26,16 +33,27 @@
|
|
|
26
33
|
"type": "git",
|
|
27
34
|
"url": "https://github.com/Tencent/tmagic-editor.git"
|
|
28
35
|
},
|
|
36
|
+
"homepage": "https://tencent.github.io/tmagic-editor/docs/",
|
|
37
|
+
"keywords": [
|
|
38
|
+
"editor",
|
|
39
|
+
"drag",
|
|
40
|
+
"resize",
|
|
41
|
+
"vue",
|
|
42
|
+
"vue3",
|
|
43
|
+
"typescript"
|
|
44
|
+
],
|
|
29
45
|
"dependencies": {
|
|
30
46
|
"@element-plus/icons": "0.0.11",
|
|
31
|
-
"@tmagic/core": "^1.0.0-
|
|
32
|
-
"@tmagic/form": "^1.0.0-
|
|
33
|
-
"@tmagic/schema": "^1.0.0-
|
|
34
|
-
"@tmagic/stage": "^1.0.0-
|
|
35
|
-
"@tmagic/utils": "^1.0.0-
|
|
47
|
+
"@tmagic/core": "^1.0.0-rc.1",
|
|
48
|
+
"@tmagic/form": "^1.0.0-rc.1",
|
|
49
|
+
"@tmagic/schema": "^1.0.0-rc.1",
|
|
50
|
+
"@tmagic/stage": "^1.0.0-rc.1",
|
|
51
|
+
"@tmagic/utils": "^1.0.0-rc.1",
|
|
52
|
+
"buffer": "^6.0.3",
|
|
36
53
|
"color": "^3.1.3",
|
|
37
|
-
"element-plus": "^2.0
|
|
54
|
+
"element-plus": "^2.2.0",
|
|
38
55
|
"events": "^3.3.0",
|
|
56
|
+
"keycon": "^1.1.2",
|
|
39
57
|
"lodash-es": "^4.17.21",
|
|
40
58
|
"monaco-editor": "^0.32.1",
|
|
41
59
|
"serialize-javascript": "^6.0.0",
|
|
@@ -43,17 +61,24 @@
|
|
|
43
61
|
},
|
|
44
62
|
"devDependencies": {
|
|
45
63
|
"@types/events": "^3.0.0",
|
|
64
|
+
"@types/jest": "^26.0.23",
|
|
46
65
|
"@types/lodash-es": "^4.17.4",
|
|
47
66
|
"@types/node": "^15.12.4",
|
|
48
67
|
"@types/serialize-javascript": "^5.0.1",
|
|
49
68
|
"@vitejs/plugin-vue": "^1.2.3",
|
|
50
69
|
"@vitejs/plugin-vue-jsx": "^1.1.6",
|
|
51
70
|
"@vue/compiler-sfc": "^3.2.0",
|
|
52
|
-
"@vue/test-utils": "^2.0.0-rc.
|
|
71
|
+
"@vue/test-utils": "^2.0.0-rc.20",
|
|
72
|
+
"@vue/vue3-jest": "^27.0.0-alpha.4",
|
|
73
|
+
"jest": "^27.5.1",
|
|
74
|
+
"jest-serializer-vue": "^2.0.2",
|
|
75
|
+
"jest-transform-stub": "^2.0.0",
|
|
53
76
|
"sass": "^1.35.1",
|
|
77
|
+
"ts-jest": "^27.1.4",
|
|
54
78
|
"typescript": "^4.3.4",
|
|
55
79
|
"vite": "^2.3.7",
|
|
56
80
|
"vite-plugin-dts": "^0.9.6",
|
|
57
81
|
"vue-tsc": "^0.0.24"
|
|
58
|
-
}
|
|
82
|
+
},
|
|
83
|
+
"gitHead": "3b647794d087888bfec9772f54356fa48c0b6d90"
|
|
59
84
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="menuData.length" v-show="visible" class="magic-editor-content-menu" ref="menu" :style="menuStyle">
|
|
3
|
+
<div>
|
|
4
|
+
<tool-button
|
|
5
|
+
v-for="(item, index) in menuData"
|
|
6
|
+
event-type="mouseup"
|
|
7
|
+
:data="item"
|
|
8
|
+
:key="index"
|
|
9
|
+
@mouseup="hide"
|
|
10
|
+
@mouseenter="showSubMenu(item)"
|
|
11
|
+
></tool-button>
|
|
12
|
+
</div>
|
|
13
|
+
<teleport to="body">
|
|
14
|
+
<content-menu class="sub-menu" ref="subMenu" :menu-data="subMenuData"></content-menu>
|
|
15
|
+
</teleport>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { defineComponent, nextTick, onMounted, PropType, ref } from 'vue';
|
|
21
|
+
|
|
22
|
+
import { MenuButton, MenuItem } from '@editor/type';
|
|
23
|
+
|
|
24
|
+
import ToolButton from './ToolButton.vue';
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
components: { ToolButton },
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
menuData: {
|
|
31
|
+
type: Array as PropType<MenuItem[]>,
|
|
32
|
+
default: () => [],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
setup() {
|
|
37
|
+
const menu = ref<HTMLDivElement>();
|
|
38
|
+
const subMenu = ref<any>();
|
|
39
|
+
const visible = ref(false);
|
|
40
|
+
const subMenuData = ref<MenuItem[]>([]);
|
|
41
|
+
const menuStyle = ref({
|
|
42
|
+
left: '0',
|
|
43
|
+
top: '0',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const hide = () => {
|
|
47
|
+
visible.value = false;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
globalThis.addEventListener(
|
|
52
|
+
'mousedown',
|
|
53
|
+
(e: MouseEvent) => {
|
|
54
|
+
if (!visible.value || (e.target && menu.value?.contains(e.target as HTMLElement))) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
hide();
|
|
58
|
+
},
|
|
59
|
+
true,
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
menu,
|
|
65
|
+
subMenu,
|
|
66
|
+
visible,
|
|
67
|
+
menuStyle,
|
|
68
|
+
subMenuData,
|
|
69
|
+
|
|
70
|
+
hide,
|
|
71
|
+
|
|
72
|
+
show(e: MouseEvent) {
|
|
73
|
+
visible.value = true;
|
|
74
|
+
|
|
75
|
+
nextTick(() => {
|
|
76
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
77
|
+
|
|
78
|
+
let top = e.clientY;
|
|
79
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
80
|
+
top = document.body.clientHeight - menuHeight;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
menuStyle.value = {
|
|
84
|
+
top: `${top}px`,
|
|
85
|
+
left: `${e.clientX}px`,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
showSubMenu(item: MenuItem) {
|
|
91
|
+
const menuItem = item as MenuButton;
|
|
92
|
+
if (typeof item !== 'object' || !menuItem.items?.length) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
subMenuData.value = menuItem.items;
|
|
97
|
+
if (menu.value) {
|
|
98
|
+
subMenu.value.show({
|
|
99
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
100
|
+
clientY: menu.value.offsetTop,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
</script>
|