@tmagic/editor 1.3.0-beta.2 → 1.3.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/style.css +52 -60
- package/dist/tmagic-editor.js +1634 -1065
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1659 -1087
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +70 -65
- package/src/components/ContentMenu.vue +5 -1
- package/src/components/SearchInput.vue +5 -1
- package/src/editorProps.ts +51 -129
- package/src/fields/Code.vue +9 -3
- package/src/fields/DataSourceFieldSelect.vue +28 -16
- package/src/fields/DataSourceFields.vue +95 -7
- package/src/fields/DataSourceMethodSelect.vue +23 -14
- package/src/fields/DataSourceMocks.vue +237 -0
- package/src/fields/EventSelect.vue +18 -11
- package/src/index.ts +4 -1
- package/src/initService.ts +50 -20
- package/src/layouts/CodeEditor.vue +20 -4
- package/src/layouts/Framework.vue +3 -1
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +18 -8
- package/src/layouts/sidebar/Sidebar.vue +7 -10
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +3 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +3 -1
- package/src/layouts/sidebar/layer/LayerNode.vue +206 -0
- package/src/layouts/sidebar/layer/LayerNodeTool.vue +32 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +85 -0
- package/src/layouts/sidebar/layer/use-drag.ts +157 -0
- package/src/layouts/sidebar/layer/use-filter.ts +70 -0
- package/src/layouts/sidebar/layer/use-keybinding.ts +47 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +103 -0
- package/src/layouts/workspace/Workspace.vue +3 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -1
- package/src/layouts/workspace/viewer/Stage.vue +19 -17
- package/src/services/dataSource.ts +10 -0
- package/src/services/editor.ts +45 -5
- package/src/theme/common/var.scss +2 -2
- package/src/theme/framework.scss +2 -0
- package/src/theme/layer-panel.scss +63 -63
- package/src/theme/props-panel.scss +8 -0
- package/src/theme/sidebar.scss +1 -5
- package/src/type.ts +60 -0
- package/src/utils/data-source/index.ts +11 -0
- package/src/utils/dep.ts +26 -11
- package/src/utils/editor.ts +14 -3
- package/src/utils/props.ts +3 -0
- package/types/editorProps.d.ts +61 -107
- package/types/fields/Code.vue.d.ts +10 -6
- package/types/fields/DataSourceMocks.vue.d.ts +32 -0
- package/types/index.d.ts +2 -1
- package/types/initService.d.ts +5 -4
- package/types/layouts/CodeEditor.vue.d.ts +5 -0
- package/types/layouts/Framework.vue.d.ts +2 -12
- package/types/layouts/PropsPanel.vue.d.ts +2 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -7
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -17
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +2 -7
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +2 -9
- package/types/layouts/sidebar/{LayerMenu.vue.d.ts → layer/LayerMenu.vue.d.ts} +1 -1
- package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +50 -0
- package/types/layouts/sidebar/{LayerNode.vue.d.ts → layer/LayerNodeTool.vue.d.ts} +1 -1
- package/types/layouts/sidebar/{LayerPanel.vue.d.ts → layer/LayerPanel.vue.d.ts} +2 -8
- package/types/layouts/sidebar/layer/use-drag.d.ts +14 -0
- package/types/layouts/sidebar/layer/use-filter.d.ts +8 -0
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +4 -0
- package/types/layouts/sidebar/layer/use-node-status.d.ts +7 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +2 -11
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +1 -1
- package/types/services/dataSource.d.ts +3 -0
- package/types/services/editor.d.ts +1 -0
- package/types/type.d.ts +60 -0
- package/types/utils/dep.d.ts +1 -1
- package/types/utils/editor.d.ts +3 -2
- package/src/layouts/sidebar/LayerNode.vue +0 -40
- package/src/layouts/sidebar/LayerPanel.vue +0 -369
- package/types/Editor.vue.d.ts +0 -233
- /package/src/layouts/sidebar/{LayerMenu.vue → layer/LayerMenu.vue} +0 -0
package/types/initService.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { MApp } from '@tmagic/schema';
|
|
2
|
+
import PropsPanel from './layouts/PropsPanel.vue';
|
|
3
|
+
import { EditorProps } from './editorProps';
|
|
3
4
|
import { Services } from './type';
|
|
4
5
|
export declare type LooseRequired<T> = {
|
|
5
6
|
[P in string & keyof T]: T[P];
|
|
6
7
|
};
|
|
7
|
-
export declare const initServiceState: (props:
|
|
8
|
-
export declare const initServiceEvents: (props:
|
|
8
|
+
export declare const initServiceState: (props: EditorProps, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, keybindingService, dataSourceService, }: Services) => void;
|
|
9
|
+
export declare const initServiceEvents: (props: EditorProps, emit: ((event: 'props-panel-mounted', instance: InstanceType<typeof PropsPanel>) => void) & ((event: 'update:modelValue', value: MApp | null) => void), { editorService, codeBlockService, dataSourceService, depService }: Services) => void;
|
|
@@ -9,12 +9,14 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
9
9
|
} | undefined;
|
|
10
10
|
height?: string | undefined;
|
|
11
11
|
autoSave?: boolean | undefined;
|
|
12
|
+
parse?: boolean | undefined;
|
|
12
13
|
}>, {
|
|
13
14
|
autoSave: boolean;
|
|
14
15
|
language: string;
|
|
15
16
|
options: () => {
|
|
16
17
|
tabSize: number;
|
|
17
18
|
};
|
|
19
|
+
parse: boolean;
|
|
18
20
|
}>, {
|
|
19
21
|
values: import("vue").Ref<string>;
|
|
20
22
|
getEditor(): monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor | null;
|
|
@@ -33,12 +35,14 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
33
35
|
} | undefined;
|
|
34
36
|
height?: string | undefined;
|
|
35
37
|
autoSave?: boolean | undefined;
|
|
38
|
+
parse?: boolean | undefined;
|
|
36
39
|
}>, {
|
|
37
40
|
autoSave: boolean;
|
|
38
41
|
language: string;
|
|
39
42
|
options: () => {
|
|
40
43
|
tabSize: number;
|
|
41
44
|
};
|
|
45
|
+
parse: boolean;
|
|
42
46
|
}>>> & {
|
|
43
47
|
onInitd?: ((...args: any[]) => any) | undefined;
|
|
44
48
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -48,6 +52,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
48
52
|
};
|
|
49
53
|
language: string;
|
|
50
54
|
autoSave: boolean;
|
|
55
|
+
parse: boolean;
|
|
51
56
|
}, {}>;
|
|
52
57
|
export default _default;
|
|
53
58
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
nav?(_: {}): any;
|
|
4
|
-
"content-before"?(_: {}): any;
|
|
5
|
-
"src-code"?(_: {}): any;
|
|
6
|
-
sidebar?(_: {}): any;
|
|
7
|
-
workspace?(_: {}): any;
|
|
8
|
-
empty?(_: {}): any;
|
|
9
|
-
"props-panel"?(_: {}): any;
|
|
10
|
-
"content-after"?(_: {}): any;
|
|
11
|
-
footer?(_: {}): any;
|
|
12
|
-
}>;
|
|
1
|
+
import type { FrameworkSlots } from '../type';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, FrameworkSlots>;
|
|
13
3
|
export default _default;
|
|
14
4
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
5
|
new (): {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormState, FormValue } from '@tmagic/form';
|
|
2
|
+
import type { PropsPanelSlots } from '../type';
|
|
2
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
4
|
extendState?: ((state: FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
4
5
|
}>, {
|
|
@@ -265,9 +266,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
265
266
|
extendState?: ((state: FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
266
267
|
}>>> & {
|
|
267
268
|
onMounted?: ((...args: any[]) => any) | undefined;
|
|
268
|
-
}, {}, {}>,
|
|
269
|
-
"props-panel-header"?(_: {}): any;
|
|
270
|
-
}>;
|
|
269
|
+
}, {}, {}>, PropsPanelSlots>;
|
|
271
270
|
export default _default;
|
|
272
271
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
273
272
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>,
|
|
3
|
-
"component-list-panel-header"?(_: {}): any;
|
|
4
|
-
"component-list-item"?(_: {
|
|
5
|
-
component: ComponentItem;
|
|
6
|
-
}): any;
|
|
7
|
-
}>;
|
|
1
|
+
import { ComponentListPanelSlots } from '../../type';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, ComponentListPanelSlots>;
|
|
8
3
|
export default _default;
|
|
9
4
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
10
5
|
new (): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MenuButton, MenuComponent } from '../../type';
|
|
1
|
+
import type { MenuButton, MenuComponent, SidebarSlots } from '../../type';
|
|
2
2
|
import { SideBarData } from '../../type';
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
data: SideBarData;
|
|
@@ -22,22 +22,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
22
22
|
};
|
|
23
23
|
}>>>, {
|
|
24
24
|
data: SideBarData;
|
|
25
|
-
}, {}>,
|
|
26
|
-
"component-list-panel-header"?(_: {}): any;
|
|
27
|
-
"component-list-item"?(_: {
|
|
28
|
-
component: any;
|
|
29
|
-
}): any;
|
|
30
|
-
"layer-panel-header"?(_: {}): any;
|
|
31
|
-
"code-block-panel-header"?(_: {}): any;
|
|
32
|
-
"code-block-panel-tool"?(_: {
|
|
33
|
-
id: any;
|
|
34
|
-
data: any;
|
|
35
|
-
}): any;
|
|
36
|
-
"layer-node-content"?(_: {
|
|
37
|
-
data: any;
|
|
38
|
-
node: any;
|
|
39
|
-
}): any;
|
|
40
|
-
}>;
|
|
25
|
+
}, {}>, SidebarSlots>;
|
|
41
26
|
export default _default;
|
|
42
27
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
43
28
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type { Id } from '@tmagic/schema';
|
|
2
|
-
import { CodeDeleteErrorType } from '../../../type';
|
|
2
|
+
import { CodeBlockListSlots, CodeDeleteErrorType } from '../../../type';
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
customError?: ((id: Id, errorType: CodeDeleteErrorType) => any) | undefined;
|
|
5
5
|
}>, {
|
|
6
6
|
filter(val: string): void;
|
|
7
7
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
8
8
|
customError?: ((id: Id, errorType: CodeDeleteErrorType) => any) | undefined;
|
|
9
|
-
}>>>, {}, {}>,
|
|
10
|
-
"code-block-panel-tool"?(_: {
|
|
11
|
-
id: any;
|
|
12
|
-
data: any;
|
|
13
|
-
}): any;
|
|
14
|
-
}>;
|
|
9
|
+
}>>>, {}, {}>, CodeBlockListSlots>;
|
|
15
10
|
export default _default;
|
|
16
11
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
12
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { Id } from '@tmagic/schema';
|
|
2
|
-
import type { CodeDeleteErrorType } from '../../../type';
|
|
2
|
+
import type { CodeBlockListPanelSlots, CodeDeleteErrorType } from '../../../type';
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
customError?: ((id: Id, errorType: CodeDeleteErrorType) => any) | undefined;
|
|
5
5
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
6
6
|
customError?: ((id: Id, errorType: CodeDeleteErrorType) => any) | undefined;
|
|
7
|
-
}>>>, {}, {}>,
|
|
8
|
-
"code-block-panel-header"?(_: {}): any;
|
|
9
|
-
"code-block-panel-search"?(_: {}): any;
|
|
10
|
-
"code-block-panel-tool"?(_: {
|
|
11
|
-
id: any;
|
|
12
|
-
data: any;
|
|
13
|
-
}): any;
|
|
14
|
-
}>;
|
|
7
|
+
}>>>, {}, {}>, CodeBlockListPanelSlots>;
|
|
15
8
|
export default _default;
|
|
16
9
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
17
10
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MenuButton, MenuComponent } from '
|
|
1
|
+
import type { MenuButton, MenuComponent } from '../../../type';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
4
4
|
}>, {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { MContainer, MNode } from '@tmagic/schema';
|
|
2
|
+
import type { LayerNodeSlots } from '../../../type';
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
data: MNode;
|
|
5
|
+
parent?: MContainer | undefined;
|
|
6
|
+
indent?: number | undefined;
|
|
7
|
+
filterText?: string | undefined;
|
|
8
|
+
isCtrlKeyDown?: boolean | undefined;
|
|
9
|
+
}>, {
|
|
10
|
+
indent: number;
|
|
11
|
+
filterText: string;
|
|
12
|
+
isCtrlKeyDown: boolean;
|
|
13
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
14
|
+
data: MNode;
|
|
15
|
+
parent?: MContainer | undefined;
|
|
16
|
+
indent?: number | undefined;
|
|
17
|
+
filterText?: string | undefined;
|
|
18
|
+
isCtrlKeyDown?: boolean | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
indent: number;
|
|
21
|
+
filterText: string;
|
|
22
|
+
isCtrlKeyDown: boolean;
|
|
23
|
+
}>>>, {
|
|
24
|
+
filterText: string;
|
|
25
|
+
indent: number;
|
|
26
|
+
isCtrlKeyDown: boolean;
|
|
27
|
+
}, {}>, LayerNodeSlots>;
|
|
28
|
+
export default _default;
|
|
29
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
30
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
31
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
32
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
33
|
+
} : {
|
|
34
|
+
type: import('vue').PropType<T[K]>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
type __VLS_WithDefaults<P, D> = {
|
|
39
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
40
|
+
default: D[K];
|
|
41
|
+
}> : P[K];
|
|
42
|
+
};
|
|
43
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type __VLS_Prettify<T> = {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MNode } from '@tmagic/schema';
|
|
1
|
+
import type { MNode } from '@tmagic/schema';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
data: MNode;
|
|
4
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { MenuButton, MenuComponent } from '
|
|
1
|
+
import type { LayerPanelSlots, MenuButton, MenuComponent } from '../../../type';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
4
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
5
5
|
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
6
|
-
}>>>, {}, {}>,
|
|
7
|
-
"layer-panel-header"?(_: {}): any;
|
|
8
|
-
"layer-node-content"?(_: {
|
|
9
|
-
node: any;
|
|
10
|
-
data: any;
|
|
11
|
-
}): any;
|
|
12
|
-
}>;
|
|
6
|
+
}>>>, {}, {}>, LayerPanelSlots>;
|
|
13
7
|
export default _default;
|
|
14
8
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
9
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MNode } from '@tmagic/schema';
|
|
2
|
+
import { type Services } from '../../../type';
|
|
3
|
+
export declare type NodeDropType = 'before' | 'after' | 'inner' | 'none';
|
|
4
|
+
/**
|
|
5
|
+
* dragstart/dragleave/dragend 属于源节点
|
|
6
|
+
* dragover 属于目标节点
|
|
7
|
+
* 这些方法并不是同一个dom事件触发的
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDrag: (services: Services | undefined) => {
|
|
10
|
+
handleDragStart: (event: DragEvent) => void;
|
|
11
|
+
handleDragEnd: (event: DragEvent, node: MNode) => void;
|
|
12
|
+
handleDragLeave: (event: DragEvent) => void;
|
|
13
|
+
handleDragOver: (event: DragEvent) => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
import { Id, MPage } from '@tmagic/schema';
|
|
3
|
+
import { LayerNodeStatus } from '../../../type';
|
|
4
|
+
export declare const updateStatus: (nodeStatusMap: Map<Id, LayerNodeStatus>, id: Id, status: Partial<LayerNodeStatus>) => void;
|
|
5
|
+
export declare const useFilter: (nodeStatusMap: ComputedRef<Map<Id, LayerNodeStatus> | undefined>, page: ComputedRef<MPage | null | undefined>) => {
|
|
6
|
+
filterText: import("vue").Ref<string>;
|
|
7
|
+
filterTextChangeHandler(text: string): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
import type { Id, MPage } from '@tmagic/schema';
|
|
3
|
+
import { LayerNodeStatus, Services } from '../../../type';
|
|
4
|
+
export declare const useNodeStatus: (services: Services | undefined, page: ComputedRef<MPage | null | undefined>) => {
|
|
5
|
+
nodeStatusMaps: import("vue").Ref<Map<Id, Map<Id, LayerNodeStatus>>>;
|
|
6
|
+
nodeStatusMap: ComputedRef<Map<Id, LayerNodeStatus> | undefined>;
|
|
7
|
+
};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { MenuButton, MenuComponent } from '../../type';
|
|
1
|
+
import type { MenuButton, MenuComponent, WorkspaceSlots } from '../../type';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
4
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
5
5
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
6
|
-
}>>>, {}, {}>,
|
|
7
|
-
stage?(_: {}): any;
|
|
8
|
-
"workspace-content"?(_: {}): any;
|
|
9
|
-
"page-bar-title"?(_: {
|
|
10
|
-
page: import("@tmagic/schema").MPage;
|
|
11
|
-
}): any;
|
|
12
|
-
"page-bar-popover"?(_: {
|
|
13
|
-
page: import("@tmagic/schema").MPage;
|
|
14
|
-
}): any;
|
|
15
|
-
}>;
|
|
6
|
+
}>>>, {}, {}>, WorkspaceSlots>;
|
|
16
7
|
export default _default;
|
|
17
8
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
18
9
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuButton, MenuComponent } from '../../../type';
|
|
1
|
+
import { type MenuButton, type MenuComponent } from '../../../type';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
4
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -10,6 +10,7 @@ interface State {
|
|
|
10
10
|
configs: Record<string, FormConfig>;
|
|
11
11
|
values: Record<string, Partial<DataSourceSchema>>;
|
|
12
12
|
events: Record<string, EventOption[]>;
|
|
13
|
+
methods: Record<string, EventOption[]>;
|
|
13
14
|
}
|
|
14
15
|
type StateKey = keyof State;
|
|
15
16
|
declare class DataSource extends BaseService {
|
|
@@ -22,6 +23,8 @@ declare class DataSource extends BaseService {
|
|
|
22
23
|
setFormValue(type: string, value: Partial<DataSourceSchema>): void;
|
|
23
24
|
getFormEvent(type?: string): EventOption[];
|
|
24
25
|
setFormEvent(type: string, value?: EventOption[]): void;
|
|
26
|
+
getFormMethod(type?: string): EventOption[];
|
|
27
|
+
setFormMethod(type: string, value?: EventOption[]): void;
|
|
25
28
|
add(config: DataSourceSchema): void;
|
|
26
29
|
update(config: DataSourceSchema): void;
|
|
27
30
|
remove(id: string): void;
|
|
@@ -122,6 +122,7 @@ declare class Editor extends BaseService {
|
|
|
122
122
|
* @param targetId 容器ID
|
|
123
123
|
*/
|
|
124
124
|
moveToContainer(config: MNode, targetId: Id): Promise<MNode | undefined>;
|
|
125
|
+
dragTo(config: MNode, targetParent: MContainer, targetIndex: number): Promise<void>;
|
|
125
126
|
/**
|
|
126
127
|
* 撤销当前操作
|
|
127
128
|
* @returns 上一次数据
|
package/types/type.d.ts
CHANGED
|
@@ -15,6 +15,56 @@ import type { PropsService } from './services/props';
|
|
|
15
15
|
import type { StorageService } from './services/storage';
|
|
16
16
|
import type { UiService } from './services/ui';
|
|
17
17
|
import type { UndoRedo } from './utils/undo-redo';
|
|
18
|
+
export interface FrameworkSlots {
|
|
19
|
+
header(props: {}): any;
|
|
20
|
+
nav(props: {}): any;
|
|
21
|
+
'content-before'(props: {}): any;
|
|
22
|
+
'content-after'(props: {}): any;
|
|
23
|
+
'src-code'(props: {}): any;
|
|
24
|
+
sidebar(props: {}): any;
|
|
25
|
+
empty(props: {}): any;
|
|
26
|
+
workspace(props: {}): any;
|
|
27
|
+
'props-panel'(props: {}): any;
|
|
28
|
+
'footer'(props: {}): any;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkspaceSlots {
|
|
31
|
+
stage(props: {}): any;
|
|
32
|
+
'workspace-content'(props: {}): any;
|
|
33
|
+
'page-bar-title'(props: {
|
|
34
|
+
page: MPage;
|
|
35
|
+
}): any;
|
|
36
|
+
'page-bar-popover'(props: {
|
|
37
|
+
page: MPage;
|
|
38
|
+
}): any;
|
|
39
|
+
}
|
|
40
|
+
export interface ComponentListPanelSlots {
|
|
41
|
+
'component-list-panel-header'(props: {}): any;
|
|
42
|
+
'component-list-item'(props: {
|
|
43
|
+
component: ComponentItem;
|
|
44
|
+
}): any;
|
|
45
|
+
}
|
|
46
|
+
export interface CodeBlockListPanelSlots extends CodeBlockListSlots {
|
|
47
|
+
'code-block-panel-search'(props: {}): any;
|
|
48
|
+
'code-block-panel-header'(props: {}): any;
|
|
49
|
+
}
|
|
50
|
+
export interface CodeBlockListSlots {
|
|
51
|
+
'code-block-panel-tool'(props: {
|
|
52
|
+
id: Id;
|
|
53
|
+
data: CodeBlockContent;
|
|
54
|
+
}): any;
|
|
55
|
+
}
|
|
56
|
+
export interface LayerNodeSlots {
|
|
57
|
+
'layer-node-content'(props: {
|
|
58
|
+
data: MNode;
|
|
59
|
+
}): any;
|
|
60
|
+
}
|
|
61
|
+
export interface LayerPanelSlots extends LayerNodeSlots {
|
|
62
|
+
'layer-panel-header'(props: {}): any;
|
|
63
|
+
}
|
|
64
|
+
export interface PropsPanelSlots {
|
|
65
|
+
'props-panel-header'(props: {}): any;
|
|
66
|
+
}
|
|
67
|
+
export type SidebarSlots = LayerPanelSlots & CodeBlockListPanelSlots & ComponentListPanelSlots;
|
|
18
68
|
export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
|
|
19
69
|
export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
|
|
20
70
|
export interface InstallOptions {
|
|
@@ -418,6 +468,7 @@ export interface DataSourceMethodSelectConfig {
|
|
|
418
468
|
export interface DataSourceFieldSelectConfig {
|
|
419
469
|
type: 'data-source-field-select';
|
|
420
470
|
name: string;
|
|
471
|
+
value?: 'key' | 'value';
|
|
421
472
|
labelWidth?: number | string;
|
|
422
473
|
disabled?: boolean | FilterFunction;
|
|
423
474
|
display?: boolean | FilterFunction;
|
|
@@ -437,3 +488,12 @@ export interface DatasourceTypeOption {
|
|
|
437
488
|
type: string;
|
|
438
489
|
text: string;
|
|
439
490
|
}
|
|
491
|
+
export interface LayerNodeStatus {
|
|
492
|
+
visible: boolean;
|
|
493
|
+
expand: boolean;
|
|
494
|
+
selected: boolean;
|
|
495
|
+
}
|
|
496
|
+
export declare enum DragType {
|
|
497
|
+
COMPONENT_LIST = "component-list",
|
|
498
|
+
LAYER_TREE = "layer-tree"
|
|
499
|
+
}
|
package/types/utils/dep.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeBlockContent, Id } from '@tmagic/schema';
|
|
1
|
+
import { type CodeBlockContent, type Id } from '@tmagic/schema';
|
|
2
2
|
import { Target } from '../services/dep';
|
|
3
3
|
export declare const createCodeBlockTarget: (id: Id, codeBlock: CodeBlockContent) => Target;
|
|
4
4
|
export declare const createDataSourceTarget: (id: Id) => Target;
|
package/types/utils/editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
1
|
+
import type { Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
|
|
2
2
|
import type StageCore from '@tmagic/stage';
|
|
3
3
|
import { Layout } from '../type';
|
|
4
4
|
export declare const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
@@ -31,7 +31,7 @@ export declare const generatePageNameByApp: (app: MApp) => string;
|
|
|
31
31
|
* @returns {boolean}
|
|
32
32
|
*/
|
|
33
33
|
export declare const isFixed: (node: MNode) => boolean;
|
|
34
|
-
export declare const getNodeIndex: (
|
|
34
|
+
export declare const getNodeIndex: (id: Id, parent: MContainer | MApp) => number;
|
|
35
35
|
export declare const getRelativeStyle: (style?: Record<string, any>) => Record<string, any>;
|
|
36
36
|
export declare const getInitPositionStyle: (style: Record<string, any> | undefined, layout: Layout) => Record<string, any>;
|
|
37
37
|
export declare const setLayout: (node: MNode, layout: Layout) => MNode;
|
|
@@ -46,3 +46,4 @@ export declare const fixNodePosition: (config: MNode, parent: MContainer, stage:
|
|
|
46
46
|
[key: string]: any;
|
|
47
47
|
} | undefined;
|
|
48
48
|
export declare const serializeConfig: (config: any) => string;
|
|
49
|
+
export declare const traverseNode: (node: MNode, cb: (node: MNode, parents: MNode[]) => void, parents?: MNode[]) => void;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
{{ `${data.name} (${data.id})` }}
|
|
4
|
-
</div>
|
|
5
|
-
<div class="layer-node-tool">
|
|
6
|
-
<template v-if="data.type !== 'page'">
|
|
7
|
-
<el-icon v-if="data.visible === false" @click.stop="setNodeVisible(true)" title="点击显示">
|
|
8
|
-
<Hide />
|
|
9
|
-
</el-icon>
|
|
10
|
-
<el-icon v-else @click.stop="setNodeVisible(false)" class="node-lock" title="点击隐藏">
|
|
11
|
-
<View />
|
|
12
|
-
</el-icon>
|
|
13
|
-
</template>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script lang="ts" setup>
|
|
18
|
-
import { inject } from 'vue';
|
|
19
|
-
import { Hide, View } from '@element-plus/icons-vue';
|
|
20
|
-
|
|
21
|
-
import { MNode } from '@tmagic/schema';
|
|
22
|
-
|
|
23
|
-
import { Services } from '@editor/type';
|
|
24
|
-
|
|
25
|
-
const props = defineProps<{
|
|
26
|
-
data: MNode;
|
|
27
|
-
}>();
|
|
28
|
-
|
|
29
|
-
const services = inject<Services>('services');
|
|
30
|
-
const editorService = services?.editorService;
|
|
31
|
-
|
|
32
|
-
const setNodeVisible = (visible: boolean) => {
|
|
33
|
-
if (!editorService) return;
|
|
34
|
-
|
|
35
|
-
editorService.update({
|
|
36
|
-
id: props.data.id,
|
|
37
|
-
visible,
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
</script>
|