@tmagic/editor 1.3.0-alpha.2 → 1.3.0-alpha.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.
Files changed (89) hide show
  1. package/dist/tmagic-editor.js +800 -514
  2. package/dist/tmagic-editor.js.map +1 -1
  3. package/dist/tmagic-editor.umd.cjs +801 -514
  4. package/dist/tmagic-editor.umd.cjs.map +1 -1
  5. package/package.json +17 -18
  6. package/src/Editor.vue +1 -1
  7. package/src/components/CodeDraftEditor.vue +5 -1
  8. package/src/components/ContentMenu.vue +5 -1
  9. package/src/components/FunctionEditor.vue +6 -1
  10. package/src/components/Icon.vue +5 -1
  11. package/src/components/Layout.vue +5 -1
  12. package/src/components/ScrollBar.vue +5 -1
  13. package/src/components/ScrollViewer.vue +5 -1
  14. package/src/components/SearchInput.vue +4 -0
  15. package/src/components/ToolButton.vue +5 -1
  16. package/src/fields/Code.vue +5 -1
  17. package/src/fields/CodeLink.vue +5 -1
  18. package/src/fields/CodeSelect.vue +8 -2
  19. package/src/fields/CodeSelectCol.vue +6 -2
  20. package/src/fields/DataSourceFields.vue +4 -0
  21. package/src/fields/DataSourceInput.vue +357 -0
  22. package/src/fields/EventSelect.vue +9 -3
  23. package/src/fields/KeyValue.vue +4 -0
  24. package/src/fields/UISelect.vue +5 -1
  25. package/src/icons/AppManageIcon.vue +5 -1
  26. package/src/icons/CodeIcon.vue +5 -1
  27. package/src/index.ts +3 -0
  28. package/src/layouts/AddPageBox.vue +5 -1
  29. package/src/layouts/CodeEditor.vue +5 -1
  30. package/src/layouts/Framework.vue +5 -1
  31. package/src/layouts/NavMenu.vue +5 -1
  32. package/src/layouts/PropsPanel.vue +5 -1
  33. package/src/layouts/Resizer.vue +5 -1
  34. package/src/layouts/sidebar/ComponentListPanel.vue +5 -1
  35. package/src/layouts/sidebar/LayerMenu.vue +5 -1
  36. package/src/layouts/sidebar/LayerPanel.vue +5 -1
  37. package/src/layouts/sidebar/Sidebar.vue +11 -7
  38. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +5 -1
  39. package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -1
  40. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +4 -0
  41. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +4 -0
  42. package/src/layouts/workspace/Breadcrumb.vue +5 -1
  43. package/src/layouts/workspace/PageBar.vue +5 -1
  44. package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
  45. package/src/layouts/workspace/Stage.vue +5 -1
  46. package/src/layouts/workspace/ViewerMenu.vue +5 -1
  47. package/src/layouts/workspace/Workspace.vue +5 -1
  48. package/types/Editor.vue.d.ts +1 -1
  49. package/types/components/CodeDraftEditor.vue.d.ts +6 -3
  50. package/types/components/ContentMenu.vue.d.ts +8 -5
  51. package/types/components/FunctionEditor.vue.d.ts +66 -45
  52. package/types/components/Icon.vue.d.ts +2 -2
  53. package/types/components/Layout.vue.d.ts +9 -6
  54. package/types/components/ScrollBar.vue.d.ts +1 -1
  55. package/types/components/ScrollViewer.vue.d.ts +8 -5
  56. package/types/components/SearchInput.vue.d.ts +1 -1
  57. package/types/components/ToolButton.vue.d.ts +8 -5
  58. package/types/fields/Code.vue.d.ts +1 -1
  59. package/types/fields/CodeLink.vue.d.ts +9 -9
  60. package/types/fields/CodeSelect.vue.d.ts +10 -7
  61. package/types/fields/CodeSelectCol.vue.d.ts +8 -5
  62. package/types/fields/DataSourceFields.vue.d.ts +8 -5
  63. package/types/fields/DataSourceInput.vue.d.ts +54 -0
  64. package/types/fields/EventSelect.vue.d.ts +3 -3
  65. package/types/fields/KeyValue.vue.d.ts +8 -5
  66. package/types/fields/UISelect.vue.d.ts +1 -1
  67. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  68. package/types/icons/CodeIcon.vue.d.ts +1 -1
  69. package/types/index.d.ts +1 -0
  70. package/types/layouts/AddPageBox.vue.d.ts +1 -1
  71. package/types/layouts/CodeEditor.vue.d.ts +7 -4
  72. package/types/layouts/Framework.vue.d.ts +13 -10
  73. package/types/layouts/NavMenu.vue.d.ts +7 -4
  74. package/types/layouts/PropsPanel.vue.d.ts +2 -2
  75. package/types/layouts/Resizer.vue.d.ts +2 -2
  76. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
  77. package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
  78. package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
  79. package/types/layouts/sidebar/Sidebar.vue.d.ts +18 -15
  80. package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +4 -4
  81. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -7
  82. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +1 -1
  83. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +3 -3
  84. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  85. package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
  86. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
  87. package/types/layouts/workspace/Stage.vue.d.ts +2 -2
  88. package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
  89. package/types/layouts/workspace/Workspace.vue.d.ts +8 -8
@@ -0,0 +1,357 @@
1
+ <template>
2
+ <component
3
+ v-if="disabled || isFocused"
4
+ :is="getConfig('components')?.autocomplete.component || 'el-autocomplete'"
5
+ class="tmagic-design-auto-complete"
6
+ ref="autocomplete"
7
+ v-model="state"
8
+ v-bind="
9
+ getConfig('components')?.autocomplete.props({
10
+ disabled,
11
+ size,
12
+ fetchSuggestions: querySearch,
13
+ triggerOnFocus: false,
14
+ clearable: true,
15
+ }) || {}
16
+ "
17
+ style="width: 100%"
18
+ @blur="blurHandler"
19
+ @change="changeHandler"
20
+ @input="inputHandler"
21
+ @select="selectHandler"
22
+ >
23
+ <template #suffix>
24
+ <Icon :icon="Coin" />
25
+ </template>
26
+ <template #default="{ item }">
27
+ <div style="display: flex; flex-direction: column; line-height: 1.2em">
28
+ <div>{{ item.text }}</div>
29
+ <span style="font-size: 10px; color: rgba(0, 0, 0, 0.6)">{{ item.value }}</span>
30
+ </div>
31
+ </template>
32
+ </component>
33
+ <div :class="`el-input el-input--${size}`" @mouseup="mouseupHandler" v-else>
34
+ <div :class="`el-input__wrapper ${isFocused ? ' is-focus' : ''}`">
35
+ <div class="el-input__inner">
36
+ <template v-for="(item, index) in displayState">
37
+ <span :key="index" v-if="item.type === 'text'" style="margin-right: 2px">{{ item.value }}</span>
38
+ <TMagicTag :key="index" :size="size" v-if="item.type === 'var'">{{ item.value }}</TMagicTag>
39
+ </template>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import { computed, inject, nextTick, ref, watch } from 'vue';
47
+ import { Coin } from '@element-plus/icons-vue';
48
+
49
+ import { FieldSize, getConfig, TMagicAutocomplete, TMagicTag } from '@tmagic/design';
50
+ import type { DataSchema, DataSourceSchema } from '@tmagic/schema';
51
+
52
+ import Icon from '@editor/components/Icon.vue';
53
+ import type { Services } from '@editor/type';
54
+
55
+ defineOptions({
56
+ name: 'MEditorDataSourceInput',
57
+ });
58
+
59
+ const props = withDefaults(
60
+ defineProps<{
61
+ config: {
62
+ type: 'data-source-input';
63
+ name: string;
64
+ text: string;
65
+ };
66
+ model: Record<string, any>;
67
+ name: string;
68
+ prop: string;
69
+ disabled: boolean;
70
+ lastValues?: Record<string, any>;
71
+ size?: FieldSize;
72
+ }>(),
73
+ {
74
+ disabled: false,
75
+ },
76
+ );
77
+
78
+ const emit = defineEmits<(e: 'change', value: string) => void>();
79
+
80
+ const { dataSourceService } = inject<Services>('services') || {};
81
+
82
+ const autocomplete = ref<InstanceType<typeof TMagicAutocomplete>>();
83
+ const isFocused = ref(false);
84
+ const state = ref('');
85
+ const displayState = ref<{ value: string; type: 'var' | 'text' }[]>([]);
86
+
87
+ const input = computed<HTMLInputElement>(() => autocomplete.value?.inputRef?.input);
88
+ const dataSources = computed(() => dataSourceService?.get('dataSources') || []);
89
+
90
+ const setDisplayState = () => {
91
+ displayState.value = [];
92
+
93
+ const matches = state.value.matchAll(/\{\{([\s\S]+?)\}\}/g);
94
+ let index = 0;
95
+ for (const match of matches) {
96
+ if (typeof match.index === 'undefined') break;
97
+
98
+ displayState.value.push({
99
+ type: 'text',
100
+ value: state.value.substring(index, match.index),
101
+ });
102
+
103
+ let dsText = '';
104
+ let ds: DataSourceSchema | undefined;
105
+ let fields: DataSchema[] | undefined;
106
+
107
+ match[1].split('.').forEach((item, index) => {
108
+ if (index === 0) {
109
+ ds = dataSources.value.find((ds) => ds.id === item);
110
+ dsText += ds?.title || item;
111
+ fields = ds?.fields;
112
+ return;
113
+ }
114
+
115
+ const field = fields?.find((field) => field.name === item);
116
+ fields = field?.fields;
117
+ dsText += `.${field?.title || item}`;
118
+ });
119
+
120
+ displayState.value.push({
121
+ type: 'var',
122
+ value: dsText,
123
+ });
124
+
125
+ index = match.index + match[0].length;
126
+ }
127
+
128
+ if (index < state.value.length) {
129
+ displayState.value.push({
130
+ type: 'text',
131
+ value: state.value.substring(index),
132
+ });
133
+ }
134
+ };
135
+
136
+ watch(
137
+ () => props.model[props.name],
138
+ (value = '') => {
139
+ state.value = value;
140
+
141
+ setDisplayState();
142
+ },
143
+ { immediate: true },
144
+ );
145
+
146
+ const mouseupHandler = async () => {
147
+ isFocused.value = true;
148
+ await nextTick();
149
+ autocomplete.value?.focus();
150
+ };
151
+
152
+ const blurHandler = () => {
153
+ isFocused.value = false;
154
+
155
+ setDisplayState();
156
+ };
157
+
158
+ const changeHandler = (v: string) => {
159
+ emit('change', v);
160
+ };
161
+
162
+ let inputText = '';
163
+
164
+ const inputHandler = (v: string) => {
165
+ if (!v) {
166
+ inputText = v;
167
+ }
168
+ };
169
+
170
+ /**
171
+ * 光标位置是不是}
172
+ * @param selectionStart 光标位置
173
+ */
174
+ const isRightCurlyBracket = (selectionStart = 0) => {
175
+ const lastChar = inputText.substring(selectionStart - 1, selectionStart);
176
+ return lastChar === '}';
177
+ };
178
+
179
+ /**
180
+ * 获取光标位置
181
+ */
182
+ const getSelectionStart = () => {
183
+ let selectionStart = input.value?.selectionStart || 0;
184
+
185
+ // 输入法可能会自动补全},如果当前光标前面一个字符是},则光标前移一位
186
+ if (isRightCurlyBracket(selectionStart)) {
187
+ selectionStart -= 1;
188
+ }
189
+
190
+ return selectionStart;
191
+ };
192
+
193
+ /**
194
+ * 当前输入的是{
195
+ * @param leftCurlyBracketIndex {字符索引
196
+ */
197
+ const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex: number) =>
198
+ leftCurlyBracketIndex > -1 && leftCurlyBracketIndex === getSelectionStart() - 1;
199
+
200
+ /**
201
+ * 当前输入的是.
202
+ * @param leftCurlyBracketIndex .字符索引
203
+ */
204
+ const curCharIsDot = (dotIndex: number) => dotIndex > -1 && dotIndex === getSelectionStart() - 1;
205
+
206
+ /**
207
+ * @param leftCurlyBracketIndex 左大括号字符索引
208
+ * @param cb 建议的方法
209
+ */
210
+ const dsQuerySearch = (queryString: string, leftCurlyBracketIndex: number, cb: (data: { value: string }[]) => void) => {
211
+ let result: DataSourceSchema[] = [];
212
+
213
+ if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
214
+ // 当前输入的是{
215
+ result = dataSources.value;
216
+ } else if (leftCurlyBracketIndex > -1) {
217
+ // 当前输入的是{xx
218
+ const queryName = queryString.substring(leftCurlyBracketIndex + 1).toLowerCase();
219
+ result = dataSources.value.filter((ds) => ds.title?.toLowerCase().includes(queryName) || ds.id.includes(queryName));
220
+ }
221
+
222
+ cb(
223
+ result.map((ds) => ({
224
+ value: ds.id,
225
+ text: ds.title,
226
+ type: 'dataSource',
227
+ })),
228
+ );
229
+ };
230
+
231
+ /**
232
+ * 字段提示
233
+ * @param queryString 当前输入框内的字符串
234
+ * @param leftAngleIndex {字符索引
235
+ * @param dotIndex .字符索引
236
+ * @param cb 建议回调
237
+ */
238
+ const fieldQuerySearch = (
239
+ queryString: string,
240
+ leftAngleIndex: number,
241
+ dotIndex: number,
242
+ cb: (data: { value: string }[]) => void,
243
+ ) => {
244
+ let result: DataSchema[] = [];
245
+
246
+ const dsKey = queryString.substring(leftAngleIndex + 1, dotIndex);
247
+ // 可能是xx.xx.xx,存在链式调用
248
+ const keys = dsKey.split('.');
249
+ // 最前的是数据源id
250
+ const ds = dataSources.value.find((ds) => ds.id === keys.shift());
251
+ if (!ds) {
252
+ return;
253
+ }
254
+
255
+ let fields = ds.fields || [];
256
+
257
+ // 后面这些事字段
258
+ let key = keys.shift();
259
+ while (key) {
260
+ for (const field of fields) {
261
+ if (field.name === key) {
262
+ fields = field.fields || [];
263
+ key = keys.shift();
264
+ break;
265
+ }
266
+ }
267
+ }
268
+
269
+ if (curCharIsDot(dotIndex)) {
270
+ // 当前输入的是.
271
+ result = fields || [];
272
+ } else if (dotIndex > -1) {
273
+ const queryName = queryString.substring(dotIndex + 1).toLowerCase();
274
+ result =
275
+ fields.filter(
276
+ (field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName),
277
+ ) || [];
278
+ }
279
+
280
+ cb(
281
+ result.map((field) => ({
282
+ value: field.name,
283
+ text: field.title,
284
+ type: 'field',
285
+ })),
286
+ );
287
+ };
288
+
289
+ /**
290
+ * 数据源提示
291
+ * @param queryString 当前输入框内的字符串
292
+ * @param cb 建议回调
293
+ */
294
+ const querySearch = (queryString: string, cb: (data: { value: string }[]) => void) => {
295
+ inputText = queryString;
296
+
297
+ const selectionStart = getSelectionStart();
298
+
299
+ const curQueryString = queryString.substring(0, selectionStart);
300
+
301
+ const fieldKeyStringLastIndex = curQueryString.lastIndexOf('.');
302
+ const dsKeyStringLastIndex = curQueryString.lastIndexOf('{');
303
+
304
+ const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
305
+
306
+ if (isFieldTip) {
307
+ fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
308
+ } else {
309
+ dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
310
+ }
311
+ };
312
+
313
+ /**
314
+ * 选择建议
315
+ * @param value 建议值
316
+ * @param type 建议类型,是数据源还是字段
317
+ */
318
+ const selectHandler = async ({ value, type }: { value: string; type: 'dataSource' | 'field' }) => {
319
+ const isDataSource = type === 'dataSource';
320
+ const selectionStart = input.value?.selectionStart || 0;
321
+ let startText = inputText.substring(0, selectionStart);
322
+
323
+ const dotIndex = startText.lastIndexOf('.');
324
+ const leftCurlyBracketIndex = startText.lastIndexOf('{');
325
+
326
+ const endText = inputText.substring(selectionStart);
327
+
328
+ let suggestText = value;
329
+
330
+ if (isDataSource) {
331
+ if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
332
+ startText = startText.substring(0, leftCurlyBracketIndex + 1);
333
+ }
334
+
335
+ // 当前光标后一位是否为},不是的话需要补上
336
+ if (!isRightCurlyBracket(selectionStart + 1)) {
337
+ suggestText = `${suggestText}}`;
338
+ }
339
+ suggestText = `{${suggestText}}`;
340
+ } else if (!curCharIsDot(dotIndex)) {
341
+ startText = startText.substring(0, dotIndex + 1);
342
+ }
343
+
344
+ state.value = `${startText}${suggestText}${endText}`;
345
+
346
+ await nextTick();
347
+
348
+ // 由于选择数据源时会在后面补全}}, 所以光标要前移2位
349
+ let newSelectionStart = 0;
350
+ if (isDataSource) {
351
+ newSelectionStart = leftCurlyBracketIndex + suggestText.length - 1;
352
+ } else {
353
+ newSelectionStart = dotIndex + suggestText.length + 1;
354
+ }
355
+ input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
356
+ };
357
+ </script>
@@ -33,8 +33,8 @@
33
33
  </div>
34
34
  </template>
35
35
 
36
- <script lang="ts" setup name="MEditorEventSelect">
37
- import { computed, defineProps, inject } from 'vue';
36
+ <script lang="ts" setup>
37
+ import { computed, inject } from 'vue';
38
38
  import { Delete } from '@element-plus/icons-vue';
39
39
  import { has } from 'lodash-es';
40
40
 
@@ -44,7 +44,9 @@ import { ActionType } from '@tmagic/schema';
44
44
 
45
45
  import type { EventSelectConfig, Services } from '@editor/type';
46
46
 
47
- const services = inject<Services>('services');
47
+ defineOptions({
48
+ name: 'MEditorEventSelect',
49
+ });
48
50
 
49
51
  const props = defineProps<{
50
52
  config: EventSelectConfig;
@@ -53,8 +55,11 @@ const props = defineProps<{
53
55
  name: string;
54
56
  size: 'small' | 'default' | 'large';
55
57
  }>();
58
+
56
59
  const emit = defineEmits(['change']);
57
60
 
61
+ const services = inject<Services>('services');
62
+
58
63
  // 事件名称下拉框表单配置
59
64
  const eventNameConfig = computed(() => {
60
65
  const defaultEventNameConfig = {
@@ -181,6 +186,7 @@ const actionsConfig = computed(() => ({
181
186
  {
182
187
  type: 'group-list',
183
188
  name: 'actions',
189
+ expandAll: true,
184
190
  enableToggleMode: false,
185
191
  items: [actionTypeConfig.value, targetCompConfig.value, compActionConfig.value, codeActionConfig.value],
186
192
  },
@@ -38,6 +38,10 @@ import { Delete, Plus } from '@element-plus/icons-vue';
38
38
 
39
39
  import { TMagicButton, TMagicInput } from '@tmagic/design';
40
40
 
41
+ defineOptions({
42
+ name: 'MEditorKeyValue',
43
+ });
44
+
41
45
  const props = withDefaults(
42
46
  defineProps<{
43
47
  config: {
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
  </template>
14
14
 
15
- <script lang="ts" setup name="MEditorUISelect">
15
+ <script lang="ts" setup>
16
16
  import { computed, inject, ref } from 'vue';
17
17
  import { Close, Delete } from '@element-plus/icons-vue';
18
18
 
@@ -21,6 +21,10 @@ import { FormState } from '@tmagic/form';
21
21
 
22
22
  import type { Services } from '@editor/type';
23
23
 
24
+ defineOptions({
25
+ name: 'MEditorUISelect',
26
+ });
27
+
24
28
  const props = defineProps<{
25
29
  config: any;
26
30
  model: any;
@@ -8,4 +8,8 @@
8
8
  </svg>
9
9
  </template>
10
10
 
11
- <script lang="ts" setup name="MEditorAppManageIcon"></script>
11
+ <script lang="ts" setup>
12
+ defineOptions({
13
+ name: 'MEditorAppManageIcon',
14
+ });
15
+ </script>
@@ -23,4 +23,8 @@
23
23
  </svg>
24
24
  </template>
25
25
 
26
- <script lang="ts" setup name="MEditorCodeIcon"></script>
26
+ <script lang="ts" setup>
27
+ defineOptions({
28
+ name: 'MEditorCodeIcon',
29
+ });
30
+ </script>
package/src/index.ts CHANGED
@@ -22,6 +22,7 @@ import CodeLink from './fields/CodeLink.vue';
22
22
  import CodeSelect from './fields/CodeSelect.vue';
23
23
  import CodeSelectCol from './fields/CodeSelectCol.vue';
24
24
  import DataSourceFields from './fields/DataSourceFields.vue';
25
+ import DataSourceInput from './fields/DataSourceInput.vue';
25
26
  import EventSelect from './fields/EventSelect.vue';
26
27
  import KeyValue from './fields/KeyValue.vue';
27
28
  import uiSelect from './fields/UISelect.vue';
@@ -51,6 +52,7 @@ export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
51
52
  export { default as CodeSelect } from './fields/CodeSelect.vue';
52
53
  export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
53
54
  export { default as DataSourceFields } from './fields/DataSourceFields.vue';
55
+ export { default as DataSourceInput } from './fields/DataSourceInput.vue';
54
56
  export { default as EventSelect } from './fields/EventSelect.vue';
55
57
  export { default as KeyValue } from './fields/KeyValue.vue';
56
58
  export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
@@ -81,5 +83,6 @@ export default {
81
83
  app.component('m-fields-event-select', EventSelect);
82
84
  app.component('m-fields-data-source-fields', DataSourceFields);
83
85
  app.component('m-fields-key-value', KeyValue);
86
+ app.component('m-fields-data-source-input', DataSourceInput);
84
87
  },
85
88
  };
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </template>
13
13
 
14
- <script lang="ts" setup name="MEditorAddPageBox">
14
+ <script lang="ts" setup>
15
15
  import { inject, toRaw } from 'vue';
16
16
  import { Plus } from '@element-plus/icons-vue';
17
17
 
@@ -21,6 +21,10 @@ import MIcon from '@editor/components/Icon.vue';
21
21
  import type { Services } from '@editor/type';
22
22
  import { generatePageNameByApp } from '@editor/utils';
23
23
 
24
+ defineOptions({
25
+ name: 'MEditorAddPageBox',
26
+ });
27
+
24
28
  const services = inject<Services>('services');
25
29
 
26
30
  const clickHandler = () => {
@@ -2,12 +2,16 @@
2
2
  <div ref="codeEditor" class="magic-code-editor"></div>
3
3
  </template>
4
4
 
5
- <script lang="ts" setup name="MEditorCodeEditor">
5
+ <script lang="ts" setup>
6
6
  import { onMounted, onUnmounted, ref, watch } from 'vue';
7
7
  import { throttle } from 'lodash-es';
8
8
  import * as monaco from 'monaco-editor';
9
9
  import serialize from 'serialize-javascript';
10
10
 
11
+ defineOptions({
12
+ name: 'MEditorCodeEditor',
13
+ });
14
+
11
15
  const props = withDefaults(
12
16
  defineProps<{
13
17
  initValues?: string | Object;
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  </template>
44
44
 
45
- <script lang="ts" setup name="MEditorFramework">
45
+ <script lang="ts" setup>
46
46
  import { computed, inject, ref, watch } from 'vue';
47
47
 
48
48
  import { TMagicScrollbar } from '@tmagic/design';
@@ -52,6 +52,10 @@ import type { GetColumnWidth, Services } from '@editor/type';
52
52
 
53
53
  import AddPageBox from './AddPageBox.vue';
54
54
 
55
+ defineOptions({
56
+ name: 'MEditorFramework',
57
+ });
58
+
55
59
  const DEFAULT_LEFT_COLUMN_WIDTH = 310;
56
60
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
57
61
 
@@ -6,7 +6,7 @@
6
6
  </div>
7
7
  </template>
8
8
 
9
- <script lang="ts" setup name="MEditorNavMenu">
9
+ <script lang="ts" setup>
10
10
  import { computed, inject, markRaw } from 'vue';
11
11
  import { Back, Delete, FullScreen, Grid, Memo, Right, ScaleToOriginal, ZoomIn, ZoomOut } from '@element-plus/icons-vue';
12
12
 
@@ -15,6 +15,10 @@ import { NodeType } from '@tmagic/schema';
15
15
  import ToolButton from '@editor/components/ToolButton.vue';
16
16
  import { ColumnLayout, MenuBarData, MenuButton, MenuComponent, MenuItem, Services } from '@editor/type';
17
17
 
18
+ defineOptions({
19
+ name: 'MEditorNavMenu',
20
+ });
21
+
18
22
  const props = withDefaults(
19
23
  defineProps<{
20
24
  data?: MenuBarData;
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </template>
15
15
 
16
- <script lang="ts" setup name="MEditorPropsPanel">
16
+ <script lang="ts" setup>
17
17
  import { computed, getCurrentInstance, inject, onMounted, onUnmounted, ref, watchEffect } from 'vue';
18
18
 
19
19
  import { tMagicMessage } from '@tmagic/design';
@@ -22,6 +22,10 @@ import { MForm } from '@tmagic/form';
22
22
 
23
23
  import type { Services } from '@editor/type';
24
24
 
25
+ defineOptions({
26
+ name: 'MEditorPropsPanel',
27
+ });
28
+
25
29
  const emit = defineEmits(['mounted']);
26
30
 
27
31
  const internalInstance = getCurrentInstance();
@@ -4,10 +4,14 @@
4
4
  </span>
5
5
  </template>
6
6
 
7
- <script lang="ts" setup name="MEditorResizer">
7
+ <script lang="ts" setup>
8
8
  import { onMounted, onUnmounted, ref } from 'vue';
9
9
  import Gesto from 'gesto';
10
10
 
11
+ defineOptions({
12
+ name: 'MEditorResizer',
13
+ });
14
+
11
15
  const emit = defineEmits(['change']);
12
16
 
13
17
  const target = ref<HTMLSpanElement>();
@@ -31,7 +31,7 @@
31
31
  </TMagicScrollbar>
32
32
  </template>
33
33
 
34
- <script lang="ts" setup name="MEditorComponentListPanel">
34
+ <script lang="ts" setup>
35
35
  import { computed, inject, ref } from 'vue';
36
36
  import { Grid } from '@element-plus/icons-vue';
37
37
  import serialize from 'serialize-javascript';
@@ -43,6 +43,10 @@ import MIcon from '@editor/components/Icon.vue';
43
43
  import SearchInput from '@editor/components/SearchInput.vue';
44
44
  import type { ComponentGroup, ComponentItem, Services, StageOptions } from '@editor/type';
45
45
 
46
+ defineOptions({
47
+ name: 'MEditorComponentListPanel',
48
+ });
49
+
46
50
  const searchText = ref('');
47
51
 
48
52
  const filterTextChangeHandler = (v: string) => {
@@ -2,7 +2,7 @@
2
2
  <ContentMenu :menu-data="menuData" ref="menu" style="overflow: initial"></ContentMenu>
3
3
  </template>
4
4
 
5
- <script lang="ts" setup name="MEditorLayerMenu">
5
+ <script lang="ts" setup>
6
6
  import { computed, inject, markRaw, ref } from 'vue';
7
7
  import { CopyDocument, Delete, Files, Plus } from '@element-plus/icons-vue';
8
8
 
@@ -11,6 +11,10 @@ import { NodeType } from '@tmagic/schema';
11
11
  import ContentMenu from '@editor/components/ContentMenu.vue';
12
12
  import type { ComponentGroup, MenuButton, MenuComponent, Services } from '@editor/type';
13
13
 
14
+ defineOptions({
15
+ name: 'MEditorLayerMenu',
16
+ });
17
+
14
18
  const props = defineProps<{
15
19
  layerContentMenu: (MenuButton | MenuComponent)[];
16
20
  }>();
@@ -48,7 +48,7 @@
48
48
  </TMagicScrollbar>
49
49
  </template>
50
50
 
51
- <script lang="ts" setup name="MEditorLayerPanel">
51
+ <script lang="ts" setup>
52
52
  import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue';
53
53
  import KeyController from 'keycon';
54
54
  import { difference, throttle, union } from 'lodash-es';
@@ -64,6 +64,10 @@ import { Layout } from '@editor/type';
64
64
 
65
65
  import LayerMenu from './LayerMenu.vue';
66
66
 
67
+ defineOptions({
68
+ name: 'MEditorLayerPanel',
69
+ });
70
+
67
71
  defineProps<{
68
72
  layerContentMenu: (MenuButton | MenuComponent)[];
69
73
  }>();