@tmagic/editor 1.3.0-beta.5 → 1.3.0-beta.7

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 (40) hide show
  1. package/dist/style.css +57 -56
  2. package/dist/tmagic-editor.js +607 -428
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +626 -446
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +11 -10
  7. package/src/Editor.vue +8 -0
  8. package/src/components/Tree.vue +66 -0
  9. package/src/components/TreeNode.vue +142 -0
  10. package/src/fields/KeyValue.vue +1 -0
  11. package/src/layouts/CodeEditor.vue +1 -0
  12. package/src/layouts/sidebar/Sidebar.vue +13 -0
  13. package/src/layouts/sidebar/data-source/DataSourceList.vue +4 -2
  14. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +8 -2
  15. package/src/layouts/sidebar/layer/LayerPanel.vue +40 -31
  16. package/src/layouts/sidebar/layer/use-click.ts +105 -0
  17. package/src/layouts/sidebar/layer/use-drag.ts +1 -1
  18. package/src/layouts/sidebar/layer/use-filter.ts +1 -12
  19. package/src/layouts/sidebar/layer/use-keybinding.ts +6 -2
  20. package/src/layouts/sidebar/layer/use-node-status.ts +4 -2
  21. package/src/services/dataSource.ts +2 -2
  22. package/src/theme/layer-panel.scss +2 -74
  23. package/src/theme/theme.scss +1 -0
  24. package/src/theme/tree.scss +72 -0
  25. package/src/type.ts +16 -1
  26. package/src/utils/data-source/index.ts +117 -34
  27. package/src/utils/tree.ts +15 -0
  28. package/types/{layouts/sidebar/layer/LayerNode.vue.d.ts → components/Tree.vue.d.ts} +19 -17
  29. package/types/components/TreeNode.vue.d.ts +47 -0
  30. package/types/layouts/CodeEditor.vue.d.ts +4 -1
  31. package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +2 -6
  32. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +7 -1
  33. package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +1 -1
  34. package/types/layouts/sidebar/layer/use-click.d.ts +106 -0
  35. package/types/layouts/sidebar/layer/use-filter.d.ts +0 -1
  36. package/types/layouts/sidebar/layer/use-keybinding.d.ts +2 -1
  37. package/types/type.d.ts +20 -1
  38. package/types/utils/data-source/index.d.ts +1 -0
  39. package/types/utils/tree.d.ts +3 -0
  40. package/src/layouts/sidebar/layer/LayerNode.vue +0 -208
@@ -1,5 +1,5 @@
1
- import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, Transition, provide, toHandlers, mergeDefaults } from 'vue';
2
- import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, CopyDocument, DocumentCopy, Files, Hide, ArrowRight, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
1
+ import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, provide, Transition, toHandlers, mergeDefaults } from 'vue';
2
+ import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, ArrowRight, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
3
3
  import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, pick, keys } from 'lodash-es';
4
4
  import * as monaco from 'monaco-editor';
5
5
  import serialize from 'serialize-javascript';
@@ -7,7 +7,7 @@ import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagi
7
7
  import { HookType, NodeType, ActionType } from '@tmagic/schema';
8
8
  import { MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
9
9
  import { MagicTable } from '@tmagic/table';
10
- import { guid, isPop, getNodePath, isNumber, isPage, toLine, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getDefaultValueFromFields, addClassName, removeClassName, getKeys, removeClassNameByClassName, getNodes, isObject as isObject$1 } from '@tmagic/utils';
10
+ import { guid, isPop, getNodePath, isNumber, isPage, toLine, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getDefaultValueFromFields, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes, isObject as isObject$1 } from '@tmagic/utils';
11
11
  import Gesto from 'gesto';
12
12
  import StageCore, { GuidesType, StageDragStatus, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
13
13
  import { EventEmitter } from 'events';
@@ -20,16 +20,16 @@ const setConfig = (option) => {
20
20
  };
21
21
  const getConfig = (key) => $TMAGIC_EDITOR[key];
22
22
 
23
- const _hoisted_1$w = {
23
+ const _hoisted_1$x = {
24
24
  class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
25
25
  };
26
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
26
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
27
27
  ...{
28
28
  name: "MEditorCodeEditor"
29
29
  },
30
30
  __name: "CodeEditor",
31
31
  props: {
32
- initValues: {},
32
+ initValues: { default: "" },
33
33
  modifiedValues: {},
34
34
  type: {},
35
35
  language: { default: "javascript" },
@@ -180,7 +180,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
180
180
  }
181
181
  });
182
182
  return (_ctx, _cache) => {
183
- return openBlock(), createElementBlock("div", _hoisted_1$w, [
183
+ return openBlock(), createElementBlock("div", _hoisted_1$x, [
184
184
  (openBlock(), createBlock(Teleport, {
185
185
  to: "body",
186
186
  disabled: !fullScreen.value
@@ -208,7 +208,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
208
208
  }
209
209
  });
210
210
 
211
- const _sfc_main$R = /* @__PURE__ */ defineComponent({
211
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
212
212
  ...{
213
213
  name: "MEditorCode"
214
214
  },
@@ -232,7 +232,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
232
232
  emit("change", v);
233
233
  };
234
234
  return (_ctx, _cache) => {
235
- return openBlock(), createBlock(_sfc_main$S, {
235
+ return openBlock(), createBlock(_sfc_main$T, {
236
236
  height: _ctx.config.height,
237
237
  "init-values": _ctx.model[_ctx.name],
238
238
  language: _ctx.config.language,
@@ -247,7 +247,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
247
247
  }
248
248
  });
249
249
 
250
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
250
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
251
251
  ...{
252
252
  name: "MEditorCodeLink"
253
253
  },
@@ -326,7 +326,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
326
326
  }
327
327
  });
328
328
 
329
- const _sfc_main$P = /* @__PURE__ */ defineComponent({
329
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
330
330
  ...{
331
331
  name: "MEditorCodeSelect"
332
332
  },
@@ -398,11 +398,11 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
398
398
  }
399
399
  });
400
400
 
401
- const _hoisted_1$v = { style: { "display": "flex", "margin-bottom": "10px" } };
401
+ const _hoisted_1$w = { style: { "display": "flex", "margin-bottom": "10px" } };
402
402
  const _hoisted_2$p = { style: { "flex": "1" } };
403
403
  const _hoisted_3$b = { style: { "flex": "1" } };
404
404
  const _hoisted_4$7 = { class: "dialog-footer" };
405
- const _sfc_main$O = /* @__PURE__ */ defineComponent({
405
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
406
406
  ...{
407
407
  name: "MEditorCodeBlockEditor"
408
408
  },
@@ -644,7 +644,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
644
644
  ])
645
645
  ]),
646
646
  default: withCtx(() => [
647
- createElementVNode("div", _hoisted_1$v, [
647
+ createElementVNode("div", _hoisted_1$w, [
648
648
  createElementVNode("div", _hoisted_2$p, [
649
649
  createVNode(unref(TMagicTag), {
650
650
  size: "small",
@@ -668,7 +668,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
668
668
  })
669
669
  ])
670
670
  ]),
671
- difVisible.value ? (openBlock(), createBlock(_sfc_main$S, {
671
+ difVisible.value ? (openBlock(), createBlock(_sfc_main$T, {
672
672
  key: 0,
673
673
  ref_key: "magicVsEditor",
674
674
  ref: magicVsEditor,
@@ -777,47 +777,72 @@ const fillConfig$1 = (config) => [
777
777
  ...BaseFormConfig(),
778
778
  ...config,
779
779
  {
780
- type: "panel",
781
- title: "数据定义",
780
+ type: "tab",
782
781
  items: [
783
782
  {
784
- name: "fields",
785
- type: "data-source-fields",
786
- defaultValue: () => []
787
- }
788
- ]
789
- },
790
- {
791
- type: "panel",
792
- title: "方法定义",
793
- items: [
783
+ title: "数据定义",
784
+ items: [
785
+ {
786
+ name: "fields",
787
+ type: "data-source-fields",
788
+ defaultValue: () => []
789
+ }
790
+ ]
791
+ },
794
792
  {
795
- name: "methods",
796
- type: "data-source-methods",
797
- defaultValue: () => []
798
- }
799
- ]
800
- },
801
- {
802
- type: "panel",
803
- title: "事件配置",
804
- display: false,
805
- items: [
793
+ title: "方法定义",
794
+ items: [
795
+ {
796
+ name: "methods",
797
+ type: "data-source-methods",
798
+ defaultValue: () => []
799
+ }
800
+ ]
801
+ },
806
802
  {
807
- name: "events",
808
- src: "datasource",
809
- type: "event-select"
810
- }
811
- ]
812
- },
813
- {
814
- type: "panel",
815
- title: "mock数据",
816
- items: [
803
+ title: "事件配置",
804
+ display: false,
805
+ items: [
806
+ {
807
+ name: "events",
808
+ src: "datasource",
809
+ type: "event-select"
810
+ }
811
+ ]
812
+ },
813
+ {
814
+ title: "mock数据",
815
+ items: [
816
+ {
817
+ name: "mocks",
818
+ type: "data-source-mocks",
819
+ defaultValue: () => []
820
+ }
821
+ ]
822
+ },
817
823
  {
818
- name: "mocks",
819
- type: "data-source-mocks",
820
- defaultValue: () => []
824
+ title: "请求参数裁剪",
825
+ display: (formState, { model }) => model.type === "http",
826
+ items: [
827
+ {
828
+ name: "beforeRequest",
829
+ type: "vs-code",
830
+ parse: true,
831
+ height: "600px"
832
+ }
833
+ ]
834
+ },
835
+ {
836
+ title: "响应数据裁剪",
837
+ display: (formState, { model }) => model.type === "http",
838
+ items: [
839
+ {
840
+ name: "afterResponse",
841
+ type: "vs-code",
842
+ parse: true,
843
+ height: "600px"
844
+ }
845
+ ]
821
846
  }
822
847
  ]
823
848
  }
@@ -832,6 +857,62 @@ const getFormConfig = (type, configs) => {
832
857
  return fillConfig$1(configs[type] || []);
833
858
  }
834
859
  };
860
+ const getFormValue = (type, values) => {
861
+ if (type !== "http") {
862
+ return values;
863
+ }
864
+ return {
865
+ beforeRequest: `(options, context) => {
866
+ /**
867
+ * 用户可以直接编写函数,在原始接口调用之前,会运行该函数,将这个函数的返回值作为该数据源接口的入参
868
+ *
869
+ * options: HttpOptions
870
+ *
871
+ * interface HttpOptions {
872
+ * // 请求链接
873
+ * url: string;
874
+ * // query参数
875
+ * params?: Record<string, string>;
876
+ * // body数据
877
+ * data?: Record<string, any>;
878
+ * // 请求头
879
+ * headers?: Record<string, string>;
880
+ * // 请求方法 GET/POST
881
+ * method?: Method;
882
+ * }
883
+ *
884
+ * context:上下文对象
885
+ *
886
+ * interface Content {
887
+ * app: AppCore;
888
+ * dataSource: HttpDataSource;
889
+ * }
890
+ *
891
+ * return: HttpOptions
892
+ */
893
+
894
+ // 此处的返回值会作为这个接口的入参
895
+ return options;
896
+ }`,
897
+ afterResponse: `(response, context) => {
898
+ /**
899
+ * 用户可以直接编写函数,在原始接口返回之后,会运行该函数,将这个函数的返回值作为该数据源接口的返回
900
+
901
+ * context:上下文对象
902
+ *
903
+ * interface Content {
904
+ * app: AppCore;
905
+ * dataSource: HttpDataSource;
906
+ * }
907
+ *
908
+ */
909
+
910
+ // 此处的返回值会作为这个接口的返回值
911
+ return response;
912
+ }`,
913
+ ...values
914
+ };
915
+ };
835
916
  const getDisplayField = (dataSources, key) => {
836
917
  const displayState = [];
837
918
  const matches = key.matchAll(/\$\{([\s\S]+?)\}/g);
@@ -1017,7 +1098,7 @@ class DataSource extends BaseService {
1017
1098
  this.get("configs")[type] = config;
1018
1099
  }
1019
1100
  getFormValue(type = "base") {
1020
- return this.get("values")[type];
1101
+ return getFormValue(type, this.get("values")[type]);
1021
1102
  }
1022
1103
  setFormValue(type, value) {
1023
1104
  this.get("values")[type] = value;
@@ -2874,7 +2955,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
2874
2955
  return newNode;
2875
2956
  };
2876
2957
 
2877
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
2958
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
2878
2959
  ...{
2879
2960
  name: "MEditorCodeParams"
2880
2961
  },
@@ -2923,8 +3004,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
2923
3004
  }
2924
3005
  });
2925
3006
 
2926
- const _hoisted_1$u = ["src"];
2927
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
3007
+ const _hoisted_1$v = ["src"];
3008
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
2928
3009
  ...{
2929
3010
  name: "MEditorIcon"
2930
3011
  },
@@ -2948,7 +3029,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
2948
3029
  class: "magic-editor-icon"
2949
3030
  }, {
2950
3031
  default: withCtx(() => [
2951
- createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$u)
3032
+ createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$v)
2952
3033
  ]),
2953
3034
  _: 1
2954
3035
  })) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
@@ -3025,9 +3106,9 @@ const useCodeBlockEdit = (codeBlockService) => {
3025
3106
  };
3026
3107
  };
3027
3108
 
3028
- const _hoisted_1$t = { class: "m-fields-code-select-col" };
3109
+ const _hoisted_1$u = { class: "m-fields-code-select-col" };
3029
3110
  const _hoisted_2$o = { class: "code-select-container" };
3030
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
3111
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
3031
3112
  ...{
3032
3113
  name: "MEditorCodeSelectCol"
3033
3114
  },
@@ -3099,7 +3180,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3099
3180
  const { codeBlockEditor, codeConfig, editCode, submitCodeBlockHandler } = useCodeBlockEdit(services?.codeBlockService);
3100
3181
  return (_ctx, _cache) => {
3101
3182
  const _component_m_form_container = resolveComponent("m-form-container");
3102
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
3183
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
3103
3184
  createElementVNode("div", _hoisted_2$o, [
3104
3185
  createVNode(_component_m_form_container, {
3105
3186
  class: "select",
@@ -3108,14 +3189,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3108
3189
  size: _ctx.size,
3109
3190
  onChange: onParamsChangeHandler
3110
3191
  }, null, 8, ["model", "size"]),
3111
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$M, {
3192
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
3112
3193
  key: 0,
3113
3194
  class: "icon",
3114
3195
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
3115
3196
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
3116
3197
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3117
3198
  ]),
3118
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$N, {
3199
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
3119
3200
  key: 0,
3120
3201
  name: "params",
3121
3202
  model: _ctx.model,
@@ -3123,7 +3204,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3123
3204
  "params-config": paramsConfig.value,
3124
3205
  onChange: onParamsChangeHandler
3125
3206
  }, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
3126
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
3207
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
3127
3208
  key: 1,
3128
3209
  ref_key: "codeBlockEditor",
3129
3210
  ref: codeBlockEditor,
@@ -3136,9 +3217,9 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3136
3217
  }
3137
3218
  });
3138
3219
 
3139
- const _hoisted_1$s = { class: "m-editor-data-source-fields" };
3220
+ const _hoisted_1$t = { class: "m-editor-data-source-fields" };
3140
3221
  const _hoisted_2$n = { class: "m-editor-data-source-fields-footer" };
3141
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
3222
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3142
3223
  ...{
3143
3224
  name: "MEditorDataSourceFields"
3144
3225
  },
@@ -3369,7 +3450,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
3369
3450
  }
3370
3451
  };
3371
3452
  return (_ctx, _cache) => {
3372
- return openBlock(), createElementBlock("div", _hoisted_1$s, [
3453
+ return openBlock(), createElementBlock("div", _hoisted_1$t, [
3373
3454
  createVNode(unref(MagicTable), {
3374
3455
  data: _ctx.model[_ctx.name],
3375
3456
  columns: fieldColumns
@@ -3426,7 +3507,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
3426
3507
  }
3427
3508
  });
3428
3509
 
3429
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
3510
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
3430
3511
  __name: "DataSourceFieldSelect",
3431
3512
  props: {
3432
3513
  config: {},
@@ -3480,10 +3561,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3480
3561
  }
3481
3562
  });
3482
3563
 
3483
- const _hoisted_1$r = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3564
+ const _hoisted_1$s = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3484
3565
  const _hoisted_2$m = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3485
3566
  const _hoisted_3$a = { class: "el-input__inner" };
3486
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
3567
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3487
3568
  ...{
3488
3569
  name: "MEditorDataSourceInput"
3489
3570
  },
@@ -3672,10 +3753,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
3672
3753
  }
3673
3754
  ), {
3674
3755
  suffix: withCtx(() => [
3675
- createVNode(_sfc_main$M, { icon: unref(Coin) }, null, 8, ["icon"])
3756
+ createVNode(_sfc_main$N, { icon: unref(Coin) }, null, 8, ["icon"])
3676
3757
  ]),
3677
3758
  default: withCtx(({ item }) => [
3678
- createElementVNode("div", _hoisted_1$r, [
3759
+ createElementVNode("div", _hoisted_1$s, [
3679
3760
  createElementVNode("div", null, toDisplayString(item.text), 1),
3680
3761
  createElementVNode("span", _hoisted_2$m, toDisplayString(item.value), 1)
3681
3762
  ])
@@ -3707,7 +3788,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
3707
3788
  }, 1032, ["size"])) : createCommentVNode("", true)
3708
3789
  ], 64);
3709
3790
  }), 256)),
3710
- createVNode(_sfc_main$M, {
3791
+ createVNode(_sfc_main$N, {
3711
3792
  class: "tmagic-data-source-input-icon",
3712
3793
  icon: unref(Coin)
3713
3794
  }, null, 8, ["icon"])
@@ -3790,9 +3871,9 @@ const useDataSourceMethod = () => {
3790
3871
  };
3791
3872
  };
3792
3873
 
3793
- const _hoisted_1$q = { class: "m-editor-data-source-methods" };
3874
+ const _hoisted_1$r = { class: "m-editor-data-source-methods" };
3794
3875
  const _hoisted_2$l = { class: "m-editor-data-source-methods-footer" };
3795
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
3876
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
3796
3877
  ...{
3797
3878
  name: "MEditorDataSourceMethods"
3798
3879
  },
@@ -3861,7 +3942,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
3861
3942
  emit("change", props.model[props.name]);
3862
3943
  };
3863
3944
  return (_ctx, _cache) => {
3864
- return openBlock(), createElementBlock("div", _hoisted_1$q, [
3945
+ return openBlock(), createElementBlock("div", _hoisted_1$r, [
3865
3946
  createVNode(unref(MagicTable), {
3866
3947
  data: _ctx.model[_ctx.name],
3867
3948
  columns: methodColumns
@@ -3880,7 +3961,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
3880
3961
  _: 1
3881
3962
  }, 8, ["disabled"])
3882
3963
  ]),
3883
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
3964
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
3884
3965
  key: 0,
3885
3966
  ref_key: "codeBlockEditor",
3886
3967
  ref: codeBlockEditor,
@@ -3895,9 +3976,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
3895
3976
  }
3896
3977
  });
3897
3978
 
3898
- const _hoisted_1$p = { class: "m-fields-data-source-method-select" };
3979
+ const _hoisted_1$q = { class: "m-fields-data-source-method-select" };
3899
3980
  const _hoisted_2$k = { class: "data-source-method-select-container" };
3900
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
3981
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
3901
3982
  ...{
3902
3983
  name: "MEditorDataSourceMethodSelect"
3903
3984
  },
@@ -3979,7 +4060,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
3979
4060
  };
3980
4061
  return (_ctx, _cache) => {
3981
4062
  const _component_m_form_container = resolveComponent("m-form-container");
3982
- return openBlock(), createElementBlock("div", _hoisted_1$p, [
4063
+ return openBlock(), createElementBlock("div", _hoisted_1$q, [
3983
4064
  createElementVNode("div", _hoisted_2$k, [
3984
4065
  createVNode(_component_m_form_container, {
3985
4066
  class: "select",
@@ -3987,14 +4068,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
3987
4068
  model: _ctx.model,
3988
4069
  onChange: onChangeHandler
3989
4070
  }, null, 8, ["config", "model"]),
3990
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$M, {
4071
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
3991
4072
  key: 0,
3992
4073
  class: "icon",
3993
4074
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
3994
4075
  onClick: editCodeHandler
3995
4076
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3996
4077
  ]),
3997
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$N, {
4078
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
3998
4079
  key: 0,
3999
4080
  name: "params",
4000
4081
  model: _ctx.model,
@@ -4003,7 +4084,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4003
4084
  "params-config": paramsConfig.value,
4004
4085
  onChange: onChangeHandler
4005
4086
  }, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
4006
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
4087
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
4007
4088
  key: 1,
4008
4089
  ref_key: "codeBlockEditor",
4009
4090
  ref: codeBlockEditor,
@@ -4016,9 +4097,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4016
4097
  }
4017
4098
  });
4018
4099
 
4019
- const _hoisted_1$o = { class: "m-editor-data-source-fields" };
4100
+ const _hoisted_1$p = { class: "m-editor-data-source-fields" };
4020
4101
  const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
4021
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
4102
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4022
4103
  ...{
4023
4104
  name: "MEditorDataSourceMocks"
4024
4105
  },
@@ -4104,7 +4185,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4104
4185
  const columns = [
4105
4186
  {
4106
4187
  type: "expand",
4107
- component: _sfc_main$S,
4188
+ component: _sfc_main$T,
4108
4189
  props: (row) => ({
4109
4190
  initValues: row.data,
4110
4191
  language: "json",
@@ -4213,7 +4294,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4213
4294
  });
4214
4295
  };
4215
4296
  return (_ctx, _cache) => {
4216
- return openBlock(), createElementBlock("div", _hoisted_1$o, [
4297
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
4217
4298
  createVNode(unref(MagicTable), {
4218
4299
  data: _ctx.model[_ctx.name],
4219
4300
  columns
@@ -4249,7 +4330,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4249
4330
  }
4250
4331
  });
4251
4332
 
4252
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
4333
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4253
4334
  ...{
4254
4335
  name: "MEditorDataSourceSelect"
4255
4336
  },
@@ -4304,12 +4385,12 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4304
4385
  }
4305
4386
  });
4306
4387
 
4307
- const _hoisted_1$n = { class: "m-fields-event-select" };
4388
+ const _hoisted_1$o = { class: "m-fields-event-select" };
4308
4389
  const _hoisted_2$i = {
4309
4390
  key: 1,
4310
4391
  class: "fullWidth"
4311
4392
  };
4312
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
4393
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4313
4394
  ...{
4314
4395
  name: "MEditorEventSelect"
4315
4396
  },
@@ -4511,7 +4592,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4511
4592
  const _component_m_form_table = resolveComponent("m-form-table");
4512
4593
  const _component_m_form_container = resolveComponent("m-form-container");
4513
4594
  const _component_m_form_panel = resolveComponent("m-form-panel");
4514
- return openBlock(), createElementBlock("div", _hoisted_1$n, [
4595
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [
4515
4596
  isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
4516
4597
  key: 0,
4517
4598
  ref: "eventForm",
@@ -4571,9 +4652,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4571
4652
  }
4572
4653
  });
4573
4654
 
4574
- const _hoisted_1$m = { class: "m-fields-key-value" };
4655
+ const _hoisted_1$n = { class: "m-fields-key-value" };
4575
4656
  const _hoisted_2$h = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
4576
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
4657
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4577
4658
  ...{
4578
4659
  name: "MEditorKeyValue"
4579
4660
  },
@@ -4616,9 +4697,10 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4616
4697
  };
4617
4698
  const deleteHandler = (index) => {
4618
4699
  records.value.splice(index, 1);
4700
+ emit("change", getValue());
4619
4701
  };
4620
4702
  return (_ctx, _cache) => {
4621
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
4703
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
4622
4704
  (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
4623
4705
  return openBlock(), createElementBlock("div", {
4624
4706
  class: "m-fields-key-value-item",
@@ -4671,12 +4753,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4671
4753
  }
4672
4754
  });
4673
4755
 
4674
- const _hoisted_1$l = {
4756
+ const _hoisted_1$m = {
4675
4757
  key: 1,
4676
4758
  class: "m-fields-ui-select",
4677
4759
  style: { "display": "flex" }
4678
4760
  };
4679
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
4761
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4680
4762
  ...{
4681
4763
  name: "MEditorUISelect"
4682
4764
  },
@@ -4765,7 +4847,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4765
4847
  ]),
4766
4848
  _: 1
4767
4849
  }, 8, ["icon", "disabled", "size"])
4768
- ])) : (openBlock(), createElementBlock("div", _hoisted_1$l, [
4850
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$m, [
4769
4851
  val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4770
4852
  createVNode(unref(TMagicTooltip), {
4771
4853
  content: "清除",
@@ -4862,7 +4944,7 @@ const useGetSo = (target, emit) => {
4862
4944
  };
4863
4945
  };
4864
4946
 
4865
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
4947
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4866
4948
  ...{
4867
4949
  name: "MEditorResizer"
4868
4950
  },
@@ -4883,7 +4965,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
4883
4965
  }
4884
4966
  });
4885
4967
 
4886
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
4968
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
4887
4969
  ...{
4888
4970
  name: "MEditorLayout"
4889
4971
  },
@@ -4995,7 +5077,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
4995
5077
  }, [
4996
5078
  renderSlot(_ctx.$slots, "left")
4997
5079
  ], 6),
4998
- createVNode(_sfc_main$A, { onChange: changeLeft })
5080
+ createVNode(_sfc_main$B, { onChange: changeLeft })
4999
5081
  ], 64)) : createCommentVNode("", true),
5000
5082
  createElementVNode("div", {
5001
5083
  class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -5004,7 +5086,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5004
5086
  renderSlot(_ctx.$slots, "center")
5005
5087
  ], 6),
5006
5088
  hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5007
- createVNode(_sfc_main$A, { onChange: changeRight }),
5089
+ createVNode(_sfc_main$B, { onChange: changeRight }),
5008
5090
  createElementVNode("div", {
5009
5091
  class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
5010
5092
  style: normalizeStyle(`width: ${_ctx.right}px`)
@@ -5017,10 +5099,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5017
5099
  }
5018
5100
  });
5019
5101
 
5020
- const _hoisted_1$k = { class: "m-editor-empty-panel" };
5102
+ const _hoisted_1$l = { class: "m-editor-empty-panel" };
5021
5103
  const _hoisted_2$g = { class: "m-editor-empty-content" };
5022
5104
  const _hoisted_3$9 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
5023
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
5105
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5024
5106
  ...{
5025
5107
  name: "MEditorAddPageBox"
5026
5108
  },
@@ -5040,14 +5122,14 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5040
5122
  });
5041
5123
  };
5042
5124
  return (_ctx, _cache) => {
5043
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
5125
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
5044
5126
  createElementVNode("div", _hoisted_2$g, [
5045
5127
  createElementVNode("div", {
5046
5128
  class: "m-editor-empty-button",
5047
5129
  onClick: clickHandler
5048
5130
  }, [
5049
5131
  createElementVNode("div", null, [
5050
- createVNode(_sfc_main$M, { icon: unref(Plus) }, null, 8, ["icon"])
5132
+ createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
5051
5133
  ]),
5052
5134
  _hoisted_3$9
5053
5135
  ])
@@ -5061,7 +5143,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
5061
5143
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
5062
5144
  const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
5063
5145
  const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
5064
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
5146
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5065
5147
  ...{
5066
5148
  name: "MEditorFramework"
5067
5149
  },
@@ -5138,13 +5220,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5138
5220
  renderSlot(_ctx.$slots, "nav"),
5139
5221
  renderSlot(_ctx.$slots, "content-before"),
5140
5222
  showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
5141
- createVNode(_sfc_main$S, {
5223
+ createVNode(_sfc_main$T, {
5142
5224
  class: "m-editor-content",
5143
5225
  "init-values": root.value,
5144
5226
  options: unref(codeOptions),
5145
5227
  onSave: saveCode
5146
5228
  }, null, 8, ["init-values", "options"])
5147
- ]) : (openBlock(), createBlock(_sfc_main$z, {
5229
+ ]) : (openBlock(), createBlock(_sfc_main$A, {
5148
5230
  key: 1,
5149
5231
  class: "m-editor-content",
5150
5232
  "left-class": "m-editor-framework-left",
@@ -5163,7 +5245,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5163
5245
  ]),
5164
5246
  center: withCtx(() => [
5165
5247
  pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
5166
- createVNode(_sfc_main$y)
5248
+ createVNode(_sfc_main$z)
5167
5249
  ])
5168
5250
  ]),
5169
5251
  _: 2
@@ -5188,12 +5270,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5188
5270
  }
5189
5271
  });
5190
5272
 
5191
- const _hoisted_1$j = {
5273
+ const _hoisted_1$k = {
5192
5274
  key: 1,
5193
5275
  class: "menu-item-text"
5194
5276
  };
5195
5277
  const _hoisted_2$f = { class: "el-dropdown-link menubar-menu-button" };
5196
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
5278
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5197
5279
  ...{
5198
5280
  name: "MEditorToolButton"
5199
5281
  },
@@ -5272,7 +5354,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5272
5354
  _ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
5273
5355
  key: 0,
5274
5356
  direction: _ctx.data.direction || "vertical"
5275
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$j, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5357
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$k, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5276
5358
  _ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
5277
5359
  key: 0,
5278
5360
  effect: "dark",
@@ -5286,7 +5368,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5286
5368
  disabled: disabled.value
5287
5369
  }, {
5288
5370
  default: withCtx(() => [
5289
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$M, {
5371
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
5290
5372
  key: 0,
5291
5373
  icon: _ctx.data.icon
5292
5374
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -5304,7 +5386,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5304
5386
  title: _ctx.data.text
5305
5387
  }, {
5306
5388
  default: withCtx(() => [
5307
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$M, {
5389
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
5308
5390
  key: 0,
5309
5391
  icon: _ctx.data.icon
5310
5392
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -5354,7 +5436,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5354
5436
  }
5355
5437
  });
5356
5438
 
5357
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
5439
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5358
5440
  ...{
5359
5441
  name: "MEditorNavMenu"
5360
5442
  },
@@ -5516,7 +5598,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5516
5598
  style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
5517
5599
  }, [
5518
5600
  (openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
5519
- return openBlock(), createBlock(_sfc_main$w, {
5601
+ return openBlock(), createBlock(_sfc_main$x, {
5520
5602
  data: item,
5521
5603
  key: index
5522
5604
  }, null, 8, ["data"]);
@@ -5528,8 +5610,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5528
5610
  }
5529
5611
  });
5530
5612
 
5531
- const _hoisted_1$i = { class: "m-editor-props-panel" };
5532
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
5613
+ const _hoisted_1$j = { class: "m-editor-props-panel" };
5614
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5533
5615
  ...{
5534
5616
  name: "MEditorPropsPanel"
5535
5617
  },
@@ -5582,7 +5664,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5582
5664
  };
5583
5665
  __expose({ configForm, submit });
5584
5666
  return (_ctx, _cache) => {
5585
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$i, [
5667
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$j, [
5586
5668
  renderSlot(_ctx.$slots, "props-panel-header"),
5587
5669
  createVNode(unref(MForm), {
5588
5670
  ref_key: "configForm",
@@ -5602,7 +5684,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5602
5684
  }
5603
5685
  });
5604
5686
 
5605
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
5687
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5606
5688
  ...{
5607
5689
  name: "MEditorSearchInput"
5608
5690
  },
@@ -5641,7 +5723,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
5641
5723
  }
5642
5724
  });
5643
5725
 
5644
- const _hoisted_1$h = { xmlns: "http://www.w3.org/2000/svg" };
5726
+ const _hoisted_1$i = { xmlns: "http://www.w3.org/2000/svg" };
5645
5727
  const _hoisted_2$e = /* @__PURE__ */ createElementVNode("g", {
5646
5728
  fill: "#7C878E",
5647
5729
  "fill-rule": "evenodd"
@@ -5655,19 +5737,19 @@ const _hoisted_2$e = /* @__PURE__ */ createElementVNode("g", {
5655
5737
  const _hoisted_3$8 = [
5656
5738
  _hoisted_2$e
5657
5739
  ];
5658
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
5740
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
5659
5741
  ...{
5660
5742
  name: "MEditorAppManageIcon"
5661
5743
  },
5662
5744
  __name: "AppManageIcon",
5663
5745
  setup(__props) {
5664
5746
  return (_ctx, _cache) => {
5665
- return openBlock(), createElementBlock("svg", _hoisted_1$h, _hoisted_3$8);
5747
+ return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_3$8);
5666
5748
  };
5667
5749
  }
5668
5750
  });
5669
5751
 
5670
- const _hoisted_1$g = {
5752
+ const _hoisted_1$h = {
5671
5753
  viewBox: "0 0 32 32",
5672
5754
  version: "1.1",
5673
5755
  xmlns: "http://www.w3.org/2000/svg",
@@ -5677,25 +5759,25 @@ const _hoisted_2$d = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
5677
5759
  const _hoisted_4$6 = [
5678
5760
  _hoisted_2$d
5679
5761
  ];
5680
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
5762
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
5681
5763
  ...{
5682
5764
  name: "MEditorCodeIcon"
5683
5765
  },
5684
5766
  __name: "CodeIcon",
5685
5767
  setup(__props) {
5686
5768
  return (_ctx, _cache) => {
5687
- return openBlock(), createElementBlock("svg", _hoisted_1$g, _hoisted_4$6);
5769
+ return openBlock(), createElementBlock("svg", _hoisted_1$h, _hoisted_4$6);
5688
5770
  };
5689
5771
  }
5690
5772
  });
5691
5773
 
5692
- const _hoisted_1$f = ["id"];
5774
+ const _hoisted_1$g = ["id"];
5693
5775
  const _hoisted_2$c = { class: "list-item" };
5694
5776
  const _hoisted_3$7 = {
5695
5777
  key: 2,
5696
5778
  class: "right-tool"
5697
5779
  };
5698
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
5780
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5699
5781
  ...{
5700
5782
  name: "MEditorCodeBlockList"
5701
5783
  },
@@ -5797,11 +5879,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5797
5879
  class: "list-container"
5798
5880
  }, [
5799
5881
  createElementVNode("div", _hoisted_2$c, [
5800
- data.type === "code" ? (openBlock(), createBlock(_sfc_main$r, {
5882
+ data.type === "code" ? (openBlock(), createBlock(_sfc_main$s, {
5801
5883
  key: 0,
5802
5884
  class: "codeIcon"
5803
5885
  })) : createCommentVNode("", true),
5804
- data.type === "node" ? (openBlock(), createBlock(_sfc_main$s, {
5886
+ data.type === "node" ? (openBlock(), createBlock(_sfc_main$t, {
5805
5887
  key: 1,
5806
5888
  class: "compIcon"
5807
5889
  })) : createCommentVNode("", true),
@@ -5815,7 +5897,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5815
5897
  placement: "bottom"
5816
5898
  }, {
5817
5899
  default: withCtx(() => [
5818
- createVNode(_sfc_main$M, {
5900
+ createVNode(_sfc_main$N, {
5819
5901
  icon: editable.value ? unref(Edit) : unref(View),
5820
5902
  class: "edit-icon",
5821
5903
  onClick: withModifiers(($event) => editCode(data.id), ["stop"])
@@ -5830,7 +5912,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5830
5912
  placement: "bottom"
5831
5913
  }, {
5832
5914
  default: withCtx(() => [
5833
- createVNode(_sfc_main$M, {
5915
+ createVNode(_sfc_main$N, {
5834
5916
  icon: unref(Close),
5835
5917
  class: "edit-icon",
5836
5918
  onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -5844,7 +5926,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5844
5926
  })
5845
5927
  ])) : createCommentVNode("", true)
5846
5928
  ])
5847
- ], 8, _hoisted_1$f)
5929
+ ], 8, _hoisted_1$g)
5848
5930
  ]),
5849
5931
  _: 3
5850
5932
  }, 8, ["default-expanded-keys", "data"]);
@@ -5852,8 +5934,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5852
5934
  }
5853
5935
  });
5854
5936
 
5855
- const _hoisted_1$e = { class: "search-wrapper" };
5856
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
5937
+ const _hoisted_1$f = { class: "search-wrapper" };
5938
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5857
5939
  ...{
5858
5940
  name: "MEditorCodeBlockListPanel"
5859
5941
  },
@@ -5873,8 +5955,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5873
5955
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
5874
5956
  default: withCtx(() => [
5875
5957
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
5876
- createElementVNode("div", _hoisted_1$e, [
5877
- createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
5958
+ createElementVNode("div", _hoisted_1$f, [
5959
+ createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
5878
5960
  editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
5879
5961
  key: 0,
5880
5962
  class: "create-code-button",
@@ -5890,7 +5972,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5890
5972
  renderSlot(_ctx.$slots, "code-block-panel-search")
5891
5973
  ])
5892
5974
  ]),
5893
- createVNode(_sfc_main$q, {
5975
+ createVNode(_sfc_main$r, {
5894
5976
  ref_key: "codeBlockList",
5895
5977
  ref: codeBlockList,
5896
5978
  "custom-error": _ctx.customError,
@@ -5905,7 +5987,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5905
5987
  ]),
5906
5988
  _: 3
5907
5989
  }, 8, ["custom-error", "onEdit", "onRemove"]),
5908
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
5990
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
5909
5991
  key: 0,
5910
5992
  ref_key: "codeBlockEditor",
5911
5993
  ref: codeBlockEditor,
@@ -5920,7 +6002,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5920
6002
  }
5921
6003
  });
5922
6004
 
5923
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
6005
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5924
6006
  ...{
5925
6007
  name: "MEditorDataSourceConfigPanel"
5926
6008
  },
@@ -5974,13 +6056,13 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5974
6056
  }
5975
6057
  });
5976
6058
 
5977
- const _hoisted_1$d = ["id"];
6059
+ const _hoisted_1$e = ["id"];
5978
6060
  const _hoisted_2$b = { class: "list-item" };
5979
6061
  const _hoisted_3$6 = {
5980
6062
  key: 2,
5981
6063
  class: "right-tool"
5982
6064
  };
5983
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
6065
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
5984
6066
  ...{
5985
6067
  name: "MEditorDataSourceList"
5986
6068
  },
@@ -6076,12 +6158,12 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6076
6158
  class: "list-container"
6077
6159
  }, [
6078
6160
  createElementVNode("div", _hoisted_2$b, [
6079
- data.type === "code" ? (openBlock(), createBlock(_sfc_main$M, {
6161
+ data.type === "code" ? (openBlock(), createBlock(_sfc_main$N, {
6080
6162
  key: 0,
6081
6163
  class: "codeIcon",
6082
6164
  icon: unref(Coin)
6083
6165
  }, null, 8, ["icon"])) : createCommentVNode("", true),
6084
- data.type === "node" ? (openBlock(), createBlock(_sfc_main$M, {
6166
+ data.type === "node" ? (openBlock(), createBlock(_sfc_main$N, {
6085
6167
  key: 1,
6086
6168
  class: "compIcon",
6087
6169
  icon: unref(Aim)
@@ -6096,7 +6178,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6096
6178
  placement: "bottom"
6097
6179
  }, {
6098
6180
  default: withCtx(() => [
6099
- createVNode(_sfc_main$M, {
6181
+ createVNode(_sfc_main$N, {
6100
6182
  icon: editable.value ? unref(Edit) : unref(View),
6101
6183
  class: "edit-icon",
6102
6184
  onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
@@ -6111,7 +6193,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6111
6193
  placement: "bottom"
6112
6194
  }, {
6113
6195
  default: withCtx(() => [
6114
- createVNode(_sfc_main$M, {
6196
+ createVNode(_sfc_main$N, {
6115
6197
  icon: unref(Close),
6116
6198
  class: "edit-icon",
6117
6199
  onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
@@ -6119,13 +6201,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6119
6201
  ]),
6120
6202
  _: 2
6121
6203
  }, 1024)) : createCommentVNode("", true),
6122
- renderSlot(_ctx.$slots, "data-source-panel-tool", {
6123
- id: data.id,
6124
- data: data.codeBlockContent
6125
- })
6204
+ renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
6126
6205
  ])) : createCommentVNode("", true)
6127
6206
  ])
6128
- ], 8, _hoisted_1$d)
6207
+ ], 8, _hoisted_1$e)
6129
6208
  ]),
6130
6209
  _: 3
6131
6210
  }, 8, ["data"]);
@@ -6133,9 +6212,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6133
6212
  }
6134
6213
  });
6135
6214
 
6136
- const _hoisted_1$c = { class: "search-wrapper" };
6215
+ const _hoisted_1$d = { class: "search-wrapper" };
6137
6216
  const _hoisted_2$a = { class: "data-source-list-panel-add-menu" };
6138
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
6217
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6139
6218
  ...{
6140
6219
  name: "MEditorDataSourceListPanel"
6141
6220
  },
@@ -6195,8 +6274,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6195
6274
  return (_ctx, _cache) => {
6196
6275
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
6197
6276
  default: withCtx(() => [
6198
- createElementVNode("div", _hoisted_1$c, [
6199
- createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
6277
+ createElementVNode("div", _hoisted_1$d, [
6278
+ createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
6200
6279
  editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
6201
6280
  key: 0,
6202
6281
  placement: "right"
@@ -6215,7 +6294,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6215
6294
  default: withCtx(() => [
6216
6295
  createElementVNode("div", _hoisted_2$a, [
6217
6296
  (openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
6218
- return openBlock(), createBlock(_sfc_main$w, {
6297
+ return openBlock(), createBlock(_sfc_main$x, {
6219
6298
  data: {
6220
6299
  type: "button",
6221
6300
  text: item.text,
@@ -6231,11 +6310,16 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6231
6310
  _: 1
6232
6311
  })) : createCommentVNode("", true)
6233
6312
  ]),
6234
- createVNode(_sfc_main$n, {
6313
+ createVNode(_sfc_main$o, {
6235
6314
  onEdit: editHandler,
6236
6315
  onRemove: removeHandler
6316
+ }, {
6317
+ "data-source-panel-tool": withCtx(({ data }) => [
6318
+ renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
6319
+ ]),
6320
+ _: 3
6237
6321
  }),
6238
- createVNode(_sfc_main$o, {
6322
+ createVNode(_sfc_main$p, {
6239
6323
  ref_key: "editDialog",
6240
6324
  ref: editDialog,
6241
6325
  disabled: !editable.value,
@@ -6244,13 +6328,187 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6244
6328
  onSubmit: submitDataSourceHandler
6245
6329
  }, null, 8, ["disabled", "values", "title"])
6246
6330
  ]),
6247
- _: 1
6331
+ _: 3
6248
6332
  });
6249
6333
  };
6250
6334
  }
6251
6335
  });
6252
6336
 
6337
+ const updateStatus = (nodeStatusMap, id, status) => {
6338
+ const nodeStatus = nodeStatusMap.get(id);
6339
+ if (!nodeStatus)
6340
+ return;
6341
+ getKeys(status).forEach((key) => {
6342
+ if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
6343
+ nodeStatus[key] = Boolean(status[key]);
6344
+ }
6345
+ });
6346
+ };
6347
+
6348
+ const _hoisted_1$c = ["draggable", "data-node-id", "data-is-container"];
6349
+ const _hoisted_2$9 = { class: "tree-node-label" };
6350
+ const _hoisted_3$5 = { class: "tree-node-tool" };
6351
+ const _hoisted_4$5 = {
6352
+ key: 0,
6353
+ class: "m-editor-tree-node-children"
6354
+ };
6355
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6356
+ ...{
6357
+ name: "MEditorTreeNode"
6358
+ },
6359
+ __name: "TreeNode",
6360
+ props: {
6361
+ data: {},
6362
+ nodeStatusMap: {},
6363
+ indent: { default: 0 }
6364
+ },
6365
+ emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
6366
+ setup(__props, { emit }) {
6367
+ const props = __props;
6368
+ const treeEmit = inject("treeEmit");
6369
+ const nodeStatus = computed(
6370
+ () => props.nodeStatusMap?.get(props.data.id) || {
6371
+ selected: false,
6372
+ expand: false,
6373
+ visible: false,
6374
+ draggable: false
6375
+ }
6376
+ );
6377
+ const expanded = computed(() => nodeStatus.value.expand);
6378
+ const selected = computed(() => nodeStatus.value.selected);
6379
+ const visible = computed(() => nodeStatus.value.visible);
6380
+ const draggable = computed(() => nodeStatus.value.draggable);
6381
+ const hasChilren = computed(() => props.data.items && props.data.items.length > 0);
6382
+ const handleDragStart = (event) => {
6383
+ treeEmit?.("node-dragstart", event, props.data);
6384
+ };
6385
+ const handleDragLeave = (event) => {
6386
+ treeEmit?.("node-dragleave", event, props.data);
6387
+ };
6388
+ const handleDragEnd = (event) => {
6389
+ treeEmit?.("node-dragend", event, props.data);
6390
+ };
6391
+ const nodeContentmenuHandler = (event) => {
6392
+ treeEmit?.("node-contextmenu", event, props.data);
6393
+ };
6394
+ const mouseenterHandler = (event) => {
6395
+ treeEmit?.("node-mouseenter", event, props.data);
6396
+ };
6397
+ const expandHandler = () => {
6398
+ updateStatus(props.nodeStatusMap, props.data.id, {
6399
+ expand: !expanded.value
6400
+ });
6401
+ };
6402
+ const nodeClickHandler = (event) => {
6403
+ treeEmit?.("node-click", event, props.data);
6404
+ };
6405
+ return (_ctx, _cache) => {
6406
+ const _component_TreeNode = resolveComponent("TreeNode", true);
6407
+ return withDirectives((openBlock(), createElementBlock("div", {
6408
+ class: "m-editor-tree-node",
6409
+ draggable: draggable.value,
6410
+ "data-node-id": _ctx.data.id,
6411
+ "data-is-container": Array.isArray(_ctx.data.items),
6412
+ onDragstart: handleDragStart,
6413
+ onDragleave: handleDragLeave,
6414
+ onDragend: handleDragEnd
6415
+ }, [
6416
+ createElementVNode("div", {
6417
+ class: normalizeClass(["tree-node", { selected: selected.value, expanded: expanded.value }]),
6418
+ style: normalizeStyle(`padding-left: ${_ctx.indent}px`),
6419
+ onContextmenu: nodeContentmenuHandler,
6420
+ onMouseenter: mouseenterHandler
6421
+ }, [
6422
+ createVNode(_sfc_main$N, {
6423
+ class: "expand-icon",
6424
+ style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
6425
+ icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
6426
+ onClick: expandHandler
6427
+ }, null, 8, ["style", "icon"]),
6428
+ createElementVNode("div", {
6429
+ class: "tree-node-content",
6430
+ onClick: nodeClickHandler
6431
+ }, [
6432
+ renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
6433
+ createElementVNode("div", _hoisted_2$9, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
6434
+ createElementVNode("div", _hoisted_3$5, [
6435
+ renderSlot(_ctx.$slots, "tree-node-tool", { data: _ctx.data })
6436
+ ])
6437
+ ])
6438
+ ])
6439
+ ], 38),
6440
+ hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
6441
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
6442
+ return openBlock(), createBlock(_component_TreeNode, {
6443
+ key: item.id,
6444
+ data: item,
6445
+ "node-status-map": _ctx.nodeStatusMap,
6446
+ indent: _ctx.indent + 11
6447
+ }, {
6448
+ "tree-node-content": withCtx(({ data: nodeData }) => [
6449
+ renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
6450
+ ]),
6451
+ "tree-node-tool": withCtx(({ data: nodeData }) => [
6452
+ renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
6453
+ ]),
6454
+ _: 2
6455
+ }, 1032, ["data", "node-status-map", "indent"]);
6456
+ }), 128))
6457
+ ])) : createCommentVNode("", true)
6458
+ ], 40, _hoisted_1$c)), [
6459
+ [vShow, visible.value]
6460
+ ]);
6461
+ };
6462
+ }
6463
+ });
6464
+
6465
+ const _hoisted_1$b = { key: 1 };
6253
6466
  const _sfc_main$l = /* @__PURE__ */ defineComponent({
6467
+ ...{
6468
+ name: "MEditorTree"
6469
+ },
6470
+ __name: "Tree",
6471
+ props: {
6472
+ data: {},
6473
+ nodeStatusMap: {},
6474
+ indent: { default: 0 },
6475
+ emptyText: { default: "暂无数据" }
6476
+ },
6477
+ emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
6478
+ setup(__props, { emit }) {
6479
+ provide("treeEmit", emit);
6480
+ const handleDragOver = (event) => {
6481
+ emit("node-dragover", event);
6482
+ };
6483
+ return (_ctx, _cache) => {
6484
+ return openBlock(), createElementBlock("div", {
6485
+ class: "m-editor-tree",
6486
+ onDragover: handleDragOver
6487
+ }, [
6488
+ _ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
6489
+ return openBlock(), createBlock(_sfc_main$m, {
6490
+ key: item.id,
6491
+ data: item,
6492
+ indent: _ctx.indent,
6493
+ "node-status-map": _ctx.nodeStatusMap
6494
+ }, {
6495
+ "tree-node-content": withCtx(({ data: nodeData }) => [
6496
+ renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
6497
+ ]),
6498
+ "tree-node-tool": withCtx(({ data: nodeData }) => [
6499
+ renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
6500
+ ]),
6501
+ _: 2
6502
+ }, 1032, ["data", "indent", "node-status-map"]);
6503
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$b, [
6504
+ createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
6505
+ ]))
6506
+ ], 32);
6507
+ };
6508
+ }
6509
+ });
6510
+
6511
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6254
6512
  ...{
6255
6513
  name: "MEditorContentMenu"
6256
6514
  },
@@ -6383,7 +6641,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6383
6641
  renderSlot(_ctx.$slots, "title"),
6384
6642
  createElementVNode("div", null, [
6385
6643
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
6386
- return openBlock(), createBlock(_sfc_main$w, {
6644
+ return openBlock(), createBlock(_sfc_main$x, {
6387
6645
  "event-type": "mouseup",
6388
6646
  ref_for: true,
6389
6647
  ref_key: "buttons",
@@ -6418,7 +6676,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6418
6676
  }
6419
6677
  });
6420
6678
 
6421
- const _hoisted_1$b = {
6679
+ const _hoisted_1$a = {
6422
6680
  width: "1em",
6423
6681
  height: "1em",
6424
6682
  viewBox: "0 0 16 16",
@@ -6426,26 +6684,26 @@ const _hoisted_1$b = {
6426
6684
  fill: "currentColor",
6427
6685
  xmlns: "http://www.w3.org/2000/svg"
6428
6686
  };
6429
- const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("path", {
6687
+ const _hoisted_2$8 = /* @__PURE__ */ createElementVNode("path", {
6430
6688
  "fill-rule": "evenodd",
6431
6689
  d: "M9.828 4H2.19a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91H9v1H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31L.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H14.54l.265-2.91A1 1 0 0 0 13.81 4H9.828zm-2.95-1.707L7.587 3H2.19c-.24 0-.47.042-.684.12L1.5 2.98a1 1 0 0 1 1-.98h3.672a1 1 0 0 1 .707.293z"
6432
6690
  }, null, -1);
6433
- const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("path", {
6691
+ const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("path", {
6434
6692
  "fill-rule": "evenodd",
6435
6693
  d: "M11 11.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5z"
6436
6694
  }, null, -1);
6437
- const _hoisted_4$5 = [
6438
- _hoisted_2$9,
6439
- _hoisted_3$5
6695
+ const _hoisted_4$4 = [
6696
+ _hoisted_2$8,
6697
+ _hoisted_3$4
6440
6698
  ];
6441
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
6699
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6442
6700
  ...{
6443
6701
  name: "MEditorFolderMinusIcon"
6444
6702
  },
6445
6703
  __name: "FolderMinusIcon",
6446
6704
  setup(__props) {
6447
6705
  return (_ctx, _cache) => {
6448
- return openBlock(), createElementBlock("svg", _hoisted_1$b, _hoisted_4$5);
6706
+ return openBlock(), createElementBlock("svg", _hoisted_1$a, _hoisted_4$4);
6449
6707
  };
6450
6708
  }
6451
6709
  });
@@ -6525,7 +6783,7 @@ const useMoveToMenu = (services) => {
6525
6783
  };
6526
6784
  };
6527
6785
 
6528
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
6786
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
6529
6787
  ...{
6530
6788
  name: "MEditorLayerMenu"
6531
6789
  },
@@ -6588,7 +6846,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6588
6846
  {
6589
6847
  type: "button",
6590
6848
  text: "全部折叠",
6591
- icon: _sfc_main$k,
6849
+ icon: _sfc_main$j,
6592
6850
  display: () => isPage(node.value),
6593
6851
  handler: () => {
6594
6852
  emit("collapse-all");
@@ -6614,7 +6872,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6614
6872
  show
6615
6873
  });
6616
6874
  return (_ctx, _cache) => {
6617
- return openBlock(), createBlock(_sfc_main$l, {
6875
+ return openBlock(), createBlock(_sfc_main$k, {
6618
6876
  "menu-data": menuData.value,
6619
6877
  ref_key: "menu",
6620
6878
  ref: menu,
@@ -6624,7 +6882,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6624
6882
  }
6625
6883
  });
6626
6884
 
6627
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
6885
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
6628
6886
  __name: "LayerNodeTool",
6629
6887
  props: {
6630
6888
  data: {}
@@ -6643,12 +6901,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
6643
6901
  };
6644
6902
  return (_ctx, _cache) => {
6645
6903
  return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6646
- _ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$M, {
6904
+ _ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$N, {
6647
6905
  key: 0,
6648
6906
  icon: unref(Hide),
6649
6907
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
6650
6908
  title: "点击显示"
6651
- }, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$M, {
6909
+ }, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$N, {
6652
6910
  key: 1,
6653
6911
  icon: unref(View),
6654
6912
  onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
@@ -6660,6 +6918,75 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
6660
6918
  }
6661
6919
  });
6662
6920
 
6921
+ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
6922
+ const select = async (data) => {
6923
+ if (!data.id) {
6924
+ throw new Error("没有id");
6925
+ }
6926
+ if (isCtrlKeyDown.value) {
6927
+ multiSelect(data);
6928
+ } else {
6929
+ await services?.editorService.select(data);
6930
+ services?.editorService.get("stage")?.select(data.id);
6931
+ }
6932
+ };
6933
+ const multiSelect = async (data) => {
6934
+ const nodes = services?.editorService.get("nodes") || [];
6935
+ const newNodes = [];
6936
+ let isCancel = false;
6937
+ nodes.forEach((node) => {
6938
+ if (node.id === data.id) {
6939
+ isCancel = true;
6940
+ return;
6941
+ }
6942
+ newNodes.push(node.id);
6943
+ });
6944
+ if (!isCancel || newNodes.length === 0) {
6945
+ newNodes.push(data.id);
6946
+ }
6947
+ await services?.editorService.multiSelect(newNodes);
6948
+ services?.editorService.get("stage")?.multiSelect(newNodes);
6949
+ };
6950
+ const throttleTime = 300;
6951
+ const highlightHandler = throttle((event, data) => {
6952
+ highlight(data);
6953
+ }, throttleTime);
6954
+ const highlight = (data) => {
6955
+ services?.editorService?.highlight(data);
6956
+ services?.editorService?.get("stage")?.highlight(data.id);
6957
+ };
6958
+ const nodeClickHandler = (event, data) => {
6959
+ if (!nodeStatusMap?.value)
6960
+ return;
6961
+ if (services?.uiService.get("uiSelectMode")) {
6962
+ document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: data }));
6963
+ return;
6964
+ }
6965
+ if (data.items && data.items.length > 0 && !isCtrlKeyDown.value) {
6966
+ updateStatus(nodeStatusMap.value, data.id, {
6967
+ expand: true
6968
+ });
6969
+ }
6970
+ nextTick(() => {
6971
+ select(data);
6972
+ });
6973
+ };
6974
+ const menu = ref();
6975
+ return {
6976
+ menu,
6977
+ nodeClickHandler,
6978
+ nodeContentmenuHandler(event, data) {
6979
+ event.preventDefault();
6980
+ const nodes = services?.editorService.get("nodes") || [];
6981
+ if (nodes.length < 2 || !nodes.includes(data)) {
6982
+ nodeClickHandler(event, data);
6983
+ }
6984
+ menu.value?.show(event);
6985
+ },
6986
+ highlightHandler
6987
+ };
6988
+ };
6989
+
6663
6990
  const dragState = {
6664
6991
  dragOverNodeId: "",
6665
6992
  dropType: "",
@@ -6704,7 +7031,7 @@ const useDrag = (services) => {
6704
7031
  if (!event.target)
6705
7032
  return;
6706
7033
  const targetEl = getNodeEl(event.target);
6707
- if (!targetEl)
7034
+ if (!targetEl?.draggable)
6708
7035
  return;
6709
7036
  const labelEl = targetEl.children[0];
6710
7037
  if (!labelEl)
@@ -6778,16 +7105,6 @@ const useDrag = (services) => {
6778
7105
  };
6779
7106
  };
6780
7107
 
6781
- const updateStatus = (nodeStatusMap, id, status) => {
6782
- const nodeStatus = nodeStatusMap.get(id);
6783
- if (!nodeStatus)
6784
- return;
6785
- getKeys(status).forEach((key) => {
6786
- if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
6787
- nodeStatus[key] = Boolean(status[key]);
6788
- }
6789
- });
6790
- };
6791
7108
  const useFilter = (nodeStatusMap, page) => {
6792
7109
  const filterIsMatch = (value, data) => {
6793
7110
  if (!value) {
@@ -6832,179 +7149,6 @@ const useFilter = (nodeStatusMap, page) => {
6832
7149
  };
6833
7150
  };
6834
7151
 
6835
- const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6836
- const _hoisted_2$8 = { class: "layer-node-label" };
6837
- const _hoisted_3$4 = { class: "layer-node-tool" };
6838
- const _hoisted_4$4 = {
6839
- key: 0,
6840
- class: "magic-editor-layer-node-children"
6841
- };
6842
- const throttleTime = 300;
6843
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
6844
- ...{
6845
- name: "MEditorLayerNode"
6846
- },
6847
- __name: "LayerNode",
6848
- props: {
6849
- data: {},
6850
- parent: {},
6851
- indent: { default: 0 },
6852
- filterText: { default: "" },
6853
- isCtrlKeyDown: { type: Boolean, default: false }
6854
- },
6855
- emits: ["node-contextmenu"],
6856
- setup(__props, { emit }) {
6857
- const props = __props;
6858
- const services = inject("services");
6859
- const nodeStatusMap = inject("nodeStatusMap");
6860
- const editorService = services?.editorService;
6861
- const uiService = services?.uiService;
6862
- const nodeStatus = computed(
6863
- () => nodeStatusMap?.value?.get(props.data.id) || {
6864
- selected: false,
6865
- expand: false,
6866
- visible: false
6867
- }
6868
- );
6869
- const expanded = computed(() => nodeStatus.value.expand);
6870
- const selected = computed(() => nodeStatus.value.selected);
6871
- const visible = computed(() => nodeStatus.value.visible);
6872
- const hasChilren = computed(() => props.data.items?.length > 0);
6873
- const nodeEl = ref();
6874
- const { handleDragStart, handleDragEnd, handleDragLeave } = useDrag(services);
6875
- const expandHandler = () => {
6876
- if (!nodeStatusMap?.value)
6877
- return;
6878
- updateStatus(nodeStatusMap.value, props.data.id, {
6879
- expand: !expanded.value
6880
- });
6881
- };
6882
- const nodeClickHandler = () => {
6883
- if (!nodeStatusMap?.value)
6884
- return;
6885
- if (uiService?.get("uiSelectMode")) {
6886
- document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: props.data }));
6887
- return;
6888
- }
6889
- if (hasChilren.value && !props.isCtrlKeyDown) {
6890
- updateStatus(nodeStatusMap.value, props.data.id, {
6891
- expand: true
6892
- });
6893
- }
6894
- nextTick(() => {
6895
- select(props.data);
6896
- });
6897
- };
6898
- const contextmenuHandler = (event) => {
6899
- event.preventDefault();
6900
- const nodes = editorService?.get("nodes") || [];
6901
- if (nodes.length < 2 || !nodes.includes(props.data)) {
6902
- nodeClickHandler();
6903
- }
6904
- emit("node-contextmenu", event, props.data);
6905
- };
6906
- const nodeContentmenuHandler = (event, node) => {
6907
- emit("node-contextmenu", event, node);
6908
- };
6909
- const select = async (data) => {
6910
- if (!data.id) {
6911
- throw new Error("没有id");
6912
- }
6913
- if (props.isCtrlKeyDown) {
6914
- multiSelect(data);
6915
- } else {
6916
- await editorService?.select(data);
6917
- editorService?.get("stage")?.select(data.id);
6918
- }
6919
- };
6920
- const multiSelect = async (data) => {
6921
- const nodes = editorService?.get("nodes") || [];
6922
- const newNodes = [];
6923
- let isCancel = false;
6924
- nodes.forEach((node) => {
6925
- if (node.id === data.id) {
6926
- isCancel = true;
6927
- return;
6928
- }
6929
- newNodes.push(node.id);
6930
- });
6931
- if (!isCancel || newNodes.length === 0) {
6932
- newNodes.push(data.id);
6933
- }
6934
- await editorService?.multiSelect(newNodes);
6935
- editorService?.get("stage")?.multiSelect(newNodes);
6936
- };
6937
- const highlightHandler = throttle(() => {
6938
- highlight();
6939
- }, throttleTime);
6940
- const highlight = () => {
6941
- editorService?.highlight(props.data);
6942
- editorService?.get("stage")?.highlight(props.data.id);
6943
- };
6944
- return (_ctx, _cache) => {
6945
- const _component_LayerNode = resolveComponent("LayerNode", true);
6946
- return withDirectives((openBlock(), createElementBlock("div", {
6947
- class: "magic-editor-layer-node",
6948
- ref_key: "nodeEl",
6949
- ref: nodeEl,
6950
- draggable: !unref(isPage)(_ctx.data),
6951
- "data-node-id": _ctx.data.id,
6952
- "data-is-container": Array.isArray(_ctx.data.items),
6953
- onDragstart: _cache[1] || (_cache[1] = //@ts-ignore
6954
- (...args) => unref(handleDragStart) && unref(handleDragStart)(...args)),
6955
- onDragleave: _cache[2] || (_cache[2] = //@ts-ignore
6956
- (...args) => unref(handleDragLeave) && unref(handleDragLeave)(...args)),
6957
- onDragend: _cache[3] || (_cache[3] = ($event) => unref(handleDragEnd)($event, _ctx.data))
6958
- }, [
6959
- createElementVNode("div", {
6960
- class: normalizeClass(["layer-node", { selected: selected.value, expanded: expanded.value }]),
6961
- style: normalizeStyle(`padding-left: ${_ctx.indent}px`),
6962
- onContextmenu: contextmenuHandler,
6963
- onMouseenter: _cache[0] || (_cache[0] = ($event) => unref(highlightHandler)())
6964
- }, [
6965
- createVNode(_sfc_main$M, {
6966
- class: "expand-icon",
6967
- style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
6968
- icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
6969
- onClick: expandHandler
6970
- }, null, 8, ["style", "icon"]),
6971
- createElementVNode("div", {
6972
- class: "layer-node-content",
6973
- onClick: nodeClickHandler
6974
- }, [
6975
- renderSlot(_ctx.$slots, "layer-node-content", { data: _ctx.data }, () => [
6976
- createElementVNode("div", _hoisted_2$8, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
6977
- createElementVNode("div", _hoisted_3$4, [
6978
- createVNode(_sfc_main$i, { data: _ctx.data }, null, 8, ["data"])
6979
- ])
6980
- ])
6981
- ])
6982
- ], 38),
6983
- hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
6984
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
6985
- return openBlock(), createBlock(_component_LayerNode, {
6986
- data: item,
6987
- parent: _ctx.data,
6988
- key: item.id,
6989
- indent: _ctx.indent + 11,
6990
- "filter-text": _ctx.filterText,
6991
- "is-ctrl-key-down": _ctx.isCtrlKeyDown,
6992
- onNodeContextmenu: nodeContentmenuHandler
6993
- }, {
6994
- "layer-node-content": withCtx(({ data: nodeData }) => [
6995
- renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
6996
- ]),
6997
- _: 2
6998
- }, 1032, ["data", "parent", "indent", "filter-text", "is-ctrl-key-down"]);
6999
- }), 128))
7000
- ])) : createCommentVNode("", true)
7001
- ], 40, _hoisted_1$a)), [
7002
- [vShow, visible.value]
7003
- ]);
7004
- };
7005
- }
7006
- });
7007
-
7008
7152
  var KeyBindingContainerKey = /* @__PURE__ */ ((KeyBindingContainerKey2) => {
7009
7153
  KeyBindingContainerKey2["STAGE"] = "stage";
7010
7154
  KeyBindingContainerKey2["LAYER_PANEL"] = "layer-panel";
@@ -7156,7 +7300,7 @@ const useKeybinding = (services, contianer) => {
7156
7300
  watchEffect(() => {
7157
7301
  if (contianer.value) {
7158
7302
  globalThis.addEventListener("blur", windowBlurHandler);
7159
- keybindingService?.registeEl(KeyBindingContainerKey.LAYER_PANEL, contianer.value);
7303
+ keybindingService?.registeEl(KeyBindingContainerKey.LAYER_PANEL, contianer.value.$el);
7160
7304
  } else {
7161
7305
  globalThis.removeEventListener("blur", windowBlurHandler);
7162
7306
  keybindingService?.unregisteEl(KeyBindingContainerKey.LAYER_PANEL);
@@ -7172,14 +7316,16 @@ const createPageNodeStatus = (services, pageId) => {
7172
7316
  map.set(pageId, {
7173
7317
  visible: true,
7174
7318
  expand: true,
7175
- selected: true
7319
+ selected: true,
7320
+ draggable: false
7176
7321
  });
7177
7322
  services?.editorService.getNodeById(pageId)?.items.forEach(
7178
7323
  (node) => traverseNode(node, (node2) => {
7179
7324
  map.set(node2.id, {
7180
7325
  visible: true,
7181
7326
  expand: false,
7182
- selected: false
7327
+ selected: false,
7328
+ draggable: true
7183
7329
  });
7184
7330
  })
7185
7331
  );
@@ -7229,7 +7375,8 @@ const useNodeStatus = (services, page) => {
7229
7375
  nodeStatusMap.value?.set(node2.id, {
7230
7376
  visible: true,
7231
7377
  expand: Array.isArray(node2.items),
7232
- selected: true
7378
+ selected: true,
7379
+ draggable: true
7233
7380
  });
7234
7381
  });
7235
7382
  });
@@ -7258,13 +7405,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7258
7405
  setup(__props) {
7259
7406
  const services = inject("services");
7260
7407
  const editorService = services?.editorService;
7261
- const layerTreeContainer = ref();
7408
+ const tree = ref();
7262
7409
  const page = computed(() => editorService?.get("page"));
7263
- const root = computed(() => editorService?.get("root"));
7264
7410
  const { nodeStatusMap } = useNodeStatus(services, page);
7265
- const { isCtrlKeyDown } = useKeybinding(services, layerTreeContainer);
7266
- provide("nodeStatusMap", nodeStatusMap);
7267
- const { filterText, filterTextChangeHandler } = useFilter(nodeStatusMap, page);
7411
+ const { isCtrlKeyDown } = useKeybinding(services, tree);
7412
+ const { filterTextChangeHandler } = useFilter(nodeStatusMap, page);
7268
7413
  const collapseAllHandler = () => {
7269
7414
  if (!page.value || !nodeStatusMap.value)
7270
7415
  return;
@@ -7276,40 +7421,45 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7276
7421
  status.expand = false;
7277
7422
  }
7278
7423
  };
7279
- const menu = ref();
7280
- const contextmenu = (event) => {
7281
- event.preventDefault();
7282
- menu.value?.show(event);
7283
- };
7284
- const { handleDragOver } = useDrag(services);
7424
+ const { handleDragStart, handleDragEnd, handleDragLeave, handleDragOver } = useDrag(services);
7425
+ const {
7426
+ menu,
7427
+ nodeClickHandler,
7428
+ nodeContentmenuHandler,
7429
+ highlightHandler: mouseenterHandler
7430
+ } = useClick(services, isCtrlKeyDown, nodeStatusMap);
7285
7431
  return (_ctx, _cache) => {
7286
- return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
7432
+ return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
7287
7433
  default: withCtx(() => [
7288
7434
  renderSlot(_ctx.$slots, "layer-panel-header"),
7289
- createVNode(_sfc_main$t, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
7290
- createElementVNode("div", {
7291
- class: "magic-editor-layer-tree",
7292
- ref_key: "layerTreeContainer",
7293
- ref: layerTreeContainer,
7435
+ createVNode(_sfc_main$u, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
7436
+ page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$l, {
7437
+ key: 0,
7294
7438
  tabindex: "-1",
7295
- onDragover: _cache[0] || (_cache[0] = //@ts-ignore
7296
- (...args) => unref(handleDragOver) && unref(handleDragOver)(...args))
7297
- }, [
7298
- page.value && root.value ? (openBlock(), createBlock(_sfc_main$h, {
7299
- key: 0,
7300
- data: page.value,
7301
- "filter-text": unref(filterText),
7302
- "is-ctrl-key-down": unref(isCtrlKeyDown),
7303
- onNodeContextmenu: contextmenu
7304
- }, {
7305
- "layer-node-content": withCtx(({ data: nodeData }) => [
7306
- renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
7307
- ]),
7308
- _: 3
7309
- }, 8, ["data", "filter-text", "is-ctrl-key-down"])) : createCommentVNode("", true)
7310
- ], 544),
7439
+ ref_key: "tree",
7440
+ ref: tree,
7441
+ data: [page.value],
7442
+ "node-status-map": unref(nodeStatusMap),
7443
+ onNodeDragover: unref(handleDragOver),
7444
+ onNodeDragstart: unref(handleDragStart),
7445
+ onNodeDragleave: unref(handleDragLeave),
7446
+ onNodeDragend: unref(handleDragEnd),
7447
+ onNodeContextmenu: unref(nodeContentmenuHandler),
7448
+ onNodeMouseenter: unref(mouseenterHandler),
7449
+ onNodeClick: unref(nodeClickHandler)
7450
+ }, {
7451
+ "tree-node-tool": withCtx(({ data: nodeData }) => [
7452
+ renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData }, () => [
7453
+ createVNode(_sfc_main$h, { data: nodeData }, null, 8, ["data"])
7454
+ ])
7455
+ ]),
7456
+ "tree-node-content": withCtx(({ data: nodeData }) => [
7457
+ renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
7458
+ ]),
7459
+ _: 3
7460
+ }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
7311
7461
  (openBlock(), createBlock(Teleport, { to: "body" }, [
7312
- createVNode(_sfc_main$j, {
7462
+ createVNode(_sfc_main$i, {
7313
7463
  ref_key: "menu",
7314
7464
  ref: menu,
7315
7465
  "layer-content-menu": _ctx.layerContentMenu,
@@ -7405,7 +7555,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7405
7555
  "model-value": collapseValue.value
7406
7556
  }, {
7407
7557
  default: withCtx(() => [
7408
- createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
7558
+ createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
7409
7559
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
7410
7560
  return openBlock(), createElementBlock(Fragment, null, [
7411
7561
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -7413,7 +7563,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7413
7563
  name: `${index}`
7414
7564
  }, {
7415
7565
  title: withCtx(() => [
7416
- createVNode(_sfc_main$M, { icon: unref(Grid) }, null, 8, ["icon"]),
7566
+ createVNode(_sfc_main$N, { icon: unref(Grid) }, null, 8, ["icon"]),
7417
7567
  createTextVNode(toDisplayString(group.title), 1)
7418
7568
  ]),
7419
7569
  default: withCtx(() => [
@@ -7434,7 +7584,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7434
7584
  content: item.desc
7435
7585
  }, {
7436
7586
  default: withCtx(() => [
7437
- createVNode(_sfc_main$M, {
7587
+ createVNode(_sfc_main$N, {
7438
7588
  icon: item.icon
7439
7589
  }, null, 8, ["icon"])
7440
7590
  ]),
@@ -7509,7 +7659,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7509
7659
  type: "component",
7510
7660
  icon: EditPen,
7511
7661
  text: "代码编辑",
7512
- component: _sfc_main$p,
7662
+ component: _sfc_main$q,
7513
7663
  slots: {}
7514
7664
  },
7515
7665
  "data-source": {
@@ -7517,7 +7667,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7517
7667
  type: "component",
7518
7668
  icon: Coin,
7519
7669
  text: "数据源",
7520
- component: _sfc_main$m,
7670
+ component: _sfc_main$n,
7521
7671
  slots: {}
7522
7672
  }
7523
7673
  };
@@ -7542,7 +7692,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7542
7692
  key: config.$key ?? index,
7543
7693
  onClick: ($event) => activeTabName.value = config.text || `${index}`
7544
7694
  }, [
7545
- config.icon ? (openBlock(), createBlock(_sfc_main$M, {
7695
+ config.icon ? (openBlock(), createBlock(_sfc_main$N, {
7546
7696
  key: 0,
7547
7697
  icon: config.icon
7548
7698
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -7613,6 +7763,29 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7613
7763
  }, null, 8, ["data"])) : createCommentVNode("", true)
7614
7764
  ]),
7615
7765
  key: "5"
7766
+ } : void 0,
7767
+ config.$key === "layer" || config.slots?.layerNodeTool ? {
7768
+ name: "layer-node-tool",
7769
+ fn: withCtx(({ data: nodeData }) => [
7770
+ config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-tool", {
7771
+ key: 0,
7772
+ data: nodeData
7773
+ }) : config.slots?.layerNodeTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
7774
+ key: 1,
7775
+ data: nodeData
7776
+ }, null, 8, ["data"])) : createCommentVNode("", true)
7777
+ ]),
7778
+ key: "6"
7779
+ } : void 0,
7780
+ config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
7781
+ name: "data-source-panel-tool",
7782
+ fn: withCtx(({ data }) => [
7783
+ config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
7784
+ key: 0,
7785
+ data
7786
+ }) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
7787
+ ]),
7788
+ key: "7"
7616
7789
  } : void 0
7617
7790
  ]), 1040)) : createCommentVNode("", true)
7618
7791
  ])), [
@@ -8240,7 +8413,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8240
8413
  content: _ctx.pinned ? "取消置于顶层自动隐藏" : "置于顶层不消失"
8241
8414
  }, {
8242
8415
  default: withCtx(() => [
8243
- createVNode(_sfc_main$M, {
8416
+ createVNode(_sfc_main$N, {
8244
8417
  style: { "margin-left": "10px", "cursor": "pointer" },
8245
8418
  icon: _ctx.pinned ? _sfc_main$a : _sfc_main$b,
8246
8419
  onClick: pinHandler
@@ -8256,7 +8429,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8256
8429
  onClick: closeHandler
8257
8430
  }, {
8258
8431
  default: withCtx(() => [
8259
- createVNode(_sfc_main$M, { icon: unref(Close) }, null, 8, ["icon"])
8432
+ createVNode(_sfc_main$N, { icon: unref(Close) }, null, 8, ["icon"])
8260
8433
  ]),
8261
8434
  _: 1
8262
8435
  })
@@ -8383,7 +8556,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8383
8556
  menu.value?.hide();
8384
8557
  };
8385
8558
  return (_ctx, _cache) => {
8386
- return openBlock(), createBlock(_sfc_main$l, {
8559
+ return openBlock(), createBlock(_sfc_main$k, {
8387
8560
  ref_key: "menu",
8388
8561
  ref: menu,
8389
8562
  class: "magic-editor-node-list-menu",
@@ -8569,7 +8742,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8569
8742
  };
8570
8743
  __expose({ show });
8571
8744
  return (_ctx, _cache) => {
8572
- return openBlock(), createBlock(_sfc_main$l, {
8745
+ return openBlock(), createBlock(_sfc_main$k, {
8573
8746
  "menu-data": menuData.value,
8574
8747
  ref_key: "menu",
8575
8748
  ref: menu
@@ -8902,14 +9075,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
8902
9075
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
8903
9076
  onClick: addPage
8904
9077
  }, [
8905
- createVNode(_sfc_main$M, { icon: unref(Plus) }, null, 8, ["icon"])
9078
+ createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
8906
9079
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
8907
9080
  canScroll.value ? (openBlock(), createElementBlock("div", {
8908
9081
  key: 2,
8909
9082
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
8910
9083
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
8911
9084
  }, [
8912
- createVNode(_sfc_main$M, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
9085
+ createVNode(_sfc_main$N, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
8913
9086
  ])) : createCommentVNode("", true),
8914
9087
  pageLength.value ? (openBlock(), createElementBlock("div", {
8915
9088
  key: 3,
@@ -8925,7 +9098,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
8925
9098
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
8926
9099
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
8927
9100
  }, [
8928
- createVNode(_sfc_main$M, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
9101
+ createVNode(_sfc_main$N, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
8929
9102
  ])) : createCommentVNode("", true)
8930
9103
  ], 512);
8931
9104
  };
@@ -8997,7 +9170,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8997
9170
  default: withCtx(() => [
8998
9171
  createElementVNode("div", null, [
8999
9172
  renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
9000
- createVNode(_sfc_main$w, {
9173
+ createVNode(_sfc_main$x, {
9001
9174
  data: {
9002
9175
  type: "button",
9003
9176
  text: "复制",
@@ -9005,7 +9178,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9005
9178
  handler: () => copy(item)
9006
9179
  }
9007
9180
  }, null, 8, ["data"]),
9008
- createVNode(_sfc_main$w, {
9181
+ createVNode(_sfc_main$x, {
9009
9182
  data: {
9010
9183
  type: "button",
9011
9184
  text: "删除",
@@ -10182,13 +10355,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10182
10355
  );
10183
10356
  __expose(services);
10184
10357
  return (_ctx, _cache) => {
10185
- return openBlock(), createBlock(_sfc_main$x, null, {
10358
+ return openBlock(), createBlock(_sfc_main$y, null, {
10186
10359
  header: withCtx(() => [
10187
10360
  renderSlot(_ctx.$slots, "header")
10188
10361
  ]),
10189
10362
  nav: withCtx(() => [
10190
10363
  renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
10191
- createVNode(_sfc_main$v, { data: _ctx.menu }, null, 8, ["data"])
10364
+ createVNode(_sfc_main$w, { data: _ctx.menu }, null, 8, ["data"])
10192
10365
  ])
10193
10366
  ]),
10194
10367
  "content-before": withCtx(() => [
@@ -10209,6 +10382,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10209
10382
  "layer-node-content": withCtx(({ data }) => [
10210
10383
  renderSlot(_ctx.$slots, "layer-node-content", { data })
10211
10384
  ]),
10385
+ "layer-node-tool": withCtx(({ data }) => [
10386
+ renderSlot(_ctx.$slots, "layer-node-tool", { data })
10387
+ ]),
10212
10388
  "component-list-panel-header": withCtx(() => [
10213
10389
  renderSlot(_ctx.$slots, "component-list-panel-header")
10214
10390
  ]),
@@ -10224,6 +10400,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10224
10400
  data
10225
10401
  })
10226
10402
  ]),
10403
+ "data-source-panel-tool": withCtx(({ data }) => [
10404
+ renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
10405
+ ]),
10227
10406
  _: 3
10228
10407
  }, 8, ["data", "layer-content-menu"])
10229
10408
  ])
@@ -10249,7 +10428,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10249
10428
  ]),
10250
10429
  "props-panel": withCtx(() => [
10251
10430
  renderSlot(_ctx.$slots, "props-panel", {}, () => [
10252
- createVNode(_sfc_main$u, {
10431
+ createVNode(_sfc_main$v, {
10253
10432
  "extend-state": _ctx.extendFormState,
10254
10433
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
10255
10434
  }, {
@@ -10287,23 +10466,23 @@ const index = {
10287
10466
  app.config.globalProperties.$TMAGIC_EDITOR = option;
10288
10467
  setConfig(option);
10289
10468
  app.component(_sfc_main.name, _sfc_main);
10290
- app.component("m-fields-ui-select", _sfc_main$B);
10291
- app.component("m-fields-code-link", _sfc_main$Q);
10292
- app.component("m-fields-vs-code", _sfc_main$R);
10293
- app.component("magic-code-editor", _sfc_main$S);
10294
- app.component("m-fields-code-select", _sfc_main$P);
10295
- app.component("m-fields-code-select-col", _sfc_main$L);
10296
- app.component("m-fields-event-select", _sfc_main$D);
10297
- app.component("m-fields-data-source-fields", _sfc_main$K);
10298
- app.component("m-fields-data-source-mocks", _sfc_main$F);
10299
- app.component("m-fields-key-value", _sfc_main$C);
10300
- app.component("m-fields-data-source-input", _sfc_main$I);
10301
- app.component("m-fields-data-source-select", _sfc_main$E);
10302
- app.component("m-fields-data-source-methods", _sfc_main$H);
10303
- app.component("m-fields-data-source-method-select", _sfc_main$G);
10304
- app.component("m-fields-data-source-field-select", _sfc_main$J);
10469
+ app.component("m-fields-ui-select", _sfc_main$C);
10470
+ app.component("m-fields-code-link", _sfc_main$R);
10471
+ app.component("m-fields-vs-code", _sfc_main$S);
10472
+ app.component("magic-code-editor", _sfc_main$T);
10473
+ app.component("m-fields-code-select", _sfc_main$Q);
10474
+ app.component("m-fields-code-select-col", _sfc_main$M);
10475
+ app.component("m-fields-event-select", _sfc_main$E);
10476
+ app.component("m-fields-data-source-fields", _sfc_main$L);
10477
+ app.component("m-fields-data-source-mocks", _sfc_main$G);
10478
+ app.component("m-fields-key-value", _sfc_main$D);
10479
+ app.component("m-fields-data-source-input", _sfc_main$J);
10480
+ app.component("m-fields-data-source-select", _sfc_main$F);
10481
+ app.component("m-fields-data-source-methods", _sfc_main$I);
10482
+ app.component("m-fields-data-source-method-select", _sfc_main$H);
10483
+ app.component("m-fields-data-source-field-select", _sfc_main$K);
10305
10484
  }
10306
10485
  };
10307
10486
 
10308
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$q as CodeBlockList, _sfc_main$p as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$P as CodeSelect, _sfc_main$L as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$l as ContentMenu, _sfc_main$J as DataSourceFieldSelect, _sfc_main$K as DataSourceFields, _sfc_main$I as DataSourceInput, _sfc_main$G as DataSourceMethodSelect, _sfc_main$H as DataSourceMethods, _sfc_main$F as DataSourceMocks, _sfc_main$E as DataSourceSelect, DepTargetType, DragType, _sfc_main$D as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$M as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$u as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$S as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$w as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
10487
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$r as CodeBlockList, _sfc_main$q as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$k as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DepTargetType, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$A as LayoutContainer, _sfc_main$v as PropsPanel, _sfc_main$B as Resizer, _sfc_main$A as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
10309
10488
  //# sourceMappingURL=tmagic-editor.js.map