@tmagic/editor 1.2.9 → 1.2.11

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 (39) hide show
  1. package/dist/style.css +26 -32
  2. package/dist/tmagic-editor.js +1694 -1342
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +1699 -1344
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +9 -9
  7. package/src/Editor.vue +10 -240
  8. package/src/components/CodeDraftEditor.vue +10 -6
  9. package/src/components/FunctionEditor.vue +1 -1
  10. package/src/editorProps.ts +135 -0
  11. package/src/fields/CodeSelect.vue +24 -13
  12. package/src/fields/CodeSelectCol.vue +117 -0
  13. package/src/fields/EventSelect.vue +216 -0
  14. package/src/index.ts +7 -0
  15. package/src/initService.ts +198 -0
  16. package/src/layouts/sidebar/code-block/CodeBlockList.vue +49 -127
  17. package/src/services/codeBlock.ts +29 -150
  18. package/src/services/dep.ts +328 -0
  19. package/src/services/editor.ts +2 -28
  20. package/src/theme/code-block.scss +5 -33
  21. package/src/theme/event.scss +24 -0
  22. package/src/theme/theme.scss +1 -0
  23. package/src/type.ts +18 -3
  24. package/src/utils/dep.ts +21 -0
  25. package/src/utils/props.ts +1 -35
  26. package/types/Editor.vue.d.ts +49 -82
  27. package/types/editorProps.d.ts +109 -0
  28. package/types/fields/CodeSelect.vue.d.ts +28 -5
  29. package/types/fields/CodeSelectCol.vue.d.ts +30 -0
  30. package/types/fields/EventSelect.vue.d.ts +26 -0
  31. package/types/index.d.ts +3 -0
  32. package/types/initService.d.ts +8 -0
  33. package/types/services/codeBlock.d.ts +3 -36
  34. package/types/services/dep.d.ts +130 -0
  35. package/types/services/editor.d.ts +1 -13
  36. package/types/services/props.d.ts +1 -15
  37. package/types/type.d.ts +17 -3
  38. package/types/utils/dep.d.ts +3 -0
  39. package/types/utils/props.d.ts +2 -16
@@ -1,83 +1,64 @@
1
- import { PropType } from 'vue';
2
- import { EventOption } from '@tmagic/core';
3
- import type { FormConfig } from '@tmagic/form';
4
- import type { MApp, MNode } from '@tmagic/schema';
5
- import StageCore, { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
6
- import type { ComponentGroup, MenuBarData, MenuButton, MenuComponent, Services, SideBarData, StageRect } from './type';
1
+ import type { Services } from './type';
7
2
  declare const _default: import("vue").DefineComponent<{
8
- /** 页面初始值 */
9
3
  modelValue: {
10
- type: PropType<MApp>;
4
+ type: import("vue").PropType<import("@tmagic/schema").MApp>;
11
5
  default: () => {};
12
6
  require: boolean;
13
7
  };
14
- /** 左侧面板中的组件列表 */
15
8
  componentGroupList: {
16
- type: PropType<ComponentGroup[]>;
9
+ type: import("vue").PropType<import("./type").ComponentGroup[]>;
17
10
  default: () => never[];
18
11
  };
19
- /** 左侧面板配置 */
20
12
  sidebar: {
21
- type: PropType<SideBarData>;
13
+ type: import("vue").PropType<import("./type").SideBarData>;
22
14
  };
23
- /** 顶部工具栏配置 */
24
15
  menu: {
25
- type: PropType<MenuBarData>;
16
+ type: import("vue").PropType<import("./type").MenuBarData>;
26
17
  default: () => {
27
18
  left: never[];
28
19
  right: never[];
29
20
  };
30
21
  };
31
- /** 组件树右键菜单 */
32
22
  layerContentMenu: {
33
- type: PropType<(MenuButton | MenuComponent)[]>;
23
+ type: import("vue").PropType<(import("./type").MenuButton | import("./type").MenuComponent)[]>;
34
24
  default: () => never[];
35
25
  };
36
- /** 画布右键菜单 */
37
26
  stageContentMenu: {
38
- type: PropType<(MenuButton | MenuComponent)[]>;
27
+ type: import("vue").PropType<(import("./type").MenuButton | import("./type").MenuComponent)[]>;
39
28
  default: () => never[];
40
29
  };
41
- /** 中间工作区域中画布渲染的内容 */
42
30
  render: {
43
- type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
31
+ type: import("vue").PropType<(stage: import("@tmagic/stage").default) => HTMLDivElement | Promise<HTMLDivElement>>;
44
32
  };
45
- /** 中间工作区域中画布通过iframe渲染时的页面url */
46
33
  runtimeUrl: StringConstructor;
47
- /** 选中时是否自动滚动到可视区域 */
48
34
  autoScrollIntoView: BooleanConstructor;
49
- /** 组件的属性配置表单的dsl */
50
35
  propsConfigs: {
51
- type: PropType<Record<string, FormConfig>>;
36
+ type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
52
37
  default: () => {};
53
38
  };
54
- /** 添加组件时的默认值 */
55
39
  propsValues: {
56
- type: PropType<Record<string, MNode>>;
40
+ type: import("vue").PropType<Record<string, import("@tmagic/schema").MNode>>;
57
41
  default: () => {};
58
42
  };
59
- /** 组件联动事件选项列表 */
60
43
  eventMethodList: {
61
- type: PropType<Record<string, {
62
- events: EventOption[];
63
- methods: EventOption[];
44
+ type: import("vue").PropType<Record<string, {
45
+ events: import("@tmagic/core").EventOption[];
46
+ methods: import("@tmagic/core").EventOption[];
64
47
  }>>;
65
48
  default: () => {};
66
49
  };
67
- /** 画布中组件选中框的移动范围 */
68
50
  moveableOptions: {
69
- type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
51
+ type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
70
52
  };
71
- /** 编辑器初始化时默认选中的组件ID */
72
53
  defaultSelected: {
73
54
  type: (NumberConstructor | StringConstructor)[];
74
55
  };
75
56
  canSelect: {
76
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
57
+ type: import("vue").PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
77
58
  default: (el: HTMLElement) => boolean;
78
59
  };
79
60
  isContainer: {
80
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
61
+ type: import("vue").PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
81
62
  default: (el: HTMLElement) => boolean;
82
63
  };
83
64
  containerHighlightClassName: {
@@ -89,96 +70,82 @@ declare const _default: import("vue").DefineComponent<{
89
70
  default: number;
90
71
  };
91
72
  containerHighlightType: {
92
- type: PropType<ContainerHighlightType>;
93
- default: ContainerHighlightType;
73
+ type: import("vue").PropType<import("@tmagic/stage").ContainerHighlightType>;
74
+ default: import("@tmagic/stage").ContainerHighlightType;
94
75
  };
95
76
  stageRect: {
96
- type: PropType<StageRect>;
77
+ type: import("vue").PropType<import("./type").StageRect>;
97
78
  };
98
79
  codeOptions: {
99
80
  type: ObjectConstructor;
100
81
  default: () => {};
101
82
  };
102
83
  updateDragEl: {
103
- type: PropType<UpdateDragEl>;
84
+ type: import("vue").PropType<import("@tmagic/stage").UpdateDragEl>;
104
85
  };
105
86
  disabledDragStart: {
106
87
  type: BooleanConstructor;
107
88
  };
108
89
  }, Services, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "props-panel-mounted")[], "update:modelValue" | "props-panel-mounted", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
109
- /** 页面初始值 */
110
90
  modelValue: {
111
- type: PropType<MApp>;
91
+ type: import("vue").PropType<import("@tmagic/schema").MApp>;
112
92
  default: () => {};
113
93
  require: boolean;
114
94
  };
115
- /** 左侧面板中的组件列表 */
116
95
  componentGroupList: {
117
- type: PropType<ComponentGroup[]>;
96
+ type: import("vue").PropType<import("./type").ComponentGroup[]>;
118
97
  default: () => never[];
119
98
  };
120
- /** 左侧面板配置 */
121
99
  sidebar: {
122
- type: PropType<SideBarData>;
100
+ type: import("vue").PropType<import("./type").SideBarData>;
123
101
  };
124
- /** 顶部工具栏配置 */
125
102
  menu: {
126
- type: PropType<MenuBarData>;
103
+ type: import("vue").PropType<import("./type").MenuBarData>;
127
104
  default: () => {
128
105
  left: never[];
129
106
  right: never[];
130
107
  };
131
108
  };
132
- /** 组件树右键菜单 */
133
109
  layerContentMenu: {
134
- type: PropType<(MenuButton | MenuComponent)[]>;
110
+ type: import("vue").PropType<(import("./type").MenuButton | import("./type").MenuComponent)[]>;
135
111
  default: () => never[];
136
112
  };
137
- /** 画布右键菜单 */
138
113
  stageContentMenu: {
139
- type: PropType<(MenuButton | MenuComponent)[]>;
114
+ type: import("vue").PropType<(import("./type").MenuButton | import("./type").MenuComponent)[]>;
140
115
  default: () => never[];
141
116
  };
142
- /** 中间工作区域中画布渲染的内容 */
143
117
  render: {
144
- type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
118
+ type: import("vue").PropType<(stage: import("@tmagic/stage").default) => HTMLDivElement | Promise<HTMLDivElement>>;
145
119
  };
146
- /** 中间工作区域中画布通过iframe渲染时的页面url */
147
120
  runtimeUrl: StringConstructor;
148
- /** 选中时是否自动滚动到可视区域 */
149
121
  autoScrollIntoView: BooleanConstructor;
150
- /** 组件的属性配置表单的dsl */
151
122
  propsConfigs: {
152
- type: PropType<Record<string, FormConfig>>;
123
+ type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
153
124
  default: () => {};
154
125
  };
155
- /** 添加组件时的默认值 */
156
126
  propsValues: {
157
- type: PropType<Record<string, MNode>>;
127
+ type: import("vue").PropType<Record<string, import("@tmagic/schema").MNode>>;
158
128
  default: () => {};
159
129
  };
160
- /** 组件联动事件选项列表 */
161
130
  eventMethodList: {
162
- type: PropType<Record<string, {
163
- events: EventOption[];
164
- methods: EventOption[];
131
+ type: import("vue").PropType<Record<string, {
132
+ events: import("@tmagic/core").EventOption[];
133
+ methods: import("@tmagic/core").EventOption[];
165
134
  }>>;
166
135
  default: () => {};
167
136
  };
168
- /** 画布中组件选中框的移动范围 */
169
137
  moveableOptions: {
170
- type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
138
+ type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
171
139
  };
172
- /** 编辑器初始化时默认选中的组件ID */
173
140
  defaultSelected: {
174
141
  type: (NumberConstructor | StringConstructor)[];
175
142
  };
176
143
  canSelect: {
177
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
144
+ type: import("vue").PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
178
145
  default: (el: HTMLElement) => boolean;
179
146
  };
180
147
  isContainer: {
181
- type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
148
+ type: import("vue").PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
182
149
  default: (el: HTMLElement) => boolean;
183
150
  };
184
151
  containerHighlightClassName: {
@@ -190,18 +157,18 @@ declare const _default: import("vue").DefineComponent<{
190
157
  default: number;
191
158
  };
192
159
  containerHighlightType: {
193
- type: PropType<ContainerHighlightType>;
194
- default: ContainerHighlightType;
160
+ type: import("vue").PropType<import("@tmagic/stage").ContainerHighlightType>;
161
+ default: import("@tmagic/stage").ContainerHighlightType;
195
162
  };
196
163
  stageRect: {
197
- type: PropType<StageRect>;
164
+ type: import("vue").PropType<import("./type").StageRect>;
198
165
  };
199
166
  codeOptions: {
200
167
  type: ObjectConstructor;
201
168
  default: () => {};
202
169
  };
203
170
  updateDragEl: {
204
- type: PropType<UpdateDragEl>;
171
+ type: import("vue").PropType<import("@tmagic/stage").UpdateDragEl>;
205
172
  };
206
173
  disabledDragStart: {
207
174
  type: BooleanConstructor;
@@ -210,24 +177,24 @@ declare const _default: import("vue").DefineComponent<{
210
177
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
211
178
  "onProps-panel-mounted"?: ((...args: any[]) => any) | undefined;
212
179
  }, {
213
- menu: MenuBarData;
180
+ menu: import("./type").MenuBarData;
214
181
  autoScrollIntoView: boolean;
215
182
  codeOptions: Record<string, any>;
216
- modelValue: MApp;
217
- layerContentMenu: (MenuButton | MenuComponent)[];
218
- stageContentMenu: (MenuButton | MenuComponent)[];
219
- componentGroupList: ComponentGroup[];
220
- propsConfigs: Record<string, FormConfig>;
221
- propsValues: Record<string, MNode>;
183
+ modelValue: import("@tmagic/schema").MApp;
184
+ layerContentMenu: (import("./type").MenuButton | import("./type").MenuComponent)[];
185
+ stageContentMenu: (import("./type").MenuButton | import("./type").MenuComponent)[];
186
+ componentGroupList: import("./type").ComponentGroup[];
187
+ propsConfigs: Record<string, import("@tmagic/form").FormConfig>;
188
+ propsValues: Record<string, import("@tmagic/schema").MNode>;
222
189
  eventMethodList: Record<string, {
223
- events: EventOption[];
224
- methods: EventOption[];
190
+ events: import("@tmagic/core").EventOption[];
191
+ methods: import("@tmagic/core").EventOption[];
225
192
  }>;
226
193
  canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
227
194
  isContainer: (el: HTMLElement) => boolean | Promise<boolean>;
228
195
  containerHighlightClassName: string;
229
196
  containerHighlightDuration: number;
230
- containerHighlightType: ContainerHighlightType;
197
+ containerHighlightType: import("@tmagic/stage").ContainerHighlightType;
231
198
  disabledDragStart: boolean;
232
199
  }>;
233
200
  export default _default;
@@ -0,0 +1,109 @@
1
+ import type { PropType } from 'vue';
2
+ import type { EventOption } from '@tmagic/core';
3
+ import type { FormConfig } from '@tmagic/form';
4
+ import type { MApp, MNode } from '@tmagic/schema';
5
+ import StageCore, { ContainerHighlightType, CustomizeMoveableOptionsCallbackConfig, MoveableOptions, UpdateDragEl } from '@tmagic/stage';
6
+ import type { ComponentGroup, MenuBarData, MenuButton, MenuComponent, SideBarData, StageRect } from './type';
7
+ declare const _default: {
8
+ /** 页面初始值 */
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
+ sidebar: {
21
+ type: PropType<SideBarData>;
22
+ };
23
+ /** 顶部工具栏配置 */
24
+ menu: {
25
+ type: PropType<MenuBarData>;
26
+ default: () => {
27
+ left: never[];
28
+ right: never[];
29
+ };
30
+ };
31
+ /** 组件树右键菜单 */
32
+ layerContentMenu: {
33
+ type: PropType<(MenuButton | MenuComponent)[]>;
34
+ default: () => never[];
35
+ };
36
+ /** 画布右键菜单 */
37
+ stageContentMenu: {
38
+ type: PropType<(MenuButton | MenuComponent)[]>;
39
+ default: () => never[];
40
+ };
41
+ /** 中间工作区域中画布渲染的内容 */
42
+ render: {
43
+ type: PropType<(stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>>;
44
+ };
45
+ /** 中间工作区域中画布通过iframe渲染时的页面url */
46
+ runtimeUrl: StringConstructor;
47
+ /** 选中时是否自动滚动到可视区域 */
48
+ autoScrollIntoView: BooleanConstructor;
49
+ /** 组件的属性配置表单的dsl */
50
+ propsConfigs: {
51
+ type: PropType<Record<string, FormConfig>>;
52
+ default: () => {};
53
+ };
54
+ /** 添加组件时的默认值 */
55
+ propsValues: {
56
+ type: PropType<Record<string, MNode>>;
57
+ default: () => {};
58
+ };
59
+ /** 组件联动事件选项列表 */
60
+ eventMethodList: {
61
+ type: PropType<Record<string, {
62
+ events: EventOption[];
63
+ methods: EventOption[];
64
+ }>>;
65
+ default: () => {};
66
+ };
67
+ /** 画布中组件选中框的移动范围 */
68
+ moveableOptions: {
69
+ type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
70
+ };
71
+ /** 编辑器初始化时默认选中的组件ID */
72
+ defaultSelected: {
73
+ type: (NumberConstructor | StringConstructor)[];
74
+ };
75
+ canSelect: {
76
+ type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
77
+ default: (el: HTMLElement) => boolean;
78
+ };
79
+ isContainer: {
80
+ type: PropType<(el: HTMLElement) => boolean | Promise<boolean>>;
81
+ default: (el: HTMLElement) => boolean;
82
+ };
83
+ containerHighlightClassName: {
84
+ type: StringConstructor;
85
+ default: string;
86
+ };
87
+ containerHighlightDuration: {
88
+ type: NumberConstructor;
89
+ default: number;
90
+ };
91
+ containerHighlightType: {
92
+ type: PropType<ContainerHighlightType>;
93
+ default: ContainerHighlightType;
94
+ };
95
+ stageRect: {
96
+ type: PropType<StageRect>;
97
+ };
98
+ codeOptions: {
99
+ type: ObjectConstructor;
100
+ default: () => {};
101
+ };
102
+ updateDragEl: {
103
+ type: PropType<UpdateDragEl>;
104
+ };
105
+ disabledDragStart: {
106
+ type: BooleanConstructor;
107
+ };
108
+ };
109
+ export default _default;
@@ -1,23 +1,41 @@
1
1
  import { TableConfig } from '@tmagic/form';
2
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
3
  config: {
4
4
  tableConfig?: TableConfig | undefined;
5
+ className?: string | undefined;
6
+ editable?: boolean | undefined;
5
7
  };
6
8
  model: any;
7
9
  prop: string;
8
10
  name: string;
9
- size: 'mini' | 'small' | 'medium';
10
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ size: 'small' | 'default' | 'large';
12
+ }>, {
13
+ config: () => {
14
+ editable: boolean;
15
+ };
16
+ }>, {}, 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<{
11
17
  config: {
12
18
  tableConfig?: TableConfig | undefined;
19
+ className?: string | undefined;
20
+ editable?: boolean | undefined;
13
21
  };
14
22
  model: any;
15
23
  prop: string;
16
24
  name: string;
17
- size: 'mini' | 'small' | 'medium';
25
+ size: 'small' | 'default' | 'large';
26
+ }>, {
27
+ config: () => {
28
+ editable: boolean;
29
+ };
18
30
  }>>> & {
19
31
  onChange?: ((...args: any[]) => any) | undefined;
20
- }, {}>;
32
+ }, {
33
+ config: {
34
+ tableConfig?: TableConfig | undefined;
35
+ className?: string | undefined;
36
+ editable?: boolean | undefined;
37
+ };
38
+ }>;
21
39
  export default _default;
22
40
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
41
  declare type __VLS_TypePropsToRuntimeProps<T> = {
@@ -28,3 +46,8 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
28
46
  required: true;
29
47
  };
30
48
  };
49
+ declare type __VLS_WithDefaults<P, D> = {
50
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
51
+ default: D[K];
52
+ } : P[K];
53
+ };
@@ -0,0 +1,30 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ config: any;
3
+ model: any;
4
+ prop: string;
5
+ name: string;
6
+ size: 'small' | 'default' | 'large';
7
+ }>, {}>, {}, 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<{
8
+ config: any;
9
+ model: any;
10
+ prop: string;
11
+ name: string;
12
+ size: 'small' | 'default' | 'large';
13
+ }>, {}>>> & {
14
+ onChange?: ((...args: any[]) => any) | undefined;
15
+ }, {}>;
16
+ export default _default;
17
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
19
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
20
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
+ } : {
22
+ type: import('vue').PropType<T[K]>;
23
+ required: true;
24
+ };
25
+ };
26
+ declare type __VLS_WithDefaults<P, D> = {
27
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
28
+ default: D[K];
29
+ } : P[K];
30
+ };
@@ -0,0 +1,26 @@
1
+ import { EventSelectConfig } from '../type';
2
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ config: EventSelectConfig;
4
+ model: any;
5
+ prop: string;
6
+ name: string;
7
+ size: 'small' | 'default' | 'large';
8
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
+ config: EventSelectConfig;
10
+ model: any;
11
+ prop: string;
12
+ name: string;
13
+ size: 'small' | 'default' | 'large';
14
+ }>>> & {
15
+ onChange?: ((...args: any[]) => any) | undefined;
16
+ }, {}>;
17
+ export default _default;
18
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
20
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
21
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
22
+ } : {
23
+ type: import('vue').PropType<T[K]>;
24
+ required: true;
25
+ };
26
+ };
package/types/index.d.ts CHANGED
@@ -13,9 +13,12 @@ export { default as storageService } from './services/storage';
13
13
  export { default as eventsService } from './services/events';
14
14
  export { default as uiService } from './services/ui';
15
15
  export { default as codeBlockService } from './services/codeBlock';
16
+ export { default as depService } from './services/dep';
16
17
  export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
17
18
  export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
18
19
  export { default as CodeSelect } from './fields/CodeSelect.vue';
20
+ export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
21
+ export { default as EventSelect } from './fields/EventSelect.vue';
19
22
  export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
20
23
  export { default as PropsPanel } from './layouts/PropsPanel.vue';
21
24
  export { default as ToolButton } from './components/ToolButton.vue';
@@ -0,0 +1,8 @@
1
+ import type { ExtractPropTypes } from 'vue';
2
+ import editorProps from './editorProps';
3
+ import type { Services } from './type';
4
+ export declare type LooseRequired<T> = {
5
+ [P in string & keyof T]: T[P];
6
+ };
7
+ export declare const initServiceState: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, }: 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, depService }: Services) => void;
@@ -1,5 +1,4 @@
1
1
  import { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
2
- import type { CodeRelation } from '../type';
3
2
  import BaseService from './BaseService';
4
3
  declare class CodeBlock extends BaseService {
5
4
  private state;
@@ -16,8 +15,7 @@ declare class CodeBlock extends BaseService {
16
15
  * @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
17
16
  * @returns {CodeBlockDSL | null}
18
17
  */
19
- getCodeDsl(forceRefresh?: boolean): Promise<CodeBlockDSL | null>;
20
- getCodeDslSync(forceRefresh?: boolean): CodeBlockDSL | null;
18
+ getCodeDsl(): CodeBlockDSL | null;
21
19
  /**
22
20
  * 根据代码块id获取代码块内容
23
21
  * @param {Id} id 代码块id
@@ -67,7 +65,7 @@ declare class CodeBlock extends BaseService {
67
65
  getEditStatus(): boolean;
68
66
  /**
69
67
  * 设置编辑状态
70
- * @param {boolean} 是否可编辑
68
+ * @param {boolean} status 是否可编辑
71
69
  * @returns {void}
72
70
  */
73
71
  setEditStatus(status: boolean): Promise<void>;
@@ -93,21 +91,6 @@ declare class CodeBlock extends BaseService {
93
91
  * @returns {string[]}
94
92
  */
95
93
  getCombineIds(): string[];
96
- /**
97
- * 监听组件更新来更新代码块绑定关系
98
- * @returns {void}
99
- */
100
- addCodeRelationListener(): void;
101
- /**
102
- * 更新全部绑定关系
103
- * @returns {void}
104
- */
105
- refreshAllRelations(): void;
106
- /**
107
- * 获取绑定关系
108
- * @returns {CodeRelation}
109
- */
110
- getCombineInfo(): CodeRelation;
111
94
  /**
112
95
  * 获取不可删除列表
113
96
  * @returns {Id[]}
@@ -134,9 +117,8 @@ declare class CodeBlock extends BaseService {
134
117
  /**
135
118
  * 在dsl数据源中删除指定id的代码块
136
119
  * @param {Id[]} codeIds 需要删除的代码块id数组
137
- * @returns {CodeBlockDSL} 删除后的code dsl
138
120
  */
139
- deleteCodeDslByIds(codeIds: Id[]): Promise<CodeBlockDSL>;
121
+ deleteCodeDslByIds(codeIds: Id[]): Promise<void>;
140
122
  /**
141
123
  * 生成代码块唯一id
142
124
  * @returns {Id} 代码块唯一id
@@ -144,21 +126,6 @@ declare class CodeBlock extends BaseService {
144
126
  getUniqueId(): Promise<Id>;
145
127
  resetState(): void;
146
128
  destroy(): void;
147
- /**
148
- * 递归遍历dsl中挂载了代码块的节点,并更新绑定关系数据
149
- * @param {MNode} node 节点信息
150
- * @param {CodeRelation} relation 关系数据
151
- * @param {boolean} deep 是否深层遍历
152
- * @returns void
153
- */
154
- private getNodeRelation;
155
- /**
156
- * 删除组件关系
157
- * @param {MNode} node 节点信息
158
- * @param {CodeRelation} relations 关系数据
159
- * @returns CodeRelation
160
- */
161
- private deleteNodeRelation;
162
129
  }
163
130
  export declare type CodeBlockService = CodeBlock;
164
131
  declare const _default: CodeBlock;