@tmagic/editor 1.3.0-alpha.0 → 1.3.0-alpha.10

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 (124) hide show
  1. package/dist/style.css +46 -9
  2. package/dist/tmagic-editor.js +1764 -871
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +1781 -882
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +19 -20
  7. package/src/Editor.vue +29 -3
  8. package/src/components/CodeDraftEditor.vue +5 -1
  9. package/src/components/ContentMenu.vue +30 -11
  10. package/src/components/FunctionEditor.vue +12 -5
  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 +5 -1
  19. package/src/fields/Code.vue +5 -1
  20. package/src/fields/CodeLink.vue +9 -3
  21. package/src/fields/CodeSelect.vue +8 -2
  22. package/src/fields/CodeSelectCol.vue +6 -2
  23. package/src/fields/DataSourceFields.vue +5 -1
  24. package/src/fields/DataSourceInput.vue +358 -0
  25. package/src/fields/DataSourceSelect.vue +75 -0
  26. package/src/fields/EventSelect.vue +9 -3
  27. package/src/fields/KeyValue.vue +4 -0
  28. package/src/fields/UISelect.vue +5 -1
  29. package/src/icons/AppManageIcon.vue +5 -1
  30. package/src/icons/CenterIcon.vue +13 -0
  31. package/src/icons/CodeIcon.vue +5 -1
  32. package/src/index.ts +13 -3
  33. package/src/initService.ts +73 -0
  34. package/src/layouts/AddPageBox.vue +5 -1
  35. package/src/layouts/CodeEditor.vue +34 -10
  36. package/src/layouts/Framework.vue +25 -25
  37. package/src/layouts/NavMenu.vue +5 -1
  38. package/src/layouts/PropsPanel.vue +14 -4
  39. package/src/layouts/sidebar/ComponentListPanel.vue +8 -5
  40. package/src/layouts/sidebar/LayerMenu.vue +13 -25
  41. package/src/layouts/sidebar/LayerNode.vue +40 -0
  42. package/src/layouts/sidebar/LayerPanel.vue +70 -27
  43. package/src/layouts/sidebar/Sidebar.vue +11 -7
  44. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +8 -4
  45. package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -1
  46. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +4 -0
  47. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +22 -2
  48. package/src/layouts/workspace/Breadcrumb.vue +5 -1
  49. package/src/layouts/workspace/PageBar.vue +5 -1
  50. package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
  51. package/src/layouts/workspace/Stage.vue +29 -7
  52. package/src/layouts/workspace/ViewerMenu.vue +15 -36
  53. package/src/layouts/workspace/Workspace.vue +9 -134
  54. package/src/services/codeBlock.ts +3 -2
  55. package/src/services/dep.ts +4 -0
  56. package/src/services/keybinding.ts +185 -0
  57. package/src/services/storage.ts +3 -2
  58. package/src/theme/content-menu.scss +1 -1
  59. package/src/theme/data-source-input.scss +18 -0
  60. package/src/theme/framework.scss +0 -3
  61. package/src/theme/layer-panel.scss +6 -0
  62. package/src/theme/layout.scss +4 -0
  63. package/src/theme/resizer.scss +25 -10
  64. package/src/theme/stage.scss +4 -0
  65. package/src/theme/theme.scss +1 -0
  66. package/src/type.ts +59 -1
  67. package/src/utils/config.ts +1 -1
  68. package/src/utils/content-menu.ts +92 -0
  69. package/src/utils/dep.ts +7 -1
  70. package/src/utils/keybinding-config.ts +120 -0
  71. package/src/utils/props.ts +34 -0
  72. package/types/Editor.vue.d.ts +7 -1
  73. package/types/components/CodeDraftEditor.vue.d.ts +6 -3
  74. package/types/components/ContentMenu.vue.d.ts +10 -5
  75. package/types/components/FunctionEditor.vue.d.ts +74 -51
  76. package/types/components/Icon.vue.d.ts +2 -2
  77. package/types/{layouts → components}/Resizer.vue.d.ts +2 -2
  78. package/types/components/ScrollBar.vue.d.ts +1 -1
  79. package/types/components/ScrollViewer.vue.d.ts +8 -5
  80. package/types/components/SearchInput.vue.d.ts +1 -1
  81. package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +9 -6
  82. package/types/components/ToolButton.vue.d.ts +8 -5
  83. package/types/editorProps.d.ts +4 -1
  84. package/types/fields/Code.vue.d.ts +1 -1
  85. package/types/fields/CodeLink.vue.d.ts +9 -9
  86. package/types/fields/CodeSelect.vue.d.ts +10 -7
  87. package/types/fields/CodeSelectCol.vue.d.ts +8 -5
  88. package/types/fields/DataSourceFields.vue.d.ts +8 -5
  89. package/types/fields/DataSourceInput.vue.d.ts +54 -0
  90. package/types/fields/DataSourceSelect.vue.d.ts +56 -0
  91. package/types/fields/EventSelect.vue.d.ts +3 -3
  92. package/types/fields/KeyValue.vue.d.ts +8 -5
  93. package/types/fields/UISelect.vue.d.ts +1 -1
  94. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  95. package/types/icons/CenterIcon.vue.d.ts +2 -0
  96. package/types/icons/CodeIcon.vue.d.ts +1 -1
  97. package/types/index.d.ts +7 -2
  98. package/types/initService.d.ts +1 -1
  99. package/types/layouts/AddPageBox.vue.d.ts +1 -1
  100. package/types/layouts/CodeEditor.vue.d.ts +16 -10
  101. package/types/layouts/Framework.vue.d.ts +11 -32
  102. package/types/layouts/NavMenu.vue.d.ts +7 -4
  103. package/types/layouts/PropsPanel.vue.d.ts +276 -4
  104. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
  105. package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
  106. package/types/layouts/sidebar/LayerNode.vue.d.ts +16 -0
  107. package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
  108. package/types/layouts/sidebar/Sidebar.vue.d.ts +18 -15
  109. package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +4 -4
  110. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -7
  111. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +1 -1
  112. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +3 -3
  113. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  114. package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
  115. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
  116. package/types/layouts/workspace/Stage.vue.d.ts +2 -2
  117. package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
  118. package/types/layouts/workspace/Workspace.vue.d.ts +9 -9
  119. package/types/services/keybinding.d.ts +20 -0
  120. package/types/type.d.ts +56 -1
  121. package/types/utils/config.d.ts +1 -1
  122. package/types/utils/content-menu.d.ts +7 -0
  123. package/types/utils/keybinding-config.d.ts +3 -0
  124. package/src/layouts/Resizer.vue +0 -32
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('@tmagic/table'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', '@tmagic/table', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.table, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
5
- })(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, table, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('@tmagic/table'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', '@tmagic/table', 'monaco-editor', 'gesto', '@tmagic/utils', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.table, global.monaco, global.Gesto, global.utils, global.StageCore, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, table, monaco, Gesto, utils, StageCore, events, core, KeyController) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -23,16 +23,16 @@
23
23
 
24
24
  const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
25
25
 
26
- const __default__$w = vue.defineComponent({
27
- name: "MEditorCode"
28
- });
29
- const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30
- ...__default__$w,
26
+ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
27
+ ...{
28
+ name: "MEditorCode"
29
+ },
30
+ __name: "Code",
31
31
  props: {
32
- model: null,
33
- name: null,
34
- config: null,
35
- prop: null
32
+ model: {},
33
+ name: {},
34
+ config: {},
35
+ prop: {}
36
36
  },
37
37
  emits: ["change"],
38
38
  setup(__props, { emit }) {
@@ -46,26 +46,32 @@
46
46
  return (_ctx, _cache) => {
47
47
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
48
48
  return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
49
- style: vue.normalizeStyle(`height: ${vue.unref(height)}`),
50
- "init-values": __props.model[__props.name],
51
- language: vue.unref(language),
52
- options: __props.config.options,
49
+ style: vue.normalizeStyle(`height: ${height.value}`),
50
+ "init-values": _ctx.model[_ctx.name],
51
+ language: language.value,
52
+ options: _ctx.config.options,
53
53
  onSave: save
54
54
  }, null, 8, ["style", "init-values", "language", "options"]);
55
55
  };
56
56
  }
57
57
  });
58
58
 
59
- const __default__$v = vue.defineComponent({
60
- name: "MEditorCodeLink"
61
- });
62
- const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
63
- ...__default__$v,
59
+ let $TMAGIC_EDITOR = {};
60
+ const setConfig = (option) => {
61
+ $TMAGIC_EDITOR = option;
62
+ };
63
+ const getConfig = (key) => $TMAGIC_EDITOR[key];
64
+
65
+ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
66
+ ...{
67
+ name: "MEditorCodeLink"
68
+ },
69
+ __name: "CodeLink",
64
70
  props: {
65
- config: null,
66
- model: null,
67
- name: null,
68
- prop: null
71
+ config: {},
72
+ model: {},
73
+ name: {},
74
+ prop: {}
69
75
  },
70
76
  emits: ["change"],
71
77
  setup(__props, { emit }) {
@@ -111,7 +117,8 @@
111
117
  if (!props.name || !props.model)
112
118
  return;
113
119
  try {
114
- props.model[props.name] = eval(`(${v[props.name]})`);
120
+ const parseDSL = getConfig("parseDSL");
121
+ props.model[props.name] = parseDSL(`(${v[props.name]})`);
115
122
  emit("change", props.model[props.name]);
116
123
  } catch (e) {
117
124
  console.error(e);
@@ -120,7 +127,7 @@
120
127
  return (_ctx, _cache) => {
121
128
  const _component_m_fields_link = vue.resolveComponent("m-fields-link");
122
129
  return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
123
- config: vue.unref(formConfig),
130
+ config: formConfig.value,
124
131
  model: modelValue,
125
132
  name: "form",
126
133
  onChange: changeHandler
@@ -129,17 +136,17 @@
129
136
  }
130
137
  });
131
138
 
132
- const __default__$u = vue.defineComponent({
133
- name: "MEditorCodeSelect"
134
- });
135
- const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
136
- ...__default__$u,
139
+ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
140
+ ...{
141
+ name: "MEditorCodeSelect"
142
+ },
143
+ __name: "CodeSelect",
137
144
  props: {
138
- config: null,
139
- model: null,
140
- prop: null,
141
- name: null,
142
- size: null
145
+ config: {},
146
+ model: {},
147
+ prop: {},
148
+ name: {},
149
+ size: {}
143
150
  },
144
151
  emits: ["change"],
145
152
  setup(__props, { emit }) {
@@ -148,6 +155,8 @@
148
155
  type: "group-list",
149
156
  name: "hookData",
150
157
  enableToggleMode: false,
158
+ expandAll: true,
159
+ titleKey: "codeId",
151
160
  items: [
152
161
  {
153
162
  type: "code-select-col",
@@ -175,13 +184,13 @@
175
184
  return (_ctx, _cache) => {
176
185
  const _component_m_form_container = vue.resolveComponent("m-form-container");
177
186
  return vue.openBlock(), vue.createElementBlock("div", {
178
- class: vue.normalizeClass(["m-fields-code-select", __props.config.className])
187
+ class: vue.normalizeClass(["m-fields-code-select", _ctx.config.className])
179
188
  }, [
180
189
  vue.createVNode(vue.unref(design.TMagicCard), null, {
181
190
  default: vue.withCtx(() => [
182
191
  vue.createVNode(_component_m_form_container, {
183
- config: vue.unref(codeConfig),
184
- model: __props.model[__props.name],
192
+ config: codeConfig.value,
193
+ model: _ctx.model[_ctx.name],
185
194
  onChange: changeHandler
186
195
  }, null, 8, ["config", "model"])
187
196
  ]),
@@ -192,18 +201,18 @@
192
201
  }
193
202
  });
194
203
 
195
- const _hoisted_1$n = ["src"];
196
- const __default__$t = vue.defineComponent({
197
- name: "MEditorIcon"
198
- });
199
- const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
200
- ...__default__$t,
204
+ const _hoisted_1$p = ["src"];
205
+ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
206
+ ...{
207
+ name: "MEditorIcon"
208
+ },
209
+ __name: "Icon",
201
210
  props: {
202
- icon: null
211
+ icon: {}
203
212
  },
204
213
  setup(__props) {
205
214
  return (_ctx, _cache) => {
206
- return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
215
+ return !_ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
207
216
  key: 0,
208
217
  class: "magic-editor-icon"
209
218
  }, {
@@ -211,23 +220,23 @@
211
220
  vue.createVNode(vue.unref(iconsVue.Edit))
212
221
  ]),
213
222
  _: 1
214
- })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
223
+ })) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
215
224
  key: 1,
216
225
  class: "magic-editor-icon"
217
226
  }, {
218
227
  default: vue.withCtx(() => [
219
- vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$n)
228
+ vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$p)
220
229
  ]),
221
230
  _: 1
222
- })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
231
+ })) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
223
232
  key: 2,
224
- class: vue.normalizeClass(["magic-editor-icon", __props.icon])
233
+ class: vue.normalizeClass(["magic-editor-icon", _ctx.icon])
225
234
  }, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
226
235
  key: 3,
227
236
  class: "magic-editor-icon"
228
237
  }, {
229
238
  default: vue.withCtx(() => [
230
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
239
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(_ctx.icon))))
231
240
  ]),
232
241
  _: 1
233
242
  }));
@@ -235,19 +244,19 @@
235
244
  }
236
245
  });
237
246
 
238
- const _hoisted_1$m = { class: "m-fields-code-select-col" };
239
- const _hoisted_2$e = { class: "code-select-container" };
240
- const __default__$s = vue.defineComponent({
241
- name: "MEditorCodeSelectCol"
242
- });
243
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
244
- ...__default__$s,
247
+ const _hoisted_1$o = { class: "m-fields-code-select-col" };
248
+ const _hoisted_2$f = { class: "code-select-container" };
249
+ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
250
+ ...{
251
+ name: "MEditorCodeSelectCol"
252
+ },
253
+ __name: "CodeSelectCol",
245
254
  props: {
246
- config: null,
247
- model: null,
248
- prop: null,
249
- name: null,
250
- size: null
255
+ config: {},
256
+ model: {},
257
+ prop: {},
258
+ name: {},
259
+ size: {}
251
260
  },
252
261
  emits: ["change"],
253
262
  setup(__props, { emit }) {
@@ -329,23 +338,23 @@
329
338
  };
330
339
  return (_ctx, _cache) => {
331
340
  const _component_m_form_container = vue.resolveComponent("m-form-container");
332
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
333
- vue.createElementVNode("div", _hoisted_2$e, [
341
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
342
+ vue.createElementVNode("div", _hoisted_2$f, [
334
343
  vue.createVNode(_component_m_form_container, {
335
344
  class: "select",
336
345
  config: selectConfig,
337
- model: __props.model,
346
+ model: _ctx.model,
338
347
  onChange: onParamsChangeHandler
339
348
  }, null, 8, ["model"]),
340
- vue.createVNode(_sfc_main$A, {
349
+ vue.createVNode(_sfc_main$E, {
341
350
  class: "icon",
342
- icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
351
+ icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
343
352
  onClick: editCode
344
353
  }, null, 8, ["icon"])
345
354
  ]),
346
355
  vue.createVNode(_component_m_form_container, {
347
356
  config: codeParamsConfig.value,
348
- model: __props.model,
357
+ model: _ctx.model,
349
358
  onChange: onParamsChangeHandler
350
359
  }, null, 8, ["config", "model"])
351
360
  ]);
@@ -353,17 +362,19 @@
353
362
  }
354
363
  });
355
364
 
356
- const _hoisted_1$l = { class: "m-editor-data-source-fields" };
357
- const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
358
- const _hoisted_3$8 = /* @__PURE__ */ vue.createTextVNode("添加");
359
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
365
+ const _hoisted_1$n = { class: "m-editor-data-source-fields" };
366
+ const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
367
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
368
+ ...{
369
+ name: "MEditorDataSourceFields"
370
+ },
360
371
  __name: "DataSourceFields",
361
372
  props: {
362
- config: null,
363
- model: null,
364
- prop: null,
373
+ config: {},
374
+ model: {},
375
+ prop: {},
365
376
  disabled: { type: Boolean, default: false },
366
- name: null
377
+ name: {}
367
378
  },
368
379
  emits: ["change"],
369
380
  setup(__props, { emit }) {
@@ -459,7 +470,7 @@
459
470
  {
460
471
  validator: ({ value, callback }, { model, parent }) => {
461
472
  const index = parent.findIndex((item) => item.name === value);
462
- if (model.index === -1 && index > -1 || model.index > -1 && index !== model.index) {
473
+ if (model.index === -1 && index > -1 || model.index > -1 && index > -1 && index !== model.index) {
463
474
  return callback(`属性key(${value})已存在`);
464
475
  }
465
476
  callback();
@@ -499,21 +510,21 @@
499
510
  }
500
511
  ];
501
512
  return (_ctx, _cache) => {
502
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
513
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
503
514
  vue.createVNode(vue.unref(table.MagicTable), {
504
- data: __props.model[__props.name],
515
+ data: _ctx.model[_ctx.name],
505
516
  columns: filedColumns
506
517
  }, null, 8, ["data"]),
507
- vue.createElementVNode("div", _hoisted_2$d, [
518
+ vue.createElementVNode("div", _hoisted_2$e, [
508
519
  vue.createVNode(vue.unref(design.TMagicButton), {
509
520
  size: "small",
510
521
  type: "primary",
511
- disabled: __props.disabled,
522
+ disabled: _ctx.disabled,
512
523
  plain: "",
513
524
  onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
514
525
  }, {
515
526
  default: vue.withCtx(() => [
516
- _hoisted_3$8
527
+ vue.createTextVNode("添加")
517
528
  ]),
518
529
  _: 1
519
530
  }, 8, ["disabled"])
@@ -524,7 +535,7 @@
524
535
  title: filedTitle.value,
525
536
  config: dataSourceFieldsConfig,
526
537
  values: fieldValues.value,
527
- parentValues: __props.model[__props.name],
538
+ parentValues: _ctx.model[_ctx.name],
528
539
  onSubmit: fieldChange
529
540
  }, null, 8, ["title", "values", "parentValues"])
530
541
  ]);
@@ -532,23 +543,343 @@
532
543
  }
533
544
  });
534
545
 
535
- const _hoisted_1$k = { class: "m-fields-event-select" };
546
+ const _hoisted_1$m = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
547
+ const _hoisted_2$d = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
548
+ const _hoisted_3$6 = { class: "el-input__inner" };
549
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
550
+ ...{
551
+ name: "MEditorDataSourceInput"
552
+ },
553
+ __name: "DataSourceInput",
554
+ props: {
555
+ config: {},
556
+ model: {},
557
+ name: {},
558
+ prop: {},
559
+ disabled: { type: Boolean, default: false },
560
+ lastValues: {},
561
+ size: {}
562
+ },
563
+ emits: ["change"],
564
+ setup(__props, { emit }) {
565
+ const props = __props;
566
+ const { dataSourceService } = vue.inject("services") || {};
567
+ const autocomplete = vue.ref();
568
+ const isFocused = vue.ref(false);
569
+ const state = vue.ref("");
570
+ const displayState = vue.ref([]);
571
+ const input = vue.computed(() => autocomplete.value?.inputRef?.input);
572
+ const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
573
+ const setDisplayState = () => {
574
+ displayState.value = [];
575
+ const matches = state.value.matchAll(/\$\{([\s\S]+?)\}/g);
576
+ let index = 0;
577
+ for (const match of matches) {
578
+ if (typeof match.index === "undefined")
579
+ break;
580
+ displayState.value.push({
581
+ type: "text",
582
+ value: state.value.substring(index, match.index)
583
+ });
584
+ let dsText = "";
585
+ let ds;
586
+ let fields;
587
+ match[1].split(".").forEach((item, index2) => {
588
+ if (index2 === 0) {
589
+ ds = dataSources.value.find((ds2) => ds2.id === item);
590
+ dsText += ds?.title || item;
591
+ fields = ds?.fields;
592
+ return;
593
+ }
594
+ const field = fields?.find((field2) => field2.name === item);
595
+ fields = field?.fields;
596
+ dsText += `.${field?.title || item}`;
597
+ });
598
+ displayState.value.push({
599
+ type: "var",
600
+ value: dsText
601
+ });
602
+ index = match.index + match[0].length;
603
+ }
604
+ if (index < state.value.length) {
605
+ displayState.value.push({
606
+ type: "text",
607
+ value: state.value.substring(index)
608
+ });
609
+ }
610
+ };
611
+ vue.watch(
612
+ () => props.model[props.name],
613
+ (value = "") => {
614
+ state.value = value;
615
+ setDisplayState();
616
+ },
617
+ { immediate: true }
618
+ );
619
+ const mouseupHandler = async () => {
620
+ isFocused.value = true;
621
+ await vue.nextTick();
622
+ autocomplete.value?.focus();
623
+ };
624
+ const blurHandler = () => {
625
+ isFocused.value = false;
626
+ setDisplayState();
627
+ };
628
+ const changeHandler = (v) => {
629
+ emit("change", v);
630
+ };
631
+ let inputText = "";
632
+ const inputHandler = (v) => {
633
+ if (!v) {
634
+ inputText = v;
635
+ }
636
+ };
637
+ const isRightCurlyBracket = (selectionStart = 0) => {
638
+ const lastChar = inputText.substring(selectionStart - 1, selectionStart);
639
+ return lastChar === "}";
640
+ };
641
+ const getSelectionStart = () => {
642
+ let selectionStart = input.value?.selectionStart || 0;
643
+ if (isRightCurlyBracket(selectionStart)) {
644
+ selectionStart -= 1;
645
+ }
646
+ return selectionStart;
647
+ };
648
+ const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex) => leftCurlyBracketIndex > 0 && leftCurlyBracketIndex === getSelectionStart() - 1;
649
+ const curCharIsDot = (dotIndex) => dotIndex > -1 && dotIndex === getSelectionStart() - 1;
650
+ const dsQuerySearch = (queryString, leftCurlyBracketIndex, cb) => {
651
+ let result = [];
652
+ if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
653
+ result = dataSources.value;
654
+ } else if (leftCurlyBracketIndex > 0) {
655
+ const queryName = queryString.substring(leftCurlyBracketIndex + 1).toLowerCase();
656
+ result = dataSources.value.filter((ds) => ds.title?.toLowerCase().includes(queryName) || ds.id.includes(queryName));
657
+ }
658
+ cb(
659
+ result.map((ds) => ({
660
+ value: ds.id,
661
+ text: ds.title,
662
+ type: "dataSource"
663
+ }))
664
+ );
665
+ };
666
+ const fieldQuerySearch = (queryString, leftAngleIndex, dotIndex, cb) => {
667
+ let result = [];
668
+ const dsKey = queryString.substring(leftAngleIndex + 1, dotIndex);
669
+ const keys = dsKey.split(".");
670
+ const ds = dataSources.value.find((ds2) => ds2.id === keys.shift());
671
+ if (!ds) {
672
+ return;
673
+ }
674
+ let fields = ds.fields || [];
675
+ let key = keys.shift();
676
+ while (key) {
677
+ for (const field of fields) {
678
+ if (field.name === key) {
679
+ fields = field.fields || [];
680
+ key = keys.shift();
681
+ break;
682
+ }
683
+ }
684
+ }
685
+ if (curCharIsDot(dotIndex)) {
686
+ result = fields || [];
687
+ } else if (dotIndex > -1) {
688
+ const queryName = queryString.substring(dotIndex + 1).toLowerCase();
689
+ result = fields.filter(
690
+ (field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
691
+ ) || [];
692
+ }
693
+ cb(
694
+ result.map((field) => ({
695
+ value: field.name,
696
+ text: field.title,
697
+ type: "field"
698
+ }))
699
+ );
700
+ };
701
+ const querySearch = (queryString, cb) => {
702
+ inputText = queryString;
703
+ const selectionStart = getSelectionStart();
704
+ const curQueryString = queryString.substring(0, selectionStart);
705
+ const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
706
+ const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
707
+ const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
708
+ if (isFieldTip) {
709
+ fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
710
+ } else {
711
+ dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
712
+ }
713
+ };
714
+ const selectHandler = async ({ value, type }) => {
715
+ const isDataSource = type === "dataSource";
716
+ const selectionStart = input.value?.selectionStart || 0;
717
+ let startText = inputText.substring(0, selectionStart);
718
+ const dotIndex = startText.lastIndexOf(".");
719
+ const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
720
+ const endText = inputText.substring(selectionStart);
721
+ let suggestText = value;
722
+ if (isDataSource) {
723
+ if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
724
+ startText = startText.substring(0, leftCurlyBracketIndex + 1);
725
+ }
726
+ if (!isRightCurlyBracket(selectionStart + 1)) {
727
+ suggestText = `${suggestText}}`;
728
+ }
729
+ } else if (!curCharIsDot(dotIndex)) {
730
+ startText = startText.substring(0, dotIndex + 1);
731
+ }
732
+ state.value = `${startText}${suggestText}${endText}`;
733
+ await vue.nextTick();
734
+ let newSelectionStart = 0;
735
+ if (isDataSource) {
736
+ newSelectionStart = leftCurlyBracketIndex + suggestText.length;
737
+ } else {
738
+ newSelectionStart = dotIndex + suggestText.length + 1;
739
+ }
740
+ input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
741
+ };
742
+ return (_ctx, _cache) => {
743
+ return _ctx.disabled || isFocused.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(design.getConfig)("components")?.autocomplete.component || "el-autocomplete"), vue.mergeProps(
744
+ {
745
+ key: 0,
746
+ class: "tmagic-design-auto-complete",
747
+ ref_key: "autocomplete",
748
+ ref: autocomplete,
749
+ modelValue: state.value,
750
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
751
+ },
752
+ vue.unref(design.getConfig)("components")?.autocomplete.props({
753
+ disabled: _ctx.disabled,
754
+ size: _ctx.size,
755
+ fetchSuggestions: querySearch,
756
+ triggerOnFocus: false,
757
+ clearable: true
758
+ }) || {},
759
+ {
760
+ style: { "width": "100%" },
761
+ onBlur: blurHandler,
762
+ onChange: changeHandler,
763
+ onInput: inputHandler,
764
+ onSelect: selectHandler
765
+ }
766
+ ), {
767
+ suffix: vue.withCtx(() => [
768
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
769
+ ]),
770
+ default: vue.withCtx(({ item }) => [
771
+ vue.createElementVNode("div", _hoisted_1$m, [
772
+ vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
773
+ vue.createElementVNode("span", _hoisted_2$d, vue.toDisplayString(item.value), 1)
774
+ ])
775
+ ]),
776
+ _: 1
777
+ }, 16, ["modelValue"])) : (vue.openBlock(), vue.createElementBlock("div", {
778
+ key: 1,
779
+ class: vue.normalizeClass(`tmagic-data-source-input-text el-input el-input--${_ctx.size}`),
780
+ onMouseup: mouseupHandler
781
+ }, [
782
+ vue.createElementVNode("div", {
783
+ class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
784
+ }, [
785
+ vue.createElementVNode("div", _hoisted_3$6, [
786
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
787
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
788
+ item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
789
+ key: index,
790
+ style: { "margin-right": "2px" }
791
+ }, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
792
+ item.type === "var" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
793
+ key: index,
794
+ size: _ctx.size
795
+ }, {
796
+ default: vue.withCtx(() => [
797
+ vue.createTextVNode(vue.toDisplayString(item.value), 1)
798
+ ]),
799
+ _: 2
800
+ }, 1032, ["size"])) : vue.createCommentVNode("", true)
801
+ ], 64);
802
+ }), 256)),
803
+ vue.createVNode(_sfc_main$E, {
804
+ class: "tmagic-data-source-input-icon",
805
+ icon: vue.unref(iconsVue.Coin)
806
+ }, null, 8, ["icon"])
807
+ ])
808
+ ], 2)
809
+ ], 34));
810
+ };
811
+ }
812
+ });
813
+
814
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
815
+ ...{
816
+ name: "MEditorDataSourceSelect"
817
+ },
818
+ __name: "DataSourceSelect",
819
+ props: {
820
+ config: {},
821
+ model: {},
822
+ name: {},
823
+ prop: {},
824
+ disabled: { type: Boolean, default: false },
825
+ lastValues: {},
826
+ size: {}
827
+ },
828
+ emits: ["change"],
829
+ setup(__props, { emit }) {
830
+ const props = __props;
831
+ const { dataSourceService } = vue.inject("services") || {};
832
+ const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
833
+ const selectConfig = vue.computed(() => {
834
+ const { type, dataSourceType, ...config } = props.config;
835
+ return {
836
+ ...config,
837
+ type: "select",
838
+ valueKey: "dataSourceId",
839
+ options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
840
+ value: {
841
+ isBindDataSource: true,
842
+ dataSourceType: ds.type,
843
+ dataSourceId: ds.id
844
+ },
845
+ text: ds.title || ds.id
846
+ }))
847
+ };
848
+ });
849
+ const changeHandler = (value) => {
850
+ emit("change", value);
851
+ };
852
+ return (_ctx, _cache) => {
853
+ return vue.openBlock(), vue.createBlock(vue.unref(form.MSelect), {
854
+ model: _ctx.model,
855
+ name: _ctx.name,
856
+ size: _ctx.size,
857
+ prop: _ctx.prop,
858
+ disabled: _ctx.disabled,
859
+ config: selectConfig.value,
860
+ "last-values": _ctx.lastValues,
861
+ onChange: changeHandler
862
+ }, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
863
+ };
864
+ }
865
+ });
866
+
867
+ const _hoisted_1$l = { class: "m-fields-event-select" };
536
868
  const _hoisted_2$c = {
537
869
  key: 1,
538
870
  class: "fullWidth"
539
871
  };
540
- const _hoisted_3$7 = /* @__PURE__ */ vue.createTextVNode("添加事件");
541
- const __default__$r = vue.defineComponent({
542
- name: "MEditorEventSelect"
543
- });
544
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
545
- ...__default__$r,
872
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
873
+ ...{
874
+ name: "MEditorEventSelect"
875
+ },
876
+ __name: "EventSelect",
546
877
  props: {
547
- config: null,
548
- model: null,
549
- prop: null,
550
- name: null,
551
- size: null
878
+ config: {},
879
+ model: {},
880
+ prop: {},
881
+ name: {},
882
+ size: {}
552
883
  },
553
884
  emits: ["change"],
554
885
  setup(__props, { emit }) {
@@ -665,6 +996,7 @@
665
996
  {
666
997
  type: "group-list",
667
998
  name: "actions",
999
+ expandAll: true,
668
1000
  enableToggleMode: false,
669
1001
  items: [actionTypeConfig.value, targetCompConfig.value, compActionConfig.value, codeActionConfig.value]
670
1002
  }
@@ -699,14 +1031,14 @@
699
1031
  const _component_m_form_table = vue.resolveComponent("m-form-table");
700
1032
  const _component_m_form_container = vue.resolveComponent("m-form-container");
701
1033
  const _component_m_form_panel = vue.resolveComponent("m-form-panel");
702
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
703
- vue.unref(isOldVersion) ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
1034
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
1035
+ isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
704
1036
  key: 0,
705
1037
  ref: "eventForm",
706
1038
  size: props.size,
707
- model: __props.model,
1039
+ model: _ctx.model,
708
1040
  name: "events",
709
- config: vue.unref(tableConfig),
1041
+ config: tableConfig.value,
710
1042
  onChange: onChangeHandler
711
1043
  }, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
712
1044
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -716,21 +1048,21 @@
716
1048
  onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
717
1049
  }, {
718
1050
  default: vue.withCtx(() => [
719
- _hoisted_3$7
1051
+ vue.createTextVNode("添加事件")
720
1052
  ]),
721
1053
  _: 1
722
1054
  }),
723
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.model[__props.name], (cardItem, index) => {
1055
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.model[_ctx.name], (cardItem, index) => {
724
1056
  return vue.openBlock(), vue.createBlock(_component_m_form_panel, {
725
1057
  key: index,
726
- config: vue.unref(actionsConfig),
1058
+ config: actionsConfig.value,
727
1059
  model: cardItem,
728
1060
  onChange: onChangeHandler
729
1061
  }, {
730
1062
  header: vue.withCtx(() => [
731
1063
  vue.createVNode(_component_m_form_container, {
732
1064
  class: "fullWidth",
733
- config: vue.unref(eventNameConfig),
1065
+ config: eventNameConfig.value,
734
1066
  model: cardItem,
735
1067
  onChange: onChangeHandler
736
1068
  }, null, 8, ["config", "model"]),
@@ -750,19 +1082,21 @@
750
1082
  }
751
1083
  });
752
1084
 
753
- const _hoisted_1$j = { class: "m-fields-key-value" };
1085
+ const _hoisted_1$k = { class: "m-fields-key-value" };
754
1086
  const _hoisted_2$b = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
755
- const _hoisted_3$6 = /* @__PURE__ */ vue.createTextVNode("添加");
756
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
1087
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
1088
+ ...{
1089
+ name: "MEditorKeyValue"
1090
+ },
757
1091
  __name: "KeyValue",
758
1092
  props: {
759
- config: null,
760
- model: null,
761
- name: null,
762
- prop: null,
1093
+ config: {},
1094
+ model: {},
1095
+ name: {},
1096
+ prop: {},
763
1097
  disabled: { type: Boolean, default: false },
764
- lastValues: null,
765
- size: null
1098
+ lastValues: {},
1099
+ size: {}
766
1100
  },
767
1101
  emits: ["change"],
768
1102
  setup(__props, { emit }) {
@@ -793,7 +1127,7 @@
793
1127
  records.value.splice(index, 1);
794
1128
  };
795
1129
  return (_ctx, _cache) => {
796
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
1130
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
797
1131
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
798
1132
  return vue.openBlock(), vue.createElementBlock("div", {
799
1133
  class: "m-fields-key-value-item",
@@ -803,8 +1137,8 @@
803
1137
  placeholder: "key",
804
1138
  modelValue: records.value[index][0],
805
1139
  "onUpdate:modelValue": ($event) => records.value[index][0] = $event,
806
- disabled: __props.disabled,
807
- size: __props.size,
1140
+ disabled: _ctx.disabled,
1141
+ size: _ctx.size,
808
1142
  onChange: keyChangeHandler
809
1143
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
810
1144
  _hoisted_2$b,
@@ -812,14 +1146,14 @@
812
1146
  placeholder: "value",
813
1147
  modelValue: records.value[index][1],
814
1148
  "onUpdate:modelValue": ($event) => records.value[index][1] = $event,
815
- disabled: __props.disabled,
816
- size: __props.size,
1149
+ disabled: _ctx.disabled,
1150
+ size: _ctx.size,
817
1151
  onChange: valueChangeHandler
818
1152
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
819
1153
  vue.createVNode(vue.unref(design.TMagicButton), {
820
1154
  class: "m-fileds-key-value-delete",
821
1155
  type: "danger",
822
- size: __props.size,
1156
+ size: _ctx.size,
823
1157
  circle: "",
824
1158
  plain: "",
825
1159
  icon: vue.unref(iconsVue.Delete),
@@ -829,13 +1163,13 @@
829
1163
  }), 128)),
830
1164
  vue.createVNode(vue.unref(design.TMagicButton), {
831
1165
  type: "primary",
832
- size: __props.size,
1166
+ size: _ctx.size,
833
1167
  plain: "",
834
1168
  icon: vue.unref(iconsVue.Plus),
835
1169
  onClick: addHandler
836
1170
  }, {
837
1171
  default: vue.withCtx(() => [
838
- _hoisted_3$6
1172
+ vue.createTextVNode("添加")
839
1173
  ]),
840
1174
  _: 1
841
1175
  }, 8, ["size", "icon"])
@@ -844,17 +1178,16 @@
844
1178
  }
845
1179
  });
846
1180
 
847
- const _hoisted_1$i = /* @__PURE__ */ vue.createTextVNode("取消");
848
- const __default__$q = vue.defineComponent({
849
- name: "MEditorUISelect"
850
- });
851
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
852
- ...__default__$q,
1181
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
1182
+ ...{
1183
+ name: "MEditorUISelect"
1184
+ },
1185
+ __name: "UISelect",
853
1186
  props: {
854
- config: null,
855
- model: null,
856
- prop: null,
857
- name: null
1187
+ config: {},
1188
+ model: {},
1189
+ prop: {},
1190
+ name: {}
858
1191
  },
859
1192
  emits: ["change"],
860
1193
  setup(__props, { emit }) {
@@ -911,7 +1244,7 @@
911
1244
  style: { "padding": "0" }
912
1245
  }, {
913
1246
  default: vue.withCtx(() => [
914
- _hoisted_1$i
1247
+ vue.createTextVNode("取消")
915
1248
  ]),
916
1249
  _: 1
917
1250
  }, 8, ["icon"])
@@ -921,7 +1254,7 @@
921
1254
  onClick: startSelect,
922
1255
  style: { "display": "flex" }
923
1256
  }, [
924
- vue.unref(val) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
1257
+ val.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
925
1258
  key: 0,
926
1259
  content: "清除"
927
1260
  }, {
@@ -937,7 +1270,7 @@
937
1270
  _: 1
938
1271
  })) : vue.createCommentVNode("", true),
939
1272
  vue.createVNode(vue.unref(design.TMagicTooltip), {
940
- content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "点击此处选择"
1273
+ content: val.value ? toName.value + "_" + val.value : "点击此处选择"
941
1274
  }, {
942
1275
  default: vue.withCtx(() => [
943
1276
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -945,7 +1278,7 @@
945
1278
  style: { "padding": "0", "margin": "0" }
946
1279
  }, {
947
1280
  default: vue.withCtx(() => [
948
- vue.createTextVNode(vue.toDisplayString(vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "点击此处选择"), 1)
1281
+ vue.createTextVNode(vue.toDisplayString(val.value ? toName.value + "_" + val.value : "点击此处选择"), 1)
949
1282
  ]),
950
1283
  _: 1
951
1284
  })
@@ -959,15 +1292,15 @@
959
1292
 
960
1293
  const UISelect_vue_vue_type_style_index_0_lang = '';
961
1294
 
962
- const __default__$p = vue.defineComponent({
963
- name: "MEditorCodeEditor"
964
- });
965
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
966
- ...__default__$p,
1295
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
1296
+ ...{
1297
+ name: "MEditorCodeEditor"
1298
+ },
1299
+ __name: "CodeEditor",
967
1300
  props: {
968
- initValues: null,
969
- modifiedValues: null,
970
- type: null,
1301
+ initValues: {},
1302
+ modifiedValues: {},
1303
+ type: {},
971
1304
  language: { default: "javascript" },
972
1305
  options: { default: () => ({
973
1306
  tabSize: 2
@@ -975,15 +1308,19 @@
975
1308
  autoSave: { type: Boolean, default: true }
976
1309
  },
977
1310
  emits: ["initd", "save"],
978
- setup(__props, { expose, emit }) {
1311
+ setup(__props, { expose: __expose, emit }) {
979
1312
  const props = __props;
980
1313
  const toString = (v, language) => {
981
1314
  let value = "";
982
1315
  if (typeof v !== "string") {
983
- value = serialize(v, {
984
- space: 2,
985
- unsafe: true
986
- }).replace(/"(\w+)":\s/g, "$1: ");
1316
+ if (props.language.toLocaleLowerCase() === "json") {
1317
+ value = JSON.stringify(v, null, 2);
1318
+ } else {
1319
+ value = serialize(v, {
1320
+ space: 2,
1321
+ unsafe: true
1322
+ }).replace(/"(\w+)":\s/g, "$1: ");
1323
+ }
987
1324
  } else {
988
1325
  value = v;
989
1326
  }
@@ -1015,7 +1352,7 @@
1015
1352
  }
1016
1353
  return vsEditor?.setValue(values.value);
1017
1354
  };
1018
- const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
1355
+ const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
1019
1356
  const init = async () => {
1020
1357
  if (!codeEditor.value)
1021
1358
  return;
@@ -1037,12 +1374,18 @@
1037
1374
  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
1038
1375
  e.preventDefault();
1039
1376
  e.stopPropagation();
1040
- emit("save", getEditorValue());
1377
+ const newValue = getEditorValue();
1378
+ values.value = newValue;
1379
+ emit("save", newValue);
1041
1380
  }
1042
1381
  });
1043
1382
  if (props.type !== "diff" && props.autoSave) {
1044
1383
  vsEditor?.onDidBlurEditorWidget(() => {
1045
- emit("save", getEditorValue());
1384
+ const newValue = getEditorValue();
1385
+ if (values.value !== newValue) {
1386
+ values.value = newValue;
1387
+ emit("save", newValue);
1388
+ }
1046
1389
  });
1047
1390
  }
1048
1391
  resizeObserver.observe(codeEditor.value);
@@ -1066,10 +1409,17 @@
1066
1409
  vue.onUnmounted(() => {
1067
1410
  resizeObserver.disconnect();
1068
1411
  });
1069
- expose({
1412
+ __expose({
1413
+ values,
1070
1414
  getEditor() {
1071
1415
  return vsEditor || vsDiffEditor;
1072
1416
  },
1417
+ getVsEditor() {
1418
+ return vsEditor;
1419
+ },
1420
+ getVsDiffEditor() {
1421
+ return vsDiffEditor;
1422
+ },
1073
1423
  setEditorValue,
1074
1424
  focus() {
1075
1425
  vsEditor?.focus();
@@ -1086,20 +1436,15 @@
1086
1436
  }
1087
1437
  });
1088
1438
 
1089
- let $TMAGIC_EDITOR = {};
1090
- const setConfig = (option) => {
1091
- $TMAGIC_EDITOR = option;
1092
- };
1093
- const getConfig = (key) => $TMAGIC_EDITOR[key];
1094
-
1095
- const __default__$o = vue.defineComponent({
1096
- name: "MEditorResizer"
1097
- });
1098
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
1099
- ...__default__$o,
1439
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
1440
+ ...{
1441
+ name: "MEditorResizer"
1442
+ },
1443
+ __name: "Resizer",
1100
1444
  emits: ["change"],
1101
1445
  setup(__props, { emit }) {
1102
1446
  const target = vue.ref();
1447
+ const isDraging = vue.ref(false);
1103
1448
  let getso;
1104
1449
  vue.onMounted(() => {
1105
1450
  if (!target.value)
@@ -1111,37 +1456,42 @@
1111
1456
  if (!target.value)
1112
1457
  return;
1113
1458
  emit("change", e.deltaX);
1459
+ }).on("dragStart", () => {
1460
+ isDraging.value = true;
1461
+ }).on("dragEnd", () => {
1462
+ isDraging.value = false;
1114
1463
  });
1115
1464
  });
1116
1465
  vue.onUnmounted(() => {
1117
1466
  getso?.unset();
1467
+ isDraging.value = false;
1118
1468
  });
1119
1469
  return (_ctx, _cache) => {
1120
1470
  return vue.openBlock(), vue.createElementBlock("span", {
1121
1471
  ref_key: "target",
1122
1472
  ref: target,
1123
- class: "m-editor-resizer"
1473
+ class: vue.normalizeClass(["m-editor-resizer", { "m-editor-resizer-draging": isDraging.value }])
1124
1474
  }, [
1125
1475
  vue.renderSlot(_ctx.$slots, "default")
1126
- ], 512);
1476
+ ], 2);
1127
1477
  };
1128
1478
  }
1129
1479
  });
1130
1480
 
1131
- const __default__$n = vue.defineComponent({
1132
- name: "MEditorLayout"
1133
- });
1134
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
1135
- ...__default__$n,
1481
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
1482
+ ...{
1483
+ name: "MEditorLayout"
1484
+ },
1485
+ __name: "SplitView",
1136
1486
  props: {
1137
- left: null,
1138
- right: null,
1487
+ left: {},
1488
+ right: {},
1139
1489
  minLeft: { default: 46 },
1140
1490
  minRight: { default: 1 },
1141
1491
  minCenter: { default: 5 },
1142
- leftClass: null,
1143
- rightClass: null,
1144
- centerClass: null
1492
+ leftClass: {},
1493
+ rightClass: {},
1494
+ centerClass: {}
1145
1495
  },
1146
1496
  emits: ["update:left", "change", "update:right"],
1147
1497
  setup(__props, { emit }) {
@@ -1233,26 +1583,26 @@
1233
1583
  ref: el,
1234
1584
  class: "m-editor-layout"
1235
1585
  }, [
1236
- vue.unref(hasLeft) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
1586
+ hasLeft.value && _ctx.$slots.left ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
1237
1587
  vue.createElementVNode("div", {
1238
- class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
1239
- style: vue.normalizeStyle(`width: ${__props.left}px`)
1588
+ class: vue.normalizeClass(["m-editor-layout-left", _ctx.leftClass]),
1589
+ style: vue.normalizeStyle(`width: ${_ctx.left}px`)
1240
1590
  }, [
1241
1591
  vue.renderSlot(_ctx.$slots, "left")
1242
1592
  ], 6),
1243
- vue.createVNode(_sfc_main$t, { onChange: changeLeft })
1593
+ vue.createVNode(_sfc_main$v, { onChange: changeLeft })
1244
1594
  ], 64)) : vue.createCommentVNode("", true),
1245
1595
  vue.createElementVNode("div", {
1246
- class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
1596
+ class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
1247
1597
  style: vue.normalizeStyle(`width: ${center.value}px`)
1248
1598
  }, [
1249
1599
  vue.renderSlot(_ctx.$slots, "center")
1250
1600
  ], 6),
1251
- vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
1252
- vue.createVNode(_sfc_main$t, { onChange: changeRight }),
1601
+ hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
1602
+ vue.createVNode(_sfc_main$v, { onChange: changeRight }),
1253
1603
  vue.createElementVNode("div", {
1254
- class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
1255
- style: vue.normalizeStyle(`width: ${__props.right}px`)
1604
+ class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
1605
+ style: vue.normalizeStyle(`width: ${_ctx.right}px`)
1256
1606
  }, [
1257
1607
  vue.renderSlot(_ctx.$slots, "right")
1258
1608
  ], 6)
@@ -1342,6 +1692,40 @@
1342
1692
  }
1343
1693
  ]
1344
1694
  },
1695
+ {
1696
+ type: "fieldset",
1697
+ legend: "边框",
1698
+ items: [
1699
+ {
1700
+ name: "borderWidth",
1701
+ text: "宽度",
1702
+ defaultValue: "0"
1703
+ },
1704
+ {
1705
+ name: "borderColor",
1706
+ text: "颜色",
1707
+ type: "colorPicker"
1708
+ },
1709
+ {
1710
+ name: "borderStyle",
1711
+ text: "样式",
1712
+ type: "select",
1713
+ defaultValue: "none",
1714
+ options: [
1715
+ { text: "none", value: "none" },
1716
+ { text: "hidden", value: "hidden" },
1717
+ { text: "dotted", value: "dotted" },
1718
+ { text: "dashed", value: "dashed" },
1719
+ { text: "solid", value: "solid" },
1720
+ { text: "double", value: "double" },
1721
+ { text: "groove", value: "groove" },
1722
+ { text: "ridge", value: "ridge" },
1723
+ { text: "inset", value: "inset" },
1724
+ { text: "outset", value: "outset" }
1725
+ ]
1726
+ }
1727
+ ]
1728
+ },
1345
1729
  {
1346
1730
  type: "fieldset",
1347
1731
  legend: "背景",
@@ -1501,6 +1885,28 @@
1501
1885
  return CodeDeleteErrorType2;
1502
1886
  })(CodeDeleteErrorType || {});
1503
1887
  const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
1888
+ var KeyBindingCommand = /* @__PURE__ */ ((KeyBindingCommand2) => {
1889
+ KeyBindingCommand2["COPY_NODE"] = "tmagic-system-copy-node";
1890
+ KeyBindingCommand2["PASTE_NODE"] = "tmagic-system-paste-node";
1891
+ KeyBindingCommand2["DELETE_NODE"] = "tmagic-system-delete-node";
1892
+ KeyBindingCommand2["CUT_NODE"] = "tmagic-system-cut-node";
1893
+ KeyBindingCommand2["UNDO"] = "tmagic-system-undo";
1894
+ KeyBindingCommand2["REDO"] = "tmagic-system-redo";
1895
+ KeyBindingCommand2["ZOOM_IN"] = "tmagic-system-zoom-in";
1896
+ KeyBindingCommand2["ZOOM_OUT"] = "tmagic-system-zoom-out";
1897
+ KeyBindingCommand2["ZOOM_RESET"] = "tmagic-system-zoom-reset";
1898
+ KeyBindingCommand2["ZOOM_FIT"] = "tmagic-system-zoom-fit";
1899
+ KeyBindingCommand2["MOVE_UP_1"] = "tmagic-system-move-up-1";
1900
+ KeyBindingCommand2["MOVE_DOWN_1"] = "tmagic-system-move-down-1";
1901
+ KeyBindingCommand2["MOVE_LEFT_1"] = "tmagic-system-move-left-1";
1902
+ KeyBindingCommand2["MOVE_RIGHT_1"] = "tmagic-system-move-right-1";
1903
+ KeyBindingCommand2["MOVE_UP_10"] = "tmagic-system-move-up-10";
1904
+ KeyBindingCommand2["MOVE_DOWN_10"] = "tmagic-system-move-down-10";
1905
+ KeyBindingCommand2["MOVE_LEFT_10"] = "tmagic-system-move-left-10";
1906
+ KeyBindingCommand2["MOVE_RIGHT_10"] = "tmagic-system-move-right-10";
1907
+ KeyBindingCommand2["SWITCH_NODE"] = "tmagic-system-switch-node";
1908
+ return KeyBindingCommand2;
1909
+ })(KeyBindingCommand || {});
1504
1910
 
1505
1911
  const COPY_STORAGE_KEY = "$MagicEditorCopyData";
1506
1912
  const getPageList = (app) => {
@@ -1947,8 +2353,8 @@
1947
2353
  * 清理,支持storageService.usePlugin
1948
2354
  */
1949
2355
  async clear() {
1950
- const storage2 = await this.getStorage();
1951
- storage2.clear();
2356
+ const storage = await this.getStorage();
2357
+ storage.clear();
1952
2358
  }
1953
2359
  /**
1954
2360
  * 获取存储项,支持storageService.usePlugin
@@ -1962,7 +2368,7 @@
1962
2368
  return null;
1963
2369
  switch (protocol) {
1964
2370
  case "object" /* OBJECT */:
1965
- return eval(`(${item})`);
2371
+ return getConfig("parseDSL")(`(${item})`);
1966
2372
  case "json" /* JSON */:
1967
2373
  return JSON.parse(item);
1968
2374
  case "number" /* NUMBER */:
@@ -1977,49 +2383,49 @@
1977
2383
  * 获取指定索引位置的key
1978
2384
  */
1979
2385
  async key(index) {
1980
- const storage2 = await this.getStorage();
1981
- return storage2.key(index);
2386
+ const storage = await this.getStorage();
2387
+ return storage.key(index);
1982
2388
  }
1983
2389
  /**
1984
2390
  * 移除存储项,支持storageService.usePlugin
1985
2391
  */
1986
- async removeItem(key2, options2 = {}) {
1987
- const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
1988
- storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
2392
+ async removeItem(key, options = {}) {
2393
+ const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
2394
+ storage.removeItem(`${options.namespace || namespace}:${key}`);
1989
2395
  }
1990
2396
  /**
1991
2397
  * 设置存储项,支持storageService.usePlugin
1992
2398
  */
1993
- async setItem(key2, value, options2 = {}) {
1994
- const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
1995
- let item2 = value;
1996
- const protocol2 = options2.protocol ? `${options2.protocol}:` : "";
2399
+ async setItem(key, value, options = {}) {
2400
+ const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
2401
+ let item = value;
2402
+ const protocol = options.protocol ? `${options.protocol}:` : "";
1997
2403
  if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
1998
- item2 = `${protocol2}${value}`;
2404
+ item = `${protocol}${value}`;
1999
2405
  } else {
2000
- item2 = `${protocol2}${serialize(value)}`;
2406
+ item = `${protocol}${serialize(value)}`;
2001
2407
  }
2002
- storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
2408
+ storage.setItem(`${options.namespace || namespace}:${key}`, item);
2003
2409
  }
2004
2410
  destroy() {
2005
2411
  this.removeAllListeners();
2006
2412
  this.removeAllPlugins();
2007
2413
  }
2008
2414
  getValueAndProtocol(value) {
2009
- let protocol2 = "";
2415
+ let protocol = "";
2010
2416
  if (value === null) {
2011
2417
  return {
2012
2418
  item: value,
2013
- protocol: protocol2
2419
+ protocol
2014
2420
  };
2015
2421
  }
2016
- const item2 = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
2017
- protocol2 = $1;
2422
+ const item = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
2423
+ protocol = $1;
2018
2424
  return $3;
2019
2425
  });
2020
2426
  return {
2021
- protocol: protocol2,
2022
- item: item2
2427
+ protocol,
2428
+ item
2023
2429
  };
2024
2430
  }
2025
2431
  }
@@ -3116,14 +3522,14 @@
3116
3522
  return stage;
3117
3523
  };
3118
3524
 
3119
- const _hoisted_1$h = { class: "m-editor-empty-panel" };
3525
+ const _hoisted_1$j = { class: "m-editor-empty-panel" };
3120
3526
  const _hoisted_2$a = { class: "m-editor-empty-content" };
3121
3527
  const _hoisted_3$5 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
3122
- const __default__$m = vue.defineComponent({
3123
- name: "MEditorAddPageBox"
3124
- });
3125
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
3126
- ...__default__$m,
3528
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
3529
+ ...{
3530
+ name: "MEditorAddPageBox"
3531
+ },
3532
+ __name: "AddPageBox",
3127
3533
  setup(__props) {
3128
3534
  const services = vue.inject("services");
3129
3535
  const clickHandler = () => {
@@ -3139,14 +3545,14 @@
3139
3545
  });
3140
3546
  };
3141
3547
  return (_ctx, _cache) => {
3142
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
3548
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
3143
3549
  vue.createElementVNode("div", _hoisted_2$a, [
3144
3550
  vue.createElementVNode("div", {
3145
3551
  class: "m-editor-empty-button",
3146
3552
  onClick: clickHandler
3147
3553
  }, [
3148
3554
  vue.createElementVNode("div", null, [
3149
- vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
3555
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
3150
3556
  ]),
3151
3557
  _hoisted_3$5
3152
3558
  ])
@@ -3156,25 +3562,22 @@
3156
3562
  }
3157
3563
  });
3158
3564
 
3159
- const _hoisted_1$g = { class: "m-editor" };
3160
- const __default__$l = vue.defineComponent({
3161
- name: "MEditorFramework"
3162
- });
3163
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
3164
- ...__default__$l,
3165
- props: {
3166
- codeOptions: { default: () => ({}) }
3565
+ const _hoisted_1$i = { class: "m-editor" };
3566
+ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3567
+ const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
3568
+ const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
3569
+ const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
3570
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
3571
+ ...{
3572
+ name: "MEditorFramework"
3167
3573
  },
3574
+ __name: "Framework",
3168
3575
  setup(__props) {
3169
- const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3170
- const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
3576
+ const codeOptions = vue.inject("codeOptions", {});
3171
3577
  const { editorService, uiService } = vue.inject("services") || {};
3172
3578
  const root = vue.computed(() => editorService?.get("root"));
3173
- const nodes = vue.computed(() => editorService?.get("nodes") || []);
3174
3579
  const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
3175
3580
  const showSrc = vue.computed(() => uiService?.get("showSrc"));
3176
- const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
3177
- const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
3178
3581
  const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
3179
3582
  const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
3180
3583
  const columnWidth = vue.ref({
@@ -3223,22 +3626,25 @@
3223
3626
  };
3224
3627
  const saveCode = (value) => {
3225
3628
  try {
3226
- editorService?.set("root", eval(value));
3629
+ const parseDSL = getConfig("parseDSL");
3630
+ editorService?.set("root", parseDSL(value));
3227
3631
  } catch (e) {
3228
3632
  console.error(e);
3229
3633
  }
3230
3634
  };
3231
3635
  return (_ctx, _cache) => {
3232
- const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
3233
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
3234
- vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
3235
- vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
3236
- key: 0,
3237
- class: "m-editor-content",
3238
- "init-values": vue.unref(root),
3239
- options: __props.codeOptions,
3240
- onSave: saveCode
3241
- }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$s, {
3636
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
3637
+ vue.renderSlot(_ctx.$slots, "header"),
3638
+ vue.renderSlot(_ctx.$slots, "nav"),
3639
+ vue.renderSlot(_ctx.$slots, "content-before"),
3640
+ showSrc.value ? vue.renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
3641
+ vue.createVNode(_sfc_main$w, {
3642
+ class: "m-editor-content",
3643
+ "init-values": root.value,
3644
+ options: vue.unref(codeOptions),
3645
+ onSave: saveCode
3646
+ }, null, 8, ["init-values", "options"])
3647
+ ]) : (vue.openBlock(), vue.createBlock(_sfc_main$u, {
3242
3648
  key: 1,
3243
3649
  class: "m-editor-content",
3244
3650
  "left-class": "m-editor-framework-left",
@@ -3256,13 +3662,13 @@
3256
3662
  vue.renderSlot(_ctx.$slots, "sidebar")
3257
3663
  ]),
3258
3664
  center: vue.withCtx(() => [
3259
- vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
3260
- vue.createVNode(_sfc_main$r)
3665
+ pageLength.value > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
3666
+ vue.createVNode(_sfc_main$t)
3261
3667
  ])
3262
3668
  ]),
3263
3669
  _: 2
3264
3670
  }, [
3265
- vue.unref(pageLength) > 0 && vue.unref(nodes).length === 1 ? {
3671
+ pageLength.value > 0 ? {
3266
3672
  name: "right",
3267
3673
  fn: vue.withCtx(() => [
3268
3674
  vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
@@ -3271,24 +3677,27 @@
3271
3677
  ]),
3272
3678
  _: 3
3273
3679
  })
3274
- ])
3680
+ ]),
3681
+ key: "0"
3275
3682
  } : void 0
3276
- ]), 1032, ["left", "right"]))
3683
+ ]), 1032, ["left", "right"])),
3684
+ vue.renderSlot(_ctx.$slots, "content-after"),
3685
+ vue.renderSlot(_ctx.$slots, "footer")
3277
3686
  ]);
3278
3687
  };
3279
3688
  }
3280
3689
  });
3281
3690
 
3282
- const _hoisted_1$f = {
3691
+ const _hoisted_1$h = {
3283
3692
  key: 1,
3284
3693
  class: "menu-item-text"
3285
3694
  };
3286
3695
  const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
3287
- const __default__$k = vue.defineComponent({
3288
- name: "MEditorToolButton"
3289
- });
3290
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
3291
- ...__default__$k,
3696
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
3697
+ ...{
3698
+ name: "MEditorToolButton"
3699
+ },
3700
+ __name: "ToolButton",
3292
3701
  props: {
3293
3702
  data: { default: () => ({
3294
3703
  type: "text",
@@ -3353,35 +3762,35 @@
3353
3762
  }
3354
3763
  };
3355
3764
  return (_ctx, _cache) => {
3356
- return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
3765
+ return display.value ? (vue.openBlock(), vue.createElementBlock("div", {
3357
3766
  key: 0,
3358
- class: vue.normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
3359
- onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(__props.data, $event)),
3360
- onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
3361
- onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
3767
+ class: vue.normalizeClass(["menu-item", `${_ctx.data.type} ${_ctx.data.className || ""}`]),
3768
+ onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(_ctx.data, $event)),
3769
+ onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(_ctx.data, $event)),
3770
+ onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(_ctx.data, $event))
3362
3771
  }, [
3363
- __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
3772
+ _ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
3364
3773
  key: 0,
3365
- direction: __props.data.direction || "vertical"
3366
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3367
- __props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3774
+ direction: _ctx.data.direction || "vertical"
3775
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3776
+ _ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3368
3777
  key: 0,
3369
3778
  effect: "dark",
3370
3779
  placement: "bottom-start",
3371
- content: __props.data.tooltip
3780
+ content: _ctx.data.tooltip
3372
3781
  }, {
3373
3782
  default: vue.withCtx(() => [
3374
3783
  vue.createVNode(vue.unref(design.TMagicButton), {
3375
3784
  size: "small",
3376
3785
  text: "",
3377
- disabled: vue.unref(disabled)
3786
+ disabled: disabled.value
3378
3787
  }, {
3379
3788
  default: vue.withCtx(() => [
3380
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
3789
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$E, {
3381
3790
  key: 0,
3382
- icon: __props.data.icon
3791
+ icon: _ctx.data.icon
3383
3792
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
3384
- vue.createElementVNode("span", null, vue.toDisplayString(__props.data.text), 1)
3793
+ vue.createElementVNode("span", null, vue.toDisplayString(_ctx.data.text), 1)
3385
3794
  ]),
3386
3795
  _: 1
3387
3796
  }, 8, ["disabled"])
@@ -3391,30 +3800,30 @@
3391
3800
  key: 1,
3392
3801
  size: "small",
3393
3802
  text: "",
3394
- disabled: vue.unref(disabled)
3803
+ disabled: disabled.value
3395
3804
  }, {
3396
3805
  default: vue.withCtx(() => [
3397
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
3806
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$E, {
3398
3807
  key: 0,
3399
- icon: __props.data.icon
3808
+ icon: _ctx.data.icon
3400
3809
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
3401
- vue.createElementVNode("span", null, vue.toDisplayString(__props.data.text), 1)
3810
+ vue.createElementVNode("span", null, vue.toDisplayString(_ctx.data.text), 1)
3402
3811
  ]),
3403
3812
  _: 1
3404
3813
  }, 8, ["disabled"]))
3405
- ], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdown), {
3814
+ ], 64)) : _ctx.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdown), {
3406
3815
  key: 3,
3407
3816
  trigger: "click",
3408
- disabled: vue.unref(disabled),
3817
+ disabled: disabled.value,
3409
3818
  onCommand: dropdownHandler
3410
3819
  }, {
3411
3820
  dropdown: vue.withCtx(() => [
3412
- __props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownMenu), { key: 0 }, {
3821
+ _ctx.data.items && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownMenu), { key: 0 }, {
3413
3822
  default: vue.withCtx(() => [
3414
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.data.items, (subItem, index) => {
3823
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.data.items, (subItem, index) => {
3415
3824
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownItem), {
3416
3825
  key: index,
3417
- command: { data: __props.data, subItem }
3826
+ command: { data: _ctx.data, subItem }
3418
3827
  }, {
3419
3828
  default: vue.withCtx(() => [
3420
3829
  vue.createTextVNode(vue.toDisplayString(subItem.text), 1)
@@ -3428,7 +3837,7 @@
3428
3837
  ]),
3429
3838
  default: vue.withCtx(() => [
3430
3839
  vue.createElementVNode("span", _hoisted_2$9, [
3431
- vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
3840
+ vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
3432
3841
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
3433
3842
  default: vue.withCtx(() => [
3434
3843
  vue.createVNode(vue.unref(iconsVue.ArrowDown))
@@ -3438,17 +3847,17 @@
3438
3847
  ])
3439
3848
  ]),
3440
3849
  _: 1
3441
- }, 8, ["disabled"])) : __props.data.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.data.component), vue.normalizeProps(vue.mergeProps({ key: 4 }, __props.data.props || {})), null, 16)) : vue.createCommentVNode("", true)
3850
+ }, 8, ["disabled"])) : _ctx.data.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.data.component), vue.normalizeProps(vue.mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : vue.createCommentVNode("", true)
3442
3851
  ], 34)) : vue.createCommentVNode("", true);
3443
3852
  };
3444
3853
  }
3445
3854
  });
3446
3855
 
3447
- const __default__$j = vue.defineComponent({
3448
- name: "MEditorNavMenu"
3449
- });
3450
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
3451
- ...__default__$j,
3856
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
3857
+ ...{
3858
+ name: "MEditorNavMenu"
3859
+ },
3860
+ __name: "NavMenu",
3452
3861
  props: {
3453
3862
  data: { default: () => ({}) },
3454
3863
  height: { default: 35 }
@@ -3597,16 +4006,16 @@
3597
4006
  return (_ctx, _cache) => {
3598
4007
  return vue.openBlock(), vue.createElementBlock("div", {
3599
4008
  class: "m-editor-nav-menu",
3600
- style: vue.normalizeStyle({ height: `${__props.height}px` })
4009
+ style: vue.normalizeStyle({ height: `${_ctx.height}px` })
3601
4010
  }, [
3602
4011
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(keys), (key) => {
3603
4012
  return vue.openBlock(), vue.createElementBlock("div", {
3604
4013
  class: vue.normalizeClass(`menu-${key}`),
3605
4014
  key,
3606
- style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
4015
+ style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
3607
4016
  }, [
3608
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
3609
- return vue.openBlock(), vue.createBlock(_sfc_main$p, {
4017
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
4018
+ return vue.openBlock(), vue.createBlock(_sfc_main$r, {
3610
4019
  data: item,
3611
4020
  key: index
3612
4021
  }, null, 8, ["data"]);
@@ -3618,20 +4027,24 @@
3618
4027
  }
3619
4028
  });
3620
4029
 
3621
- const _hoisted_1$e = { class: "m-editor-props-panel" };
3622
- const __default__$i = vue.defineComponent({
3623
- name: "MEditorPropsPanel"
3624
- });
3625
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
3626
- ...__default__$i,
4030
+ const _hoisted_1$g = { class: "m-editor-props-panel" };
4031
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
4032
+ ...{
4033
+ name: "MEditorPropsPanel"
4034
+ },
4035
+ __name: "PropsPanel",
4036
+ props: {
4037
+ extendState: { type: Function }
4038
+ },
3627
4039
  emits: ["mounted"],
3628
- setup(__props, { expose, emit }) {
4040
+ setup(__props, { expose: __expose, emit }) {
3629
4041
  const internalInstance = vue.getCurrentInstance();
3630
4042
  const values = vue.ref({});
3631
4043
  const configForm = vue.ref();
3632
4044
  const curFormConfig = vue.ref([]);
3633
4045
  const services = vue.inject("services");
3634
4046
  const node = vue.computed(() => services?.editorService.get("node"));
4047
+ const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
3635
4048
  const propsPanelSize = vue.computed(() => services?.uiService.get("propsPanelSize") || "small");
3636
4049
  const stage = vue.computed(() => services?.editorService.get("stage"));
3637
4050
  const init = async () => {
@@ -3666,26 +4079,32 @@
3666
4079
  design.tMagicMessage.error(e.message);
3667
4080
  }
3668
4081
  };
3669
- expose({ submit });
4082
+ __expose({ configForm, submit });
3670
4083
  return (_ctx, _cache) => {
3671
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
4084
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
3672
4085
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
3673
4086
  vue.createVNode(vue.unref(form.MForm), {
3674
4087
  ref_key: "configForm",
3675
4088
  ref: configForm,
3676
- class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
3677
- "popper-class": `m-editor-props-panel-popper ${vue.unref(propsPanelSize)}`,
3678
- size: vue.unref(propsPanelSize),
4089
+ class: vue.normalizeClass(`m-editor-props-panel ${propsPanelSize.value}`),
4090
+ "popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
4091
+ size: propsPanelSize.value,
3679
4092
  "init-values": values.value,
3680
4093
  config: curFormConfig.value,
4094
+ "extend-state": _ctx.extendState,
3681
4095
  onChange: submit
3682
- }, null, 8, ["class", "popper-class", "size", "init-values", "config"])
4096
+ }, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
4097
+ ], 512)), [
4098
+ [vue.vShow, nodes.value.length === 1]
3683
4099
  ]);
3684
4100
  };
3685
4101
  }
3686
4102
  });
3687
4103
 
3688
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
4104
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
4105
+ ...{
4106
+ name: "MEditorSearchInput"
4107
+ },
3689
4108
  __name: "SearchInput",
3690
4109
  emits: ["search"],
3691
4110
  setup(__props, { emit }) {
@@ -3717,80 +4136,77 @@
3717
4136
  }
3718
4137
  });
3719
4138
 
3720
- const _export_sfc = (sfc, props) => {
3721
- const target = sfc.__vccOpts || sfc;
3722
- for (const [key, val] of props) {
3723
- target[key] = val;
3724
- }
3725
- return target;
3726
- };
3727
-
3728
- const _sfc_main$l = {};
3729
-
3730
- const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
3731
- const _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("g", {
4139
+ const _hoisted_1$f = { xmlns: "http://www.w3.org/2000/svg" };
4140
+ const _hoisted_2$8 = /* @__PURE__ */ vue.createElementVNode("g", {
3732
4141
  fill: "#7C878E",
3733
4142
  "fill-rule": "evenodd"
3734
4143
  }, [
3735
- /*#__PURE__*/vue.createElementVNode("path", {
4144
+ /* @__PURE__ */ vue.createElementVNode("path", {
3736
4145
  d: "M15.3,5.5 L8,0 L0.7,5.5 L8,11 L15.3,5.5 Z M8,2.5 L12,5.5 L8,8.5 L4,5.5 L8,2.5 Z",
3737
4146
  "fill-rule": "nonzero"
3738
4147
  }),
3739
- /*#__PURE__*/vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
4148
+ /* @__PURE__ */ vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
3740
4149
  ], -1);
3741
4150
  const _hoisted_3$4 = [
3742
4151
  _hoisted_2$8
3743
4152
  ];
4153
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
4154
+ ...{
4155
+ name: "MEditorAppManageIcon"
4156
+ },
4157
+ __name: "AppManageIcon",
4158
+ setup(__props) {
4159
+ return (_ctx, _cache) => {
4160
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$f, _hoisted_3$4);
4161
+ };
4162
+ }
4163
+ });
3744
4164
 
3745
- function _sfc_render$2(_ctx, _cache) {
3746
- return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_3$4))
3747
- }
3748
- const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$l, [['render',_sfc_render$2]]);
3749
-
3750
- const _sfc_main$k = {};
3751
-
3752
- const _hoisted_1$c = {
4165
+ const _hoisted_1$e = {
3753
4166
  viewBox: "0 0 32 32",
3754
4167
  version: "1.1",
3755
4168
  xmlns: "http://www.w3.org/2000/svg",
3756
4169
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
3757
4170
  };
3758
- const _hoisted_2$7 = /*#__PURE__*/vue.createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
4171
+ const _hoisted_2$7 = /* @__PURE__ */ vue.createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
3759
4172
  const _hoisted_4$4 = [
3760
4173
  _hoisted_2$7
3761
4174
  ];
4175
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
4176
+ ...{
4177
+ name: "MEditorCodeIcon"
4178
+ },
4179
+ __name: "CodeIcon",
4180
+ setup(__props) {
4181
+ return (_ctx, _cache) => {
4182
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$e, _hoisted_4$4);
4183
+ };
4184
+ }
4185
+ });
3762
4186
 
3763
- function _sfc_render$1(_ctx, _cache) {
3764
- return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _hoisted_4$4))
3765
- }
3766
- const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$k, [['render',_sfc_render$1]]);
3767
-
3768
- const _hoisted_1$b = {
4187
+ const _hoisted_1$d = {
3769
4188
  key: 0,
3770
4189
  class: "m-editor-content-bottom"
3771
4190
  };
3772
- const _hoisted_2$6 = /* @__PURE__ */ vue.createTextVNode("确认");
3773
- const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
3774
- const _hoisted_4$3 = {
4191
+ const _hoisted_2$6 = {
3775
4192
  key: 1,
3776
4193
  class: "m-editor-content-bottom"
3777
4194
  };
3778
- const _hoisted_5$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
3779
- const __default__$h = vue.defineComponent({
3780
- name: "MEditorCodeDraftEditor"
3781
- });
3782
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
3783
- ...__default__$h,
4195
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
4196
+ ...{
4197
+ name: "MEditorCodeDraftEditor"
4198
+ },
4199
+ __name: "CodeDraftEditor",
3784
4200
  props: {
3785
- id: null,
3786
- content: null,
4201
+ id: {},
4202
+ content: {},
3787
4203
  editable: { type: Boolean, default: true },
3788
4204
  autoSaveDraft: { type: Boolean, default: true },
3789
- codeOptions: null,
3790
- language: null
4205
+ codeOptions: {},
4206
+ language: {}
3791
4207
  },
3792
4208
  emits: ["close", "saveAndClose"],
3793
- setup(__props, { expose, emit }) {
4209
+ setup(__props, { expose: __expose, emit }) {
3794
4210
  const props = __props;
3795
4211
  const services = vue.inject("services");
3796
4212
  const codeContent = vue.ref("");
@@ -3855,7 +4271,7 @@
3855
4271
  codeEditor.value.focus();
3856
4272
  }
3857
4273
  };
3858
- expose({
4274
+ __expose({
3859
4275
  saveAndClose,
3860
4276
  close
3861
4277
  });
@@ -3863,16 +4279,16 @@
3863
4279
  return vue.openBlock(), vue.createElementBlock("div", {
3864
4280
  class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
3865
4281
  }, [
3866
- vue.createVNode(_sfc_main$u, {
4282
+ vue.createVNode(_sfc_main$w, {
3867
4283
  ref_key: "codeEditor",
3868
4284
  ref: codeEditor,
3869
4285
  class: "m-editor-container",
3870
4286
  "init-values": `${codeContent.value}`,
3871
4287
  onSave: saveCodeDraft,
3872
- language: __props.language,
3873
- options: vue.unref(codeOptions)
4288
+ language: _ctx.language,
4289
+ options: codeOptions.value
3874
4290
  }, null, 8, ["init-values", "language", "options"]),
3875
- __props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
4291
+ _ctx.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
3876
4292
  vue.createVNode(vue.unref(design.TMagicButton), {
3877
4293
  type: "primary",
3878
4294
  class: "button",
@@ -3889,7 +4305,7 @@
3889
4305
  onClick: saveAndClose
3890
4306
  }, {
3891
4307
  default: vue.withCtx(() => [
3892
- _hoisted_2$6
4308
+ vue.createTextVNode("确认")
3893
4309
  ]),
3894
4310
  _: 1
3895
4311
  }),
@@ -3898,11 +4314,11 @@
3898
4314
  onClick: close
3899
4315
  }, {
3900
4316
  default: vue.withCtx(() => [
3901
- _hoisted_3$3
4317
+ vue.createTextVNode("关闭")
3902
4318
  ]),
3903
4319
  _: 1
3904
4320
  })
3905
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$3, [
4321
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
3906
4322
  vue.createVNode(vue.unref(design.TMagicButton), {
3907
4323
  type: "primary",
3908
4324
  class: "button",
@@ -3918,7 +4334,7 @@
3918
4334
  onClick: close
3919
4335
  }, {
3920
4336
  default: vue.withCtx(() => [
3921
- _hoisted_5$2
4337
+ vue.createTextVNode("关闭")
3922
4338
  ]),
3923
4339
  _: 1
3924
4340
  })
@@ -3928,26 +4344,27 @@
3928
4344
  }
3929
4345
  });
3930
4346
 
3931
- const _hoisted_1$a = { class: "code-name-wrapper" };
4347
+ const _hoisted_1$c = { class: "code-name-wrapper" };
3932
4348
  const _hoisted_2$5 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
3933
- const _hoisted_3$2 = { class: "code-name-wrapper" };
3934
- const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
3935
- const __default__$g = vue.defineComponent({
3936
- name: "MEditorFunctionEditor"
3937
- });
3938
- const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
3939
- ...__default__$g,
4349
+ const _hoisted_3$3 = { class: "code-name-wrapper" };
4350
+ const _hoisted_4$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
4351
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
4352
+ ...{
4353
+ name: "MEditorFunctionEditor"
4354
+ },
4355
+ __name: "FunctionEditor",
3940
4356
  props: {
3941
- id: null,
3942
- name: null,
3943
- content: null,
4357
+ id: {},
4358
+ name: {},
4359
+ content: {},
3944
4360
  editable: { type: Boolean, default: true },
3945
4361
  autoSaveDraft: { type: Boolean, default: true },
3946
- codeOptions: null,
3947
- paramsColConfig: null
4362
+ codeOptions: {},
4363
+ paramsColConfig: {}
3948
4364
  },
3949
- setup(__props, { expose }) {
4365
+ setup(__props, { expose: __expose }) {
3950
4366
  const props = __props;
4367
+ vue.provide("mForm", null);
3951
4368
  const defaultParamColConfig = {
3952
4369
  type: "row",
3953
4370
  label: "参数类型",
@@ -4016,29 +4433,29 @@
4016
4433
  initTableModel();
4017
4434
  const beforeSave = (codeValue) => {
4018
4435
  try {
4019
- eval(codeValue);
4436
+ getConfig("parseDSL")(codeValue);
4020
4437
  return true;
4021
4438
  } catch (e) {
4022
4439
  design.tMagicMessage.error(e.stack);
4023
4440
  return false;
4024
4441
  }
4025
4442
  };
4026
- const saveCode = async (codeValue2) => {
4443
+ const saveCode = async (codeValue) => {
4027
4444
  if (!props.editable)
4028
4445
  return;
4029
- evalRes.value = beforeSave(codeValue2);
4446
+ evalRes.value = beforeSave(codeValue);
4030
4447
  if (evalRes.value) {
4031
4448
  await services?.codeBlockService.setCodeDslById(props.id, {
4032
4449
  name: codeName.value,
4033
- content: codeValue2,
4450
+ content: codeValue,
4034
4451
  params: tableModel.value?.params || []
4035
4452
  });
4036
4453
  design.tMagicMessage.success("代码成功保存到本地");
4037
4454
  services?.codeBlockService.removeCodeDraft(props.id);
4038
4455
  }
4039
4456
  };
4040
- const saveAndClose = async (codeValue2) => {
4041
- await saveCode(codeValue2);
4457
+ const saveAndClose = async (codeValue) => {
4458
+ await saveCode(codeValue);
4042
4459
  if (evalRes.value) {
4043
4460
  close();
4044
4461
  }
@@ -4047,24 +4464,24 @@
4047
4464
  services?.codeBlockService.setCodeEditorShowStatus(false);
4048
4465
  };
4049
4466
  const codeDraftEditor = vue.ref();
4050
- expose({
4467
+ __expose({
4051
4468
  codeDraftEditor
4052
4469
  });
4053
4470
  return (_ctx, _cache) => {
4054
4471
  const _component_m_form_table = vue.resolveComponent("m-form-table");
4055
4472
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
4056
4473
  header: vue.withCtx(() => [
4057
- vue.createElementVNode("div", _hoisted_1$a, [
4474
+ vue.createElementVNode("div", _hoisted_1$c, [
4058
4475
  _hoisted_2$5,
4059
4476
  vue.createVNode(vue.unref(design.TMagicInput), {
4060
4477
  class: "code-name-input",
4061
4478
  modelValue: codeName.value,
4062
4479
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
4063
- disabled: !__props.editable
4480
+ disabled: !_ctx.editable
4064
4481
  }, null, 8, ["modelValue", "disabled"])
4065
4482
  ]),
4066
- vue.createElementVNode("div", _hoisted_3$2, [
4067
- _hoisted_4$2,
4483
+ vue.createElementVNode("div", _hoisted_3$3, [
4484
+ _hoisted_4$3,
4068
4485
  vue.createVNode(_component_m_form_table, {
4069
4486
  style: { "width": "800px" },
4070
4487
  config: tableConfig,
@@ -4077,14 +4494,14 @@
4077
4494
  ])
4078
4495
  ]),
4079
4496
  default: vue.withCtx(() => [
4080
- vue.createVNode(_sfc_main$j, {
4497
+ vue.createVNode(_sfc_main$l, {
4081
4498
  ref_key: "codeDraftEditor",
4082
4499
  ref: codeDraftEditor,
4083
- id: __props.id,
4500
+ id: _ctx.id,
4084
4501
  content: codeContent.value,
4085
- editable: __props.editable,
4086
- autoSaveDraft: __props.autoSaveDraft,
4087
- codeOptions: __props.codeOptions,
4502
+ editable: _ctx.editable,
4503
+ autoSaveDraft: _ctx.autoSaveDraft,
4504
+ codeOptions: _ctx.codeOptions,
4088
4505
  language: "javascript",
4089
4506
  onSaveAndClose: saveAndClose,
4090
4507
  onClose: close
@@ -4096,17 +4513,17 @@
4096
4513
  }
4097
4514
  });
4098
4515
 
4099
- const _hoisted_1$9 = {
4516
+ const _hoisted_1$b = {
4100
4517
  key: 0,
4101
4518
  class: "m-editor-code-block-editor-panel"
4102
4519
  };
4103
- const __default__$f = vue.defineComponent({
4104
- name: "MEditorCodeBlockEditor"
4105
- });
4106
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
4107
- ...__default__$f,
4520
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
4521
+ ...{
4522
+ name: "MEditorCodeBlockEditor"
4523
+ },
4524
+ __name: "CodeBlockEditor",
4108
4525
  props: {
4109
- paramsColConfig: null
4526
+ paramsColConfig: {}
4110
4527
  },
4111
4528
  setup(__props) {
4112
4529
  const services = vue.inject("services");
@@ -4153,28 +4570,28 @@
4153
4570
  "append-to-body": true,
4154
4571
  "show-close": false,
4155
4572
  "close-on-click-modal": true,
4156
- size: vue.unref(size),
4573
+ size: size.value,
4157
4574
  "before-close": handleClose
4158
4575
  }, {
4159
4576
  default: vue.withCtx(() => [
4160
- vue.createVNode(_sfc_main$s, {
4577
+ vue.createVNode(_sfc_main$u, {
4161
4578
  left: left.value,
4162
4579
  "onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
4163
4580
  "min-left": 45,
4164
4581
  class: "code-editor-layout"
4165
4582
  }, {
4166
4583
  center: vue.withCtx(() => [
4167
- !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4168
- vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
4169
- codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
4584
+ !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
4585
+ vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
4586
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$k, {
4170
4587
  key: 0,
4171
4588
  ref_key: "functionEditor",
4172
4589
  ref: functionEditor,
4173
- id: vue.unref(id),
4590
+ id: id.value,
4174
4591
  name: codeConfig.value.name,
4175
4592
  content: codeConfig.value.content,
4176
- paramsColConfig: __props.paramsColConfig,
4177
- editable: !!vue.unref(editable),
4593
+ paramsColConfig: _ctx.paramsColConfig,
4594
+ editable: !!editable.value,
4178
4595
  autoSaveDraft: true,
4179
4596
  codeOptions: vue.unref(codeOptions)
4180
4597
  }, null, 8, ["id", "name", "content", "paramsColConfig", "editable", "codeOptions"])) : vue.createCommentVNode("", true)
@@ -4189,22 +4606,21 @@
4189
4606
  }
4190
4607
  });
4191
4608
 
4192
- const _hoisted_1$8 = { class: "search-wrapper" };
4193
- const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("新增");
4194
- const _hoisted_3$1 = ["id"];
4195
- const _hoisted_4$1 = { class: "list-item" };
4196
- const _hoisted_5$1 = {
4609
+ const _hoisted_1$a = { class: "search-wrapper" };
4610
+ const _hoisted_2$4 = ["id"];
4611
+ const _hoisted_3$2 = { class: "list-item" };
4612
+ const _hoisted_4$2 = {
4197
4613
  key: 2,
4198
4614
  class: "right-tool"
4199
4615
  };
4200
- const __default__$e = vue.defineComponent({
4201
- name: "MEditorCodeBlockList"
4202
- });
4203
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
4204
- ...__default__$e,
4616
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
4617
+ ...{
4618
+ name: "MEditorCodeBlockList"
4619
+ },
4620
+ __name: "CodeBlockList",
4205
4621
  props: {
4206
- customError: null,
4207
- paramsColConfig: null
4622
+ customError: { type: Function },
4623
+ paramsColConfig: {}
4208
4624
  },
4209
4625
  setup(__props) {
4210
4626
  const props = __props;
@@ -4293,9 +4709,9 @@
4293
4709
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
4294
4710
  default: vue.withCtx(() => [
4295
4711
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
4296
- vue.createElementVNode("div", _hoisted_1$8, [
4297
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4298
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4712
+ vue.createElementVNode("div", _hoisted_1$a, [
4713
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
4714
+ editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4299
4715
  key: 0,
4300
4716
  class: "create-code-button",
4301
4717
  type: "primary",
@@ -4303,7 +4719,7 @@
4303
4719
  onClick: createCodeBlock
4304
4720
  }, {
4305
4721
  default: vue.withCtx(() => [
4306
- _hoisted_2$4
4722
+ vue.createTextVNode("新增")
4307
4723
  ]),
4308
4724
  _: 1
4309
4725
  })) : vue.createCommentVNode("", true)
@@ -4315,9 +4731,9 @@
4315
4731
  class: "magic-editor-layer-tree",
4316
4732
  "node-key": "id",
4317
4733
  "empty-text": "暂无代码块",
4318
- "default-expanded-keys": vue.unref(expandedKeys),
4734
+ "default-expanded-keys": expandedKeys.value,
4319
4735
  "expand-on-click-node": false,
4320
- data: vue.unref(codeList),
4736
+ data: codeList.value,
4321
4737
  props: treeProps,
4322
4738
  "highlight-current": true,
4323
4739
  "filter-node-method": filterNode,
@@ -4328,41 +4744,41 @@
4328
4744
  id: data.id,
4329
4745
  class: "list-container"
4330
4746
  }, [
4331
- vue.createElementVNode("div", _hoisted_4$1, [
4332
- data.type === "code" ? (vue.openBlock(), vue.createBlock(CodeIcon, {
4747
+ vue.createElementVNode("div", _hoisted_3$2, [
4748
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
4333
4749
  key: 0,
4334
4750
  class: "codeIcon"
4335
4751
  })) : vue.createCommentVNode("", true),
4336
- data.type === "node" ? (vue.openBlock(), vue.createBlock(AppManageIcon, {
4752
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
4337
4753
  key: 1,
4338
4754
  class: "compIcon"
4339
4755
  })) : vue.createCommentVNode("", true),
4340
4756
  vue.createElementVNode("span", {
4341
4757
  class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
4342
4758
  }, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
4343
- data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
4759
+ data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
4344
4760
  vue.createVNode(vue.unref(design.TMagicTooltip), {
4345
4761
  effect: "dark",
4346
- content: vue.unref(editable) ? "编辑" : "查看",
4762
+ content: editable.value ? "编辑" : "查看",
4347
4763
  placement: "bottom"
4348
4764
  }, {
4349
4765
  default: vue.withCtx(() => [
4350
- vue.createVNode(_sfc_main$A, {
4351
- icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4766
+ vue.createVNode(_sfc_main$E, {
4767
+ icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4352
4768
  class: "edit-icon",
4353
4769
  onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
4354
4770
  }, null, 8, ["icon", "onClick"])
4355
4771
  ]),
4356
4772
  _: 2
4357
4773
  }, 1032, ["content"]),
4358
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
4774
+ editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
4359
4775
  key: 0,
4360
4776
  effect: "dark",
4361
4777
  content: "删除",
4362
4778
  placement: "bottom"
4363
4779
  }, {
4364
4780
  default: vue.withCtx(() => [
4365
- vue.createVNode(_sfc_main$A, {
4781
+ vue.createVNode(_sfc_main$E, {
4366
4782
  icon: vue.unref(iconsVue.Close),
4367
4783
  class: "edit-icon",
4368
4784
  onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -4376,13 +4792,13 @@
4376
4792
  })
4377
4793
  ])) : vue.createCommentVNode("", true)
4378
4794
  ])
4379
- ], 8, _hoisted_3$1)
4795
+ ], 8, _hoisted_2$4)
4380
4796
  ]),
4381
4797
  _: 3
4382
4798
  }, 8, ["default-expanded-keys", "data"]),
4383
- vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
4799
+ isShowCodeBlockEditor.value ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
4384
4800
  key: 0,
4385
- paramsColConfig: __props.paramsColConfig
4801
+ paramsColConfig: _ctx.paramsColConfig
4386
4802
  }, {
4387
4803
  "code-block-edit-panel-header": vue.withCtx(({ id }) => [
4388
4804
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
@@ -4396,16 +4812,17 @@
4396
4812
  }
4397
4813
  });
4398
4814
 
4399
- const _hoisted_1$7 = /* @__PURE__ */ vue.createTextVNode("确定");
4400
- const _hoisted_2$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
4401
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4815
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
4816
+ ...{
4817
+ name: "MEditorDataSourceConfigPanel"
4818
+ },
4402
4819
  __name: "DataSourceConfigPanel",
4403
4820
  props: {
4404
- title: null,
4405
- values: null
4821
+ title: {},
4822
+ values: {}
4406
4823
  },
4407
4824
  emits: ["submit"],
4408
- setup(__props, { expose, emit }) {
4825
+ setup(__props, { expose: __expose, emit }) {
4409
4826
  const props = __props;
4410
4827
  const type = vue.ref("base");
4411
4828
  const services = vue.inject("services");
@@ -4436,7 +4853,7 @@
4436
4853
  const hide = () => {
4437
4854
  visible.value = false;
4438
4855
  };
4439
- expose({
4856
+ __expose({
4440
4857
  show() {
4441
4858
  visible.value = true;
4442
4859
  },
@@ -4446,12 +4863,12 @@
4446
4863
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDrawer), {
4447
4864
  modelValue: visible.value,
4448
4865
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
4449
- title: __props.title,
4866
+ title: _ctx.title,
4450
4867
  "close-on-press-escape": true,
4451
4868
  "append-to-body": true,
4452
4869
  "show-close": true,
4453
4870
  "close-on-click-modal": true,
4454
- size: vue.unref(size)
4871
+ size: size.value
4455
4872
  }, {
4456
4873
  footer: vue.withCtx(() => [
4457
4874
  vue.createElementVNode("div", null, [
@@ -4460,13 +4877,13 @@
4460
4877
  onClick: submitHandler
4461
4878
  }, {
4462
4879
  default: vue.withCtx(() => [
4463
- _hoisted_1$7
4880
+ vue.createTextVNode("确定")
4464
4881
  ]),
4465
4882
  _: 1
4466
4883
  }),
4467
4884
  vue.createVNode(vue.unref(design.TMagicButton), { onClick: hide }, {
4468
4885
  default: vue.withCtx(() => [
4469
- _hoisted_2$3
4886
+ vue.createTextVNode("关闭")
4470
4887
  ]),
4471
4888
  _: 1
4472
4889
  })
@@ -4476,7 +4893,7 @@
4476
4893
  vue.createVNode(vue.unref(form.MForm), {
4477
4894
  ref_key: "form",
4478
4895
  ref: form$1,
4479
- config: vue.unref(dataSourceConfig),
4896
+ config: dataSourceConfig.value,
4480
4897
  "init-values": initValues.value,
4481
4898
  onChange: changeHandler
4482
4899
  }, null, 8, ["config", "init-values"])
@@ -4487,22 +4904,21 @@
4487
4904
  }
4488
4905
  });
4489
4906
 
4490
- const _hoisted_1$6 = { class: "search-wrapper" };
4491
- const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
4492
- const _hoisted_3 = ["id"];
4493
- const _hoisted_4 = { class: "list-item" };
4494
- const _hoisted_5 = {
4907
+ const _hoisted_1$9 = { class: "search-wrapper" };
4908
+ const _hoisted_2$3 = ["id"];
4909
+ const _hoisted_3$1 = { class: "list-item" };
4910
+ const _hoisted_4$1 = {
4495
4911
  key: 2,
4496
4912
  class: "right-tool"
4497
4913
  };
4498
- const __default__$d = vue.defineComponent({
4499
- name: "MEditorDataSourceListPanel"
4500
- });
4501
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4502
- ...__default__$d,
4914
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
4915
+ ...{
4916
+ name: "MEditorDataSourceListPanel"
4917
+ },
4918
+ __name: "DataSourceListPanel",
4503
4919
  setup(__props) {
4504
4920
  const services = vue.inject("services", {});
4505
- const { dataSourceService, depService } = vue.inject("services") || {};
4921
+ const { dataSourceService, depService, editorService } = vue.inject("services") || {};
4506
4922
  const list = vue.computed(
4507
4923
  () => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
4508
4924
  id: target.id,
@@ -4554,18 +4970,30 @@
4554
4970
  const filterTextChangeHandler = (val) => {
4555
4971
  tree.value?.filter(val);
4556
4972
  };
4973
+ const selectComp = (compId) => {
4974
+ const stage = editorService?.get("stage");
4975
+ editorService?.select(compId);
4976
+ stage?.select(compId);
4977
+ };
4978
+ const clickHandler = (data, node) => {
4979
+ if (data.type === "node") {
4980
+ selectComp(data.id);
4981
+ } else if (data.type === "key") {
4982
+ selectComp(node.parent.data.id);
4983
+ }
4984
+ };
4557
4985
  return (_ctx, _cache) => {
4558
4986
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
4559
4987
  default: vue.withCtx(() => [
4560
- vue.createElementVNode("div", _hoisted_1$6, [
4561
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4988
+ vue.createElementVNode("div", _hoisted_1$9, [
4989
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
4562
4990
  vue.createVNode(vue.unref(design.TMagicButton), {
4563
4991
  type: "primary",
4564
4992
  size: "small",
4565
4993
  onClick: addHandler
4566
4994
  }, {
4567
4995
  default: vue.withCtx(() => [
4568
- _hoisted_2$2
4996
+ vue.createTextVNode("新增")
4569
4997
  ]),
4570
4998
  _: 1
4571
4999
  })
@@ -4578,21 +5006,22 @@
4578
5006
  "empty-text": "暂无代码块",
4579
5007
  "default-expand-all": "",
4580
5008
  "expand-on-click-node": false,
4581
- data: vue.unref(list),
4582
- "highlight-current": true
5009
+ data: list.value,
5010
+ "highlight-current": true,
5011
+ onNodeClick: clickHandler
4583
5012
  }, {
4584
5013
  default: vue.withCtx(({ data }) => [
4585
5014
  vue.createElementVNode("div", {
4586
5015
  id: data.id,
4587
5016
  class: "list-container"
4588
5017
  }, [
4589
- vue.createElementVNode("div", _hoisted_4, [
4590
- data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
5018
+ vue.createElementVNode("div", _hoisted_3$1, [
5019
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$E, {
4591
5020
  key: 0,
4592
5021
  class: "codeIcon",
4593
5022
  icon: vue.unref(iconsVue.Coin)
4594
5023
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4595
- data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
5024
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$E, {
4596
5025
  key: 1,
4597
5026
  class: "compIcon",
4598
5027
  icon: vue.unref(iconsVue.Aim)
@@ -4600,14 +5029,14 @@
4600
5029
  vue.createElementVNode("span", {
4601
5030
  class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
4602
5031
  }, vue.toDisplayString(data.name) + "(" + vue.toDisplayString(data.id) + ")", 3),
4603
- data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
5032
+ data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
4604
5033
  vue.createVNode(vue.unref(design.TMagicTooltip), {
4605
5034
  effect: "dark",
4606
5035
  content: "编辑",
4607
5036
  placement: "bottom"
4608
5037
  }, {
4609
5038
  default: vue.withCtx(() => [
4610
- vue.createVNode(_sfc_main$A, {
5039
+ vue.createVNode(_sfc_main$E, {
4611
5040
  class: "edit-icon",
4612
5041
  icon: vue.unref(iconsVue.Edit),
4613
5042
  onClick: vue.withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
@@ -4621,7 +5050,7 @@
4621
5050
  placement: "bottom"
4622
5051
  }, {
4623
5052
  default: vue.withCtx(() => [
4624
- vue.createVNode(_sfc_main$A, {
5053
+ vue.createVNode(_sfc_main$E, {
4625
5054
  icon: vue.unref(iconsVue.Close),
4626
5055
  class: "edit-icon",
4627
5056
  onClick: vue.withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
@@ -4635,11 +5064,11 @@
4635
5064
  })
4636
5065
  ])) : vue.createCommentVNode("", true)
4637
5066
  ])
4638
- ], 8, _hoisted_3)
5067
+ ], 8, _hoisted_2$3)
4639
5068
  ]),
4640
5069
  _: 3
4641
5070
  }, 8, ["data"]),
4642
- vue.createVNode(_sfc_main$f, {
5071
+ vue.createVNode(_sfc_main$h, {
4643
5072
  ref_key: "editDialog",
4644
5073
  ref: editDialog,
4645
5074
  values: dataSourceValues.value,
@@ -4653,12 +5082,12 @@
4653
5082
  }
4654
5083
  });
4655
5084
 
4656
- const _hoisted_1$5 = ["onClick", "onDragstart"];
4657
- const __default__$c = vue.defineComponent({
4658
- name: "MEditorComponentListPanel"
4659
- });
4660
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4661
- ...__default__$c,
5085
+ const _hoisted_1$8 = ["onClick", "onDragstart"];
5086
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
5087
+ ...{
5088
+ name: "MEditorComponentListPanel"
5089
+ },
5090
+ __name: "ComponentListPanel",
4662
5091
  setup(__props) {
4663
5092
  const searchText = vue.ref("");
4664
5093
  const filterTextChangeHandler = (v) => {
@@ -4688,14 +5117,13 @@
4688
5117
  };
4689
5118
  const dragstartHandler = ({ text, type, data = {} }, e) => {
4690
5119
  if (e.dataTransfer) {
4691
- e.dataTransfer.effectAllowed = "move";
4692
5120
  e.dataTransfer.setData(
4693
- "data",
5121
+ "text/html",
4694
5122
  serialize({
4695
5123
  name: text,
4696
5124
  type,
4697
5125
  ...data
4698
- }).replace(/"(\w+)":\s/g, "$1: ")
5126
+ })
4699
5127
  );
4700
5128
  }
4701
5129
  };
@@ -4723,7 +5151,7 @@
4723
5151
  }
4724
5152
  if (timeout || !stage.value)
4725
5153
  return;
4726
- timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
5154
+ timeout = stage.value.delayedMarkContainer(e);
4727
5155
  };
4728
5156
  return (_ctx, _cache) => {
4729
5157
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
@@ -4731,18 +5159,18 @@
4731
5159
  vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
4732
5160
  vue.createVNode(vue.unref(design.TMagicCollapse), {
4733
5161
  class: "ui-component-panel",
4734
- "model-value": vue.unref(collapseValue)
5162
+ "model-value": collapseValue.value
4735
5163
  }, {
4736
5164
  default: vue.withCtx(() => [
4737
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4738
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
5165
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
5166
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
4739
5167
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
4740
5168
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
4741
5169
  key: index,
4742
5170
  name: `${index}`
4743
5171
  }, {
4744
5172
  title: vue.withCtx(() => [
4745
- vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
5173
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
4746
5174
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
4747
5175
  ]),
4748
5176
  default: vue.withCtx(() => [
@@ -4757,7 +5185,7 @@
4757
5185
  onDrag: dragHandler
4758
5186
  }, [
4759
5187
  vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
4760
- vue.createVNode(_sfc_main$A, {
5188
+ vue.createVNode(_sfc_main$E, {
4761
5189
  icon: item.icon
4762
5190
  }, null, 8, ["icon"]),
4763
5191
  vue.createVNode(vue.unref(design.TMagicTooltip), {
@@ -4771,7 +5199,7 @@
4771
5199
  _: 2
4772
5200
  }, 1032, ["content"])
4773
5201
  ])
4774
- ], 40, _hoisted_1$5);
5202
+ ], 40, _hoisted_1$8);
4775
5203
  }), 128))
4776
5204
  ]),
4777
5205
  _: 2
@@ -4788,19 +5216,20 @@
4788
5216
  }
4789
5217
  });
4790
5218
 
4791
- const __default__$b = vue.defineComponent({
4792
- name: "MEditorContentMenu"
4793
- });
4794
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4795
- ...__default__$b,
5219
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
5220
+ ...{
5221
+ name: "MEditorContentMenu"
5222
+ },
5223
+ __name: "ContentMenu",
4796
5224
  props: {
4797
5225
  menuData: { default: () => [] },
4798
5226
  isSubMenu: { type: Boolean, default: false }
4799
5227
  },
4800
5228
  emits: ["hide", "show"],
4801
- setup(__props, { expose, emit }) {
5229
+ setup(__props, { expose: __expose, emit }) {
4802
5230
  const props = __props;
4803
5231
  const menu = vue.ref();
5232
+ const buttons = vue.ref();
4804
5233
  const subMenu = vue.ref();
4805
5234
  const visible = vue.ref(false);
4806
5235
  const subMenuData = vue.ref([]);
@@ -4808,6 +5237,7 @@
4808
5237
  left: "0",
4809
5238
  top: "0"
4810
5239
  });
5240
+ const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
4811
5241
  const hide = () => {
4812
5242
  if (!visible.value)
4813
5243
  return;
@@ -4820,7 +5250,7 @@
4820
5250
  if (!visible.value || !target) {
4821
5251
  return;
4822
5252
  }
4823
- if (menu.value?.contains(target) || subMenu.value?.$el?.contains(target)) {
5253
+ if (contains(target)) {
4824
5254
  return;
4825
5255
  }
4826
5256
  hide();
@@ -4842,18 +5272,25 @@
4842
5272
  });
4843
5273
  }, 300);
4844
5274
  };
4845
- const showSubMenu = (item) => {
5275
+ const showSubMenu = (item, index) => {
4846
5276
  const menuItem = item;
4847
5277
  if (typeof item !== "object" || !menuItem.items?.length) {
4848
5278
  return;
4849
5279
  }
4850
- subMenuData.value = menuItem.items;
4851
- if (menu.value) {
4852
- subMenu.value.show({
4853
- clientX: menu.value.offsetLeft + menu.value.clientWidth,
4854
- clientY: menu.value.offsetTop
4855
- });
4856
- }
5280
+ subMenuData.value = menuItem.items || [];
5281
+ setTimeout(() => {
5282
+ if (menu.value) {
5283
+ let y = menu.value.offsetTop;
5284
+ if (buttons.value?.[index].$el) {
5285
+ const rect = buttons.value?.[index].$el.getBoundingClientRect();
5286
+ y = rect.top;
5287
+ }
5288
+ subMenu.value?.show({
5289
+ clientX: menu.value.offsetLeft + menu.value.clientWidth,
5290
+ clientY: y
5291
+ });
5292
+ }
5293
+ }, 0);
4857
5294
  };
4858
5295
  vue.onMounted(() => {
4859
5296
  if (props.isSubMenu)
@@ -4865,13 +5302,15 @@
4865
5302
  return;
4866
5303
  globalThis.removeEventListener("mousedown", hideHandler, true);
4867
5304
  });
4868
- expose({
5305
+ __expose({
5306
+ menu,
4869
5307
  hide,
4870
- show
5308
+ show,
5309
+ contains
4871
5310
  });
4872
5311
  return (_ctx, _cache) => {
4873
5312
  const _component_content_menu = vue.resolveComponent("content-menu", true);
4874
- return __props.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
5313
+ return _ctx.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
4875
5314
  key: 0,
4876
5315
  class: "magic-editor-content-menu",
4877
5316
  ref_key: "menu",
@@ -4879,25 +5318,29 @@
4879
5318
  style: vue.normalizeStyle(menuStyle.value)
4880
5319
  }, [
4881
5320
  vue.createElementVNode("div", null, [
4882
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
4883
- return vue.openBlock(), vue.createBlock(_sfc_main$p, {
5321
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
5322
+ return vue.openBlock(), vue.createBlock(_sfc_main$r, {
4884
5323
  "event-type": "mouseup",
5324
+ ref_for: true,
5325
+ ref_key: "buttons",
5326
+ ref: buttons,
4885
5327
  data: item,
4886
5328
  key: index,
4887
5329
  onMouseup: hide,
4888
- onMouseenter: ($event) => showSubMenu(item)
5330
+ onMouseenter: ($event) => showSubMenu(item, index)
4889
5331
  }, null, 8, ["data", "onMouseenter"]);
4890
5332
  }), 128))
4891
5333
  ]),
4892
5334
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
4893
- vue.createVNode(_component_content_menu, {
5335
+ subMenuData.value.length ? (vue.openBlock(), vue.createBlock(_component_content_menu, {
5336
+ key: 0,
4894
5337
  class: "sub-menu",
4895
5338
  ref_key: "subMenu",
4896
5339
  ref: subMenu,
4897
5340
  "menu-data": subMenuData.value,
4898
5341
  "is-sub-menu": true,
4899
5342
  onHide: hide
4900
- }, null, 8, ["menu-data"])
5343
+ }, null, 8, ["menu-data"])) : vue.createCommentVNode("", true)
4901
5344
  ]))
4902
5345
  ], 4)), [
4903
5346
  [vue.vShow, visible.value]
@@ -4906,21 +5349,95 @@
4906
5349
  }
4907
5350
  });
4908
5351
 
4909
- const __default__$a = vue.defineComponent({
4910
- name: "MEditorLayerMenu"
5352
+ const useDeleteMenu = () => ({
5353
+ type: "button",
5354
+ text: "删除",
5355
+ icon: iconsVue.Delete,
5356
+ display: (services) => {
5357
+ const node = services?.editorService?.get("node");
5358
+ return node?.type !== schema.NodeType.ROOT && !utils.isPage(node);
5359
+ },
5360
+ handler: (services) => {
5361
+ const nodes = services?.editorService?.get("nodes");
5362
+ nodes && services?.editorService?.remove(nodes);
5363
+ }
4911
5364
  });
4912
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4913
- ...__default__$a,
5365
+ const canPaste = vue.ref(false);
5366
+ const useCopyMenu = () => ({
5367
+ type: "button",
5368
+ text: "复制",
5369
+ icon: vue.markRaw(iconsVue.CopyDocument),
5370
+ handler: (services) => {
5371
+ const nodes = services?.editorService?.get("nodes");
5372
+ nodes && services?.editorService?.copy(nodes);
5373
+ canPaste.value = true;
5374
+ }
5375
+ });
5376
+ const usePasteMenu = (menu) => ({
5377
+ type: "button",
5378
+ text: "粘贴",
5379
+ icon: vue.markRaw(iconsVue.DocumentCopy),
5380
+ display: () => canPaste.value,
5381
+ handler: (services) => {
5382
+ const nodes = services?.editorService?.get("nodes");
5383
+ if (!nodes || nodes.length === 0)
5384
+ return;
5385
+ if (menu?.value?.$el) {
5386
+ const stage = services?.editorService?.get("stage");
5387
+ const rect = menu.value.$el.getBoundingClientRect();
5388
+ const parentRect = stage?.container?.getBoundingClientRect();
5389
+ const initialLeft = (rect.left || 0) - (parentRect?.left || 0);
5390
+ const initialTop = (rect.top || 0) - (parentRect?.top || 0);
5391
+ services?.editorService?.paste({ left: initialLeft, top: initialTop });
5392
+ } else {
5393
+ services?.editorService?.paste();
5394
+ }
5395
+ }
5396
+ });
5397
+ const moveTo = (id, services) => {
5398
+ if (!services?.editorService)
5399
+ return;
5400
+ const nodes = services.editorService.get("nodes") || [];
5401
+ const parent = services.editorService.getNodeById(id);
5402
+ if (!parent)
5403
+ return;
5404
+ services?.editorService.add(nodes, parent);
5405
+ services?.editorService.remove(nodes);
5406
+ };
5407
+ const useMoveToMenu = (services) => {
5408
+ const root = vue.computed(() => services?.editorService?.get("root"));
5409
+ return {
5410
+ type: "button",
5411
+ text: "移动至",
5412
+ display: (services2) => {
5413
+ const node = services2?.editorService?.get("node");
5414
+ const pageLength = services2?.editorService?.get("pageLength") || 0;
5415
+ return !utils.isPage(node) && pageLength > 1;
5416
+ },
5417
+ items: (root.value?.items || []).filter((page) => page.id !== services?.editorService?.get("page")?.id).map((page) => ({
5418
+ text: `${page.name}(${page.id})`,
5419
+ type: "button",
5420
+ handler: (services2) => {
5421
+ moveTo(page.id, services2);
5422
+ }
5423
+ }))
5424
+ };
5425
+ };
5426
+
5427
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
5428
+ ...{
5429
+ name: "MEditorLayerMenu"
5430
+ },
5431
+ __name: "LayerMenu",
4914
5432
  props: {
4915
- layerContentMenu: null
5433
+ layerContentMenu: {}
4916
5434
  },
4917
- setup(__props, { expose }) {
5435
+ setup(__props, { expose: __expose }) {
4918
5436
  const props = __props;
4919
5437
  const services = vue.inject("services");
4920
5438
  const menu = vue.ref();
4921
5439
  const node = vue.computed(() => services?.editorService.get("node"));
4922
- const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
4923
- const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
5440
+ const nodes = vue.computed(() => services?.editorService.get("nodes"));
4924
5441
  const componentList = vue.computed(() => services?.componentListService.getList() || []);
4925
5442
  const createMenuItems = (group) => group.items.map((component) => ({
4926
5443
  text: component.text,
@@ -4970,38 +5487,24 @@
4970
5487
  type: "button",
4971
5488
  text: "新增",
4972
5489
  icon: vue.markRaw(iconsVue.Plus),
4973
- display: () => node.value?.items,
5490
+ display: () => node.value?.items && nodes.value?.length === 1,
4974
5491
  items: getSubMenuData.value
4975
5492
  },
4976
- {
4977
- type: "button",
4978
- text: "复制",
4979
- icon: vue.markRaw(iconsVue.CopyDocument),
4980
- display: () => !isRoot.value,
4981
- handler: () => {
4982
- node.value && services?.editorService.copy(node.value);
4983
- }
4984
- },
4985
- {
4986
- type: "button",
4987
- text: "删除",
4988
- icon: vue.markRaw(iconsVue.Delete),
4989
- display: () => !isRoot.value && !isPage.value,
4990
- handler: () => {
4991
- node.value && services?.editorService.remove(node.value);
4992
- }
4993
- },
5493
+ useCopyMenu(),
5494
+ usePasteMenu(),
5495
+ useDeleteMenu(),
5496
+ useMoveToMenu(services),
4994
5497
  ...props.layerContentMenu
4995
5498
  ]);
4996
5499
  const show = (e) => {
4997
5500
  menu.value?.show(e);
4998
5501
  };
4999
- expose({
5502
+ __expose({
5000
5503
  show
5001
5504
  });
5002
5505
  return (_ctx, _cache) => {
5003
- return vue.openBlock(), vue.createBlock(_sfc_main$c, {
5004
- "menu-data": vue.unref(menuData),
5506
+ return vue.openBlock(), vue.createBlock(_sfc_main$e, {
5507
+ "menu-data": menuData.value,
5005
5508
  ref_key: "menu",
5006
5509
  ref: menu,
5007
5510
  style: { "overflow": "initial" }
@@ -5010,19 +5513,71 @@
5010
5513
  }
5011
5514
  });
5012
5515
 
5013
- const _hoisted_1$4 = ["id", "onMouseenter"];
5014
- const __default__$9 = vue.defineComponent({
5015
- name: "MEditorLayerPanel"
5516
+ const _hoisted_1$7 = { class: "layer-node-tool" };
5517
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
5518
+ __name: "LayerNode",
5519
+ props: {
5520
+ data: {}
5521
+ },
5522
+ setup(__props) {
5523
+ const props = __props;
5524
+ const services = vue.inject("services");
5525
+ const editorService = services?.editorService;
5526
+ const setNodeVisible = (visible) => {
5527
+ if (!editorService)
5528
+ return;
5529
+ editorService.update({
5530
+ id: props.data.id,
5531
+ visible
5532
+ });
5533
+ };
5534
+ return (_ctx, _cache) => {
5535
+ const _component_el_icon = vue.resolveComponent("el-icon");
5536
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
5537
+ vue.createElementVNode("div", null, vue.toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
5538
+ vue.createElementVNode("div", _hoisted_1$7, [
5539
+ _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
5540
+ _ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
5541
+ key: 0,
5542
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
5543
+ title: "点击显示"
5544
+ }, {
5545
+ default: vue.withCtx(() => [
5546
+ vue.createVNode(vue.unref(iconsVue.Hide))
5547
+ ]),
5548
+ _: 1
5549
+ })) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
5550
+ key: 1,
5551
+ onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
5552
+ class: "node-lock",
5553
+ title: "点击隐藏"
5554
+ }, {
5555
+ default: vue.withCtx(() => [
5556
+ vue.createVNode(vue.unref(iconsVue.View))
5557
+ ]),
5558
+ _: 1
5559
+ }))
5560
+ ], 64)) : vue.createCommentVNode("", true)
5561
+ ])
5562
+ ], 64);
5563
+ };
5564
+ }
5016
5565
  });
5017
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
5018
- ...__default__$9,
5566
+
5567
+ const _hoisted_1$6 = ["id", "onMouseenter"];
5568
+ const throttleTime = 150;
5569
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
5570
+ ...{
5571
+ name: "MEditorLayerPanel"
5572
+ },
5573
+ __name: "LayerPanel",
5019
5574
  props: {
5020
- layerContentMenu: null
5575
+ layerContentMenu: {}
5021
5576
  },
5022
5577
  setup(__props) {
5023
- const throttleTime = 150;
5024
5578
  const services = vue.inject("services");
5025
5579
  const editorService = services?.editorService;
5580
+ const keybindingService = services?.keybindingService;
5026
5581
  const tree = vue.ref();
5027
5582
  const menu = vue.ref();
5028
5583
  const checkedKeys = vue.ref([]);
@@ -5156,25 +5711,59 @@
5156
5711
  const windowBlurHandler = () => {
5157
5712
  isCtrlKeyDown.value = false;
5158
5713
  };
5159
- let keycon;
5714
+ keybindingService?.registeCommand("layer-panel-not-ctrl-keydown", (e) => {
5715
+ if (e.key !== keybindingService.ctrlKey) {
5716
+ isCtrlKeyDown.value = false;
5717
+ }
5718
+ });
5719
+ keybindingService?.registeCommand("layer-panel-ctrl-keydown", () => {
5720
+ isCtrlKeyDown.value = true;
5721
+ });
5722
+ keybindingService?.registeCommand("layer-panel-ctrl-keyup", () => {
5723
+ isCtrlKeyDown.value = false;
5724
+ });
5725
+ keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
5726
+ if (!tree.value?.$el.contains(document.activeElement)) {
5727
+ isCtrlKeyDown.value = false;
5728
+ }
5729
+ });
5730
+ keybindingService?.registe([
5731
+ {
5732
+ command: "layer-panel-not-ctrl-keydown",
5733
+ when: [["layer-panel", "keydown"]]
5734
+ },
5735
+ {
5736
+ command: "layer-panel-ctrl-keydown",
5737
+ keybinding: "ctrl",
5738
+ when: [["layer-panel", "keydown"]]
5739
+ },
5740
+ {
5741
+ command: "layer-panel-ctrl-keyup",
5742
+ keybinding: "ctrl",
5743
+ when: [["layer-panel", "keyup"]]
5744
+ },
5745
+ {
5746
+ command: "layer-panel-global-keydwon",
5747
+ keybinding: "ctrl",
5748
+ when: [["global", "keydown"]]
5749
+ }
5750
+ ]);
5751
+ vue.watch(tree, () => {
5752
+ if (tree.value?.$el) {
5753
+ keybindingService?.registeEl("layer-panel", tree.value.$el);
5754
+ tree.value.$el.addEventListener("blur", windowBlurHandler);
5755
+ } else {
5756
+ keybindingService?.unregisteEl("layer-panel");
5757
+ }
5758
+ });
5160
5759
  vue.onMounted(() => {
5161
5760
  editorService?.on("remove", editorServiceRemoveHandler);
5162
- keycon = new KeyController();
5163
- const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
5164
- const ctrl = isMac ? "meta" : "ctrl";
5165
- keycon.keydown((e) => {
5166
- if (e.key !== ctrl) {
5167
- isCtrlKeyDown.value = false;
5168
- }
5169
- }).keydown(ctrl, () => {
5170
- isCtrlKeyDown.value = true;
5171
- }).keyup(ctrl, () => {
5172
- isCtrlKeyDown.value = false;
5173
- });
5174
5761
  globalThis.addEventListener("blur", windowBlurHandler);
5175
5762
  });
5763
+ vue.onBeforeUnmount(() => {
5764
+ tree.value?.$el.removeEventListener("blur", windowBlurHandler);
5765
+ });
5176
5766
  vue.onUnmounted(() => {
5177
- keycon.destroy();
5178
5767
  editorService?.off("remove", editorServiceRemoveHandler);
5179
5768
  globalThis.removeEventListener("blur", windowBlurHandler);
5180
5769
  });
@@ -5206,33 +5795,36 @@
5206
5795
  };
5207
5796
  const contextmenu = async (event, data) => {
5208
5797
  event.preventDefault();
5209
- await select(data);
5798
+ if (nodes.value.length < 2) {
5799
+ await select(data);
5800
+ }
5210
5801
  menu.value?.show(event);
5211
5802
  };
5212
5803
  return (_ctx, _cache) => {
5213
5804
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
5214
5805
  default: vue.withCtx(() => [
5215
5806
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
5216
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
5217
- vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
5807
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
5808
+ values.value.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
5218
5809
  key: 0,
5219
5810
  class: "magic-editor-layer-tree",
5220
5811
  ref_key: "tree",
5221
5812
  ref: tree,
5222
5813
  "node-key": "id",
5223
5814
  "empty-text": "页面空荡荡的",
5815
+ tabindex: "-1",
5224
5816
  draggable: "",
5225
5817
  "default-expanded-keys": expandedKeys.value,
5226
5818
  "default-checked-keys": checkedKeys.value,
5227
5819
  "current-node-key": currentNodeKey.value,
5228
- data: vue.unref(values),
5820
+ data: values.value,
5229
5821
  "expand-on-click-node": false,
5230
- "highlight-current": !vue.unref(isMultiSelect),
5822
+ "highlight-current": !isMultiSelect.value,
5231
5823
  "check-on-click-node": true,
5232
5824
  props: treeProps,
5233
5825
  "filter-node-method": filterNode,
5234
5826
  "allow-drop": allowDrop,
5235
- "show-checkbox": vue.unref(isMultiSelect),
5827
+ "show-checkbox": isMultiSelect.value,
5236
5828
  onNodeClick: clickHandler,
5237
5829
  onNodeContextmenu: contextmenu,
5238
5830
  onNodeDragEnd: handleDragEnd,
@@ -5252,17 +5844,17 @@
5252
5844
  node,
5253
5845
  data
5254
5846
  }, () => [
5255
- vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
5847
+ vue.createVNode(_sfc_main$c, { data }, null, 8, ["data"])
5256
5848
  ])
5257
- ], 40, _hoisted_1$4)
5849
+ ], 40, _hoisted_1$6)
5258
5850
  ]),
5259
5851
  _: 3
5260
5852
  }, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : vue.createCommentVNode("", true),
5261
5853
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
5262
- vue.createVNode(_sfc_main$b, {
5854
+ vue.createVNode(_sfc_main$d, {
5263
5855
  ref_key: "menu",
5264
5856
  ref: menu,
5265
- "layer-content-menu": __props.layerContentMenu
5857
+ "layer-content-menu": _ctx.layerContentMenu
5266
5858
  }, null, 8, ["layer-content-menu"])
5267
5859
  ]))
5268
5860
  ]),
@@ -5272,23 +5864,23 @@
5272
5864
  }
5273
5865
  });
5274
5866
 
5275
- const _hoisted_1$3 = {
5867
+ const _hoisted_1$5 = {
5276
5868
  key: 1,
5277
5869
  class: "magic-editor-tab-panel-title"
5278
5870
  };
5279
- const __default__$8 = vue.defineComponent({
5280
- name: "MEditorSidebar"
5281
- });
5282
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
5283
- ...__default__$8,
5871
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
5872
+ ...{
5873
+ name: "MEditorSidebar"
5874
+ },
5875
+ __name: "Sidebar",
5284
5876
  props: {
5285
5877
  data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
5286
- layerContentMenu: null
5878
+ layerContentMenu: {}
5287
5879
  },
5288
- setup(__props, { expose }) {
5880
+ setup(__props, { expose: __expose }) {
5289
5881
  const props = __props;
5290
- const tabPaneComponent = design.getConfig("components").tabPane;
5291
- const tabsComponent = design.getConfig("components").tabs;
5882
+ const tabPaneComponent = design.getConfig("components")?.tabPane;
5883
+ const tabsComponent = design.getConfig("components")?.tabs;
5292
5884
  const activeTabName = vue.ref(props.data?.status);
5293
5885
  const getItemConfig = (data) => {
5294
5886
  const map = {
@@ -5297,7 +5889,7 @@
5297
5889
  type: "component",
5298
5890
  icon: iconsVue.Goods,
5299
5891
  text: "组件",
5300
- component: _sfc_main$d,
5892
+ component: _sfc_main$f,
5301
5893
  slots: {}
5302
5894
  },
5303
5895
  layer: {
@@ -5308,7 +5900,7 @@
5308
5900
  props: {
5309
5901
  layerContentMenu: props.layerContentMenu
5310
5902
  },
5311
- component: _sfc_main$a,
5903
+ component: _sfc_main$b,
5312
5904
  slots: {}
5313
5905
  },
5314
5906
  "code-block": {
@@ -5316,7 +5908,7 @@
5316
5908
  type: "component",
5317
5909
  icon: iconsVue.EditPen,
5318
5910
  text: "代码编辑",
5319
- component: _sfc_main$g,
5911
+ component: _sfc_main$i,
5320
5912
  slots: {}
5321
5913
  },
5322
5914
  "data-source": {
@@ -5324,7 +5916,7 @@
5324
5916
  type: "component",
5325
5917
  icon: iconsVue.Coin,
5326
5918
  text: "数据源",
5327
- component: _sfc_main$e,
5919
+ component: _sfc_main$g,
5328
5920
  slots: {}
5329
5921
  }
5330
5922
  };
@@ -5337,30 +5929,30 @@
5337
5929
  activeTabName.value = status || "0";
5338
5930
  }
5339
5931
  );
5340
- expose({
5932
+ __expose({
5341
5933
  activeTabName
5342
5934
  });
5343
5935
  return (_ctx, _cache) => {
5344
- return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent).component), vue.mergeProps({
5936
+ return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent)?.component || "el-tabs"), vue.mergeProps({
5345
5937
  key: 0,
5346
5938
  modelValue: activeTabName.value,
5347
5939
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
5348
5940
  class: "m-editor-sidebar tmagic-design-tabs"
5349
- }, vue.unref(tabsComponent).props({ type: "card", tabPosition: "left" })), {
5941
+ }, vue.unref(tabsComponent)?.props({ type: "card", tabPosition: "left" }) || {}), {
5350
5942
  default: vue.withCtx(() => [
5351
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
5352
- return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent).component), vue.mergeProps(vue.unref(tabPaneComponent).props({ name: config.text }), {
5943
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
5944
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent)?.component || "el-tab-pane"), vue.mergeProps(vue.unref(tabPaneComponent)?.props({ name: config.text, lazy: config.lazy }) || {}, {
5353
5945
  key: config.$key || index
5354
5946
  }), {
5355
5947
  label: vue.withCtx(() => [
5356
5948
  (vue.openBlock(), vue.createElementBlock("div", {
5357
5949
  key: config.text
5358
5950
  }, [
5359
- config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
5951
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$E, {
5360
5952
  key: 0,
5361
5953
  icon: config.icon
5362
5954
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
5363
- config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
5955
+ config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
5364
5956
  ]))
5365
5957
  ]),
5366
5958
  default: vue.withCtx(() => [
@@ -5369,7 +5961,8 @@
5369
5961
  name: "component-list-panel-header",
5370
5962
  fn: vue.withCtx(() => [
5371
5963
  config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
5372
- ])
5964
+ ]),
5965
+ key: "0"
5373
5966
  } : void 0,
5374
5967
  config.$key === "component-list" || config.slots?.componentListItem ? {
5375
5968
  name: "component-list-item",
@@ -5381,19 +5974,22 @@
5381
5974
  key: 1,
5382
5975
  component
5383
5976
  }, null, 8, ["component"])) : vue.createCommentVNode("", true)
5384
- ])
5977
+ ]),
5978
+ key: "1"
5385
5979
  } : void 0,
5386
5980
  config.$key === "layer" || config.slots?.layerPanelHeader ? {
5387
5981
  name: "layer-panel-header",
5388
5982
  fn: vue.withCtx(() => [
5389
5983
  config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
5390
- ])
5984
+ ]),
5985
+ key: "2"
5391
5986
  } : void 0,
5392
5987
  config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
5393
5988
  name: "code-block-panel-header",
5394
5989
  fn: vue.withCtx(() => [
5395
5990
  config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
5396
- ])
5991
+ ]),
5992
+ key: "3"
5397
5993
  } : void 0,
5398
5994
  config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
5399
5995
  name: "code-block-panel-tool",
@@ -5403,7 +5999,8 @@
5403
5999
  id,
5404
6000
  data
5405
6001
  }) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
5406
- ])
6002
+ ]),
6003
+ key: "4"
5407
6004
  } : void 0,
5408
6005
  config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
5409
6006
  name: "code-block-edit-panel-header",
@@ -5412,7 +6009,8 @@
5412
6009
  key: 0,
5413
6010
  id
5414
6011
  }) : config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
5415
- ])
6012
+ ]),
6013
+ key: "5"
5416
6014
  } : void 0,
5417
6015
  config.$key === "layer" || config.slots?.layerNodeContent ? {
5418
6016
  name: "layer-node-content",
@@ -5426,7 +6024,8 @@
5426
6024
  data: nodeData,
5427
6025
  node
5428
6026
  }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
5429
- ])
6027
+ ]),
6028
+ key: "6"
5430
6029
  } : void 0
5431
6030
  ]), 1040)) : vue.createCommentVNode("", true)
5432
6031
  ]),
@@ -5440,16 +6039,16 @@
5440
6039
  }
5441
6040
  });
5442
6041
 
5443
- const _hoisted_1$2 = {
6042
+ const _hoisted_1$4 = {
5444
6043
  key: 0,
5445
6044
  class: "m-editor-breadcrumb"
5446
6045
  };
5447
- const _hoisted_2$1 = { key: 0 };
5448
- const __default__$7 = vue.defineComponent({
5449
- name: "MEditorBreadcrumb"
5450
- });
5451
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
5452
- ...__default__$7,
6046
+ const _hoisted_2$2 = { key: 0 };
6047
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
6048
+ ...{
6049
+ name: "MEditorBreadcrumb"
6050
+ },
6051
+ __name: "Breadcrumb",
5453
6052
  setup(__props) {
5454
6053
  const services = vue.inject("services");
5455
6054
  const editorService = services?.editorService;
@@ -5462,14 +6061,14 @@
5462
6061
  editorService?.get("stage")?.select(node2.id);
5463
6062
  };
5464
6063
  return (_ctx, _cache) => {
5465
- return vue.unref(nodes).length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
5466
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(path), (item, index) => {
6064
+ return nodes.value.length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
6065
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(path.value, (item, index) => {
5467
6066
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
5468
6067
  key: item.id
5469
6068
  }, [
5470
6069
  vue.createVNode(vue.unref(design.TMagicButton), {
5471
6070
  text: "",
5472
- disabled: item.id === vue.unref(node)?.id,
6071
+ disabled: item.id === node.value?.id,
5473
6072
  onClick: ($event) => select(item)
5474
6073
  }, {
5475
6074
  default: vue.withCtx(() => [
@@ -5477,7 +6076,7 @@
5477
6076
  ]),
5478
6077
  _: 2
5479
6078
  }, 1032, ["disabled", "onClick"]),
5480
- index < vue.unref(path).length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$1, "/")) : vue.createCommentVNode("", true)
6079
+ index < path.value.length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$2, "/")) : vue.createCommentVNode("", true)
5481
6080
  ], 64);
5482
6081
  }), 128))
5483
6082
  ])) : vue.createCommentVNode("", true);
@@ -5485,15 +6084,15 @@
5485
6084
  }
5486
6085
  });
5487
6086
 
5488
- const _hoisted_1$1 = {
6087
+ const _hoisted_1$3 = {
5489
6088
  key: 1,
5490
6089
  style: { "width": "21px" }
5491
6090
  };
5492
- const __default__$6 = vue.defineComponent({
5493
- name: "MEditorPageBarScrollContainer"
5494
- });
5495
- const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
5496
- ...__default__$6,
6091
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
6092
+ ...{
6093
+ name: "MEditorPageBarScrollContainer"
6094
+ },
6095
+ __name: "PageBarScrollContainer",
5497
6096
  setup(__props) {
5498
6097
  const services = vue.inject("services");
5499
6098
  const editorService = services?.editorService;
@@ -5571,22 +6170,22 @@
5571
6170
  ref_key: "pageBar",
5572
6171
  ref: pageBar
5573
6172
  }, [
5574
- vue.unref(showAddPageButton) ? (vue.openBlock(), vue.createElementBlock("div", {
6173
+ showAddPageButton.value ? (vue.openBlock(), vue.createElementBlock("div", {
5575
6174
  key: 0,
5576
6175
  id: "m-editor-page-bar-add-icon",
5577
6176
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5578
6177
  onClick: addPage
5579
6178
  }, [
5580
- vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
5581
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
6179
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6180
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3)),
5582
6181
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
5583
6182
  key: 2,
5584
6183
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5585
6184
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5586
6185
  }, [
5587
- vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
6186
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
5588
6187
  ])) : vue.createCommentVNode("", true),
5589
- vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
6188
+ pageLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
5590
6189
  key: 3,
5591
6190
  class: "m-editor-page-bar-items",
5592
6191
  ref_key: "itemsContainer",
@@ -5600,20 +6199,20 @@
5600
6199
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5601
6200
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5602
6201
  }, [
5603
- vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
6202
+ vue.createVNode(_sfc_main$E, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
5604
6203
  ])) : vue.createCommentVNode("", true)
5605
6204
  ], 512);
5606
6205
  };
5607
6206
  }
5608
6207
  });
5609
6208
 
5610
- const _hoisted_1 = ["onClick"];
5611
- const _hoisted_2 = { class: "m-editor-page-bar-title" };
5612
- const __default__$5 = vue.defineComponent({
5613
- name: "MEditorPageBar"
5614
- });
5615
- const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
5616
- ...__default__$5,
6209
+ const _hoisted_1$2 = ["onClick"];
6210
+ const _hoisted_2$1 = { class: "m-editor-page-bar-title" };
6211
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
6212
+ ...{
6213
+ name: "MEditorPageBar"
6214
+ },
6215
+ __name: "PageBar",
5617
6216
  setup(__props) {
5618
6217
  const services = vue.inject("services");
5619
6218
  const editorService = services?.editorService;
@@ -5633,15 +6232,15 @@
5633
6232
  editorService?.remove(node);
5634
6233
  };
5635
6234
  return (_ctx, _cache) => {
5636
- return vue.openBlock(), vue.createBlock(_sfc_main$7, null, {
6235
+ return vue.openBlock(), vue.createBlock(_sfc_main$8, null, {
5637
6236
  default: vue.withCtx(() => [
5638
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root) && vue.unref(root).items || [], (item) => {
6237
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(root.value && root.value.items || [], (item) => {
5639
6238
  return vue.openBlock(), vue.createElementBlock("div", {
5640
- class: vue.normalizeClass(["m-editor-page-bar-item", { active: vue.unref(page)?.id === item.id }]),
6239
+ class: vue.normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
5641
6240
  key: item.key,
5642
6241
  onClick: ($event) => switchPage(item)
5643
6242
  }, [
5644
- vue.createElementVNode("div", _hoisted_2, [
6243
+ vue.createElementVNode("div", _hoisted_2$1, [
5645
6244
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
5646
6245
  vue.createVNode(vue.unref(design.TMagicTooltip), {
5647
6246
  effect: "dark",
@@ -5672,7 +6271,7 @@
5672
6271
  default: vue.withCtx(() => [
5673
6272
  vue.createElementVNode("div", null, [
5674
6273
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
5675
- vue.createVNode(_sfc_main$p, {
6274
+ vue.createVNode(_sfc_main$r, {
5676
6275
  data: {
5677
6276
  type: "button",
5678
6277
  text: "复制",
@@ -5680,7 +6279,7 @@
5680
6279
  handler: () => copy(item)
5681
6280
  }
5682
6281
  }, null, 8, ["data"]),
5683
- vue.createVNode(_sfc_main$p, {
6282
+ vue.createVNode(_sfc_main$r, {
5684
6283
  data: {
5685
6284
  type: "button",
5686
6285
  text: "删除",
@@ -5693,7 +6292,7 @@
5693
6292
  ]),
5694
6293
  _: 2
5695
6294
  }, 1024)
5696
- ], 10, _hoisted_1);
6295
+ ], 10, _hoisted_1$2);
5697
6296
  }), 128))
5698
6297
  ]),
5699
6298
  _: 3
@@ -5830,16 +6429,16 @@
5830
6429
  };
5831
6430
  }
5832
6431
 
5833
- const __default__$4 = vue.defineComponent({
5834
- name: "MEditorScrollBar"
5835
- });
5836
- const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5837
- ...__default__$4,
6432
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
6433
+ ...{
6434
+ name: "MEditorScrollBar"
6435
+ },
6436
+ __name: "ScrollBar",
5838
6437
  props: {
5839
- size: null,
5840
- scrollSize: null,
6438
+ size: {},
6439
+ scrollSize: {},
5841
6440
  isHorizontal: { type: Boolean },
5842
- pos: null
6441
+ pos: {}
5843
6442
  },
5844
6443
  emits: ["scroll"],
5845
6444
  setup(__props, { emit }) {
@@ -5904,13 +6503,13 @@
5904
6503
  return vue.openBlock(), vue.createElementBlock("div", {
5905
6504
  ref_key: "bar",
5906
6505
  ref: bar,
5907
- class: vue.normalizeClass(["m-editor-scroll-bar", __props.isHorizontal ? "horizontal" : "vertical"])
6506
+ class: vue.normalizeClass(["m-editor-scroll-bar", _ctx.isHorizontal ? "horizontal" : "vertical"])
5908
6507
  }, [
5909
6508
  vue.createElementVNode("div", {
5910
6509
  ref_key: "thumb",
5911
6510
  ref: thumb,
5912
6511
  class: "m-editor-scroll-bar-thumb",
5913
- style: vue.normalizeStyle(vue.unref(thumbStyle))
6512
+ style: vue.normalizeStyle(thumbStyle.value)
5914
6513
  }, null, 4)
5915
6514
  ], 2);
5916
6515
  };
@@ -5919,11 +6518,11 @@
5919
6518
 
5920
6519
  const ScrollBar_vue_vue_type_style_index_0_lang = '';
5921
6520
 
5922
- const __default__$3 = vue.defineComponent({
5923
- name: "MEditorScrollViewer"
5924
- });
5925
- const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
5926
- ...__default__$3,
6521
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
6522
+ ...{
6523
+ name: "MEditorScrollViewer"
6524
+ },
6525
+ __name: "ScrollViewer",
5927
6526
  props: {
5928
6527
  width: { default: 0 },
5929
6528
  height: { default: 0 },
@@ -5935,7 +6534,7 @@
5935
6534
  height: 0
5936
6535
  }) }
5937
6536
  },
5938
- setup(__props, { expose }) {
6537
+ setup(__props, { expose: __expose }) {
5939
6538
  const props = __props;
5940
6539
  const container = vue.ref();
5941
6540
  const el = vue.ref();
@@ -5989,7 +6588,7 @@
5989
6588
  left: hOffset.value
5990
6589
  });
5991
6590
  };
5992
- expose({
6591
+ __expose({
5993
6592
  container
5994
6593
  });
5995
6594
  return (_ctx, _cache) => {
@@ -6001,23 +6600,23 @@
6001
6600
  vue.createElementVNode("div", {
6002
6601
  ref_key: "el",
6003
6602
  ref: el,
6004
- style: vue.normalizeStyle(vue.unref(style))
6603
+ style: vue.normalizeStyle(style.value)
6005
6604
  }, [
6006
6605
  vue.renderSlot(_ctx.$slots, "default")
6007
6606
  ], 4),
6008
- scrollHeight.value > __props.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$5, {
6607
+ scrollHeight.value > _ctx.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$6, {
6009
6608
  key: 0,
6010
6609
  "scroll-size": scrollHeight.value,
6011
- size: __props.wrapHeight,
6610
+ size: _ctx.wrapHeight,
6012
6611
  pos: vOffset.value,
6013
6612
  onScroll: vScrollHandler
6014
6613
  }, null, 8, ["scroll-size", "size", "pos"])) : vue.createCommentVNode("", true),
6015
- scrollWidth.value > __props.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$5, {
6614
+ scrollWidth.value > _ctx.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$6, {
6016
6615
  key: 1,
6017
6616
  "is-horizontal": true,
6018
6617
  "scroll-size": scrollWidth.value,
6019
6618
  pos: hOffset.value,
6020
- size: __props.wrapWidth,
6619
+ size: _ctx.wrapWidth,
6021
6620
  onScroll: hScrollHandler
6022
6621
  }, null, 8, ["scroll-size", "pos", "size"])) : vue.createCommentVNode("", true)
6023
6622
  ], 512);
@@ -6025,16 +6624,59 @@
6025
6624
  }
6026
6625
  });
6027
6626
 
6028
- const __default__$2 = vue.defineComponent({
6029
- name: "MEditorViewerMenu"
6627
+ const _hoisted_1$1 = {
6628
+ viewBox: "0 0 24 24",
6629
+ fill: "none",
6630
+ xmlns: "http://www.w3.org/2000/svg"
6631
+ };
6632
+ const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("path", {
6633
+ "fill-rule": "evenodd",
6634
+ "clip-rule": "evenodd",
6635
+ d: "M2 4H21V6H2V4Z",
6636
+ fill: "black",
6637
+ "fill-opacity": "0.9"
6638
+ }, null, -1);
6639
+ const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("path", {
6640
+ "fill-rule": "evenodd",
6641
+ "clip-rule": "evenodd",
6642
+ d: "M5 11H18V13H5V11Z",
6643
+ fill: "black",
6644
+ "fill-opacity": "0.9"
6645
+ }, null, -1);
6646
+ const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("path", {
6647
+ "fill-rule": "evenodd",
6648
+ "clip-rule": "evenodd",
6649
+ d: "M2 18H21V20H2V18Z",
6650
+ fill: "black",
6651
+ "fill-opacity": "0.9"
6652
+ }, null, -1);
6653
+ const _hoisted_5 = [
6654
+ _hoisted_2,
6655
+ _hoisted_3,
6656
+ _hoisted_4
6657
+ ];
6658
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
6659
+ ...{
6660
+ name: "MEditorCenterIcon"
6661
+ },
6662
+ __name: "CenterIcon",
6663
+ setup(__props) {
6664
+ return (_ctx, _cache) => {
6665
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_5);
6666
+ };
6667
+ }
6030
6668
  });
6669
+
6031
6670
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
6032
- ...__default__$2,
6671
+ ...{
6672
+ name: "MEditorViewerMenu"
6673
+ },
6674
+ __name: "ViewerMenu",
6033
6675
  props: {
6034
6676
  isMultiSelect: { type: Boolean, default: false },
6035
- stageContentMenu: null
6677
+ stageContentMenu: {}
6036
6678
  },
6037
- setup(__props, { expose }) {
6679
+ setup(__props, { expose: __expose }) {
6038
6680
  const props = __props;
6039
6681
  const services = vue.inject("services");
6040
6682
  const editorService = services?.editorService;
@@ -6044,11 +6686,11 @@
6044
6686
  const node = vue.computed(() => editorService?.get("node"));
6045
6687
  const nodes = vue.computed(() => editorService?.get("nodes"));
6046
6688
  const parent = vue.computed(() => editorService?.get("parent"));
6047
- const stage = vue.computed(() => editorService?.get("stage"));
6048
6689
  const menuData = vue.computed(() => [
6049
6690
  {
6050
6691
  type: "button",
6051
6692
  text: "水平居中",
6693
+ icon: vue.markRaw(_sfc_main$4),
6052
6694
  display: () => canCenter.value,
6053
6695
  handler: () => {
6054
6696
  if (!nodes.value)
@@ -6056,30 +6698,8 @@
6056
6698
  editorService?.alignCenter(nodes.value);
6057
6699
  }
6058
6700
  },
6059
- {
6060
- type: "button",
6061
- text: "复制",
6062
- icon: vue.markRaw(iconsVue.CopyDocument),
6063
- handler: () => {
6064
- nodes.value && editorService?.copy(nodes.value);
6065
- canPaste.value = true;
6066
- }
6067
- },
6068
- {
6069
- type: "button",
6070
- text: "粘贴",
6071
- icon: vue.markRaw(iconsVue.DocumentCopy),
6072
- display: () => canPaste.value,
6073
- handler: () => {
6074
- const rect = menu.value?.$el.getBoundingClientRect();
6075
- const parentRect = stage.value?.container?.getBoundingClientRect();
6076
- const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
6077
- const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
6078
- if (!nodes.value || nodes.value.length === 0)
6079
- return;
6080
- editorService?.paste({ left: initialLeft, top: initialTop });
6081
- }
6082
- },
6701
+ useCopyMenu(),
6702
+ usePasteMenu(menu),
6083
6703
  {
6084
6704
  type: "divider",
6085
6705
  direction: "horizontal",
@@ -6110,6 +6730,7 @@
6110
6730
  {
6111
6731
  type: "button",
6112
6732
  text: "置顶",
6733
+ icon: vue.markRaw(iconsVue.Top),
6113
6734
  display: () => !utils.isPage(node.value) && !props.isMultiSelect,
6114
6735
  handler: () => {
6115
6736
  editorService?.moveLayer(LayerOffset.TOP);
@@ -6118,25 +6739,19 @@
6118
6739
  {
6119
6740
  type: "button",
6120
6741
  text: "置底",
6742
+ icon: vue.markRaw(iconsVue.Bottom),
6121
6743
  display: () => !utils.isPage(node.value) && !props.isMultiSelect,
6122
6744
  handler: () => {
6123
6745
  editorService?.moveLayer(LayerOffset.BOTTOM);
6124
6746
  }
6125
6747
  },
6748
+ useMoveToMenu(services),
6126
6749
  {
6127
6750
  type: "divider",
6128
6751
  direction: "horizontal",
6129
6752
  display: () => !utils.isPage(node.value) && !props.isMultiSelect
6130
6753
  },
6131
- {
6132
- type: "button",
6133
- text: "删除",
6134
- icon: iconsVue.Delete,
6135
- display: () => !utils.isPage(node.value),
6136
- handler: () => {
6137
- nodes.value && editorService?.remove(nodes.value);
6138
- }
6139
- },
6754
+ useDeleteMenu(),
6140
6755
  {
6141
6756
  type: "divider",
6142
6757
  direction: "horizontal"
@@ -6169,10 +6784,10 @@
6169
6784
  const data = await storageService.getItem(COPY_STORAGE_KEY);
6170
6785
  canPaste.value = data !== "undefined" && !!data;
6171
6786
  };
6172
- expose({ show });
6787
+ __expose({ show });
6173
6788
  return (_ctx, _cache) => {
6174
- return vue.openBlock(), vue.createBlock(_sfc_main$c, {
6175
- "menu-data": vue.unref(menuData),
6789
+ return vue.openBlock(), vue.createBlock(_sfc_main$e, {
6790
+ "menu-data": menuData.value,
6176
6791
  ref_key: "menu",
6177
6792
  ref: menu
6178
6793
  }, null, 8, ["menu-data"]);
@@ -6180,13 +6795,13 @@
6180
6795
  }
6181
6796
  });
6182
6797
 
6183
- const __default__$1 = vue.defineComponent({
6184
- name: "MEditorStage"
6185
- });
6186
6798
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
6187
- ...__default__$1,
6799
+ ...{
6800
+ name: "MEditorStage"
6801
+ },
6802
+ __name: "Stage",
6188
6803
  props: {
6189
- stageContentMenu: null
6804
+ stageContentMenu: {}
6190
6805
  },
6191
6806
  setup(__props) {
6192
6807
  let stage = null;
@@ -6212,6 +6827,9 @@
6212
6827
  if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
6213
6828
  return;
6214
6829
  stage = useStage(stageOptions);
6830
+ stage.on("select", () => {
6831
+ stageWrap.value?.container?.focus();
6832
+ });
6215
6833
  services?.editorService.set("stage", vue.markRaw(stage));
6216
6834
  stage?.mount(stageContainer.value);
6217
6835
  if (!node.value?.id)
@@ -6252,22 +6870,26 @@
6252
6870
  }
6253
6871
  });
6254
6872
  vue.onMounted(() => {
6255
- stageWrap.value?.container && resizeObserver.observe(stageWrap.value.container);
6873
+ if (stageWrap.value?.container) {
6874
+ resizeObserver.observe(stageWrap.value.container);
6875
+ services?.keybindingService.registeEl("stage", stageWrap.value.container);
6876
+ }
6256
6877
  });
6257
6878
  vue.onUnmounted(() => {
6258
6879
  stage?.destroy();
6259
6880
  resizeObserver.disconnect();
6260
6881
  services?.editorService.set("stage", null);
6882
+ services?.keybindingService.unregisteEl("stage");
6261
6883
  });
6262
- const contextmenuHandler = (e2) => {
6263
- e2.preventDefault();
6264
- menu.value?.show(e2);
6884
+ const contextmenuHandler = (e) => {
6885
+ e.preventDefault();
6886
+ menu.value?.show(e);
6265
6887
  };
6266
- const dragoverHandler = (e2) => {
6267
- e2.preventDefault();
6268
- if (e2.dataTransfer) {
6269
- e2.dataTransfer.dropEffect = "move";
6270
- }
6888
+ const dragoverHandler = (e) => {
6889
+ e.preventDefault();
6890
+ if (!e.dataTransfer)
6891
+ return;
6892
+ e.dataTransfer.dropEffect = "move";
6271
6893
  };
6272
6894
  const dropHandler = async (e) => {
6273
6895
  e.preventDefault();
@@ -6278,7 +6900,13 @@
6278
6900
  parent = services?.editorService.getNodeById(parentEl.id, false);
6279
6901
  }
6280
6902
  if (e.dataTransfer && parent && stageContainer.value && stage) {
6281
- const config = eval(`(${e.dataTransfer.getData("data")})`);
6903
+ const parseDSL = getConfig("parseDSL");
6904
+ const data = e.dataTransfer.getData("text/html");
6905
+ if (!data)
6906
+ return;
6907
+ const config = parseDSL(`(${data})`);
6908
+ if (!config)
6909
+ return;
6282
6910
  const layout = await services?.editorService.getLayout(parent);
6283
6911
  const containerRect = stageContainer.value.getBoundingClientRect();
6284
6912
  const { scrollTop, scrollLeft } = stage.mask;
@@ -6307,26 +6935,28 @@
6307
6935
  }
6308
6936
  };
6309
6937
  return (_ctx, _cache) => {
6310
- return vue.openBlock(), vue.createBlock(_sfc_main$4, {
6938
+ return vue.openBlock(), vue.createBlock(_sfc_main$5, {
6311
6939
  class: "m-editor-stage",
6312
6940
  ref_key: "stageWrap",
6313
6941
  ref: stageWrap,
6314
- width: vue.unref(stageRect)?.width,
6315
- height: vue.unref(stageRect)?.height,
6316
- "wrap-width": vue.unref(stageContainerRect)?.width,
6317
- "wrap-height": vue.unref(stageContainerRect)?.height,
6318
- zoom: vue.unref(zoom),
6942
+ tabindex: "-1",
6943
+ width: stageRect.value?.width,
6944
+ height: stageRect.value?.height,
6945
+ "wrap-width": stageContainerRect.value?.width,
6946
+ "wrap-height": stageContainerRect.value?.height,
6947
+ zoom: zoom.value,
6319
6948
  "correction-scroll-size": {
6320
6949
  width: 60,
6321
6950
  height: 50
6322
- }
6951
+ },
6952
+ onClick: _cache[0] || (_cache[0] = ($event) => stageWrap.value?.container?.focus())
6323
6953
  }, {
6324
6954
  default: vue.withCtx(() => [
6325
6955
  vue.createElementVNode("div", {
6326
6956
  class: "m-editor-stage-container",
6327
6957
  ref_key: "stageContainer",
6328
6958
  ref: stageContainer,
6329
- style: vue.normalizeStyle(`transform: scale(${vue.unref(zoom)});`),
6959
+ style: vue.normalizeStyle(`transform: scale(${zoom.value});`),
6330
6960
  onContextmenu: contextmenuHandler,
6331
6961
  onDrop: dropHandler,
6332
6962
  onDragover: dragoverHandler
@@ -6335,8 +6965,8 @@
6335
6965
  vue.createVNode(_sfc_main$3, {
6336
6966
  ref_key: "menu",
6337
6967
  ref: menu,
6338
- "is-multi-select": vue.unref(isMultiSelect),
6339
- "stage-content-menu": __props.stageContentMenu
6968
+ "is-multi-select": isMultiSelect.value,
6969
+ "stage-content-menu": _ctx.stageContentMenu
6340
6970
  }, null, 8, ["is-multi-select", "stage-content-menu"])
6341
6971
  ]))
6342
6972
  ]),
@@ -6346,131 +6976,29 @@
6346
6976
  }
6347
6977
  });
6348
6978
 
6349
- const __default__ = vue.defineComponent({
6350
- name: "MEditorWorkspace"
6351
- });
6979
+ const _hoisted_1 = { class: "m-editor-workspace" };
6352
6980
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
6353
- ...__default__,
6981
+ ...{
6982
+ name: "MEditorWorkspace"
6983
+ },
6984
+ __name: "Workspace",
6354
6985
  props: {
6355
- stageContentMenu: null
6986
+ stageContentMenu: {}
6356
6987
  },
6357
6988
  setup(__props) {
6358
6989
  const services = vue.inject("services");
6359
- const workspace = vue.ref();
6360
- const nodes = vue.computed(() => services?.editorService.get("nodes"));
6361
6990
  const page = vue.computed(() => services?.editorService.get("page"));
6362
- const mouseenterHandler = () => {
6363
- workspace.value?.focus();
6364
- };
6365
- const mouseleaveHandler = () => {
6366
- workspace.value?.blur();
6367
- };
6368
- let keycon;
6369
- vue.onMounted(() => {
6370
- workspace.value?.addEventListener("mouseenter", mouseenterHandler);
6371
- workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
6372
- keycon = new KeyController(workspace.value);
6373
- const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
6374
- const ctrl = isMac ? "meta" : "ctrl";
6375
- keycon.keyup("delete", (e) => {
6376
- e.inputEvent.preventDefault();
6377
- if (!nodes.value || utils.isPage(nodes.value[0]))
6378
- return;
6379
- services?.editorService.remove(nodes.value);
6380
- }).keyup("backspace", (e) => {
6381
- e.inputEvent.preventDefault();
6382
- if (!nodes.value || utils.isPage(nodes.value[0]))
6383
- return;
6384
- services?.editorService.remove(nodes.value);
6385
- }).keydown([ctrl, "c"], (e) => {
6386
- e.inputEvent.preventDefault();
6387
- nodes.value && services?.editorService.copy(nodes.value);
6388
- }).keydown([ctrl, "v"], (e) => {
6389
- e.inputEvent.preventDefault();
6390
- nodes.value && services?.editorService.paste({ offsetX: 10, offsetY: 10 });
6391
- }).keydown([ctrl, "x"], (e) => {
6392
- e.inputEvent.preventDefault();
6393
- if (!nodes.value || utils.isPage(nodes.value[0]))
6394
- return;
6395
- services?.editorService.copy(nodes.value);
6396
- services?.editorService.remove(nodes.value);
6397
- }).keydown([ctrl, "z"], (e) => {
6398
- e.inputEvent.preventDefault();
6399
- services?.editorService.undo();
6400
- }).keydown([ctrl, "shift", "z"], (e) => {
6401
- e.inputEvent.preventDefault();
6402
- services?.editorService.redo();
6403
- }).keydown("up", (e) => {
6404
- e.inputEvent.preventDefault();
6405
- services?.editorService.move(0, -1);
6406
- }).keydown("down", (e) => {
6407
- e.inputEvent.preventDefault();
6408
- services?.editorService.move(0, 1);
6409
- }).keydown("left", (e) => {
6410
- e.inputEvent.preventDefault();
6411
- services?.editorService.move(-1, 0);
6412
- }).keydown("right", (e) => {
6413
- e.inputEvent.preventDefault();
6414
- services?.editorService.move(1, 0);
6415
- }).keydown([ctrl, "up"], (e) => {
6416
- e.inputEvent.preventDefault();
6417
- services?.editorService.move(0, -10);
6418
- }).keydown([ctrl, "down"], (e) => {
6419
- e.inputEvent.preventDefault();
6420
- services?.editorService.move(0, 10);
6421
- }).keydown([ctrl, "left"], (e) => {
6422
- e.inputEvent.preventDefault();
6423
- services?.editorService.move(-10, 0);
6424
- }).keydown([ctrl, "right"], (e) => {
6425
- e.inputEvent.preventDefault();
6426
- services?.editorService.move(10, 0);
6427
- }).keydown("tab", (e) => {
6428
- e.inputEvent.preventDefault();
6429
- services?.editorService.selectNextNode();
6430
- }).keydown([ctrl, "tab"], (e) => {
6431
- e.inputEvent.preventDefault();
6432
- services?.editorService.selectNextPage();
6433
- }).keydown([ctrl, "="], (e) => {
6434
- e.inputEvent.preventDefault();
6435
- services?.uiService.zoom(0.1);
6436
- }).keydown([ctrl, "numpadplus"], (e) => {
6437
- e.inputEvent.preventDefault();
6438
- services?.uiService.zoom(0.1);
6439
- }).keydown([ctrl, "-"], (e) => {
6440
- e.inputEvent.preventDefault();
6441
- services?.uiService.zoom(-0.1);
6442
- }).keydown([ctrl, "numpad-"], (e) => {
6443
- e.inputEvent.preventDefault();
6444
- services?.uiService.zoom(-0.1);
6445
- }).keydown([ctrl, "0"], async (e) => {
6446
- e.inputEvent.preventDefault();
6447
- services?.uiService.set("zoom", await services.uiService.calcZoom());
6448
- }).keydown([ctrl, "1"], (e) => {
6449
- e.inputEvent.preventDefault();
6450
- services?.uiService.set("zoom", 1);
6451
- });
6452
- });
6453
- vue.onUnmounted(() => {
6454
- workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
6455
- workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
6456
- keycon.destroy();
6457
- });
6458
6991
  return (_ctx, _cache) => {
6459
- return vue.openBlock(), vue.createElementBlock("div", {
6460
- class: "m-editor-workspace",
6461
- tabindex: "-1",
6462
- ref_key: "workspace",
6463
- ref: workspace
6464
- }, [
6465
- vue.createVNode(_sfc_main$8),
6992
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
6993
+ vue.createVNode(_sfc_main$9),
6466
6994
  vue.renderSlot(_ctx.$slots, "stage", {}, () => [
6467
- vue.unref(page) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
6995
+ page.value ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
6468
6996
  key: 0,
6469
- "stage-content-menu": __props.stageContentMenu
6997
+ "stage-content-menu": _ctx.stageContentMenu
6470
6998
  }, null, 8, ["stage-content-menu"])) : vue.createCommentVNode("", true)
6471
6999
  ]),
6472
7000
  vue.renderSlot(_ctx.$slots, "workspace-content"),
6473
- vue.createVNode(_sfc_main$6, null, {
7001
+ vue.createVNode(_sfc_main$7, null, {
6474
7002
  "page-bar-title": vue.withCtx(({ page: page2 }) => [
6475
7003
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
6476
7004
  ]),
@@ -6479,7 +7007,7 @@
6479
7007
  ]),
6480
7008
  _: 3
6481
7009
  })
6482
- ], 512);
7010
+ ]);
6483
7011
  };
6484
7012
  }
6485
7013
  });
@@ -6508,8 +7036,8 @@
6508
7036
  * @param {CodeBlockDSL} codeDsl 代码DSL
6509
7037
  * @returns {void}
6510
7038
  */
6511
- async setCodeDsl(codeDsl2) {
6512
- this.state.codeDsl = codeDsl2;
7039
+ async setCodeDsl(codeDsl) {
7040
+ this.state.codeDsl = codeDsl;
6513
7041
  this.emit("code-dsl-change", this.state.codeDsl);
6514
7042
  }
6515
7043
  /**
@@ -6526,13 +7054,13 @@
6526
7054
  * @param {Id} id 代码块id
6527
7055
  * @returns {CodeBlockContent | null}
6528
7056
  */
6529
- getCodeContentById(id2) {
6530
- if (!id2)
7057
+ getCodeContentById(id) {
7058
+ if (!id)
6531
7059
  return null;
6532
7060
  const totalCodeDsl = this.getCodeDsl();
6533
7061
  if (!totalCodeDsl)
6534
7062
  return null;
6535
- return totalCodeDsl[id2] ?? null;
7063
+ return totalCodeDsl[id] ?? null;
6536
7064
  }
6537
7065
  /**
6538
7066
  * 设置代码块ID和代码内容到源dsl
@@ -6547,7 +7075,8 @@
6547
7075
  }
6548
7076
  const codeConfigProcessed = codeConfig;
6549
7077
  if (codeConfig.content) {
6550
- codeConfigProcessed.content = eval(codeConfig.content);
7078
+ const parseDSL = getConfig("parseDSL");
7079
+ codeConfigProcessed.content = parseDSL(codeConfig.content);
6551
7080
  }
6552
7081
  const existContent = codeDsl[id] || {};
6553
7082
  codeDsl[id] = {
@@ -6562,8 +7091,8 @@
6562
7091
  * @returns {CodeBlockDSL}
6563
7092
  */
6564
7093
  getCodeDslByIds(ids) {
6565
- const codeDsl2 = this.getCodeDsl();
6566
- return lodashEs.pick(codeDsl2, ids);
7094
+ const codeDsl = this.getCodeDsl();
7095
+ return lodashEs.pick(codeDsl, ids);
6567
7096
  }
6568
7097
  /**
6569
7098
  * 设置代码编辑面板展示状态
@@ -6586,10 +7115,10 @@
6586
7115
  * @param {Id} id 代码块id
6587
7116
  * @returns {void}
6588
7117
  */
6589
- setCodeEditorContent(status, id2) {
6590
- if (!id2)
7118
+ setCodeEditorContent(status, id) {
7119
+ if (!id)
6591
7120
  return;
6592
- this.setId(id2);
7121
+ this.setId(id);
6593
7122
  this.state.isShowCodeEditor = status;
6594
7123
  }
6595
7124
  /**
@@ -6619,10 +7148,10 @@
6619
7148
  * @param {Id} id 代码块id
6620
7149
  * @returns {void}
6621
7150
  */
6622
- setId(id2) {
6623
- if (!id2)
7151
+ setId(id) {
7152
+ if (!id)
6624
7153
  return;
6625
- this.state.id = id2;
7154
+ this.state.id = id;
6626
7155
  }
6627
7156
  /**
6628
7157
  * 获取当前选中的代码块ID
@@ -6687,9 +7216,9 @@
6687
7216
  const currentDsl = await this.getCodeDsl();
6688
7217
  if (!currentDsl)
6689
7218
  return;
6690
- codeIds.forEach((id2) => {
6691
- delete currentDsl[id2];
6692
- this.emit("remove", id2);
7219
+ codeIds.forEach((id) => {
7220
+ delete currentDsl[id];
7221
+ this.emit("remove", id);
6693
7222
  });
6694
7223
  }
6695
7224
  /**
@@ -7098,6 +7627,7 @@
7098
7627
  });
7099
7628
  });
7100
7629
  });
7630
+ this.emit("collected", nodes, deep);
7101
7631
  }
7102
7632
  /**
7103
7633
  * 清除依赖
@@ -7126,6 +7656,7 @@
7126
7656
  const fullKey = prop ? `${prop}.${key}` : key;
7127
7657
  if (target.isTarget(key, value)) {
7128
7658
  target.updateDep(node, fullKey);
7659
+ this.emit("update-dep", node, fullKey);
7129
7660
  } else if (!keyIsItems && Array.isArray(value)) {
7130
7661
  value.forEach((item, index) => {
7131
7662
  collectTarget(item, `${fullKey}.${index}`);
@@ -7201,6 +7732,275 @@
7201
7732
  }
7202
7733
  const eventsService = new Events();
7203
7734
 
7735
+ class Keybinding extends BaseService {
7736
+ ctrlKey = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "meta" : "ctrl";
7737
+ controllers = /* @__PURE__ */ new Map();
7738
+ bindingList = [];
7739
+ commands = {
7740
+ [KeyBindingCommand.DELETE_NODE]: () => {
7741
+ const nodes = editorService.get("nodes");
7742
+ if (!nodes || utils.isPage(nodes[0]))
7743
+ return;
7744
+ editorService.remove(nodes);
7745
+ },
7746
+ [KeyBindingCommand.COPY_NODE]: () => {
7747
+ const nodes = editorService.get("nodes");
7748
+ nodes && editorService.copy(nodes);
7749
+ },
7750
+ [KeyBindingCommand.CUT_NODE]: () => {
7751
+ const nodes = editorService.get("nodes");
7752
+ if (!nodes || utils.isPage(nodes[0]))
7753
+ return;
7754
+ editorService.copy(nodes);
7755
+ editorService.remove(nodes);
7756
+ },
7757
+ [KeyBindingCommand.PASTE_NODE]: () => {
7758
+ const nodes = editorService.get("nodes");
7759
+ nodes && editorService.paste({ offsetX: 10, offsetY: 10 });
7760
+ },
7761
+ [KeyBindingCommand.UNDO]: () => {
7762
+ editorService.undo();
7763
+ },
7764
+ [KeyBindingCommand.REDO]: () => {
7765
+ editorService.redo();
7766
+ },
7767
+ [KeyBindingCommand.ZOOM_IN]: () => {
7768
+ uiService.zoom(0.1);
7769
+ },
7770
+ [KeyBindingCommand.ZOOM_OUT]: () => {
7771
+ uiService.zoom(-0.1);
7772
+ },
7773
+ [KeyBindingCommand.ZOOM_RESET]: () => {
7774
+ uiService.set("zoom", 1);
7775
+ },
7776
+ [KeyBindingCommand.ZOOM_FIT]: async () => {
7777
+ uiService.set("zoom", await uiService.calcZoom());
7778
+ },
7779
+ [KeyBindingCommand.MOVE_UP_1]: () => {
7780
+ editorService.move(0, -1);
7781
+ },
7782
+ [KeyBindingCommand.MOVE_DOWN_1]: () => {
7783
+ editorService.move(0, 1);
7784
+ },
7785
+ [KeyBindingCommand.MOVE_LEFT_1]: () => {
7786
+ editorService.move(-1, 0);
7787
+ },
7788
+ [KeyBindingCommand.MOVE_RIGHT_1]: () => {
7789
+ editorService.move(1, 0);
7790
+ },
7791
+ [KeyBindingCommand.MOVE_UP_10]: () => {
7792
+ editorService.move(0, -10);
7793
+ },
7794
+ [KeyBindingCommand.MOVE_DOWN_10]: () => {
7795
+ editorService.move(0, 10);
7796
+ },
7797
+ [KeyBindingCommand.MOVE_LEFT_10]: () => {
7798
+ editorService.move(-10, 0);
7799
+ },
7800
+ [KeyBindingCommand.MOVE_RIGHT_10]: () => {
7801
+ editorService.move(10, 0);
7802
+ },
7803
+ [KeyBindingCommand.SWITCH_NODE]: () => {
7804
+ editorService.selectNextNode();
7805
+ }
7806
+ };
7807
+ registeCommand(command, handler) {
7808
+ this.commands[command] = handler;
7809
+ }
7810
+ unregisteCommand(command) {
7811
+ delete this.commands[command];
7812
+ }
7813
+ registeEl(name, el) {
7814
+ if (name !== "global" && !el) {
7815
+ throw new Error("只有name为global可以不传el");
7816
+ }
7817
+ const keycon = new KeyController(el);
7818
+ this.controllers.set(name, keycon);
7819
+ this.bind(name);
7820
+ }
7821
+ unregisteEl(name) {
7822
+ this.controllers.get(name)?.destroy();
7823
+ this.controllers.delete(name);
7824
+ this.bindingList.forEach((item) => {
7825
+ item.binded = false;
7826
+ });
7827
+ }
7828
+ registe(maps) {
7829
+ for (const keybindingItem of maps) {
7830
+ const { command, keybinding, when } = keybindingItem;
7831
+ for (const [type = "", eventType = "keydown"] of when) {
7832
+ const cacheItem = { type, command, keybinding, eventType, binded: false };
7833
+ this.bindingList.push(cacheItem);
7834
+ }
7835
+ }
7836
+ this.bind();
7837
+ }
7838
+ reset() {
7839
+ this.controllers.forEach((keycon) => {
7840
+ keycon.destroy();
7841
+ });
7842
+ this.controllers.clear();
7843
+ this.bindingList = [];
7844
+ }
7845
+ destroy() {
7846
+ this.reset();
7847
+ }
7848
+ bind(name) {
7849
+ for (const item of this.bindingList) {
7850
+ const { type, eventType, command, keybinding, binded } = item;
7851
+ if (name && name !== type) {
7852
+ continue;
7853
+ }
7854
+ if (binded) {
7855
+ continue;
7856
+ }
7857
+ const keycon = this.controllers.get(type);
7858
+ if (!keycon) {
7859
+ continue;
7860
+ }
7861
+ const handler = (e) => {
7862
+ e.inputEvent.preventDefault();
7863
+ this.commands[command]?.(e.inputEvent);
7864
+ };
7865
+ this.getKeyconKeys(keybinding).forEach((keys) => {
7866
+ if (keys[0]) {
7867
+ keycon[eventType](keys, handler);
7868
+ } else {
7869
+ keycon[eventType](handler);
7870
+ }
7871
+ });
7872
+ item.binded = true;
7873
+ }
7874
+ }
7875
+ getKeyconKeys(keybinding = "") {
7876
+ const splitKey = (key) => key.split("+").map((k) => k === "ctrl" ? this.ctrlKey : k);
7877
+ if (Array.isArray(keybinding)) {
7878
+ return keybinding.map((key) => splitKey(key));
7879
+ }
7880
+ return [splitKey(keybinding)];
7881
+ }
7882
+ }
7883
+ const keybindingService = new Keybinding();
7884
+
7885
+ const keybindingConfig = [
7886
+ {
7887
+ command: KeyBindingCommand.DELETE_NODE,
7888
+ keybinding: ["delete", "backspace"],
7889
+ when: [
7890
+ ["stage", "keyup"],
7891
+ ["layer-panel", "keydown"]
7892
+ ]
7893
+ },
7894
+ {
7895
+ command: KeyBindingCommand.COPY_NODE,
7896
+ keybinding: "ctrl+c",
7897
+ when: [
7898
+ ["stage", "keydown"],
7899
+ ["layer-panel", "keydown"]
7900
+ ]
7901
+ },
7902
+ {
7903
+ command: KeyBindingCommand.PASTE_NODE,
7904
+ keybinding: "ctrl+v",
7905
+ when: [
7906
+ ["stage", "keydown"],
7907
+ ["layer-panel", "keydown"]
7908
+ ]
7909
+ },
7910
+ {
7911
+ command: KeyBindingCommand.CUT_NODE,
7912
+ keybinding: "ctrl+x",
7913
+ when: [
7914
+ ["stage", "keydown"],
7915
+ ["layer-panel", "keydown"]
7916
+ ]
7917
+ },
7918
+ {
7919
+ command: KeyBindingCommand.UNDO,
7920
+ keybinding: "ctrl+z",
7921
+ when: [
7922
+ ["stage", "keydown"],
7923
+ ["layer-panel", "keydown"]
7924
+ ]
7925
+ },
7926
+ {
7927
+ command: KeyBindingCommand.REDO,
7928
+ keybinding: "ctrl+shift+z",
7929
+ when: [
7930
+ ["stage", "keydown"],
7931
+ ["layer-panel", "keydown"]
7932
+ ]
7933
+ },
7934
+ {
7935
+ command: KeyBindingCommand.MOVE_UP_1,
7936
+ keybinding: "up",
7937
+ when: [["stage", "keydown"]]
7938
+ },
7939
+ {
7940
+ command: KeyBindingCommand.MOVE_DOWN_1,
7941
+ keybinding: "down",
7942
+ when: [["stage", "keydown"]]
7943
+ },
7944
+ {
7945
+ command: KeyBindingCommand.MOVE_LEFT_1,
7946
+ keybinding: "left",
7947
+ when: [["stage", "keydown"]]
7948
+ },
7949
+ {
7950
+ command: KeyBindingCommand.MOVE_RIGHT_1,
7951
+ keybinding: "right",
7952
+ when: [["stage", "keydown"]]
7953
+ },
7954
+ {
7955
+ command: KeyBindingCommand.MOVE_UP_10,
7956
+ keybinding: "ctrl+up",
7957
+ when: [["stage", "keydown"]]
7958
+ },
7959
+ {
7960
+ command: KeyBindingCommand.MOVE_DOWN_10,
7961
+ keybinding: "ctrl+down",
7962
+ when: [["stage", "keydown"]]
7963
+ },
7964
+ {
7965
+ command: KeyBindingCommand.MOVE_LEFT_10,
7966
+ keybinding: "ctrl+left",
7967
+ when: [["stage", "keydown"]]
7968
+ },
7969
+ {
7970
+ command: KeyBindingCommand.MOVE_RIGHT_10,
7971
+ keybinding: "ctrl+right",
7972
+ when: [["stage", "keydown"]]
7973
+ },
7974
+ {
7975
+ command: KeyBindingCommand.SWITCH_NODE,
7976
+ keybinding: "tab",
7977
+ when: [
7978
+ ["stage", "keydown"],
7979
+ ["layer-panel", "keydown"]
7980
+ ]
7981
+ },
7982
+ {
7983
+ command: KeyBindingCommand.ZOOM_IN,
7984
+ keybinding: ["ctrl+=", "ctrl+numpadplus"],
7985
+ when: [["stage", "keydown"]]
7986
+ },
7987
+ {
7988
+ command: KeyBindingCommand.ZOOM_OUT,
7989
+ keybinding: ["ctrl+-", "ctrl+numpad-"],
7990
+ when: [["stage", "keydown"]]
7991
+ },
7992
+ {
7993
+ command: KeyBindingCommand.ZOOM_FIT,
7994
+ keybinding: "ctrl+0",
7995
+ when: [["stage", "keydown"]]
7996
+ },
7997
+ {
7998
+ command: KeyBindingCommand.ZOOM_RESET,
7999
+ keybinding: "ctrl+1",
8000
+ when: [["stage", "keydown"]]
8001
+ }
8002
+ ];
8003
+
7204
8004
  const editorProps = {
7205
8005
  /** 页面初始值 */
7206
8006
  modelValue: {
@@ -7299,6 +8099,9 @@
7299
8099
  },
7300
8100
  disabledDragStart: {
7301
8101
  type: Boolean
8102
+ },
8103
+ extendFormState: {
8104
+ type: Function
7302
8105
  }
7303
8106
  };
7304
8107
 
@@ -7307,6 +8110,9 @@
7307
8110
  id,
7308
8111
  name: codeBlock.name,
7309
8112
  isTarget: (key, value) => {
8113
+ if (id === value) {
8114
+ return true;
8115
+ }
7310
8116
  if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
7311
8117
  const index = value.hookData.findIndex((item) => item.codeId === id);
7312
8118
  return Boolean(index > -1);
@@ -7318,7 +8124,10 @@
7318
8124
  type: "data-source",
7319
8125
  id,
7320
8126
  name: ds.title || `${id}`,
7321
- isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
8127
+ isTarget: (key, value) => (
8128
+ // 关联数据源对象或者在模板在使用数据源
8129
+ value.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
8130
+ )
7322
8131
  });
7323
8132
 
7324
8133
  const initServiceState = (props, {
@@ -7328,7 +8137,8 @@
7328
8137
  propsService,
7329
8138
  eventsService,
7330
8139
  uiService,
7331
- codeBlockService
8140
+ codeBlockService,
8141
+ keybindingService
7332
8142
  }) => {
7333
8143
  vue.watch(
7334
8144
  () => props.modelValue,
@@ -7397,9 +8207,46 @@
7397
8207
  uiService.resetState();
7398
8208
  componentListService.resetState();
7399
8209
  codeBlockService.resetState();
8210
+ keybindingService.reset();
7400
8211
  });
7401
8212
  };
7402
8213
  const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
8214
+ const getApp = () => {
8215
+ const stage = editorService.get("stage");
8216
+ return stage?.renderer.runtime?.getApp?.();
8217
+ };
8218
+ const updateDataSoucreSchema = () => {
8219
+ const root = editorService.get("root");
8220
+ if (root?.dataSources) {
8221
+ getApp()?.dataSourceManager?.updateSchema(root.dataSources);
8222
+ }
8223
+ };
8224
+ const upateNodeWhenDataSourceChange = (nodes) => {
8225
+ const root = editorService.get("root");
8226
+ const stage = editorService.get("stage");
8227
+ if (!root || !stage)
8228
+ return;
8229
+ const app = getApp();
8230
+ if (!app)
8231
+ return;
8232
+ if (app.dsl) {
8233
+ app.dsl.dataSourceDeps = root.dataSourceDeps;
8234
+ app.dsl.dataSources = root.dataSources;
8235
+ }
8236
+ updateDataSoucreSchema();
8237
+ nodes.forEach((node) => {
8238
+ const deps = Object.values(root.dataSourceDeps || {});
8239
+ deps.forEach((dep) => {
8240
+ if (dep[node.id]) {
8241
+ stage.update({
8242
+ config: lodashEs.cloneDeep(node),
8243
+ parentId: editorService.getParentById(node.id)?.id,
8244
+ root: lodashEs.cloneDeep(root)
8245
+ });
8246
+ }
8247
+ });
8248
+ });
8249
+ };
7403
8250
  const targetAddHandler = (target) => {
7404
8251
  if (target.type !== "data-source")
7405
8252
  return;
@@ -7417,8 +8264,16 @@
7417
8264
  return;
7418
8265
  delete root.dataSourceDeps[id];
7419
8266
  };
8267
+ const depUpdateHandler = (node) => {
8268
+ upateNodeWhenDataSourceChange([node]);
8269
+ };
8270
+ const collectedHandler = (nodes) => {
8271
+ upateNodeWhenDataSourceChange(nodes);
8272
+ };
7420
8273
  depService.on("add-target", targetAddHandler);
7421
8274
  depService.on("remove-target", targetRemoveHandler);
8275
+ depService.on("dep-update", depUpdateHandler);
8276
+ depService.on("collected", collectedHandler);
7422
8277
  const rootChangeHandler = async (value, preValue) => {
7423
8278
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
7424
8279
  let node;
@@ -7486,14 +8341,20 @@
7486
8341
  codeBlockService.on("remove", codeBlockRemoveHandler);
7487
8342
  const dataSourceAddHandler = (config) => {
7488
8343
  depService.addTarget(createDataSourceTarget(config.id, config));
8344
+ getApp()?.dataSourceManager?.addDataSource(config);
7489
8345
  };
7490
8346
  const dataSourceUpdateHandler = (config) => {
7491
8347
  if (config.title) {
7492
8348
  depService.getTarget(config.id).name = config.title;
7493
8349
  }
8350
+ const root = editorService.get("root");
8351
+ const targets = depService.getTargets("data-source");
8352
+ const nodes = utils.getNodes(Object.keys(targets[config.id].deps), root?.items);
8353
+ upateNodeWhenDataSourceChange(nodes);
7494
8354
  };
7495
8355
  const dataSourceRemoveHandler = (id) => {
7496
8356
  depService.removeTarget(id);
8357
+ getApp()?.dataSourceManager?.removeDataSource(id);
7497
8358
  };
7498
8359
  dataSourceService.on("add", dataSourceAddHandler);
7499
8360
  dataSourceService.on("update", dataSourceUpdateHandler);
@@ -7501,6 +8362,8 @@
7501
8362
  vue.onUnmounted(() => {
7502
8363
  depService.off("add-target", targetAddHandler);
7503
8364
  depService.off("remove-target", targetRemoveHandler);
8365
+ depService.off("dep-update", depUpdateHandler);
8366
+ depService.off("collected", collectedHandler);
7504
8367
  editorService.off("history-change", historyChangeHandler);
7505
8368
  editorService.off("root-change", rootChangeHandler);
7506
8369
  editorService.off("add", nodeAddHandler);
@@ -7515,13 +8378,13 @@
7515
8378
  };
7516
8379
 
7517
8380
  const _sfc_main = vue.defineComponent({
7518
- name: "m-editor",
8381
+ name: "MEditor",
7519
8382
  components: {
7520
- TMagicNavMenu: _sfc_main$o,
7521
- Sidebar: _sfc_main$9,
8383
+ TMagicNavMenu: _sfc_main$q,
8384
+ Sidebar: _sfc_main$a,
7522
8385
  Workspace: _sfc_main$1,
7523
- PropsPanel: _sfc_main$n,
7524
- Framework: _sfc_main$q
8386
+ PropsPanel: _sfc_main$p,
8387
+ Framework: _sfc_main$s
7525
8388
  },
7526
8389
  props: editorProps,
7527
8390
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -7536,10 +8399,13 @@
7536
8399
  storageService,
7537
8400
  codeBlockService,
7538
8401
  depService,
7539
- dataSourceService
8402
+ dataSourceService,
8403
+ keybindingService
7540
8404
  };
7541
8405
  initServiceEvents(props, emit, services);
7542
8406
  initServiceState(props, services);
8407
+ keybindingService.registe(keybindingConfig);
8408
+ keybindingService.registeEl("global");
7543
8409
  vue.provide("services", services);
7544
8410
  vue.provide("codeOptions", props.codeOptions);
7545
8411
  vue.provide(
@@ -7562,18 +8428,35 @@
7562
8428
  }
7563
8429
  });
7564
8430
 
8431
+ const _export_sfc = (sfc, props) => {
8432
+ const target = sfc.__vccOpts || sfc;
8433
+ for (const [key, val] of props) {
8434
+ target[key] = val;
8435
+ }
8436
+ return target;
8437
+ };
8438
+
7565
8439
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7566
8440
  const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
7567
8441
  const _component_Sidebar = vue.resolveComponent("Sidebar");
7568
8442
  const _component_Workspace = vue.resolveComponent("Workspace");
7569
8443
  const _component_PropsPanel = vue.resolveComponent("PropsPanel");
7570
8444
  const _component_Framework = vue.resolveComponent("Framework");
7571
- return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
8445
+ return vue.openBlock(), vue.createBlock(_component_Framework, null, {
8446
+ header: vue.withCtx(() => [
8447
+ vue.renderSlot(_ctx.$slots, "header")
8448
+ ]),
7572
8449
  nav: vue.withCtx(() => [
7573
8450
  vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
7574
8451
  vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
7575
8452
  ])
7576
8453
  ]),
8454
+ "content-before": vue.withCtx(() => [
8455
+ vue.renderSlot(_ctx.$slots, "content-before")
8456
+ ]),
8457
+ "src-code": vue.withCtx(() => [
8458
+ vue.renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
8459
+ ]),
7577
8460
  sidebar: vue.withCtx(() => [
7578
8461
  vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
7579
8462
  vue.createVNode(_component_Sidebar, {
@@ -7633,27 +8516,35 @@
7633
8516
  "props-panel": vue.withCtx(() => [
7634
8517
  vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
7635
8518
  vue.createVNode(_component_PropsPanel, {
8519
+ "extend-state": _ctx.extendFormState,
7636
8520
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
7637
8521
  }, {
7638
8522
  "props-panel-header": vue.withCtx(() => [
7639
8523
  vue.renderSlot(_ctx.$slots, "props-panel-header")
7640
8524
  ]),
7641
8525
  _: 3
7642
- })
8526
+ }, 8, ["extend-state"])
7643
8527
  ])
7644
8528
  ]),
7645
8529
  empty: vue.withCtx(() => [
7646
8530
  vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
7647
8531
  ]),
8532
+ "content-after": vue.withCtx(() => [
8533
+ vue.renderSlot(_ctx.$slots, "content-after")
8534
+ ]),
8535
+ footer: vue.withCtx(() => [
8536
+ vue.renderSlot(_ctx.$slots, "footer")
8537
+ ]),
7648
8538
  _: 3
7649
- }, 8, ["code-options"]);
8539
+ });
7650
8540
  }
7651
8541
  const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
7652
8542
 
7653
8543
  const index$1 = '';
7654
8544
 
7655
8545
  const defaultInstallOpt = {
7656
- // @todo, 自定义图片上传方法等编辑器依赖的外部选项
8546
+ // eslint-disable-next-line no-eval
8547
+ parseDSL: (dsl) => eval(dsl)
7657
8548
  };
7658
8549
  const index = {
7659
8550
  install: (app, opt) => {
@@ -7661,46 +8552,54 @@
7661
8552
  app.config.globalProperties.$TMAGIC_EDITOR = option;
7662
8553
  setConfig(option);
7663
8554
  app.component(Editor.name, Editor);
7664
- app.component("m-fields-ui-select", _sfc_main$v);
7665
- app.component("m-fields-code-link", _sfc_main$C);
7666
- app.component("m-fields-vs-code", _sfc_main$D);
7667
- app.component("magic-code-editor", _sfc_main$u);
7668
- app.component("m-fields-code-select", _sfc_main$B);
7669
- app.component("m-fields-code-select-col", _sfc_main$z);
7670
- app.component("m-fields-event-select", _sfc_main$x);
7671
- app.component("m-fields-data-source-fields", _sfc_main$y);
7672
- app.component("m-fields-key-value", _sfc_main$w);
8555
+ app.component("m-fields-ui-select", _sfc_main$x);
8556
+ app.component("m-fields-code-link", _sfc_main$G);
8557
+ app.component("m-fields-vs-code", _sfc_main$H);
8558
+ app.component("magic-code-editor", _sfc_main$w);
8559
+ app.component("m-fields-code-select", _sfc_main$F);
8560
+ app.component("m-fields-code-select-col", _sfc_main$D);
8561
+ app.component("m-fields-event-select", _sfc_main$z);
8562
+ app.component("m-fields-data-source-fields", _sfc_main$C);
8563
+ app.component("m-fields-key-value", _sfc_main$y);
8564
+ app.component("m-fields-data-source-input", _sfc_main$B);
8565
+ app.component("m-fields-data-source-select", _sfc_main$A);
7673
8566
  }
7674
8567
  };
7675
8568
 
7676
8569
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
7677
8570
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
7678
- exports.CodeBlockList = _sfc_main$g;
8571
+ exports.CodeBlockList = _sfc_main$i;
7679
8572
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
7680
- exports.CodeSelect = _sfc_main$B;
7681
- exports.CodeSelectCol = _sfc_main$z;
8573
+ exports.CodeSelect = _sfc_main$F;
8574
+ exports.CodeSelectCol = _sfc_main$D;
7682
8575
  exports.ColumnLayout = ColumnLayout;
7683
- exports.ComponentListPanel = _sfc_main$d;
7684
- exports.ContentMenu = _sfc_main$c;
7685
- exports.DataSourceFields = _sfc_main$y;
7686
- exports.EventSelect = _sfc_main$x;
8576
+ exports.ComponentListPanel = _sfc_main$f;
8577
+ exports.ContentMenu = _sfc_main$e;
8578
+ exports.DataSourceFields = _sfc_main$C;
8579
+ exports.DataSourceInput = _sfc_main$B;
8580
+ exports.DataSourceSelect = _sfc_main$A;
8581
+ exports.EventSelect = _sfc_main$z;
7687
8582
  exports.Fixed2Other = Fixed2Other;
7688
8583
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
7689
- exports.Icon = _sfc_main$A;
7690
- exports.KeyValue = _sfc_main$w;
8584
+ exports.Icon = _sfc_main$E;
8585
+ exports.KeyBindingCommand = KeyBindingCommand;
8586
+ exports.KeyValue = _sfc_main$y;
7691
8587
  exports.Keys = Keys;
7692
8588
  exports.LayerOffset = LayerOffset;
7693
- exports.LayerPanel = _sfc_main$a;
8589
+ exports.LayerPanel = _sfc_main$b;
7694
8590
  exports.Layout = Layout;
7695
- exports.LayoutContainer = _sfc_main$s;
7696
- exports.PropsPanel = _sfc_main$n;
7697
- exports.TMagicCodeEditor = _sfc_main$u;
8591
+ exports.LayoutContainer = _sfc_main$u;
8592
+ exports.PropsPanel = _sfc_main$p;
8593
+ exports.Resizer = _sfc_main$v;
8594
+ exports.SplitView = _sfc_main$u;
8595
+ exports.TMagicCodeEditor = _sfc_main$w;
7698
8596
  exports.TMagicEditor = Editor;
7699
- exports.ToolButton = _sfc_main$p;
8597
+ exports.ToolButton = _sfc_main$r;
7700
8598
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
7701
8599
  exports.beforePaste = beforePaste;
7702
8600
  exports.change2Fixed = change2Fixed;
7703
8601
  exports.codeBlockService = codeBlockService;
8602
+ exports.dataSourceService = dataSourceService;
7704
8603
  exports.debug = debug;
7705
8604
  exports.default = index;
7706
8605
  exports.depService = depService;