@tmagic/editor 1.3.15 → 1.4.0-beta.1

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 (121) hide show
  1. package/dist/style.css +17 -3
  2. package/dist/tmagic-editor.js +875 -530
  3. package/dist/tmagic-editor.umd.cjs +891 -545
  4. package/package.json +23 -21
  5. package/src/Editor.vue +8 -0
  6. package/src/components/CodeBlockEditor.vue +50 -24
  7. package/src/components/FloatingBox.vue +53 -12
  8. package/src/fields/Code.vue +12 -10
  9. package/src/fields/CodeLink.vue +9 -9
  10. package/src/fields/CodeSelect.vue +7 -5
  11. package/src/fields/CodeSelectCol.vue +1 -1
  12. package/src/fields/DataSourceFieldSelect.vue +118 -27
  13. package/src/fields/DataSourceFields.vue +10 -3
  14. package/src/fields/DataSourceInput.vue +7 -7
  15. package/src/fields/DataSourceMethodSelect.vue +1 -1
  16. package/src/fields/DataSourceMethods.vue +3 -3
  17. package/src/fields/DataSourceMocks.vue +3 -3
  18. package/src/fields/DataSourceSelect.vue +6 -18
  19. package/src/fields/EventSelect.vue +1 -1
  20. package/src/fields/KeyValue.vue +8 -8
  21. package/src/fields/PageFragmentSelect.vue +1 -1
  22. package/src/fields/UISelect.vue +5 -5
  23. package/src/hooks/use-code-block-edit.ts +0 -1
  24. package/src/index.ts +3 -2
  25. package/src/layouts/NavMenu.vue +21 -2
  26. package/src/layouts/sidebar/Sidebar.vue +16 -1
  27. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
  28. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +3 -0
  29. package/src/services/BaseService.ts +5 -2
  30. package/src/services/codeBlock.ts +14 -8
  31. package/src/services/dataSource.ts +39 -26
  32. package/src/services/editor.ts +46 -25
  33. package/src/services/events.ts +4 -4
  34. package/src/services/props.ts +44 -35
  35. package/src/services/stageOverlay.ts +14 -7
  36. package/src/services/storage.ts +14 -8
  37. package/src/services/ui.ts +20 -19
  38. package/src/theme/code-editor.scss +6 -0
  39. package/src/theme/component-list-panel.scss +79 -71
  40. package/src/theme/floating-box.scss +2 -0
  41. package/src/theme/layer-panel.scss +1 -0
  42. package/src/theme/sidebar.scss +6 -3
  43. package/src/type.ts +82 -37
  44. package/src/utils/operator.ts +37 -39
  45. package/src/utils/props.ts +174 -37
  46. package/types/components/CodeBlockEditor.vue.d.ts +4 -4
  47. package/types/components/CodeParams.vue.d.ts +5 -5
  48. package/types/components/ContentMenu.vue.d.ts +12 -12
  49. package/types/components/FloatingBox.vue.d.ts +14 -12
  50. package/types/components/Icon.vue.d.ts +3 -3
  51. package/types/components/Resizer.vue.d.ts +3 -3
  52. package/types/components/ScrollBar.vue.d.ts +3 -3
  53. package/types/components/ScrollViewer.vue.d.ts +12 -12
  54. package/types/components/SearchInput.vue.d.ts +1 -1
  55. package/types/components/SplitView.vue.d.ts +11 -11
  56. package/types/components/ToolButton.vue.d.ts +13 -13
  57. package/types/components/Tree.vue.d.ts +24 -14
  58. package/types/components/TreeNode.vue.d.ts +22 -12
  59. package/types/fields/Code.vue.d.ts +14 -14
  60. package/types/fields/CodeLink.vue.d.ts +6 -10
  61. package/types/fields/CodeSelect.vue.d.ts +14 -14
  62. package/types/fields/CodeSelectCol.vue.d.ts +11 -11
  63. package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
  64. package/types/fields/DataSourceFields.vue.d.ts +11 -11
  65. package/types/fields/DataSourceInput.vue.d.ts +14 -18
  66. package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
  67. package/types/fields/DataSourceMethods.vue.d.ts +11 -11
  68. package/types/fields/DataSourceMocks.vue.d.ts +11 -11
  69. package/types/fields/DataSourceSelect.vue.d.ts +13 -26
  70. package/types/fields/EventSelect.vue.d.ts +3 -3
  71. package/types/fields/KeyValue.vue.d.ts +14 -18
  72. package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
  73. package/types/fields/UISelect.vue.d.ts +8 -4
  74. package/types/hooks/use-code-block-edit.d.ts +51 -89
  75. package/types/hooks/use-data-source-method.d.ts +51 -89
  76. package/types/hooks/use-node-status.d.ts +6 -1
  77. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  78. package/types/icons/CenterIcon.vue.d.ts +1 -1
  79. package/types/icons/CodeIcon.vue.d.ts +1 -1
  80. package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
  81. package/types/icons/PinIcon.vue.d.ts +1 -1
  82. package/types/icons/PinnedIcon.vue.d.ts +1 -1
  83. package/types/index.d.ts +1 -0
  84. package/types/layouts/AddPageBox.vue.d.ts +3 -3
  85. package/types/layouts/CodeEditor.vue.d.ts +12 -12
  86. package/types/layouts/Framework.vue.d.ts +9 -9
  87. package/types/layouts/NavMenu.vue.d.ts +11 -11
  88. package/types/layouts/PropsPanel.vue.d.ts +193 -243
  89. package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
  90. package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
  91. package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
  92. package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
  93. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
  94. package/types/layouts/sidebar/Sidebar.vue.d.ts +12 -12
  95. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
  96. package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
  97. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
  98. package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
  99. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
  100. package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
  101. package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
  102. package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
  103. package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
  104. package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
  105. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  106. package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
  107. package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
  108. package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
  109. package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
  110. package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
  111. package/types/services/BaseService.d.ts +5 -2
  112. package/types/services/codeBlock.d.ts +8 -0
  113. package/types/services/dataSource.d.ts +9 -2
  114. package/types/services/editor.d.ts +8 -1
  115. package/types/services/props.d.ts +15 -22
  116. package/types/services/stageOverlay.d.ts +8 -1
  117. package/types/services/storage.d.ts +8 -0
  118. package/types/services/ui.d.ts +15 -9
  119. package/types/type.d.ts +51 -32
  120. package/types/utils/operator.d.ts +1 -1
  121. package/types/utils/props.d.ts +2 -13
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('moveable'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', 'moveable', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.table, global.utils, global.Gesto, global.VanillaMoveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
- })(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto, VanillaMoveable, dep, StageCore, events, core, KeyController) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('moveable'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', 'moveable', '@tmagic/table', '@tmagic/utils', 'gesto', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.VanillaMoveable, global.table, global.utils, global.Gesto, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, VanillaMoveable, table, utils, Gesto, dep, StageCore, events, core, KeyController) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -32,7 +32,7 @@
32
32
  emmetMonacoEs.emmetHTML(monaco__namespace);
33
33
  emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
34
34
 
35
- const _hoisted_1$t = {
35
+ const _hoisted_1$u = {
36
36
  class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
37
37
  };
38
38
  const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
@@ -193,7 +193,7 @@
193
193
  }
194
194
  });
195
195
  return (_ctx, _cache) => {
196
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
196
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$u, [
197
197
  (vue.openBlock(), vue.createBlock(vue.Teleport, {
198
198
  to: "body",
199
199
  disabled: !fullScreen.value
@@ -223,7 +223,7 @@
223
223
 
224
224
  const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
225
225
  ...{
226
- name: "MEditorCode"
226
+ name: "MFieldsVsCode"
227
227
  },
228
228
  __name: "Code",
229
229
  props: {
@@ -263,7 +263,7 @@
263
263
 
264
264
  const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
265
265
  ...{
266
- name: "MEditorCodeLink"
266
+ name: "MFieldsCodeLink"
267
267
  },
268
268
  __name: "CodeLink",
269
269
  props: {
@@ -343,7 +343,7 @@
343
343
 
344
344
  const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
345
345
  ...{
346
- name: "MEditorCodeSelect"
346
+ name: "MFieldsCodeSelect"
347
347
  },
348
348
  __name: "CodeSelect",
349
349
  props: {
@@ -459,11 +459,150 @@
459
459
  }
460
460
  });
461
461
 
462
+ const _hoisted_1$t = { class: "m-editor-float-box-body" };
463
+ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
464
+ __name: "FloatingBox",
465
+ props: {
466
+ visible: { type: Boolean, default: false },
467
+ position: { default: () => ({ left: 0, top: 0 }) },
468
+ rect: { default: () => ({ width: "auto", height: "auto" }) },
469
+ title: { default: "" },
470
+ beforeClose: {}
471
+ },
472
+ emits: ["update:visible"],
473
+ setup(__props, { expose: __expose, emit: __emit }) {
474
+ const props = __props;
475
+ const emit = __emit;
476
+ const target = vue.ref();
477
+ const dragTarget = vue.ref();
478
+ const zIndex = design.useZIndex();
479
+ const curZIndex = vue.ref(zIndex.nextZIndex());
480
+ const rect = vue.ref({
481
+ width: props.rect.width,
482
+ height: props.rect.height
483
+ });
484
+ vue.watchEffect(() => {
485
+ rect.value = {
486
+ width: props.rect.width,
487
+ height: props.rect.height
488
+ };
489
+ });
490
+ const style = vue.computed(() => ({
491
+ left: `${props.position.left}px`,
492
+ top: `${props.position.top}px`,
493
+ width: typeof rect.value.width === "string" ? rect.value.width : `${rect.value.width}px`,
494
+ height: typeof rect.value.height === "string" ? rect.value.height : `${rect.value.height}px`
495
+ }));
496
+ let moveable = null;
497
+ const initMoveable = () => {
498
+ moveable = new VanillaMoveable(globalThis.document.body, {
499
+ className: "m-editor-floating-box-moveable",
500
+ target: target.value,
501
+ draggable: true,
502
+ resizable: true,
503
+ edge: true,
504
+ keepRatio: false,
505
+ origin: false,
506
+ snappable: true,
507
+ dragTarget: dragTarget.value,
508
+ dragTargetSelf: false,
509
+ linePadding: 10,
510
+ controlPadding: 10,
511
+ bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
512
+ });
513
+ moveable.on("drag", (e) => {
514
+ e.target.style.transform = e.transform;
515
+ });
516
+ moveable.on("resize", (e) => {
517
+ rect.value.width = e.width;
518
+ rect.value.height = e.height;
519
+ e.target.style.width = `${e.width}px`;
520
+ e.target.style.height = `${e.height}px`;
521
+ e.target.style.transform = e.drag.transform;
522
+ });
523
+ };
524
+ const destroyMoveable = () => {
525
+ moveable?.destroy();
526
+ moveable = null;
527
+ };
528
+ vue.watch(
529
+ () => props.visible,
530
+ async (visible) => {
531
+ if (visible) {
532
+ await vue.nextTick();
533
+ initMoveable();
534
+ } else {
535
+ destroyMoveable();
536
+ }
537
+ },
538
+ {
539
+ immediate: true
540
+ }
541
+ );
542
+ vue.onBeforeUnmount(() => {
543
+ destroyMoveable();
544
+ });
545
+ const hide = (cancel) => {
546
+ if (cancel !== false) {
547
+ emit("update:visible", false);
548
+ }
549
+ };
550
+ const closeHandler = () => {
551
+ if (typeof props.beforeClose === "function") {
552
+ props.beforeClose(hide);
553
+ } else {
554
+ hide();
555
+ }
556
+ };
557
+ const nextZIndex = () => {
558
+ curZIndex.value = zIndex.nextZIndex();
559
+ };
560
+ __expose({
561
+ target
562
+ });
563
+ return (_ctx, _cache) => {
564
+ return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
565
+ key: 0,
566
+ to: "body"
567
+ }, [
568
+ vue.createElementVNode("div", {
569
+ ref_key: "target",
570
+ ref: target,
571
+ class: "m-editor-float-box",
572
+ style: vue.normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
573
+ onMousedown: nextZIndex
574
+ }, [
575
+ vue.createElementVNode("div", {
576
+ ref_key: "dragTarget",
577
+ ref: dragTarget,
578
+ class: "m-editor-float-box-title"
579
+ }, [
580
+ vue.renderSlot(_ctx.$slots, "title", {}, () => [
581
+ vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
582
+ ]),
583
+ vue.createElementVNode("div", null, [
584
+ vue.createVNode(vue.unref(design.TMagicButton), {
585
+ link: "",
586
+ size: "small",
587
+ icon: vue.unref(iconsVue.Close),
588
+ onClick: closeHandler
589
+ }, null, 8, ["icon"])
590
+ ])
591
+ ], 512),
592
+ vue.createElementVNode("div", _hoisted_1$t, [
593
+ vue.renderSlot(_ctx.$slots, "body")
594
+ ])
595
+ ], 36)
596
+ ])) : vue.createCommentVNode("", true);
597
+ };
598
+ }
599
+ });
600
+
462
601
  const _hoisted_1$s = { style: { "display": "flex", "margin-bottom": "10px" } };
463
602
  const _hoisted_2$k = { style: { "flex": "1" } };
464
603
  const _hoisted_3$8 = { style: { "flex": "1" } };
465
604
  const _hoisted_4$7 = { class: "dialog-footer" };
466
- const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
605
+ const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
467
606
  ...{
468
607
  name: "MEditorCodeBlockEditor"
469
608
  },
@@ -629,14 +768,30 @@
629
768
  changedValue.value && submitForm(changedValue.value);
630
769
  done();
631
770
  }).catch((action) => {
632
- done(action === "close");
771
+ done(action === "cancel");
633
772
  });
634
773
  };
635
774
  const closedHandler = () => {
636
775
  changedValue.value = void 0;
637
776
  };
777
+ const boxVisible = vue.ref(false);
778
+ const editVisible = vue.ref(false);
779
+ const floatingBoxBody = vue.ref();
780
+ const boxPosition = vue.computed(() => {
781
+ const columnWidth2 = services?.uiService?.get("columnWidth");
782
+ const navMenuRect = services?.uiService?.get("navMenuRect");
783
+ return {
784
+ left: columnWidth2?.left ?? 0,
785
+ top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
786
+ };
787
+ });
638
788
  __expose({
639
- show() {
789
+ async show() {
790
+ if (props.slideType !== "box") {
791
+ boxVisible.value = true;
792
+ }
793
+ await vue.nextTick();
794
+ editVisible.value = true;
640
795
  fomDrawer.value?.show();
641
796
  },
642
797
  hide() {
@@ -645,41 +800,61 @@
645
800
  });
646
801
  return (_ctx, _cache) => {
647
802
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
648
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.slideType === "box" ? vue.unref(form.MFormBox) : vue.unref(form.MFormDrawer)), {
649
- class: "m-editor-code-block-editor",
650
- ref_key: "fomDrawer",
651
- ref: fomDrawer,
652
- "label-width": "80px",
653
- "close-on-press-escape": false,
654
- title: _ctx.content.name,
655
- width: size.value,
656
- config: functionConfig.value,
657
- values: _ctx.content,
658
- disabled: _ctx.disabled,
659
- "before-close": beforeClose,
660
- onChange: changeHandler,
661
- onSubmit: submitForm,
662
- onError: errorHandler,
663
- onOpen: openHandler,
664
- onClosed: closedHandler
803
+ vue.createVNode(_sfc_main$Q, {
804
+ visible: boxVisible.value,
805
+ "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
806
+ title: "代码编辑",
807
+ position: boxPosition.value,
808
+ "before-close": beforeClose
665
809
  }, {
666
- left: vue.withCtx(() => [
667
- vue.createVNode(vue.unref(design.TMagicButton), {
668
- type: "primary",
669
- link: "",
670
- onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
671
- }, {
672
- default: vue.withCtx(() => [
673
- vue.createTextVNode("查看修改")
674
- ]),
675
- _: 1
676
- })
810
+ body: vue.withCtx(() => [
811
+ vue.createElementVNode("div", {
812
+ ref_key: "floatingBoxBody",
813
+ ref: floatingBoxBody
814
+ }, null, 512)
677
815
  ]),
678
816
  _: 1
679
- }, 40, ["title", "width", "config", "values", "disabled"])),
817
+ }, 8, ["visible", "position"]),
818
+ editVisible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
819
+ key: 0,
820
+ to: floatingBoxBody.value,
821
+ disabled: _ctx.slideType === "box"
822
+ }, [
823
+ vue.createVNode(vue.unref(form.MFormBox), {
824
+ class: "m-editor-code-block-editor",
825
+ ref_key: "fomDrawer",
826
+ ref: fomDrawer,
827
+ "label-width": "80px",
828
+ "close-on-press-escape": false,
829
+ title: _ctx.content.name,
830
+ width: size.value,
831
+ config: functionConfig.value,
832
+ values: _ctx.content,
833
+ disabled: _ctx.disabled,
834
+ onChange: changeHandler,
835
+ onSubmit: submitForm,
836
+ onError: errorHandler,
837
+ onOpen: openHandler,
838
+ onClosed: closedHandler
839
+ }, {
840
+ left: vue.withCtx(() => [
841
+ vue.createVNode(vue.unref(design.TMagicButton), {
842
+ type: "primary",
843
+ link: "",
844
+ onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = true)
845
+ }, {
846
+ default: vue.withCtx(() => [
847
+ vue.createTextVNode("查看修改")
848
+ ]),
849
+ _: 1
850
+ })
851
+ ]),
852
+ _: 1
853
+ }, 8, ["title", "width", "config", "values", "disabled"])
854
+ ], 8, ["to", "disabled"])) : vue.createCommentVNode("", true),
680
855
  vue.createVNode(vue.unref(design.TMagicDialog), {
681
856
  modelValue: difVisible.value,
682
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => difVisible.value = $event),
857
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => difVisible.value = $event),
683
858
  title: "查看修改",
684
859
  fullscreen: ""
685
860
  }, {
@@ -687,7 +862,7 @@
687
862
  vue.createElementVNode("span", _hoisted_4$7, [
688
863
  vue.createVNode(vue.unref(design.TMagicButton), {
689
864
  size: "small",
690
- onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = false)
865
+ onClick: _cache[2] || (_cache[2] = ($event) => difVisible.value = false)
691
866
  }, {
692
867
  default: vue.withCtx(() => [
693
868
  vue.createTextVNode("取消")
@@ -1146,6 +1321,9 @@
1146
1321
  });
1147
1322
  });
1148
1323
  }
1324
+ /**
1325
+ * @deprecated 请使用usePlugin代替
1326
+ */
1149
1327
  use(options) {
1150
1328
  Object.entries(options).forEach(([methodName2, method]) => {
1151
1329
  if (typeof method === "function")
@@ -1177,6 +1355,23 @@
1177
1355
  }
1178
1356
  }
1179
1357
 
1358
+ const canUsePluginMethods$6 = {
1359
+ async: [],
1360
+ sync: [
1361
+ "getFormConfig",
1362
+ "setFormConfig",
1363
+ "getFormValue",
1364
+ "setFormValue",
1365
+ "getFormEvent",
1366
+ "setFormEvent",
1367
+ "getFormMethod",
1368
+ "setFormMethod",
1369
+ "add",
1370
+ "update",
1371
+ "remove",
1372
+ "createId"
1373
+ ]
1374
+ };
1180
1375
  class DataSource extends BaseService {
1181
1376
  state = vue.reactive({
1182
1377
  datasourceTypeList: [],
@@ -1188,20 +1383,7 @@
1188
1383
  methods: {}
1189
1384
  });
1190
1385
  constructor() {
1191
- super([
1192
- { name: "getFormConfig", isAsync: false },
1193
- { name: "setFormConfig", isAsync: false },
1194
- { name: "getFormValue", isAsync: false },
1195
- { name: "setFormValue", isAsync: false },
1196
- { name: "getFormEvent", isAsync: false },
1197
- { name: "setFormEvent", isAsync: false },
1198
- { name: "getFormMethod", isAsync: false },
1199
- { name: "setFormMethod", isAsync: false },
1200
- { name: "add", isAsync: false },
1201
- { name: "update", isAsync: false },
1202
- { name: "remove", isAsync: false },
1203
- { name: "createId", isAsync: false }
1204
- ]);
1386
+ super(canUsePluginMethods$6.sync.map((methodName) => ({ name: methodName, isAsync: false })));
1205
1387
  }
1206
1388
  set(name, value) {
1207
1389
  this.state[name] = value;
@@ -1210,28 +1392,28 @@
1210
1392
  return this.state[name];
1211
1393
  }
1212
1394
  getFormConfig(type = "base") {
1213
- return getFormConfig(type, this.get("configs"));
1395
+ return getFormConfig(utils.toLine(type), this.get("configs"));
1214
1396
  }
1215
1397
  setFormConfig(type, config) {
1216
- this.get("configs")[type] = config;
1398
+ this.get("configs")[utils.toLine(type)] = config;
1217
1399
  }
1218
1400
  getFormValue(type = "base") {
1219
- return getFormValue(type, this.get("values")[type]);
1401
+ return getFormValue(utils.toLine(type), this.get("values")[type]);
1220
1402
  }
1221
1403
  setFormValue(type, value) {
1222
- this.get("values")[type] = value;
1404
+ this.get("values")[utils.toLine(type)] = value;
1223
1405
  }
1224
1406
  getFormEvent(type = "base") {
1225
- return this.get("events")[type] || [];
1407
+ return this.get("events")[utils.toLine(type)] || [];
1226
1408
  }
1227
1409
  setFormEvent(type, value = []) {
1228
- this.get("events")[type] = value;
1410
+ this.get("events")[utils.toLine(type)] = value;
1229
1411
  }
1230
1412
  getFormMethod(type = "base") {
1231
- return this.get("methods")[type] || [];
1413
+ return this.get("methods")[utils.toLine(type)] || [];
1232
1414
  }
1233
1415
  setFormMethod(type, value = []) {
1234
- this.get("methods")[type] = value;
1416
+ this.get("methods")[utils.toLine(type)] = value;
1235
1417
  }
1236
1418
  add(config) {
1237
1419
  const newConfig = {
@@ -1255,6 +1437,9 @@
1255
1437
  dataSources.splice(index, 1);
1256
1438
  this.emit("remove", id);
1257
1439
  }
1440
+ createId() {
1441
+ return `ds_${utils.guid()}`;
1442
+ }
1258
1443
  getDataSourceById(id) {
1259
1444
  return this.get("dataSources").find((ds) => ds.id === id);
1260
1445
  }
@@ -1266,8 +1451,8 @@
1266
1451
  this.resetState();
1267
1452
  this.removeAllPlugins();
1268
1453
  }
1269
- createId() {
1270
- return `ds_${utils.guid()}`;
1454
+ usePlugin(options) {
1455
+ super.usePlugin(options);
1271
1456
  }
1272
1457
  }
1273
1458
  const dataSourceService = new DataSource();
@@ -1290,7 +1475,6 @@
1290
1475
  ];
1291
1476
  const styleTabConfig = {
1292
1477
  title: "样式",
1293
- labelWidth: "80px",
1294
1478
  items: [
1295
1479
  {
1296
1480
  name: "style",
@@ -1300,29 +1484,58 @@
1300
1484
  legend: "位置",
1301
1485
  items: [
1302
1486
  {
1487
+ type: "data-source-field-select",
1303
1488
  name: "position",
1304
- type: "checkbox",
1305
- activeValue: "fixed",
1306
- inactiveValue: "absolute",
1307
- defaultValue: "absolute",
1308
- text: "固定定位"
1489
+ text: "固定定位",
1490
+ checkStrictly: false,
1491
+ dataSourceFieldType: ["string"],
1492
+ fieldConfig: {
1493
+ type: "checkbox",
1494
+ activeValue: "fixed",
1495
+ inactiveValue: "absolute",
1496
+ defaultValue: "absolute"
1497
+ }
1309
1498
  },
1310
1499
  {
1500
+ type: "data-source-field-select",
1311
1501
  name: "left",
1312
- text: "left"
1502
+ text: "left",
1503
+ checkStrictly: false,
1504
+ dataSourceFieldType: ["string", "number"],
1505
+ fieldConfig: {
1506
+ type: "text"
1507
+ }
1313
1508
  },
1314
1509
  {
1510
+ type: "data-source-field-select",
1315
1511
  name: "top",
1316
1512
  text: "top",
1513
+ checkStrictly: false,
1514
+ dataSourceFieldType: ["string", "number"],
1515
+ fieldConfig: {
1516
+ type: "text"
1517
+ },
1317
1518
  disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
1318
1519
  },
1319
1520
  {
1521
+ type: "data-source-field-select",
1320
1522
  name: "right",
1321
- text: "right"
1523
+ text: "right",
1524
+ checkStrictly: false,
1525
+ dataSourceFieldType: ["string", "number"],
1526
+ fieldConfig: {
1527
+ type: "text"
1528
+ }
1322
1529
  },
1323
1530
  {
1531
+ type: "data-source-field-select",
1324
1532
  name: "bottom",
1325
1533
  text: "bottom",
1534
+ checkStrictly: false,
1535
+ dataSourceFieldType: ["string", "number"],
1536
+ fieldConfig: {
1537
+ type: "text"
1538
+ },
1326
1539
  disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
1327
1540
  }
1328
1541
  ]
@@ -1332,12 +1545,42 @@
1332
1545
  legend: "盒子",
1333
1546
  items: [
1334
1547
  {
1548
+ type: "data-source-field-select",
1335
1549
  name: "width",
1336
- text: "宽度"
1550
+ text: "宽度",
1551
+ checkStrictly: false,
1552
+ dataSourceFieldType: ["string", "number"],
1553
+ fieldConfig: {
1554
+ type: "text"
1555
+ }
1337
1556
  },
1338
1557
  {
1558
+ type: "data-source-field-select",
1339
1559
  name: "height",
1340
- text: "高度"
1560
+ text: "高度",
1561
+ checkStrictly: false,
1562
+ dataSourceFieldType: ["string", "number"],
1563
+ fieldConfig: {
1564
+ type: "text"
1565
+ }
1566
+ },
1567
+ {
1568
+ type: "data-source-field-select",
1569
+ text: "overflow",
1570
+ name: "overflow",
1571
+ checkStrictly: false,
1572
+ dataSourceFieldType: ["string"],
1573
+ fieldConfig: {
1574
+ type: "select",
1575
+ options: [
1576
+ { text: "visible", value: "visible" },
1577
+ { text: "hidden", value: "hidden" },
1578
+ { text: "clip", value: "clip" },
1579
+ { text: "scroll", value: "scroll" },
1580
+ { text: "auto", value: "auto" },
1581
+ { text: "overlay", value: "overlay" }
1582
+ ]
1583
+ }
1341
1584
  }
1342
1585
  ]
1343
1586
  },
@@ -1346,32 +1589,48 @@
1346
1589
  legend: "边框",
1347
1590
  items: [
1348
1591
  {
1592
+ type: "data-source-field-select",
1349
1593
  name: "borderWidth",
1350
1594
  text: "宽度",
1351
- defaultValue: "0"
1595
+ defaultValue: "0",
1596
+ checkStrictly: false,
1597
+ dataSourceFieldType: ["string", "number"],
1598
+ fieldConfig: {
1599
+ type: "text"
1600
+ }
1352
1601
  },
1353
1602
  {
1603
+ type: "data-source-field-select",
1354
1604
  name: "borderColor",
1355
1605
  text: "颜色",
1356
- type: "colorPicker"
1606
+ checkStrictly: false,
1607
+ dataSourceFieldType: ["string"],
1608
+ fieldConfig: {
1609
+ type: "text"
1610
+ }
1357
1611
  },
1358
1612
  {
1613
+ type: "data-source-field-select",
1359
1614
  name: "borderStyle",
1360
1615
  text: "样式",
1361
- type: "select",
1362
1616
  defaultValue: "none",
1363
- options: [
1364
- { text: "none", value: "none" },
1365
- { text: "hidden", value: "hidden" },
1366
- { text: "dotted", value: "dotted" },
1367
- { text: "dashed", value: "dashed" },
1368
- { text: "solid", value: "solid" },
1369
- { text: "double", value: "double" },
1370
- { text: "groove", value: "groove" },
1371
- { text: "ridge", value: "ridge" },
1372
- { text: "inset", value: "inset" },
1373
- { text: "outset", value: "outset" }
1374
- ]
1617
+ checkStrictly: false,
1618
+ dataSourceFieldType: ["string"],
1619
+ fieldConfig: {
1620
+ type: "select",
1621
+ options: [
1622
+ { text: "none", value: "none" },
1623
+ { text: "hidden", value: "hidden" },
1624
+ { text: "dotted", value: "dotted" },
1625
+ { text: "dashed", value: "dashed" },
1626
+ { text: "solid", value: "solid" },
1627
+ { text: "double", value: "double" },
1628
+ { text: "groove", value: "groove" },
1629
+ { text: "ridge", value: "ridge" },
1630
+ { text: "inset", value: "inset" },
1631
+ { text: "outset", value: "outset" }
1632
+ ]
1633
+ }
1375
1634
  }
1376
1635
  ]
1377
1636
  },
@@ -1380,31 +1639,53 @@
1380
1639
  legend: "背景",
1381
1640
  items: [
1382
1641
  {
1642
+ type: "data-source-field-select",
1383
1643
  name: "backgroundImage",
1384
- text: "背景图"
1644
+ text: "背景图",
1645
+ checkStrictly: false,
1646
+ dataSourceFieldType: ["string"],
1647
+ fieldConfig: {
1648
+ type: "text"
1649
+ }
1385
1650
  },
1386
1651
  {
1652
+ type: "data-source-field-select",
1387
1653
  name: "backgroundColor",
1388
1654
  text: "背景颜色",
1389
- type: "colorPicker"
1655
+ checkStrictly: false,
1656
+ dataSourceFieldType: ["string"],
1657
+ fieldConfig: {
1658
+ type: "colorPicker"
1659
+ }
1390
1660
  },
1391
1661
  {
1662
+ type: "data-source-field-select",
1392
1663
  name: "backgroundRepeat",
1393
1664
  text: "背景图重复",
1394
- type: "select",
1395
1665
  defaultValue: "no-repeat",
1396
- options: [
1397
- { text: "repeat", value: "repeat" },
1398
- { text: "repeat-x", value: "repeat-x" },
1399
- { text: "repeat-y", value: "repeat-y" },
1400
- { text: "no-repeat", value: "no-repeat" },
1401
- { text: "inherit", value: "inherit" }
1402
- ]
1666
+ checkStrictly: false,
1667
+ dataSourceFieldType: ["string"],
1668
+ fieldConfig: {
1669
+ type: "select",
1670
+ options: [
1671
+ { text: "repeat", value: "repeat" },
1672
+ { text: "repeat-x", value: "repeat-x" },
1673
+ { text: "repeat-y", value: "repeat-y" },
1674
+ { text: "no-repeat", value: "no-repeat" },
1675
+ { text: "inherit", value: "inherit" }
1676
+ ]
1677
+ }
1403
1678
  },
1404
1679
  {
1680
+ type: "data-source-field-select",
1405
1681
  name: "backgroundSize",
1406
1682
  text: "背景图大小",
1407
- defaultValue: "100% 100%"
1683
+ defaultValue: "100% 100%",
1684
+ checkStrictly: false,
1685
+ dataSourceFieldType: ["string"],
1686
+ fieldConfig: {
1687
+ type: "text"
1688
+ }
1408
1689
  }
1409
1690
  ]
1410
1691
  },
@@ -1413,17 +1694,34 @@
1413
1694
  legend: "字体",
1414
1695
  items: [
1415
1696
  {
1697
+ type: "data-source-field-select",
1416
1698
  name: "color",
1417
1699
  text: "颜色",
1418
- type: "colorPicker"
1700
+ checkStrictly: false,
1701
+ dataSourceFieldType: ["string"],
1702
+ fieldConfig: {
1703
+ type: "colorPicker"
1704
+ }
1419
1705
  },
1420
1706
  {
1707
+ type: "data-source-field-select",
1421
1708
  name: "fontSize",
1422
- text: "大小"
1709
+ text: "大小",
1710
+ checkStrictly: false,
1711
+ dataSourceFieldType: ["string", "number"],
1712
+ fieldConfig: {
1713
+ type: "text"
1714
+ }
1423
1715
  },
1424
1716
  {
1717
+ type: "data-source-field-select",
1425
1718
  name: "fontWeight",
1426
- text: "粗细"
1719
+ text: "粗细",
1720
+ checkStrictly: false,
1721
+ dataSourceFieldType: ["string", "number"],
1722
+ fieldConfig: {
1723
+ type: "text"
1724
+ }
1427
1725
  }
1428
1726
  ]
1429
1727
  },
@@ -1433,12 +1731,24 @@
1433
1731
  name: "transform",
1434
1732
  items: [
1435
1733
  {
1734
+ type: "data-source-field-select",
1436
1735
  name: "rotate",
1437
- text: "旋转角度"
1736
+ text: "旋转角度",
1737
+ checkStrictly: false,
1738
+ dataSourceFieldType: ["string"],
1739
+ fieldConfig: {
1740
+ type: "text"
1741
+ }
1438
1742
  },
1439
1743
  {
1744
+ type: "data-source-field-select",
1440
1745
  name: "scale",
1441
- text: "缩放"
1746
+ text: "缩放",
1747
+ checkStrictly: false,
1748
+ dataSourceFieldType: ["number", "string"],
1749
+ fieldConfig: {
1750
+ type: "text"
1751
+ }
1442
1752
  }
1443
1753
  ]
1444
1754
  }
@@ -1464,13 +1774,11 @@
1464
1774
  {
1465
1775
  name: "created",
1466
1776
  text: "created",
1467
- labelWidth: "100px",
1468
1777
  type: "code-select"
1469
1778
  },
1470
1779
  {
1471
1780
  name: "mounted",
1472
1781
  text: "mounted",
1473
- labelWidth: "100px",
1474
1782
  type: "code-select"
1475
1783
  }
1476
1784
  ]
@@ -1493,14 +1801,22 @@
1493
1801
  type: "data-source-field-select",
1494
1802
  name: "field",
1495
1803
  value: "key",
1496
- label: "字段"
1804
+ label: "字段",
1805
+ checkStrictly: false,
1806
+ dataSourceFieldType: ["string", "number", "boolean", "any"]
1497
1807
  },
1498
1808
  {
1499
1809
  type: "select",
1500
1810
  options: (mForm, { model }) => {
1501
- const [id, field] = model.field;
1811
+ const [id, ...fieldNames] = model.field;
1502
1812
  const ds = dataSourceService.getDataSourceById(id);
1503
- const type = ds?.fields.find((f) => f.name === field)?.type;
1813
+ let fields = ds?.fields || [];
1814
+ let type = "";
1815
+ (fieldNames || []).forEach((fieldName) => {
1816
+ const field = fields.find((f) => f.name === fieldName);
1817
+ fields = field?.fields || [];
1818
+ type = field?.type || "";
1819
+ });
1504
1820
  if (type === "array") {
1505
1821
  return arrayOptions;
1506
1822
  }
@@ -1527,9 +1843,15 @@
1527
1843
  {
1528
1844
  name: "value",
1529
1845
  type: (mForm, { model }) => {
1530
- const [id, field] = model.field;
1846
+ const [id, ...fieldNames] = model.field;
1531
1847
  const ds = dataSourceService.getDataSourceById(id);
1532
- const type = ds?.fields.find((f) => f.name === field)?.type;
1848
+ let fields = ds?.fields || [];
1849
+ let type = "";
1850
+ (fieldNames || []).forEach((fieldName) => {
1851
+ const field = fields.find((f) => f.name === fieldName);
1852
+ fields = field?.fields || [];
1853
+ type = field?.type || "";
1854
+ });
1533
1855
  if (type === "number") {
1534
1856
  return "number";
1535
1857
  }
@@ -1557,13 +1879,13 @@
1557
1879
  }
1558
1880
  ]
1559
1881
  };
1560
- const fillConfig = (config = []) => [
1882
+ const fillConfig = (config = [], labelWidth = "80px") => [
1561
1883
  {
1562
1884
  type: "tab",
1885
+ labelWidth,
1563
1886
  items: [
1564
1887
  {
1565
1888
  title: "属性",
1566
- labelWidth: "80px",
1567
1889
  items: [
1568
1890
  // 组件类型,必须要有
1569
1891
  {
@@ -1900,6 +2222,17 @@
1900
2222
  }
1901
2223
  const depService = new Dep();
1902
2224
 
2225
+ const canUsePluginMethods$5 = {
2226
+ async: [
2227
+ "setPropsConfig",
2228
+ "getPropsConfig",
2229
+ "setPropsValue",
2230
+ "getPropsValue",
2231
+ "fillConfig",
2232
+ "getDefaultPropsValue"
2233
+ ],
2234
+ sync: ["createId", "setNewItemId"]
2235
+ };
1903
2236
  class Props extends BaseService {
1904
2237
  state = vue.reactive({
1905
2238
  propsConfigMap: {},
@@ -1908,14 +2241,8 @@
1908
2241
  });
1909
2242
  constructor() {
1910
2243
  super([
1911
- { name: "setPropsConfig", isAsync: true },
1912
- { name: "getPropsConfig", isAsync: true },
1913
- { name: "setPropsValue", isAsync: true },
1914
- { name: "getPropsValue", isAsync: true },
1915
- { name: "createId", isAsync: false },
1916
- { name: "setNewItemId", isAsync: true },
1917
- { name: "fillConfig", isAsync: true },
1918
- { name: "getDefaultPropsValue", isAsync: true }
2244
+ ...canUsePluginMethods$5.async.map((methodName) => ({ name: methodName, isAsync: true })),
2245
+ ...canUsePluginMethods$5.sync.map((methodName) => ({ name: methodName, isAsync: false }))
1919
2246
  ]);
1920
2247
  }
1921
2248
  setPropsConfigs(configs) {
@@ -1924,16 +2251,11 @@
1924
2251
  });
1925
2252
  this.emit("props-configs-change");
1926
2253
  }
1927
- async fillConfig(config) {
1928
- return fillConfig(config);
2254
+ async fillConfig(config, labelWidth) {
2255
+ return fillConfig(config, typeof labelWidth !== "function" ? labelWidth : "80px");
1929
2256
  }
1930
- /**
1931
- * 为指定类型组件设置组件属性表单配置
1932
- * @param type 组件类型
1933
- * @param config 组件属性表单配置
1934
- */
1935
2257
  async setPropsConfig(type, config) {
1936
- this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
2258
+ this.state.propsConfigMap[utils.toLine(type)] = await this.fillConfig(Array.isArray(config) ? config : [config]);
1937
2259
  }
1938
2260
  /**
1939
2261
  * 获取指点类型的组件属性表单配置
@@ -1944,7 +2266,7 @@
1944
2266
  if (type === "area") {
1945
2267
  return await this.getPropsConfig("button");
1946
2268
  }
1947
- return lodashEs.cloneDeep(this.state.propsConfigMap[type] || await this.fillConfig([]));
2269
+ return lodashEs.cloneDeep(this.state.propsConfigMap[utils.toLine(type)] || await this.fillConfig([]));
1948
2270
  }
1949
2271
  setPropsValues(values) {
1950
2272
  Object.keys(values).forEach((type) => {
@@ -1957,14 +2279,15 @@
1957
2279
  * @param value 组件初始值
1958
2280
  */
1959
2281
  async setPropsValue(type, value) {
1960
- this.state.propsValueMap[type] = value;
2282
+ this.state.propsValueMap[utils.toLine(type)] = value;
1961
2283
  }
1962
2284
  /**
1963
2285
  * 获取指定类型的组件初始值
1964
2286
  * @param type 组件类型
1965
2287
  * @returns 组件初始值
1966
2288
  */
1967
- async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
2289
+ async getPropsValue(componentType, { inputEvent, ...defaultValue } = {}) {
2290
+ const type = utils.toLine(componentType);
1968
2291
  if (type === "area") {
1969
2292
  const value = await this.getPropsValue("button");
1970
2293
  value.className = "action-area";
@@ -1974,23 +2297,21 @@
1974
2297
  }
1975
2298
  return value;
1976
2299
  }
1977
- const [id, defaultPropsValue, data] = await Promise.all([
1978
- this.createId(type),
1979
- this.getDefaultPropsValue(type),
1980
- this.setNewItemId(
1981
- lodashEs.cloneDeep({
1982
- type,
1983
- ...defaultValue
1984
- })
1985
- )
1986
- ]);
2300
+ const id = this.createId(type);
2301
+ const defaultPropsValue = this.getDefaultPropsValue(type);
2302
+ const data = this.setNewItemId(
2303
+ lodashEs.cloneDeep({
2304
+ type,
2305
+ ...defaultValue
2306
+ })
2307
+ );
1987
2308
  return {
1988
2309
  id,
1989
2310
  ...defaultPropsValue,
1990
2311
  ...lodashEs.mergeWith({}, lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
1991
2312
  };
1992
2313
  }
1993
- async createId(type) {
2314
+ createId(type) {
1994
2315
  return `${type}_${utils.guid()}`;
1995
2316
  }
1996
2317
  /**
@@ -2000,15 +2321,15 @@
2000
2321
  * @param {Boolean} force 是否强制设置新的ID
2001
2322
  */
2002
2323
  /* eslint no-param-reassign: ["error", { "props": false }] */
2003
- async setNewItemId(config, force = true) {
2324
+ setNewItemId(config, force = true) {
2004
2325
  if (force || editorService.getNodeById(config.id)) {
2005
- const newId = await this.createId(config.type || "component");
2326
+ const newId = this.createId(config.type || "component");
2006
2327
  this.setRelateId(config.id, newId);
2007
2328
  config.id = newId;
2008
2329
  }
2009
2330
  if (config.items && Array.isArray(config.items)) {
2010
2331
  for (const item of config.items) {
2011
- await this.setNewItemId(item);
2332
+ this.setNewItemId(item);
2012
2333
  }
2013
2334
  }
2014
2335
  return config;
@@ -2018,7 +2339,7 @@
2018
2339
  * @param type 组件类型
2019
2340
  * @returns Object
2020
2341
  */
2021
- async getDefaultPropsValue(type) {
2342
+ getDefaultPropsValue(type) {
2022
2343
  return ["page", "container"].includes(type) ? {
2023
2344
  type,
2024
2345
  layout: "absolute",
@@ -2072,6 +2393,9 @@
2072
2393
  this.removeAllListeners();
2073
2394
  this.removeAllPlugins();
2074
2395
  }
2396
+ usePlugin(options) {
2397
+ super.usePlugin(options);
2398
+ }
2075
2399
  /**
2076
2400
  * 获取setNewItemId前后映射关系
2077
2401
  * @param oldId 原组件ID
@@ -2231,18 +2555,15 @@
2231
2555
  Protocol2["BOOLEAN"] = "boolean";
2232
2556
  return Protocol2;
2233
2557
  })(Protocol || {});
2558
+ const canUsePluginMethods$4 = {
2559
+ async: [],
2560
+ sync: ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]
2561
+ };
2234
2562
  class WebStorage extends BaseService {
2235
2563
  storage = globalThis.localStorage;
2236
2564
  namespace = "tmagic";
2237
2565
  constructor() {
2238
- super([
2239
- { name: "getStorage", isAsync: false },
2240
- { name: "getNamespace", isAsync: false },
2241
- { name: "clear", isAsync: false },
2242
- { name: "getItem", isAsync: false },
2243
- { name: "removeItem", isAsync: false },
2244
- { name: "setItem", isAsync: false }
2245
- ]);
2566
+ super(canUsePluginMethods$4.sync.map((methodName) => ({ name: methodName, isAsync: false })));
2246
2567
  }
2247
2568
  /**
2248
2569
  * 获取数据存储对象,可以通过
@@ -2325,6 +2646,9 @@
2325
2646
  this.removeAllListeners();
2326
2647
  this.removeAllPlugins();
2327
2648
  }
2649
+ usePlugin(options) {
2650
+ super.usePlugin(options);
2651
+ }
2328
2652
  getValueAndProtocol(value) {
2329
2653
  let protocol = "";
2330
2654
  if (value === null) {
@@ -2345,6 +2669,33 @@
2345
2669
  }
2346
2670
  const storageService = new WebStorage();
2347
2671
 
2672
+ const canUsePluginMethods$3 = {
2673
+ async: [
2674
+ "getLayout",
2675
+ "highlight",
2676
+ "select",
2677
+ "multiSelect",
2678
+ "doAdd",
2679
+ "add",
2680
+ "doRemove",
2681
+ "remove",
2682
+ "doUpdate",
2683
+ "update",
2684
+ "sort",
2685
+ "copy",
2686
+ "paste",
2687
+ "doPaste",
2688
+ "doAlignCenter",
2689
+ "alignCenter",
2690
+ "moveLayer",
2691
+ "moveToContainer",
2692
+ "dragTo",
2693
+ "undo",
2694
+ "redo",
2695
+ "move"
2696
+ ],
2697
+ sync: []
2698
+ };
2348
2699
  class Editor extends BaseService {
2349
2700
  state = vue.reactive({
2350
2701
  root: null,
@@ -2363,29 +2714,7 @@
2363
2714
  isHistoryStateChange = false;
2364
2715
  constructor() {
2365
2716
  super(
2366
- [
2367
- { name: "getLayout", isAsync: true },
2368
- { name: "select", isAsync: true },
2369
- { name: "doAdd", isAsync: true },
2370
- { name: "add", isAsync: true },
2371
- { name: "doRemove", isAsync: true },
2372
- { name: "remove", isAsync: true },
2373
- { name: "doUpdate", isAsync: true },
2374
- { name: "update", isAsync: true },
2375
- { name: "sort", isAsync: true },
2376
- { name: "copy", isAsync: true },
2377
- { name: "paste", isAsync: true },
2378
- { name: "doPaste", isAsync: true },
2379
- { name: "doAlignCenter", isAsync: true },
2380
- { name: "alignCenter", isAsync: true },
2381
- { name: "moveLayer", isAsync: true },
2382
- { name: "moveToContainer", isAsync: true },
2383
- { name: "move", isAsync: true },
2384
- { name: "undo", isAsync: true },
2385
- { name: "redo", isAsync: true },
2386
- { name: "highlight", isAsync: true },
2387
- { name: "dragTo", isAsync: true }
2388
- ],
2717
+ canUsePluginMethods$3.async.map((methodName) => ({ name: methodName, isAsync: true })),
2389
2718
  // 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
2390
2719
  ["select", "update", "moveLayer"]
2391
2720
  );
@@ -2887,7 +3216,7 @@
2887
3216
  }
2888
3217
  async doPaste(config, position = {}) {
2889
3218
  propsService.clearRelateId();
2890
- const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
3219
+ const pasteConfigs = beforePaste(position, lodashEs.cloneDeep(config));
2891
3220
  return pasteConfigs;
2892
3221
  }
2893
3222
  async doAlignCenter(config) {
@@ -3125,6 +3454,9 @@
3125
3454
  resetModifiedNodeId() {
3126
3455
  this.get("modifiedNodeIds").clear();
3127
3456
  }
3457
+ usePlugin(options) {
3458
+ super.usePlugin(options);
3459
+ }
3128
3460
  addModifiedNodeId(id) {
3129
3461
  if (!this.isHistoryStateChange) {
3130
3462
  this.get("modifiedNodeIds").set(id, id);
@@ -3192,45 +3524,43 @@
3192
3524
  }
3193
3525
  const editorService = new Editor();
3194
3526
 
3195
- const beforePaste = async (position, config) => {
3527
+ const beforePaste = (position, config) => {
3196
3528
  if (!config[0]?.style)
3197
3529
  return config;
3198
3530
  const curNode = editorService.get("node");
3199
3531
  const { left: referenceLeft, top: referenceTop } = config[0].style;
3200
- const pasteConfigs = await Promise.all(
3201
- config.map(async (configItem) => {
3202
- const { offsetX = 0, offsetY = 0, ...positionClone } = position;
3203
- let pastePosition = positionClone;
3204
- if (!lodashEs.isEmpty(pastePosition) && curNode?.items) {
3205
- pastePosition = getPositionInContainer(pastePosition, curNode.id);
3206
- }
3207
- if (pastePosition.left && configItem.style?.left) {
3208
- pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
3209
- }
3210
- if (pastePosition.top && configItem.style?.top) {
3211
- pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
3212
- }
3213
- const pasteConfig = await propsService.setNewItemId(configItem, false);
3214
- if (pasteConfig.style) {
3215
- const { left, top } = pasteConfig.style;
3216
- if (typeof left === "number" || !!left && !isNaN(Number(left))) {
3217
- pasteConfig.style.left = Number(left) + offsetX;
3218
- }
3219
- if (typeof top === "number" || !!top && !isNaN(Number(top))) {
3220
- pasteConfig.style.top = Number(top) + offsetY;
3221
- }
3222
- pasteConfig.style = {
3223
- ...pasteConfig.style,
3224
- ...pastePosition
3225
- };
3226
- }
3227
- const root = editorService.get("root");
3228
- if ((utils.isPage(pasteConfig) || utils.isPageFragment(pasteConfig)) && root) {
3229
- pasteConfig.name = generatePageNameByApp(root, utils.isPage(pasteConfig) ? schema.NodeType.PAGE : schema.NodeType.PAGE_FRAGMENT);
3230
- }
3231
- return pasteConfig;
3232
- })
3233
- );
3532
+ const pasteConfigs = config.map((configItem) => {
3533
+ const { offsetX = 0, offsetY = 0, ...positionClone } = position;
3534
+ let pastePosition = positionClone;
3535
+ if (!lodashEs.isEmpty(pastePosition) && curNode?.items) {
3536
+ pastePosition = getPositionInContainer(pastePosition, curNode.id);
3537
+ }
3538
+ if (pastePosition.left && configItem.style?.left) {
3539
+ pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
3540
+ }
3541
+ if (pastePosition.top && configItem.style?.top) {
3542
+ pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
3543
+ }
3544
+ const pasteConfig = propsService.setNewItemId(configItem, false);
3545
+ if (pasteConfig.style) {
3546
+ const { left, top } = pasteConfig.style;
3547
+ if (typeof left === "number" || !!left && !isNaN(Number(left))) {
3548
+ pasteConfig.style.left = Number(left) + offsetX;
3549
+ }
3550
+ if (typeof top === "number" || !!top && !isNaN(Number(top))) {
3551
+ pasteConfig.style.top = Number(top) + offsetY;
3552
+ }
3553
+ pasteConfig.style = {
3554
+ ...pasteConfig.style,
3555
+ ...pastePosition
3556
+ };
3557
+ }
3558
+ const root = editorService.get("root");
3559
+ if ((utils.isPage(pasteConfig) || utils.isPageFragment(pasteConfig)) && root) {
3560
+ pasteConfig.name = generatePageNameByApp(root, utils.isPage(pasteConfig) ? schema.NodeType.PAGE : schema.NodeType.PAGE_FRAGMENT);
3561
+ }
3562
+ return pasteConfig;
3563
+ });
3234
3564
  return pasteConfigs;
3235
3565
  };
3236
3566
  const getPositionInContainer = (position = {}, id) => {
@@ -3264,7 +3594,7 @@
3264
3594
  return newNode;
3265
3595
  };
3266
3596
 
3267
- const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
3597
+ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
3268
3598
  ...{
3269
3599
  name: "MEditorCodeParams"
3270
3600
  },
@@ -3315,7 +3645,7 @@
3315
3645
  });
3316
3646
 
3317
3647
  const _hoisted_1$r = ["src"];
3318
- const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
3648
+ const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
3319
3649
  ...{
3320
3650
  name: "MEditorIcon"
3321
3651
  },
@@ -3419,9 +3749,9 @@
3419
3749
 
3420
3750
  const _hoisted_1$q = { class: "m-fields-code-select-col" };
3421
3751
  const _hoisted_2$j = { class: "code-select-container" };
3422
- const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
3752
+ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
3423
3753
  ...{
3424
- name: "MEditorCodeSelectCol"
3754
+ name: "MFieldsCodeSelectCol"
3425
3755
  },
3426
3756
  __name: "CodeSelectCol",
3427
3757
  props: {
@@ -3504,14 +3834,14 @@
3504
3834
  size: _ctx.size,
3505
3835
  onChange: onParamsChangeHandler
3506
3836
  }, null, 8, ["model", "size"]),
3507
- _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
3837
+ _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
3508
3838
  key: 0,
3509
3839
  class: "icon",
3510
3840
  icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
3511
3841
  onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(editCode)(_ctx.model[_ctx.name]))
3512
3842
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
3513
3843
  ]),
3514
- paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
3844
+ paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
3515
3845
  name: "params",
3516
3846
  key: _ctx.model[_ctx.name],
3517
3847
  model: _ctx.model,
@@ -3519,7 +3849,7 @@
3519
3849
  "params-config": paramsConfig.value,
3520
3850
  onChange: onParamsChangeHandler
3521
3851
  }, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true),
3522
- vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
3852
+ vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
3523
3853
  key: 1,
3524
3854
  ref_key: "codeBlockEditor",
3525
3855
  ref: codeBlockEditor,
@@ -3534,9 +3864,9 @@
3534
3864
 
3535
3865
  const _hoisted_1$p = { class: "m-editor-data-source-fields" };
3536
3866
  const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
3537
- const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
3867
+ const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
3538
3868
  ...{
3539
- name: "MEditorDataSourceFields"
3869
+ name: "MFieldsDataSourceFields"
3540
3870
  },
3541
3871
  __name: "DataSourceFields",
3542
3872
  props: {
@@ -3588,7 +3918,14 @@
3588
3918
  },
3589
3919
  {
3590
3920
  label: "默认值",
3591
- prop: "defaultValue"
3921
+ prop: "defaultValue",
3922
+ formatter(item, row) {
3923
+ try {
3924
+ return JSON.stringify(row.defaultValue);
3925
+ } catch (e) {
3926
+ return row.defaultValue;
3927
+ }
3928
+ }
3592
3929
  },
3593
3930
  {
3594
3931
  label: "操作",
@@ -3826,7 +4163,11 @@
3826
4163
  }
3827
4164
  });
3828
4165
 
3829
- const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
4166
+ const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
4167
+ const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
4168
+ ...{
4169
+ name: "MFieldsDataSourceFieldSelect"
4170
+ },
3830
4171
  __name: "DataSourceFieldSelect",
3831
4172
  props: {
3832
4173
  config: {},
@@ -3845,48 +4186,117 @@
3845
4186
  const emit = __emit;
3846
4187
  const props = __props;
3847
4188
  const dataSources = vue.computed(() => services?.dataSourceService.get("dataSources"));
3848
- const getOptionChildren = (fields = []) => fields.map((field) => ({
3849
- label: field.title || field.name,
3850
- value: field.name,
3851
- children: field.type === "array" ? [] : getOptionChildren(field.fields)
3852
- }));
4189
+ const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
4190
+ const child = [];
4191
+ fields.forEach((field) => {
4192
+ if (!dataSourceFieldType.length) {
4193
+ dataSourceFieldType.push("any");
4194
+ }
4195
+ const children = getOptionChildren(field.fields, dataSourceFieldType);
4196
+ const item = {
4197
+ label: field.title || field.name,
4198
+ value: field.name,
4199
+ children
4200
+ };
4201
+ const fieldType = field.type || "any";
4202
+ if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
4203
+ child.push(item);
4204
+ return;
4205
+ }
4206
+ if (!dataSourceFieldType.includes(fieldType) && fieldType !== "object") {
4207
+ return;
4208
+ }
4209
+ if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
4210
+ return;
4211
+ }
4212
+ child.push(item);
4213
+ });
4214
+ return child;
4215
+ };
3853
4216
  const cascaderConfig = vue.computed(() => {
3854
4217
  const valueIsKey = props.config.value === "key";
3855
4218
  return {
3856
4219
  type: "cascader",
3857
- name: props.name,
3858
- checkStrictly: !valueIsKey,
3859
- text: "",
3860
- options: () => dataSources.value?.filter((ds) => ds.fields?.length)?.map((ds) => ({
3861
- label: ds.title || ds.id,
3862
- value: valueIsKey ? ds.id : `${utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
3863
- children: getOptionChildren(ds.fields)
3864
- })) || []
4220
+ checkStrictly: props.config.checkStrictly ?? !valueIsKey,
4221
+ popperClass: "m-editor-data-source-field-select-popper",
4222
+ options: () => {
4223
+ const options = dataSources.value?.map((ds) => ({
4224
+ label: ds.title || ds.id,
4225
+ value: valueIsKey ? ds.id : `${utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
4226
+ children: getOptionChildren(ds.fields, props.config.dataSourceFieldType)
4227
+ })) || [];
4228
+ return options.filter((option) => option.children.length);
4229
+ }
3865
4230
  };
3866
4231
  });
4232
+ const showDataSourceFieldSelect = vue.ref(false);
4233
+ vue.onMounted(() => {
4234
+ const value = props.model[props.name];
4235
+ if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
4236
+ return showDataSourceFieldSelect.value = true;
4237
+ }
4238
+ });
4239
+ const mForm = vue.inject("mForm");
4240
+ const type = vue.computed(() => {
4241
+ let type2 = props.config.fieldConfig?.type;
4242
+ if (typeof type2 === "function") {
4243
+ type2 = type2(mForm, {
4244
+ model: props.model
4245
+ });
4246
+ }
4247
+ if (type2 === "form")
4248
+ return "";
4249
+ if (type2 === "container")
4250
+ return "";
4251
+ return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.items ? "" : "text");
4252
+ });
4253
+ const tagName = vue.computed(() => {
4254
+ if (showDataSourceFieldSelect.value || !props.config.fieldConfig) {
4255
+ return form.MCascader;
4256
+ }
4257
+ const component = vue.resolveComponent(`m-${props.config.items ? "form" : "fields"}-${type.value}`);
4258
+ if (typeof component !== "string")
4259
+ return component;
4260
+ return "m-fields-text";
4261
+ });
3867
4262
  const onChangeHandler = (value) => {
3868
4263
  emit("change", value);
3869
4264
  };
3870
4265
  return (_ctx, _cache) => {
3871
- const _component_m_form_container = vue.resolveComponent("m-form-container");
3872
- return vue.openBlock(), vue.createBlock(_component_m_form_container, {
3873
- config: {
3874
- ..._ctx.config,
3875
- ...cascaderConfig.value
3876
- },
3877
- model: _ctx.model,
3878
- onChange: onChangeHandler
3879
- }, null, 8, ["config", "model"]);
4266
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
4267
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
4268
+ style: { "width": "100%" },
4269
+ config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
4270
+ model: _ctx.model,
4271
+ name: _ctx.name,
4272
+ disabled: _ctx.disabled,
4273
+ size: _ctx.size,
4274
+ "last-values": _ctx.lastValues,
4275
+ "init-values": _ctx.initValues,
4276
+ values: _ctx.values,
4277
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
4278
+ onChange: onChangeHandler
4279
+ }, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
4280
+ _ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4281
+ key: 0,
4282
+ style: { "margin-left": "5px" },
4283
+ link: "",
4284
+ type: showDataSourceFieldSelect.value ? "primary" : "default",
4285
+ icon: vue.unref(iconsVue.Coin),
4286
+ size: _ctx.size,
4287
+ onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
4288
+ }, null, 8, ["type", "icon", "size"])) : vue.createCommentVNode("", true)
4289
+ ]);
3880
4290
  };
3881
4291
  }
3882
4292
  });
3883
4293
 
3884
- const _hoisted_1$o = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
4294
+ const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3885
4295
  const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3886
4296
  const _hoisted_3$7 = { class: "el-input__inner" };
3887
- const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
4297
+ const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
3888
4298
  ...{
3889
- name: "MEditorDataSourceInput"
4299
+ name: "MFieldsDataSourceInput"
3890
4300
  },
3891
4301
  __name: "DataSourceInput",
3892
4302
  props: {
@@ -4074,10 +4484,10 @@
4074
4484
  }
4075
4485
  ), {
4076
4486
  suffix: vue.withCtx(() => [
4077
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
4487
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
4078
4488
  ]),
4079
4489
  default: vue.withCtx(({ item }) => [
4080
- vue.createElementVNode("div", _hoisted_1$o, [
4490
+ vue.createElementVNode("div", _hoisted_1$n, [
4081
4491
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
4082
4492
  vue.createElementVNode("span", _hoisted_2$h, vue.toDisplayString(item.value), 1)
4083
4493
  ])
@@ -4109,7 +4519,7 @@
4109
4519
  }, 1032, ["size"])) : vue.createCommentVNode("", true)
4110
4520
  ], 64);
4111
4521
  }), 256)),
4112
- vue.createVNode(_sfc_main$O, {
4522
+ vue.createVNode(_sfc_main$N, {
4113
4523
  class: "tmagic-data-source-input-icon",
4114
4524
  icon: vue.unref(iconsVue.Coin)
4115
4525
  }, null, 8, ["icon"])
@@ -4192,11 +4602,11 @@
4192
4602
  };
4193
4603
  };
4194
4604
 
4195
- const _hoisted_1$n = { class: "m-editor-data-source-methods" };
4605
+ const _hoisted_1$m = { class: "m-editor-data-source-methods" };
4196
4606
  const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
4197
- const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
4607
+ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4198
4608
  ...{
4199
- name: "MEditorDataSourceMethods"
4609
+ name: "MFieldsDataSourceMethods"
4200
4610
  },
4201
4611
  __name: "DataSourceMethods",
4202
4612
  props: {
@@ -4264,7 +4674,7 @@
4264
4674
  emit("change", props.model[props.name]);
4265
4675
  };
4266
4676
  return (_ctx, _cache) => {
4267
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
4677
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
4268
4678
  vue.createVNode(vue.unref(table.MagicTable), {
4269
4679
  data: _ctx.model[_ctx.name],
4270
4680
  columns: methodColumns
@@ -4283,7 +4693,7 @@
4283
4693
  _: 1
4284
4694
  }, 8, ["disabled"])
4285
4695
  ]),
4286
- vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
4696
+ vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
4287
4697
  key: 0,
4288
4698
  ref_key: "codeBlockEditor",
4289
4699
  ref: codeBlockEditor,
@@ -4298,11 +4708,11 @@
4298
4708
  }
4299
4709
  });
4300
4710
 
4301
- const _hoisted_1$m = { class: "m-fields-data-source-method-select" };
4711
+ const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
4302
4712
  const _hoisted_2$f = { class: "data-source-method-select-container" };
4303
- const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4713
+ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
4304
4714
  ...{
4305
- name: "MEditorDataSourceMethodSelect"
4715
+ name: "MFieldsDataSourceMethodSelect"
4306
4716
  },
4307
4717
  __name: "DataSourceMethodSelect",
4308
4718
  props: {
@@ -4391,7 +4801,7 @@
4391
4801
  };
4392
4802
  return (_ctx, _cache) => {
4393
4803
  const _component_m_form_container = vue.resolveComponent("m-form-container");
4394
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
4804
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
4395
4805
  vue.createElementVNode("div", _hoisted_2$f, [
4396
4806
  vue.createVNode(_component_m_form_container, {
4397
4807
  class: "select",
@@ -4399,14 +4809,14 @@
4399
4809
  model: _ctx.model,
4400
4810
  onChange: onChangeHandler
4401
4811
  }, null, 8, ["config", "model"]),
4402
- _ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
4812
+ _ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
4403
4813
  key: 0,
4404
4814
  class: "icon",
4405
4815
  icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4406
4816
  onClick: editCodeHandler
4407
4817
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
4408
4818
  ]),
4409
- paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
4819
+ paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
4410
4820
  key: 0,
4411
4821
  name: "params",
4412
4822
  model: _ctx.model,
@@ -4415,7 +4825,7 @@
4415
4825
  "params-config": paramsConfig.value,
4416
4826
  onChange: onChangeHandler
4417
4827
  }, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true),
4418
- vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
4828
+ vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
4419
4829
  key: 1,
4420
4830
  ref_key: "codeBlockEditor",
4421
4831
  ref: codeBlockEditor,
@@ -4428,11 +4838,11 @@
4428
4838
  }
4429
4839
  });
4430
4840
 
4431
- const _hoisted_1$l = { class: "m-editor-data-source-fields" };
4841
+ const _hoisted_1$k = { class: "m-editor-data-source-fields" };
4432
4842
  const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
4433
- const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
4843
+ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
4434
4844
  ...{
4435
- name: "MEditorDataSourceMocks"
4845
+ name: "MFieldsDataSourceMocks"
4436
4846
  },
4437
4847
  __name: "DataSourceMocks",
4438
4848
  props: {
@@ -4626,7 +5036,7 @@
4626
5036
  });
4627
5037
  };
4628
5038
  return (_ctx, _cache) => {
4629
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
5039
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
4630
5040
  vue.createVNode(vue.unref(table.MagicTable), {
4631
5041
  data: _ctx.model[_ctx.name],
4632
5042
  columns
@@ -4662,9 +5072,9 @@
4662
5072
  }
4663
5073
  });
4664
5074
 
4665
- const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5075
+ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
4666
5076
  ...{
4667
- name: "MEditorDataSourceSelect"
5077
+ name: "MFieldsDataSourceSelect"
4668
5078
  },
4669
5079
  __name: "DataSourceSelect",
4670
5080
  props: {
@@ -4719,14 +5129,14 @@
4719
5129
  }
4720
5130
  });
4721
5131
 
4722
- const _hoisted_1$k = { class: "m-fields-event-select" };
5132
+ const _hoisted_1$j = { class: "m-fields-event-select" };
4723
5133
  const _hoisted_2$d = {
4724
5134
  key: 1,
4725
5135
  class: "fullWidth"
4726
5136
  };
4727
- const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5137
+ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
4728
5138
  ...{
4729
- name: "MEditorEventSelect"
5139
+ name: "MFieldsEventSelect"
4730
5140
  },
4731
5141
  __name: "EventSelect",
4732
5142
  props: {
@@ -4928,7 +5338,7 @@
4928
5338
  const _component_m_form_table = vue.resolveComponent("m-form-table");
4929
5339
  const _component_m_form_container = vue.resolveComponent("m-form-container");
4930
5340
  const _component_m_form_panel = vue.resolveComponent("m-form-panel");
4931
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
5341
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
4932
5342
  isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
4933
5343
  key: 0,
4934
5344
  ref: "eventForm",
@@ -4988,7 +5398,7 @@
4988
5398
  }
4989
5399
  });
4990
5400
 
4991
- const _hoisted_1$j = {
5401
+ const _hoisted_1$i = {
4992
5402
  viewBox: "0 0 32 32",
4993
5403
  version: "1.1",
4994
5404
  xmlns: "http://www.w3.org/2000/svg",
@@ -4998,24 +5408,24 @@
4998
5408
  const _hoisted_4$6 = [
4999
5409
  _hoisted_2$c
5000
5410
  ];
5001
- const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5411
+ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5002
5412
  ...{
5003
5413
  name: "MEditorCodeIcon"
5004
5414
  },
5005
5415
  __name: "CodeIcon",
5006
5416
  setup(__props) {
5007
5417
  return (_ctx, _cache) => {
5008
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$j, _hoisted_4$6);
5418
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$i, _hoisted_4$6);
5009
5419
  };
5010
5420
  }
5011
5421
  });
5012
5422
 
5013
- const _hoisted_1$i = { class: "m-fields-key-value" };
5423
+ const _hoisted_1$h = { class: "m-fields-key-value" };
5014
5424
  const _hoisted_2$b = { key: 0 };
5015
5425
  const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
5016
- const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5426
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5017
5427
  ...{
5018
- name: "MEditorKeyValue"
5428
+ name: "MFieldsKeyValue"
5019
5429
  },
5020
5430
  __name: "KeyValue",
5021
5431
  props: {
@@ -5071,7 +5481,7 @@
5071
5481
  emit("change", v);
5072
5482
  };
5073
5483
  return (_ctx, _cache) => {
5074
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
5484
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
5075
5485
  !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
5076
5486
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
5077
5487
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -5137,7 +5547,7 @@
5137
5547
  size: "default",
5138
5548
  disabled: _ctx.disabled,
5139
5549
  link: "",
5140
- icon: _sfc_main$E,
5550
+ icon: _sfc_main$D,
5141
5551
  onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
5142
5552
  }, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
5143
5553
  ]);
@@ -5145,11 +5555,11 @@
5145
5555
  }
5146
5556
  });
5147
5557
 
5148
- const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
5558
+ const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
5149
5559
  const _hoisted_2$a = { class: "page-fragment-select-container" };
5150
- const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5560
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5151
5561
  ...{
5152
- name: "MEditorPageFragmentSelect"
5562
+ name: "MFieldsPageFragmentSelect"
5153
5563
  },
5154
5564
  __name: "PageFragmentSelect",
5155
5565
  props: {
@@ -5193,7 +5603,7 @@
5193
5603
  };
5194
5604
  return (_ctx, _cache) => {
5195
5605
  const _component_m_form_container = vue.resolveComponent("m-form-container");
5196
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
5606
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
5197
5607
  vue.createElementVNode("div", _hoisted_2$a, [
5198
5608
  vue.createVNode(_component_m_form_container, {
5199
5609
  class: "select",
@@ -5202,7 +5612,7 @@
5202
5612
  size: _ctx.size,
5203
5613
  onChange: changeHandler
5204
5614
  }, null, 8, ["model", "size"]),
5205
- _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
5615
+ _ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
5206
5616
  key: 0,
5207
5617
  class: "icon",
5208
5618
  icon: vue.unref(iconsVue.Edit),
@@ -5214,14 +5624,14 @@
5214
5624
  }
5215
5625
  });
5216
5626
 
5217
- const _hoisted_1$g = {
5627
+ const _hoisted_1$f = {
5218
5628
  key: 1,
5219
5629
  class: "m-fields-ui-select",
5220
5630
  style: { "display": "flex" }
5221
5631
  };
5222
- const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5632
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5223
5633
  ...{
5224
- name: "MEditorUISelect"
5634
+ name: "MFieldsUISelect"
5225
5635
  },
5226
5636
  __name: "UISelect",
5227
5637
  props: {
@@ -5288,7 +5698,7 @@
5288
5698
  services?.editorService.get("stage")?.highlight(id);
5289
5699
  services?.stageOverlayService.get("stage")?.highlight(id);
5290
5700
  }, 150);
5291
- const unhightlight = () => {
5701
+ const unhighlight = () => {
5292
5702
  services?.editorService.set("highlightNode", null);
5293
5703
  services?.editorService.get("stage")?.clearHighlight();
5294
5704
  services?.stageOverlayService.get("stage")?.clearHighlight();
@@ -5312,7 +5722,7 @@
5312
5722
  ]),
5313
5723
  _: 1
5314
5724
  }, 8, ["icon", "disabled", "size"])
5315
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
5725
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
5316
5726
  val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
5317
5727
  vue.createVNode(vue.unref(design.TMagicTooltip), {
5318
5728
  content: "清除",
@@ -5327,7 +5737,7 @@
5327
5737
  size: _ctx.size,
5328
5738
  link: "",
5329
5739
  onClick: vue.withModifiers(deleteHandler, ["stop"])
5330
- }, null, 8, ["icon", "disabled", "size", "onClick"])
5740
+ }, null, 8, ["icon", "disabled", "size"])
5331
5741
  ]),
5332
5742
  _: 1
5333
5743
  }),
@@ -5343,7 +5753,7 @@
5343
5753
  size: _ctx.size,
5344
5754
  onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
5345
5755
  onMouseenter: _cache[1] || (_cache[1] = ($event) => vue.unref(highlight)(val.value)),
5346
- onMouseleave: unhightlight
5756
+ onMouseleave: unhighlight
5347
5757
  }, {
5348
5758
  default: vue.withCtx(() => [
5349
5759
  vue.createTextVNode(vue.toDisplayString(`${toName.value}_${val.value}`), 1)
@@ -5407,7 +5817,7 @@
5407
5817
  };
5408
5818
  };
5409
5819
 
5410
- const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5820
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5411
5821
  ...{
5412
5822
  name: "MEditorResizer"
5413
5823
  },
@@ -5429,7 +5839,7 @@
5429
5839
  }
5430
5840
  });
5431
5841
 
5432
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5842
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5433
5843
  ...{
5434
5844
  name: "MEditorSplitView"
5435
5845
  },
@@ -5556,7 +5966,7 @@
5556
5966
  }, [
5557
5967
  vue.renderSlot(_ctx.$slots, "left")
5558
5968
  ], 6),
5559
- vue.createVNode(_sfc_main$A, { onChange: changeLeft })
5969
+ vue.createVNode(_sfc_main$z, { onChange: changeLeft })
5560
5970
  ], 64)) : vue.createCommentVNode("", true),
5561
5971
  vue.createElementVNode("div", {
5562
5972
  class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -5565,7 +5975,7 @@
5565
5975
  vue.renderSlot(_ctx.$slots, "center")
5566
5976
  ], 6),
5567
5977
  hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5568
- vue.createVNode(_sfc_main$A, { onChange: changeRight }),
5978
+ vue.createVNode(_sfc_main$z, { onChange: changeRight }),
5569
5979
  vue.createElementVNode("div", {
5570
5980
  class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
5571
5981
  style: vue.normalizeStyle(`width: ${_ctx.right}px`)
@@ -5578,12 +5988,12 @@
5578
5988
  }
5579
5989
  });
5580
5990
 
5581
- const _hoisted_1$f = {
5991
+ const _hoisted_1$e = {
5582
5992
  key: 1,
5583
5993
  class: "menu-item-text"
5584
5994
  };
5585
5995
  const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
5586
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5996
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
5587
5997
  ...{
5588
5998
  name: "MEditorToolButton"
5589
5999
  },
@@ -5662,7 +6072,7 @@
5662
6072
  _ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
5663
6073
  key: 0,
5664
6074
  direction: _ctx.data.direction || "vertical"
5665
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
6075
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
5666
6076
  _ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
5667
6077
  key: 0,
5668
6078
  effect: "dark",
@@ -5676,7 +6086,7 @@
5676
6086
  disabled: disabled.value
5677
6087
  }, {
5678
6088
  default: vue.withCtx(() => [
5679
- _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
6089
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
5680
6090
  key: 0,
5681
6091
  icon: _ctx.data.icon
5682
6092
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -5694,7 +6104,7 @@
5694
6104
  title: _ctx.data.text
5695
6105
  }, {
5696
6106
  default: vue.withCtx(() => [
5697
- _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
6107
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
5698
6108
  key: 0,
5699
6109
  icon: _ctx.data.icon
5700
6110
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -5744,11 +6154,11 @@
5744
6154
  }
5745
6155
  });
5746
6156
 
5747
- const _hoisted_1$e = {
6157
+ const _hoisted_1$d = {
5748
6158
  key: 1,
5749
6159
  style: { "width": "21px" }
5750
6160
  };
5751
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
6161
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
5752
6162
  ...{
5753
6163
  name: "MEditorPageBarAddButton"
5754
6164
  },
@@ -5782,13 +6192,13 @@
5782
6192
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5783
6193
  onClick: addPage
5784
6194
  }, [
5785
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
5786
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e));
6195
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6196
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d));
5787
6197
  };
5788
6198
  }
5789
6199
  });
5790
6200
 
5791
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
6201
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5792
6202
  ...{
5793
6203
  name: "MEditorPageBarScrollContainer"
5794
6204
  },
@@ -5894,7 +6304,7 @@
5894
6304
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5895
6305
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5896
6306
  }, [
5897
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
6307
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
5898
6308
  ])) : vue.createCommentVNode("", true),
5899
6309
  _ctx.type === vue.unref(schema.NodeType).PAGE && pageLength.value || _ctx.type === vue.unref(schema.NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
5900
6310
  key: 1,
@@ -5910,14 +6320,14 @@
5910
6320
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5911
6321
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5912
6322
  }, [
5913
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
6323
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
5914
6324
  ])) : vue.createCommentVNode("", true)
5915
6325
  ], 512);
5916
6326
  };
5917
6327
  }
5918
6328
  });
5919
6329
 
5920
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
6330
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5921
6331
  ...{
5922
6332
  name: "MEditorPageBarSwitchTypeButton"
5923
6333
  },
@@ -5961,11 +6371,11 @@
5961
6371
  }
5962
6372
  });
5963
6373
 
5964
- const _hoisted_1$d = { class: "m-editor-page-bar-tabs" };
6374
+ const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
5965
6375
  const _hoisted_2$8 = ["onClick"];
5966
6376
  const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
5967
6377
  const _hoisted_4$5 = ["title"];
5968
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
6378
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5969
6379
  ...{
5970
6380
  name: "MEditorPageBar"
5971
6381
  },
@@ -6043,15 +6453,15 @@
6043
6453
  editorService?.remove(node);
6044
6454
  };
6045
6455
  return (_ctx, _cache) => {
6046
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
6047
- !_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$v, {
6456
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
6457
+ !_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
6048
6458
  key: 0,
6049
6459
  modelValue: active.value,
6050
6460
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
6051
6461
  }, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
6052
- vue.createVNode(_sfc_main$w, { type: active.value }, {
6462
+ vue.createVNode(_sfc_main$v, { type: active.value }, {
6053
6463
  prepend: vue.withCtx(() => [
6054
- vue.createVNode(_sfc_main$x, { type: active.value }, null, 8, ["type"])
6464
+ vue.createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
6055
6465
  ]),
6056
6466
  default: vue.withCtx(() => [
6057
6467
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
@@ -6084,7 +6494,7 @@
6084
6494
  default: vue.withCtx(() => [
6085
6495
  vue.createElementVNode("div", null, [
6086
6496
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
6087
- vue.createVNode(_sfc_main$y, {
6497
+ vue.createVNode(_sfc_main$x, {
6088
6498
  data: {
6089
6499
  type: "button",
6090
6500
  text: "复制",
@@ -6092,7 +6502,7 @@
6092
6502
  handler: () => copy(item)
6093
6503
  }
6094
6504
  }, null, 8, ["data"]),
6095
- vue.createVNode(_sfc_main$y, {
6505
+ vue.createVNode(_sfc_main$x, {
6096
6506
  data: {
6097
6507
  type: "button",
6098
6508
  text: "删除",
@@ -6115,11 +6525,11 @@
6115
6525
  }
6116
6526
  });
6117
6527
 
6118
- const _hoisted_1$c = { class: "m-editor-empty-panel" };
6528
+ const _hoisted_1$b = { class: "m-editor-empty-panel" };
6119
6529
  const _hoisted_2$7 = { class: "m-editor-empty-content" };
6120
6530
  const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
6121
6531
  const _hoisted_4$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面片", -1);
6122
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
6532
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
6123
6533
  ...{
6124
6534
  name: "MEditorAddPageBox"
6125
6535
  },
@@ -6143,14 +6553,14 @@
6143
6553
  });
6144
6554
  };
6145
6555
  return (_ctx, _cache) => {
6146
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
6556
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
6147
6557
  vue.createElementVNode("div", _hoisted_2$7, [
6148
6558
  vue.createElementVNode("div", {
6149
6559
  class: "m-editor-empty-button",
6150
6560
  onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(schema.NodeType).PAGE))
6151
6561
  }, [
6152
6562
  vue.createElementVNode("div", null, [
6153
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6563
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6154
6564
  ]),
6155
6565
  _hoisted_3$4
6156
6566
  ]),
@@ -6160,7 +6570,7 @@
6160
6570
  onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(vue.unref(schema.NodeType).PAGE_FRAGMENT))
6161
6571
  }, [
6162
6572
  vue.createElementVNode("div", null, [
6163
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6573
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6164
6574
  ]),
6165
6575
  _hoisted_4$4
6166
6576
  ])) : vue.createCommentVNode("", true)
@@ -6174,7 +6584,7 @@
6174
6584
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
6175
6585
  const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
6176
6586
  const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
6177
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
6587
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
6178
6588
  ...{
6179
6589
  name: "MEditorFramework"
6180
6590
  },
@@ -6261,7 +6671,7 @@
6261
6671
  options: vue.unref(codeOptions),
6262
6672
  onSave: saveCode
6263
6673
  }, null, 8, ["init-values", "options"])
6264
- ]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$z, {
6674
+ ]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$y, {
6265
6675
  key: 1,
6266
6676
  "element-loading-text": "Runtime 加载中...",
6267
6677
  ref_key: "splitView",
@@ -6284,10 +6694,10 @@
6284
6694
  ]),
6285
6695
  center: vue.withCtx(() => [
6286
6696
  page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
6287
- vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
6697
+ vue.createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
6288
6698
  ]),
6289
6699
  vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
6290
- vue.createVNode(_sfc_main$u, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
6700
+ vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
6291
6701
  "page-bar-title": vue.withCtx(({ page: page2 }) => [
6292
6702
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
6293
6703
  ]),
@@ -6322,7 +6732,7 @@
6322
6732
  }
6323
6733
  });
6324
6734
 
6325
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
6735
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
6326
6736
  ...{
6327
6737
  name: "MEditorNavMenu"
6328
6738
  },
@@ -6472,10 +6882,30 @@
6472
6882
  });
6473
6883
  return data;
6474
6884
  });
6885
+ const resizeObserver = new ResizeObserver(() => {
6886
+ const rect = navMenu.value?.getBoundingClientRect();
6887
+ if (rect) {
6888
+ uiService?.set("navMenuRect", {
6889
+ left: rect.left,
6890
+ top: rect.top,
6891
+ width: rect.width,
6892
+ height: rect.height
6893
+ });
6894
+ }
6895
+ });
6896
+ const navMenu = vue.ref();
6897
+ vue.onMounted(() => {
6898
+ navMenu.value && resizeObserver.observe(navMenu.value);
6899
+ });
6900
+ vue.onBeforeUnmount(() => {
6901
+ resizeObserver.disconnect();
6902
+ });
6475
6903
  return (_ctx, _cache) => {
6476
6904
  return vue.openBlock(), vue.createElementBlock("div", {
6477
6905
  class: "m-editor-nav-menu",
6478
- style: vue.normalizeStyle({ height: `${_ctx.height}px` })
6906
+ style: vue.normalizeStyle({ height: `${_ctx.height}px` }),
6907
+ ref_key: "navMenu",
6908
+ ref: navMenu
6479
6909
  }, [
6480
6910
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(keys), (key) => {
6481
6911
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -6484,7 +6914,7 @@
6484
6914
  style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
6485
6915
  }, [
6486
6916
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
6487
- return vue.openBlock(), vue.createBlock(_sfc_main$y, {
6917
+ return vue.openBlock(), vue.createBlock(_sfc_main$x, {
6488
6918
  data: item,
6489
6919
  key: index
6490
6920
  }, null, 8, ["data"]);
@@ -6496,8 +6926,8 @@
6496
6926
  }
6497
6927
  });
6498
6928
 
6499
- const _hoisted_1$b = { class: "m-editor-props-panel" };
6500
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
6929
+ const _hoisted_1$a = { class: "m-editor-props-panel" };
6930
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
6501
6931
  ...{
6502
6932
  name: "MEditorPropsPanel"
6503
6933
  },
@@ -6552,7 +6982,7 @@
6552
6982
  };
6553
6983
  __expose({ configForm, submit });
6554
6984
  return (_ctx, _cache) => {
6555
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
6985
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
6556
6986
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
6557
6987
  vue.createVNode(vue.unref(form.MForm), {
6558
6988
  ref_key: "configForm",
@@ -6573,116 +7003,6 @@
6573
7003
  }
6574
7004
  });
6575
7005
 
6576
- const _hoisted_1$a = { class: "m-editor-float-box-body" };
6577
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
6578
- __name: "FloatingBox",
6579
- props: {
6580
- visible: { type: Boolean, default: false },
6581
- position: { default: () => ({ left: 0, top: 0 }) },
6582
- rect: { default: () => ({ width: "auto", height: "auto" }) },
6583
- title: { default: "" }
6584
- },
6585
- emits: ["update:visible"],
6586
- setup(__props, { expose: __expose, emit: __emit }) {
6587
- const props = __props;
6588
- const emit = __emit;
6589
- const target = vue.ref();
6590
- const dragTarget = vue.ref();
6591
- const style = vue.computed(() => ({
6592
- left: `${props.position.left}px`,
6593
- top: `${props.position.top}px`,
6594
- width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
6595
- height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
6596
- }));
6597
- let moveable = null;
6598
- const initMoveable = () => {
6599
- moveable = new VanillaMoveable(globalThis.document.body, {
6600
- className: "m-editor-floating-box-moveable",
6601
- target: target.value,
6602
- draggable: true,
6603
- resizable: true,
6604
- edge: true,
6605
- keepRatio: false,
6606
- origin: false,
6607
- snappable: true,
6608
- dragTarget: dragTarget.value,
6609
- dragTargetSelf: false,
6610
- linePadding: 10,
6611
- controlPadding: 10
6612
- });
6613
- moveable.on("drag", (e) => {
6614
- e.target.style.transform = e.transform;
6615
- });
6616
- moveable.on("resize", (e) => {
6617
- e.target.style.width = `${e.width}px`;
6618
- e.target.style.height = `${e.height}px`;
6619
- e.target.style.transform = e.drag.transform;
6620
- });
6621
- };
6622
- const destroyMoveable = () => {
6623
- moveable?.destroy();
6624
- moveable = null;
6625
- };
6626
- vue.watch(
6627
- () => props.visible,
6628
- async (visible) => {
6629
- if (visible) {
6630
- await vue.nextTick();
6631
- initMoveable();
6632
- } else {
6633
- destroyMoveable();
6634
- }
6635
- },
6636
- {
6637
- immediate: true
6638
- }
6639
- );
6640
- vue.onBeforeUnmount(() => {
6641
- destroyMoveable();
6642
- });
6643
- const closeHandler = () => {
6644
- emit("update:visible", false);
6645
- };
6646
- __expose({
6647
- target
6648
- });
6649
- return (_ctx, _cache) => {
6650
- return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
6651
- key: 0,
6652
- to: "body"
6653
- }, [
6654
- vue.createElementVNode("div", {
6655
- ref_key: "target",
6656
- ref: target,
6657
- class: "m-editor-float-box",
6658
- style: vue.normalizeStyle(style.value)
6659
- }, [
6660
- vue.createElementVNode("div", {
6661
- ref_key: "dragTarget",
6662
- ref: dragTarget,
6663
- class: "m-editor-float-box-title"
6664
- }, [
6665
- vue.renderSlot(_ctx.$slots, "title", {}, () => [
6666
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
6667
- ]),
6668
- vue.createElementVNode("div", null, [
6669
- vue.createVNode(vue.unref(design.TMagicButton), {
6670
- link: "",
6671
- size: "small",
6672
- icon: vue.unref(iconsVue.Close),
6673
- onClick: closeHandler
6674
- }, null, 8, ["icon"])
6675
- ])
6676
- ], 512),
6677
- vue.createElementVNode("div", _hoisted_1$a, [
6678
- vue.renderSlot(_ctx.$slots, "body")
6679
- ])
6680
- ], 4)
6681
- ])) : vue.createCommentVNode("", true);
6682
- };
6683
- }
6684
- });
6685
-
6686
7006
  const useFloatBox = (slideKeys) => {
6687
7007
  const floatBoxStates = vue.ref(
6688
7008
  slideKeys.value.reduce(
@@ -6866,7 +7186,7 @@
6866
7186
  onContextmenu: nodeContentmenuHandler,
6867
7187
  onMouseenter: mouseenterHandler
6868
7188
  }, [
6869
- vue.createVNode(_sfc_main$O, {
7189
+ vue.createVNode(_sfc_main$N, {
6870
7190
  class: "expand-icon",
6871
7191
  style: vue.normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
6872
7192
  icon: expanded.value ? vue.unref(iconsVue.ArrowDown) : vue.unref(iconsVue.ArrowRight),
@@ -7145,7 +7465,7 @@
7145
7465
  placement: "bottom"
7146
7466
  }, {
7147
7467
  default: vue.withCtx(() => [
7148
- vue.createVNode(_sfc_main$O, {
7468
+ vue.createVNode(_sfc_main$N, {
7149
7469
  icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
7150
7470
  class: "edit-icon",
7151
7471
  onClick: vue.withModifiers(($event) => editCode(`${data.key}`), ["stop"])
@@ -7160,7 +7480,7 @@
7160
7480
  placement: "bottom"
7161
7481
  }, {
7162
7482
  default: vue.withCtx(() => [
7163
- vue.createVNode(_sfc_main$O, {
7483
+ vue.createVNode(_sfc_main$N, {
7164
7484
  icon: vue.unref(iconsVue.Close),
7165
7485
  class: "edit-icon",
7166
7486
  onClick: vue.withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
@@ -7237,7 +7557,7 @@
7237
7557
  ]),
7238
7558
  _: 3
7239
7559
  }),
7240
- vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
7560
+ vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
7241
7561
  key: 0,
7242
7562
  ref_key: "codeBlockEditor",
7243
7563
  ref: codeBlockEditor,
@@ -7418,7 +7738,7 @@
7418
7738
  placement: "bottom"
7419
7739
  }, {
7420
7740
  default: vue.withCtx(() => [
7421
- vue.createVNode(_sfc_main$O, {
7741
+ vue.createVNode(_sfc_main$N, {
7422
7742
  icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
7423
7743
  class: "edit-icon",
7424
7744
  onClick: vue.withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
@@ -7433,7 +7753,7 @@
7433
7753
  placement: "bottom"
7434
7754
  }, {
7435
7755
  default: vue.withCtx(() => [
7436
- vue.createVNode(_sfc_main$O, {
7756
+ vue.createVNode(_sfc_main$N, {
7437
7757
  icon: vue.unref(iconsVue.Close),
7438
7758
  class: "edit-icon",
7439
7759
  onClick: vue.withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
@@ -7535,7 +7855,7 @@
7535
7855
  default: vue.withCtx(() => [
7536
7856
  vue.createElementVNode("div", _hoisted_2$5, [
7537
7857
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
7538
- return vue.openBlock(), vue.createBlock(_sfc_main$y, {
7858
+ return vue.openBlock(), vue.createBlock(_sfc_main$x, {
7539
7859
  data: {
7540
7860
  type: "button",
7541
7861
  text: item.text,
@@ -7549,14 +7869,15 @@
7549
7869
  ])
7550
7870
  ]),
7551
7871
  _: 1
7552
- })) : vue.createCommentVNode("", true)
7872
+ })) : vue.createCommentVNode("", true),
7873
+ vue.renderSlot(_ctx.$slots, "data-source-panel-search")
7553
7874
  ]),
7554
7875
  vue.createVNode(_sfc_main$i, {
7555
7876
  onEdit: editHandler,
7556
7877
  onRemove: removeHandler
7557
7878
  })
7558
7879
  ]),
7559
- _: 1
7880
+ _: 3
7560
7881
  }),
7561
7882
  vue.createVNode(_sfc_main$j, {
7562
7883
  ref_key: "editDialog",
@@ -7703,7 +8024,7 @@
7703
8024
  vue.renderSlot(_ctx.$slots, "title"),
7704
8025
  vue.createElementVNode("div", null, [
7705
8026
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
7706
- return vue.openBlock(), vue.createBlock(_sfc_main$y, {
8027
+ return vue.openBlock(), vue.createBlock(_sfc_main$x, {
7707
8028
  "event-type": "mouseup",
7708
8029
  ref_for: true,
7709
8030
  ref_key: "buttons",
@@ -7968,12 +8289,12 @@
7968
8289
  };
7969
8290
  return (_ctx, _cache) => {
7970
8291
  return _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
7971
- _ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
8292
+ _ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
7972
8293
  key: 0,
7973
8294
  icon: vue.unref(iconsVue.Hide),
7974
8295
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
7975
8296
  title: "点击显示"
7976
- }, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$O, {
8297
+ }, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$N, {
7977
8298
  key: 1,
7978
8299
  icon: vue.unref(iconsVue.View),
7979
8300
  onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
@@ -8614,7 +8935,7 @@
8614
8935
  name: `${index}`
8615
8936
  }, {
8616
8937
  title: vue.withCtx(() => [
8617
- vue.createVNode(_sfc_main$O, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
8938
+ vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
8618
8939
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
8619
8940
  ]),
8620
8941
  default: vue.withCtx(() => [
@@ -8635,7 +8956,7 @@
8635
8956
  content: item.desc
8636
8957
  }, {
8637
8958
  default: vue.withCtx(() => [
8638
- vue.createVNode(_sfc_main$O, {
8959
+ vue.createVNode(_sfc_main$N, {
8639
8960
  icon: item.icon
8640
8961
  }, null, 8, ["icon"])
8641
8962
  ]),
@@ -8715,7 +9036,12 @@
8715
9036
  icon: iconsVue.EditPen,
8716
9037
  text: "代码编辑",
8717
9038
  component: _sfc_main$k,
8718
- slots: {}
9039
+ slots: {},
9040
+ boxComponentConfig: {
9041
+ props: {
9042
+ slideType: "box"
9043
+ }
9044
+ }
8719
9045
  },
8720
9046
  "data-source": {
8721
9047
  $key: "data-source",
@@ -8772,7 +9098,7 @@
8772
9098
  (...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
8773
9099
  onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
8774
9100
  }, [
8775
- config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
9101
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
8776
9102
  key: 0,
8777
9103
  icon: config.icon
8778
9104
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -8833,6 +9159,13 @@
8833
9159
  ]),
8834
9160
  key: "4"
8835
9161
  } : void 0,
9162
+ config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
9163
+ name: "code-block-panel-search",
9164
+ fn: vue.withCtx(() => [
9165
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
9166
+ ]),
9167
+ key: "5"
9168
+ } : void 0,
8836
9169
  config.$key === "layer" || config.slots?.layerNodeContent ? {
8837
9170
  name: "layer-node-content",
8838
9171
  fn: vue.withCtx(({ data: nodeData }) => [
@@ -8844,7 +9177,7 @@
8844
9177
  data: nodeData
8845
9178
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8846
9179
  ]),
8847
- key: "5"
9180
+ key: "6"
8848
9181
  } : void 0,
8849
9182
  config.$key === "layer" || config.slots?.layerNodeLabel ? {
8850
9183
  name: "layer-node-label",
@@ -8857,7 +9190,7 @@
8857
9190
  data: nodeData
8858
9191
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8859
9192
  ]),
8860
- key: "6"
9193
+ key: "7"
8861
9194
  } : void 0,
8862
9195
  config.$key === "layer" || config.slots?.layerNodeTool ? {
8863
9196
  name: "layer-node-tool",
@@ -8870,9 +9203,9 @@
8870
9203
  data: nodeData
8871
9204
  }, null, 8, ["data"])) : vue.createCommentVNode("", true)
8872
9205
  ]),
8873
- key: "7"
9206
+ key: "8"
8874
9207
  } : void 0,
8875
- config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
9208
+ config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
8876
9209
  name: "data-source-panel-tool",
8877
9210
  fn: vue.withCtx(({ data }) => [
8878
9211
  config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-tool", {
@@ -8880,7 +9213,14 @@
8880
9213
  data
8881
9214
  }) : config.slots?.DataSourcePanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : vue.createCommentVNode("", true)
8882
9215
  ]),
8883
- key: "8"
9216
+ key: "9"
9217
+ } : void 0,
9218
+ config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
9219
+ name: "data-source-panel-search",
9220
+ fn: vue.withCtx(() => [
9221
+ config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : vue.createCommentVNode("", true)
9222
+ ]),
9223
+ key: "10"
8884
9224
  } : void 0
8885
9225
  ]), 1040)) : vue.createCommentVNode("", true)
8886
9226
  ])), [
@@ -8891,7 +9231,7 @@
8891
9231
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
8892
9232
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8893
9233
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8894
- vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
9234
+ vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
8895
9235
  key: config.$key ?? index,
8896
9236
  visible: vue.unref(floatBoxStates)[config.$key].status,
8897
9237
  "onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
@@ -9260,15 +9600,21 @@
9260
9600
  showRule: true,
9261
9601
  propsPanelSize: "small",
9262
9602
  showAddPageButton: true,
9263
- floatBox: /* @__PURE__ */ new Map(),
9264
- hideSlideBar: false
9603
+ hideSlideBar: false,
9604
+ navMenuRect: {
9605
+ left: 0,
9606
+ top: 0,
9607
+ width: 0,
9608
+ height: 0
9609
+ }
9265
9610
  });
9611
+ const canUsePluginMethods$2 = {
9612
+ async: ["zoom", "calcZoom"],
9613
+ sync: []
9614
+ };
9266
9615
  class Ui extends BaseService {
9267
9616
  constructor() {
9268
- super([
9269
- { name: "zoom", isAsync: true },
9270
- { name: "calcZoom", isAsync: true }
9271
- ]);
9617
+ super(canUsePluginMethods$2.async.map((methodName) => ({ name: methodName, isAsync: true })));
9272
9618
  }
9273
9619
  set(name, value) {
9274
9620
  const mask = editorService.get("stage")?.mask;
@@ -9306,19 +9652,6 @@
9306
9652
  }
9307
9653
  return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
9308
9654
  }
9309
- async setFloatBox(keys) {
9310
- const map = state.floatBox;
9311
- for (const key of keys) {
9312
- if (map.get(key))
9313
- continue;
9314
- map.set(key, {
9315
- status: false,
9316
- zIndex: 99,
9317
- top: 0,
9318
- left: 0
9319
- });
9320
- }
9321
- }
9322
9655
  resetState() {
9323
9656
  this.set("showSrc", false);
9324
9657
  this.set("uiSelectMode", false);
@@ -9333,6 +9666,9 @@
9333
9666
  this.removeAllListeners();
9334
9667
  this.removeAllPlugins();
9335
9668
  }
9669
+ usePlugin(options) {
9670
+ super.usePlugin(options);
9671
+ }
9336
9672
  async setStageRect(value) {
9337
9673
  state.stageRect = {
9338
9674
  ...state.stageRect,
@@ -9524,7 +9860,7 @@
9524
9860
  ]),
9525
9861
  _: 1
9526
9862
  })) : vue.createCommentVNode("", true),
9527
- page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
9863
+ page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
9528
9864
  key: 1,
9529
9865
  ref_key: "box",
9530
9866
  ref: box,
@@ -10066,6 +10402,10 @@
10066
10402
  }
10067
10403
  });
10068
10404
 
10405
+ const canUsePluginMethods$1 = {
10406
+ async: ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"],
10407
+ sync: []
10408
+ };
10069
10409
  class CodeBlock extends BaseService {
10070
10410
  state = vue.reactive({
10071
10411
  codeDsl: null,
@@ -10075,13 +10415,7 @@
10075
10415
  paramsColConfig: void 0
10076
10416
  });
10077
10417
  constructor() {
10078
- super([
10079
- { name: "setCodeDslById", isAsync: true },
10080
- { name: "setEditStatus", isAsync: true },
10081
- { name: "setCombineIds", isAsync: true },
10082
- { name: "setUndeleteableList", isAsync: true },
10083
- { name: "deleteCodeDslByIds", isAsync: true }
10084
- ]);
10418
+ super(canUsePluginMethods$1.async.map((methodName) => ({ name: methodName, isAsync: true })));
10085
10419
  }
10086
10420
  /**
10087
10421
  * 设置活动的代码块dsl数据源
@@ -10254,6 +10588,9 @@
10254
10588
  this.removeAllListeners();
10255
10589
  this.removeAllPlugins();
10256
10590
  }
10591
+ usePlugin(options) {
10592
+ super.usePlugin(options);
10593
+ }
10257
10594
  }
10258
10595
  const codeBlockService = new CodeBlock();
10259
10596
 
@@ -10309,10 +10646,10 @@
10309
10646
  });
10310
10647
  }
10311
10648
  setEvent(type, events) {
10312
- eventMap[type] = [...core.DEFAULT_EVENTS, ...events];
10649
+ eventMap[utils.toLine(type)] = [...core.DEFAULT_EVENTS, ...events];
10313
10650
  }
10314
10651
  getEvent(type) {
10315
- return lodashEs.cloneDeep(eventMap[type] || core.DEFAULT_EVENTS);
10652
+ return lodashEs.cloneDeep(eventMap[utils.toLine(type)] || core.DEFAULT_EVENTS);
10316
10653
  }
10317
10654
  setMethods(methods) {
10318
10655
  Object.keys(methods).forEach((type) => {
@@ -10320,10 +10657,10 @@
10320
10657
  });
10321
10658
  }
10322
10659
  setMethod(type, method) {
10323
- methodMap[type] = [...core.DEFAULT_METHODS, ...method];
10660
+ methodMap[utils.toLine(type)] = [...core.DEFAULT_METHODS, ...method];
10324
10661
  }
10325
10662
  getMethod(type) {
10326
- return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
10663
+ return lodashEs.cloneDeep(methodMap[utils.toLine(type)] || core.DEFAULT_METHODS);
10327
10664
  }
10328
10665
  resetState() {
10329
10666
  eventMap = vue.reactive({});
@@ -10517,6 +10854,10 @@
10517
10854
  }
10518
10855
  const keybindingService = new Keybinding();
10519
10856
 
10857
+ const canUsePluginMethods = {
10858
+ async: [],
10859
+ sync: ["openOverlay", "closeOverlay", "updateOverlay", "createStage"]
10860
+ };
10520
10861
  class StageOverlay extends BaseService {
10521
10862
  state = vue.reactive({
10522
10863
  wrapDiv: document.createElement("div"),
@@ -10529,12 +10870,7 @@
10529
10870
  stageOverlayVisible: false
10530
10871
  });
10531
10872
  constructor() {
10532
- super([
10533
- { name: "openOverlay", isAsync: false },
10534
- { name: "closeOverlay", isAsync: false },
10535
- { name: "updateOverlay", isAsync: false },
10536
- { name: "createStage", isAsync: false }
10537
- ]);
10873
+ super(canUsePluginMethods.sync.map((methodName) => ({ name: methodName, isAsync: false })));
10538
10874
  this.get("wrapDiv").classList.add("tmagic-editor-sub-stage-wrap");
10539
10875
  }
10540
10876
  get(name) {
@@ -10601,6 +10937,9 @@
10601
10937
  }
10602
10938
  });
10603
10939
  }
10940
+ usePlugin(options) {
10941
+ super.usePlugin(options);
10942
+ }
10604
10943
  createContentEl() {
10605
10944
  const sourceEl = this.get("sourceEl");
10606
10945
  if (!sourceEl)
@@ -11032,7 +11371,7 @@
11032
11371
  name: "MEditor"
11033
11372
  },
11034
11373
  __name: "Editor",
11035
- props: vue.mergeDefaults({
11374
+ props: /* @__PURE__ */ vue.mergeDefaults({
11036
11375
  modelValue: {},
11037
11376
  componentGroupList: {},
11038
11377
  datasourceList: {},
@@ -11049,7 +11388,7 @@
11049
11388
  datasourceValues: {},
11050
11389
  datasourceConfigs: {},
11051
11390
  datasourceEventMethodList: {},
11052
- moveableOptions: { type: Function },
11391
+ moveableOptions: { type: [Object, Function] },
11053
11392
  defaultSelected: {},
11054
11393
  containerHighlightClassName: {},
11055
11394
  containerHighlightDuration: {},
@@ -11113,13 +11452,13 @@
11113
11452
  vue.provide("stageOptions", stageOptions);
11114
11453
  __expose(services);
11115
11454
  return (_ctx, _cache) => {
11116
- return vue.openBlock(), vue.createBlock(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
11455
+ return vue.openBlock(), vue.createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
11117
11456
  header: vue.withCtx(() => [
11118
11457
  vue.renderSlot(_ctx.$slots, "header")
11119
11458
  ]),
11120
11459
  nav: vue.withCtx(() => [
11121
11460
  vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
11122
- vue.createVNode(_sfc_main$r, { data: _ctx.menu }, null, 8, ["data"])
11461
+ vue.createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
11123
11462
  ])
11124
11463
  ]),
11125
11464
  "content-before": vue.withCtx(() => [
@@ -11162,9 +11501,15 @@
11162
11501
  data
11163
11502
  })
11164
11503
  ]),
11504
+ "code-block-panel-search": vue.withCtx(() => [
11505
+ vue.renderSlot(_ctx.$slots, "code-block-panel-search")
11506
+ ]),
11165
11507
  "data-source-panel-tool": vue.withCtx(({ data }) => [
11166
11508
  vue.renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
11167
11509
  ]),
11510
+ "data-source-panel-search": vue.withCtx(() => [
11511
+ vue.renderSlot(_ctx.$slots, "data-source-panel-search")
11512
+ ]),
11168
11513
  _: 3
11169
11514
  }, 8, ["data", "layer-content-menu", "custom-content-menu"])
11170
11515
  ])
@@ -11188,7 +11533,7 @@
11188
11533
  ]),
11189
11534
  "props-panel": vue.withCtx(() => [
11190
11535
  vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
11191
- vue.createVNode(_sfc_main$q, {
11536
+ vue.createVNode(_sfc_main$p, {
11192
11537
  "extend-state": _ctx.extendFormState,
11193
11538
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
11194
11539
  onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
@@ -11234,23 +11579,23 @@
11234
11579
  const option = Object.assign(defaultInstallOpt, opt || {});
11235
11580
  app.config.globalProperties.$TMAGIC_EDITOR = option;
11236
11581
  setConfig(option);
11237
- app.component(_sfc_main.name, _sfc_main);
11238
- app.component("m-fields-ui-select", _sfc_main$B);
11582
+ app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
11583
+ app.component("magic-code-editor", _sfc_main$U);
11584
+ app.component("m-fields-ui-select", _sfc_main$A);
11239
11585
  app.component("m-fields-code-link", _sfc_main$S);
11240
11586
  app.component("m-fields-vs-code", _sfc_main$T);
11241
- app.component("magic-code-editor", _sfc_main$U);
11242
11587
  app.component("m-fields-code-select", _sfc_main$R);
11243
- app.component("m-fields-code-select-col", _sfc_main$N);
11244
- app.component("m-fields-event-select", _sfc_main$F);
11245
- app.component("m-fields-data-source-fields", _sfc_main$M);
11246
- app.component("m-fields-data-source-mocks", _sfc_main$H);
11247
- app.component("m-fields-key-value", _sfc_main$D);
11248
- app.component("m-fields-data-source-input", _sfc_main$K);
11249
- app.component("m-fields-data-source-select", _sfc_main$G);
11250
- app.component("m-fields-data-source-methods", _sfc_main$J);
11251
- app.component("m-fields-data-source-method-select", _sfc_main$I);
11252
- app.component("m-fields-data-source-field-select", _sfc_main$L);
11253
- app.component("m-fields-page-fragment-select", _sfc_main$C);
11588
+ app.component("m-fields-code-select-col", _sfc_main$M);
11589
+ app.component("m-fields-event-select", _sfc_main$E);
11590
+ app.component("m-fields-data-source-fields", _sfc_main$L);
11591
+ app.component("m-fields-data-source-mocks", _sfc_main$G);
11592
+ app.component("m-fields-key-value", _sfc_main$C);
11593
+ app.component("m-fields-data-source-input", _sfc_main$J);
11594
+ app.component("m-fields-data-source-select", _sfc_main$F);
11595
+ app.component("m-fields-data-source-methods", _sfc_main$I);
11596
+ app.component("m-fields-data-source-method-select", _sfc_main$H);
11597
+ app.component("m-fields-data-source-field-select", _sfc_main$K);
11598
+ app.component("m-fields-page-fragment-select", _sfc_main$B);
11254
11599
  }
11255
11600
  };
11256
11601
 
@@ -11260,41 +11605,42 @@
11260
11605
  });
11261
11606
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
11262
11607
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
11263
- exports.CodeBlockEditor = _sfc_main$Q;
11608
+ exports.CodeBlockEditor = _sfc_main$P;
11264
11609
  exports.CodeBlockList = _sfc_main$l;
11265
11610
  exports.CodeBlockListPanel = _sfc_main$k;
11266
11611
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
11267
11612
  exports.CodeSelect = _sfc_main$R;
11268
- exports.CodeSelectCol = _sfc_main$N;
11613
+ exports.CodeSelectCol = _sfc_main$M;
11269
11614
  exports.ColumnLayout = ColumnLayout;
11270
11615
  exports.ComponentListPanel = _sfc_main$b;
11271
11616
  exports.ContentMenu = _sfc_main$g;
11272
- exports.DataSourceFieldSelect = _sfc_main$L;
11273
- exports.DataSourceFields = _sfc_main$M;
11274
- exports.DataSourceInput = _sfc_main$K;
11275
- exports.DataSourceMethodSelect = _sfc_main$I;
11276
- exports.DataSourceMethods = _sfc_main$J;
11277
- exports.DataSourceMocks = _sfc_main$H;
11278
- exports.DataSourceSelect = _sfc_main$G;
11617
+ exports.DataSourceConfigPanel = _sfc_main$j;
11618
+ exports.DataSourceFieldSelect = _sfc_main$K;
11619
+ exports.DataSourceFields = _sfc_main$L;
11620
+ exports.DataSourceInput = _sfc_main$J;
11621
+ exports.DataSourceMethodSelect = _sfc_main$H;
11622
+ exports.DataSourceMethods = _sfc_main$I;
11623
+ exports.DataSourceMocks = _sfc_main$G;
11624
+ exports.DataSourceSelect = _sfc_main$F;
11279
11625
  exports.DragType = DragType;
11280
- exports.EventSelect = _sfc_main$F;
11626
+ exports.EventSelect = _sfc_main$E;
11281
11627
  exports.Fixed2Other = Fixed2Other;
11282
11628
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
11283
- exports.Icon = _sfc_main$O;
11629
+ exports.Icon = _sfc_main$N;
11284
11630
  exports.KeyBindingCommand = KeyBindingCommand;
11285
- exports.KeyValue = _sfc_main$D;
11631
+ exports.KeyValue = _sfc_main$C;
11286
11632
  exports.Keys = Keys;
11287
11633
  exports.LayerOffset = LayerOffset;
11288
11634
  exports.LayerPanel = _sfc_main$c;
11289
11635
  exports.Layout = Layout;
11290
- exports.LayoutContainer = _sfc_main$z;
11291
- exports.PageFragmentSelect = _sfc_main$C;
11292
- exports.PropsPanel = _sfc_main$q;
11293
- exports.Resizer = _sfc_main$A;
11294
- exports.SplitView = _sfc_main$z;
11636
+ exports.LayoutContainer = _sfc_main$y;
11637
+ exports.PageFragmentSelect = _sfc_main$B;
11638
+ exports.PropsPanel = _sfc_main$p;
11639
+ exports.Resizer = _sfc_main$z;
11640
+ exports.SplitView = _sfc_main$y;
11295
11641
  exports.TMagicCodeEditor = _sfc_main$U;
11296
11642
  exports.TMagicEditor = _sfc_main;
11297
- exports.ToolButton = _sfc_main$y;
11643
+ exports.ToolButton = _sfc_main$x;
11298
11644
  exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
11299
11645
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
11300
11646
  exports.advancedTabConfig = advancedTabConfig;