@tmagic/editor 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +15 -1
- package/dist/tmagic-editor.js +1242 -1163
- package/dist/tmagic-editor.umd.cjs +1260 -1180
- package/package.json +11 -11
- package/src/Editor.vue +6 -1
- package/src/editorProps.ts +3 -0
- package/src/fields/CodeSelectCol.vue +26 -18
- package/src/fields/DataSourceFieldSelect.vue +38 -33
- package/src/fields/DataSourceMethodSelect.vue +25 -31
- package/src/fields/DataSourceSelect.vue +49 -13
- package/src/fields/EventSelect.vue +8 -6
- 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/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/types/components/ContentMenu.vue.d.ts +3 -3
- package/types/components/ToolButton.vue.d.ts +2 -2
- package/types/editorProps.d.ts +3 -0
- package/types/layouts/PropsPanel.vue.d.ts +2 -0
- package/types/layouts/sidebar/Sidebar.vue.d.ts +7 -7
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +2 -2
- 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/ViewerMenu.vue.d.ts +2 -2
- package/types/services/ui.d.ts +18 -0
- package/types/type.d.ts +26 -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,164 @@
|
|
|
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
|
-
|
|
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
|
+
display: false,
|
|
630
|
+
items: [
|
|
631
|
+
{
|
|
632
|
+
name: "events",
|
|
633
|
+
src: "datasource",
|
|
634
|
+
type: "event-select"
|
|
635
|
+
}
|
|
636
|
+
]
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
title: "mock数据",
|
|
640
|
+
items: [
|
|
641
|
+
{
|
|
642
|
+
name: "mocks",
|
|
643
|
+
type: "data-source-mocks",
|
|
644
|
+
defaultValue: () => []
|
|
645
|
+
}
|
|
646
|
+
]
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
title: "请求参数裁剪",
|
|
650
|
+
display: (formState, { model }) => model.type === "http",
|
|
651
|
+
items: [
|
|
652
|
+
{
|
|
653
|
+
name: "beforeRequest",
|
|
654
|
+
type: "vs-code",
|
|
655
|
+
parse: true,
|
|
656
|
+
height: "600px"
|
|
657
|
+
}
|
|
658
|
+
]
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
title: "响应数据裁剪",
|
|
662
|
+
display: (formState, { model }) => model.type === "http",
|
|
663
|
+
items: [
|
|
664
|
+
{
|
|
665
|
+
name: "afterResponse",
|
|
666
|
+
type: "vs-code",
|
|
667
|
+
parse: true,
|
|
668
|
+
height: "600px"
|
|
669
|
+
}
|
|
670
|
+
]
|
|
1196
671
|
}
|
|
1197
672
|
]
|
|
1198
673
|
}
|
|
@@ -2057,6 +1532,13 @@
|
|
|
2057
1532
|
ColumnLayout2["RIGHT"] = "right";
|
|
2058
1533
|
return ColumnLayout2;
|
|
2059
1534
|
})(ColumnLayout || {});
|
|
1535
|
+
var SideItemKey = /* @__PURE__ */ ((SideItemKey2) => {
|
|
1536
|
+
SideItemKey2["COMPONENT_LIST"] = "component-list";
|
|
1537
|
+
SideItemKey2["LAYER"] = "layer";
|
|
1538
|
+
SideItemKey2["CODE_BLOCK"] = "code-block";
|
|
1539
|
+
SideItemKey2["DATA_SOURCE"] = "data-source";
|
|
1540
|
+
return SideItemKey2;
|
|
1541
|
+
})(SideItemKey || {});
|
|
2060
1542
|
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
2061
1543
|
LayerOffset2["TOP"] = "top";
|
|
2062
1544
|
LayerOffset2["BOTTOM"] = "bottom";
|
|
@@ -3708,7 +3190,7 @@
|
|
|
3708
3190
|
return newNode;
|
|
3709
3191
|
};
|
|
3710
3192
|
|
|
3711
|
-
const _sfc_main$
|
|
3193
|
+
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
3712
3194
|
...{
|
|
3713
3195
|
name: "MEditorCodeParams"
|
|
3714
3196
|
},
|
|
@@ -3758,68 +3240,9 @@
|
|
|
3758
3240
|
}
|
|
3759
3241
|
});
|
|
3760
3242
|
|
|
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({
|
|
3243
|
+
const _hoisted_1$s = { class: "m-fields-code-select-col" };
|
|
3244
|
+
const _hoisted_2$k = { class: "code-select-container" };
|
|
3245
|
+
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
3823
3246
|
...{
|
|
3824
3247
|
name: "MFieldsCodeSelectCol"
|
|
3825
3248
|
},
|
|
@@ -3839,9 +3262,13 @@
|
|
|
3839
3262
|
setup(__props, { emit: __emit }) {
|
|
3840
3263
|
const mForm = vue.inject("mForm");
|
|
3841
3264
|
const services = vue.inject("services");
|
|
3265
|
+
const eventBus = vue.inject("eventBus");
|
|
3842
3266
|
const emit = __emit;
|
|
3843
|
-
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
3844
3267
|
const props = __props;
|
|
3268
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
3269
|
+
const hasCodeBlockSidePanel = vue.computed(
|
|
3270
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.CODE_BLOCK)
|
|
3271
|
+
);
|
|
3845
3272
|
const getParamItemsConfig = (codeId) => {
|
|
3846
3273
|
if (!codeDsl.value || !codeId)
|
|
3847
3274
|
return [];
|
|
@@ -3892,46 +3319,278 @@
|
|
|
3892
3319
|
props.model.params = value.params;
|
|
3893
3320
|
emit("change", props.model);
|
|
3894
3321
|
};
|
|
3895
|
-
const
|
|
3322
|
+
const editCode = (id) => {
|
|
3323
|
+
eventBus?.emit("edit-code", id);
|
|
3324
|
+
};
|
|
3896
3325
|
return (_ctx, _cache) => {
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
vue.createVNode(_component_m_form_container, {
|
|
3326
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$s, [
|
|
3327
|
+
vue.createElementVNode("div", _hoisted_2$k, [
|
|
3328
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
3901
3329
|
class: "select",
|
|
3902
3330
|
config: selectConfig,
|
|
3903
3331
|
model: _ctx.model,
|
|
3904
3332
|
size: _ctx.size,
|
|
3905
3333
|
onChange: onParamsChangeHandler
|
|
3906
3334
|
}, null, 8, ["model", "size"]),
|
|
3907
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(
|
|
3335
|
+
_ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3908
3336
|
key: 0,
|
|
3909
|
-
class: "
|
|
3910
|
-
|
|
3911
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
3912
|
-
},
|
|
3337
|
+
class: "m-fields-select-action-button",
|
|
3338
|
+
size: _ctx.size,
|
|
3339
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editCode(_ctx.model[_ctx.name]))
|
|
3340
|
+
}, {
|
|
3341
|
+
default: vue.withCtx(() => [
|
|
3342
|
+
vue.createVNode(_sfc_main$U, {
|
|
3343
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
3344
|
+
}, null, 8, ["icon"])
|
|
3345
|
+
]),
|
|
3346
|
+
_: 1
|
|
3347
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
3913
3348
|
]),
|
|
3914
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3349
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
3915
3350
|
name: "params",
|
|
3916
3351
|
key: _ctx.model[_ctx.name],
|
|
3917
3352
|
model: _ctx.model,
|
|
3918
3353
|
size: _ctx.size,
|
|
3919
3354
|
"params-config": paramsConfig.value,
|
|
3920
3355
|
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)
|
|
3356
|
+
}, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true)
|
|
3930
3357
|
]);
|
|
3931
3358
|
};
|
|
3932
3359
|
}
|
|
3933
3360
|
});
|
|
3934
3361
|
|
|
3362
|
+
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
3363
|
+
__name: "FloatingBox",
|
|
3364
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
3365
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
3366
|
+
title: { default: "" },
|
|
3367
|
+
beforeClose: {}
|
|
3368
|
+
}, {
|
|
3369
|
+
"width": { default: 0 },
|
|
3370
|
+
"widthModifiers": {},
|
|
3371
|
+
"height": { default: 0 },
|
|
3372
|
+
"heightModifiers": {},
|
|
3373
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
3374
|
+
"visibleModifiers": {}
|
|
3375
|
+
}),
|
|
3376
|
+
emits: ["update:width", "update:height", "update:visible"],
|
|
3377
|
+
setup(__props, { expose: __expose }) {
|
|
3378
|
+
const width = vue.useModel(__props, "width");
|
|
3379
|
+
const height = vue.useModel(__props, "height");
|
|
3380
|
+
const visible = vue.useModel(__props, "visible");
|
|
3381
|
+
const props = __props;
|
|
3382
|
+
const target = vue.ref();
|
|
3383
|
+
const titleEl = vue.ref();
|
|
3384
|
+
const zIndex = design.useZIndex();
|
|
3385
|
+
const curZIndex = vue.ref(0);
|
|
3386
|
+
const titleHeight = vue.ref(0);
|
|
3387
|
+
const bodyHeight = vue.computed(() => {
|
|
3388
|
+
if (height.value) {
|
|
3389
|
+
return height.value - titleHeight.value;
|
|
3390
|
+
}
|
|
3391
|
+
if (target.value) {
|
|
3392
|
+
return target.value.clientHeight - titleHeight.value;
|
|
3393
|
+
}
|
|
3394
|
+
return "auto";
|
|
3395
|
+
});
|
|
3396
|
+
const services = vue.inject("services");
|
|
3397
|
+
const frameworkWidth = vue.computed(() => services?.uiService.get("frameworkRect").width || 0);
|
|
3398
|
+
const style = vue.computed(() => {
|
|
3399
|
+
let { left } = props.position;
|
|
3400
|
+
if (width.value) {
|
|
3401
|
+
left = left + width.value > frameworkWidth.value ? frameworkWidth.value - width.value : left;
|
|
3402
|
+
}
|
|
3403
|
+
return {
|
|
3404
|
+
left: `${left}px`,
|
|
3405
|
+
top: `${props.position.top}px`,
|
|
3406
|
+
width: width.value ? `${width.value}px` : "auto",
|
|
3407
|
+
height: height.value ? `${height.value}px` : "auto"
|
|
3408
|
+
};
|
|
3409
|
+
});
|
|
3410
|
+
let moveable = null;
|
|
3411
|
+
const initMoveable = () => {
|
|
3412
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
3413
|
+
className: "m-editor-floating-box-moveable",
|
|
3414
|
+
target: target.value,
|
|
3415
|
+
draggable: true,
|
|
3416
|
+
resizable: true,
|
|
3417
|
+
edge: true,
|
|
3418
|
+
keepRatio: false,
|
|
3419
|
+
origin: false,
|
|
3420
|
+
snappable: true,
|
|
3421
|
+
dragTarget: titleEl.value,
|
|
3422
|
+
dragTargetSelf: false,
|
|
3423
|
+
linePadding: 10,
|
|
3424
|
+
controlPadding: 10,
|
|
3425
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
3426
|
+
});
|
|
3427
|
+
moveable.on("drag", (e) => {
|
|
3428
|
+
e.target.style.transform = e.transform;
|
|
3429
|
+
});
|
|
3430
|
+
moveable.on("resize", (e) => {
|
|
3431
|
+
width.value = e.width;
|
|
3432
|
+
height.value = e.height;
|
|
3433
|
+
e.target.style.width = `${e.width}px`;
|
|
3434
|
+
e.target.style.height = `${e.height}px`;
|
|
3435
|
+
e.target.style.transform = e.drag.transform;
|
|
3436
|
+
});
|
|
3437
|
+
};
|
|
3438
|
+
const destroyMoveable = () => {
|
|
3439
|
+
moveable?.destroy();
|
|
3440
|
+
moveable = null;
|
|
3441
|
+
};
|
|
3442
|
+
vue.watch(
|
|
3443
|
+
visible,
|
|
3444
|
+
async (visible2) => {
|
|
3445
|
+
if (visible2) {
|
|
3446
|
+
await vue.nextTick();
|
|
3447
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3448
|
+
const targetRect = target.value?.getBoundingClientRect();
|
|
3449
|
+
if (targetRect) {
|
|
3450
|
+
width.value = targetRect.width;
|
|
3451
|
+
height.value = targetRect.height;
|
|
3452
|
+
initMoveable();
|
|
3453
|
+
}
|
|
3454
|
+
if (titleEl.value) {
|
|
3455
|
+
const titleRect = titleEl.value.getBoundingClientRect();
|
|
3456
|
+
titleHeight.value = titleRect.height;
|
|
3457
|
+
}
|
|
3458
|
+
} else {
|
|
3459
|
+
destroyMoveable();
|
|
3460
|
+
}
|
|
3461
|
+
},
|
|
3462
|
+
{
|
|
3463
|
+
immediate: true
|
|
3464
|
+
}
|
|
3465
|
+
);
|
|
3466
|
+
vue.onBeforeUnmount(() => {
|
|
3467
|
+
destroyMoveable();
|
|
3468
|
+
});
|
|
3469
|
+
const hide = (cancel) => {
|
|
3470
|
+
if (cancel !== false) {
|
|
3471
|
+
visible.value = false;
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3474
|
+
const closeHandler = () => {
|
|
3475
|
+
if (typeof props.beforeClose === "function") {
|
|
3476
|
+
props.beforeClose(hide);
|
|
3477
|
+
} else {
|
|
3478
|
+
hide();
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3481
|
+
const nextZIndex = () => {
|
|
3482
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3483
|
+
};
|
|
3484
|
+
vue.provide("parentFloating", target);
|
|
3485
|
+
__expose({
|
|
3486
|
+
bodyHeight,
|
|
3487
|
+
target,
|
|
3488
|
+
titleEl
|
|
3489
|
+
});
|
|
3490
|
+
return (_ctx, _cache) => {
|
|
3491
|
+
return visible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
3492
|
+
key: 0,
|
|
3493
|
+
to: "body"
|
|
3494
|
+
}, [
|
|
3495
|
+
vue.createElementVNode("div", {
|
|
3496
|
+
ref_key: "target",
|
|
3497
|
+
ref: target,
|
|
3498
|
+
class: "m-editor-float-box",
|
|
3499
|
+
style: vue.normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
3500
|
+
onMousedown: nextZIndex
|
|
3501
|
+
}, [
|
|
3502
|
+
vue.createElementVNode("div", {
|
|
3503
|
+
ref_key: "titleEl",
|
|
3504
|
+
ref: titleEl,
|
|
3505
|
+
class: "m-editor-float-box-title"
|
|
3506
|
+
}, [
|
|
3507
|
+
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
3508
|
+
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
|
|
3509
|
+
]),
|
|
3510
|
+
vue.createElementVNode("div", null, [
|
|
3511
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3512
|
+
link: "",
|
|
3513
|
+
size: "small",
|
|
3514
|
+
onClick: closeHandler
|
|
3515
|
+
}, {
|
|
3516
|
+
default: vue.withCtx(() => [
|
|
3517
|
+
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
3518
|
+
]),
|
|
3519
|
+
_: 1
|
|
3520
|
+
})
|
|
3521
|
+
])
|
|
3522
|
+
], 512),
|
|
3523
|
+
vue.createElementVNode("div", {
|
|
3524
|
+
class: "m-editor-float-box-body",
|
|
3525
|
+
style: vue.normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
3526
|
+
}, [
|
|
3527
|
+
vue.renderSlot(_ctx.$slots, "body")
|
|
3528
|
+
], 4)
|
|
3529
|
+
], 36)
|
|
3530
|
+
])) : vue.createCommentVNode("", true);
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
});
|
|
3534
|
+
|
|
3535
|
+
const useCodeBlockEdit = (codeBlockService) => {
|
|
3536
|
+
const codeConfig = vue.ref();
|
|
3537
|
+
const codeId = vue.ref();
|
|
3538
|
+
const codeBlockEditor = vue.ref();
|
|
3539
|
+
const createCodeBlock = async () => {
|
|
3540
|
+
if (!codeBlockService) {
|
|
3541
|
+
design.tMagicMessage.error("新增代码块失败");
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
codeConfig.value = {
|
|
3545
|
+
name: "",
|
|
3546
|
+
content: `({app, params}) => {
|
|
3547
|
+
// place your code here
|
|
3548
|
+
}`,
|
|
3549
|
+
params: []
|
|
3550
|
+
};
|
|
3551
|
+
codeId.value = await codeBlockService.getUniqueId();
|
|
3552
|
+
await vue.nextTick();
|
|
3553
|
+
codeBlockEditor.value?.show();
|
|
3554
|
+
};
|
|
3555
|
+
const editCode = async (id) => {
|
|
3556
|
+
const codeBlock = await codeBlockService?.getCodeContentById(id);
|
|
3557
|
+
if (!codeBlock) {
|
|
3558
|
+
design.tMagicMessage.error("获取代码块内容失败");
|
|
3559
|
+
return;
|
|
3560
|
+
}
|
|
3561
|
+
let codeContent = codeBlock.content;
|
|
3562
|
+
if (typeof codeContent !== "string") {
|
|
3563
|
+
codeContent = codeContent.toString();
|
|
3564
|
+
}
|
|
3565
|
+
codeConfig.value = {
|
|
3566
|
+
...lodashEs.cloneDeep(codeBlock),
|
|
3567
|
+
content: codeContent
|
|
3568
|
+
};
|
|
3569
|
+
codeId.value = id;
|
|
3570
|
+
await vue.nextTick();
|
|
3571
|
+
codeBlockEditor.value?.show();
|
|
3572
|
+
};
|
|
3573
|
+
const deleteCode = async (key) => {
|
|
3574
|
+
codeBlockService?.deleteCodeDslByIds([key]);
|
|
3575
|
+
};
|
|
3576
|
+
const submitCodeBlockHandler = async (values) => {
|
|
3577
|
+
if (!codeId.value)
|
|
3578
|
+
return;
|
|
3579
|
+
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3580
|
+
design.tMagicMessage.success("代码块保存成功");
|
|
3581
|
+
codeBlockEditor.value?.hide();
|
|
3582
|
+
};
|
|
3583
|
+
return {
|
|
3584
|
+
codeId,
|
|
3585
|
+
codeConfig,
|
|
3586
|
+
codeBlockEditor,
|
|
3587
|
+
createCodeBlock,
|
|
3588
|
+
editCode,
|
|
3589
|
+
deleteCode,
|
|
3590
|
+
submitCodeBlockHandler
|
|
3591
|
+
};
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3935
3594
|
const useDataSourceMethod = () => {
|
|
3936
3595
|
const codeConfig = vue.ref();
|
|
3937
3596
|
const codeBlockEditor = vue.ref();
|
|
@@ -4026,6 +3685,7 @@
|
|
|
4026
3685
|
propsPanelSize: "small",
|
|
4027
3686
|
showAddPageButton: true,
|
|
4028
3687
|
hideSlideBar: false,
|
|
3688
|
+
sideBarItems: [],
|
|
4029
3689
|
navMenuRect: {
|
|
4030
3690
|
left: 0,
|
|
4031
3691
|
top: 0,
|
|
@@ -4269,9 +3929,70 @@
|
|
|
4269
3929
|
};
|
|
4270
3930
|
};
|
|
4271
3931
|
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
|
|
3932
|
+
const useWindowRect = () => {
|
|
3933
|
+
const rect = vue.reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
3934
|
+
const windowResizeHandler = () => {
|
|
3935
|
+
rect.width = globalThis.innerWidth;
|
|
3936
|
+
rect.height = globalThis.innerHeight;
|
|
3937
|
+
};
|
|
3938
|
+
globalThis.addEventListener("resize", windowResizeHandler);
|
|
3939
|
+
vue.onBeforeUnmount(() => {
|
|
3940
|
+
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
3941
|
+
});
|
|
3942
|
+
return {
|
|
3943
|
+
rect
|
|
3944
|
+
};
|
|
3945
|
+
};
|
|
3946
|
+
|
|
3947
|
+
const useEditorContentHeight = () => {
|
|
3948
|
+
const services = vue.inject("services");
|
|
3949
|
+
const frameworkHeight = vue.computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
3950
|
+
const navMenuHeight = vue.computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
3951
|
+
const editorContentHeight = vue.computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
3952
|
+
const height = vue.ref(0);
|
|
3953
|
+
vue.watch(
|
|
3954
|
+
editorContentHeight,
|
|
3955
|
+
() => {
|
|
3956
|
+
if (height.value > 0 && height.value === editorContentHeight.value)
|
|
3957
|
+
return;
|
|
3958
|
+
height.value = editorContentHeight.value;
|
|
3959
|
+
},
|
|
3960
|
+
{
|
|
3961
|
+
immediate: true
|
|
3962
|
+
}
|
|
3963
|
+
);
|
|
3964
|
+
return {
|
|
3965
|
+
height
|
|
3966
|
+
};
|
|
3967
|
+
};
|
|
3968
|
+
|
|
3969
|
+
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
3970
|
+
const boxPosition = vue.ref({
|
|
3971
|
+
left: 0,
|
|
3972
|
+
top: 0
|
|
3973
|
+
});
|
|
3974
|
+
const calcBoxPosition = () => {
|
|
3975
|
+
const columnWidth = uiService?.get("columnWidth");
|
|
3976
|
+
const navMenuRect = uiService?.get("navMenuRect");
|
|
3977
|
+
let left = columnWidth?.left ?? 0;
|
|
3978
|
+
if (parent?.value) {
|
|
3979
|
+
const rect = parent?.value?.getBoundingClientRect();
|
|
3980
|
+
left = (rect?.left ?? 0) + (rect?.width ?? 0);
|
|
3981
|
+
}
|
|
3982
|
+
boxPosition.value = {
|
|
3983
|
+
left,
|
|
3984
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
3985
|
+
};
|
|
3986
|
+
};
|
|
3987
|
+
return {
|
|
3988
|
+
boxPosition,
|
|
3989
|
+
calcBoxPosition
|
|
3990
|
+
};
|
|
3991
|
+
};
|
|
3992
|
+
|
|
3993
|
+
const _hoisted_1$r = { class: "m-editor-data-source-fields" };
|
|
3994
|
+
const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
|
|
3995
|
+
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
4275
3996
|
...{
|
|
4276
3997
|
name: "MFieldsDataSourceFields"
|
|
4277
3998
|
},
|
|
@@ -4526,12 +4247,12 @@
|
|
|
4526
4247
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4527
4248
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4528
4249
|
return (_ctx, _cache) => {
|
|
4529
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4250
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$r, [
|
|
4530
4251
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
4531
4252
|
data: _ctx.model[_ctx.name],
|
|
4532
4253
|
columns: fieldColumns
|
|
4533
4254
|
}, null, 8, ["data"]),
|
|
4534
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
4255
|
+
vue.createElementVNode("div", _hoisted_2$j, [
|
|
4535
4256
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4536
4257
|
size: "small",
|
|
4537
4258
|
disabled: _ctx.disabled,
|
|
@@ -4556,7 +4277,7 @@
|
|
|
4556
4277
|
_: 1
|
|
4557
4278
|
}, 8, ["disabled"])
|
|
4558
4279
|
]),
|
|
4559
|
-
vue.createVNode(_sfc_main$
|
|
4280
|
+
vue.createVNode(_sfc_main$N, {
|
|
4560
4281
|
visible: addDialogVisible.value,
|
|
4561
4282
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
|
4562
4283
|
width: width.value,
|
|
@@ -4579,7 +4300,7 @@
|
|
|
4579
4300
|
]),
|
|
4580
4301
|
_: 1
|
|
4581
4302
|
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4582
|
-
vue.createVNode(_sfc_main$
|
|
4303
|
+
vue.createVNode(_sfc_main$N, {
|
|
4583
4304
|
visible: addFromJsonDialogVisible.value,
|
|
4584
4305
|
"onUpdate:visible": _cache[5] || (_cache[5] = ($event) => addFromJsonDialogVisible.value = $event),
|
|
4585
4306
|
width: width.value,
|
|
@@ -4604,115 +4325,8 @@
|
|
|
4604
4325
|
}
|
|
4605
4326
|
});
|
|
4606
4327
|
|
|
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({
|
|
4328
|
+
const _hoisted_1$q = { class: "m-fields-data-source-field-select" };
|
|
4329
|
+
const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
4716
4330
|
...{
|
|
4717
4331
|
name: "MFieldsDataSourceFieldSelect"
|
|
4718
4332
|
},
|
|
@@ -4731,8 +4345,13 @@
|
|
|
4731
4345
|
emits: ["change"],
|
|
4732
4346
|
setup(__props, { emit: __emit }) {
|
|
4733
4347
|
const services = vue.inject("services");
|
|
4348
|
+
const eventBus = vue.inject("eventBus");
|
|
4734
4349
|
const emit = __emit;
|
|
4735
4350
|
const props = __props;
|
|
4351
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
4352
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
4353
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
4354
|
+
);
|
|
4736
4355
|
const selectedDataSourceId = vue.computed(() => {
|
|
4737
4356
|
const value = props.model[props.name];
|
|
4738
4357
|
if (!Array.isArray(value) || !value.length) {
|
|
@@ -4785,12 +4404,19 @@
|
|
|
4785
4404
|
};
|
|
4786
4405
|
});
|
|
4787
4406
|
const showDataSourceFieldSelect = vue.ref(false);
|
|
4788
|
-
vue.
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4407
|
+
vue.watch(
|
|
4408
|
+
() => props.model[props.name],
|
|
4409
|
+
(value) => {
|
|
4410
|
+
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4411
|
+
showDataSourceFieldSelect.value = true;
|
|
4412
|
+
} else {
|
|
4413
|
+
showDataSourceFieldSelect.value = false;
|
|
4414
|
+
}
|
|
4415
|
+
},
|
|
4416
|
+
{
|
|
4417
|
+
immediate: true
|
|
4792
4418
|
}
|
|
4793
|
-
|
|
4419
|
+
);
|
|
4794
4420
|
const mForm = vue.inject("mForm");
|
|
4795
4421
|
const type = vue.computed(() => {
|
|
4796
4422
|
let type2 = props.config.fieldConfig?.type;
|
|
@@ -4817,11 +4443,11 @@
|
|
|
4817
4443
|
const onChangeHandler = (value) => {
|
|
4818
4444
|
emit("change", value);
|
|
4819
4445
|
};
|
|
4820
|
-
const
|
|
4821
|
-
|
|
4822
|
-
|
|
4446
|
+
const editHandler = (id) => {
|
|
4447
|
+
eventBus?.emit("edit-data-source", id);
|
|
4448
|
+
};
|
|
4823
4449
|
return (_ctx, _cache) => {
|
|
4824
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4450
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$q, [
|
|
4825
4451
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
|
|
4826
4452
|
style: { "width": "100%" },
|
|
4827
4453
|
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
@@ -4835,22 +4461,22 @@
|
|
|
4835
4461
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4836
4462
|
onChange: onChangeHandler
|
|
4837
4463
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4838
|
-
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4464
|
+
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4839
4465
|
key: 0,
|
|
4840
|
-
|
|
4841
|
-
link: "",
|
|
4466
|
+
class: "m-fields-select-action-button",
|
|
4842
4467
|
size: _ctx.size,
|
|
4843
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
4468
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectedDataSourceId.value))
|
|
4844
4469
|
}, {
|
|
4845
4470
|
default: vue.withCtx(() => [
|
|
4846
|
-
vue.createVNode(_sfc_main$U, {
|
|
4471
|
+
vue.createVNode(_sfc_main$U, {
|
|
4472
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
4473
|
+
}, null, 8, ["icon"])
|
|
4847
4474
|
]),
|
|
4848
4475
|
_: 1
|
|
4849
4476
|
}, 8, ["size"])) : vue.createCommentVNode("", true),
|
|
4850
4477
|
_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4851
4478
|
key: 1,
|
|
4852
4479
|
style: { "margin-left": "5px" },
|
|
4853
|
-
link: "",
|
|
4854
4480
|
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4855
4481
|
size: _ctx.size,
|
|
4856
4482
|
onClick: _cache[1] || (_cache[1] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
@@ -4859,24 +4485,16 @@
|
|
|
4859
4485
|
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4860
4486
|
]),
|
|
4861
4487
|
_: 1
|
|
4862
|
-
}, 8, ["type", "size"])) : vue.createCommentVNode("", true)
|
|
4863
|
-
vue.createVNode(_sfc_main$K, {
|
|
4864
|
-
ref_key: "editDialog",
|
|
4865
|
-
ref: editDialog,
|
|
4866
|
-
disabled: !vue.unref(editable),
|
|
4867
|
-
values: vue.unref(dataSourceValues),
|
|
4868
|
-
title: vue.unref(dialogTitle),
|
|
4869
|
-
onSubmit: vue.unref(submitDataSourceHandler)
|
|
4870
|
-
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
4488
|
+
}, 8, ["type", "size"])) : vue.createCommentVNode("", true)
|
|
4871
4489
|
]);
|
|
4872
4490
|
};
|
|
4873
4491
|
}
|
|
4874
4492
|
});
|
|
4875
4493
|
|
|
4876
|
-
const _hoisted_1$
|
|
4877
|
-
const _hoisted_2$
|
|
4878
|
-
const _hoisted_3$
|
|
4879
|
-
const _sfc_main$
|
|
4494
|
+
const _hoisted_1$p = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4495
|
+
const _hoisted_2$i = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4496
|
+
const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
|
|
4497
|
+
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
4880
4498
|
...{
|
|
4881
4499
|
name: "MFieldsDataSourceInput"
|
|
4882
4500
|
},
|
|
@@ -4983,138 +4601,435 @@
|
|
|
4983
4601
|
}
|
|
4984
4602
|
}
|
|
4985
4603
|
}
|
|
4986
|
-
if (curCharIsDot(dotIndex)) {
|
|
4987
|
-
result = fields || [];
|
|
4988
|
-
} else if (dotIndex > -1) {
|
|
4989
|
-
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
4990
|
-
result = fields.filter(
|
|
4991
|
-
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
4992
|
-
) || [];
|
|
4993
|
-
}
|
|
4994
|
-
cb(
|
|
4995
|
-
result.map((field) => ({
|
|
4996
|
-
value: field.name,
|
|
4997
|
-
text: field.title,
|
|
4998
|
-
type: "field"
|
|
4999
|
-
}))
|
|
5000
|
-
);
|
|
4604
|
+
if (curCharIsDot(dotIndex)) {
|
|
4605
|
+
result = fields || [];
|
|
4606
|
+
} else if (dotIndex > -1) {
|
|
4607
|
+
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
4608
|
+
result = fields.filter(
|
|
4609
|
+
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
4610
|
+
) || [];
|
|
4611
|
+
}
|
|
4612
|
+
cb(
|
|
4613
|
+
result.map((field) => ({
|
|
4614
|
+
value: field.name,
|
|
4615
|
+
text: field.title,
|
|
4616
|
+
type: "field"
|
|
4617
|
+
}))
|
|
4618
|
+
);
|
|
4619
|
+
};
|
|
4620
|
+
const querySearch = (queryString, cb) => {
|
|
4621
|
+
inputText = queryString;
|
|
4622
|
+
const selectionStart = getSelectionStart();
|
|
4623
|
+
const curQueryString = queryString.substring(0, selectionStart);
|
|
4624
|
+
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
4625
|
+
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
4626
|
+
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
4627
|
+
if (isFieldTip) {
|
|
4628
|
+
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
4629
|
+
} else {
|
|
4630
|
+
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
4631
|
+
}
|
|
4632
|
+
};
|
|
4633
|
+
const selectHandler = async ({ value, type }) => {
|
|
4634
|
+
const isDataSource = type === "dataSource";
|
|
4635
|
+
const selectionStart = input.value?.selectionStart || 0;
|
|
4636
|
+
let startText = inputText.substring(0, selectionStart);
|
|
4637
|
+
const dotIndex = startText.lastIndexOf(".");
|
|
4638
|
+
const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
|
|
4639
|
+
const endText = inputText.substring(selectionStart);
|
|
4640
|
+
let suggestText = value;
|
|
4641
|
+
if (isDataSource) {
|
|
4642
|
+
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
4643
|
+
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
4644
|
+
}
|
|
4645
|
+
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
4646
|
+
suggestText = `${suggestText}}`;
|
|
4647
|
+
}
|
|
4648
|
+
} else if (!curCharIsDot(dotIndex)) {
|
|
4649
|
+
startText = startText.substring(0, dotIndex + 1);
|
|
4650
|
+
}
|
|
4651
|
+
state.value = `${startText}${suggestText}${endText}`;
|
|
4652
|
+
await vue.nextTick();
|
|
4653
|
+
let newSelectionStart = 0;
|
|
4654
|
+
if (isDataSource) {
|
|
4655
|
+
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
4656
|
+
} else {
|
|
4657
|
+
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4658
|
+
}
|
|
4659
|
+
input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
|
|
4660
|
+
changeHandler(state.value);
|
|
4661
|
+
};
|
|
4662
|
+
return (_ctx, _cache) => {
|
|
4663
|
+
return _ctx.disabled || isFocused.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(design.getConfig)("components")?.autocomplete.component || "el-autocomplete"), vue.mergeProps(
|
|
4664
|
+
{
|
|
4665
|
+
key: 0,
|
|
4666
|
+
class: "tmagic-design-auto-complete",
|
|
4667
|
+
ref_key: "autocomplete",
|
|
4668
|
+
ref: autocomplete,
|
|
4669
|
+
modelValue: state.value,
|
|
4670
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
|
|
4671
|
+
},
|
|
4672
|
+
vue.unref(design.getConfig)("components")?.autocomplete.props({
|
|
4673
|
+
disabled: _ctx.disabled,
|
|
4674
|
+
size: _ctx.size,
|
|
4675
|
+
fetchSuggestions: querySearch,
|
|
4676
|
+
triggerOnFocus: false,
|
|
4677
|
+
clearable: true
|
|
4678
|
+
}) || {},
|
|
4679
|
+
{
|
|
4680
|
+
style: { "width": "100%" },
|
|
4681
|
+
onBlur: blurHandler,
|
|
4682
|
+
onInput: inputHandler,
|
|
4683
|
+
onSelect: selectHandler
|
|
4684
|
+
}
|
|
4685
|
+
), {
|
|
4686
|
+
suffix: vue.withCtx(() => [
|
|
4687
|
+
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4688
|
+
]),
|
|
4689
|
+
default: vue.withCtx(({ item }) => [
|
|
4690
|
+
vue.createElementVNode("div", _hoisted_1$p, [
|
|
4691
|
+
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
4692
|
+
vue.createElementVNode("span", _hoisted_2$i, vue.toDisplayString(item.value), 1)
|
|
4693
|
+
])
|
|
4694
|
+
]),
|
|
4695
|
+
_: 1
|
|
4696
|
+
}, 16, ["modelValue"])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
4697
|
+
key: 1,
|
|
4698
|
+
class: vue.normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
4699
|
+
onMouseup: mouseupHandler
|
|
4700
|
+
}, [
|
|
4701
|
+
vue.createElementVNode("div", {
|
|
4702
|
+
class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
4703
|
+
}, [
|
|
4704
|
+
vue.createElementVNode("div", _hoisted_3$8, [
|
|
4705
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
|
|
4706
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4707
|
+
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
4708
|
+
key: index,
|
|
4709
|
+
style: { "margin-right": "2px" }
|
|
4710
|
+
}, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
|
|
4711
|
+
item.type === "var" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
|
|
4712
|
+
key: index,
|
|
4713
|
+
size: _ctx.size
|
|
4714
|
+
}, {
|
|
4715
|
+
default: vue.withCtx(() => [
|
|
4716
|
+
vue.createTextVNode(vue.toDisplayString(item.value), 1)
|
|
4717
|
+
]),
|
|
4718
|
+
_: 2
|
|
4719
|
+
}, 1032, ["size"])) : vue.createCommentVNode("", true)
|
|
4720
|
+
], 64);
|
|
4721
|
+
}), 256)),
|
|
4722
|
+
vue.createVNode(_sfc_main$U, {
|
|
4723
|
+
class: "tmagic-data-source-input-icon",
|
|
4724
|
+
icon: vue.unref(iconsVue.Coin)
|
|
4725
|
+
}, null, 8, ["icon"])
|
|
4726
|
+
])
|
|
4727
|
+
], 2)
|
|
4728
|
+
], 34));
|
|
4729
|
+
};
|
|
4730
|
+
}
|
|
4731
|
+
});
|
|
4732
|
+
|
|
4733
|
+
const _hoisted_1$o = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
4734
|
+
const _hoisted_2$h = { style: { "flex": "1" } };
|
|
4735
|
+
const _hoisted_3$7 = { style: { "flex": "1" } };
|
|
4736
|
+
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
4737
|
+
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
4738
|
+
...{
|
|
4739
|
+
name: "MEditorCodeBlockEditor"
|
|
4740
|
+
},
|
|
4741
|
+
__name: "CodeBlockEditor",
|
|
4742
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
4743
|
+
content: {},
|
|
4744
|
+
disabled: { type: Boolean },
|
|
4745
|
+
isDataSource: { type: Boolean },
|
|
4746
|
+
dataSourceType: {}
|
|
4747
|
+
}, {
|
|
4748
|
+
"width": { default: 670 },
|
|
4749
|
+
"widthModifiers": {},
|
|
4750
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
4751
|
+
"visibleModifiers": {}
|
|
4752
|
+
}),
|
|
4753
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
4754
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4755
|
+
const width = vue.useModel(__props, "width");
|
|
4756
|
+
const boxVisible = vue.useModel(__props, "visible");
|
|
4757
|
+
const props = __props;
|
|
4758
|
+
const emit = __emit;
|
|
4759
|
+
const services = vue.inject("services");
|
|
4760
|
+
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
4761
|
+
const difVisible = vue.ref(false);
|
|
4762
|
+
const { rect: windowRect } = useWindowRect();
|
|
4763
|
+
const magicVsEditor = vue.ref();
|
|
4764
|
+
const diffChange = () => {
|
|
4765
|
+
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
4766
|
+
return;
|
|
4767
|
+
}
|
|
4768
|
+
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
4769
|
+
difVisible.value = false;
|
|
4770
|
+
};
|
|
4771
|
+
const defaultParamColConfig = {
|
|
4772
|
+
type: "row",
|
|
4773
|
+
label: "参数类型",
|
|
4774
|
+
items: [
|
|
4775
|
+
{
|
|
4776
|
+
text: "参数类型",
|
|
4777
|
+
labelWidth: "70px",
|
|
4778
|
+
type: "select",
|
|
4779
|
+
name: "type",
|
|
4780
|
+
options: [
|
|
4781
|
+
{
|
|
4782
|
+
text: "数字",
|
|
4783
|
+
label: "数字",
|
|
4784
|
+
value: "number"
|
|
4785
|
+
},
|
|
4786
|
+
{
|
|
4787
|
+
text: "字符串",
|
|
4788
|
+
label: "字符串",
|
|
4789
|
+
value: "text"
|
|
4790
|
+
},
|
|
4791
|
+
{
|
|
4792
|
+
text: "组件",
|
|
4793
|
+
label: "组件",
|
|
4794
|
+
value: "ui-select"
|
|
4795
|
+
}
|
|
4796
|
+
]
|
|
4797
|
+
}
|
|
4798
|
+
]
|
|
4799
|
+
};
|
|
4800
|
+
const functionConfig = vue.computed(() => [
|
|
4801
|
+
{
|
|
4802
|
+
text: "名称",
|
|
4803
|
+
name: "name",
|
|
4804
|
+
rules: [{ required: true, message: "请输入名称", trigger: "blur" }]
|
|
4805
|
+
},
|
|
4806
|
+
{
|
|
4807
|
+
text: "描述",
|
|
4808
|
+
name: "desc"
|
|
4809
|
+
},
|
|
4810
|
+
{
|
|
4811
|
+
text: "执行时机",
|
|
4812
|
+
name: "timing",
|
|
4813
|
+
type: "select",
|
|
4814
|
+
options: () => {
|
|
4815
|
+
const options = [
|
|
4816
|
+
{ text: "初始化前", value: "beforeInit" },
|
|
4817
|
+
{ text: "初始化后", value: "afterInit" }
|
|
4818
|
+
];
|
|
4819
|
+
if (props.dataSourceType !== "base") {
|
|
4820
|
+
options.push({ text: "请求前", value: "beforeRequest" });
|
|
4821
|
+
options.push({ text: "请求后", value: "afterRequest" });
|
|
4822
|
+
}
|
|
4823
|
+
return options;
|
|
4824
|
+
},
|
|
4825
|
+
display: () => props.isDataSource
|
|
4826
|
+
},
|
|
4827
|
+
{
|
|
4828
|
+
type: "table",
|
|
4829
|
+
border: true,
|
|
4830
|
+
text: "参数",
|
|
4831
|
+
enableFullscreen: false,
|
|
4832
|
+
enableToggleMode: false,
|
|
4833
|
+
name: "params",
|
|
4834
|
+
dropSort: false,
|
|
4835
|
+
items: [
|
|
4836
|
+
{
|
|
4837
|
+
type: "text",
|
|
4838
|
+
label: "参数名",
|
|
4839
|
+
name: "name"
|
|
4840
|
+
},
|
|
4841
|
+
{
|
|
4842
|
+
type: "text",
|
|
4843
|
+
label: "描述",
|
|
4844
|
+
name: "extra"
|
|
4845
|
+
},
|
|
4846
|
+
services?.codeBlockService.getParamsColConfig() || defaultParamColConfig
|
|
4847
|
+
]
|
|
4848
|
+
},
|
|
4849
|
+
{
|
|
4850
|
+
name: "content",
|
|
4851
|
+
type: "vs-code",
|
|
4852
|
+
options: vue.inject("codeOptions", {}),
|
|
4853
|
+
height: "500px",
|
|
4854
|
+
onChange: (formState, code) => {
|
|
4855
|
+
try {
|
|
4856
|
+
getConfig("parseDSL")(code);
|
|
4857
|
+
return code;
|
|
4858
|
+
} catch (error) {
|
|
4859
|
+
design.tMagicMessage.error(error.message);
|
|
4860
|
+
throw error;
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
]);
|
|
4865
|
+
const submitForm = (values) => {
|
|
4866
|
+
changedValue.value = void 0;
|
|
4867
|
+
emit("submit", values);
|
|
5001
4868
|
};
|
|
5002
|
-
const
|
|
5003
|
-
|
|
5004
|
-
const selectionStart = getSelectionStart();
|
|
5005
|
-
const curQueryString = queryString.substring(0, selectionStart);
|
|
5006
|
-
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
5007
|
-
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
5008
|
-
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
5009
|
-
if (isFieldTip) {
|
|
5010
|
-
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
5011
|
-
} else {
|
|
5012
|
-
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
5013
|
-
}
|
|
4869
|
+
const errorHandler = (error) => {
|
|
4870
|
+
design.tMagicMessage.error(error.message);
|
|
5014
4871
|
};
|
|
5015
|
-
const
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
5025
|
-
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
5026
|
-
}
|
|
5027
|
-
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
5028
|
-
suggestText = `${suggestText}}`;
|
|
5029
|
-
}
|
|
5030
|
-
} else if (!curCharIsDot(dotIndex)) {
|
|
5031
|
-
startText = startText.substring(0, dotIndex + 1);
|
|
5032
|
-
}
|
|
5033
|
-
state.value = `${startText}${suggestText}${endText}`;
|
|
5034
|
-
await vue.nextTick();
|
|
5035
|
-
let newSelectionStart = 0;
|
|
5036
|
-
if (isDataSource) {
|
|
5037
|
-
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
5038
|
-
} else {
|
|
5039
|
-
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4872
|
+
const formBox = vue.ref();
|
|
4873
|
+
const changedValue = vue.ref();
|
|
4874
|
+
const changeHandler = (values) => {
|
|
4875
|
+
changedValue.value = values;
|
|
4876
|
+
};
|
|
4877
|
+
const beforeClose = (done) => {
|
|
4878
|
+
if (!changedValue.value) {
|
|
4879
|
+
done();
|
|
4880
|
+
return;
|
|
5040
4881
|
}
|
|
5041
|
-
|
|
5042
|
-
|
|
4882
|
+
design.tMagicMessageBox.confirm("当前代码块已修改,是否保存?", "提示", {
|
|
4883
|
+
confirmButtonText: "保存并关闭",
|
|
4884
|
+
cancelButtonText: "不保存并关闭",
|
|
4885
|
+
type: "warning",
|
|
4886
|
+
distinguishCancelAndClose: true
|
|
4887
|
+
}).then(() => {
|
|
4888
|
+
changedValue.value && submitForm(changedValue.value);
|
|
4889
|
+
done();
|
|
4890
|
+
}).catch((action) => {
|
|
4891
|
+
done(action === "cancel");
|
|
4892
|
+
});
|
|
5043
4893
|
};
|
|
4894
|
+
const closedHandler = () => {
|
|
4895
|
+
changedValue.value = void 0;
|
|
4896
|
+
};
|
|
4897
|
+
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4898
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4899
|
+
__expose({
|
|
4900
|
+
async show() {
|
|
4901
|
+
calcBoxPosition();
|
|
4902
|
+
boxVisible.value = true;
|
|
4903
|
+
},
|
|
4904
|
+
async hide() {
|
|
4905
|
+
boxVisible.value = false;
|
|
4906
|
+
}
|
|
4907
|
+
});
|
|
5044
4908
|
return (_ctx, _cache) => {
|
|
5045
|
-
return
|
|
5046
|
-
{
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
"onUpdate:
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
class: vue.normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
5081
|
-
onMouseup: mouseupHandler
|
|
5082
|
-
}, [
|
|
5083
|
-
vue.createElementVNode("div", {
|
|
5084
|
-
class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
5085
|
-
}, [
|
|
5086
|
-
vue.createElementVNode("div", _hoisted_3$7, [
|
|
5087
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
|
|
5088
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
5089
|
-
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
5090
|
-
key: index,
|
|
5091
|
-
style: { "margin-right": "2px" }
|
|
5092
|
-
}, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
|
|
5093
|
-
item.type === "var" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTag), {
|
|
5094
|
-
key: index,
|
|
5095
|
-
size: _ctx.size
|
|
4909
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4910
|
+
vue.createVNode(_sfc_main$N, {
|
|
4911
|
+
visible: boxVisible.value,
|
|
4912
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
4913
|
+
width: width.value,
|
|
4914
|
+
"onUpdate:width": _cache[2] || (_cache[2] = ($event) => width.value = $event),
|
|
4915
|
+
height: vue.unref(codeBlockEditorHeight),
|
|
4916
|
+
"onUpdate:height": _cache[3] || (_cache[3] = ($event) => vue.isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
4917
|
+
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
4918
|
+
position: vue.unref(boxPosition),
|
|
4919
|
+
"before-close": beforeClose
|
|
4920
|
+
}, {
|
|
4921
|
+
body: vue.withCtx(() => [
|
|
4922
|
+
vue.createVNode(vue.unref(form.MFormBox), {
|
|
4923
|
+
class: "m-editor-code-block-editor",
|
|
4924
|
+
ref_key: "formBox",
|
|
4925
|
+
ref: formBox,
|
|
4926
|
+
"label-width": "80px",
|
|
4927
|
+
"close-on-press-escape": false,
|
|
4928
|
+
title: _ctx.content.name,
|
|
4929
|
+
config: functionConfig.value,
|
|
4930
|
+
values: _ctx.content,
|
|
4931
|
+
disabled: _ctx.disabled,
|
|
4932
|
+
style: { "height": "100%" },
|
|
4933
|
+
onChange: changeHandler,
|
|
4934
|
+
onSubmit: submitForm,
|
|
4935
|
+
onError: errorHandler,
|
|
4936
|
+
onClosed: closedHandler
|
|
4937
|
+
}, {
|
|
4938
|
+
left: vue.withCtx(() => [
|
|
4939
|
+
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4940
|
+
key: 0,
|
|
4941
|
+
type: "primary",
|
|
4942
|
+
link: "",
|
|
4943
|
+
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
5096
4944
|
}, {
|
|
5097
4945
|
default: vue.withCtx(() => [
|
|
5098
|
-
vue.createTextVNode(
|
|
4946
|
+
vue.createTextVNode("查看修改")
|
|
5099
4947
|
]),
|
|
5100
|
-
_:
|
|
5101
|
-
}
|
|
5102
|
-
],
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
4948
|
+
_: 1
|
|
4949
|
+
})) : vue.createCommentVNode("", true)
|
|
4950
|
+
]),
|
|
4951
|
+
_: 1
|
|
4952
|
+
}, 8, ["title", "config", "values", "disabled"])
|
|
4953
|
+
]),
|
|
4954
|
+
_: 1
|
|
4955
|
+
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4956
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4957
|
+
vue.createVNode(vue.unref(design.TMagicDialog), {
|
|
4958
|
+
title: "查看修改",
|
|
4959
|
+
modelValue: difVisible.value,
|
|
4960
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
4961
|
+
fullscreen: ""
|
|
4962
|
+
}, {
|
|
4963
|
+
footer: vue.withCtx(() => [
|
|
4964
|
+
vue.createElementVNode("span", _hoisted_4$7, [
|
|
4965
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4966
|
+
size: "small",
|
|
4967
|
+
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
4968
|
+
}, {
|
|
4969
|
+
default: vue.withCtx(() => [
|
|
4970
|
+
vue.createTextVNode("取消")
|
|
4971
|
+
]),
|
|
4972
|
+
_: 1
|
|
4973
|
+
}),
|
|
4974
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4975
|
+
size: "small",
|
|
4976
|
+
type: "primary",
|
|
4977
|
+
onClick: diffChange
|
|
4978
|
+
}, {
|
|
4979
|
+
default: vue.withCtx(() => [
|
|
4980
|
+
vue.createTextVNode("确定")
|
|
4981
|
+
]),
|
|
4982
|
+
_: 1
|
|
4983
|
+
})
|
|
4984
|
+
])
|
|
4985
|
+
]),
|
|
4986
|
+
default: vue.withCtx(() => [
|
|
4987
|
+
vue.createElementVNode("div", _hoisted_1$o, [
|
|
4988
|
+
vue.createElementVNode("div", _hoisted_2$h, [
|
|
4989
|
+
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
4990
|
+
size: "small",
|
|
4991
|
+
type: "info"
|
|
4992
|
+
}, {
|
|
4993
|
+
default: vue.withCtx(() => [
|
|
4994
|
+
vue.createTextVNode("修改前")
|
|
4995
|
+
]),
|
|
4996
|
+
_: 1
|
|
4997
|
+
})
|
|
4998
|
+
]),
|
|
4999
|
+
vue.createElementVNode("div", _hoisted_3$7, [
|
|
5000
|
+
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
5001
|
+
size: "small",
|
|
5002
|
+
type: "success"
|
|
5003
|
+
}, {
|
|
5004
|
+
default: vue.withCtx(() => [
|
|
5005
|
+
vue.createTextVNode("修改后")
|
|
5006
|
+
]),
|
|
5007
|
+
_: 1
|
|
5008
|
+
})
|
|
5009
|
+
])
|
|
5010
|
+
]),
|
|
5011
|
+
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
5012
|
+
key: 0,
|
|
5013
|
+
ref_key: "magicVsEditor",
|
|
5014
|
+
ref: magicVsEditor,
|
|
5015
|
+
type: "diff",
|
|
5016
|
+
language: "json",
|
|
5017
|
+
initValues: _ctx.content.content,
|
|
5018
|
+
modifiedValues: formBox.value?.form?.values.content,
|
|
5019
|
+
style: vue.normalizeStyle(`height: ${vue.unref(windowRect).height - 150}px`)
|
|
5020
|
+
}, null, 8, ["initValues", "modifiedValues", "style"])) : vue.createCommentVNode("", true)
|
|
5021
|
+
]),
|
|
5022
|
+
_: 1
|
|
5023
|
+
}, 8, ["modelValue"])
|
|
5024
|
+
]))
|
|
5025
|
+
], 64);
|
|
5111
5026
|
};
|
|
5112
5027
|
}
|
|
5113
5028
|
});
|
|
5114
5029
|
|
|
5115
|
-
const _hoisted_1$
|
|
5030
|
+
const _hoisted_1$n = { class: "m-editor-data-source-methods" };
|
|
5116
5031
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
5117
|
-
const _sfc_main$
|
|
5032
|
+
const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
|
|
5118
5033
|
...{
|
|
5119
5034
|
name: "MFieldsDataSourceMethods"
|
|
5120
5035
|
},
|
|
@@ -5184,7 +5099,7 @@
|
|
|
5184
5099
|
emit("change", props.model[props.name]);
|
|
5185
5100
|
};
|
|
5186
5101
|
return (_ctx, _cache) => {
|
|
5187
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5102
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
|
|
5188
5103
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
5189
5104
|
data: _ctx.model[_ctx.name],
|
|
5190
5105
|
columns: methodColumns
|
|
@@ -5203,7 +5118,7 @@
|
|
|
5203
5118
|
_: 1
|
|
5204
5119
|
}, 8, ["disabled"])
|
|
5205
5120
|
]),
|
|
5206
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5121
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$J, {
|
|
5207
5122
|
key: 0,
|
|
5208
5123
|
ref_key: "codeBlockEditor",
|
|
5209
5124
|
ref: codeBlockEditor,
|
|
@@ -5218,9 +5133,9 @@
|
|
|
5218
5133
|
}
|
|
5219
5134
|
});
|
|
5220
5135
|
|
|
5221
|
-
const _hoisted_1$
|
|
5136
|
+
const _hoisted_1$m = { class: "m-fields-data-source-method-select" };
|
|
5222
5137
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
5223
|
-
const _sfc_main$
|
|
5138
|
+
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
5224
5139
|
...{
|
|
5225
5140
|
name: "MFieldsDataSourceMethodSelect"
|
|
5226
5141
|
},
|
|
@@ -5240,9 +5155,13 @@
|
|
|
5240
5155
|
setup(__props, { emit: __emit }) {
|
|
5241
5156
|
const mForm = vue.inject("mForm");
|
|
5242
5157
|
const services = vue.inject("services");
|
|
5158
|
+
const eventBus = vue.inject("eventBus");
|
|
5243
5159
|
const emit = __emit;
|
|
5244
5160
|
const dataSourceService = services?.dataSourceService;
|
|
5245
5161
|
const props = __props;
|
|
5162
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
5163
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5164
|
+
);
|
|
5246
5165
|
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
5247
5166
|
const dataSources = vue.computed(() => dataSourceService?.get("dataSources"));
|
|
5248
5167
|
const isCustomMethod = vue.computed(() => {
|
|
@@ -5297,36 +5216,38 @@
|
|
|
5297
5216
|
props.model.params = value.params;
|
|
5298
5217
|
emit("change", props.model);
|
|
5299
5218
|
};
|
|
5300
|
-
const { codeBlockEditor, codeConfig, editCode, submitCode } = useDataSourceMethod();
|
|
5301
5219
|
const editCodeHandler = () => {
|
|
5302
|
-
const [id
|
|
5220
|
+
const [id] = props.model[props.name];
|
|
5303
5221
|
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5304
5222
|
if (!dataSource)
|
|
5305
5223
|
return;
|
|
5306
|
-
|
|
5307
|
-
setParamsConfig([id, name]);
|
|
5308
|
-
};
|
|
5309
|
-
const submitCodeBlockHandler = (value) => {
|
|
5310
|
-
submitCode(value);
|
|
5224
|
+
eventBus?.emit("edit-data-source", id);
|
|
5311
5225
|
};
|
|
5312
5226
|
return (_ctx, _cache) => {
|
|
5313
|
-
|
|
5314
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
5227
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
5315
5228
|
vue.createElementVNode("div", _hoisted_2$f, [
|
|
5316
|
-
vue.createVNode(
|
|
5229
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
5317
5230
|
class: "select",
|
|
5318
5231
|
config: cascaderConfig.value,
|
|
5319
5232
|
model: _ctx.model,
|
|
5233
|
+
size: _ctx.size,
|
|
5320
5234
|
onChange: onChangeHandler
|
|
5321
|
-
}, null, 8, ["config", "model"]),
|
|
5322
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(
|
|
5235
|
+
}, null, 8, ["config", "model", "size"]),
|
|
5236
|
+
_ctx.model[_ctx.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5323
5237
|
key: 0,
|
|
5324
|
-
class: "
|
|
5325
|
-
|
|
5238
|
+
class: "m-fields-select-action-button",
|
|
5239
|
+
size: _ctx.size,
|
|
5326
5240
|
onClick: editCodeHandler
|
|
5327
|
-
},
|
|
5241
|
+
}, {
|
|
5242
|
+
default: vue.withCtx(() => [
|
|
5243
|
+
vue.createVNode(_sfc_main$U, {
|
|
5244
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5245
|
+
}, null, 8, ["icon"])
|
|
5246
|
+
]),
|
|
5247
|
+
_: 1
|
|
5248
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
5328
5249
|
]),
|
|
5329
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5250
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
5330
5251
|
key: 0,
|
|
5331
5252
|
name: "params",
|
|
5332
5253
|
model: _ctx.model,
|
|
@@ -5334,23 +5255,15 @@
|
|
|
5334
5255
|
disabled: _ctx.disabled,
|
|
5335
5256
|
"params-config": paramsConfig.value,
|
|
5336
5257
|
onChange: onChangeHandler
|
|
5337
|
-
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true)
|
|
5338
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
5339
|
-
key: 1,
|
|
5340
|
-
ref_key: "codeBlockEditor",
|
|
5341
|
-
ref: codeBlockEditor,
|
|
5342
|
-
disabled: notEditable.value,
|
|
5343
|
-
content: vue.unref(codeConfig),
|
|
5344
|
-
onSubmit: submitCodeBlockHandler
|
|
5345
|
-
}, null, 8, ["disabled", "content"])) : vue.createCommentVNode("", true)
|
|
5258
|
+
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true)
|
|
5346
5259
|
]);
|
|
5347
5260
|
};
|
|
5348
5261
|
}
|
|
5349
5262
|
});
|
|
5350
5263
|
|
|
5351
|
-
const _hoisted_1$
|
|
5264
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
5352
5265
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
5353
|
-
const _sfc_main$
|
|
5266
|
+
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
5354
5267
|
...{
|
|
5355
5268
|
name: "MFieldsDataSourceMocks"
|
|
5356
5269
|
},
|
|
@@ -5556,7 +5469,7 @@
|
|
|
5556
5469
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
5557
5470
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5558
5471
|
return (_ctx, _cache) => {
|
|
5559
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5472
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
5560
5473
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
5561
5474
|
data: _ctx.model[_ctx.name],
|
|
5562
5475
|
columns
|
|
@@ -5575,7 +5488,7 @@
|
|
|
5575
5488
|
_: 1
|
|
5576
5489
|
}, 8, ["disabled"])
|
|
5577
5490
|
]),
|
|
5578
|
-
vue.createVNode(_sfc_main$
|
|
5491
|
+
vue.createVNode(_sfc_main$N, {
|
|
5579
5492
|
visible: addDialogVisible.value,
|
|
5580
5493
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
5581
5494
|
width: width.value,
|
|
@@ -5603,7 +5516,8 @@
|
|
|
5603
5516
|
}
|
|
5604
5517
|
});
|
|
5605
5518
|
|
|
5606
|
-
const
|
|
5519
|
+
const _hoisted_1$k = { class: "m-fields-data-source-select" };
|
|
5520
|
+
const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
5607
5521
|
...{
|
|
5608
5522
|
name: "MFieldsDataSourceSelect"
|
|
5609
5523
|
},
|
|
@@ -5623,8 +5537,14 @@
|
|
|
5623
5537
|
setup(__props, { emit: __emit }) {
|
|
5624
5538
|
const emit = __emit;
|
|
5625
5539
|
const props = __props;
|
|
5626
|
-
const
|
|
5540
|
+
const mForm = vue.inject("mForm");
|
|
5541
|
+
const { dataSourceService, uiService } = vue.inject("services") || {};
|
|
5542
|
+
const eventBus = vue.inject("eventBus");
|
|
5627
5543
|
const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
|
|
5544
|
+
const notEditable = vue.computed(() => form.filterFunction(mForm, props.config.notEditable, props));
|
|
5545
|
+
const hasDataSourceSidePanel = vue.computed(
|
|
5546
|
+
() => (uiService?.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5547
|
+
);
|
|
5628
5548
|
const selectConfig = vue.computed(() => {
|
|
5629
5549
|
const { type, dataSourceType, value, ...config } = props.config;
|
|
5630
5550
|
const valueIsId = props.config.value === "id";
|
|
@@ -5645,17 +5565,42 @@
|
|
|
5645
5565
|
const changeHandler = (value) => {
|
|
5646
5566
|
emit("change", value);
|
|
5647
5567
|
};
|
|
5568
|
+
const editHandler = () => {
|
|
5569
|
+
const value = props.model[props.name];
|
|
5570
|
+
if (!value)
|
|
5571
|
+
return;
|
|
5572
|
+
const id = typeof value === "string" ? value : value.dataSourceId;
|
|
5573
|
+
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5574
|
+
if (!dataSource)
|
|
5575
|
+
return;
|
|
5576
|
+
eventBus?.emit("edit-data-source", id);
|
|
5577
|
+
};
|
|
5648
5578
|
return (_ctx, _cache) => {
|
|
5649
|
-
return vue.openBlock(), vue.
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5579
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
5580
|
+
vue.createVNode(vue.unref(form.MSelect), {
|
|
5581
|
+
model: _ctx.model,
|
|
5582
|
+
name: _ctx.name,
|
|
5583
|
+
size: _ctx.size,
|
|
5584
|
+
prop: _ctx.prop,
|
|
5585
|
+
disabled: _ctx.disabled,
|
|
5586
|
+
config: selectConfig.value,
|
|
5587
|
+
"last-values": _ctx.lastValues,
|
|
5588
|
+
onChange: changeHandler
|
|
5589
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]),
|
|
5590
|
+
_ctx.model[_ctx.name] && hasDataSourceSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5591
|
+
key: 0,
|
|
5592
|
+
class: "m-fields-select-action-button",
|
|
5593
|
+
size: _ctx.size,
|
|
5594
|
+
onClick: editHandler
|
|
5595
|
+
}, {
|
|
5596
|
+
default: vue.withCtx(() => [
|
|
5597
|
+
vue.createVNode(_sfc_main$U, {
|
|
5598
|
+
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5599
|
+
}, null, 8, ["icon"])
|
|
5600
|
+
]),
|
|
5601
|
+
_: 1
|
|
5602
|
+
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
5603
|
+
]);
|
|
5659
5604
|
};
|
|
5660
5605
|
}
|
|
5661
5606
|
});
|
|
@@ -5665,7 +5610,7 @@
|
|
|
5665
5610
|
key: 1,
|
|
5666
5611
|
class: "fullWidth"
|
|
5667
5612
|
};
|
|
5668
|
-
const _sfc_main$
|
|
5613
|
+
const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
|
|
5669
5614
|
...{
|
|
5670
5615
|
name: "MFieldsEventSelect"
|
|
5671
5616
|
},
|
|
@@ -5823,6 +5768,7 @@
|
|
|
5823
5768
|
]
|
|
5824
5769
|
}));
|
|
5825
5770
|
const actionsConfig = vue.computed(() => ({
|
|
5771
|
+
type: "panel",
|
|
5826
5772
|
items: [
|
|
5827
5773
|
{
|
|
5828
5774
|
type: "group-list",
|
|
@@ -5867,8 +5813,6 @@
|
|
|
5867
5813
|
};
|
|
5868
5814
|
return (_ctx, _cache) => {
|
|
5869
5815
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
5870
|
-
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
5871
|
-
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
5872
5816
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
5873
5817
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
5874
5818
|
key: 0,
|
|
@@ -5893,7 +5837,7 @@
|
|
|
5893
5837
|
_: 1
|
|
5894
5838
|
}, 8, ["size", "disabled"]),
|
|
5895
5839
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.model[_ctx.name], (cardItem, index) => {
|
|
5896
|
-
return vue.openBlock(), vue.createBlock(
|
|
5840
|
+
return vue.openBlock(), vue.createBlock(vue.unref(form.MPanel), {
|
|
5897
5841
|
key: index,
|
|
5898
5842
|
disabled: _ctx.disabled,
|
|
5899
5843
|
size: _ctx.size,
|
|
@@ -5903,7 +5847,7 @@
|
|
|
5903
5847
|
onChange: onChangeHandler
|
|
5904
5848
|
}, {
|
|
5905
5849
|
header: vue.withCtx(() => [
|
|
5906
|
-
vue.createVNode(
|
|
5850
|
+
vue.createVNode(vue.unref(form.MContainer), {
|
|
5907
5851
|
class: "fullWidth",
|
|
5908
5852
|
config: eventNameConfig.value,
|
|
5909
5853
|
model: cardItem,
|
|
@@ -5939,7 +5883,7 @@
|
|
|
5939
5883
|
const _hoisted_4$6 = [
|
|
5940
5884
|
_hoisted_2$c
|
|
5941
5885
|
];
|
|
5942
|
-
const _sfc_main$
|
|
5886
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
5943
5887
|
...{
|
|
5944
5888
|
name: "MEditorCodeIcon"
|
|
5945
5889
|
},
|
|
@@ -5954,7 +5898,7 @@
|
|
|
5954
5898
|
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5955
5899
|
const _hoisted_2$b = { key: 0 };
|
|
5956
5900
|
const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5957
|
-
const _sfc_main$
|
|
5901
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
5958
5902
|
...{
|
|
5959
5903
|
name: "MFieldsKeyValue"
|
|
5960
5904
|
},
|
|
@@ -6078,7 +6022,7 @@
|
|
|
6078
6022
|
size: "default",
|
|
6079
6023
|
disabled: _ctx.disabled,
|
|
6080
6024
|
link: "",
|
|
6081
|
-
icon: _sfc_main$
|
|
6025
|
+
icon: _sfc_main$D,
|
|
6082
6026
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
6083
6027
|
}, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
6084
6028
|
]);
|
|
@@ -6088,7 +6032,7 @@
|
|
|
6088
6032
|
|
|
6089
6033
|
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
6090
6034
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
6091
|
-
const _sfc_main$
|
|
6035
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
6092
6036
|
...{
|
|
6093
6037
|
name: "MFieldsPageFragmentSelect"
|
|
6094
6038
|
},
|
|
@@ -6160,7 +6104,7 @@
|
|
|
6160
6104
|
class: "m-fields-ui-select",
|
|
6161
6105
|
style: { "display": "flex" }
|
|
6162
6106
|
};
|
|
6163
|
-
const _sfc_main$
|
|
6107
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
6164
6108
|
...{
|
|
6165
6109
|
name: "MFieldsUISelect"
|
|
6166
6110
|
},
|
|
@@ -6348,7 +6292,7 @@
|
|
|
6348
6292
|
};
|
|
6349
6293
|
};
|
|
6350
6294
|
|
|
6351
|
-
const _sfc_main$
|
|
6295
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
6352
6296
|
...{
|
|
6353
6297
|
name: "MEditorResizer"
|
|
6354
6298
|
},
|
|
@@ -6370,7 +6314,7 @@
|
|
|
6370
6314
|
}
|
|
6371
6315
|
});
|
|
6372
6316
|
|
|
6373
|
-
const _sfc_main$
|
|
6317
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
6374
6318
|
...{
|
|
6375
6319
|
name: "MEditorSplitView"
|
|
6376
6320
|
},
|
|
@@ -6511,7 +6455,7 @@
|
|
|
6511
6455
|
}, [
|
|
6512
6456
|
vue.renderSlot(_ctx.$slots, "left")
|
|
6513
6457
|
], 6),
|
|
6514
|
-
vue.createVNode(_sfc_main$
|
|
6458
|
+
vue.createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
6515
6459
|
], 64)) : vue.createCommentVNode("", true),
|
|
6516
6460
|
vue.createElementVNode("div", {
|
|
6517
6461
|
class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6520,7 +6464,7 @@
|
|
|
6520
6464
|
vue.renderSlot(_ctx.$slots, "center")
|
|
6521
6465
|
], 6),
|
|
6522
6466
|
hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
6523
|
-
vue.createVNode(_sfc_main$
|
|
6467
|
+
vue.createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
6524
6468
|
vue.createElementVNode("div", {
|
|
6525
6469
|
class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6526
6470
|
style: vue.normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -6538,7 +6482,7 @@
|
|
|
6538
6482
|
class: "menu-item-text"
|
|
6539
6483
|
};
|
|
6540
6484
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6541
|
-
const _sfc_main$
|
|
6485
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
6542
6486
|
...{
|
|
6543
6487
|
name: "MEditorToolButton"
|
|
6544
6488
|
},
|
|
@@ -6703,7 +6647,7 @@
|
|
|
6703
6647
|
key: 1,
|
|
6704
6648
|
style: { "width": "21px" }
|
|
6705
6649
|
};
|
|
6706
|
-
const _sfc_main$
|
|
6650
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
6707
6651
|
...{
|
|
6708
6652
|
name: "MEditorPageBarAddButton"
|
|
6709
6653
|
},
|
|
@@ -6743,7 +6687,7 @@
|
|
|
6743
6687
|
}
|
|
6744
6688
|
});
|
|
6745
6689
|
|
|
6746
|
-
const _sfc_main$
|
|
6690
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
6747
6691
|
...{
|
|
6748
6692
|
name: "MEditorPageBarScrollContainer"
|
|
6749
6693
|
},
|
|
@@ -6872,7 +6816,7 @@
|
|
|
6872
6816
|
}
|
|
6873
6817
|
});
|
|
6874
6818
|
|
|
6875
|
-
const _sfc_main$
|
|
6819
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
6876
6820
|
...{
|
|
6877
6821
|
name: "MEditorPageBarSwitchTypeButton"
|
|
6878
6822
|
},
|
|
@@ -6920,7 +6864,7 @@
|
|
|
6920
6864
|
const _hoisted_2$8 = ["onClick"];
|
|
6921
6865
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
6922
6866
|
const _hoisted_4$5 = ["title"];
|
|
6923
|
-
const _sfc_main$
|
|
6867
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
6924
6868
|
...{
|
|
6925
6869
|
name: "MEditorPageBar"
|
|
6926
6870
|
},
|
|
@@ -6999,14 +6943,14 @@
|
|
|
6999
6943
|
};
|
|
7000
6944
|
return (_ctx, _cache) => {
|
|
7001
6945
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
7002
|
-
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6946
|
+
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
7003
6947
|
key: 0,
|
|
7004
6948
|
modelValue: active.value,
|
|
7005
6949
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
7006
6950
|
}, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
|
|
7007
|
-
vue.createVNode(_sfc_main$
|
|
6951
|
+
vue.createVNode(_sfc_main$v, { type: active.value }, {
|
|
7008
6952
|
prepend: vue.withCtx(() => [
|
|
7009
|
-
vue.createVNode(_sfc_main$
|
|
6953
|
+
vue.createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
7010
6954
|
]),
|
|
7011
6955
|
default: vue.withCtx(() => [
|
|
7012
6956
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
|
|
@@ -7039,7 +6983,7 @@
|
|
|
7039
6983
|
default: vue.withCtx(() => [
|
|
7040
6984
|
vue.createElementVNode("div", null, [
|
|
7041
6985
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
7042
|
-
vue.createVNode(_sfc_main$
|
|
6986
|
+
vue.createVNode(_sfc_main$x, {
|
|
7043
6987
|
data: {
|
|
7044
6988
|
type: "button",
|
|
7045
6989
|
text: "复制",
|
|
@@ -7047,7 +6991,7 @@
|
|
|
7047
6991
|
handler: () => copy(item)
|
|
7048
6992
|
}
|
|
7049
6993
|
}, null, 8, ["data"]),
|
|
7050
|
-
vue.createVNode(_sfc_main$
|
|
6994
|
+
vue.createVNode(_sfc_main$x, {
|
|
7051
6995
|
data: {
|
|
7052
6996
|
type: "button",
|
|
7053
6997
|
text: "删除",
|
|
@@ -7074,7 +7018,7 @@
|
|
|
7074
7018
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
7075
7019
|
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
7076
7020
|
const _hoisted_4$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面片", -1);
|
|
7077
|
-
const _sfc_main$
|
|
7021
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
7078
7022
|
...{
|
|
7079
7023
|
name: "MEditorAddPageBox"
|
|
7080
7024
|
},
|
|
@@ -7129,7 +7073,7 @@
|
|
|
7129
7073
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
7130
7074
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
7131
7075
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
7132
|
-
const _sfc_main$
|
|
7076
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
7133
7077
|
...{
|
|
7134
7078
|
name: "MEditorFramework"
|
|
7135
7079
|
},
|
|
@@ -7213,7 +7157,7 @@
|
|
|
7213
7157
|
options: vue.unref(codeOptions),
|
|
7214
7158
|
onSave: saveCode
|
|
7215
7159
|
}, null, 8, ["init-values", "options"])
|
|
7216
|
-
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7160
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$y, {
|
|
7217
7161
|
key: 1,
|
|
7218
7162
|
"element-loading-text": "Runtime 加载中...",
|
|
7219
7163
|
ref_key: "splitView",
|
|
@@ -7237,10 +7181,10 @@
|
|
|
7237
7181
|
]),
|
|
7238
7182
|
center: vue.withCtx(() => [
|
|
7239
7183
|
page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7240
|
-
vue.createVNode(_sfc_main$
|
|
7184
|
+
vue.createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7241
7185
|
]),
|
|
7242
7186
|
vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7243
|
-
vue.createVNode(_sfc_main$
|
|
7187
|
+
vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
7244
7188
|
"page-bar-title": vue.withCtx(({ page: page2 }) => [
|
|
7245
7189
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7246
7190
|
]),
|
|
@@ -7275,7 +7219,7 @@
|
|
|
7275
7219
|
}
|
|
7276
7220
|
});
|
|
7277
7221
|
|
|
7278
|
-
const _sfc_main$
|
|
7222
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
7279
7223
|
...{
|
|
7280
7224
|
name: "MEditorNavMenu"
|
|
7281
7225
|
},
|
|
@@ -7457,7 +7401,7 @@
|
|
|
7457
7401
|
style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
7458
7402
|
}, [
|
|
7459
7403
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
|
|
7460
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7404
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
7461
7405
|
data: item,
|
|
7462
7406
|
key: index
|
|
7463
7407
|
}, null, 8, ["data"]);
|
|
@@ -7470,12 +7414,13 @@
|
|
|
7470
7414
|
});
|
|
7471
7415
|
|
|
7472
7416
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
7473
|
-
const _sfc_main$
|
|
7417
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
7474
7418
|
...{
|
|
7475
7419
|
name: "MEditorPropsPanel"
|
|
7476
7420
|
},
|
|
7477
7421
|
__name: "PropsPanel",
|
|
7478
7422
|
props: {
|
|
7423
|
+
disabledShowSrc: { type: Boolean },
|
|
7479
7424
|
extendState: { type: Function }
|
|
7480
7425
|
},
|
|
7481
7426
|
emits: ["mounted", "submit-error", "form-error"],
|
|
@@ -7536,7 +7481,7 @@
|
|
|
7536
7481
|
vue.createVNode(vue.unref(form.MForm), {
|
|
7537
7482
|
ref_key: "configForm",
|
|
7538
7483
|
ref: configForm,
|
|
7539
|
-
class: vue.normalizeClass(
|
|
7484
|
+
class: vue.normalizeClass(propsPanelSize.value),
|
|
7540
7485
|
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
7541
7486
|
size: propsPanelSize.value,
|
|
7542
7487
|
"init-values": values.value,
|
|
@@ -7545,7 +7490,8 @@
|
|
|
7545
7490
|
onChange: submit,
|
|
7546
7491
|
onError: errorHandler
|
|
7547
7492
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"]),
|
|
7548
|
-
vue.
|
|
7493
|
+
!_ctx.disabledShowSrc ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
7494
|
+
key: 0,
|
|
7549
7495
|
class: "m-editor-props-panel-src-icon",
|
|
7550
7496
|
circle: "",
|
|
7551
7497
|
size: "large",
|
|
@@ -7557,9 +7503,9 @@
|
|
|
7557
7503
|
vue.createVNode(_sfc_main$U, { icon: vue.unref(iconsVue.Document) }, null, 8, ["icon"])
|
|
7558
7504
|
]),
|
|
7559
7505
|
_: 1
|
|
7560
|
-
}, 8, ["type"]),
|
|
7506
|
+
}, 8, ["type"])) : vue.createCommentVNode("", true),
|
|
7561
7507
|
showSrc.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
|
|
7562
|
-
key:
|
|
7508
|
+
key: 1,
|
|
7563
7509
|
height: `${vue.unref(editorContentHeight)}px`,
|
|
7564
7510
|
"init-values": values.value,
|
|
7565
7511
|
options: vue.unref(codeOptions),
|
|
@@ -7573,7 +7519,7 @@
|
|
|
7573
7519
|
}
|
|
7574
7520
|
});
|
|
7575
7521
|
|
|
7576
|
-
const _sfc_main$
|
|
7522
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
7577
7523
|
...{
|
|
7578
7524
|
name: "MEditorSearchInput"
|
|
7579
7525
|
},
|
|
@@ -7631,7 +7577,7 @@
|
|
|
7631
7577
|
key: 0,
|
|
7632
7578
|
class: "m-editor-tree-node-children"
|
|
7633
7579
|
};
|
|
7634
|
-
const _sfc_main$
|
|
7580
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
7635
7581
|
...{
|
|
7636
7582
|
name: "MEditorTreeNode"
|
|
7637
7583
|
},
|
|
@@ -7752,7 +7698,7 @@
|
|
|
7752
7698
|
key: 1,
|
|
7753
7699
|
class: "m-editor-tree-empty"
|
|
7754
7700
|
};
|
|
7755
|
-
const _sfc_main$
|
|
7701
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
7756
7702
|
...{
|
|
7757
7703
|
name: "MEditorTree"
|
|
7758
7704
|
},
|
|
@@ -7776,7 +7722,7 @@
|
|
|
7776
7722
|
onDragover: handleDragOver
|
|
7777
7723
|
}, [
|
|
7778
7724
|
_ctx.data?.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.data, (item) => {
|
|
7779
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7725
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
7780
7726
|
key: item.id,
|
|
7781
7727
|
data: item,
|
|
7782
7728
|
indent: _ctx.indent,
|
|
@@ -7873,7 +7819,7 @@
|
|
|
7873
7819
|
};
|
|
7874
7820
|
};
|
|
7875
7821
|
|
|
7876
|
-
const _sfc_main$
|
|
7822
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
7877
7823
|
...{
|
|
7878
7824
|
name: "MEditorCodeBlockList"
|
|
7879
7825
|
},
|
|
@@ -7955,7 +7901,7 @@
|
|
|
7955
7901
|
filter: filterTextChangeHandler
|
|
7956
7902
|
});
|
|
7957
7903
|
return (_ctx, _cache) => {
|
|
7958
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7904
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
7959
7905
|
data: codeList.value,
|
|
7960
7906
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
7961
7907
|
onNodeClick: clickHandler
|
|
@@ -8012,7 +7958,7 @@
|
|
|
8012
7958
|
});
|
|
8013
7959
|
|
|
8014
7960
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
8015
|
-
const _sfc_main$
|
|
7961
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
8016
7962
|
...{
|
|
8017
7963
|
name: "MEditorCodeBlockListPanel"
|
|
8018
7964
|
},
|
|
@@ -8021,6 +7967,7 @@
|
|
|
8021
7967
|
customError: { type: Function }
|
|
8022
7968
|
},
|
|
8023
7969
|
setup(__props) {
|
|
7970
|
+
const eventBus = vue.inject("eventBus");
|
|
8024
7971
|
const { codeBlockService } = vue.inject("services") || {};
|
|
8025
7972
|
const editable = vue.computed(() => codeBlockService?.getEditStatus());
|
|
8026
7973
|
const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
@@ -8028,13 +7975,16 @@
|
|
|
8028
7975
|
const filterTextChangeHandler = (val) => {
|
|
8029
7976
|
codeBlockList.value?.filter(val);
|
|
8030
7977
|
};
|
|
7978
|
+
eventBus?.on("edit-code", (id) => {
|
|
7979
|
+
editCode(id);
|
|
7980
|
+
});
|
|
8031
7981
|
return (_ctx, _cache) => {
|
|
8032
7982
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8033
7983
|
vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
8034
7984
|
default: vue.withCtx(() => [
|
|
8035
7985
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
8036
7986
|
vue.createElementVNode("div", _hoisted_1$7, [
|
|
8037
|
-
vue.createVNode(_sfc_main$
|
|
7987
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8038
7988
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
8039
7989
|
key: 0,
|
|
8040
7990
|
class: "create-code-button",
|
|
@@ -8050,7 +8000,7 @@
|
|
|
8050
8000
|
vue.renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
8051
8001
|
])
|
|
8052
8002
|
]),
|
|
8053
|
-
vue.createVNode(_sfc_main$
|
|
8003
|
+
vue.createVNode(_sfc_main$l, {
|
|
8054
8004
|
ref_key: "codeBlockList",
|
|
8055
8005
|
ref: codeBlockList,
|
|
8056
8006
|
"custom-error": _ctx.customError,
|
|
@@ -8068,7 +8018,7 @@
|
|
|
8068
8018
|
]),
|
|
8069
8019
|
_: 3
|
|
8070
8020
|
}),
|
|
8071
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8021
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$J, {
|
|
8072
8022
|
key: 0,
|
|
8073
8023
|
ref_key: "codeBlockEditor",
|
|
8074
8024
|
ref: codeBlockEditor,
|
|
@@ -8081,6 +8031,113 @@
|
|
|
8081
8031
|
}
|
|
8082
8032
|
});
|
|
8083
8033
|
|
|
8034
|
+
const useDataSourceEdit = (dataSourceService) => {
|
|
8035
|
+
const dialogTitle = vue.ref("");
|
|
8036
|
+
const editDialog = vue.ref();
|
|
8037
|
+
const dataSourceValues = vue.ref({});
|
|
8038
|
+
const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
|
|
8039
|
+
const editHandler = (id) => {
|
|
8040
|
+
if (!editDialog.value)
|
|
8041
|
+
return;
|
|
8042
|
+
dataSourceValues.value = {
|
|
8043
|
+
...dataSourceService?.getDataSourceById(id)
|
|
8044
|
+
};
|
|
8045
|
+
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8046
|
+
editDialog.value.show();
|
|
8047
|
+
};
|
|
8048
|
+
const submitDataSourceHandler = (value) => {
|
|
8049
|
+
if (value.id) {
|
|
8050
|
+
dataSourceService?.update(value);
|
|
8051
|
+
} else {
|
|
8052
|
+
dataSourceService?.add(value);
|
|
8053
|
+
}
|
|
8054
|
+
editDialog.value?.hide();
|
|
8055
|
+
};
|
|
8056
|
+
return {
|
|
8057
|
+
dialogTitle,
|
|
8058
|
+
editDialog,
|
|
8059
|
+
dataSourceValues,
|
|
8060
|
+
editable,
|
|
8061
|
+
editHandler,
|
|
8062
|
+
submitDataSourceHandler
|
|
8063
|
+
};
|
|
8064
|
+
};
|
|
8065
|
+
|
|
8066
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
8067
|
+
...{
|
|
8068
|
+
name: "MEditorDataSourceConfigPanel"
|
|
8069
|
+
},
|
|
8070
|
+
__name: "DataSourceConfigPanel",
|
|
8071
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
8072
|
+
title: {},
|
|
8073
|
+
values: {},
|
|
8074
|
+
disabled: { type: Boolean }
|
|
8075
|
+
}, {
|
|
8076
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
8077
|
+
"visibleModifiers": {},
|
|
8078
|
+
"width": { default: 670 },
|
|
8079
|
+
"widthModifiers": {}
|
|
8080
|
+
}),
|
|
8081
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
8082
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8083
|
+
const props = __props;
|
|
8084
|
+
const boxVisible = vue.useModel(__props, "visible");
|
|
8085
|
+
const width = vue.useModel(__props, "width");
|
|
8086
|
+
const emit = __emit;
|
|
8087
|
+
const services = vue.inject("services");
|
|
8088
|
+
const initValues = vue.ref({});
|
|
8089
|
+
const dataSourceConfig = vue.ref([]);
|
|
8090
|
+
const { height: editorHeight } = useEditorContentHeight();
|
|
8091
|
+
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
8092
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
8093
|
+
vue.watchEffect(() => {
|
|
8094
|
+
initValues.value = props.values;
|
|
8095
|
+
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
8096
|
+
});
|
|
8097
|
+
const submitHandler = (values) => {
|
|
8098
|
+
emit("submit", values);
|
|
8099
|
+
};
|
|
8100
|
+
const errorHandler = (error) => {
|
|
8101
|
+
design.tMagicMessage.error(error.message);
|
|
8102
|
+
};
|
|
8103
|
+
__expose({
|
|
8104
|
+
show() {
|
|
8105
|
+
calcBoxPosition();
|
|
8106
|
+
boxVisible.value = true;
|
|
8107
|
+
},
|
|
8108
|
+
hide() {
|
|
8109
|
+
boxVisible.value = false;
|
|
8110
|
+
}
|
|
8111
|
+
});
|
|
8112
|
+
return (_ctx, _cache) => {
|
|
8113
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
8114
|
+
visible: boxVisible.value,
|
|
8115
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
8116
|
+
width: width.value,
|
|
8117
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
8118
|
+
height: vue.unref(editorHeight),
|
|
8119
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => vue.isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
8120
|
+
title: _ctx.title,
|
|
8121
|
+
position: vue.unref(boxPosition)
|
|
8122
|
+
}, {
|
|
8123
|
+
body: vue.withCtx(() => [
|
|
8124
|
+
vue.createVNode(vue.unref(form.MFormBox), {
|
|
8125
|
+
"label-width": "80px",
|
|
8126
|
+
title: _ctx.title,
|
|
8127
|
+
config: dataSourceConfig.value,
|
|
8128
|
+
values: initValues.value,
|
|
8129
|
+
disabled: _ctx.disabled,
|
|
8130
|
+
style: { "height": "100%" },
|
|
8131
|
+
onSubmit: submitHandler,
|
|
8132
|
+
onError: errorHandler
|
|
8133
|
+
}, null, 8, ["title", "config", "values", "disabled"])
|
|
8134
|
+
]),
|
|
8135
|
+
_: 1
|
|
8136
|
+
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
8137
|
+
};
|
|
8138
|
+
}
|
|
8139
|
+
});
|
|
8140
|
+
|
|
8084
8141
|
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
8085
8142
|
...{
|
|
8086
8143
|
name: "MEditorDataSourceList"
|
|
@@ -8170,7 +8227,7 @@
|
|
|
8170
8227
|
filter: filterTextChangeHandler
|
|
8171
8228
|
});
|
|
8172
8229
|
return (_ctx, _cache) => {
|
|
8173
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8230
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
8174
8231
|
data: list.value,
|
|
8175
8232
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
8176
8233
|
onNodeClick: clickHandler
|
|
@@ -8231,6 +8288,7 @@
|
|
|
8231
8288
|
},
|
|
8232
8289
|
__name: "DataSourceListPanel",
|
|
8233
8290
|
setup(__props) {
|
|
8291
|
+
const eventBus = vue.inject("eventBus");
|
|
8234
8292
|
const { dataSourceService } = vue.inject("services") || {};
|
|
8235
8293
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
8236
8294
|
const datasourceTypeList = vue.computed(
|
|
@@ -8262,12 +8320,15 @@
|
|
|
8262
8320
|
const filterTextChangeHandler = (val) => {
|
|
8263
8321
|
dataSourceList.value?.filter(val);
|
|
8264
8322
|
};
|
|
8323
|
+
eventBus?.on("edit-data-source", (id) => {
|
|
8324
|
+
editHandler(id);
|
|
8325
|
+
});
|
|
8265
8326
|
return (_ctx, _cache) => {
|
|
8266
8327
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8267
8328
|
vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8268
8329
|
default: vue.withCtx(() => [
|
|
8269
8330
|
vue.createElementVNode("div", _hoisted_1$6, [
|
|
8270
|
-
vue.createVNode(_sfc_main$
|
|
8331
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8271
8332
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
|
|
8272
8333
|
key: 0,
|
|
8273
8334
|
placement: "right"
|
|
@@ -8286,7 +8347,7 @@
|
|
|
8286
8347
|
default: vue.withCtx(() => [
|
|
8287
8348
|
vue.createElementVNode("div", _hoisted_2$5, [
|
|
8288
8349
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
8289
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8350
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
8290
8351
|
data: {
|
|
8291
8352
|
type: "button",
|
|
8292
8353
|
text: item.text,
|
|
@@ -8312,7 +8373,7 @@
|
|
|
8312
8373
|
]),
|
|
8313
8374
|
_: 3
|
|
8314
8375
|
}),
|
|
8315
|
-
vue.createVNode(_sfc_main$
|
|
8376
|
+
vue.createVNode(_sfc_main$j, {
|
|
8316
8377
|
ref_key: "editDialog",
|
|
8317
8378
|
ref: editDialog,
|
|
8318
8379
|
disabled: !vue.unref(editable),
|
|
@@ -8456,7 +8517,7 @@
|
|
|
8456
8517
|
vue.renderSlot(_ctx.$slots, "title"),
|
|
8457
8518
|
vue.createElementVNode("div", null, [
|
|
8458
8519
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
8459
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8520
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
8460
8521
|
"event-type": "mouseup",
|
|
8461
8522
|
ref_for: true,
|
|
8462
8523
|
ref_key: "buttons",
|
|
@@ -9232,8 +9293,8 @@
|
|
|
9232
9293
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9233
9294
|
default: vue.withCtx(() => [
|
|
9234
9295
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9235
|
-
vue.createVNode(_sfc_main$
|
|
9236
|
-
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9296
|
+
vue.createVNode(_sfc_main$o, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
9297
|
+
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
9237
9298
|
key: 0,
|
|
9238
9299
|
tabindex: "-1",
|
|
9239
9300
|
ref_key: "tree",
|
|
@@ -9359,7 +9420,7 @@
|
|
|
9359
9420
|
"model-value": collapseValue.value
|
|
9360
9421
|
}, {
|
|
9361
9422
|
default: vue.withCtx(() => [
|
|
9362
|
-
vue.createVNode(_sfc_main$
|
|
9423
|
+
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
9363
9424
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
|
|
9364
9425
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9365
9426
|
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
@@ -9432,7 +9493,11 @@
|
|
|
9432
9493
|
},
|
|
9433
9494
|
__name: "Sidebar",
|
|
9434
9495
|
props: {
|
|
9435
|
-
data: { default: () => ({
|
|
9496
|
+
data: { default: () => ({
|
|
9497
|
+
type: "tabs",
|
|
9498
|
+
status: "组件",
|
|
9499
|
+
items: [SideItemKey.COMPONENT_LIST, SideItemKey.LAYER, SideItemKey.CODE_BLOCK, SideItemKey.DATA_SOURCE]
|
|
9500
|
+
}) },
|
|
9436
9501
|
layerContentMenu: {},
|
|
9437
9502
|
customContentMenu: {}
|
|
9438
9503
|
},
|
|
@@ -9444,8 +9509,8 @@
|
|
|
9444
9509
|
const activeTabName = vue.ref(props.data?.status);
|
|
9445
9510
|
const getItemConfig = (data) => {
|
|
9446
9511
|
const map = {
|
|
9447
|
-
|
|
9448
|
-
$key:
|
|
9512
|
+
[SideItemKey.COMPONENT_LIST]: {
|
|
9513
|
+
$key: SideItemKey.COMPONENT_LIST,
|
|
9449
9514
|
type: "component",
|
|
9450
9515
|
icon: iconsVue.Goods,
|
|
9451
9516
|
text: "组件",
|
|
@@ -9464,16 +9529,16 @@
|
|
|
9464
9529
|
component: _sfc_main$c,
|
|
9465
9530
|
slots: {}
|
|
9466
9531
|
},
|
|
9467
|
-
|
|
9532
|
+
[SideItemKey.CODE_BLOCK]: {
|
|
9468
9533
|
$key: "code-block",
|
|
9469
9534
|
type: "component",
|
|
9470
9535
|
icon: iconsVue.EditPen,
|
|
9471
9536
|
text: "代码编辑",
|
|
9472
|
-
component: _sfc_main$
|
|
9537
|
+
component: _sfc_main$k,
|
|
9473
9538
|
slots: {}
|
|
9474
9539
|
},
|
|
9475
|
-
|
|
9476
|
-
$key:
|
|
9540
|
+
[SideItemKey.DATA_SOURCE]: {
|
|
9541
|
+
$key: SideItemKey.DATA_SOURCE,
|
|
9477
9542
|
type: "component",
|
|
9478
9543
|
icon: iconsVue.Coin,
|
|
9479
9544
|
text: "数据源",
|
|
@@ -9484,6 +9549,15 @@
|
|
|
9484
9549
|
return typeof data === "string" ? map[data] : data;
|
|
9485
9550
|
};
|
|
9486
9551
|
const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
9552
|
+
vue.watch(
|
|
9553
|
+
sideBarItems,
|
|
9554
|
+
(items) => {
|
|
9555
|
+
services?.uiService.set("sideBarItems", items);
|
|
9556
|
+
},
|
|
9557
|
+
{
|
|
9558
|
+
immediate: true
|
|
9559
|
+
}
|
|
9560
|
+
);
|
|
9487
9561
|
vue.watch(
|
|
9488
9562
|
() => props.data.status,
|
|
9489
9563
|
(status) => {
|
|
@@ -9522,7 +9596,8 @@
|
|
|
9522
9596
|
class: vue.normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
9523
9597
|
draggable: "true",
|
|
9524
9598
|
key: config.$key ?? index,
|
|
9525
|
-
|
|
9599
|
+
style: vue.normalizeStyle(config.tabStyle || {}),
|
|
9600
|
+
onClick: ($event) => activeTabName.value = config.text || config.$key || `${index}`,
|
|
9526
9601
|
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
9527
9602
|
(...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
|
|
9528
9603
|
onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
|
|
@@ -9532,7 +9607,7 @@
|
|
|
9532
9607
|
icon: config.icon
|
|
9533
9608
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
9534
9609
|
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
9535
|
-
],
|
|
9610
|
+
], 46, _hoisted_3$1)), [
|
|
9536
9611
|
[vue.vShow, !vue.unref(floatBoxStates)[config.$key]?.status]
|
|
9537
9612
|
]);
|
|
9538
9613
|
}), 128))
|
|
@@ -9653,14 +9728,14 @@
|
|
|
9653
9728
|
} : void 0
|
|
9654
9729
|
]), 1040)) : vue.createCommentVNode("", true)
|
|
9655
9730
|
])), [
|
|
9656
|
-
[vue.vShow,
|
|
9731
|
+
[vue.vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
|
|
9657
9732
|
]);
|
|
9658
9733
|
}), 128))
|
|
9659
9734
|
])) : vue.createCommentVNode("", true),
|
|
9660
9735
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
9661
9736
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
9662
9737
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9663
|
-
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9738
|
+
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
9664
9739
|
key: config.$key ?? index,
|
|
9665
9740
|
visible: vue.unref(floatBoxStates)[config.$key].status,
|
|
9666
9741
|
"onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -10093,7 +10168,7 @@
|
|
|
10093
10168
|
]),
|
|
10094
10169
|
_: 1
|
|
10095
10170
|
})) : vue.createCommentVNode("", true),
|
|
10096
|
-
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
10171
|
+
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
10097
10172
|
key: 1,
|
|
10098
10173
|
ref_key: "box",
|
|
10099
10174
|
ref: box,
|
|
@@ -10103,7 +10178,7 @@
|
|
|
10103
10178
|
position: menuPosition.value
|
|
10104
10179
|
}, {
|
|
10105
10180
|
body: vue.withCtx(() => [
|
|
10106
|
-
vue.createVNode(_sfc_main$
|
|
10181
|
+
vue.createVNode(_sfc_main$m, {
|
|
10107
10182
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10108
10183
|
data: nodeData.value,
|
|
10109
10184
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
@@ -11253,6 +11328,7 @@
|
|
|
11253
11328
|
containerHighlightClassName: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
11254
11329
|
containerHighlightDuration: 800,
|
|
11255
11330
|
containerHighlightType: StageCore.ContainerHighlightType.DEFAULT,
|
|
11331
|
+
disabledShowSrc: false,
|
|
11256
11332
|
componentGroupList: () => [],
|
|
11257
11333
|
datasourceList: () => [],
|
|
11258
11334
|
menu: () => ({ left: [], right: [] }),
|
|
@@ -11634,6 +11710,7 @@
|
|
|
11634
11710
|
disabledMultiSelect: { type: Boolean },
|
|
11635
11711
|
disabledPageFragment: { type: Boolean },
|
|
11636
11712
|
disabledStageOverlay: { type: Boolean },
|
|
11713
|
+
disabledShowSrc: { type: Boolean },
|
|
11637
11714
|
render: { type: Function },
|
|
11638
11715
|
updateDragEl: { type: Function },
|
|
11639
11716
|
canSelect: { type: Function },
|
|
@@ -11683,15 +11760,16 @@
|
|
|
11683
11760
|
vue.provide("services", services);
|
|
11684
11761
|
vue.provide("codeOptions", props.codeOptions);
|
|
11685
11762
|
vue.provide("stageOptions", stageOptions);
|
|
11763
|
+
vue.provide("eventBus", new events.EventEmitter());
|
|
11686
11764
|
__expose(services);
|
|
11687
11765
|
return (_ctx, _cache) => {
|
|
11688
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
11766
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11689
11767
|
header: vue.withCtx(() => [
|
|
11690
11768
|
vue.renderSlot(_ctx.$slots, "header")
|
|
11691
11769
|
]),
|
|
11692
11770
|
nav: vue.withCtx(() => [
|
|
11693
11771
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
|
|
11694
|
-
vue.createVNode(_sfc_main$
|
|
11772
|
+
vue.createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11695
11773
|
])
|
|
11696
11774
|
]),
|
|
11697
11775
|
"content-before": vue.withCtx(() => [
|
|
@@ -11766,8 +11844,9 @@
|
|
|
11766
11844
|
]),
|
|
11767
11845
|
"props-panel": vue.withCtx(() => [
|
|
11768
11846
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11769
|
-
vue.createVNode(_sfc_main$
|
|
11847
|
+
vue.createVNode(_sfc_main$p, {
|
|
11770
11848
|
"extend-state": _ctx.extendFormState,
|
|
11849
|
+
"disabled-show-src": _ctx.disabledShowSrc,
|
|
11771
11850
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11772
11851
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
11773
11852
|
onSubmitError: _cache[2] || (_cache[2] = (e) => _ctx.$emit("props-submit-error", e))
|
|
@@ -11776,7 +11855,7 @@
|
|
|
11776
11855
|
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
11777
11856
|
]),
|
|
11778
11857
|
_: 3
|
|
11779
|
-
}, 8, ["extend-state"])
|
|
11858
|
+
}, 8, ["extend-state", "disabled-show-src"])
|
|
11780
11859
|
])
|
|
11781
11860
|
]),
|
|
11782
11861
|
empty: vue.withCtx(() => [
|
|
@@ -11814,21 +11893,21 @@
|
|
|
11814
11893
|
setConfig(option);
|
|
11815
11894
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11816
11895
|
app.component("magic-code-editor", _sfc_main$T);
|
|
11817
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
11896
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11818
11897
|
app.component("m-fields-code-link", _sfc_main$R);
|
|
11819
11898
|
app.component("m-fields-vs-code", _sfc_main$S);
|
|
11820
11899
|
app.component("m-fields-code-select", _sfc_main$Q);
|
|
11821
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
11822
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11823
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
11824
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11825
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11826
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11827
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11828
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11829
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11830
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11831
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11900
|
+
app.component("m-fields-code-select-col", _sfc_main$O);
|
|
11901
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11902
|
+
app.component("m-fields-data-source-fields", _sfc_main$M);
|
|
11903
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11904
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11905
|
+
app.component("m-fields-data-source-input", _sfc_main$K);
|
|
11906
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11907
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11908
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11909
|
+
app.component("m-fields-data-source-field-select", _sfc_main$L);
|
|
11910
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11832
11911
|
}
|
|
11833
11912
|
};
|
|
11834
11913
|
|
|
@@ -11838,42 +11917,43 @@
|
|
|
11838
11917
|
});
|
|
11839
11918
|
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
11840
11919
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
11841
|
-
exports.CodeBlockEditor = _sfc_main$
|
|
11842
|
-
exports.CodeBlockList = _sfc_main$
|
|
11843
|
-
exports.CodeBlockListPanel = _sfc_main$
|
|
11920
|
+
exports.CodeBlockEditor = _sfc_main$J;
|
|
11921
|
+
exports.CodeBlockList = _sfc_main$l;
|
|
11922
|
+
exports.CodeBlockListPanel = _sfc_main$k;
|
|
11844
11923
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
11845
11924
|
exports.CodeSelect = _sfc_main$Q;
|
|
11846
|
-
exports.CodeSelectCol = _sfc_main$
|
|
11925
|
+
exports.CodeSelectCol = _sfc_main$O;
|
|
11847
11926
|
exports.ColumnLayout = ColumnLayout;
|
|
11848
11927
|
exports.ComponentListPanel = _sfc_main$b;
|
|
11849
11928
|
exports.ContentMenu = _sfc_main$g;
|
|
11850
|
-
exports.DataSourceConfigPanel = _sfc_main$
|
|
11851
|
-
exports.DataSourceFieldSelect = _sfc_main$
|
|
11852
|
-
exports.DataSourceFields = _sfc_main$
|
|
11853
|
-
exports.DataSourceInput = _sfc_main$
|
|
11854
|
-
exports.DataSourceMethodSelect = _sfc_main$
|
|
11855
|
-
exports.DataSourceMethods = _sfc_main$
|
|
11856
|
-
exports.DataSourceMocks = _sfc_main$
|
|
11857
|
-
exports.DataSourceSelect = _sfc_main$
|
|
11929
|
+
exports.DataSourceConfigPanel = _sfc_main$j;
|
|
11930
|
+
exports.DataSourceFieldSelect = _sfc_main$L;
|
|
11931
|
+
exports.DataSourceFields = _sfc_main$M;
|
|
11932
|
+
exports.DataSourceInput = _sfc_main$K;
|
|
11933
|
+
exports.DataSourceMethodSelect = _sfc_main$H;
|
|
11934
|
+
exports.DataSourceMethods = _sfc_main$I;
|
|
11935
|
+
exports.DataSourceMocks = _sfc_main$G;
|
|
11936
|
+
exports.DataSourceSelect = _sfc_main$F;
|
|
11858
11937
|
exports.DragType = DragType;
|
|
11859
|
-
exports.EventSelect = _sfc_main$
|
|
11938
|
+
exports.EventSelect = _sfc_main$E;
|
|
11860
11939
|
exports.Fixed2Other = Fixed2Other;
|
|
11861
11940
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
11862
11941
|
exports.Icon = _sfc_main$U;
|
|
11863
11942
|
exports.KeyBindingCommand = KeyBindingCommand;
|
|
11864
|
-
exports.KeyValue = _sfc_main$
|
|
11943
|
+
exports.KeyValue = _sfc_main$C;
|
|
11865
11944
|
exports.Keys = Keys;
|
|
11866
11945
|
exports.LayerOffset = LayerOffset;
|
|
11867
11946
|
exports.LayerPanel = _sfc_main$c;
|
|
11868
11947
|
exports.Layout = Layout;
|
|
11869
|
-
exports.LayoutContainer = _sfc_main$
|
|
11870
|
-
exports.PageFragmentSelect = _sfc_main$
|
|
11871
|
-
exports.PropsPanel = _sfc_main$
|
|
11872
|
-
exports.Resizer = _sfc_main$
|
|
11873
|
-
exports.
|
|
11948
|
+
exports.LayoutContainer = _sfc_main$y;
|
|
11949
|
+
exports.PageFragmentSelect = _sfc_main$B;
|
|
11950
|
+
exports.PropsPanel = _sfc_main$p;
|
|
11951
|
+
exports.Resizer = _sfc_main$z;
|
|
11952
|
+
exports.SideItemKey = SideItemKey;
|
|
11953
|
+
exports.SplitView = _sfc_main$y;
|
|
11874
11954
|
exports.TMagicCodeEditor = _sfc_main$T;
|
|
11875
11955
|
exports.TMagicEditor = _sfc_main;
|
|
11876
|
-
exports.ToolButton = _sfc_main$
|
|
11956
|
+
exports.ToolButton = _sfc_main$x;
|
|
11877
11957
|
exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
|
|
11878
11958
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
11879
11959
|
exports.advancedTabConfig = advancedTabConfig;
|