@tmagic/editor 1.3.0-beta.1 → 1.3.0-beta.3

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.
Files changed (81) hide show
  1. package/dist/style.css +67 -75
  2. package/dist/tmagic-editor.js +1667 -1062
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +1692 -1084
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +10 -10
  7. package/src/Editor.vue +70 -65
  8. package/src/components/ContentMenu.vue +5 -1
  9. package/src/components/SearchInput.vue +5 -1
  10. package/src/components/ToolButton.vue +1 -1
  11. package/src/editorProps.ts +51 -129
  12. package/src/fields/Code.vue +9 -3
  13. package/src/fields/DataSourceFieldSelect.vue +28 -16
  14. package/src/fields/DataSourceFields.vue +95 -7
  15. package/src/fields/DataSourceMethodSelect.vue +23 -14
  16. package/src/fields/DataSourceMocks.vue +237 -0
  17. package/src/fields/EventSelect.vue +30 -11
  18. package/src/index.ts +4 -1
  19. package/src/initService.ts +50 -20
  20. package/src/layouts/CodeEditor.vue +20 -4
  21. package/src/layouts/Framework.vue +3 -1
  22. package/src/layouts/PropsPanel.vue +3 -1
  23. package/src/layouts/sidebar/ComponentListPanel.vue +18 -8
  24. package/src/layouts/sidebar/Sidebar.vue +7 -10
  25. package/src/layouts/sidebar/code-block/CodeBlockList.vue +3 -1
  26. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +3 -1
  27. package/src/layouts/sidebar/layer/LayerNode.vue +206 -0
  28. package/src/layouts/sidebar/layer/LayerNodeTool.vue +32 -0
  29. package/src/layouts/sidebar/layer/LayerPanel.vue +85 -0
  30. package/src/layouts/sidebar/layer/use-drag.ts +157 -0
  31. package/src/layouts/sidebar/layer/use-filter.ts +70 -0
  32. package/src/layouts/sidebar/layer/use-keybinding.ts +47 -0
  33. package/src/layouts/sidebar/layer/use-node-status.ts +103 -0
  34. package/src/layouts/workspace/Workspace.vue +3 -1
  35. package/src/layouts/workspace/viewer/NodeListMenu.vue +16 -9
  36. package/src/layouts/workspace/viewer/Stage.vue +19 -17
  37. package/src/layouts/workspace/viewer/ViewerMenu.vue +1 -1
  38. package/src/services/dataSource.ts +21 -0
  39. package/src/services/editor.ts +45 -5
  40. package/src/theme/common/var.scss +2 -2
  41. package/src/theme/content-menu.scss +22 -20
  42. package/src/theme/framework.scss +2 -0
  43. package/src/theme/layer-panel.scss +63 -63
  44. package/src/theme/props-panel.scss +8 -0
  45. package/src/theme/sidebar.scss +1 -5
  46. package/src/type.ts +61 -0
  47. package/src/utils/data-source/index.ts +23 -0
  48. package/src/utils/dep.ts +26 -11
  49. package/src/utils/editor.ts +14 -3
  50. package/src/utils/props.ts +4 -0
  51. package/types/editorProps.d.ts +61 -107
  52. package/types/fields/Code.vue.d.ts +10 -6
  53. package/types/fields/DataSourceMocks.vue.d.ts +32 -0
  54. package/types/index.d.ts +2 -1
  55. package/types/initService.d.ts +5 -4
  56. package/types/layouts/CodeEditor.vue.d.ts +5 -0
  57. package/types/layouts/Framework.vue.d.ts +2 -12
  58. package/types/layouts/PropsPanel.vue.d.ts +2 -3
  59. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -7
  60. package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -17
  61. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +2 -7
  62. package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +2 -9
  63. package/types/layouts/sidebar/{LayerMenu.vue.d.ts → layer/LayerMenu.vue.d.ts} +1 -1
  64. package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +50 -0
  65. package/types/layouts/sidebar/{LayerNode.vue.d.ts → layer/LayerNodeTool.vue.d.ts} +1 -1
  66. package/types/layouts/sidebar/{LayerPanel.vue.d.ts → layer/LayerPanel.vue.d.ts} +2 -8
  67. package/types/layouts/sidebar/layer/use-drag.d.ts +14 -0
  68. package/types/layouts/sidebar/layer/use-filter.d.ts +8 -0
  69. package/types/layouts/sidebar/layer/use-keybinding.d.ts +4 -0
  70. package/types/layouts/sidebar/layer/use-node-status.d.ts +7 -0
  71. package/types/layouts/workspace/Workspace.vue.d.ts +2 -11
  72. package/types/layouts/workspace/viewer/Stage.vue.d.ts +1 -1
  73. package/types/services/dataSource.d.ts +7 -0
  74. package/types/services/editor.d.ts +1 -0
  75. package/types/type.d.ts +61 -0
  76. package/types/utils/dep.d.ts +1 -1
  77. package/types/utils/editor.d.ts +3 -2
  78. package/src/layouts/sidebar/LayerNode.vue +0 -40
  79. package/src/layouts/sidebar/LayerPanel.vue +0 -369
  80. package/types/Editor.vue.d.ts +0 -233
  81. /package/src/layouts/sidebar/{LayerMenu.vue → layer/LayerMenu.vue} +0 -0
@@ -1,127 +1,81 @@
1
- import type { PropType } from 'vue';
2
1
  import type { EventOption } from '@tmagic/core';
3
2
  import type { FormConfig, FormState } from '@tmagic/form';
4
- import type { DataSourceSchema, MApp, MNode } from '@tmagic/schema';
3
+ import type { DataSourceSchema, Id, MApp, MNode } from '@tmagic/schema';
5
4
  import StageCore, { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
6
5
  import type { ComponentGroup, DatasourceTypeOption, MenuBarData, MenuButton, MenuComponent, SideBarData, StageRect } from './type';
7
- declare const _default: {
6
+ export interface EditorProps {
8
7
  /** 页面初始值 */
9
- modelValue: {
10
- type: PropType<MApp>;
11
- default: () => {};
12
- require: boolean;
13
- };
14
- /** 左侧面板中的组件列表 */
15
- componentGroupList: {
16
- type: PropType<ComponentGroup[]>;
17
- default: () => never[];
18
- };
19
- /** 左侧面板中的组件列表 */
20
- datasourceList: {
21
- type: PropType<DatasourceTypeOption[]>;
22
- default: () => never[];
23
- };
8
+ modelValue?: MApp;
9
+ /** 左侧面板中的组件类型列表 */
10
+ componentGroupList?: ComponentGroup[];
11
+ /** 左侧面板中的数据源类型列表 */
12
+ datasourceList?: DatasourceTypeOption[];
24
13
  /** 左侧面板配置 */
25
- sidebar: {
26
- type: PropType<SideBarData>;
27
- };
14
+ sidebar?: SideBarData;
28
15
  /** 顶部工具栏配置 */
29
- menu: {
30
- type: PropType<MenuBarData>;
31
- default: () => {
32
- left: never[];
33
- right: never[];
34
- };
35
- };
16
+ menu?: MenuBarData;
36
17
  /** 组件树右键菜单 */
37
- layerContentMenu: {
38
- type: PropType<(MenuButton | MenuComponent)[]>;
39
- default: () => never[];
40
- };
18
+ layerContentMenu?: (MenuButton | MenuComponent)[];
41
19
  /** 画布右键菜单 */
42
- stageContentMenu: {
43
- type: PropType<(MenuButton | MenuComponent)[]>;
44
- default: () => never[];
45
- };
20
+ stageContentMenu?: (MenuButton | MenuComponent)[];
46
21
  /** 中间工作区域中画布渲染的内容 */
47
- render: {
48
- type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
49
- };
22
+ render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
50
23
  /** 中间工作区域中画布通过iframe渲染时的页面url */
51
- runtimeUrl: StringConstructor;
24
+ runtimeUrl?: string;
52
25
  /** 选中时是否自动滚动到可视区域 */
53
- autoScrollIntoView: BooleanConstructor;
26
+ autoScrollIntoView?: boolean;
54
27
  /** 组件的属性配置表单的dsl */
55
- propsConfigs: {
56
- type: PropType<Record<string, FormConfig>>;
57
- default: () => {};
58
- };
28
+ propsConfigs?: Record<string, FormConfig>;
59
29
  /** 添加组件时的默认值 */
60
- propsValues: {
61
- type: PropType<Record<string, Partial<MNode>>>;
62
- default: () => {};
63
- };
30
+ propsValues?: Record<string, Partial<MNode>>;
64
31
  /** 组件联动事件选项列表 */
65
- eventMethodList: {
66
- type: PropType<Record<string, {
67
- events: EventOption[];
68
- methods: EventOption[];
69
- }>>;
70
- default: () => {};
71
- };
32
+ eventMethodList?: Record<string, {
33
+ events: EventOption[];
34
+ methods: EventOption[];
35
+ }>;
72
36
  /** 添加数据源时的默认值 */
73
- datasourceValues: {
74
- type: PropType<Record<string, Partial<DataSourceSchema>>>;
75
- default: () => {};
76
- };
37
+ datasourceValues?: Record<string, Partial<DataSourceSchema>>;
77
38
  /** 数据源的属性配置表单的dsl */
78
- datasourceConfigs: {
79
- type: PropType<Record<string, FormConfig>>;
80
- default: () => {};
81
- };
39
+ datasourceConfigs?: Record<string, FormConfig>;
40
+ datasourceEventMethodList?: Record<string, {
41
+ events: EventOption[];
42
+ methods: EventOption[];
43
+ }>;
82
44
  /** 画布中组件选中框的移动范围 */
83
- moveableOptions: {
84
- type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
85
- };
45
+ moveableOptions?: MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions);
86
46
  /** 编辑器初始化时默认选中的组件ID */
87
- defaultSelected: {
88
- type: (NumberConstructor | StringConstructor)[];
89
- };
90
- canSelect: {
91
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
92
- default: (el: HTMLElement) => boolean;
93
- };
94
- isContainer: {
95
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
96
- default: (el: HTMLElement) => boolean;
97
- };
98
- containerHighlightClassName: {
99
- type: StringConstructor;
100
- default: string;
101
- };
102
- containerHighlightDuration: {
103
- type: NumberConstructor;
104
- default: number;
105
- };
106
- containerHighlightType: {
107
- type: PropType<ContainerHighlightType>;
108
- default: ContainerHighlightType;
109
- };
110
- stageRect: {
111
- type: PropType<StageRect>;
112
- };
113
- codeOptions: {
114
- type: ObjectConstructor;
115
- default: () => {};
116
- };
117
- updateDragEl: {
118
- type: PropType<UpdateDragEl>;
119
- };
120
- disabledDragStart: {
121
- type: BooleanConstructor;
122
- };
123
- extendFormState: {
124
- type: PropType<(state: FormState) => Record<string, any> | Promise<Record<string, any>>>;
125
- };
47
+ defaultSelected?: Id;
48
+ canSelect?: (el: HTMLElement) => boolean | Promise<boolean>;
49
+ isContainer?: (el: HTMLElement) => boolean | Promise<boolean>;
50
+ containerHighlightClassName?: string;
51
+ containerHighlightDuration?: number;
52
+ containerHighlightType?: ContainerHighlightType;
53
+ stageRect?: StageRect;
54
+ codeOptions?: {
55
+ [key: string]: any;
56
+ };
57
+ updateDragEl?: UpdateDragEl;
58
+ disabledDragStart?: boolean;
59
+ extendFormState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
60
+ }
61
+ export declare const defaultEditorProps: {
62
+ componentGroupList: () => never[];
63
+ datasourceList: () => never[];
64
+ menu: () => {
65
+ left: never[];
66
+ right: never[];
67
+ };
68
+ layerContentMenu: () => never[];
69
+ stageContentMenu: () => never[];
70
+ propsConfigs: () => {};
71
+ propsValues: () => {};
72
+ eventMethodList: () => {};
73
+ datasourceValues: () => {};
74
+ datasourceConfigs: () => {};
75
+ canSelect: (el: HTMLElement) => boolean;
76
+ isContainer: (el: HTMLElement) => boolean;
77
+ containerHighlightClassName: string;
78
+ containerHighlightDuration: number;
79
+ containerHighlightType: ContainerHighlightType;
80
+ codeOptions: () => {};
126
81
  };
127
- export default _default;
@@ -1,19 +1,23 @@
1
1
  import type { FieldProps } from '@tmagic/form';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
3
3
  language?: string | undefined;
4
- options?: Object | undefined;
4
+ options?: {
5
+ [key: string]: any;
6
+ } | undefined;
5
7
  height?: string | undefined;
8
+ parse?: boolean | undefined;
6
9
  }>>, {
7
10
  disabled: boolean;
8
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
11
+ }>, {}, 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<FieldProps<{
9
12
  language?: string | undefined;
10
- options?: Object | undefined;
13
+ options?: {
14
+ [key: string]: any;
15
+ } | undefined;
11
16
  height?: string | undefined;
17
+ parse?: boolean | undefined;
12
18
  }>>, {
13
19
  disabled: boolean;
14
- }>>> & {
15
- onChange?: ((...args: any[]) => any) | undefined;
16
- }, {
20
+ }>>>, {
17
21
  disabled: boolean;
18
22
  }, {}>;
19
23
  export default _default;
@@ -0,0 +1,32 @@
1
+ import { type FieldProps } from '@tmagic/form';
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
3
+ type: "data-source-mocks";
4
+ }>>, {
5
+ disabled: boolean;
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps<{
7
+ type: "data-source-mocks";
8
+ }>>, {
9
+ disabled: boolean;
10
+ }>>> & {
11
+ onChange?: ((...args: any[]) => any) | undefined;
12
+ }, {
13
+ disabled: boolean;
14
+ }, {}>;
15
+ export default _default;
16
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
17
+ type __VLS_TypePropsToRuntimeProps<T> = {
18
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
19
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
20
+ } : {
21
+ type: import('vue').PropType<T[K]>;
22
+ required: true;
23
+ };
24
+ };
25
+ type __VLS_WithDefaults<P, D> = {
26
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
27
+ default: D[K];
28
+ }> : P[K];
29
+ };
30
+ type __VLS_Prettify<T> = {
31
+ [K in keyof T]: T[K];
32
+ } & {};
package/types/index.d.ts CHANGED
@@ -18,10 +18,11 @@ export { default as uiService } from './services/ui';
18
18
  export { default as codeBlockService } from './services/codeBlock';
19
19
  export { default as depService } from './services/dep';
20
20
  export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
21
- export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
21
+ export { default as LayerPanel } from './layouts/sidebar/layer/LayerPanel.vue';
22
22
  export { default as CodeSelect } from './fields/CodeSelect.vue';
23
23
  export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
24
24
  export { default as DataSourceFields } from './fields/DataSourceFields.vue';
25
+ export { default as DataSourceMocks } from './fields/DataSourceMocks.vue';
25
26
  export { default as DataSourceMethods } from './fields/DataSourceMethods.vue';
26
27
  export { default as DataSourceInput } from './fields/DataSourceInput.vue';
27
28
  export { default as DataSourceSelect } from './fields/DataSourceSelect.vue';
@@ -1,8 +1,9 @@
1
- import type { ExtractPropTypes } from 'vue';
2
- import editorProps from './editorProps';
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: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, keybindingService, dataSourceService, }: Services) => void;
8
- export declare const initServiceEvents: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, emit: (event: 'props-panel-mounted' | 'update:modelValue', ...args: any[]) => void, { editorService, codeBlockService, dataSourceService, depService }: Services) => void;
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
- 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<{}>>, {}, {}>, {
2
- header?(_: {}): any;
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 type { ComponentItem } 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<{}>>, {}, {}>, {
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 '../../type';
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 '../../type';
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,4 @@
1
+ import type { Services } from '../../../type';
2
+ export declare const useKeybinding: (services: Services | undefined) => {
3
+ isCtrlKeyDown: import("vue").Ref<boolean>;
4
+ };
@@ -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<{
@@ -1,3 +1,4 @@
1
+ import type { EventOption } from '@tmagic/core';
1
2
  import type { FormConfig } from '@tmagic/form';
2
3
  import type { DataSourceSchema } from '@tmagic/schema';
3
4
  import type { DatasourceTypeOption } from '../type';
@@ -8,6 +9,8 @@ interface State {
8
9
  editable: boolean;
9
10
  configs: Record<string, FormConfig>;
10
11
  values: Record<string, Partial<DataSourceSchema>>;
12
+ events: Record<string, EventOption[]>;
13
+ methods: Record<string, EventOption[]>;
11
14
  }
12
15
  type StateKey = keyof State;
13
16
  declare class DataSource extends BaseService {
@@ -18,6 +21,10 @@ declare class DataSource extends BaseService {
18
21
  setFormConfig(type: string, config: FormConfig): void;
19
22
  getFormValue(type?: string): Partial<DataSourceSchema>;
20
23
  setFormValue(type: string, value: Partial<DataSourceSchema>): void;
24
+ getFormEvent(type?: string): EventOption[];
25
+ setFormEvent(type: string, value?: EventOption[]): void;
26
+ getFormMethod(type?: string): EventOption[];
27
+ setFormMethod(type: string, value?: EventOption[]): void;
21
28
  add(config: DataSourceSchema): void;
22
29
  update(config: DataSourceSchema): void;
23
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 上一次数据