@tmagic/editor 1.4.3 → 1.4.5
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.
- package/dist/style.css +17 -3
- package/dist/tmagic-editor.js +1309 -1208
- package/dist/tmagic-editor.umd.cjs +1327 -1224
- package/package.json +19 -24
- package/src/Editor.vue +6 -1
- package/src/editorProps.ts +3 -0
- package/src/fields/CodeSelectCol.vue +26 -18
- package/src/fields/DataSourceFieldSelect.vue +23 -61
- package/src/fields/DataSourceMethodSelect.vue +25 -31
- package/src/fields/DataSourceSelect.vue +49 -13
- package/src/fields/EventSelect.vue +37 -14
- package/src/hooks/use-editor-content-height.ts +11 -5
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/Sidebar.vue +24 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +6 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +6 -1
- package/src/layouts/workspace/viewer/Stage.vue +7 -6
- package/src/services/editor.ts +2 -2
- package/src/services/ui.ts +1 -0
- package/src/theme/data-source-field.scss +12 -0
- package/src/theme/props-panel.scss +1 -1
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +31 -2
- package/src/utils/content-menu.ts +7 -3
- package/src/utils/data-source/index.ts +39 -3
- package/src/utils/editor.ts +14 -7
- package/types/components/CodeBlockEditor.vue.d.ts +21 -34
- package/types/components/CodeParams.vue.d.ts +2 -2
- package/types/components/ContentMenu.vue.d.ts +4 -4
- package/types/components/FloatingBox.vue.d.ts +41 -38
- package/types/components/ScrollViewer.vue.d.ts +1 -1
- package/types/components/ToolButton.vue.d.ts +6 -6
- package/types/components/Tree.vue.d.ts +2 -2
- package/types/editorProps.d.ts +3 -0
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/DataSourceFields.vue.d.ts +32 -78
- package/types/fields/DataSourceInput.vue.d.ts +2 -2
- package/types/fields/DataSourceMethods.vue.d.ts +2 -2
- package/types/fields/DataSourceMocks.vue.d.ts +31 -76
- package/types/fields/KeyValue.vue.d.ts +2 -2
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/hooks/use-code-block-edit.d.ts +18 -6
- package/types/hooks/use-data-source-edit.d.ts +18 -6
- package/types/hooks/use-data-source-method.d.ts +18 -6
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/layouts/PropsPanel.vue.d.ts +40 -38
- package/types/layouts/sidebar/Sidebar.vue.d.ts +7 -7
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +20 -30
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +8 -8
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +4 -4
- package/types/layouts/sidebar/layer/use-click.d.ts +13 -13
- package/types/layouts/workspace/Workspace.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +8 -8
- package/types/services/dataSource.d.ts +1 -0
- package/types/services/ui.d.ts +19 -1
- package/types/type.d.ts +26 -2
- package/types/utils/data-source/index.d.ts +3 -2
|
@@ -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/form'), require('@tmagic/schema'), require('
|
|
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/form', '@tmagic/schema', '
|
|
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.form, global.schema, global.
|
|
5
|
-
})(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, form, schema,
|
|
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/form'), require('@tmagic/schema'), require('@tmagic/table'), require('@tmagic/utils'), require('moveable'), require('@tmagic/dep'), require('events'), require('gesto'), require('@tmagic/stage'), 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/form', '@tmagic/schema', '@tmagic/table', '@tmagic/utils', 'moveable', '@tmagic/dep', 'events', 'gesto', '@tmagic/stage', '@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.form, global.schema, global.table, global.utils, global.VanillaMoveable, global.dep, global.events, global.Gesto, global.StageCore, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, form, schema, table, utils, VanillaMoveable, dep, events, Gesto, StageCore, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
25
25
|
|
|
26
|
-
const _hoisted_1$
|
|
26
|
+
const _hoisted_1$u = ["src"];
|
|
27
27
|
const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
28
28
|
...{
|
|
29
29
|
name: "MEditorIcon"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
class: "magic-editor-icon"
|
|
49
49
|
}, {
|
|
50
50
|
default: vue.withCtx(() => [
|
|
51
|
-
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
51
|
+
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$u)
|
|
52
52
|
]),
|
|
53
53
|
_: 1
|
|
54
54
|
})) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
emmetMonacoEs.emmetHTML(monaco__namespace);
|
|
77
77
|
emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
|
|
78
78
|
|
|
79
|
-
const _hoisted_1$
|
|
79
|
+
const _hoisted_1$t = {
|
|
80
80
|
class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
|
|
81
81
|
};
|
|
82
82
|
const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
return (_ctx, _cache) => {
|
|
240
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
240
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
|
|
241
241
|
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
242
242
|
to: "body",
|
|
243
243
|
disabled: !fullScreen.value
|
|
@@ -510,689 +510,163 @@
|
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
512
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
513
|
+
function BaseFormConfig() {
|
|
514
|
+
return [
|
|
515
|
+
{
|
|
516
|
+
name: "id",
|
|
517
|
+
type: "hidden"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "type",
|
|
521
|
+
text: "类型",
|
|
522
|
+
type: "hidden",
|
|
523
|
+
defaultValue: "base"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "title",
|
|
527
|
+
text: "名称",
|
|
528
|
+
rules: [
|
|
529
|
+
{
|
|
530
|
+
required: true,
|
|
531
|
+
message: "请输入名称"
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
name: "description",
|
|
537
|
+
text: "描述"
|
|
538
|
+
}
|
|
539
|
+
];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const HttpFormConfig = [
|
|
543
|
+
{
|
|
544
|
+
name: "autoFetch",
|
|
545
|
+
text: "自动请求",
|
|
546
|
+
type: "switch",
|
|
547
|
+
defaultValue: true
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
name: "responseOptions",
|
|
551
|
+
items: [
|
|
552
|
+
{
|
|
553
|
+
name: "dataPath",
|
|
554
|
+
text: "数据路径"
|
|
544
555
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
556
|
+
]
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: "fieldset",
|
|
560
|
+
name: "options",
|
|
561
|
+
legend: "HTTP 配置",
|
|
562
|
+
items: [
|
|
563
|
+
{
|
|
564
|
+
name: "url",
|
|
565
|
+
text: "URL"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "method",
|
|
569
|
+
text: "Method",
|
|
570
|
+
type: "select",
|
|
571
|
+
options: [
|
|
572
|
+
{ text: "GET", value: "GET" },
|
|
573
|
+
{ text: "POST", value: "POST" },
|
|
574
|
+
{ text: "PUT", value: "PUT" },
|
|
575
|
+
{ text: "DELETE", value: "DELETE" }
|
|
576
|
+
]
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
name: "params",
|
|
580
|
+
type: "key-value",
|
|
581
|
+
defaultValue: {},
|
|
582
|
+
text: "参数"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: "data",
|
|
586
|
+
type: "key-value",
|
|
587
|
+
defaultValue: {},
|
|
588
|
+
advanced: true,
|
|
589
|
+
text: "请求体"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
name: "headers",
|
|
593
|
+
type: "key-value",
|
|
594
|
+
defaultValue: {},
|
|
595
|
+
text: "请求头"
|
|
553
596
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
snappable: true,
|
|
572
|
-
dragTarget: titleEl.value,
|
|
573
|
-
dragTargetSelf: false,
|
|
574
|
-
linePadding: 10,
|
|
575
|
-
controlPadding: 10,
|
|
576
|
-
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
577
|
-
});
|
|
578
|
-
moveable.on("drag", (e) => {
|
|
579
|
-
e.target.style.transform = e.transform;
|
|
580
|
-
});
|
|
581
|
-
moveable.on("resize", (e) => {
|
|
582
|
-
width.value = e.width;
|
|
583
|
-
height.value = e.height;
|
|
584
|
-
e.target.style.width = `${e.width}px`;
|
|
585
|
-
e.target.style.height = `${e.height}px`;
|
|
586
|
-
e.target.style.transform = e.drag.transform;
|
|
587
|
-
});
|
|
588
|
-
};
|
|
589
|
-
const destroyMoveable = () => {
|
|
590
|
-
moveable?.destroy();
|
|
591
|
-
moveable = null;
|
|
592
|
-
};
|
|
593
|
-
vue.watch(
|
|
594
|
-
visible,
|
|
595
|
-
async (visible2) => {
|
|
596
|
-
if (visible2) {
|
|
597
|
-
await vue.nextTick();
|
|
598
|
-
curZIndex.value = zIndex.nextZIndex();
|
|
599
|
-
const targetRect = target.value?.getBoundingClientRect();
|
|
600
|
-
if (targetRect) {
|
|
601
|
-
width.value = targetRect.width;
|
|
602
|
-
height.value = targetRect.height;
|
|
603
|
-
initMoveable();
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
];
|
|
600
|
+
|
|
601
|
+
const fillConfig$1 = (config) => [
|
|
602
|
+
...BaseFormConfig(),
|
|
603
|
+
...config,
|
|
604
|
+
{
|
|
605
|
+
type: "tab",
|
|
606
|
+
items: [
|
|
607
|
+
{
|
|
608
|
+
title: "数据定义",
|
|
609
|
+
items: [
|
|
610
|
+
{
|
|
611
|
+
name: "fields",
|
|
612
|
+
type: "data-source-fields",
|
|
613
|
+
defaultValue: () => []
|
|
604
614
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
title: "方法定义",
|
|
619
|
+
items: [
|
|
620
|
+
{
|
|
621
|
+
name: "methods",
|
|
622
|
+
type: "data-source-methods",
|
|
623
|
+
defaultValue: () => []
|
|
608
624
|
}
|
|
609
|
-
|
|
610
|
-
destroyMoveable();
|
|
611
|
-
}
|
|
625
|
+
]
|
|
612
626
|
},
|
|
613
627
|
{
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
class: "m-editor-float-box-title"
|
|
657
|
-
}, [
|
|
658
|
-
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
659
|
-
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
|
|
660
|
-
]),
|
|
661
|
-
vue.createElementVNode("div", null, [
|
|
662
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
663
|
-
link: "",
|
|
664
|
-
size: "small",
|
|
665
|
-
onClick: closeHandler
|
|
666
|
-
}, {
|
|
667
|
-
default: vue.withCtx(() => [
|
|
668
|
-
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
669
|
-
]),
|
|
670
|
-
_: 1
|
|
671
|
-
})
|
|
672
|
-
])
|
|
673
|
-
], 512),
|
|
674
|
-
vue.createElementVNode("div", {
|
|
675
|
-
class: "m-editor-float-box-body",
|
|
676
|
-
style: vue.normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
677
|
-
}, [
|
|
678
|
-
vue.renderSlot(_ctx.$slots, "body")
|
|
679
|
-
], 4)
|
|
680
|
-
], 36)
|
|
681
|
-
])) : vue.createCommentVNode("", true);
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
const useEditorContentHeight = () => {
|
|
687
|
-
const services = vue.inject("services");
|
|
688
|
-
const frameworkHeight = vue.computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
689
|
-
const navMenuHeight = vue.computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
690
|
-
const editorContentHeight = vue.computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
691
|
-
const height = vue.ref(0);
|
|
692
|
-
vue.watchEffect(() => {
|
|
693
|
-
if (height.value > 0 && height.value === editorContentHeight.value)
|
|
694
|
-
return;
|
|
695
|
-
height.value = editorContentHeight.value;
|
|
696
|
-
});
|
|
697
|
-
return {
|
|
698
|
-
height
|
|
699
|
-
};
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
703
|
-
const boxPosition = vue.ref({
|
|
704
|
-
left: 0,
|
|
705
|
-
top: 0
|
|
706
|
-
});
|
|
707
|
-
const calcBoxPosition = () => {
|
|
708
|
-
const columnWidth = uiService?.get("columnWidth");
|
|
709
|
-
const navMenuRect = uiService?.get("navMenuRect");
|
|
710
|
-
let left = columnWidth?.left ?? 0;
|
|
711
|
-
if (parent?.value) {
|
|
712
|
-
const rect = parent?.value?.getBoundingClientRect();
|
|
713
|
-
left = (rect?.left ?? 0) + (rect?.width ?? 0);
|
|
714
|
-
}
|
|
715
|
-
boxPosition.value = {
|
|
716
|
-
left,
|
|
717
|
-
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
return {
|
|
721
|
-
boxPosition,
|
|
722
|
-
calcBoxPosition
|
|
723
|
-
};
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
const useWindowRect = () => {
|
|
727
|
-
const rect = vue.reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
728
|
-
const windowResizeHandler = () => {
|
|
729
|
-
rect.width = globalThis.innerWidth;
|
|
730
|
-
rect.height = globalThis.innerHeight;
|
|
731
|
-
};
|
|
732
|
-
globalThis.addEventListener("resize", windowResizeHandler);
|
|
733
|
-
vue.onBeforeUnmount(() => {
|
|
734
|
-
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
735
|
-
});
|
|
736
|
-
return {
|
|
737
|
-
rect
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
742
|
-
const _hoisted_2$k = { style: { "flex": "1" } };
|
|
743
|
-
const _hoisted_3$8 = { style: { "flex": "1" } };
|
|
744
|
-
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
745
|
-
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
746
|
-
...{
|
|
747
|
-
name: "MEditorCodeBlockEditor"
|
|
748
|
-
},
|
|
749
|
-
__name: "CodeBlockEditor",
|
|
750
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
751
|
-
content: {},
|
|
752
|
-
disabled: { type: Boolean },
|
|
753
|
-
isDataSource: { type: Boolean },
|
|
754
|
-
dataSourceType: {}
|
|
755
|
-
}, {
|
|
756
|
-
"width": { default: 670 },
|
|
757
|
-
"widthModifiers": {},
|
|
758
|
-
"visible": { type: Boolean, ...{ default: false } },
|
|
759
|
-
"visibleModifiers": {}
|
|
760
|
-
}),
|
|
761
|
-
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
762
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
763
|
-
const width = vue.useModel(__props, "width");
|
|
764
|
-
const boxVisible = vue.useModel(__props, "visible");
|
|
765
|
-
const props = __props;
|
|
766
|
-
const emit = __emit;
|
|
767
|
-
const services = vue.inject("services");
|
|
768
|
-
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
769
|
-
const difVisible = vue.ref(false);
|
|
770
|
-
const { rect: windowRect } = useWindowRect();
|
|
771
|
-
const magicVsEditor = vue.ref();
|
|
772
|
-
const diffChange = () => {
|
|
773
|
-
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
777
|
-
difVisible.value = false;
|
|
778
|
-
};
|
|
779
|
-
const defaultParamColConfig = {
|
|
780
|
-
type: "row",
|
|
781
|
-
label: "参数类型",
|
|
782
|
-
items: [
|
|
783
|
-
{
|
|
784
|
-
text: "参数类型",
|
|
785
|
-
labelWidth: "70px",
|
|
786
|
-
type: "select",
|
|
787
|
-
name: "type",
|
|
788
|
-
options: [
|
|
789
|
-
{
|
|
790
|
-
text: "数字",
|
|
791
|
-
label: "数字",
|
|
792
|
-
value: "number"
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
text: "字符串",
|
|
796
|
-
label: "字符串",
|
|
797
|
-
value: "text"
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
text: "组件",
|
|
801
|
-
label: "组件",
|
|
802
|
-
value: "ui-select"
|
|
803
|
-
}
|
|
804
|
-
]
|
|
805
|
-
}
|
|
806
|
-
]
|
|
807
|
-
};
|
|
808
|
-
const functionConfig = vue.computed(() => [
|
|
809
|
-
{
|
|
810
|
-
text: "名称",
|
|
811
|
-
name: "name",
|
|
812
|
-
rules: [{ required: true, message: "请输入名称", trigger: "blur" }]
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
text: "描述",
|
|
816
|
-
name: "desc"
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
text: "执行时机",
|
|
820
|
-
name: "timing",
|
|
821
|
-
type: "select",
|
|
822
|
-
options: () => {
|
|
823
|
-
const options = [
|
|
824
|
-
{ text: "初始化前", value: "beforeInit" },
|
|
825
|
-
{ text: "初始化后", value: "afterInit" }
|
|
826
|
-
];
|
|
827
|
-
if (props.dataSourceType !== "base") {
|
|
828
|
-
options.push({ text: "请求前", value: "beforeRequest" });
|
|
829
|
-
options.push({ text: "请求后", value: "afterRequest" });
|
|
830
|
-
}
|
|
831
|
-
return options;
|
|
832
|
-
},
|
|
833
|
-
display: () => props.isDataSource
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
type: "table",
|
|
837
|
-
border: true,
|
|
838
|
-
text: "参数",
|
|
839
|
-
enableFullscreen: false,
|
|
840
|
-
enableToggleMode: false,
|
|
841
|
-
name: "params",
|
|
842
|
-
dropSort: false,
|
|
843
|
-
items: [
|
|
844
|
-
{
|
|
845
|
-
type: "text",
|
|
846
|
-
label: "参数名",
|
|
847
|
-
name: "name"
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
type: "text",
|
|
851
|
-
label: "描述",
|
|
852
|
-
name: "extra"
|
|
853
|
-
},
|
|
854
|
-
services?.codeBlockService.getParamsColConfig() || defaultParamColConfig
|
|
855
|
-
]
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
name: "content",
|
|
859
|
-
type: "vs-code",
|
|
860
|
-
options: vue.inject("codeOptions", {}),
|
|
861
|
-
height: "500px",
|
|
862
|
-
onChange: (formState, code) => {
|
|
863
|
-
try {
|
|
864
|
-
getConfig("parseDSL")(code);
|
|
865
|
-
return code;
|
|
866
|
-
} catch (error) {
|
|
867
|
-
design.tMagicMessage.error(error.message);
|
|
868
|
-
throw error;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
]);
|
|
873
|
-
const submitForm = (values) => {
|
|
874
|
-
changedValue.value = void 0;
|
|
875
|
-
emit("submit", values);
|
|
876
|
-
};
|
|
877
|
-
const errorHandler = (error) => {
|
|
878
|
-
design.tMagicMessage.error(error.message);
|
|
879
|
-
};
|
|
880
|
-
const formBox = vue.ref();
|
|
881
|
-
const changedValue = vue.ref();
|
|
882
|
-
const changeHandler = (values) => {
|
|
883
|
-
changedValue.value = values;
|
|
884
|
-
};
|
|
885
|
-
const beforeClose = (done) => {
|
|
886
|
-
if (!changedValue.value) {
|
|
887
|
-
done();
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
design.tMagicMessageBox.confirm("当前代码块已修改,是否保存?", "提示", {
|
|
891
|
-
confirmButtonText: "保存并关闭",
|
|
892
|
-
cancelButtonText: "不保存并关闭",
|
|
893
|
-
type: "warning",
|
|
894
|
-
distinguishCancelAndClose: true
|
|
895
|
-
}).then(() => {
|
|
896
|
-
changedValue.value && submitForm(changedValue.value);
|
|
897
|
-
done();
|
|
898
|
-
}).catch((action) => {
|
|
899
|
-
done(action === "cancel");
|
|
900
|
-
});
|
|
901
|
-
};
|
|
902
|
-
const closedHandler = () => {
|
|
903
|
-
changedValue.value = void 0;
|
|
904
|
-
};
|
|
905
|
-
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
906
|
-
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
907
|
-
__expose({
|
|
908
|
-
async show() {
|
|
909
|
-
calcBoxPosition();
|
|
910
|
-
boxVisible.value = true;
|
|
911
|
-
},
|
|
912
|
-
async hide() {
|
|
913
|
-
boxVisible.value = false;
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
return (_ctx, _cache) => {
|
|
917
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
918
|
-
vue.createVNode(_sfc_main$P, {
|
|
919
|
-
visible: boxVisible.value,
|
|
920
|
-
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
921
|
-
width: width.value,
|
|
922
|
-
"onUpdate:width": _cache[2] || (_cache[2] = ($event) => width.value = $event),
|
|
923
|
-
height: vue.unref(codeBlockEditorHeight),
|
|
924
|
-
"onUpdate:height": _cache[3] || (_cache[3] = ($event) => vue.isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
925
|
-
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
926
|
-
position: vue.unref(boxPosition),
|
|
927
|
-
"before-close": beforeClose
|
|
928
|
-
}, {
|
|
929
|
-
body: vue.withCtx(() => [
|
|
930
|
-
vue.createVNode(vue.unref(form.MFormBox), {
|
|
931
|
-
class: "m-editor-code-block-editor",
|
|
932
|
-
ref_key: "formBox",
|
|
933
|
-
ref: formBox,
|
|
934
|
-
"label-width": "80px",
|
|
935
|
-
"close-on-press-escape": false,
|
|
936
|
-
title: _ctx.content.name,
|
|
937
|
-
config: functionConfig.value,
|
|
938
|
-
values: _ctx.content,
|
|
939
|
-
disabled: _ctx.disabled,
|
|
940
|
-
style: { "height": "100%" },
|
|
941
|
-
onChange: changeHandler,
|
|
942
|
-
onSubmit: submitForm,
|
|
943
|
-
onError: errorHandler,
|
|
944
|
-
onClosed: closedHandler
|
|
945
|
-
}, {
|
|
946
|
-
left: vue.withCtx(() => [
|
|
947
|
-
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
948
|
-
key: 0,
|
|
949
|
-
type: "primary",
|
|
950
|
-
link: "",
|
|
951
|
-
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
952
|
-
}, {
|
|
953
|
-
default: vue.withCtx(() => [
|
|
954
|
-
vue.createTextVNode("查看修改")
|
|
955
|
-
]),
|
|
956
|
-
_: 1
|
|
957
|
-
})) : vue.createCommentVNode("", true)
|
|
958
|
-
]),
|
|
959
|
-
_: 1
|
|
960
|
-
}, 8, ["title", "config", "values", "disabled"])
|
|
961
|
-
]),
|
|
962
|
-
_: 1
|
|
963
|
-
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
964
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
965
|
-
vue.createVNode(vue.unref(design.TMagicDialog), {
|
|
966
|
-
title: "查看修改",
|
|
967
|
-
modelValue: difVisible.value,
|
|
968
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
969
|
-
fullscreen: ""
|
|
970
|
-
}, {
|
|
971
|
-
footer: vue.withCtx(() => [
|
|
972
|
-
vue.createElementVNode("span", _hoisted_4$7, [
|
|
973
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
974
|
-
size: "small",
|
|
975
|
-
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
976
|
-
}, {
|
|
977
|
-
default: vue.withCtx(() => [
|
|
978
|
-
vue.createTextVNode("取消")
|
|
979
|
-
]),
|
|
980
|
-
_: 1
|
|
981
|
-
}),
|
|
982
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
983
|
-
size: "small",
|
|
984
|
-
type: "primary",
|
|
985
|
-
onClick: diffChange
|
|
986
|
-
}, {
|
|
987
|
-
default: vue.withCtx(() => [
|
|
988
|
-
vue.createTextVNode("确定")
|
|
989
|
-
]),
|
|
990
|
-
_: 1
|
|
991
|
-
})
|
|
992
|
-
])
|
|
993
|
-
]),
|
|
994
|
-
default: vue.withCtx(() => [
|
|
995
|
-
vue.createElementVNode("div", _hoisted_1$r, [
|
|
996
|
-
vue.createElementVNode("div", _hoisted_2$k, [
|
|
997
|
-
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
998
|
-
size: "small",
|
|
999
|
-
type: "info"
|
|
1000
|
-
}, {
|
|
1001
|
-
default: vue.withCtx(() => [
|
|
1002
|
-
vue.createTextVNode("修改前")
|
|
1003
|
-
]),
|
|
1004
|
-
_: 1
|
|
1005
|
-
})
|
|
1006
|
-
]),
|
|
1007
|
-
vue.createElementVNode("div", _hoisted_3$8, [
|
|
1008
|
-
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
1009
|
-
size: "small",
|
|
1010
|
-
type: "success"
|
|
1011
|
-
}, {
|
|
1012
|
-
default: vue.withCtx(() => [
|
|
1013
|
-
vue.createTextVNode("修改后")
|
|
1014
|
-
]),
|
|
1015
|
-
_: 1
|
|
1016
|
-
})
|
|
1017
|
-
])
|
|
1018
|
-
]),
|
|
1019
|
-
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
1020
|
-
key: 0,
|
|
1021
|
-
ref_key: "magicVsEditor",
|
|
1022
|
-
ref: magicVsEditor,
|
|
1023
|
-
type: "diff",
|
|
1024
|
-
language: "json",
|
|
1025
|
-
initValues: _ctx.content.content,
|
|
1026
|
-
modifiedValues: formBox.value?.form?.values.content,
|
|
1027
|
-
style: vue.normalizeStyle(`height: ${vue.unref(windowRect).height - 150}px`)
|
|
1028
|
-
}, null, 8, ["initValues", "modifiedValues", "style"])) : vue.createCommentVNode("", true)
|
|
1029
|
-
]),
|
|
1030
|
-
_: 1
|
|
1031
|
-
}, 8, ["modelValue"])
|
|
1032
|
-
]))
|
|
1033
|
-
], 64);
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
|
|
1038
|
-
function BaseFormConfig() {
|
|
1039
|
-
return [
|
|
1040
|
-
{
|
|
1041
|
-
name: "id",
|
|
1042
|
-
type: "hidden"
|
|
1043
|
-
},
|
|
1044
|
-
{
|
|
1045
|
-
name: "type",
|
|
1046
|
-
text: "类型",
|
|
1047
|
-
type: "hidden",
|
|
1048
|
-
defaultValue: "base"
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
name: "title",
|
|
1052
|
-
text: "名称",
|
|
1053
|
-
rules: [
|
|
1054
|
-
{
|
|
1055
|
-
required: true,
|
|
1056
|
-
message: "请输入名称"
|
|
1057
|
-
}
|
|
1058
|
-
]
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
name: "description",
|
|
1062
|
-
text: "描述"
|
|
1063
|
-
}
|
|
1064
|
-
];
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
const HttpFormConfig = [
|
|
1068
|
-
{
|
|
1069
|
-
name: "autoFetch",
|
|
1070
|
-
text: "自动请求",
|
|
1071
|
-
type: "switch",
|
|
1072
|
-
defaultValue: true
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
name: "responseOptions",
|
|
1076
|
-
items: [
|
|
1077
|
-
{
|
|
1078
|
-
name: "dataPath",
|
|
1079
|
-
text: "数据路径"
|
|
1080
|
-
}
|
|
1081
|
-
]
|
|
1082
|
-
},
|
|
1083
|
-
{
|
|
1084
|
-
type: "fieldset",
|
|
1085
|
-
name: "options",
|
|
1086
|
-
legend: "HTTP 配置",
|
|
1087
|
-
items: [
|
|
1088
|
-
{
|
|
1089
|
-
name: "url",
|
|
1090
|
-
text: "URL"
|
|
1091
|
-
},
|
|
1092
|
-
{
|
|
1093
|
-
name: "method",
|
|
1094
|
-
text: "Method",
|
|
1095
|
-
type: "select",
|
|
1096
|
-
options: [
|
|
1097
|
-
{ text: "GET", value: "GET" },
|
|
1098
|
-
{ text: "POST", value: "POST" },
|
|
1099
|
-
{ text: "PUT", value: "PUT" },
|
|
1100
|
-
{ text: "DELETE", value: "DELETE" }
|
|
1101
|
-
]
|
|
1102
|
-
},
|
|
1103
|
-
{
|
|
1104
|
-
name: "params",
|
|
1105
|
-
type: "key-value",
|
|
1106
|
-
defaultValue: {},
|
|
1107
|
-
text: "参数"
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
name: "data",
|
|
1111
|
-
type: "key-value",
|
|
1112
|
-
defaultValue: {},
|
|
1113
|
-
advanced: true,
|
|
1114
|
-
text: "请求体"
|
|
1115
|
-
},
|
|
1116
|
-
{
|
|
1117
|
-
name: "headers",
|
|
1118
|
-
type: "key-value",
|
|
1119
|
-
defaultValue: {},
|
|
1120
|
-
text: "请求头"
|
|
1121
|
-
}
|
|
1122
|
-
]
|
|
1123
|
-
}
|
|
1124
|
-
];
|
|
1125
|
-
|
|
1126
|
-
const fillConfig$1 = (config) => [
|
|
1127
|
-
...BaseFormConfig(),
|
|
1128
|
-
...config,
|
|
1129
|
-
{
|
|
1130
|
-
type: "tab",
|
|
1131
|
-
items: [
|
|
1132
|
-
{
|
|
1133
|
-
title: "数据定义",
|
|
1134
|
-
items: [
|
|
1135
|
-
{
|
|
1136
|
-
name: "fields",
|
|
1137
|
-
type: "data-source-fields",
|
|
1138
|
-
defaultValue: () => []
|
|
1139
|
-
}
|
|
1140
|
-
]
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
title: "方法定义",
|
|
1144
|
-
items: [
|
|
1145
|
-
{
|
|
1146
|
-
name: "methods",
|
|
1147
|
-
type: "data-source-methods",
|
|
1148
|
-
defaultValue: () => []
|
|
1149
|
-
}
|
|
1150
|
-
]
|
|
1151
|
-
},
|
|
1152
|
-
{
|
|
1153
|
-
title: "事件配置",
|
|
1154
|
-
display: false,
|
|
1155
|
-
items: [
|
|
1156
|
-
{
|
|
1157
|
-
name: "events",
|
|
1158
|
-
src: "datasource",
|
|
1159
|
-
type: "event-select"
|
|
1160
|
-
}
|
|
1161
|
-
]
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
title: "mock数据",
|
|
1165
|
-
items: [
|
|
1166
|
-
{
|
|
1167
|
-
name: "mocks",
|
|
1168
|
-
type: "data-source-mocks",
|
|
1169
|
-
defaultValue: () => []
|
|
1170
|
-
}
|
|
1171
|
-
]
|
|
1172
|
-
},
|
|
1173
|
-
{
|
|
1174
|
-
title: "请求参数裁剪",
|
|
1175
|
-
display: (formState, { model }) => model.type === "http",
|
|
1176
|
-
items: [
|
|
1177
|
-
{
|
|
1178
|
-
name: "beforeRequest",
|
|
1179
|
-
type: "vs-code",
|
|
1180
|
-
parse: true,
|
|
1181
|
-
height: "600px"
|
|
1182
|
-
}
|
|
1183
|
-
]
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
title: "响应数据裁剪",
|
|
1187
|
-
display: (formState, { model }) => model.type === "http",
|
|
1188
|
-
items: [
|
|
1189
|
-
{
|
|
1190
|
-
name: "afterResponse",
|
|
1191
|
-
type: "vs-code",
|
|
1192
|
-
parse: true,
|
|
1193
|
-
height: "600px"
|
|
1194
|
-
}
|
|
1195
|
-
]
|
|
628
|
+
title: "事件配置",
|
|
629
|
+
items: [
|
|
630
|
+
{
|
|
631
|
+
name: "events",
|
|
632
|
+
src: "datasource",
|
|
633
|
+
type: "event-select"
|
|
634
|
+
}
|
|
635
|
+
]
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
title: "mock数据",
|
|
639
|
+
items: [
|
|
640
|
+
{
|
|
641
|
+
name: "mocks",
|
|
642
|
+
type: "data-source-mocks",
|
|
643
|
+
defaultValue: () => []
|
|
644
|
+
}
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
title: "请求参数裁剪",
|
|
649
|
+
display: (formState, { model }) => model.type === "http",
|
|
650
|
+
items: [
|
|
651
|
+
{
|
|
652
|
+
name: "beforeRequest",
|
|
653
|
+
type: "vs-code",
|
|
654
|
+
parse: true,
|
|
655
|
+
height: "600px"
|
|
656
|
+
}
|
|
657
|
+
]
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
title: "响应数据裁剪",
|
|
661
|
+
display: (formState, { model }) => model.type === "http",
|
|
662
|
+
items: [
|
|
663
|
+
{
|
|
664
|
+
name: "afterResponse",
|
|
665
|
+
type: "vs-code",
|
|
666
|
+
parse: true,
|
|
667
|
+
height: "600px"
|
|
668
|
+
}
|
|
669
|
+
]
|
|
1196
670
|
}
|
|
1197
671
|
]
|
|
1198
672
|
}
|
|
@@ -1302,6 +776,33 @@
|
|
|
1302
776
|
}
|
|
1303
777
|
return displayState;
|
|
1304
778
|
};
|
|
779
|
+
const getCascaderOptionsFromFields = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
780
|
+
const child = [];
|
|
781
|
+
fields.forEach((field) => {
|
|
782
|
+
if (!dataSourceFieldType.length) {
|
|
783
|
+
dataSourceFieldType.push("any");
|
|
784
|
+
}
|
|
785
|
+
const children = getCascaderOptionsFromFields(field.fields, dataSourceFieldType);
|
|
786
|
+
const item = {
|
|
787
|
+
label: field.title || field.name,
|
|
788
|
+
value: field.name,
|
|
789
|
+
children
|
|
790
|
+
};
|
|
791
|
+
const fieldType = field.type || "any";
|
|
792
|
+
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
793
|
+
child.push(item);
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (!dataSourceFieldType.includes(fieldType) && !["array", "object", "any"].includes(fieldType)) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
child.push(item);
|
|
803
|
+
});
|
|
804
|
+
return child;
|
|
805
|
+
};
|
|
1305
806
|
|
|
1306
807
|
const compose = (middleware, isAsync) => {
|
|
1307
808
|
if (!Array.isArray(middleware))
|
|
@@ -2057,6 +1558,13 @@
|
|
|
2057
1558
|
ColumnLayout2["RIGHT"] = "right";
|
|
2058
1559
|
return ColumnLayout2;
|
|
2059
1560
|
})(ColumnLayout || {});
|
|
1561
|
+
var SideItemKey = /* @__PURE__ */ ((SideItemKey2) => {
|
|
1562
|
+
SideItemKey2["COMPONENT_LIST"] = "component-list";
|
|
1563
|
+
SideItemKey2["LAYER"] = "layer";
|
|
1564
|
+
SideItemKey2["CODE_BLOCK"] = "code-block";
|
|
1565
|
+
SideItemKey2["DATA_SOURCE"] = "data-source";
|
|
1566
|
+
return SideItemKey2;
|
|
1567
|
+
})(SideItemKey || {});
|
|
2060
1568
|
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
2061
1569
|
LayerOffset2["TOP"] = "top";
|
|
2062
1570
|
LayerOffset2["BOTTOM"] = "bottom";
|
|
@@ -2157,11 +1665,13 @@
|
|
|
2157
1665
|
height = 0;
|
|
2158
1666
|
}
|
|
2159
1667
|
const { height: parentHeight } = parentNode.style;
|
|
1668
|
+
const { scrollTop = 0, wrapperHeight } = stage.mask;
|
|
1669
|
+
const wrapperHeightDeal = utils.calcValueByFontsize(stage.renderer.getDocument(), wrapperHeight);
|
|
1670
|
+
const scrollTopDeal = utils.calcValueByFontsize(stage.renderer.getDocument(), scrollTop);
|
|
2160
1671
|
if (utils.isPage(parentNode)) {
|
|
2161
|
-
|
|
2162
|
-
return (wrapperHeight - height) / 2 + scrollTop;
|
|
1672
|
+
return (wrapperHeightDeal - height) / 2 + scrollTopDeal;
|
|
2163
1673
|
}
|
|
2164
|
-
return (parentHeight - height) / 2;
|
|
1674
|
+
return (Math.min(parentHeight, wrapperHeightDeal) - height) / 2;
|
|
2165
1675
|
};
|
|
2166
1676
|
const getInitPositionStyle = (style = {}, layout) => {
|
|
2167
1677
|
if (layout === Layout.ABSOLUTE) {
|
|
@@ -2262,8 +1772,12 @@
|
|
|
2262
1772
|
const el = doc.getElementById(`${config.id}`);
|
|
2263
1773
|
const parentEl = doc.getElementById(`${parent.id}`);
|
|
2264
1774
|
const left = Number(config.style?.left) || 0;
|
|
2265
|
-
if (el && parentEl
|
|
2266
|
-
|
|
1775
|
+
if (el && parentEl) {
|
|
1776
|
+
const calcParentOffsetWidth = utils.calcValueByFontsize(doc, parentEl.offsetWidth);
|
|
1777
|
+
const calcElOffsetWidth = utils.calcValueByFontsize(doc, el.offsetWidth);
|
|
1778
|
+
if (calcElOffsetWidth + left > calcParentOffsetWidth) {
|
|
1779
|
+
return calcParentOffsetWidth - calcElOffsetWidth;
|
|
1780
|
+
}
|
|
2267
1781
|
}
|
|
2268
1782
|
return config.style.left;
|
|
2269
1783
|
};
|
|
@@ -3350,7 +2864,7 @@
|
|
|
3350
2864
|
const el = doc.getElementById(`${node.id}`);
|
|
3351
2865
|
const parentEl = layout === Layout.FIXED ? doc.body : el?.offsetParent;
|
|
3352
2866
|
if (parentEl && el) {
|
|
3353
|
-
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
|
|
2867
|
+
node.style.left = utils.calcValueByFontsize(doc, (parentEl.clientWidth - el.clientWidth) / 2);
|
|
3354
2868
|
node.style.right = "";
|
|
3355
2869
|
}
|
|
3356
2870
|
} else if (parent.style && utils.isNumber(parent.style?.width) && utils.isNumber(node.style?.width)) {
|
|
@@ -3708,7 +3222,7 @@
|
|
|
3708
3222
|
return newNode;
|
|
3709
3223
|
};
|
|
3710
3224
|
|
|
3711
|
-
const _sfc_main$
|
|
3225
|
+
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
3712
3226
|
...{
|
|
3713
3227
|
name: "MEditorCodeParams"
|
|
3714
3228
|
},
|
|
@@ -3758,68 +3272,9 @@
|
|
|
3758
3272
|
}
|
|
3759
3273
|
});
|
|
3760
3274
|
|
|
3761
|
-
const
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
const codeBlockEditor = vue.ref();
|
|
3765
|
-
const createCodeBlock = async () => {
|
|
3766
|
-
if (!codeBlockService) {
|
|
3767
|
-
design.tMagicMessage.error("新增代码块失败");
|
|
3768
|
-
return;
|
|
3769
|
-
}
|
|
3770
|
-
codeConfig.value = {
|
|
3771
|
-
name: "",
|
|
3772
|
-
content: `({app, params}) => {
|
|
3773
|
-
// place your code here
|
|
3774
|
-
}`,
|
|
3775
|
-
params: []
|
|
3776
|
-
};
|
|
3777
|
-
codeId.value = await codeBlockService.getUniqueId();
|
|
3778
|
-
await vue.nextTick();
|
|
3779
|
-
codeBlockEditor.value?.show();
|
|
3780
|
-
};
|
|
3781
|
-
const editCode = async (id) => {
|
|
3782
|
-
const codeBlock = await codeBlockService?.getCodeContentById(id);
|
|
3783
|
-
if (!codeBlock) {
|
|
3784
|
-
design.tMagicMessage.error("获取代码块内容失败");
|
|
3785
|
-
return;
|
|
3786
|
-
}
|
|
3787
|
-
let codeContent = codeBlock.content;
|
|
3788
|
-
if (typeof codeContent !== "string") {
|
|
3789
|
-
codeContent = codeContent.toString();
|
|
3790
|
-
}
|
|
3791
|
-
codeConfig.value = {
|
|
3792
|
-
...lodashEs.cloneDeep(codeBlock),
|
|
3793
|
-
content: codeContent
|
|
3794
|
-
};
|
|
3795
|
-
codeId.value = id;
|
|
3796
|
-
await vue.nextTick();
|
|
3797
|
-
codeBlockEditor.value?.show();
|
|
3798
|
-
};
|
|
3799
|
-
const deleteCode = async (key) => {
|
|
3800
|
-
codeBlockService?.deleteCodeDslByIds([key]);
|
|
3801
|
-
};
|
|
3802
|
-
const submitCodeBlockHandler = async (values) => {
|
|
3803
|
-
if (!codeId.value)
|
|
3804
|
-
return;
|
|
3805
|
-
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3806
|
-
design.tMagicMessage.success("代码块保存成功");
|
|
3807
|
-
codeBlockEditor.value?.hide();
|
|
3808
|
-
};
|
|
3809
|
-
return {
|
|
3810
|
-
codeId,
|
|
3811
|
-
codeConfig,
|
|
3812
|
-
codeBlockEditor,
|
|
3813
|
-
createCodeBlock,
|
|
3814
|
-
editCode,
|
|
3815
|
-
deleteCode,
|
|
3816
|
-
submitCodeBlockHandler
|
|
3817
|
-
};
|
|
3818
|
-
};
|
|
3819
|
-
|
|
3820
|
-
const _hoisted_1$q = { class: "m-fields-code-select-col" };
|
|
3821
|
-
const _hoisted_2$j = { class: "code-select-container" };
|
|
3822
|
-
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
3275
|
+
const _hoisted_1$s = { class: "m-fields-code-select-col" };
|
|
3276
|
+
const _hoisted_2$k = { class: "code-select-container" };
|
|
3277
|
+
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
3823
3278
|
...{
|
|
3824
3279
|
name: "MFieldsCodeSelectCol"
|
|
3825
3280
|
},
|
|
@@ -3839,9 +3294,13 @@
|
|
|
3839
3294
|
setup(__props, { emit: __emit }) {
|
|
3840
3295
|
const mForm = vue.inject("mForm");
|
|
3841
3296
|
const services = vue.inject("services");
|
|
3297
|
+
const eventBus = vue.inject("eventBus");
|
|
3842
3298
|
const emit = __emit;
|
|
3843
|
-
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
3844
3299
|
const props = __props;
|
|
3300
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
3301
|
+
const hasCodeBlockSidePanel = vue.computed(
|
|
3302
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.CODE_BLOCK)
|
|
3303
|
+
);
|
|
3845
3304
|
const getParamItemsConfig = (codeId) => {
|
|
3846
3305
|
if (!codeDsl.value || !codeId)
|
|
3847
3306
|
return [];
|
|
@@ -3892,46 +3351,278 @@
|
|
|
3892
3351
|
props.model.params = value.params;
|
|
3893
3352
|
emit("change", props.model);
|
|
3894
3353
|
};
|
|
3895
|
-
const
|
|
3354
|
+
const editCode = (id) => {
|
|
3355
|
+
eventBus?.emit("edit-code", id);
|
|
3356
|
+
};
|
|
3896
3357
|
return (_ctx, _cache) => {
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
vue.createVNode(_component_m_form_container, {
|
|
3358
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$s, [
|
|
3359
|
+
vue.createElementVNode("div", _hoisted_2$k, [
|
|
3360
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
3901
3361
|
class: "select",
|
|
3902
3362
|
config: selectConfig,
|
|
3903
3363
|
model: _ctx.model,
|
|
3904
3364
|
size: _ctx.size,
|
|
3905
3365
|
onChange: onParamsChangeHandler
|
|
3906
3366
|
}, null, 8, ["model", "size"]),
|
|
3907
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(
|
|
3367
|
+
_ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3908
3368
|
key: 0,
|
|
3909
|
-
class: "
|
|
3910
|
-
|
|
3911
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
3912
|
-
},
|
|
3369
|
+
class: "m-fields-select-action-button",
|
|
3370
|
+
size: _ctx.size,
|
|
3371
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editCode(_ctx.model[_ctx.name]))
|
|
3372
|
+
}, {
|
|
3373
|
+
default: vue.withCtx(() => [
|
|
3374
|
+
vue.createVNode(_sfc_main$U, {
|
|
3375
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
3376
|
+
}, null, 8, ["icon"])
|
|
3377
|
+
]),
|
|
3378
|
+
_: 1
|
|
3379
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
3913
3380
|
]),
|
|
3914
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3381
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
3915
3382
|
name: "params",
|
|
3916
3383
|
key: _ctx.model[_ctx.name],
|
|
3917
3384
|
model: _ctx.model,
|
|
3918
3385
|
size: _ctx.size,
|
|
3919
3386
|
"params-config": paramsConfig.value,
|
|
3920
3387
|
onChange: onParamsChangeHandler
|
|
3921
|
-
}, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true)
|
|
3922
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
3923
|
-
key: 1,
|
|
3924
|
-
ref_key: "codeBlockEditor",
|
|
3925
|
-
ref: codeBlockEditor,
|
|
3926
|
-
disabled: notEditable.value,
|
|
3927
|
-
content: vue.unref(codeConfig),
|
|
3928
|
-
onSubmit: vue.unref(submitCodeBlockHandler)
|
|
3929
|
-
}, null, 8, ["disabled", "content", "onSubmit"])) : vue.createCommentVNode("", true)
|
|
3388
|
+
}, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true)
|
|
3930
3389
|
]);
|
|
3931
3390
|
};
|
|
3932
3391
|
}
|
|
3933
3392
|
});
|
|
3934
3393
|
|
|
3394
|
+
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
3395
|
+
__name: "FloatingBox",
|
|
3396
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
3397
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
3398
|
+
title: { default: "" },
|
|
3399
|
+
beforeClose: {}
|
|
3400
|
+
}, {
|
|
3401
|
+
"width": { default: 0 },
|
|
3402
|
+
"widthModifiers": {},
|
|
3403
|
+
"height": { default: 0 },
|
|
3404
|
+
"heightModifiers": {},
|
|
3405
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
3406
|
+
"visibleModifiers": {}
|
|
3407
|
+
}),
|
|
3408
|
+
emits: ["update:width", "update:height", "update:visible"],
|
|
3409
|
+
setup(__props, { expose: __expose }) {
|
|
3410
|
+
const width = vue.useModel(__props, "width");
|
|
3411
|
+
const height = vue.useModel(__props, "height");
|
|
3412
|
+
const visible = vue.useModel(__props, "visible");
|
|
3413
|
+
const props = __props;
|
|
3414
|
+
const target = vue.ref();
|
|
3415
|
+
const titleEl = vue.ref();
|
|
3416
|
+
const zIndex = design.useZIndex();
|
|
3417
|
+
const curZIndex = vue.ref(0);
|
|
3418
|
+
const titleHeight = vue.ref(0);
|
|
3419
|
+
const bodyHeight = vue.computed(() => {
|
|
3420
|
+
if (height.value) {
|
|
3421
|
+
return height.value - titleHeight.value;
|
|
3422
|
+
}
|
|
3423
|
+
if (target.value) {
|
|
3424
|
+
return target.value.clientHeight - titleHeight.value;
|
|
3425
|
+
}
|
|
3426
|
+
return "auto";
|
|
3427
|
+
});
|
|
3428
|
+
const services = vue.inject("services");
|
|
3429
|
+
const frameworkWidth = vue.computed(() => services?.uiService.get("frameworkRect").width || 0);
|
|
3430
|
+
const style = vue.computed(() => {
|
|
3431
|
+
let { left } = props.position;
|
|
3432
|
+
if (width.value) {
|
|
3433
|
+
left = left + width.value > frameworkWidth.value ? frameworkWidth.value - width.value : left;
|
|
3434
|
+
}
|
|
3435
|
+
return {
|
|
3436
|
+
left: `${left}px`,
|
|
3437
|
+
top: `${props.position.top}px`,
|
|
3438
|
+
width: width.value ? `${width.value}px` : "auto",
|
|
3439
|
+
height: height.value ? `${height.value}px` : "auto"
|
|
3440
|
+
};
|
|
3441
|
+
});
|
|
3442
|
+
let moveable = null;
|
|
3443
|
+
const initMoveable = () => {
|
|
3444
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
3445
|
+
className: "m-editor-floating-box-moveable",
|
|
3446
|
+
target: target.value,
|
|
3447
|
+
draggable: true,
|
|
3448
|
+
resizable: true,
|
|
3449
|
+
edge: true,
|
|
3450
|
+
keepRatio: false,
|
|
3451
|
+
origin: false,
|
|
3452
|
+
snappable: true,
|
|
3453
|
+
dragTarget: titleEl.value,
|
|
3454
|
+
dragTargetSelf: false,
|
|
3455
|
+
linePadding: 10,
|
|
3456
|
+
controlPadding: 10,
|
|
3457
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
3458
|
+
});
|
|
3459
|
+
moveable.on("drag", (e) => {
|
|
3460
|
+
e.target.style.transform = e.transform;
|
|
3461
|
+
});
|
|
3462
|
+
moveable.on("resize", (e) => {
|
|
3463
|
+
width.value = e.width;
|
|
3464
|
+
height.value = e.height;
|
|
3465
|
+
e.target.style.width = `${e.width}px`;
|
|
3466
|
+
e.target.style.height = `${e.height}px`;
|
|
3467
|
+
e.target.style.transform = e.drag.transform;
|
|
3468
|
+
});
|
|
3469
|
+
};
|
|
3470
|
+
const destroyMoveable = () => {
|
|
3471
|
+
moveable?.destroy();
|
|
3472
|
+
moveable = null;
|
|
3473
|
+
};
|
|
3474
|
+
vue.watch(
|
|
3475
|
+
visible,
|
|
3476
|
+
async (visible2) => {
|
|
3477
|
+
if (visible2) {
|
|
3478
|
+
await vue.nextTick();
|
|
3479
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3480
|
+
const targetRect = target.value?.getBoundingClientRect();
|
|
3481
|
+
if (targetRect) {
|
|
3482
|
+
width.value = targetRect.width;
|
|
3483
|
+
height.value = targetRect.height;
|
|
3484
|
+
initMoveable();
|
|
3485
|
+
}
|
|
3486
|
+
if (titleEl.value) {
|
|
3487
|
+
const titleRect = titleEl.value.getBoundingClientRect();
|
|
3488
|
+
titleHeight.value = titleRect.height;
|
|
3489
|
+
}
|
|
3490
|
+
} else {
|
|
3491
|
+
destroyMoveable();
|
|
3492
|
+
}
|
|
3493
|
+
},
|
|
3494
|
+
{
|
|
3495
|
+
immediate: true
|
|
3496
|
+
}
|
|
3497
|
+
);
|
|
3498
|
+
vue.onBeforeUnmount(() => {
|
|
3499
|
+
destroyMoveable();
|
|
3500
|
+
});
|
|
3501
|
+
const hide = (cancel) => {
|
|
3502
|
+
if (cancel !== false) {
|
|
3503
|
+
visible.value = false;
|
|
3504
|
+
}
|
|
3505
|
+
};
|
|
3506
|
+
const closeHandler = () => {
|
|
3507
|
+
if (typeof props.beforeClose === "function") {
|
|
3508
|
+
props.beforeClose(hide);
|
|
3509
|
+
} else {
|
|
3510
|
+
hide();
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
const nextZIndex = () => {
|
|
3514
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3515
|
+
};
|
|
3516
|
+
vue.provide("parentFloating", target);
|
|
3517
|
+
__expose({
|
|
3518
|
+
bodyHeight,
|
|
3519
|
+
target,
|
|
3520
|
+
titleEl
|
|
3521
|
+
});
|
|
3522
|
+
return (_ctx, _cache) => {
|
|
3523
|
+
return visible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
3524
|
+
key: 0,
|
|
3525
|
+
to: "body"
|
|
3526
|
+
}, [
|
|
3527
|
+
vue.createElementVNode("div", {
|
|
3528
|
+
ref_key: "target",
|
|
3529
|
+
ref: target,
|
|
3530
|
+
class: "m-editor-float-box",
|
|
3531
|
+
style: vue.normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
3532
|
+
onMousedown: nextZIndex
|
|
3533
|
+
}, [
|
|
3534
|
+
vue.createElementVNode("div", {
|
|
3535
|
+
ref_key: "titleEl",
|
|
3536
|
+
ref: titleEl,
|
|
3537
|
+
class: "m-editor-float-box-title"
|
|
3538
|
+
}, [
|
|
3539
|
+
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
3540
|
+
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
|
|
3541
|
+
]),
|
|
3542
|
+
vue.createElementVNode("div", null, [
|
|
3543
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3544
|
+
link: "",
|
|
3545
|
+
size: "small",
|
|
3546
|
+
onClick: closeHandler
|
|
3547
|
+
}, {
|
|
3548
|
+
default: vue.withCtx(() => [
|
|
3549
|
+
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
3550
|
+
]),
|
|
3551
|
+
_: 1
|
|
3552
|
+
})
|
|
3553
|
+
])
|
|
3554
|
+
], 512),
|
|
3555
|
+
vue.createElementVNode("div", {
|
|
3556
|
+
class: "m-editor-float-box-body",
|
|
3557
|
+
style: vue.normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
3558
|
+
}, [
|
|
3559
|
+
vue.renderSlot(_ctx.$slots, "body")
|
|
3560
|
+
], 4)
|
|
3561
|
+
], 36)
|
|
3562
|
+
])) : vue.createCommentVNode("", true);
|
|
3563
|
+
};
|
|
3564
|
+
}
|
|
3565
|
+
});
|
|
3566
|
+
|
|
3567
|
+
const useCodeBlockEdit = (codeBlockService) => {
|
|
3568
|
+
const codeConfig = vue.ref();
|
|
3569
|
+
const codeId = vue.ref();
|
|
3570
|
+
const codeBlockEditor = vue.ref();
|
|
3571
|
+
const createCodeBlock = async () => {
|
|
3572
|
+
if (!codeBlockService) {
|
|
3573
|
+
design.tMagicMessage.error("新增代码块失败");
|
|
3574
|
+
return;
|
|
3575
|
+
}
|
|
3576
|
+
codeConfig.value = {
|
|
3577
|
+
name: "",
|
|
3578
|
+
content: `({app, params}) => {
|
|
3579
|
+
// place your code here
|
|
3580
|
+
}`,
|
|
3581
|
+
params: []
|
|
3582
|
+
};
|
|
3583
|
+
codeId.value = await codeBlockService.getUniqueId();
|
|
3584
|
+
await vue.nextTick();
|
|
3585
|
+
codeBlockEditor.value?.show();
|
|
3586
|
+
};
|
|
3587
|
+
const editCode = async (id) => {
|
|
3588
|
+
const codeBlock = await codeBlockService?.getCodeContentById(id);
|
|
3589
|
+
if (!codeBlock) {
|
|
3590
|
+
design.tMagicMessage.error("获取代码块内容失败");
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3593
|
+
let codeContent = codeBlock.content;
|
|
3594
|
+
if (typeof codeContent !== "string") {
|
|
3595
|
+
codeContent = codeContent.toString();
|
|
3596
|
+
}
|
|
3597
|
+
codeConfig.value = {
|
|
3598
|
+
...lodashEs.cloneDeep(codeBlock),
|
|
3599
|
+
content: codeContent
|
|
3600
|
+
};
|
|
3601
|
+
codeId.value = id;
|
|
3602
|
+
await vue.nextTick();
|
|
3603
|
+
codeBlockEditor.value?.show();
|
|
3604
|
+
};
|
|
3605
|
+
const deleteCode = async (key) => {
|
|
3606
|
+
codeBlockService?.deleteCodeDslByIds([key]);
|
|
3607
|
+
};
|
|
3608
|
+
const submitCodeBlockHandler = async (values) => {
|
|
3609
|
+
if (!codeId.value)
|
|
3610
|
+
return;
|
|
3611
|
+
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3612
|
+
design.tMagicMessage.success("代码块保存成功");
|
|
3613
|
+
codeBlockEditor.value?.hide();
|
|
3614
|
+
};
|
|
3615
|
+
return {
|
|
3616
|
+
codeId,
|
|
3617
|
+
codeConfig,
|
|
3618
|
+
codeBlockEditor,
|
|
3619
|
+
createCodeBlock,
|
|
3620
|
+
editCode,
|
|
3621
|
+
deleteCode,
|
|
3622
|
+
submitCodeBlockHandler
|
|
3623
|
+
};
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3935
3626
|
const useDataSourceMethod = () => {
|
|
3936
3627
|
const codeConfig = vue.ref();
|
|
3937
3628
|
const codeBlockEditor = vue.ref();
|
|
@@ -4026,6 +3717,7 @@
|
|
|
4026
3717
|
propsPanelSize: "small",
|
|
4027
3718
|
showAddPageButton: true,
|
|
4028
3719
|
hideSlideBar: false,
|
|
3720
|
+
sideBarItems: [],
|
|
4029
3721
|
navMenuRect: {
|
|
4030
3722
|
left: 0,
|
|
4031
3723
|
top: 0,
|
|
@@ -4269,9 +3961,70 @@
|
|
|
4269
3961
|
};
|
|
4270
3962
|
};
|
|
4271
3963
|
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
|
|
3964
|
+
const useWindowRect = () => {
|
|
3965
|
+
const rect = vue.reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
3966
|
+
const windowResizeHandler = () => {
|
|
3967
|
+
rect.width = globalThis.innerWidth;
|
|
3968
|
+
rect.height = globalThis.innerHeight;
|
|
3969
|
+
};
|
|
3970
|
+
globalThis.addEventListener("resize", windowResizeHandler);
|
|
3971
|
+
vue.onBeforeUnmount(() => {
|
|
3972
|
+
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
3973
|
+
});
|
|
3974
|
+
return {
|
|
3975
|
+
rect
|
|
3976
|
+
};
|
|
3977
|
+
};
|
|
3978
|
+
|
|
3979
|
+
const useEditorContentHeight = () => {
|
|
3980
|
+
const services = vue.inject("services");
|
|
3981
|
+
const frameworkHeight = vue.computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
3982
|
+
const navMenuHeight = vue.computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
3983
|
+
const editorContentHeight = vue.computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
3984
|
+
const height = vue.ref(0);
|
|
3985
|
+
vue.watch(
|
|
3986
|
+
editorContentHeight,
|
|
3987
|
+
() => {
|
|
3988
|
+
if (height.value > 0 && height.value === editorContentHeight.value)
|
|
3989
|
+
return;
|
|
3990
|
+
height.value = editorContentHeight.value;
|
|
3991
|
+
},
|
|
3992
|
+
{
|
|
3993
|
+
immediate: true
|
|
3994
|
+
}
|
|
3995
|
+
);
|
|
3996
|
+
return {
|
|
3997
|
+
height
|
|
3998
|
+
};
|
|
3999
|
+
};
|
|
4000
|
+
|
|
4001
|
+
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
4002
|
+
const boxPosition = vue.ref({
|
|
4003
|
+
left: 0,
|
|
4004
|
+
top: 0
|
|
4005
|
+
});
|
|
4006
|
+
const calcBoxPosition = () => {
|
|
4007
|
+
const columnWidth = uiService?.get("columnWidth");
|
|
4008
|
+
const navMenuRect = uiService?.get("navMenuRect");
|
|
4009
|
+
let left = columnWidth?.left ?? 0;
|
|
4010
|
+
if (parent?.value) {
|
|
4011
|
+
const rect = parent?.value?.getBoundingClientRect();
|
|
4012
|
+
left = (rect?.left ?? 0) + (rect?.width ?? 0);
|
|
4013
|
+
}
|
|
4014
|
+
boxPosition.value = {
|
|
4015
|
+
left,
|
|
4016
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
4017
|
+
};
|
|
4018
|
+
};
|
|
4019
|
+
return {
|
|
4020
|
+
boxPosition,
|
|
4021
|
+
calcBoxPosition
|
|
4022
|
+
};
|
|
4023
|
+
};
|
|
4024
|
+
|
|
4025
|
+
const _hoisted_1$r = { class: "m-editor-data-source-fields" };
|
|
4026
|
+
const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
|
|
4027
|
+
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
4275
4028
|
...{
|
|
4276
4029
|
name: "MFieldsDataSourceFields"
|
|
4277
4030
|
},
|
|
@@ -4526,12 +4279,12 @@
|
|
|
4526
4279
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4527
4280
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4528
4281
|
return (_ctx, _cache) => {
|
|
4529
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4282
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$r, [
|
|
4530
4283
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
4531
4284
|
data: _ctx.model[_ctx.name],
|
|
4532
4285
|
columns: fieldColumns
|
|
4533
4286
|
}, null, 8, ["data"]),
|
|
4534
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
4287
|
+
vue.createElementVNode("div", _hoisted_2$j, [
|
|
4535
4288
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4536
4289
|
size: "small",
|
|
4537
4290
|
disabled: _ctx.disabled,
|
|
@@ -4556,7 +4309,7 @@
|
|
|
4556
4309
|
_: 1
|
|
4557
4310
|
}, 8, ["disabled"])
|
|
4558
4311
|
]),
|
|
4559
|
-
vue.createVNode(_sfc_main$
|
|
4312
|
+
vue.createVNode(_sfc_main$N, {
|
|
4560
4313
|
visible: addDialogVisible.value,
|
|
4561
4314
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
|
4562
4315
|
width: width.value,
|
|
@@ -4579,7 +4332,7 @@
|
|
|
4579
4332
|
]),
|
|
4580
4333
|
_: 1
|
|
4581
4334
|
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4582
|
-
vue.createVNode(_sfc_main$
|
|
4335
|
+
vue.createVNode(_sfc_main$N, {
|
|
4583
4336
|
visible: addFromJsonDialogVisible.value,
|
|
4584
4337
|
"onUpdate:visible": _cache[5] || (_cache[5] = ($event) => addFromJsonDialogVisible.value = $event),
|
|
4585
4338
|
width: width.value,
|
|
@@ -4604,115 +4357,8 @@
|
|
|
4604
4357
|
}
|
|
4605
4358
|
});
|
|
4606
4359
|
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4609
|
-
const editDialog = vue.ref();
|
|
4610
|
-
const dataSourceValues = vue.ref({});
|
|
4611
|
-
const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
|
|
4612
|
-
const editHandler = (id) => {
|
|
4613
|
-
if (!editDialog.value)
|
|
4614
|
-
return;
|
|
4615
|
-
dataSourceValues.value = {
|
|
4616
|
-
...dataSourceService?.getDataSourceById(id)
|
|
4617
|
-
};
|
|
4618
|
-
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
4619
|
-
editDialog.value.show();
|
|
4620
|
-
};
|
|
4621
|
-
const submitDataSourceHandler = (value) => {
|
|
4622
|
-
if (value.id) {
|
|
4623
|
-
dataSourceService?.update(value);
|
|
4624
|
-
} else {
|
|
4625
|
-
dataSourceService?.add(value);
|
|
4626
|
-
}
|
|
4627
|
-
editDialog.value?.hide();
|
|
4628
|
-
};
|
|
4629
|
-
return {
|
|
4630
|
-
dialogTitle,
|
|
4631
|
-
editDialog,
|
|
4632
|
-
dataSourceValues,
|
|
4633
|
-
editable,
|
|
4634
|
-
editHandler,
|
|
4635
|
-
submitDataSourceHandler
|
|
4636
|
-
};
|
|
4637
|
-
};
|
|
4638
|
-
|
|
4639
|
-
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
4640
|
-
...{
|
|
4641
|
-
name: "MEditorDataSourceConfigPanel"
|
|
4642
|
-
},
|
|
4643
|
-
__name: "DataSourceConfigPanel",
|
|
4644
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
4645
|
-
title: {},
|
|
4646
|
-
values: {},
|
|
4647
|
-
disabled: { type: Boolean }
|
|
4648
|
-
}, {
|
|
4649
|
-
"visible": { type: Boolean, ...{ default: false } },
|
|
4650
|
-
"visibleModifiers": {},
|
|
4651
|
-
"width": { default: 670 },
|
|
4652
|
-
"widthModifiers": {}
|
|
4653
|
-
}),
|
|
4654
|
-
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
4655
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4656
|
-
const props = __props;
|
|
4657
|
-
const boxVisible = vue.useModel(__props, "visible");
|
|
4658
|
-
const width = vue.useModel(__props, "width");
|
|
4659
|
-
const emit = __emit;
|
|
4660
|
-
const services = vue.inject("services");
|
|
4661
|
-
const initValues = vue.ref({});
|
|
4662
|
-
const dataSourceConfig = vue.ref([]);
|
|
4663
|
-
const { height: editorHeight } = useEditorContentHeight();
|
|
4664
|
-
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4665
|
-
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4666
|
-
vue.watchEffect(() => {
|
|
4667
|
-
initValues.value = props.values;
|
|
4668
|
-
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
4669
|
-
});
|
|
4670
|
-
const submitHandler = (values) => {
|
|
4671
|
-
emit("submit", values);
|
|
4672
|
-
};
|
|
4673
|
-
const errorHandler = (error) => {
|
|
4674
|
-
design.tMagicMessage.error(error.message);
|
|
4675
|
-
};
|
|
4676
|
-
__expose({
|
|
4677
|
-
show() {
|
|
4678
|
-
calcBoxPosition();
|
|
4679
|
-
boxVisible.value = true;
|
|
4680
|
-
},
|
|
4681
|
-
hide() {
|
|
4682
|
-
boxVisible.value = false;
|
|
4683
|
-
}
|
|
4684
|
-
});
|
|
4685
|
-
return (_ctx, _cache) => {
|
|
4686
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
4687
|
-
visible: boxVisible.value,
|
|
4688
|
-
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
4689
|
-
width: width.value,
|
|
4690
|
-
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
4691
|
-
height: vue.unref(editorHeight),
|
|
4692
|
-
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => vue.isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
4693
|
-
title: _ctx.title,
|
|
4694
|
-
position: vue.unref(boxPosition)
|
|
4695
|
-
}, {
|
|
4696
|
-
body: vue.withCtx(() => [
|
|
4697
|
-
vue.createVNode(vue.unref(form.MFormBox), {
|
|
4698
|
-
"label-width": "80px",
|
|
4699
|
-
title: _ctx.title,
|
|
4700
|
-
config: dataSourceConfig.value,
|
|
4701
|
-
values: initValues.value,
|
|
4702
|
-
disabled: _ctx.disabled,
|
|
4703
|
-
style: { "height": "100%" },
|
|
4704
|
-
onSubmit: submitHandler,
|
|
4705
|
-
onError: errorHandler
|
|
4706
|
-
}, null, 8, ["title", "config", "values", "disabled"])
|
|
4707
|
-
]),
|
|
4708
|
-
_: 1
|
|
4709
|
-
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
4710
|
-
};
|
|
4711
|
-
}
|
|
4712
|
-
});
|
|
4713
|
-
|
|
4714
|
-
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4715
|
-
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
4360
|
+
const _hoisted_1$q = { class: "m-fields-data-source-field-select" };
|
|
4361
|
+
const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
4716
4362
|
...{
|
|
4717
4363
|
name: "MFieldsDataSourceFieldSelect"
|
|
4718
4364
|
},
|
|
@@ -4731,8 +4377,13 @@
|
|
|
4731
4377
|
emits: ["change"],
|
|
4732
4378
|
setup(__props, { emit: __emit }) {
|
|
4733
4379
|
const services = vue.inject("services");
|
|
4380
|
+
const eventBus = vue.inject("eventBus");
|
|
4734
4381
|
const emit = __emit;
|
|
4735
4382
|
const props = __props;
|
|
4383
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
4384
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
4385
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
4386
|
+
);
|
|
4736
4387
|
const selectedDataSourceId = vue.computed(() => {
|
|
4737
4388
|
const value = props.model[props.name];
|
|
4738
4389
|
if (!Array.isArray(value) || !value.length) {
|
|
@@ -4741,33 +4392,6 @@
|
|
|
4741
4392
|
return value[0].replace(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, "");
|
|
4742
4393
|
});
|
|
4743
4394
|
const dataSources = vue.computed(() => services?.dataSourceService.get("dataSources"));
|
|
4744
|
-
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4745
|
-
const child = [];
|
|
4746
|
-
fields.forEach((field) => {
|
|
4747
|
-
if (!dataSourceFieldType.length) {
|
|
4748
|
-
dataSourceFieldType.push("any");
|
|
4749
|
-
}
|
|
4750
|
-
const children = getOptionChildren(field.fields, dataSourceFieldType);
|
|
4751
|
-
const item = {
|
|
4752
|
-
label: field.title || field.name,
|
|
4753
|
-
value: field.name,
|
|
4754
|
-
children
|
|
4755
|
-
};
|
|
4756
|
-
const fieldType = field.type || "any";
|
|
4757
|
-
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
4758
|
-
child.push(item);
|
|
4759
|
-
return;
|
|
4760
|
-
}
|
|
4761
|
-
if (!dataSourceFieldType.includes(fieldType) && !["array", "object", "any"].includes(fieldType)) {
|
|
4762
|
-
return;
|
|
4763
|
-
}
|
|
4764
|
-
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
4765
|
-
return;
|
|
4766
|
-
}
|
|
4767
|
-
child.push(item);
|
|
4768
|
-
});
|
|
4769
|
-
return child;
|
|
4770
|
-
};
|
|
4771
4395
|
const cascaderConfig = vue.computed(() => {
|
|
4772
4396
|
const valueIsKey = props.config.value === "key";
|
|
4773
4397
|
return {
|
|
@@ -4778,7 +4402,7 @@
|
|
|
4778
4402
|
const options = dataSources.value?.map((ds) => ({
|
|
4779
4403
|
label: ds.title || ds.id,
|
|
4780
4404
|
value: valueIsKey ? ds.id : `${utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
4781
|
-
children:
|
|
4405
|
+
children: getCascaderOptionsFromFields(ds.fields, props.config.dataSourceFieldType)
|
|
4782
4406
|
})) || [];
|
|
4783
4407
|
return options.filter((option) => option.children.length);
|
|
4784
4408
|
}
|
|
@@ -4824,13 +4448,12 @@
|
|
|
4824
4448
|
const onChangeHandler = (value) => {
|
|
4825
4449
|
emit("change", value);
|
|
4826
4450
|
};
|
|
4827
|
-
const
|
|
4828
|
-
|
|
4829
|
-
|
|
4451
|
+
const editHandler = (id) => {
|
|
4452
|
+
eventBus?.emit("edit-data-source", id);
|
|
4453
|
+
};
|
|
4830
4454
|
return (_ctx, _cache) => {
|
|
4831
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4455
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$q, [
|
|
4832
4456
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
|
|
4833
|
-
style: { "width": "100%" },
|
|
4834
4457
|
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
4835
4458
|
model: _ctx.model,
|
|
4836
4459
|
name: _ctx.name,
|
|
@@ -4842,14 +4465,16 @@
|
|
|
4842
4465
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4843
4466
|
onChange: onChangeHandler
|
|
4844
4467
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4845
|
-
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4468
|
+
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4846
4469
|
key: 0,
|
|
4847
|
-
|
|
4470
|
+
class: "m-fields-select-action-button",
|
|
4848
4471
|
size: _ctx.size,
|
|
4849
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
4472
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectedDataSourceId.value))
|
|
4850
4473
|
}, {
|
|
4851
4474
|
default: vue.withCtx(() => [
|
|
4852
|
-
vue.createVNode(_sfc_main$U, {
|
|
4475
|
+
vue.createVNode(_sfc_main$U, {
|
|
4476
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
4477
|
+
}, null, 8, ["icon"])
|
|
4853
4478
|
]),
|
|
4854
4479
|
_: 1
|
|
4855
4480
|
}, 8, ["size"])) : vue.createCommentVNode("", true),
|
|
@@ -4864,24 +4489,16 @@
|
|
|
4864
4489
|
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4865
4490
|
]),
|
|
4866
4491
|
_: 1
|
|
4867
|
-
}, 8, ["type", "size"])) : vue.createCommentVNode("", true)
|
|
4868
|
-
vue.createVNode(_sfc_main$K, {
|
|
4869
|
-
ref_key: "editDialog",
|
|
4870
|
-
ref: editDialog,
|
|
4871
|
-
disabled: !vue.unref(editable),
|
|
4872
|
-
values: vue.unref(dataSourceValues),
|
|
4873
|
-
title: vue.unref(dialogTitle),
|
|
4874
|
-
onSubmit: vue.unref(submitDataSourceHandler)
|
|
4875
|
-
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
4492
|
+
}, 8, ["type", "size"])) : vue.createCommentVNode("", true)
|
|
4876
4493
|
]);
|
|
4877
4494
|
};
|
|
4878
4495
|
}
|
|
4879
4496
|
});
|
|
4880
4497
|
|
|
4881
|
-
const _hoisted_1$
|
|
4882
|
-
const _hoisted_2$
|
|
4883
|
-
const _hoisted_3$
|
|
4884
|
-
const _sfc_main$
|
|
4498
|
+
const _hoisted_1$p = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4499
|
+
const _hoisted_2$i = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4500
|
+
const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
|
|
4501
|
+
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
4885
4502
|
...{
|
|
4886
4503
|
name: "MFieldsDataSourceInput"
|
|
4887
4504
|
},
|
|
@@ -4988,138 +4605,435 @@
|
|
|
4988
4605
|
}
|
|
4989
4606
|
}
|
|
4990
4607
|
}
|
|
4991
|
-
if (curCharIsDot(dotIndex)) {
|
|
4992
|
-
result = fields || [];
|
|
4993
|
-
} else if (dotIndex > -1) {
|
|
4994
|
-
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
4995
|
-
result = fields.filter(
|
|
4996
|
-
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
4997
|
-
) || [];
|
|
4998
|
-
}
|
|
4999
|
-
cb(
|
|
5000
|
-
result.map((field) => ({
|
|
5001
|
-
value: field.name,
|
|
5002
|
-
text: field.title,
|
|
5003
|
-
type: "field"
|
|
5004
|
-
}))
|
|
5005
|
-
);
|
|
4608
|
+
if (curCharIsDot(dotIndex)) {
|
|
4609
|
+
result = fields || [];
|
|
4610
|
+
} else if (dotIndex > -1) {
|
|
4611
|
+
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
4612
|
+
result = fields.filter(
|
|
4613
|
+
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
4614
|
+
) || [];
|
|
4615
|
+
}
|
|
4616
|
+
cb(
|
|
4617
|
+
result.map((field) => ({
|
|
4618
|
+
value: field.name,
|
|
4619
|
+
text: field.title,
|
|
4620
|
+
type: "field"
|
|
4621
|
+
}))
|
|
4622
|
+
);
|
|
4623
|
+
};
|
|
4624
|
+
const querySearch = (queryString, cb) => {
|
|
4625
|
+
inputText = queryString;
|
|
4626
|
+
const selectionStart = getSelectionStart();
|
|
4627
|
+
const curQueryString = queryString.substring(0, selectionStart);
|
|
4628
|
+
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
4629
|
+
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
4630
|
+
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
4631
|
+
if (isFieldTip) {
|
|
4632
|
+
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
4633
|
+
} else {
|
|
4634
|
+
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
4635
|
+
}
|
|
4636
|
+
};
|
|
4637
|
+
const selectHandler = async ({ value, type }) => {
|
|
4638
|
+
const isDataSource = type === "dataSource";
|
|
4639
|
+
const selectionStart = input.value?.selectionStart || 0;
|
|
4640
|
+
let startText = inputText.substring(0, selectionStart);
|
|
4641
|
+
const dotIndex = startText.lastIndexOf(".");
|
|
4642
|
+
const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
|
|
4643
|
+
const endText = inputText.substring(selectionStart);
|
|
4644
|
+
let suggestText = value;
|
|
4645
|
+
if (isDataSource) {
|
|
4646
|
+
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
4647
|
+
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
4648
|
+
}
|
|
4649
|
+
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
4650
|
+
suggestText = `${suggestText}}`;
|
|
4651
|
+
}
|
|
4652
|
+
} else if (!curCharIsDot(dotIndex)) {
|
|
4653
|
+
startText = startText.substring(0, dotIndex + 1);
|
|
4654
|
+
}
|
|
4655
|
+
state.value = `${startText}${suggestText}${endText}`;
|
|
4656
|
+
await vue.nextTick();
|
|
4657
|
+
let newSelectionStart = 0;
|
|
4658
|
+
if (isDataSource) {
|
|
4659
|
+
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
4660
|
+
} else {
|
|
4661
|
+
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4662
|
+
}
|
|
4663
|
+
input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
|
|
4664
|
+
changeHandler(state.value);
|
|
4665
|
+
};
|
|
4666
|
+
return (_ctx, _cache) => {
|
|
4667
|
+
return _ctx.disabled || isFocused.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(design.getConfig)("components")?.autocomplete.component || "el-autocomplete"), vue.mergeProps(
|
|
4668
|
+
{
|
|
4669
|
+
key: 0,
|
|
4670
|
+
class: "tmagic-design-auto-complete",
|
|
4671
|
+
ref_key: "autocomplete",
|
|
4672
|
+
ref: autocomplete,
|
|
4673
|
+
modelValue: state.value,
|
|
4674
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
|
|
4675
|
+
},
|
|
4676
|
+
vue.unref(design.getConfig)("components")?.autocomplete.props({
|
|
4677
|
+
disabled: _ctx.disabled,
|
|
4678
|
+
size: _ctx.size,
|
|
4679
|
+
fetchSuggestions: querySearch,
|
|
4680
|
+
triggerOnFocus: false,
|
|
4681
|
+
clearable: true
|
|
4682
|
+
}) || {},
|
|
4683
|
+
{
|
|
4684
|
+
style: { "width": "100%" },
|
|
4685
|
+
onBlur: blurHandler,
|
|
4686
|
+
onInput: inputHandler,
|
|
4687
|
+
onSelect: selectHandler
|
|
4688
|
+
}
|
|
4689
|
+
), {
|
|
4690
|
+
suffix: vue.withCtx(() => [
|
|
4691
|
+
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4692
|
+
]),
|
|
4693
|
+
default: vue.withCtx(({ item }) => [
|
|
4694
|
+
vue.createElementVNode("div", _hoisted_1$p, [
|
|
4695
|
+
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
4696
|
+
vue.createElementVNode("span", _hoisted_2$i, vue.toDisplayString(item.value), 1)
|
|
4697
|
+
])
|
|
4698
|
+
]),
|
|
4699
|
+
_: 1
|
|
4700
|
+
}, 16, ["modelValue"])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
4701
|
+
key: 1,
|
|
4702
|
+
class: vue.normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
4703
|
+
onMouseup: mouseupHandler
|
|
4704
|
+
}, [
|
|
4705
|
+
vue.createElementVNode("div", {
|
|
4706
|
+
class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
4707
|
+
}, [
|
|
4708
|
+
vue.createElementVNode("div", _hoisted_3$8, [
|
|
4709
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
|
|
4710
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4711
|
+
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
4712
|
+
key: index,
|
|
4713
|
+
style: { "margin-right": "2px" }
|
|
4714
|
+
}, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
|
|
4715
|
+
item.type === "var" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
|
|
4716
|
+
key: index,
|
|
4717
|
+
size: _ctx.size
|
|
4718
|
+
}, {
|
|
4719
|
+
default: vue.withCtx(() => [
|
|
4720
|
+
vue.createTextVNode(vue.toDisplayString(item.value), 1)
|
|
4721
|
+
]),
|
|
4722
|
+
_: 2
|
|
4723
|
+
}, 1032, ["size"])) : vue.createCommentVNode("", true)
|
|
4724
|
+
], 64);
|
|
4725
|
+
}), 256)),
|
|
4726
|
+
vue.createVNode(_sfc_main$U, {
|
|
4727
|
+
class: "tmagic-data-source-input-icon",
|
|
4728
|
+
icon: vue.unref(iconsVue.Coin)
|
|
4729
|
+
}, null, 8, ["icon"])
|
|
4730
|
+
])
|
|
4731
|
+
], 2)
|
|
4732
|
+
], 34));
|
|
4733
|
+
};
|
|
4734
|
+
}
|
|
4735
|
+
});
|
|
4736
|
+
|
|
4737
|
+
const _hoisted_1$o = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
4738
|
+
const _hoisted_2$h = { style: { "flex": "1" } };
|
|
4739
|
+
const _hoisted_3$7 = { style: { "flex": "1" } };
|
|
4740
|
+
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
4741
|
+
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
4742
|
+
...{
|
|
4743
|
+
name: "MEditorCodeBlockEditor"
|
|
4744
|
+
},
|
|
4745
|
+
__name: "CodeBlockEditor",
|
|
4746
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
4747
|
+
content: {},
|
|
4748
|
+
disabled: { type: Boolean },
|
|
4749
|
+
isDataSource: { type: Boolean },
|
|
4750
|
+
dataSourceType: {}
|
|
4751
|
+
}, {
|
|
4752
|
+
"width": { default: 670 },
|
|
4753
|
+
"widthModifiers": {},
|
|
4754
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
4755
|
+
"visibleModifiers": {}
|
|
4756
|
+
}),
|
|
4757
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
4758
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4759
|
+
const width = vue.useModel(__props, "width");
|
|
4760
|
+
const boxVisible = vue.useModel(__props, "visible");
|
|
4761
|
+
const props = __props;
|
|
4762
|
+
const emit = __emit;
|
|
4763
|
+
const services = vue.inject("services");
|
|
4764
|
+
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
4765
|
+
const difVisible = vue.ref(false);
|
|
4766
|
+
const { rect: windowRect } = useWindowRect();
|
|
4767
|
+
const magicVsEditor = vue.ref();
|
|
4768
|
+
const diffChange = () => {
|
|
4769
|
+
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
4770
|
+
return;
|
|
4771
|
+
}
|
|
4772
|
+
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
4773
|
+
difVisible.value = false;
|
|
4774
|
+
};
|
|
4775
|
+
const defaultParamColConfig = {
|
|
4776
|
+
type: "row",
|
|
4777
|
+
label: "参数类型",
|
|
4778
|
+
items: [
|
|
4779
|
+
{
|
|
4780
|
+
text: "参数类型",
|
|
4781
|
+
labelWidth: "70px",
|
|
4782
|
+
type: "select",
|
|
4783
|
+
name: "type",
|
|
4784
|
+
options: [
|
|
4785
|
+
{
|
|
4786
|
+
text: "数字",
|
|
4787
|
+
label: "数字",
|
|
4788
|
+
value: "number"
|
|
4789
|
+
},
|
|
4790
|
+
{
|
|
4791
|
+
text: "字符串",
|
|
4792
|
+
label: "字符串",
|
|
4793
|
+
value: "text"
|
|
4794
|
+
},
|
|
4795
|
+
{
|
|
4796
|
+
text: "组件",
|
|
4797
|
+
label: "组件",
|
|
4798
|
+
value: "ui-select"
|
|
4799
|
+
}
|
|
4800
|
+
]
|
|
4801
|
+
}
|
|
4802
|
+
]
|
|
4803
|
+
};
|
|
4804
|
+
const functionConfig = vue.computed(() => [
|
|
4805
|
+
{
|
|
4806
|
+
text: "名称",
|
|
4807
|
+
name: "name",
|
|
4808
|
+
rules: [{ required: true, message: "请输入名称", trigger: "blur" }]
|
|
4809
|
+
},
|
|
4810
|
+
{
|
|
4811
|
+
text: "描述",
|
|
4812
|
+
name: "desc"
|
|
4813
|
+
},
|
|
4814
|
+
{
|
|
4815
|
+
text: "执行时机",
|
|
4816
|
+
name: "timing",
|
|
4817
|
+
type: "select",
|
|
4818
|
+
options: () => {
|
|
4819
|
+
const options = [
|
|
4820
|
+
{ text: "初始化前", value: "beforeInit" },
|
|
4821
|
+
{ text: "初始化后", value: "afterInit" }
|
|
4822
|
+
];
|
|
4823
|
+
if (props.dataSourceType !== "base") {
|
|
4824
|
+
options.push({ text: "请求前", value: "beforeRequest" });
|
|
4825
|
+
options.push({ text: "请求后", value: "afterRequest" });
|
|
4826
|
+
}
|
|
4827
|
+
return options;
|
|
4828
|
+
},
|
|
4829
|
+
display: () => props.isDataSource
|
|
4830
|
+
},
|
|
4831
|
+
{
|
|
4832
|
+
type: "table",
|
|
4833
|
+
border: true,
|
|
4834
|
+
text: "参数",
|
|
4835
|
+
enableFullscreen: false,
|
|
4836
|
+
enableToggleMode: false,
|
|
4837
|
+
name: "params",
|
|
4838
|
+
dropSort: false,
|
|
4839
|
+
items: [
|
|
4840
|
+
{
|
|
4841
|
+
type: "text",
|
|
4842
|
+
label: "参数名",
|
|
4843
|
+
name: "name"
|
|
4844
|
+
},
|
|
4845
|
+
{
|
|
4846
|
+
type: "text",
|
|
4847
|
+
label: "描述",
|
|
4848
|
+
name: "extra"
|
|
4849
|
+
},
|
|
4850
|
+
services?.codeBlockService.getParamsColConfig() || defaultParamColConfig
|
|
4851
|
+
]
|
|
4852
|
+
},
|
|
4853
|
+
{
|
|
4854
|
+
name: "content",
|
|
4855
|
+
type: "vs-code",
|
|
4856
|
+
options: vue.inject("codeOptions", {}),
|
|
4857
|
+
height: "500px",
|
|
4858
|
+
onChange: (formState, code) => {
|
|
4859
|
+
try {
|
|
4860
|
+
getConfig("parseDSL")(code);
|
|
4861
|
+
return code;
|
|
4862
|
+
} catch (error) {
|
|
4863
|
+
design.tMagicMessage.error(error.message);
|
|
4864
|
+
throw error;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
]);
|
|
4869
|
+
const submitForm = (values) => {
|
|
4870
|
+
changedValue.value = void 0;
|
|
4871
|
+
emit("submit", values);
|
|
5006
4872
|
};
|
|
5007
|
-
const
|
|
5008
|
-
|
|
5009
|
-
const selectionStart = getSelectionStart();
|
|
5010
|
-
const curQueryString = queryString.substring(0, selectionStart);
|
|
5011
|
-
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
5012
|
-
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
5013
|
-
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
5014
|
-
if (isFieldTip) {
|
|
5015
|
-
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
5016
|
-
} else {
|
|
5017
|
-
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
5018
|
-
}
|
|
4873
|
+
const errorHandler = (error) => {
|
|
4874
|
+
design.tMagicMessage.error(error.message);
|
|
5019
4875
|
};
|
|
5020
|
-
const
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
5030
|
-
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
5031
|
-
}
|
|
5032
|
-
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
5033
|
-
suggestText = `${suggestText}}`;
|
|
5034
|
-
}
|
|
5035
|
-
} else if (!curCharIsDot(dotIndex)) {
|
|
5036
|
-
startText = startText.substring(0, dotIndex + 1);
|
|
5037
|
-
}
|
|
5038
|
-
state.value = `${startText}${suggestText}${endText}`;
|
|
5039
|
-
await vue.nextTick();
|
|
5040
|
-
let newSelectionStart = 0;
|
|
5041
|
-
if (isDataSource) {
|
|
5042
|
-
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
5043
|
-
} else {
|
|
5044
|
-
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4876
|
+
const formBox = vue.ref();
|
|
4877
|
+
const changedValue = vue.ref();
|
|
4878
|
+
const changeHandler = (values) => {
|
|
4879
|
+
changedValue.value = values;
|
|
4880
|
+
};
|
|
4881
|
+
const beforeClose = (done) => {
|
|
4882
|
+
if (!changedValue.value) {
|
|
4883
|
+
done();
|
|
4884
|
+
return;
|
|
5045
4885
|
}
|
|
5046
|
-
|
|
5047
|
-
|
|
4886
|
+
design.tMagicMessageBox.confirm("当前代码块已修改,是否保存?", "提示", {
|
|
4887
|
+
confirmButtonText: "保存并关闭",
|
|
4888
|
+
cancelButtonText: "不保存并关闭",
|
|
4889
|
+
type: "warning",
|
|
4890
|
+
distinguishCancelAndClose: true
|
|
4891
|
+
}).then(() => {
|
|
4892
|
+
changedValue.value && submitForm(changedValue.value);
|
|
4893
|
+
done();
|
|
4894
|
+
}).catch((action) => {
|
|
4895
|
+
done(action === "cancel");
|
|
4896
|
+
});
|
|
4897
|
+
};
|
|
4898
|
+
const closedHandler = () => {
|
|
4899
|
+
changedValue.value = void 0;
|
|
5048
4900
|
};
|
|
4901
|
+
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4902
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4903
|
+
__expose({
|
|
4904
|
+
async show() {
|
|
4905
|
+
calcBoxPosition();
|
|
4906
|
+
boxVisible.value = true;
|
|
4907
|
+
},
|
|
4908
|
+
async hide() {
|
|
4909
|
+
boxVisible.value = false;
|
|
4910
|
+
}
|
|
4911
|
+
});
|
|
5049
4912
|
return (_ctx, _cache) => {
|
|
5050
|
-
return
|
|
5051
|
-
{
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
"onUpdate:
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
class: vue.normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
5086
|
-
onMouseup: mouseupHandler
|
|
5087
|
-
}, [
|
|
5088
|
-
vue.createElementVNode("div", {
|
|
5089
|
-
class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
5090
|
-
}, [
|
|
5091
|
-
vue.createElementVNode("div", _hoisted_3$7, [
|
|
5092
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
|
|
5093
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
5094
|
-
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
5095
|
-
key: index,
|
|
5096
|
-
style: { "margin-right": "2px" }
|
|
5097
|
-
}, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
|
|
5098
|
-
item.type === "var" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
|
|
5099
|
-
key: index,
|
|
5100
|
-
size: _ctx.size
|
|
4913
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4914
|
+
vue.createVNode(_sfc_main$N, {
|
|
4915
|
+
visible: boxVisible.value,
|
|
4916
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
4917
|
+
width: width.value,
|
|
4918
|
+
"onUpdate:width": _cache[2] || (_cache[2] = ($event) => width.value = $event),
|
|
4919
|
+
height: vue.unref(codeBlockEditorHeight),
|
|
4920
|
+
"onUpdate:height": _cache[3] || (_cache[3] = ($event) => vue.isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
4921
|
+
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
4922
|
+
position: vue.unref(boxPosition),
|
|
4923
|
+
"before-close": beforeClose
|
|
4924
|
+
}, {
|
|
4925
|
+
body: vue.withCtx(() => [
|
|
4926
|
+
vue.createVNode(vue.unref(form.MFormBox), {
|
|
4927
|
+
class: "m-editor-code-block-editor",
|
|
4928
|
+
ref_key: "formBox",
|
|
4929
|
+
ref: formBox,
|
|
4930
|
+
"label-width": "80px",
|
|
4931
|
+
"close-on-press-escape": false,
|
|
4932
|
+
title: _ctx.content.name,
|
|
4933
|
+
config: functionConfig.value,
|
|
4934
|
+
values: _ctx.content,
|
|
4935
|
+
disabled: _ctx.disabled,
|
|
4936
|
+
style: { "height": "100%" },
|
|
4937
|
+
onChange: changeHandler,
|
|
4938
|
+
onSubmit: submitForm,
|
|
4939
|
+
onError: errorHandler,
|
|
4940
|
+
onClosed: closedHandler
|
|
4941
|
+
}, {
|
|
4942
|
+
left: vue.withCtx(() => [
|
|
4943
|
+
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4944
|
+
key: 0,
|
|
4945
|
+
type: "primary",
|
|
4946
|
+
link: "",
|
|
4947
|
+
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
5101
4948
|
}, {
|
|
5102
4949
|
default: vue.withCtx(() => [
|
|
5103
|
-
vue.createTextVNode(
|
|
4950
|
+
vue.createTextVNode("查看修改")
|
|
5104
4951
|
]),
|
|
5105
|
-
_:
|
|
5106
|
-
}
|
|
5107
|
-
],
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
4952
|
+
_: 1
|
|
4953
|
+
})) : vue.createCommentVNode("", true)
|
|
4954
|
+
]),
|
|
4955
|
+
_: 1
|
|
4956
|
+
}, 8, ["title", "config", "values", "disabled"])
|
|
4957
|
+
]),
|
|
4958
|
+
_: 1
|
|
4959
|
+
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4960
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4961
|
+
vue.createVNode(vue.unref(design.TMagicDialog), {
|
|
4962
|
+
title: "查看修改",
|
|
4963
|
+
modelValue: difVisible.value,
|
|
4964
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
4965
|
+
fullscreen: ""
|
|
4966
|
+
}, {
|
|
4967
|
+
footer: vue.withCtx(() => [
|
|
4968
|
+
vue.createElementVNode("span", _hoisted_4$7, [
|
|
4969
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4970
|
+
size: "small",
|
|
4971
|
+
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
4972
|
+
}, {
|
|
4973
|
+
default: vue.withCtx(() => [
|
|
4974
|
+
vue.createTextVNode("取消")
|
|
4975
|
+
]),
|
|
4976
|
+
_: 1
|
|
4977
|
+
}),
|
|
4978
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4979
|
+
size: "small",
|
|
4980
|
+
type: "primary",
|
|
4981
|
+
onClick: diffChange
|
|
4982
|
+
}, {
|
|
4983
|
+
default: vue.withCtx(() => [
|
|
4984
|
+
vue.createTextVNode("确定")
|
|
4985
|
+
]),
|
|
4986
|
+
_: 1
|
|
4987
|
+
})
|
|
4988
|
+
])
|
|
4989
|
+
]),
|
|
4990
|
+
default: vue.withCtx(() => [
|
|
4991
|
+
vue.createElementVNode("div", _hoisted_1$o, [
|
|
4992
|
+
vue.createElementVNode("div", _hoisted_2$h, [
|
|
4993
|
+
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
4994
|
+
size: "small",
|
|
4995
|
+
type: "info"
|
|
4996
|
+
}, {
|
|
4997
|
+
default: vue.withCtx(() => [
|
|
4998
|
+
vue.createTextVNode("修改前")
|
|
4999
|
+
]),
|
|
5000
|
+
_: 1
|
|
5001
|
+
})
|
|
5002
|
+
]),
|
|
5003
|
+
vue.createElementVNode("div", _hoisted_3$7, [
|
|
5004
|
+
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
5005
|
+
size: "small",
|
|
5006
|
+
type: "success"
|
|
5007
|
+
}, {
|
|
5008
|
+
default: vue.withCtx(() => [
|
|
5009
|
+
vue.createTextVNode("修改后")
|
|
5010
|
+
]),
|
|
5011
|
+
_: 1
|
|
5012
|
+
})
|
|
5013
|
+
])
|
|
5014
|
+
]),
|
|
5015
|
+
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
5016
|
+
key: 0,
|
|
5017
|
+
ref_key: "magicVsEditor",
|
|
5018
|
+
ref: magicVsEditor,
|
|
5019
|
+
type: "diff",
|
|
5020
|
+
language: "json",
|
|
5021
|
+
initValues: _ctx.content.content,
|
|
5022
|
+
modifiedValues: formBox.value?.form?.values.content,
|
|
5023
|
+
style: vue.normalizeStyle(`height: ${vue.unref(windowRect).height - 150}px`)
|
|
5024
|
+
}, null, 8, ["initValues", "modifiedValues", "style"])) : vue.createCommentVNode("", true)
|
|
5025
|
+
]),
|
|
5026
|
+
_: 1
|
|
5027
|
+
}, 8, ["modelValue"])
|
|
5028
|
+
]))
|
|
5029
|
+
], 64);
|
|
5116
5030
|
};
|
|
5117
5031
|
}
|
|
5118
5032
|
});
|
|
5119
5033
|
|
|
5120
|
-
const _hoisted_1$
|
|
5034
|
+
const _hoisted_1$n = { class: "m-editor-data-source-methods" };
|
|
5121
5035
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
5122
|
-
const _sfc_main$
|
|
5036
|
+
const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
|
|
5123
5037
|
...{
|
|
5124
5038
|
name: "MFieldsDataSourceMethods"
|
|
5125
5039
|
},
|
|
@@ -5189,7 +5103,7 @@
|
|
|
5189
5103
|
emit("change", props.model[props.name]);
|
|
5190
5104
|
};
|
|
5191
5105
|
return (_ctx, _cache) => {
|
|
5192
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5106
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
|
|
5193
5107
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
5194
5108
|
data: _ctx.model[_ctx.name],
|
|
5195
5109
|
columns: methodColumns
|
|
@@ -5208,7 +5122,7 @@
|
|
|
5208
5122
|
_: 1
|
|
5209
5123
|
}, 8, ["disabled"])
|
|
5210
5124
|
]),
|
|
5211
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5125
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$J, {
|
|
5212
5126
|
key: 0,
|
|
5213
5127
|
ref_key: "codeBlockEditor",
|
|
5214
5128
|
ref: codeBlockEditor,
|
|
@@ -5223,9 +5137,9 @@
|
|
|
5223
5137
|
}
|
|
5224
5138
|
});
|
|
5225
5139
|
|
|
5226
|
-
const _hoisted_1$
|
|
5140
|
+
const _hoisted_1$m = { class: "m-fields-data-source-method-select" };
|
|
5227
5141
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
5228
|
-
const _sfc_main$
|
|
5142
|
+
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
5229
5143
|
...{
|
|
5230
5144
|
name: "MFieldsDataSourceMethodSelect"
|
|
5231
5145
|
},
|
|
@@ -5245,9 +5159,13 @@
|
|
|
5245
5159
|
setup(__props, { emit: __emit }) {
|
|
5246
5160
|
const mForm = vue.inject("mForm");
|
|
5247
5161
|
const services = vue.inject("services");
|
|
5162
|
+
const eventBus = vue.inject("eventBus");
|
|
5248
5163
|
const emit = __emit;
|
|
5249
5164
|
const dataSourceService = services?.dataSourceService;
|
|
5250
5165
|
const props = __props;
|
|
5166
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
5167
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5168
|
+
);
|
|
5251
5169
|
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
5252
5170
|
const dataSources = vue.computed(() => dataSourceService?.get("dataSources"));
|
|
5253
5171
|
const isCustomMethod = vue.computed(() => {
|
|
@@ -5302,36 +5220,38 @@
|
|
|
5302
5220
|
props.model.params = value.params;
|
|
5303
5221
|
emit("change", props.model);
|
|
5304
5222
|
};
|
|
5305
|
-
const { codeBlockEditor, codeConfig, editCode, submitCode } = useDataSourceMethod();
|
|
5306
5223
|
const editCodeHandler = () => {
|
|
5307
|
-
const [id
|
|
5224
|
+
const [id] = props.model[props.name];
|
|
5308
5225
|
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5309
5226
|
if (!dataSource)
|
|
5310
5227
|
return;
|
|
5311
|
-
|
|
5312
|
-
setParamsConfig([id, name]);
|
|
5313
|
-
};
|
|
5314
|
-
const submitCodeBlockHandler = (value) => {
|
|
5315
|
-
submitCode(value);
|
|
5228
|
+
eventBus?.emit("edit-data-source", id);
|
|
5316
5229
|
};
|
|
5317
5230
|
return (_ctx, _cache) => {
|
|
5318
|
-
|
|
5319
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
5231
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
5320
5232
|
vue.createElementVNode("div", _hoisted_2$f, [
|
|
5321
|
-
vue.createVNode(
|
|
5233
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
5322
5234
|
class: "select",
|
|
5323
5235
|
config: cascaderConfig.value,
|
|
5324
5236
|
model: _ctx.model,
|
|
5237
|
+
size: _ctx.size,
|
|
5325
5238
|
onChange: onChangeHandler
|
|
5326
|
-
}, null, 8, ["config", "model"]),
|
|
5327
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(
|
|
5239
|
+
}, null, 8, ["config", "model", "size"]),
|
|
5240
|
+
_ctx.model[_ctx.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5328
5241
|
key: 0,
|
|
5329
|
-
class: "
|
|
5330
|
-
|
|
5242
|
+
class: "m-fields-select-action-button",
|
|
5243
|
+
size: _ctx.size,
|
|
5331
5244
|
onClick: editCodeHandler
|
|
5332
|
-
},
|
|
5245
|
+
}, {
|
|
5246
|
+
default: vue.withCtx(() => [
|
|
5247
|
+
vue.createVNode(_sfc_main$U, {
|
|
5248
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5249
|
+
}, null, 8, ["icon"])
|
|
5250
|
+
]),
|
|
5251
|
+
_: 1
|
|
5252
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
5333
5253
|
]),
|
|
5334
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5254
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
5335
5255
|
key: 0,
|
|
5336
5256
|
name: "params",
|
|
5337
5257
|
model: _ctx.model,
|
|
@@ -5339,23 +5259,15 @@
|
|
|
5339
5259
|
disabled: _ctx.disabled,
|
|
5340
5260
|
"params-config": paramsConfig.value,
|
|
5341
5261
|
onChange: onChangeHandler
|
|
5342
|
-
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true)
|
|
5343
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
5344
|
-
key: 1,
|
|
5345
|
-
ref_key: "codeBlockEditor",
|
|
5346
|
-
ref: codeBlockEditor,
|
|
5347
|
-
disabled: notEditable.value,
|
|
5348
|
-
content: vue.unref(codeConfig),
|
|
5349
|
-
onSubmit: submitCodeBlockHandler
|
|
5350
|
-
}, null, 8, ["disabled", "content"])) : vue.createCommentVNode("", true)
|
|
5262
|
+
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true)
|
|
5351
5263
|
]);
|
|
5352
5264
|
};
|
|
5353
5265
|
}
|
|
5354
5266
|
});
|
|
5355
5267
|
|
|
5356
|
-
const _hoisted_1$
|
|
5268
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
5357
5269
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
5358
|
-
const _sfc_main$
|
|
5270
|
+
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
5359
5271
|
...{
|
|
5360
5272
|
name: "MFieldsDataSourceMocks"
|
|
5361
5273
|
},
|
|
@@ -5561,7 +5473,7 @@
|
|
|
5561
5473
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
5562
5474
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5563
5475
|
return (_ctx, _cache) => {
|
|
5564
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5476
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
5565
5477
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
5566
5478
|
data: _ctx.model[_ctx.name],
|
|
5567
5479
|
columns
|
|
@@ -5580,7 +5492,7 @@
|
|
|
5580
5492
|
_: 1
|
|
5581
5493
|
}, 8, ["disabled"])
|
|
5582
5494
|
]),
|
|
5583
|
-
vue.createVNode(_sfc_main$
|
|
5495
|
+
vue.createVNode(_sfc_main$N, {
|
|
5584
5496
|
visible: addDialogVisible.value,
|
|
5585
5497
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
5586
5498
|
width: width.value,
|
|
@@ -5608,7 +5520,8 @@
|
|
|
5608
5520
|
}
|
|
5609
5521
|
});
|
|
5610
5522
|
|
|
5611
|
-
const
|
|
5523
|
+
const _hoisted_1$k = { class: "m-fields-data-source-select" };
|
|
5524
|
+
const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
5612
5525
|
...{
|
|
5613
5526
|
name: "MFieldsDataSourceSelect"
|
|
5614
5527
|
},
|
|
@@ -5628,8 +5541,14 @@
|
|
|
5628
5541
|
setup(__props, { emit: __emit }) {
|
|
5629
5542
|
const emit = __emit;
|
|
5630
5543
|
const props = __props;
|
|
5631
|
-
const
|
|
5544
|
+
const mForm = vue.inject("mForm");
|
|
5545
|
+
const { dataSourceService, uiService } = vue.inject("services") || {};
|
|
5546
|
+
const eventBus = vue.inject("eventBus");
|
|
5632
5547
|
const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
|
|
5548
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
5549
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
5550
|
+
() => (uiService?.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5551
|
+
);
|
|
5633
5552
|
const selectConfig = vue.computed(() => {
|
|
5634
5553
|
const { type, dataSourceType, value, ...config } = props.config;
|
|
5635
5554
|
const valueIsId = props.config.value === "id";
|
|
@@ -5650,17 +5569,42 @@
|
|
|
5650
5569
|
const changeHandler = (value) => {
|
|
5651
5570
|
emit("change", value);
|
|
5652
5571
|
};
|
|
5572
|
+
const editHandler = () => {
|
|
5573
|
+
const value = props.model[props.name];
|
|
5574
|
+
if (!value)
|
|
5575
|
+
return;
|
|
5576
|
+
const id = typeof value === "string" ? value : value.dataSourceId;
|
|
5577
|
+
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5578
|
+
if (!dataSource)
|
|
5579
|
+
return;
|
|
5580
|
+
eventBus?.emit("edit-data-source", id);
|
|
5581
|
+
};
|
|
5653
5582
|
return (_ctx, _cache) => {
|
|
5654
|
-
return vue.openBlock(), vue.
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5583
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
5584
|
+
vue.createVNode(vue.unref(form.MSelect), {
|
|
5585
|
+
model: _ctx.model,
|
|
5586
|
+
name: _ctx.name,
|
|
5587
|
+
size: _ctx.size,
|
|
5588
|
+
prop: _ctx.prop,
|
|
5589
|
+
disabled: _ctx.disabled,
|
|
5590
|
+
config: selectConfig.value,
|
|
5591
|
+
"last-values": _ctx.lastValues,
|
|
5592
|
+
onChange: changeHandler
|
|
5593
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]),
|
|
5594
|
+
_ctx.model[_ctx.name] && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5595
|
+
key: 0,
|
|
5596
|
+
class: "m-fields-select-action-button",
|
|
5597
|
+
size: _ctx.size,
|
|
5598
|
+
onClick: editHandler
|
|
5599
|
+
}, {
|
|
5600
|
+
default: vue.withCtx(() => [
|
|
5601
|
+
vue.createVNode(_sfc_main$U, {
|
|
5602
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5603
|
+
}, null, 8, ["icon"])
|
|
5604
|
+
]),
|
|
5605
|
+
_: 1
|
|
5606
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
5607
|
+
]);
|
|
5664
5608
|
};
|
|
5665
5609
|
}
|
|
5666
5610
|
});
|
|
@@ -5670,7 +5614,7 @@
|
|
|
5670
5614
|
key: 1,
|
|
5671
5615
|
class: "fullWidth"
|
|
5672
5616
|
};
|
|
5673
|
-
const _sfc_main$
|
|
5617
|
+
const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
|
|
5674
5618
|
...{
|
|
5675
5619
|
name: "MFieldsEventSelect"
|
|
5676
5620
|
},
|
|
@@ -5696,24 +5640,41 @@
|
|
|
5696
5640
|
const eventsService = services?.eventsService;
|
|
5697
5641
|
const codeBlockService = services?.codeBlockService;
|
|
5698
5642
|
const eventNameConfig = vue.computed(() => {
|
|
5643
|
+
const fieldType = props.config.src === "component" ? "select" : "cascader";
|
|
5699
5644
|
const defaultEventNameConfig = {
|
|
5700
5645
|
name: "name",
|
|
5701
5646
|
text: "事件",
|
|
5702
|
-
type:
|
|
5647
|
+
type: fieldType,
|
|
5703
5648
|
labelWidth: "40px",
|
|
5649
|
+
checkStrictly: true,
|
|
5650
|
+
valueSeparator: ".",
|
|
5704
5651
|
options: (mForm, { formValue }) => {
|
|
5705
5652
|
let events = [];
|
|
5706
5653
|
if (!eventsService || !dataSourceService)
|
|
5707
5654
|
return events;
|
|
5708
5655
|
if (props.config.src === "component") {
|
|
5709
5656
|
events = eventsService.getEvent(formValue.type);
|
|
5710
|
-
|
|
5657
|
+
return events.map((option) => ({
|
|
5658
|
+
text: option.label,
|
|
5659
|
+
value: option.value
|
|
5660
|
+
}));
|
|
5661
|
+
}
|
|
5662
|
+
if (props.config.src === "datasource") {
|
|
5711
5663
|
events = dataSourceService.getFormEvent(formValue.type);
|
|
5664
|
+
const dataSource = dataSourceService.getDataSourceById(formValue.id);
|
|
5665
|
+
const fields = dataSource?.fields || [];
|
|
5666
|
+
if (fields.length > 0) {
|
|
5667
|
+
return [
|
|
5668
|
+
...events,
|
|
5669
|
+
{
|
|
5670
|
+
label: "数据变化",
|
|
5671
|
+
value: utils.DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX,
|
|
5672
|
+
children: getCascaderOptionsFromFields(fields)
|
|
5673
|
+
}
|
|
5674
|
+
];
|
|
5675
|
+
}
|
|
5676
|
+
return events;
|
|
5712
5677
|
}
|
|
5713
|
-
return events.map((option) => ({
|
|
5714
|
-
text: option.label,
|
|
5715
|
-
value: option.value
|
|
5716
|
-
}));
|
|
5717
5678
|
}
|
|
5718
5679
|
};
|
|
5719
5680
|
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
@@ -5828,6 +5789,7 @@
|
|
|
5828
5789
|
]
|
|
5829
5790
|
}));
|
|
5830
5791
|
const actionsConfig = vue.computed(() => ({
|
|
5792
|
+
type: "panel",
|
|
5831
5793
|
items: [
|
|
5832
5794
|
{
|
|
5833
5795
|
type: "group-list",
|
|
@@ -5872,8 +5834,6 @@
|
|
|
5872
5834
|
};
|
|
5873
5835
|
return (_ctx, _cache) => {
|
|
5874
5836
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
5875
|
-
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
5876
|
-
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
5877
5837
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
5878
5838
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
5879
5839
|
key: 0,
|
|
@@ -5898,7 +5858,7 @@
|
|
|
5898
5858
|
_: 1
|
|
5899
5859
|
}, 8, ["size", "disabled"]),
|
|
5900
5860
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.model[_ctx.name], (cardItem, index) => {
|
|
5901
|
-
return vue.openBlock(), vue.createBlock(
|
|
5861
|
+
return vue.openBlock(), vue.createBlock(vue.unref(form.MPanel), {
|
|
5902
5862
|
key: index,
|
|
5903
5863
|
disabled: _ctx.disabled,
|
|
5904
5864
|
size: _ctx.size,
|
|
@@ -5908,7 +5868,7 @@
|
|
|
5908
5868
|
onChange: onChangeHandler
|
|
5909
5869
|
}, {
|
|
5910
5870
|
header: vue.withCtx(() => [
|
|
5911
|
-
vue.createVNode(
|
|
5871
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
5912
5872
|
class: "fullWidth",
|
|
5913
5873
|
config: eventNameConfig.value,
|
|
5914
5874
|
model: cardItem,
|
|
@@ -5944,7 +5904,7 @@
|
|
|
5944
5904
|
const _hoisted_4$6 = [
|
|
5945
5905
|
_hoisted_2$c
|
|
5946
5906
|
];
|
|
5947
|
-
const _sfc_main$
|
|
5907
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
5948
5908
|
...{
|
|
5949
5909
|
name: "MEditorCodeIcon"
|
|
5950
5910
|
},
|
|
@@ -5959,7 +5919,7 @@
|
|
|
5959
5919
|
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5960
5920
|
const _hoisted_2$b = { key: 0 };
|
|
5961
5921
|
const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5962
|
-
const _sfc_main$
|
|
5922
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
5963
5923
|
...{
|
|
5964
5924
|
name: "MFieldsKeyValue"
|
|
5965
5925
|
},
|
|
@@ -6083,7 +6043,7 @@
|
|
|
6083
6043
|
size: "default",
|
|
6084
6044
|
disabled: _ctx.disabled,
|
|
6085
6045
|
link: "",
|
|
6086
|
-
icon: _sfc_main$
|
|
6046
|
+
icon: _sfc_main$D,
|
|
6087
6047
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
6088
6048
|
}, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
6089
6049
|
]);
|
|
@@ -6093,7 +6053,7 @@
|
|
|
6093
6053
|
|
|
6094
6054
|
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
6095
6055
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
6096
|
-
const _sfc_main$
|
|
6056
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
6097
6057
|
...{
|
|
6098
6058
|
name: "MFieldsPageFragmentSelect"
|
|
6099
6059
|
},
|
|
@@ -6165,7 +6125,7 @@
|
|
|
6165
6125
|
class: "m-fields-ui-select",
|
|
6166
6126
|
style: { "display": "flex" }
|
|
6167
6127
|
};
|
|
6168
|
-
const _sfc_main$
|
|
6128
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
6169
6129
|
...{
|
|
6170
6130
|
name: "MFieldsUISelect"
|
|
6171
6131
|
},
|
|
@@ -6353,7 +6313,7 @@
|
|
|
6353
6313
|
};
|
|
6354
6314
|
};
|
|
6355
6315
|
|
|
6356
|
-
const _sfc_main$
|
|
6316
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
6357
6317
|
...{
|
|
6358
6318
|
name: "MEditorResizer"
|
|
6359
6319
|
},
|
|
@@ -6375,7 +6335,7 @@
|
|
|
6375
6335
|
}
|
|
6376
6336
|
});
|
|
6377
6337
|
|
|
6378
|
-
const _sfc_main$
|
|
6338
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
6379
6339
|
...{
|
|
6380
6340
|
name: "MEditorSplitView"
|
|
6381
6341
|
},
|
|
@@ -6516,7 +6476,7 @@
|
|
|
6516
6476
|
}, [
|
|
6517
6477
|
vue.renderSlot(_ctx.$slots, "left")
|
|
6518
6478
|
], 6),
|
|
6519
|
-
vue.createVNode(_sfc_main$
|
|
6479
|
+
vue.createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
6520
6480
|
], 64)) : vue.createCommentVNode("", true),
|
|
6521
6481
|
vue.createElementVNode("div", {
|
|
6522
6482
|
class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6525,7 +6485,7 @@
|
|
|
6525
6485
|
vue.renderSlot(_ctx.$slots, "center")
|
|
6526
6486
|
], 6),
|
|
6527
6487
|
hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
6528
|
-
vue.createVNode(_sfc_main$
|
|
6488
|
+
vue.createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
6529
6489
|
vue.createElementVNode("div", {
|
|
6530
6490
|
class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6531
6491
|
style: vue.normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -6543,7 +6503,7 @@
|
|
|
6543
6503
|
class: "menu-item-text"
|
|
6544
6504
|
};
|
|
6545
6505
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6546
|
-
const _sfc_main$
|
|
6506
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
6547
6507
|
...{
|
|
6548
6508
|
name: "MEditorToolButton"
|
|
6549
6509
|
},
|
|
@@ -6708,7 +6668,7 @@
|
|
|
6708
6668
|
key: 1,
|
|
6709
6669
|
style: { "width": "21px" }
|
|
6710
6670
|
};
|
|
6711
|
-
const _sfc_main$
|
|
6671
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
6712
6672
|
...{
|
|
6713
6673
|
name: "MEditorPageBarAddButton"
|
|
6714
6674
|
},
|
|
@@ -6748,7 +6708,7 @@
|
|
|
6748
6708
|
}
|
|
6749
6709
|
});
|
|
6750
6710
|
|
|
6751
|
-
const _sfc_main$
|
|
6711
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
6752
6712
|
...{
|
|
6753
6713
|
name: "MEditorPageBarScrollContainer"
|
|
6754
6714
|
},
|
|
@@ -6877,7 +6837,7 @@
|
|
|
6877
6837
|
}
|
|
6878
6838
|
});
|
|
6879
6839
|
|
|
6880
|
-
const _sfc_main$
|
|
6840
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
6881
6841
|
...{
|
|
6882
6842
|
name: "MEditorPageBarSwitchTypeButton"
|
|
6883
6843
|
},
|
|
@@ -6925,7 +6885,7 @@
|
|
|
6925
6885
|
const _hoisted_2$8 = ["onClick"];
|
|
6926
6886
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
6927
6887
|
const _hoisted_4$5 = ["title"];
|
|
6928
|
-
const _sfc_main$
|
|
6888
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
6929
6889
|
...{
|
|
6930
6890
|
name: "MEditorPageBar"
|
|
6931
6891
|
},
|
|
@@ -7004,14 +6964,14 @@
|
|
|
7004
6964
|
};
|
|
7005
6965
|
return (_ctx, _cache) => {
|
|
7006
6966
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
7007
|
-
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6967
|
+
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
7008
6968
|
key: 0,
|
|
7009
6969
|
modelValue: active.value,
|
|
7010
6970
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
7011
6971
|
}, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
|
|
7012
|
-
vue.createVNode(_sfc_main$
|
|
6972
|
+
vue.createVNode(_sfc_main$v, { type: active.value }, {
|
|
7013
6973
|
prepend: vue.withCtx(() => [
|
|
7014
|
-
vue.createVNode(_sfc_main$
|
|
6974
|
+
vue.createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
7015
6975
|
]),
|
|
7016
6976
|
default: vue.withCtx(() => [
|
|
7017
6977
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
|
|
@@ -7044,7 +7004,7 @@
|
|
|
7044
7004
|
default: vue.withCtx(() => [
|
|
7045
7005
|
vue.createElementVNode("div", null, [
|
|
7046
7006
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
7047
|
-
vue.createVNode(_sfc_main$
|
|
7007
|
+
vue.createVNode(_sfc_main$x, {
|
|
7048
7008
|
data: {
|
|
7049
7009
|
type: "button",
|
|
7050
7010
|
text: "复制",
|
|
@@ -7052,7 +7012,7 @@
|
|
|
7052
7012
|
handler: () => copy(item)
|
|
7053
7013
|
}
|
|
7054
7014
|
}, null, 8, ["data"]),
|
|
7055
|
-
vue.createVNode(_sfc_main$
|
|
7015
|
+
vue.createVNode(_sfc_main$x, {
|
|
7056
7016
|
data: {
|
|
7057
7017
|
type: "button",
|
|
7058
7018
|
text: "删除",
|
|
@@ -7079,7 +7039,7 @@
|
|
|
7079
7039
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
7080
7040
|
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
7081
7041
|
const _hoisted_4$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面片", -1);
|
|
7082
|
-
const _sfc_main$
|
|
7042
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
7083
7043
|
...{
|
|
7084
7044
|
name: "MEditorAddPageBox"
|
|
7085
7045
|
},
|
|
@@ -7134,7 +7094,7 @@
|
|
|
7134
7094
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
7135
7095
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
7136
7096
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
7137
|
-
const _sfc_main$
|
|
7097
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
7138
7098
|
...{
|
|
7139
7099
|
name: "MEditorFramework"
|
|
7140
7100
|
},
|
|
@@ -7218,7 +7178,7 @@
|
|
|
7218
7178
|
options: vue.unref(codeOptions),
|
|
7219
7179
|
onSave: saveCode
|
|
7220
7180
|
}, null, 8, ["init-values", "options"])
|
|
7221
|
-
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7181
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$y, {
|
|
7222
7182
|
key: 1,
|
|
7223
7183
|
"element-loading-text": "Runtime 加载中...",
|
|
7224
7184
|
ref_key: "splitView",
|
|
@@ -7242,10 +7202,10 @@
|
|
|
7242
7202
|
]),
|
|
7243
7203
|
center: vue.withCtx(() => [
|
|
7244
7204
|
page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7245
|
-
vue.createVNode(_sfc_main$
|
|
7205
|
+
vue.createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7246
7206
|
]),
|
|
7247
7207
|
vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7248
|
-
vue.createVNode(_sfc_main$
|
|
7208
|
+
vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
7249
7209
|
"page-bar-title": vue.withCtx(({ page: page2 }) => [
|
|
7250
7210
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7251
7211
|
]),
|
|
@@ -7280,7 +7240,7 @@
|
|
|
7280
7240
|
}
|
|
7281
7241
|
});
|
|
7282
7242
|
|
|
7283
|
-
const _sfc_main$
|
|
7243
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
7284
7244
|
...{
|
|
7285
7245
|
name: "MEditorNavMenu"
|
|
7286
7246
|
},
|
|
@@ -7462,7 +7422,7 @@
|
|
|
7462
7422
|
style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
7463
7423
|
}, [
|
|
7464
7424
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
|
|
7465
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7425
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
7466
7426
|
data: item,
|
|
7467
7427
|
key: index
|
|
7468
7428
|
}, null, 8, ["data"]);
|
|
@@ -7475,12 +7435,13 @@
|
|
|
7475
7435
|
});
|
|
7476
7436
|
|
|
7477
7437
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
7478
|
-
const _sfc_main$
|
|
7438
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
7479
7439
|
...{
|
|
7480
7440
|
name: "MEditorPropsPanel"
|
|
7481
7441
|
},
|
|
7482
7442
|
__name: "PropsPanel",
|
|
7483
7443
|
props: {
|
|
7444
|
+
disabledShowSrc: { type: Boolean },
|
|
7484
7445
|
extendState: { type: Function }
|
|
7485
7446
|
},
|
|
7486
7447
|
emits: ["mounted", "submit-error", "form-error"],
|
|
@@ -7541,7 +7502,7 @@
|
|
|
7541
7502
|
vue.createVNode(vue.unref(form.MForm), {
|
|
7542
7503
|
ref_key: "configForm",
|
|
7543
7504
|
ref: configForm,
|
|
7544
|
-
class: vue.normalizeClass(
|
|
7505
|
+
class: vue.normalizeClass(propsPanelSize.value),
|
|
7545
7506
|
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
7546
7507
|
size: propsPanelSize.value,
|
|
7547
7508
|
"init-values": values.value,
|
|
@@ -7550,7 +7511,8 @@
|
|
|
7550
7511
|
onChange: submit,
|
|
7551
7512
|
onError: errorHandler
|
|
7552
7513
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"]),
|
|
7553
|
-
vue.
|
|
7514
|
+
!_ctx.disabledShowSrc ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
7515
|
+
key: 0,
|
|
7554
7516
|
class: "m-editor-props-panel-src-icon",
|
|
7555
7517
|
circle: "",
|
|
7556
7518
|
size: "large",
|
|
@@ -7562,9 +7524,9 @@
|
|
|
7562
7524
|
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Document) }, null, 8, ["icon"])
|
|
7563
7525
|
]),
|
|
7564
7526
|
_: 1
|
|
7565
|
-
}, 8, ["type"]),
|
|
7527
|
+
}, 8, ["type"])) : vue.createCommentVNode("", true),
|
|
7566
7528
|
showSrc.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
7567
|
-
key:
|
|
7529
|
+
key: 1,
|
|
7568
7530
|
height: `${vue.unref(editorContentHeight)}px`,
|
|
7569
7531
|
"init-values": values.value,
|
|
7570
7532
|
options: vue.unref(codeOptions),
|
|
@@ -7578,7 +7540,7 @@
|
|
|
7578
7540
|
}
|
|
7579
7541
|
});
|
|
7580
7542
|
|
|
7581
|
-
const _sfc_main$
|
|
7543
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
7582
7544
|
...{
|
|
7583
7545
|
name: "MEditorSearchInput"
|
|
7584
7546
|
},
|
|
@@ -7636,7 +7598,7 @@
|
|
|
7636
7598
|
key: 0,
|
|
7637
7599
|
class: "m-editor-tree-node-children"
|
|
7638
7600
|
};
|
|
7639
|
-
const _sfc_main$
|
|
7601
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
7640
7602
|
...{
|
|
7641
7603
|
name: "MEditorTreeNode"
|
|
7642
7604
|
},
|
|
@@ -7757,7 +7719,7 @@
|
|
|
7757
7719
|
key: 1,
|
|
7758
7720
|
class: "m-editor-tree-empty"
|
|
7759
7721
|
};
|
|
7760
|
-
const _sfc_main$
|
|
7722
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
7761
7723
|
...{
|
|
7762
7724
|
name: "MEditorTree"
|
|
7763
7725
|
},
|
|
@@ -7781,7 +7743,7 @@
|
|
|
7781
7743
|
onDragover: handleDragOver
|
|
7782
7744
|
}, [
|
|
7783
7745
|
_ctx.data?.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.data, (item) => {
|
|
7784
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7746
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
7785
7747
|
key: item.id,
|
|
7786
7748
|
data: item,
|
|
7787
7749
|
indent: _ctx.indent,
|
|
@@ -7878,7 +7840,7 @@
|
|
|
7878
7840
|
};
|
|
7879
7841
|
};
|
|
7880
7842
|
|
|
7881
|
-
const _sfc_main$
|
|
7843
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
7882
7844
|
...{
|
|
7883
7845
|
name: "MEditorCodeBlockList"
|
|
7884
7846
|
},
|
|
@@ -7960,7 +7922,7 @@
|
|
|
7960
7922
|
filter: filterTextChangeHandler
|
|
7961
7923
|
});
|
|
7962
7924
|
return (_ctx, _cache) => {
|
|
7963
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7925
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
7964
7926
|
data: codeList.value,
|
|
7965
7927
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
7966
7928
|
onNodeClick: clickHandler
|
|
@@ -8017,7 +7979,7 @@
|
|
|
8017
7979
|
});
|
|
8018
7980
|
|
|
8019
7981
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
8020
|
-
const _sfc_main$
|
|
7982
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
8021
7983
|
...{
|
|
8022
7984
|
name: "MEditorCodeBlockListPanel"
|
|
8023
7985
|
},
|
|
@@ -8026,6 +7988,7 @@
|
|
|
8026
7988
|
customError: { type: Function }
|
|
8027
7989
|
},
|
|
8028
7990
|
setup(__props) {
|
|
7991
|
+
const eventBus = vue.inject("eventBus");
|
|
8029
7992
|
const { codeBlockService } = vue.inject("services") || {};
|
|
8030
7993
|
const editable = vue.computed(() => codeBlockService?.getEditStatus());
|
|
8031
7994
|
const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
@@ -8033,13 +7996,16 @@
|
|
|
8033
7996
|
const filterTextChangeHandler = (val) => {
|
|
8034
7997
|
codeBlockList.value?.filter(val);
|
|
8035
7998
|
};
|
|
7999
|
+
eventBus?.on("edit-code", (id) => {
|
|
8000
|
+
editCode(id);
|
|
8001
|
+
});
|
|
8036
8002
|
return (_ctx, _cache) => {
|
|
8037
8003
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8038
8004
|
vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
8039
8005
|
default: vue.withCtx(() => [
|
|
8040
8006
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
8041
8007
|
vue.createElementVNode("div", _hoisted_1$7, [
|
|
8042
|
-
vue.createVNode(_sfc_main$
|
|
8008
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8043
8009
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
8044
8010
|
key: 0,
|
|
8045
8011
|
class: "create-code-button",
|
|
@@ -8055,7 +8021,7 @@
|
|
|
8055
8021
|
vue.renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
8056
8022
|
])
|
|
8057
8023
|
]),
|
|
8058
|
-
vue.createVNode(_sfc_main$
|
|
8024
|
+
vue.createVNode(_sfc_main$l, {
|
|
8059
8025
|
ref_key: "codeBlockList",
|
|
8060
8026
|
ref: codeBlockList,
|
|
8061
8027
|
"custom-error": _ctx.customError,
|
|
@@ -8073,7 +8039,7 @@
|
|
|
8073
8039
|
]),
|
|
8074
8040
|
_: 3
|
|
8075
8041
|
}),
|
|
8076
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8042
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$J, {
|
|
8077
8043
|
key: 0,
|
|
8078
8044
|
ref_key: "codeBlockEditor",
|
|
8079
8045
|
ref: codeBlockEditor,
|
|
@@ -8086,6 +8052,113 @@
|
|
|
8086
8052
|
}
|
|
8087
8053
|
});
|
|
8088
8054
|
|
|
8055
|
+
const useDataSourceEdit = (dataSourceService) => {
|
|
8056
|
+
const dialogTitle = vue.ref("");
|
|
8057
|
+
const editDialog = vue.ref();
|
|
8058
|
+
const dataSourceValues = vue.ref({});
|
|
8059
|
+
const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
|
|
8060
|
+
const editHandler = (id) => {
|
|
8061
|
+
if (!editDialog.value)
|
|
8062
|
+
return;
|
|
8063
|
+
dataSourceValues.value = {
|
|
8064
|
+
...dataSourceService?.getDataSourceById(id)
|
|
8065
|
+
};
|
|
8066
|
+
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8067
|
+
editDialog.value.show();
|
|
8068
|
+
};
|
|
8069
|
+
const submitDataSourceHandler = (value) => {
|
|
8070
|
+
if (value.id) {
|
|
8071
|
+
dataSourceService?.update(value);
|
|
8072
|
+
} else {
|
|
8073
|
+
dataSourceService?.add(value);
|
|
8074
|
+
}
|
|
8075
|
+
editDialog.value?.hide();
|
|
8076
|
+
};
|
|
8077
|
+
return {
|
|
8078
|
+
dialogTitle,
|
|
8079
|
+
editDialog,
|
|
8080
|
+
dataSourceValues,
|
|
8081
|
+
editable,
|
|
8082
|
+
editHandler,
|
|
8083
|
+
submitDataSourceHandler
|
|
8084
|
+
};
|
|
8085
|
+
};
|
|
8086
|
+
|
|
8087
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
8088
|
+
...{
|
|
8089
|
+
name: "MEditorDataSourceConfigPanel"
|
|
8090
|
+
},
|
|
8091
|
+
__name: "DataSourceConfigPanel",
|
|
8092
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
8093
|
+
title: {},
|
|
8094
|
+
values: {},
|
|
8095
|
+
disabled: { type: Boolean }
|
|
8096
|
+
}, {
|
|
8097
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
8098
|
+
"visibleModifiers": {},
|
|
8099
|
+
"width": { default: 670 },
|
|
8100
|
+
"widthModifiers": {}
|
|
8101
|
+
}),
|
|
8102
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
8103
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8104
|
+
const props = __props;
|
|
8105
|
+
const boxVisible = vue.useModel(__props, "visible");
|
|
8106
|
+
const width = vue.useModel(__props, "width");
|
|
8107
|
+
const emit = __emit;
|
|
8108
|
+
const services = vue.inject("services");
|
|
8109
|
+
const initValues = vue.ref({});
|
|
8110
|
+
const dataSourceConfig = vue.ref([]);
|
|
8111
|
+
const { height: editorHeight } = useEditorContentHeight();
|
|
8112
|
+
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
8113
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
8114
|
+
vue.watchEffect(() => {
|
|
8115
|
+
initValues.value = props.values;
|
|
8116
|
+
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
8117
|
+
});
|
|
8118
|
+
const submitHandler = (values) => {
|
|
8119
|
+
emit("submit", values);
|
|
8120
|
+
};
|
|
8121
|
+
const errorHandler = (error) => {
|
|
8122
|
+
design.tMagicMessage.error(error.message);
|
|
8123
|
+
};
|
|
8124
|
+
__expose({
|
|
8125
|
+
show() {
|
|
8126
|
+
calcBoxPosition();
|
|
8127
|
+
boxVisible.value = true;
|
|
8128
|
+
},
|
|
8129
|
+
hide() {
|
|
8130
|
+
boxVisible.value = false;
|
|
8131
|
+
}
|
|
8132
|
+
});
|
|
8133
|
+
return (_ctx, _cache) => {
|
|
8134
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
8135
|
+
visible: boxVisible.value,
|
|
8136
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
8137
|
+
width: width.value,
|
|
8138
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
8139
|
+
height: vue.unref(editorHeight),
|
|
8140
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => vue.isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
8141
|
+
title: _ctx.title,
|
|
8142
|
+
position: vue.unref(boxPosition)
|
|
8143
|
+
}, {
|
|
8144
|
+
body: vue.withCtx(() => [
|
|
8145
|
+
vue.createVNode(vue.unref(form.MFormBox), {
|
|
8146
|
+
"label-width": "80px",
|
|
8147
|
+
title: _ctx.title,
|
|
8148
|
+
config: dataSourceConfig.value,
|
|
8149
|
+
values: initValues.value,
|
|
8150
|
+
disabled: _ctx.disabled,
|
|
8151
|
+
style: { "height": "100%" },
|
|
8152
|
+
onSubmit: submitHandler,
|
|
8153
|
+
onError: errorHandler
|
|
8154
|
+
}, null, 8, ["title", "config", "values", "disabled"])
|
|
8155
|
+
]),
|
|
8156
|
+
_: 1
|
|
8157
|
+
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
8158
|
+
};
|
|
8159
|
+
}
|
|
8160
|
+
});
|
|
8161
|
+
|
|
8089
8162
|
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
8090
8163
|
...{
|
|
8091
8164
|
name: "MEditorDataSourceList"
|
|
@@ -8175,7 +8248,7 @@
|
|
|
8175
8248
|
filter: filterTextChangeHandler
|
|
8176
8249
|
});
|
|
8177
8250
|
return (_ctx, _cache) => {
|
|
8178
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8251
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
8179
8252
|
data: list.value,
|
|
8180
8253
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
8181
8254
|
onNodeClick: clickHandler
|
|
@@ -8236,6 +8309,7 @@
|
|
|
8236
8309
|
},
|
|
8237
8310
|
__name: "DataSourceListPanel",
|
|
8238
8311
|
setup(__props) {
|
|
8312
|
+
const eventBus = vue.inject("eventBus");
|
|
8239
8313
|
const { dataSourceService } = vue.inject("services") || {};
|
|
8240
8314
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
8241
8315
|
const datasourceTypeList = vue.computed(
|
|
@@ -8267,12 +8341,15 @@
|
|
|
8267
8341
|
const filterTextChangeHandler = (val) => {
|
|
8268
8342
|
dataSourceList.value?.filter(val);
|
|
8269
8343
|
};
|
|
8344
|
+
eventBus?.on("edit-data-source", (id) => {
|
|
8345
|
+
editHandler(id);
|
|
8346
|
+
});
|
|
8270
8347
|
return (_ctx, _cache) => {
|
|
8271
8348
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8272
8349
|
vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8273
8350
|
default: vue.withCtx(() => [
|
|
8274
8351
|
vue.createElementVNode("div", _hoisted_1$6, [
|
|
8275
|
-
vue.createVNode(_sfc_main$
|
|
8352
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8276
8353
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
|
|
8277
8354
|
key: 0,
|
|
8278
8355
|
placement: "right"
|
|
@@ -8291,7 +8368,7 @@
|
|
|
8291
8368
|
default: vue.withCtx(() => [
|
|
8292
8369
|
vue.createElementVNode("div", _hoisted_2$5, [
|
|
8293
8370
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
8294
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8371
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
8295
8372
|
data: {
|
|
8296
8373
|
type: "button",
|
|
8297
8374
|
text: item.text,
|
|
@@ -8317,7 +8394,7 @@
|
|
|
8317
8394
|
]),
|
|
8318
8395
|
_: 3
|
|
8319
8396
|
}),
|
|
8320
|
-
vue.createVNode(_sfc_main$
|
|
8397
|
+
vue.createVNode(_sfc_main$j, {
|
|
8321
8398
|
ref_key: "editDialog",
|
|
8322
8399
|
ref: editDialog,
|
|
8323
8400
|
disabled: !vue.unref(editable),
|
|
@@ -8461,7 +8538,7 @@
|
|
|
8461
8538
|
vue.renderSlot(_ctx.$slots, "title"),
|
|
8462
8539
|
vue.createElementVNode("div", null, [
|
|
8463
8540
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
8464
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8541
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
8465
8542
|
"event-type": "mouseup",
|
|
8466
8543
|
ref_for: true,
|
|
8467
8544
|
ref_key: "buttons",
|
|
@@ -8563,8 +8640,8 @@
|
|
|
8563
8640
|
const stage = services?.editorService?.get("stage");
|
|
8564
8641
|
const rect = menu.value.$el.getBoundingClientRect();
|
|
8565
8642
|
const parentRect = stage?.container?.getBoundingClientRect();
|
|
8566
|
-
const initialLeft = (rect.left || 0) - (parentRect?.left || 0);
|
|
8567
|
-
const initialTop = (rect.top || 0) - (parentRect?.top || 0);
|
|
8643
|
+
const initialLeft = utils.calcValueByFontsize(stage?.renderer.getDocument(), (rect.left || 0) - (parentRect?.left || 0)) / services.uiService.get("zoom");
|
|
8644
|
+
const initialTop = utils.calcValueByFontsize(stage?.renderer.getDocument(), (rect.top || 0) - (parentRect?.top || 0)) / services.uiService.get("zoom");
|
|
8568
8645
|
services?.editorService?.paste({ left: initialLeft, top: initialTop });
|
|
8569
8646
|
} else {
|
|
8570
8647
|
services?.editorService?.paste();
|
|
@@ -9237,8 +9314,8 @@
|
|
|
9237
9314
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9238
9315
|
default: vue.withCtx(() => [
|
|
9239
9316
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9240
|
-
vue.createVNode(_sfc_main$
|
|
9241
|
-
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9317
|
+
vue.createVNode(_sfc_main$o, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
9318
|
+
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
9242
9319
|
key: 0,
|
|
9243
9320
|
tabindex: "-1",
|
|
9244
9321
|
ref_key: "tree",
|
|
@@ -9364,7 +9441,7 @@
|
|
|
9364
9441
|
"model-value": collapseValue.value
|
|
9365
9442
|
}, {
|
|
9366
9443
|
default: vue.withCtx(() => [
|
|
9367
|
-
vue.createVNode(_sfc_main$
|
|
9444
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
9368
9445
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
|
|
9369
9446
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9370
9447
|
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
@@ -9437,7 +9514,11 @@
|
|
|
9437
9514
|
},
|
|
9438
9515
|
__name: "Sidebar",
|
|
9439
9516
|
props: {
|
|
9440
|
-
data: { default: () => ({
|
|
9517
|
+
data: { default: () => ({
|
|
9518
|
+
type: "tabs",
|
|
9519
|
+
status: "组件",
|
|
9520
|
+
items: [SideItemKey.COMPONENT_LIST, SideItemKey.LAYER, SideItemKey.CODE_BLOCK, SideItemKey.DATA_SOURCE]
|
|
9521
|
+
}) },
|
|
9441
9522
|
layerContentMenu: {},
|
|
9442
9523
|
customContentMenu: {}
|
|
9443
9524
|
},
|
|
@@ -9449,8 +9530,8 @@
|
|
|
9449
9530
|
const activeTabName = vue.ref(props.data?.status);
|
|
9450
9531
|
const getItemConfig = (data) => {
|
|
9451
9532
|
const map = {
|
|
9452
|
-
|
|
9453
|
-
$key:
|
|
9533
|
+
[SideItemKey.COMPONENT_LIST]: {
|
|
9534
|
+
$key: SideItemKey.COMPONENT_LIST,
|
|
9454
9535
|
type: "component",
|
|
9455
9536
|
icon: iconsVue.Goods,
|
|
9456
9537
|
text: "组件",
|
|
@@ -9469,16 +9550,16 @@
|
|
|
9469
9550
|
component: _sfc_main$c,
|
|
9470
9551
|
slots: {}
|
|
9471
9552
|
},
|
|
9472
|
-
|
|
9553
|
+
[SideItemKey.CODE_BLOCK]: {
|
|
9473
9554
|
$key: "code-block",
|
|
9474
9555
|
type: "component",
|
|
9475
9556
|
icon: iconsVue.EditPen,
|
|
9476
9557
|
text: "代码编辑",
|
|
9477
|
-
component: _sfc_main$
|
|
9558
|
+
component: _sfc_main$k,
|
|
9478
9559
|
slots: {}
|
|
9479
9560
|
},
|
|
9480
|
-
|
|
9481
|
-
$key:
|
|
9561
|
+
[SideItemKey.DATA_SOURCE]: {
|
|
9562
|
+
$key: SideItemKey.DATA_SOURCE,
|
|
9482
9563
|
type: "component",
|
|
9483
9564
|
icon: iconsVue.Coin,
|
|
9484
9565
|
text: "数据源",
|
|
@@ -9489,6 +9570,15 @@
|
|
|
9489
9570
|
return typeof data === "string" ? map[data] : data;
|
|
9490
9571
|
};
|
|
9491
9572
|
const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
9573
|
+
vue.watch(
|
|
9574
|
+
sideBarItems,
|
|
9575
|
+
(items) => {
|
|
9576
|
+
services?.uiService.set("sideBarItems", items);
|
|
9577
|
+
},
|
|
9578
|
+
{
|
|
9579
|
+
immediate: true
|
|
9580
|
+
}
|
|
9581
|
+
);
|
|
9492
9582
|
vue.watch(
|
|
9493
9583
|
() => props.data.status,
|
|
9494
9584
|
(status) => {
|
|
@@ -9527,7 +9617,8 @@
|
|
|
9527
9617
|
class: vue.normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
9528
9618
|
draggable: "true",
|
|
9529
9619
|
key: config.$key ?? index,
|
|
9530
|
-
|
|
9620
|
+
style: vue.normalizeStyle(config.tabStyle || {}),
|
|
9621
|
+
onClick: ($event) => activeTabName.value = config.text || config.$key || `${index}`,
|
|
9531
9622
|
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
9532
9623
|
(...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
|
|
9533
9624
|
onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
|
|
@@ -9537,7 +9628,7 @@
|
|
|
9537
9628
|
icon: config.icon
|
|
9538
9629
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
9539
9630
|
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
9540
|
-
],
|
|
9631
|
+
], 46, _hoisted_3$1)), [
|
|
9541
9632
|
[vue.vShow, !vue.unref(floatBoxStates)[config.$key]?.status]
|
|
9542
9633
|
]);
|
|
9543
9634
|
}), 128))
|
|
@@ -9547,7 +9638,10 @@
|
|
|
9547
9638
|
class: "m-editor-sidebar-content",
|
|
9548
9639
|
key: config.$key ?? index
|
|
9549
9640
|
}, [
|
|
9550
|
-
config && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
9641
|
+
config && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
9642
|
+
key: 0,
|
|
9643
|
+
ref_for: true
|
|
9644
|
+
}, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
9551
9645
|
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
9552
9646
|
name: "component-list-panel-header",
|
|
9553
9647
|
fn: vue.withCtx(() => [
|
|
@@ -9658,14 +9752,14 @@
|
|
|
9658
9752
|
} : void 0
|
|
9659
9753
|
]), 1040)) : vue.createCommentVNode("", true)
|
|
9660
9754
|
])), [
|
|
9661
|
-
[vue.vShow,
|
|
9755
|
+
[vue.vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
|
|
9662
9756
|
]);
|
|
9663
9757
|
}), 128))
|
|
9664
9758
|
])) : vue.createCommentVNode("", true),
|
|
9665
9759
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
9666
9760
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
9667
9761
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9668
|
-
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9762
|
+
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
9669
9763
|
key: config.$key ?? index,
|
|
9670
9764
|
visible: vue.unref(floatBoxStates)[config.$key].status,
|
|
9671
9765
|
"onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -9680,7 +9774,10 @@
|
|
|
9680
9774
|
}, {
|
|
9681
9775
|
body: vue.withCtx(() => [
|
|
9682
9776
|
vue.createElementVNode("div", _hoisted_5$1, [
|
|
9683
|
-
config && vue.unref(floatBoxStates)[config.$key].status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
9777
|
+
config && vue.unref(floatBoxStates)[config.$key].status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
9778
|
+
key: 0,
|
|
9779
|
+
ref_for: true
|
|
9780
|
+
}, config.props || {}, vue.toHandlers(config?.listeners || {})), null, 16)) : vue.createCommentVNode("", true)
|
|
9684
9781
|
])
|
|
9685
9782
|
]),
|
|
9686
9783
|
_: 2
|
|
@@ -10098,7 +10195,7 @@
|
|
|
10098
10195
|
]),
|
|
10099
10196
|
_: 1
|
|
10100
10197
|
})) : vue.createCommentVNode("", true),
|
|
10101
|
-
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
10198
|
+
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
10102
10199
|
key: 1,
|
|
10103
10200
|
ref_key: "box",
|
|
10104
10201
|
ref: box,
|
|
@@ -10108,7 +10205,7 @@
|
|
|
10108
10205
|
position: menuPosition.value
|
|
10109
10206
|
}, {
|
|
10110
10207
|
body: vue.withCtx(() => [
|
|
10111
|
-
vue.createVNode(_sfc_main$
|
|
10208
|
+
vue.createVNode(_sfc_main$m, {
|
|
10112
10209
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10113
10210
|
data: nodeData.value,
|
|
10114
10211
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
@@ -10501,17 +10598,17 @@
|
|
|
10501
10598
|
position = "absolute";
|
|
10502
10599
|
top = e.clientY - containerRect.top + scrollTop;
|
|
10503
10600
|
left = e.clientX - containerRect.left + scrollLeft;
|
|
10504
|
-
if (parentEl
|
|
10601
|
+
if (parentEl) {
|
|
10505
10602
|
const { left: parentLeft, top: parentTop } = StageCore.getOffset(parentEl);
|
|
10506
|
-
left = left -
|
|
10507
|
-
top = top -
|
|
10603
|
+
left = left - parentLeft * zoom.value;
|
|
10604
|
+
top = top - parentTop * zoom.value;
|
|
10508
10605
|
}
|
|
10509
10606
|
}
|
|
10510
10607
|
config.data.style = {
|
|
10511
10608
|
...style,
|
|
10512
10609
|
position,
|
|
10513
|
-
top: top / zoom.value,
|
|
10514
|
-
left: left / zoom.value
|
|
10610
|
+
top: utils.calcValueByFontsize(doc, top / zoom.value),
|
|
10611
|
+
left: utils.calcValueByFontsize(doc, left / zoom.value)
|
|
10515
10612
|
};
|
|
10516
10613
|
config.data.inputEvent = e;
|
|
10517
10614
|
services?.editorService.add(config.data, parent);
|
|
@@ -11258,6 +11355,7 @@
|
|
|
11258
11355
|
containerHighlightClassName: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
11259
11356
|
containerHighlightDuration: 800,
|
|
11260
11357
|
containerHighlightType: StageCore.ContainerHighlightType.DEFAULT,
|
|
11358
|
+
disabledShowSrc: false,
|
|
11261
11359
|
componentGroupList: () => [],
|
|
11262
11360
|
datasourceList: () => [],
|
|
11263
11361
|
menu: () => ({ left: [], right: [] }),
|
|
@@ -11639,6 +11737,7 @@
|
|
|
11639
11737
|
disabledMultiSelect: { type: Boolean },
|
|
11640
11738
|
disabledPageFragment: { type: Boolean },
|
|
11641
11739
|
disabledStageOverlay: { type: Boolean },
|
|
11740
|
+
disabledShowSrc: { type: Boolean },
|
|
11642
11741
|
render: { type: Function },
|
|
11643
11742
|
updateDragEl: { type: Function },
|
|
11644
11743
|
canSelect: { type: Function },
|
|
@@ -11688,15 +11787,16 @@
|
|
|
11688
11787
|
vue.provide("services", services);
|
|
11689
11788
|
vue.provide("codeOptions", props.codeOptions);
|
|
11690
11789
|
vue.provide("stageOptions", stageOptions);
|
|
11790
|
+
vue.provide("eventBus", new events.EventEmitter());
|
|
11691
11791
|
__expose(services);
|
|
11692
11792
|
return (_ctx, _cache) => {
|
|
11693
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
11793
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11694
11794
|
header: vue.withCtx(() => [
|
|
11695
11795
|
vue.renderSlot(_ctx.$slots, "header")
|
|
11696
11796
|
]),
|
|
11697
11797
|
nav: vue.withCtx(() => [
|
|
11698
11798
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
|
|
11699
|
-
vue.createVNode(_sfc_main$
|
|
11799
|
+
vue.createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11700
11800
|
])
|
|
11701
11801
|
]),
|
|
11702
11802
|
"content-before": vue.withCtx(() => [
|
|
@@ -11771,8 +11871,9 @@
|
|
|
11771
11871
|
]),
|
|
11772
11872
|
"props-panel": vue.withCtx(() => [
|
|
11773
11873
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11774
|
-
vue.createVNode(_sfc_main$
|
|
11874
|
+
vue.createVNode(_sfc_main$p, {
|
|
11775
11875
|
"extend-state": _ctx.extendFormState,
|
|
11876
|
+
"disabled-show-src": _ctx.disabledShowSrc,
|
|
11776
11877
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11777
11878
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
11778
11879
|
onSubmitError: _cache[2] || (_cache[2] = (e) => _ctx.$emit("props-submit-error", e))
|
|
@@ -11781,7 +11882,7 @@
|
|
|
11781
11882
|
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
11782
11883
|
]),
|
|
11783
11884
|
_: 3
|
|
11784
|
-
}, 8, ["extend-state"])
|
|
11885
|
+
}, 8, ["extend-state", "disabled-show-src"])
|
|
11785
11886
|
])
|
|
11786
11887
|
]),
|
|
11787
11888
|
empty: vue.withCtx(() => [
|
|
@@ -11819,66 +11920,67 @@
|
|
|
11819
11920
|
setConfig(option);
|
|
11820
11921
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11821
11922
|
app.component("magic-code-editor", _sfc_main$T);
|
|
11822
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
11923
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11823
11924
|
app.component("m-fields-code-link", _sfc_main$R);
|
|
11824
11925
|
app.component("m-fields-vs-code", _sfc_main$S);
|
|
11825
11926
|
app.component("m-fields-code-select", _sfc_main$Q);
|
|
11826
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
11827
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11828
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
11829
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11830
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11831
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11832
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11833
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11834
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11835
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11836
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11927
|
+
app.component("m-fields-code-select-col", _sfc_main$O);
|
|
11928
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11929
|
+
app.component("m-fields-data-source-fields", _sfc_main$M);
|
|
11930
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11931
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11932
|
+
app.component("m-fields-data-source-input", _sfc_main$K);
|
|
11933
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11934
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11935
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11936
|
+
app.component("m-fields-data-source-field-select", _sfc_main$L);
|
|
11937
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11837
11938
|
}
|
|
11838
11939
|
};
|
|
11839
11940
|
|
|
11840
|
-
Object.defineProperty(exports,
|
|
11941
|
+
Object.defineProperty(exports, "DepTargetType", {
|
|
11841
11942
|
enumerable: true,
|
|
11842
11943
|
get: () => dep.DepTargetType
|
|
11843
11944
|
});
|
|
11844
11945
|
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
11845
11946
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
11846
|
-
exports.CodeBlockEditor = _sfc_main$
|
|
11847
|
-
exports.CodeBlockList = _sfc_main$
|
|
11848
|
-
exports.CodeBlockListPanel = _sfc_main$
|
|
11947
|
+
exports.CodeBlockEditor = _sfc_main$J;
|
|
11948
|
+
exports.CodeBlockList = _sfc_main$l;
|
|
11949
|
+
exports.CodeBlockListPanel = _sfc_main$k;
|
|
11849
11950
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
11850
11951
|
exports.CodeSelect = _sfc_main$Q;
|
|
11851
|
-
exports.CodeSelectCol = _sfc_main$
|
|
11952
|
+
exports.CodeSelectCol = _sfc_main$O;
|
|
11852
11953
|
exports.ColumnLayout = ColumnLayout;
|
|
11853
11954
|
exports.ComponentListPanel = _sfc_main$b;
|
|
11854
11955
|
exports.ContentMenu = _sfc_main$g;
|
|
11855
|
-
exports.DataSourceConfigPanel = _sfc_main$
|
|
11856
|
-
exports.DataSourceFieldSelect = _sfc_main$
|
|
11857
|
-
exports.DataSourceFields = _sfc_main$
|
|
11858
|
-
exports.DataSourceInput = _sfc_main$
|
|
11859
|
-
exports.DataSourceMethodSelect = _sfc_main$
|
|
11860
|
-
exports.DataSourceMethods = _sfc_main$
|
|
11861
|
-
exports.DataSourceMocks = _sfc_main$
|
|
11862
|
-
exports.DataSourceSelect = _sfc_main$
|
|
11956
|
+
exports.DataSourceConfigPanel = _sfc_main$j;
|
|
11957
|
+
exports.DataSourceFieldSelect = _sfc_main$L;
|
|
11958
|
+
exports.DataSourceFields = _sfc_main$M;
|
|
11959
|
+
exports.DataSourceInput = _sfc_main$K;
|
|
11960
|
+
exports.DataSourceMethodSelect = _sfc_main$H;
|
|
11961
|
+
exports.DataSourceMethods = _sfc_main$I;
|
|
11962
|
+
exports.DataSourceMocks = _sfc_main$G;
|
|
11963
|
+
exports.DataSourceSelect = _sfc_main$F;
|
|
11863
11964
|
exports.DragType = DragType;
|
|
11864
|
-
exports.EventSelect = _sfc_main$
|
|
11965
|
+
exports.EventSelect = _sfc_main$E;
|
|
11865
11966
|
exports.Fixed2Other = Fixed2Other;
|
|
11866
11967
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
11867
11968
|
exports.Icon = _sfc_main$U;
|
|
11868
11969
|
exports.KeyBindingCommand = KeyBindingCommand;
|
|
11869
|
-
exports.KeyValue = _sfc_main$
|
|
11970
|
+
exports.KeyValue = _sfc_main$C;
|
|
11870
11971
|
exports.Keys = Keys;
|
|
11871
11972
|
exports.LayerOffset = LayerOffset;
|
|
11872
11973
|
exports.LayerPanel = _sfc_main$c;
|
|
11873
11974
|
exports.Layout = Layout;
|
|
11874
|
-
exports.LayoutContainer = _sfc_main$
|
|
11875
|
-
exports.PageFragmentSelect = _sfc_main$
|
|
11876
|
-
exports.PropsPanel = _sfc_main$
|
|
11877
|
-
exports.Resizer = _sfc_main$
|
|
11878
|
-
exports.
|
|
11975
|
+
exports.LayoutContainer = _sfc_main$y;
|
|
11976
|
+
exports.PageFragmentSelect = _sfc_main$B;
|
|
11977
|
+
exports.PropsPanel = _sfc_main$p;
|
|
11978
|
+
exports.Resizer = _sfc_main$z;
|
|
11979
|
+
exports.SideItemKey = SideItemKey;
|
|
11980
|
+
exports.SplitView = _sfc_main$y;
|
|
11879
11981
|
exports.TMagicCodeEditor = _sfc_main$T;
|
|
11880
11982
|
exports.TMagicEditor = _sfc_main;
|
|
11881
|
-
exports.ToolButton = _sfc_main$
|
|
11983
|
+
exports.ToolButton = _sfc_main$x;
|
|
11882
11984
|
exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
|
|
11883
11985
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
11884
11986
|
exports.advancedTabConfig = advancedTabConfig;
|
|
@@ -11900,6 +12002,7 @@
|
|
|
11900
12002
|
exports.generatePageName = generatePageName;
|
|
11901
12003
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
11902
12004
|
exports.getAddParent = getAddParent;
|
|
12005
|
+
exports.getCascaderOptionsFromFields = getCascaderOptionsFromFields;
|
|
11903
12006
|
exports.getConfig = getConfig;
|
|
11904
12007
|
exports.getDefaultConfig = getDefaultConfig;
|
|
11905
12008
|
exports.getDisplayField = getDisplayField;
|