@tmagic/editor 1.3.0-alpha.2 → 1.3.0-alpha.21

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 (167) hide show
  1. package/dist/style.css +91 -120
  2. package/dist/tmagic-editor.js +4609 -3257
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +5708 -4337
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +21 -22
  7. package/src/Editor.vue +29 -7
  8. package/src/components/CodeBlockEditor.vue +170 -0
  9. package/src/components/CodeParams.vue +60 -0
  10. package/src/components/ContentMenu.vue +30 -11
  11. package/src/components/Icon.vue +5 -1
  12. package/src/components/Resizer.vue +45 -0
  13. package/src/components/ScrollBar.vue +5 -1
  14. package/src/components/ScrollViewer.vue +5 -1
  15. package/src/components/SearchInput.vue +4 -0
  16. package/src/components/{Layout.vue → SplitView.vue} +8 -4
  17. package/src/components/ToolButton.vue +5 -1
  18. package/src/editorProps.ts +35 -4
  19. package/src/fields/Code.vue +28 -20
  20. package/src/fields/CodeLink.vue +15 -10
  21. package/src/fields/CodeSelect.vue +19 -10
  22. package/src/fields/CodeSelectCol.vue +67 -83
  23. package/src/fields/DataSourceFieldSelect.vue +47 -0
  24. package/src/fields/DataSourceFields.vue +24 -21
  25. package/src/fields/DataSourceInput.vue +318 -0
  26. package/src/fields/DataSourceMethodSelect.vue +136 -0
  27. package/src/fields/DataSourceMethods.vue +103 -0
  28. package/src/fields/DataSourceSelect.vue +68 -0
  29. package/src/fields/EventSelect.vue +62 -22
  30. package/src/fields/KeyValue.vue +13 -11
  31. package/src/fields/UISelect.vue +59 -15
  32. package/src/hooks/index.ts +21 -0
  33. package/src/hooks/use-code-block-edit.ts +84 -0
  34. package/src/hooks/use-data-source-method.ts +100 -0
  35. package/src/{utils/stage.ts → hooks/use-stage.ts} +4 -7
  36. package/src/icons/AppManageIcon.vue +5 -1
  37. package/src/icons/CenterIcon.vue +13 -0
  38. package/src/icons/CodeIcon.vue +5 -3
  39. package/src/index.ts +24 -3
  40. package/src/initService.ts +75 -16
  41. package/src/layouts/AddPageBox.vue +5 -1
  42. package/src/layouts/CodeEditor.vue +66 -11
  43. package/src/layouts/Framework.vue +32 -28
  44. package/src/layouts/NavMenu.vue +5 -1
  45. package/src/layouts/PropsPanel.vue +14 -4
  46. package/src/layouts/sidebar/ComponentListPanel.vue +11 -10
  47. package/src/layouts/sidebar/LayerMenu.vue +13 -25
  48. package/src/layouts/sidebar/LayerNode.vue +40 -0
  49. package/src/layouts/sidebar/LayerPanel.vue +71 -28
  50. package/src/layouts/sidebar/Sidebar.vue +13 -17
  51. package/src/layouts/sidebar/code-block/CodeBlockList.vue +84 -118
  52. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +63 -0
  53. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +39 -34
  54. package/src/layouts/sidebar/data-source/DataSourceList.vue +145 -0
  55. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +17 -65
  56. package/src/layouts/workspace/Breadcrumb.vue +5 -1
  57. package/src/layouts/workspace/PageBar.vue +5 -1
  58. package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
  59. package/src/layouts/workspace/Stage.vue +30 -8
  60. package/src/layouts/workspace/ViewerMenu.vue +15 -36
  61. package/src/layouts/workspace/Workspace.vue +9 -134
  62. package/src/services/codeBlock.ts +20 -72
  63. package/src/services/dataSource.ts +17 -2
  64. package/src/services/dep.ts +23 -20
  65. package/src/services/editor.ts +3 -3
  66. package/src/services/keybinding.ts +185 -0
  67. package/src/services/props.ts +2 -2
  68. package/src/services/storage.ts +3 -2
  69. package/src/theme/code-block.scss +5 -117
  70. package/src/theme/code-editor.scss +27 -2
  71. package/src/theme/content-menu.scss +1 -1
  72. package/src/theme/data-source-input.scss +18 -0
  73. package/src/theme/data-source-methods.scss +13 -0
  74. package/src/theme/event.scss +15 -12
  75. package/src/theme/framework.scss +0 -3
  76. package/src/theme/layer-panel.scss +6 -0
  77. package/src/theme/layout.scss +4 -0
  78. package/src/theme/resizer.scss +25 -10
  79. package/src/theme/stage.scss +4 -0
  80. package/src/theme/theme.scss +2 -0
  81. package/src/type.ts +105 -7
  82. package/src/utils/config.ts +1 -1
  83. package/src/utils/content-menu.ts +92 -0
  84. package/src/utils/data-source/formConfigs/base.ts +35 -30
  85. package/src/utils/data-source/index.ts +75 -6
  86. package/src/utils/dep.ts +39 -7
  87. package/src/utils/index.ts +1 -1
  88. package/src/utils/keybinding-config.ts +120 -0
  89. package/src/utils/props.ts +298 -155
  90. package/src/utils/undo-redo.ts +1 -1
  91. package/types/Editor.vue.d.ts +37 -4
  92. package/types/components/CodeBlockEditor.vue.d.ts +23 -0
  93. package/types/components/CodeParams.vue.d.ts +26 -0
  94. package/types/components/ContentMenu.vue.d.ts +8 -3
  95. package/types/components/Icon.vue.d.ts +2 -2
  96. package/types/{layouts → components}/Resizer.vue.d.ts +2 -2
  97. package/types/components/ScrollBar.vue.d.ts +1 -1
  98. package/types/components/ScrollViewer.vue.d.ts +8 -5
  99. package/types/components/SearchInput.vue.d.ts +1 -1
  100. package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +9 -6
  101. package/types/components/ToolButton.vue.d.ts +10 -7
  102. package/types/editorProps.d.ts +23 -4
  103. package/types/fields/Code.vue.d.ts +23 -18
  104. package/types/fields/CodeLink.vue.d.ts +13 -22
  105. package/types/fields/CodeSelect.vue.d.ts +12 -20
  106. package/types/fields/CodeSelectCol.vue.d.ts +14 -15
  107. package/types/fields/DataSourceFieldSelect.vue.d.ts +29 -0
  108. package/types/fields/DataSourceFields.vue.d.ts +13 -21
  109. package/types/fields/DataSourceInput.vue.d.ts +34 -0
  110. package/types/fields/DataSourceMethodSelect.vue.d.ts +29 -0
  111. package/types/fields/DataSourceMethods.vue.d.ts +32 -0
  112. package/types/fields/DataSourceSelect.vue.d.ts +40 -0
  113. package/types/fields/EventSelect.vue.d.ts +3 -14
  114. package/types/fields/KeyValue.vue.d.ts +15 -27
  115. package/types/fields/UISelect.vue.d.ts +3 -12
  116. package/types/hooks/index.d.ts +3 -0
  117. package/types/hooks/use-code-block-edit.d.ts +125 -0
  118. package/types/hooks/use-data-source-method.d.ts +123 -0
  119. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  120. package/types/icons/CenterIcon.vue.d.ts +2 -0
  121. package/types/icons/CodeIcon.vue.d.ts +1 -1
  122. package/types/index.d.ts +12 -2
  123. package/types/initService.d.ts +2 -2
  124. package/types/layouts/AddPageBox.vue.d.ts +1 -1
  125. package/types/layouts/CodeEditor.vue.d.ts +18 -10
  126. package/types/layouts/Framework.vue.d.ts +11 -32
  127. package/types/layouts/NavMenu.vue.d.ts +7 -4
  128. package/types/layouts/PropsPanel.vue.d.ts +276 -4
  129. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
  130. package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
  131. package/types/layouts/sidebar/LayerNode.vue.d.ts +16 -0
  132. package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
  133. package/types/layouts/sidebar/Sidebar.vue.d.ts +16 -16
  134. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -12
  135. package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +28 -0
  136. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +4 -2
  137. package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +14 -0
  138. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +1 -11
  139. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  140. package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
  141. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
  142. package/types/layouts/workspace/Stage.vue.d.ts +2 -2
  143. package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
  144. package/types/layouts/workspace/Workspace.vue.d.ts +9 -9
  145. package/types/services/codeBlock.d.ts +6 -37
  146. package/types/services/dataSource.d.ts +7 -1
  147. package/types/services/dep.d.ts +12 -21
  148. package/types/services/editor.d.ts +1 -1
  149. package/types/services/keybinding.d.ts +20 -0
  150. package/types/services/props.d.ts +10 -115
  151. package/types/type.d.ts +97 -7
  152. package/types/utils/config.d.ts +1 -1
  153. package/types/utils/content-menu.d.ts +7 -0
  154. package/types/utils/data-source/formConfigs/base.d.ts +2 -2
  155. package/types/utils/data-source/index.d.ts +7 -1
  156. package/types/utils/dep.d.ts +4 -2
  157. package/types/utils/index.d.ts +1 -1
  158. package/types/utils/keybinding-config.d.ts +3 -0
  159. package/types/utils/props.d.ts +13 -102
  160. package/src/components/CodeDraftEditor.vue +0 -144
  161. package/src/components/FunctionEditor.vue +0 -190
  162. package/src/layouts/Resizer.vue +0 -32
  163. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +0 -96
  164. package/types/components/CodeDraftEditor.vue.d.ts +0 -58
  165. package/types/components/FunctionEditor.vue.d.ts +0 -192
  166. package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +0 -25
  167. /package/types/{utils/stage.d.ts → hooks/use-stage.d.ts} +0 -0
@@ -1,4 +1,5 @@
1
- import { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
1
+ import type { ColumnConfig } from '@tmagic/form';
2
+ import type { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
2
3
  import BaseService from './BaseService';
3
4
  declare class CodeBlock extends BaseService {
4
5
  private state;
@@ -28,36 +29,13 @@ declare class CodeBlock extends BaseService {
28
29
  * @param {CodeBlockContent} codeConfig 代码块内容配置信息
29
30
  * @returns {void}
30
31
  */
31
- setCodeDslById(id: Id, codeConfig: CodeBlockContent): Promise<void>;
32
+ setCodeDslById(id: Id, codeConfig: Partial<CodeBlockContent>): Promise<void>;
32
33
  /**
33
34
  * 根据代码块id数组获取代码dsl
34
35
  * @param {string[]} ids 代码块id数组
35
36
  * @returns {CodeBlockDSL}
36
37
  */
37
38
  getCodeDslByIds(ids: string[]): CodeBlockDSL;
38
- /**
39
- * 设置代码编辑面板展示状态
40
- * @param {boolean} status 是否展示代码编辑面板
41
- * @returns {void}
42
- */
43
- setCodeEditorShowStatus(status: boolean): Promise<void>;
44
- /**
45
- * 获取代码编辑面板展示状态
46
- * @returns {boolean} 是否展示代码编辑面板
47
- */
48
- getCodeEditorShowStatus(): boolean;
49
- /**
50
- * 设置代码编辑面板展示状态及展示内容
51
- * @param {boolean} status 是否展示代码编辑面板
52
- * @param {Id} id 代码块id
53
- * @returns {void}
54
- */
55
- setCodeEditorContent(status: boolean, id: Id): void;
56
- /**
57
- * 获取当前选中的代码块内容
58
- * @returns {CodeBlockContent | null}
59
- */
60
- getCurrentDsl(): CodeBlockContent | null;
61
39
  /**
62
40
  * 获取编辑状态
63
41
  * @returns {boolean} 是否可编辑
@@ -69,17 +47,6 @@ declare class CodeBlock extends BaseService {
69
47
  * @returns {void}
70
48
  */
71
49
  setEditStatus(status: boolean): Promise<void>;
72
- /**
73
- * 设置当前选中的代码块ID
74
- * @param {Id} id 代码块id
75
- * @returns {void}
76
- */
77
- setId(id: Id): void;
78
- /**
79
- * 获取当前选中的代码块ID
80
- * @returns {Id} id 代码块id
81
- */
82
- getId(): Id;
83
50
  /**
84
51
  * 设置当前选中组件已关联绑定的代码块id数组
85
52
  * @param {string[]} ids 代码块id数组
@@ -119,11 +86,13 @@ declare class CodeBlock extends BaseService {
119
86
  * @param {Id[]} codeIds 需要删除的代码块id数组
120
87
  */
121
88
  deleteCodeDslByIds(codeIds: Id[]): Promise<void>;
89
+ setParamsColConfig(config: ColumnConfig): void;
90
+ getParamsColConfig(): ColumnConfig | undefined;
122
91
  /**
123
92
  * 生成代码块唯一id
124
93
  * @returns {Id} 代码块唯一id
125
94
  */
126
- getUniqueId(): Promise<Id>;
95
+ getUniqueId(): Promise<string>;
127
96
  resetState(): void;
128
97
  destroy(): void;
129
98
  }
@@ -1,9 +1,13 @@
1
1
  import type { FormConfig } from '@tmagic/form';
2
- import { DataSourceSchema } from '@tmagic/schema';
2
+ import type { DataSourceSchema } from '@tmagic/schema';
3
+ import type { DatasourceTypeOption } from '../type';
3
4
  import BaseService from './BaseService';
4
5
  interface State {
6
+ datasourceTypeList: DatasourceTypeOption[];
5
7
  dataSources: DataSourceSchema[];
8
+ editable: boolean;
6
9
  configs: Record<string, FormConfig>;
10
+ values: Record<string, Partial<DataSourceSchema>>;
7
11
  }
8
12
  type StateKey = keyof State;
9
13
  declare class DataSource extends BaseService {
@@ -12,6 +16,8 @@ declare class DataSource extends BaseService {
12
16
  get<K extends StateKey>(name: K): State[K];
13
17
  getFormConfig(type?: string): FormConfig;
14
18
  setFormConfig(type: string, config: FormConfig): void;
19
+ getFormValue(type?: string): Partial<DataSourceSchema>;
20
+ setFormValue(type: string, value: Partial<DataSourceSchema>): void;
15
21
  add(config: DataSourceSchema): void;
16
22
  update(config: DataSourceSchema): void;
17
23
  remove(id: string): void;
@@ -1,23 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { MNode } from '@tmagic/schema';
3
+ import type { Dep, MNode } from '@tmagic/schema';
4
+ import { DepTargetType } from '../type';
4
5
  type IsTarget = (key: string | number, value: any) => boolean;
5
6
  interface TargetOptions {
6
7
  isTarget: IsTarget;
7
8
  id: string | number;
8
- type?: string;
9
- name: string;
10
- }
11
- interface Dep {
12
- [key: string | number]: {
13
- name: string;
14
- keys: (string | number)[];
15
- };
16
- }
17
- interface TargetList {
18
- [key: string]: {
19
- [key: string | number]: Target;
20
- };
9
+ /** 类型,数据源、代码块或其他 */
10
+ type?: DepTargetType | string;
11
+ name?: string;
21
12
  }
22
13
  /**
23
14
  * 需要收集依赖的目标
@@ -36,11 +27,11 @@ export declare class Target extends EventEmitter {
36
27
  /**
37
28
  * 目标名称,用于显示在依赖列表中
38
29
  */
39
- name: string;
30
+ name?: string;
40
31
  /**
41
32
  * 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
42
33
  */
43
- type: string;
34
+ type: DepTargetType | string;
44
35
  /**
45
36
  * 依赖详情
46
37
  * 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
@@ -70,15 +61,15 @@ export declare class Target extends EventEmitter {
70
61
  destroy(): void;
71
62
  }
72
63
  export declare class Watcher extends EventEmitter {
73
- targets: TargetList;
64
+ private targets;
74
65
  /**
75
66
  * 获取指定类型中的所有target
76
67
  * @param type 分类
77
68
  * @returns Target[]
78
69
  */
79
- getTargets(type?: string): {
80
- [key: string]: Target;
81
- [key: number]: Target;
70
+ getTargets(type?: DepTargetType | string): {
71
+ [targetId: string]: Target;
72
+ [targetId: number]: Target;
82
73
  };
83
74
  /**
84
75
  * 添加新的目标
@@ -107,7 +98,7 @@ export declare class Watcher extends EventEmitter {
107
98
  * @param type 分类
108
99
  * @returns void
109
100
  */
110
- removeTargets(type?: string): void;
101
+ removeTargets(type?: DepTargetType | string): void;
111
102
  /**
112
103
  * 删除所有target
113
104
  */
@@ -42,7 +42,7 @@ declare class Editor extends BaseService {
42
42
  /**
43
43
  * 只有容器拥有布局
44
44
  */
45
- getLayout(parent: MNode, node?: MNode): Promise<Layout>;
45
+ getLayout(parent: MNode, node?: MNode | null): Promise<Layout>;
46
46
  /**
47
47
  * 选中指定节点(将指定节点设置成当前选中状态)
48
48
  * @param config 指定节点配置或者ID
@@ -0,0 +1,20 @@
1
+ import { KeyBindingItem } from '../type';
2
+ import BaseService from './BaseService';
3
+ declare class Keybinding extends BaseService {
4
+ ctrlKey: string;
5
+ private controllers;
6
+ private bindingList;
7
+ private commands;
8
+ registeCommand(command: string, handler: (e: KeyboardEvent) => void | Promise<void>): void;
9
+ unregisteCommand(command: string): void;
10
+ registeEl(name: string, el?: HTMLElement): void;
11
+ unregisteEl(name: string): void;
12
+ registe(maps: KeyBindingItem[]): void;
13
+ reset(): void;
14
+ destroy(): void;
15
+ private bind;
16
+ private getKeyconKeys;
17
+ }
18
+ export type KeybindingService = Keybinding;
19
+ declare const _default: Keybinding;
20
+ export default _default;
@@ -7,120 +7,15 @@ declare class Props extends BaseService {
7
7
  setPropsConfigs(configs: Record<string, FormConfig>): void;
8
8
  fillConfig(config: FormConfig): Promise<{
9
9
  type: string;
10
- items: ({
10
+ items: {
11
+ [x: string]: any;
12
+ status?: string | undefined;
11
13
  title: string;
12
- labelWidth: string;
13
- items: import("@tmagic/form").ChildConfig[];
14
- lazy?: undefined;
15
- } | {
16
- title: string;
17
- labelWidth: string;
18
- items: {
19
- name: string;
20
- items: ({
21
- type: string;
22
- legend: string;
23
- items: ({
24
- name: string;
25
- type: string;
26
- activeValue: string; /**
27
- * 为指定类型组件设置组件属性表单配置
28
- * @param type 组件类型
29
- * @param config 组件属性表单配置
30
- */
31
- inactiveValue: string;
32
- defaultValue: string;
33
- text: string;
34
- disabled?: undefined;
35
- } | {
36
- name: string;
37
- text: string;
38
- type?: undefined;
39
- activeValue?: undefined; /**
40
- * 为指定类型组件设置组件属性表单配置
41
- * @param type 组件类型
42
- * @param config 组件属性表单配置
43
- */
44
- inactiveValue?: undefined;
45
- defaultValue?: undefined;
46
- disabled?: undefined;
47
- } | {
48
- name: string;
49
- text: string;
50
- disabled: (vm: import("@tmagic/form").FormState, { model }: any) => boolean;
51
- type?: undefined;
52
- activeValue?: undefined; /**
53
- * 为指定类型组件设置组件属性表单配置
54
- * @param type 组件类型
55
- * @param config 组件属性表单配置
56
- */
57
- inactiveValue?: undefined;
58
- defaultValue?: undefined;
59
- })[];
60
- name?: undefined;
61
- } | {
62
- type: string;
63
- legend: string;
64
- items: ({
65
- name: string;
66
- text: string;
67
- type?: undefined;
68
- defaultValue?: undefined;
69
- options?: undefined;
70
- } | {
71
- name: string;
72
- text: string;
73
- type: string;
74
- defaultValue?: undefined;
75
- options?: undefined;
76
- } | {
77
- name: string;
78
- text: string;
79
- type: string;
80
- defaultValue: string;
81
- options: {
82
- text: string;
83
- value: string;
84
- }[];
85
- } | {
86
- name: string;
87
- text: string;
88
- defaultValue: string;
89
- type?: undefined;
90
- options?: undefined;
91
- })[];
92
- name?: undefined;
93
- } | {
94
- type: string;
95
- legend: string;
96
- name: string;
97
- items: {
98
- name: string;
99
- text: string;
100
- }[];
101
- })[];
102
- }[];
103
- lazy?: undefined;
104
- } | {
105
- title: string;
106
- items: {
107
- name: string;
108
- type: string;
109
- labelWidth: number;
110
- }[];
111
- labelWidth?: undefined;
112
- lazy?: undefined;
113
- } | {
114
- title: string;
115
- lazy: boolean;
116
- items: {
117
- name: string;
118
- text: string;
119
- labelWidth: string;
120
- type: string;
121
- }[];
122
- labelWidth?: undefined;
123
- })[];
14
+ lazy?: boolean | undefined;
15
+ labelWidth?: string | undefined;
16
+ items: FormConfig;
17
+ onTabClick?: ((mForm: import("@tmagic/form").FormState | undefined, tab: any, data: any) => void) | undefined;
18
+ }[];
124
19
  }[]>;
125
20
  /**
126
21
  * 为指定类型组件设置组件属性表单配置
@@ -134,13 +29,13 @@ declare class Props extends BaseService {
134
29
  * @returns 组件属性表单配置
135
30
  */
136
31
  getPropsConfig(type: string): Promise<FormConfig>;
137
- setPropsValues(values: Record<string, MNode>): void;
32
+ setPropsValues(values: Record<string, Partial<MNode>>): void;
138
33
  /**
139
34
  * 为指点类型组件设置组件初始值
140
35
  * @param type 组件类型
141
36
  * @param value 组件初始值
142
37
  */
143
- setPropsValue(type: string, value: MNode): Promise<void>;
38
+ setPropsValue(type: string, value: Partial<MNode>): Promise<void>;
144
39
  /**
145
40
  * 获取指定类型的组件初始值
146
41
  * @param type 组件类型
package/types/type.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import type { Component } from 'vue';
2
- import type { FormConfig, FormItem } from '@tmagic/form';
2
+ import type { ColumnConfig, FilterFunction, FormConfig, FormItem } from '@tmagic/form';
3
3
  import type { CodeBlockContent, CodeBlockDSL, Id, MApp, MContainer, MNode, MPage } from '@tmagic/schema';
4
4
  import type StageCore from '@tmagic/stage';
5
5
  import type { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
6
6
  import type { CodeBlockService } from './services/codeBlock';
7
7
  import type { ComponentListService } from './services/componentList';
8
- import { DataSourceService } from './services/dataSource';
8
+ import type { DataSourceService } from './services/dataSource';
9
9
  import type { DepService } from './services/dep';
10
10
  import type { EditorService } from './services/editor';
11
11
  import type { EventsService } from './services/events';
12
12
  import type { HistoryService } from './services/history';
13
+ import type { KeybindingService } from './services/keybinding';
13
14
  import type { PropsService } from './services/props';
14
15
  import type { StorageService } from './services/storage';
15
16
  import type { UiService } from './services/ui';
@@ -17,6 +18,7 @@ import type { UndoRedo } from './utils/undo-redo';
17
18
  export type BeforeAdd = (config: MNode, parent: MContainer) => Promise<MNode> | MNode;
18
19
  export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig;
19
20
  export interface InstallOptions {
21
+ parseDSL: <T = any>(dsl: string) => T;
20
22
  [key: string]: any;
21
23
  }
22
24
  export interface Services {
@@ -30,6 +32,7 @@ export interface Services {
30
32
  codeBlockService: CodeBlockService;
31
33
  depService: DepService;
32
34
  dataSourceService: DataSourceService;
35
+ keybindingService: KeybindingService;
33
36
  }
34
37
  export interface StageOptions {
35
38
  runtimeUrl: string;
@@ -58,7 +61,7 @@ export interface StoreState {
58
61
  export type StoreStateKey = keyof StoreState;
59
62
  export interface PropsState {
60
63
  propsConfigMap: Record<string, FormConfig>;
61
- propsValueMap: Record<string, MNode>;
64
+ propsValueMap: Record<string, Partial<MNode>>;
62
65
  }
63
66
  export interface ComponentGroupState {
64
67
  list: ComponentGroup[];
@@ -260,18 +263,15 @@ export interface ScrollViewerEvent {
260
263
  scrollWidth: number;
261
264
  }
262
265
  export type CodeState = {
263
- /** 是否展示代码块编辑区 */
264
- isShowCodeEditor: boolean;
265
266
  /** 代码块DSL数据源 */
266
267
  codeDsl: CodeBlockDSL | null;
267
- /** 当前选中的代码块id */
268
- id: Id;
269
268
  /** 代码块是否可编辑 */
270
269
  editable: boolean;
271
270
  /** list模式下左侧展示的代码列表 */
272
271
  combineIds: string[];
273
272
  /** 为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除) */
274
273
  undeletableList: Id[];
274
+ paramsColConfig?: ColumnConfig;
275
275
  };
276
276
  export type HookData = {
277
277
  /** 代码块id */
@@ -343,4 +343,94 @@ export interface EventSelectConfig {
343
343
  compActionConfig?: FormItem;
344
344
  /** 联动代码配置 */
345
345
  codeActionConfig?: FormItem;
346
+ /** 联动数据源配置 */
347
+ dataSourceActionConfig?: FormItem;
348
+ }
349
+ export declare enum KeyBindingCommand {
350
+ /** 复制 */
351
+ COPY_NODE = "tmagic-system-copy-node",
352
+ /** 粘贴 */
353
+ PASTE_NODE = "tmagic-system-paste-node",
354
+ /** 删除 */
355
+ DELETE_NODE = "tmagic-system-delete-node",
356
+ /** 剪切 */
357
+ CUT_NODE = "tmagic-system-cut-node",
358
+ /** 撤销 */
359
+ UNDO = "tmagic-system-undo",
360
+ /** 重做 */
361
+ REDO = "tmagic-system-redo",
362
+ /** 放大 */
363
+ ZOOM_IN = "tmagic-system-zoom-in",
364
+ /** 缩小 */
365
+ ZOOM_OUT = "tmagic-system-zoom-out",
366
+ /** 缩放到实际大小 */
367
+ ZOOM_RESET = "tmagic-system-zoom-reset",
368
+ /** 缩放以适应 */
369
+ ZOOM_FIT = "tmagic-system-zoom-fit",
370
+ /** 向上移动1px */
371
+ MOVE_UP_1 = "tmagic-system-move-up-1",
372
+ /** 向下移动1px */
373
+ MOVE_DOWN_1 = "tmagic-system-move-down-1",
374
+ /** 向左移动1px */
375
+ MOVE_LEFT_1 = "tmagic-system-move-left-1",
376
+ /** 向右移动1px */
377
+ MOVE_RIGHT_1 = "tmagic-system-move-right-1",
378
+ /** 向上移动10px */
379
+ MOVE_UP_10 = "tmagic-system-move-up-10",
380
+ /** 向下移动10px */
381
+ MOVE_DOWN_10 = "tmagic-system-move-down-10",
382
+ /** 向左移动10px */
383
+ MOVE_LEFT_10 = "tmagic-system-move-left-10",
384
+ /** 向右移动10px */
385
+ MOVE_RIGHT_10 = "tmagic-system-move-right-10",
386
+ /** 切换组件 */
387
+ SWITCH_NODE = "tmagic-system-switch-node"
388
+ }
389
+ export interface KeyBindingItem {
390
+ command: KeyBindingCommand | string;
391
+ keybinding?: string | string[];
392
+ when: [string, 'keyup' | 'keydown'][];
393
+ }
394
+ export interface KeyBindingCacheItem {
395
+ type: string;
396
+ command: KeyBindingCommand | string;
397
+ keybinding?: string | string[];
398
+ eventType: 'keyup' | 'keydown';
399
+ binded: boolean;
400
+ }
401
+ export interface CodeSelectColConfig {
402
+ type: 'code-select-col';
403
+ name: string;
404
+ labelWidth?: number | string;
405
+ disabled?: boolean | FilterFunction;
406
+ display?: boolean | FilterFunction;
407
+ }
408
+ export interface DataSourceMethodSelectConfig {
409
+ type: 'data-source-method-select';
410
+ name: string;
411
+ labelWidth?: number | string;
412
+ disabled?: boolean | FilterFunction;
413
+ display?: boolean | FilterFunction;
414
+ }
415
+ export interface DataSourceFieldSelectConfig {
416
+ type: 'data-source-field-select';
417
+ name: string;
418
+ labelWidth?: number | string;
419
+ disabled?: boolean | FilterFunction;
420
+ display?: boolean | FilterFunction;
421
+ }
422
+ export declare enum DepTargetType {
423
+ DEFAULT = "default",
424
+ /** 代码块 */
425
+ CODE_BLOCK = "code-block",
426
+ /** 数据源 */
427
+ DATA_SOURCE = "data-source",
428
+ /** 数据源方法 */
429
+ DATA_SOURCE_METHOD = "data-source-method",
430
+ /** 数据源条件 */
431
+ DATA_SOURCE_COND = "data-source-cond"
432
+ }
433
+ export interface DatasourceTypeOption {
434
+ type: string;
435
+ text: string;
346
436
  }
@@ -1,4 +1,4 @@
1
1
  import { InstallOptions } from '../type';
2
2
  declare const setConfig: (option: InstallOptions) => void;
3
- declare const getConfig: (key: keyof InstallOptions) => unknown;
3
+ declare const getConfig: <K extends keyof InstallOptions>(key: K) => InstallOptions[K];
4
4
  export { getConfig, setConfig };
@@ -0,0 +1,7 @@
1
+ import { Ref } from 'vue';
2
+ import ContentMenu from '../components/ContentMenu.vue';
3
+ import type { MenuButton, Services } from '../type';
4
+ export declare const useDeleteMenu: () => MenuButton;
5
+ export declare const useCopyMenu: () => MenuButton;
6
+ export declare const usePasteMenu: (menu?: Ref<InstanceType<typeof ContentMenu> | undefined>) => MenuButton;
7
+ export declare const useMoveToMenu: (services?: Services) => MenuButton;
@@ -1,3 +1,3 @@
1
1
  import type { FormConfig } from '@tmagic/form';
2
- declare const _default: FormConfig;
3
- export default _default;
2
+ import type { DatasourceTypeOption } from '../../../type';
3
+ export default function (datasourceTypeList?: DatasourceTypeOption[]): FormConfig;
@@ -1,2 +1,8 @@
1
1
  import { FormConfig } from '@tmagic/form';
2
- export declare const getFormConfig: (type: string, configs: Record<string, FormConfig>) => FormConfig;
2
+ import { DataSourceSchema } from '@tmagic/schema';
3
+ import { DatasourceTypeOption } from '../../type';
4
+ export declare const getFormConfig: (type: string, datasourceTypeList: DatasourceTypeOption[], configs: Record<string, FormConfig>) => FormConfig;
5
+ export declare const getDisplayField: (dataSources: DataSourceSchema[], key: string) => {
6
+ value: string;
7
+ type: 'var' | 'text';
8
+ }[];
@@ -1,4 +1,6 @@
1
- import { CodeBlockContent, DataSourceSchema, Id } from '@tmagic/schema';
1
+ import { CodeBlockContent, Id } from '@tmagic/schema';
2
2
  import { Target } from '../services/dep';
3
3
  export declare const createCodeBlockTarget: (id: Id, codeBlock: CodeBlockContent) => Target;
4
- export declare const createDataSourceTarget: (id: Id, ds: DataSourceSchema) => Target;
4
+ export declare const createDataSourceTarget: (id: Id) => Target;
5
+ export declare const createDataSourceCondTarget: (id: string) => Target;
6
+ export declare const createDataSourceMethodTarget: (id: string) => Target;
@@ -2,5 +2,5 @@ export * from './config';
2
2
  export * from './props';
3
3
  export * from './logger';
4
4
  export * from './editor';
5
- export * from './stage';
6
5
  export * from './operator';
6
+ export * from './data-source';
@@ -0,0 +1,3 @@
1
+ import { KeyBindingItem } from '../type';
2
+ declare const _default: KeyBindingItem[];
3
+ export default _default;