@tmagic/editor 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +17 -3
- package/dist/tmagic-editor.js +1309 -1208
- package/dist/tmagic-editor.umd.cjs +1327 -1224
- package/package.json +19 -24
- package/src/Editor.vue +6 -1
- package/src/editorProps.ts +3 -0
- package/src/fields/CodeSelectCol.vue +26 -18
- package/src/fields/DataSourceFieldSelect.vue +23 -61
- package/src/fields/DataSourceMethodSelect.vue +25 -31
- package/src/fields/DataSourceSelect.vue +49 -13
- package/src/fields/EventSelect.vue +37 -14
- package/src/hooks/use-editor-content-height.ts +11 -5
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/Sidebar.vue +24 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +6 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +6 -1
- package/src/layouts/workspace/viewer/Stage.vue +7 -6
- package/src/services/editor.ts +2 -2
- package/src/services/ui.ts +1 -0
- package/src/theme/data-source-field.scss +12 -0
- package/src/theme/props-panel.scss +1 -1
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +31 -2
- package/src/utils/content-menu.ts +7 -3
- package/src/utils/data-source/index.ts +39 -3
- package/src/utils/editor.ts +14 -7
- package/types/components/CodeBlockEditor.vue.d.ts +21 -34
- package/types/components/CodeParams.vue.d.ts +2 -2
- package/types/components/ContentMenu.vue.d.ts +4 -4
- package/types/components/FloatingBox.vue.d.ts +41 -38
- package/types/components/ScrollViewer.vue.d.ts +1 -1
- package/types/components/ToolButton.vue.d.ts +6 -6
- package/types/components/Tree.vue.d.ts +2 -2
- package/types/editorProps.d.ts +3 -0
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/DataSourceFields.vue.d.ts +32 -78
- package/types/fields/DataSourceInput.vue.d.ts +2 -2
- package/types/fields/DataSourceMethods.vue.d.ts +2 -2
- package/types/fields/DataSourceMocks.vue.d.ts +31 -76
- package/types/fields/KeyValue.vue.d.ts +2 -2
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/hooks/use-code-block-edit.d.ts +18 -6
- package/types/hooks/use-data-source-edit.d.ts +18 -6
- package/types/hooks/use-data-source-method.d.ts +18 -6
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/layouts/PropsPanel.vue.d.ts +40 -38
- package/types/layouts/sidebar/Sidebar.vue.d.ts +7 -7
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +20 -30
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +8 -8
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +4 -4
- package/types/layouts/sidebar/layer/use-click.d.ts +13 -13
- package/types/layouts/workspace/Workspace.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +8 -8
- package/types/services/dataSource.d.ts +1 -0
- package/types/services/ui.d.ts +19 -1
- package/types/type.d.ts +26 -2
- package/types/utils/data-source/index.d.ts +3 -2
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString,
|
|
2
|
-
import { Edit, FullScreen,
|
|
1
|
+
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, createCommentVNode, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString, createTextVNode, isRef, mergeProps, Fragment, renderList, createStaticVNode, watchEffect, withModifiers, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, Transition, mergeDefaults } from 'vue';
|
|
2
|
+
import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document, Search, ArrowRight, CopyDocument, Files, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
|
|
3
3
|
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
|
|
4
4
|
import serialize from 'serialize-javascript';
|
|
5
|
-
import { TMagicIcon, TMagicButton, TMagicCard, useZIndex, tMagicMessage,
|
|
5
|
+
import { TMagicIcon, TMagicButton, TMagicCard, useZIndex, tMagicMessage, tMagicMessageBox, getConfig as getConfig$1, TMagicTag, TMagicDialog, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
6
6
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
7
7
|
import * as monaco from 'monaco-editor';
|
|
8
|
-
import { MContainer,
|
|
8
|
+
import { MContainer, MForm, filterFunction, createValues, MFormBox, MCascader, MSelect, MPanel } from '@tmagic/form';
|
|
9
9
|
import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
10
|
-
import VanillaMoveable from 'moveable';
|
|
11
10
|
import { MagicTable } from '@tmagic/table';
|
|
12
|
-
import { toLine, guid, isPage, isPageFragment, isPop, getNodePath, isNumber, getValueByKeyPath, setValueByKeyPath, convertToNumber, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
11
|
+
import { toLine, guid, isPage, isPageFragment, isPop, getNodePath, isNumber, calcValueByFontsize, getValueByKeyPath, setValueByKeyPath, convertToNumber, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
12
|
+
import VanillaMoveable from 'moveable';
|
|
13
13
|
import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
14
14
|
export { DepTargetType } from '@tmagic/dep';
|
|
15
|
-
import Gesto from 'gesto';
|
|
16
|
-
import StageCore, { GuidesType, getOffset, calcValueByFontsize, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
17
15
|
import { EventEmitter } from 'events';
|
|
16
|
+
import Gesto from 'gesto';
|
|
17
|
+
import StageCore, { GuidesType, getOffset, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
18
18
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
19
19
|
import KeyController from 'keycon';
|
|
20
20
|
|
|
21
|
-
const _hoisted_1$
|
|
21
|
+
const _hoisted_1$u = ["src"];
|
|
22
22
|
const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
23
23
|
...{
|
|
24
24
|
name: "MEditorIcon"
|
|
@@ -43,7 +43,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
class: "magic-editor-icon"
|
|
44
44
|
}, {
|
|
45
45
|
default: withCtx(() => [
|
|
46
|
-
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
46
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$u)
|
|
47
47
|
]),
|
|
48
48
|
_: 1
|
|
49
49
|
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -71,7 +71,7 @@ const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
|
71
71
|
emmetHTML(monaco);
|
|
72
72
|
emmetCSS(monaco, ["css", "scss"]);
|
|
73
73
|
|
|
74
|
-
const _hoisted_1$
|
|
74
|
+
const _hoisted_1$t = {
|
|
75
75
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
76
76
|
};
|
|
77
77
|
const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
@@ -232,7 +232,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
return (_ctx, _cache) => {
|
|
235
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
235
|
+
return openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
236
236
|
(openBlock(), createBlock(Teleport, {
|
|
237
237
|
to: "body",
|
|
238
238
|
disabled: !fullScreen.value
|
|
@@ -505,689 +505,163 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
505
505
|
}
|
|
506
506
|
});
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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
|
-
|
|
508
|
+
function BaseFormConfig() {
|
|
509
|
+
return [
|
|
510
|
+
{
|
|
511
|
+
name: "id",
|
|
512
|
+
type: "hidden"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: "type",
|
|
516
|
+
text: "类型",
|
|
517
|
+
type: "hidden",
|
|
518
|
+
defaultValue: "base"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: "title",
|
|
522
|
+
text: "名称",
|
|
523
|
+
rules: [
|
|
524
|
+
{
|
|
525
|
+
required: true,
|
|
526
|
+
message: "请输入名称"
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: "description",
|
|
532
|
+
text: "描述"
|
|
533
|
+
}
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const HttpFormConfig = [
|
|
538
|
+
{
|
|
539
|
+
name: "autoFetch",
|
|
540
|
+
text: "自动请求",
|
|
541
|
+
type: "switch",
|
|
542
|
+
defaultValue: true
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: "responseOptions",
|
|
546
|
+
items: [
|
|
547
|
+
{
|
|
548
|
+
name: "dataPath",
|
|
549
|
+
text: "数据路径"
|
|
539
550
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
551
|
+
]
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
type: "fieldset",
|
|
555
|
+
name: "options",
|
|
556
|
+
legend: "HTTP 配置",
|
|
557
|
+
items: [
|
|
558
|
+
{
|
|
559
|
+
name: "url",
|
|
560
|
+
text: "URL"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: "method",
|
|
564
|
+
text: "Method",
|
|
565
|
+
type: "select",
|
|
566
|
+
options: [
|
|
567
|
+
{ text: "GET", value: "GET" },
|
|
568
|
+
{ text: "POST", value: "POST" },
|
|
569
|
+
{ text: "PUT", value: "PUT" },
|
|
570
|
+
{ text: "DELETE", value: "DELETE" }
|
|
571
|
+
]
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "params",
|
|
575
|
+
type: "key-value",
|
|
576
|
+
defaultValue: {},
|
|
577
|
+
text: "参数"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: "data",
|
|
581
|
+
type: "key-value",
|
|
582
|
+
defaultValue: {},
|
|
583
|
+
advanced: true,
|
|
584
|
+
text: "请求体"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
name: "headers",
|
|
588
|
+
type: "key-value",
|
|
589
|
+
defaultValue: {},
|
|
590
|
+
text: "请求头"
|
|
548
591
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
snappable: true,
|
|
567
|
-
dragTarget: titleEl.value,
|
|
568
|
-
dragTargetSelf: false,
|
|
569
|
-
linePadding: 10,
|
|
570
|
-
controlPadding: 10,
|
|
571
|
-
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
572
|
-
});
|
|
573
|
-
moveable.on("drag", (e) => {
|
|
574
|
-
e.target.style.transform = e.transform;
|
|
575
|
-
});
|
|
576
|
-
moveable.on("resize", (e) => {
|
|
577
|
-
width.value = e.width;
|
|
578
|
-
height.value = e.height;
|
|
579
|
-
e.target.style.width = `${e.width}px`;
|
|
580
|
-
e.target.style.height = `${e.height}px`;
|
|
581
|
-
e.target.style.transform = e.drag.transform;
|
|
582
|
-
});
|
|
583
|
-
};
|
|
584
|
-
const destroyMoveable = () => {
|
|
585
|
-
moveable?.destroy();
|
|
586
|
-
moveable = null;
|
|
587
|
-
};
|
|
588
|
-
watch(
|
|
589
|
-
visible,
|
|
590
|
-
async (visible2) => {
|
|
591
|
-
if (visible2) {
|
|
592
|
-
await nextTick();
|
|
593
|
-
curZIndex.value = zIndex.nextZIndex();
|
|
594
|
-
const targetRect = target.value?.getBoundingClientRect();
|
|
595
|
-
if (targetRect) {
|
|
596
|
-
width.value = targetRect.width;
|
|
597
|
-
height.value = targetRect.height;
|
|
598
|
-
initMoveable();
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
];
|
|
595
|
+
|
|
596
|
+
const fillConfig$1 = (config) => [
|
|
597
|
+
...BaseFormConfig(),
|
|
598
|
+
...config,
|
|
599
|
+
{
|
|
600
|
+
type: "tab",
|
|
601
|
+
items: [
|
|
602
|
+
{
|
|
603
|
+
title: "数据定义",
|
|
604
|
+
items: [
|
|
605
|
+
{
|
|
606
|
+
name: "fields",
|
|
607
|
+
type: "data-source-fields",
|
|
608
|
+
defaultValue: () => []
|
|
599
609
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
610
|
+
]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
title: "方法定义",
|
|
614
|
+
items: [
|
|
615
|
+
{
|
|
616
|
+
name: "methods",
|
|
617
|
+
type: "data-source-methods",
|
|
618
|
+
defaultValue: () => []
|
|
603
619
|
}
|
|
604
|
-
|
|
605
|
-
destroyMoveable();
|
|
606
|
-
}
|
|
620
|
+
]
|
|
607
621
|
},
|
|
608
622
|
{
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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
|
-
class: "m-editor-float-box-title"
|
|
652
|
-
}, [
|
|
653
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
654
|
-
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
655
|
-
]),
|
|
656
|
-
createElementVNode("div", null, [
|
|
657
|
-
createVNode(unref(TMagicButton), {
|
|
658
|
-
link: "",
|
|
659
|
-
size: "small",
|
|
660
|
-
onClick: closeHandler
|
|
661
|
-
}, {
|
|
662
|
-
default: withCtx(() => [
|
|
663
|
-
createVNode(_sfc_main$U, { icon: unref(Close) }, null, 8, ["icon"])
|
|
664
|
-
]),
|
|
665
|
-
_: 1
|
|
666
|
-
})
|
|
667
|
-
])
|
|
668
|
-
], 512),
|
|
669
|
-
createElementVNode("div", {
|
|
670
|
-
class: "m-editor-float-box-body",
|
|
671
|
-
style: normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
672
|
-
}, [
|
|
673
|
-
renderSlot(_ctx.$slots, "body")
|
|
674
|
-
], 4)
|
|
675
|
-
], 36)
|
|
676
|
-
])) : createCommentVNode("", true);
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
const useEditorContentHeight = () => {
|
|
682
|
-
const services = inject("services");
|
|
683
|
-
const frameworkHeight = computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
684
|
-
const navMenuHeight = computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
685
|
-
const editorContentHeight = computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
686
|
-
const height = ref(0);
|
|
687
|
-
watchEffect(() => {
|
|
688
|
-
if (height.value > 0 && height.value === editorContentHeight.value)
|
|
689
|
-
return;
|
|
690
|
-
height.value = editorContentHeight.value;
|
|
691
|
-
});
|
|
692
|
-
return {
|
|
693
|
-
height
|
|
694
|
-
};
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
698
|
-
const boxPosition = ref({
|
|
699
|
-
left: 0,
|
|
700
|
-
top: 0
|
|
701
|
-
});
|
|
702
|
-
const calcBoxPosition = () => {
|
|
703
|
-
const columnWidth = uiService?.get("columnWidth");
|
|
704
|
-
const navMenuRect = uiService?.get("navMenuRect");
|
|
705
|
-
let left = columnWidth?.left ?? 0;
|
|
706
|
-
if (parent?.value) {
|
|
707
|
-
const rect = parent?.value?.getBoundingClientRect();
|
|
708
|
-
left = (rect?.left ?? 0) + (rect?.width ?? 0);
|
|
709
|
-
}
|
|
710
|
-
boxPosition.value = {
|
|
711
|
-
left,
|
|
712
|
-
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
713
|
-
};
|
|
714
|
-
};
|
|
715
|
-
return {
|
|
716
|
-
boxPosition,
|
|
717
|
-
calcBoxPosition
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
|
|
721
|
-
const useWindowRect = () => {
|
|
722
|
-
const rect = reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
723
|
-
const windowResizeHandler = () => {
|
|
724
|
-
rect.width = globalThis.innerWidth;
|
|
725
|
-
rect.height = globalThis.innerHeight;
|
|
726
|
-
};
|
|
727
|
-
globalThis.addEventListener("resize", windowResizeHandler);
|
|
728
|
-
onBeforeUnmount(() => {
|
|
729
|
-
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
730
|
-
});
|
|
731
|
-
return {
|
|
732
|
-
rect
|
|
733
|
-
};
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
737
|
-
const _hoisted_2$k = { style: { "flex": "1" } };
|
|
738
|
-
const _hoisted_3$8 = { style: { "flex": "1" } };
|
|
739
|
-
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
740
|
-
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
741
|
-
...{
|
|
742
|
-
name: "MEditorCodeBlockEditor"
|
|
743
|
-
},
|
|
744
|
-
__name: "CodeBlockEditor",
|
|
745
|
-
props: /* @__PURE__ */ mergeModels({
|
|
746
|
-
content: {},
|
|
747
|
-
disabled: { type: Boolean },
|
|
748
|
-
isDataSource: { type: Boolean },
|
|
749
|
-
dataSourceType: {}
|
|
750
|
-
}, {
|
|
751
|
-
"width": { default: 670 },
|
|
752
|
-
"widthModifiers": {},
|
|
753
|
-
"visible": { type: Boolean, ...{ default: false } },
|
|
754
|
-
"visibleModifiers": {}
|
|
755
|
-
}),
|
|
756
|
-
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
757
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
758
|
-
const width = useModel(__props, "width");
|
|
759
|
-
const boxVisible = useModel(__props, "visible");
|
|
760
|
-
const props = __props;
|
|
761
|
-
const emit = __emit;
|
|
762
|
-
const services = inject("services");
|
|
763
|
-
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
764
|
-
const difVisible = ref(false);
|
|
765
|
-
const { rect: windowRect } = useWindowRect();
|
|
766
|
-
const magicVsEditor = ref();
|
|
767
|
-
const diffChange = () => {
|
|
768
|
-
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
772
|
-
difVisible.value = false;
|
|
773
|
-
};
|
|
774
|
-
const defaultParamColConfig = {
|
|
775
|
-
type: "row",
|
|
776
|
-
label: "参数类型",
|
|
777
|
-
items: [
|
|
778
|
-
{
|
|
779
|
-
text: "参数类型",
|
|
780
|
-
labelWidth: "70px",
|
|
781
|
-
type: "select",
|
|
782
|
-
name: "type",
|
|
783
|
-
options: [
|
|
784
|
-
{
|
|
785
|
-
text: "数字",
|
|
786
|
-
label: "数字",
|
|
787
|
-
value: "number"
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
text: "字符串",
|
|
791
|
-
label: "字符串",
|
|
792
|
-
value: "text"
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
text: "组件",
|
|
796
|
-
label: "组件",
|
|
797
|
-
value: "ui-select"
|
|
798
|
-
}
|
|
799
|
-
]
|
|
800
|
-
}
|
|
801
|
-
]
|
|
802
|
-
};
|
|
803
|
-
const functionConfig = computed(() => [
|
|
804
|
-
{
|
|
805
|
-
text: "名称",
|
|
806
|
-
name: "name",
|
|
807
|
-
rules: [{ required: true, message: "请输入名称", trigger: "blur" }]
|
|
808
|
-
},
|
|
809
|
-
{
|
|
810
|
-
text: "描述",
|
|
811
|
-
name: "desc"
|
|
812
|
-
},
|
|
813
|
-
{
|
|
814
|
-
text: "执行时机",
|
|
815
|
-
name: "timing",
|
|
816
|
-
type: "select",
|
|
817
|
-
options: () => {
|
|
818
|
-
const options = [
|
|
819
|
-
{ text: "初始化前", value: "beforeInit" },
|
|
820
|
-
{ text: "初始化后", value: "afterInit" }
|
|
821
|
-
];
|
|
822
|
-
if (props.dataSourceType !== "base") {
|
|
823
|
-
options.push({ text: "请求前", value: "beforeRequest" });
|
|
824
|
-
options.push({ text: "请求后", value: "afterRequest" });
|
|
825
|
-
}
|
|
826
|
-
return options;
|
|
827
|
-
},
|
|
828
|
-
display: () => props.isDataSource
|
|
829
|
-
},
|
|
830
|
-
{
|
|
831
|
-
type: "table",
|
|
832
|
-
border: true,
|
|
833
|
-
text: "参数",
|
|
834
|
-
enableFullscreen: false,
|
|
835
|
-
enableToggleMode: false,
|
|
836
|
-
name: "params",
|
|
837
|
-
dropSort: false,
|
|
838
|
-
items: [
|
|
839
|
-
{
|
|
840
|
-
type: "text",
|
|
841
|
-
label: "参数名",
|
|
842
|
-
name: "name"
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
type: "text",
|
|
846
|
-
label: "描述",
|
|
847
|
-
name: "extra"
|
|
848
|
-
},
|
|
849
|
-
services?.codeBlockService.getParamsColConfig() || defaultParamColConfig
|
|
850
|
-
]
|
|
851
|
-
},
|
|
852
|
-
{
|
|
853
|
-
name: "content",
|
|
854
|
-
type: "vs-code",
|
|
855
|
-
options: inject("codeOptions", {}),
|
|
856
|
-
height: "500px",
|
|
857
|
-
onChange: (formState, code) => {
|
|
858
|
-
try {
|
|
859
|
-
getConfig("parseDSL")(code);
|
|
860
|
-
return code;
|
|
861
|
-
} catch (error) {
|
|
862
|
-
tMagicMessage.error(error.message);
|
|
863
|
-
throw error;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
]);
|
|
868
|
-
const submitForm = (values) => {
|
|
869
|
-
changedValue.value = void 0;
|
|
870
|
-
emit("submit", values);
|
|
871
|
-
};
|
|
872
|
-
const errorHandler = (error) => {
|
|
873
|
-
tMagicMessage.error(error.message);
|
|
874
|
-
};
|
|
875
|
-
const formBox = ref();
|
|
876
|
-
const changedValue = ref();
|
|
877
|
-
const changeHandler = (values) => {
|
|
878
|
-
changedValue.value = values;
|
|
879
|
-
};
|
|
880
|
-
const beforeClose = (done) => {
|
|
881
|
-
if (!changedValue.value) {
|
|
882
|
-
done();
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
tMagicMessageBox.confirm("当前代码块已修改,是否保存?", "提示", {
|
|
886
|
-
confirmButtonText: "保存并关闭",
|
|
887
|
-
cancelButtonText: "不保存并关闭",
|
|
888
|
-
type: "warning",
|
|
889
|
-
distinguishCancelAndClose: true
|
|
890
|
-
}).then(() => {
|
|
891
|
-
changedValue.value && submitForm(changedValue.value);
|
|
892
|
-
done();
|
|
893
|
-
}).catch((action) => {
|
|
894
|
-
done(action === "cancel");
|
|
895
|
-
});
|
|
896
|
-
};
|
|
897
|
-
const closedHandler = () => {
|
|
898
|
-
changedValue.value = void 0;
|
|
899
|
-
};
|
|
900
|
-
const parentFloating = inject("parentFloating", ref(null));
|
|
901
|
-
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
902
|
-
__expose({
|
|
903
|
-
async show() {
|
|
904
|
-
calcBoxPosition();
|
|
905
|
-
boxVisible.value = true;
|
|
906
|
-
},
|
|
907
|
-
async hide() {
|
|
908
|
-
boxVisible.value = false;
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
return (_ctx, _cache) => {
|
|
912
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
913
|
-
createVNode(_sfc_main$P, {
|
|
914
|
-
visible: boxVisible.value,
|
|
915
|
-
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
916
|
-
width: width.value,
|
|
917
|
-
"onUpdate:width": _cache[2] || (_cache[2] = ($event) => width.value = $event),
|
|
918
|
-
height: unref(codeBlockEditorHeight),
|
|
919
|
-
"onUpdate:height": _cache[3] || (_cache[3] = ($event) => isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
920
|
-
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
921
|
-
position: unref(boxPosition),
|
|
922
|
-
"before-close": beforeClose
|
|
923
|
-
}, {
|
|
924
|
-
body: withCtx(() => [
|
|
925
|
-
createVNode(unref(MFormBox), {
|
|
926
|
-
class: "m-editor-code-block-editor",
|
|
927
|
-
ref_key: "formBox",
|
|
928
|
-
ref: formBox,
|
|
929
|
-
"label-width": "80px",
|
|
930
|
-
"close-on-press-escape": false,
|
|
931
|
-
title: _ctx.content.name,
|
|
932
|
-
config: functionConfig.value,
|
|
933
|
-
values: _ctx.content,
|
|
934
|
-
disabled: _ctx.disabled,
|
|
935
|
-
style: { "height": "100%" },
|
|
936
|
-
onChange: changeHandler,
|
|
937
|
-
onSubmit: submitForm,
|
|
938
|
-
onError: errorHandler,
|
|
939
|
-
onClosed: closedHandler
|
|
940
|
-
}, {
|
|
941
|
-
left: withCtx(() => [
|
|
942
|
-
!_ctx.disabled ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
943
|
-
key: 0,
|
|
944
|
-
type: "primary",
|
|
945
|
-
link: "",
|
|
946
|
-
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
947
|
-
}, {
|
|
948
|
-
default: withCtx(() => [
|
|
949
|
-
createTextVNode("查看修改")
|
|
950
|
-
]),
|
|
951
|
-
_: 1
|
|
952
|
-
})) : createCommentVNode("", true)
|
|
953
|
-
]),
|
|
954
|
-
_: 1
|
|
955
|
-
}, 8, ["title", "config", "values", "disabled"])
|
|
956
|
-
]),
|
|
957
|
-
_: 1
|
|
958
|
-
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
959
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
960
|
-
createVNode(unref(TMagicDialog), {
|
|
961
|
-
title: "查看修改",
|
|
962
|
-
modelValue: difVisible.value,
|
|
963
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
964
|
-
fullscreen: ""
|
|
965
|
-
}, {
|
|
966
|
-
footer: withCtx(() => [
|
|
967
|
-
createElementVNode("span", _hoisted_4$7, [
|
|
968
|
-
createVNode(unref(TMagicButton), {
|
|
969
|
-
size: "small",
|
|
970
|
-
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
971
|
-
}, {
|
|
972
|
-
default: withCtx(() => [
|
|
973
|
-
createTextVNode("取消")
|
|
974
|
-
]),
|
|
975
|
-
_: 1
|
|
976
|
-
}),
|
|
977
|
-
createVNode(unref(TMagicButton), {
|
|
978
|
-
size: "small",
|
|
979
|
-
type: "primary",
|
|
980
|
-
onClick: diffChange
|
|
981
|
-
}, {
|
|
982
|
-
default: withCtx(() => [
|
|
983
|
-
createTextVNode("确定")
|
|
984
|
-
]),
|
|
985
|
-
_: 1
|
|
986
|
-
})
|
|
987
|
-
])
|
|
988
|
-
]),
|
|
989
|
-
default: withCtx(() => [
|
|
990
|
-
createElementVNode("div", _hoisted_1$r, [
|
|
991
|
-
createElementVNode("div", _hoisted_2$k, [
|
|
992
|
-
createVNode(unref(TMagicTag), {
|
|
993
|
-
size: "small",
|
|
994
|
-
type: "info"
|
|
995
|
-
}, {
|
|
996
|
-
default: withCtx(() => [
|
|
997
|
-
createTextVNode("修改前")
|
|
998
|
-
]),
|
|
999
|
-
_: 1
|
|
1000
|
-
})
|
|
1001
|
-
]),
|
|
1002
|
-
createElementVNode("div", _hoisted_3$8, [
|
|
1003
|
-
createVNode(unref(TMagicTag), {
|
|
1004
|
-
size: "small",
|
|
1005
|
-
type: "success"
|
|
1006
|
-
}, {
|
|
1007
|
-
default: withCtx(() => [
|
|
1008
|
-
createTextVNode("修改后")
|
|
1009
|
-
]),
|
|
1010
|
-
_: 1
|
|
1011
|
-
})
|
|
1012
|
-
])
|
|
1013
|
-
]),
|
|
1014
|
-
difVisible.value ? (openBlock(), createBlock(_sfc_main$T, {
|
|
1015
|
-
key: 0,
|
|
1016
|
-
ref_key: "magicVsEditor",
|
|
1017
|
-
ref: magicVsEditor,
|
|
1018
|
-
type: "diff",
|
|
1019
|
-
language: "json",
|
|
1020
|
-
initValues: _ctx.content.content,
|
|
1021
|
-
modifiedValues: formBox.value?.form?.values.content,
|
|
1022
|
-
style: normalizeStyle(`height: ${unref(windowRect).height - 150}px`)
|
|
1023
|
-
}, null, 8, ["initValues", "modifiedValues", "style"])) : createCommentVNode("", true)
|
|
1024
|
-
]),
|
|
1025
|
-
_: 1
|
|
1026
|
-
}, 8, ["modelValue"])
|
|
1027
|
-
]))
|
|
1028
|
-
], 64);
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
function BaseFormConfig() {
|
|
1034
|
-
return [
|
|
1035
|
-
{
|
|
1036
|
-
name: "id",
|
|
1037
|
-
type: "hidden"
|
|
1038
|
-
},
|
|
1039
|
-
{
|
|
1040
|
-
name: "type",
|
|
1041
|
-
text: "类型",
|
|
1042
|
-
type: "hidden",
|
|
1043
|
-
defaultValue: "base"
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
name: "title",
|
|
1047
|
-
text: "名称",
|
|
1048
|
-
rules: [
|
|
1049
|
-
{
|
|
1050
|
-
required: true,
|
|
1051
|
-
message: "请输入名称"
|
|
1052
|
-
}
|
|
1053
|
-
]
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
name: "description",
|
|
1057
|
-
text: "描述"
|
|
1058
|
-
}
|
|
1059
|
-
];
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
const HttpFormConfig = [
|
|
1063
|
-
{
|
|
1064
|
-
name: "autoFetch",
|
|
1065
|
-
text: "自动请求",
|
|
1066
|
-
type: "switch",
|
|
1067
|
-
defaultValue: true
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
name: "responseOptions",
|
|
1071
|
-
items: [
|
|
1072
|
-
{
|
|
1073
|
-
name: "dataPath",
|
|
1074
|
-
text: "数据路径"
|
|
1075
|
-
}
|
|
1076
|
-
]
|
|
1077
|
-
},
|
|
1078
|
-
{
|
|
1079
|
-
type: "fieldset",
|
|
1080
|
-
name: "options",
|
|
1081
|
-
legend: "HTTP 配置",
|
|
1082
|
-
items: [
|
|
1083
|
-
{
|
|
1084
|
-
name: "url",
|
|
1085
|
-
text: "URL"
|
|
1086
|
-
},
|
|
1087
|
-
{
|
|
1088
|
-
name: "method",
|
|
1089
|
-
text: "Method",
|
|
1090
|
-
type: "select",
|
|
1091
|
-
options: [
|
|
1092
|
-
{ text: "GET", value: "GET" },
|
|
1093
|
-
{ text: "POST", value: "POST" },
|
|
1094
|
-
{ text: "PUT", value: "PUT" },
|
|
1095
|
-
{ text: "DELETE", value: "DELETE" }
|
|
1096
|
-
]
|
|
1097
|
-
},
|
|
1098
|
-
{
|
|
1099
|
-
name: "params",
|
|
1100
|
-
type: "key-value",
|
|
1101
|
-
defaultValue: {},
|
|
1102
|
-
text: "参数"
|
|
1103
|
-
},
|
|
1104
|
-
{
|
|
1105
|
-
name: "data",
|
|
1106
|
-
type: "key-value",
|
|
1107
|
-
defaultValue: {},
|
|
1108
|
-
advanced: true,
|
|
1109
|
-
text: "请求体"
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
name: "headers",
|
|
1113
|
-
type: "key-value",
|
|
1114
|
-
defaultValue: {},
|
|
1115
|
-
text: "请求头"
|
|
1116
|
-
}
|
|
1117
|
-
]
|
|
1118
|
-
}
|
|
1119
|
-
];
|
|
1120
|
-
|
|
1121
|
-
const fillConfig$1 = (config) => [
|
|
1122
|
-
...BaseFormConfig(),
|
|
1123
|
-
...config,
|
|
1124
|
-
{
|
|
1125
|
-
type: "tab",
|
|
1126
|
-
items: [
|
|
1127
|
-
{
|
|
1128
|
-
title: "数据定义",
|
|
1129
|
-
items: [
|
|
1130
|
-
{
|
|
1131
|
-
name: "fields",
|
|
1132
|
-
type: "data-source-fields",
|
|
1133
|
-
defaultValue: () => []
|
|
1134
|
-
}
|
|
1135
|
-
]
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
title: "方法定义",
|
|
1139
|
-
items: [
|
|
1140
|
-
{
|
|
1141
|
-
name: "methods",
|
|
1142
|
-
type: "data-source-methods",
|
|
1143
|
-
defaultValue: () => []
|
|
1144
|
-
}
|
|
1145
|
-
]
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
title: "事件配置",
|
|
1149
|
-
display: false,
|
|
1150
|
-
items: [
|
|
1151
|
-
{
|
|
1152
|
-
name: "events",
|
|
1153
|
-
src: "datasource",
|
|
1154
|
-
type: "event-select"
|
|
1155
|
-
}
|
|
1156
|
-
]
|
|
1157
|
-
},
|
|
1158
|
-
{
|
|
1159
|
-
title: "mock数据",
|
|
1160
|
-
items: [
|
|
1161
|
-
{
|
|
1162
|
-
name: "mocks",
|
|
1163
|
-
type: "data-source-mocks",
|
|
1164
|
-
defaultValue: () => []
|
|
1165
|
-
}
|
|
1166
|
-
]
|
|
1167
|
-
},
|
|
1168
|
-
{
|
|
1169
|
-
title: "请求参数裁剪",
|
|
1170
|
-
display: (formState, { model }) => model.type === "http",
|
|
1171
|
-
items: [
|
|
1172
|
-
{
|
|
1173
|
-
name: "beforeRequest",
|
|
1174
|
-
type: "vs-code",
|
|
1175
|
-
parse: true,
|
|
1176
|
-
height: "600px"
|
|
1177
|
-
}
|
|
1178
|
-
]
|
|
1179
|
-
},
|
|
1180
|
-
{
|
|
1181
|
-
title: "响应数据裁剪",
|
|
1182
|
-
display: (formState, { model }) => model.type === "http",
|
|
1183
|
-
items: [
|
|
1184
|
-
{
|
|
1185
|
-
name: "afterResponse",
|
|
1186
|
-
type: "vs-code",
|
|
1187
|
-
parse: true,
|
|
1188
|
-
height: "600px"
|
|
1189
|
-
}
|
|
1190
|
-
]
|
|
623
|
+
title: "事件配置",
|
|
624
|
+
items: [
|
|
625
|
+
{
|
|
626
|
+
name: "events",
|
|
627
|
+
src: "datasource",
|
|
628
|
+
type: "event-select"
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
title: "mock数据",
|
|
634
|
+
items: [
|
|
635
|
+
{
|
|
636
|
+
name: "mocks",
|
|
637
|
+
type: "data-source-mocks",
|
|
638
|
+
defaultValue: () => []
|
|
639
|
+
}
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
title: "请求参数裁剪",
|
|
644
|
+
display: (formState, { model }) => model.type === "http",
|
|
645
|
+
items: [
|
|
646
|
+
{
|
|
647
|
+
name: "beforeRequest",
|
|
648
|
+
type: "vs-code",
|
|
649
|
+
parse: true,
|
|
650
|
+
height: "600px"
|
|
651
|
+
}
|
|
652
|
+
]
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
title: "响应数据裁剪",
|
|
656
|
+
display: (formState, { model }) => model.type === "http",
|
|
657
|
+
items: [
|
|
658
|
+
{
|
|
659
|
+
name: "afterResponse",
|
|
660
|
+
type: "vs-code",
|
|
661
|
+
parse: true,
|
|
662
|
+
height: "600px"
|
|
663
|
+
}
|
|
664
|
+
]
|
|
1191
665
|
}
|
|
1192
666
|
]
|
|
1193
667
|
}
|
|
@@ -1297,6 +771,33 @@ const getDisplayField = (dataSources, key) => {
|
|
|
1297
771
|
}
|
|
1298
772
|
return displayState;
|
|
1299
773
|
};
|
|
774
|
+
const getCascaderOptionsFromFields = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
775
|
+
const child = [];
|
|
776
|
+
fields.forEach((field) => {
|
|
777
|
+
if (!dataSourceFieldType.length) {
|
|
778
|
+
dataSourceFieldType.push("any");
|
|
779
|
+
}
|
|
780
|
+
const children = getCascaderOptionsFromFields(field.fields, dataSourceFieldType);
|
|
781
|
+
const item = {
|
|
782
|
+
label: field.title || field.name,
|
|
783
|
+
value: field.name,
|
|
784
|
+
children
|
|
785
|
+
};
|
|
786
|
+
const fieldType = field.type || "any";
|
|
787
|
+
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
788
|
+
child.push(item);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
if (!dataSourceFieldType.includes(fieldType) && !["array", "object", "any"].includes(fieldType)) {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
child.push(item);
|
|
798
|
+
});
|
|
799
|
+
return child;
|
|
800
|
+
};
|
|
1300
801
|
|
|
1301
802
|
const compose = (middleware, isAsync) => {
|
|
1302
803
|
if (!Array.isArray(middleware))
|
|
@@ -2052,6 +1553,13 @@ var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
|
2052
1553
|
ColumnLayout2["RIGHT"] = "right";
|
|
2053
1554
|
return ColumnLayout2;
|
|
2054
1555
|
})(ColumnLayout || {});
|
|
1556
|
+
var SideItemKey = /* @__PURE__ */ ((SideItemKey2) => {
|
|
1557
|
+
SideItemKey2["COMPONENT_LIST"] = "component-list";
|
|
1558
|
+
SideItemKey2["LAYER"] = "layer";
|
|
1559
|
+
SideItemKey2["CODE_BLOCK"] = "code-block";
|
|
1560
|
+
SideItemKey2["DATA_SOURCE"] = "data-source";
|
|
1561
|
+
return SideItemKey2;
|
|
1562
|
+
})(SideItemKey || {});
|
|
2055
1563
|
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
2056
1564
|
LayerOffset2["TOP"] = "top";
|
|
2057
1565
|
LayerOffset2["BOTTOM"] = "bottom";
|
|
@@ -2152,11 +1660,13 @@ const getMiddleTop = (node, parentNode, stage) => {
|
|
|
2152
1660
|
height = 0;
|
|
2153
1661
|
}
|
|
2154
1662
|
const { height: parentHeight } = parentNode.style;
|
|
1663
|
+
const { scrollTop = 0, wrapperHeight } = stage.mask;
|
|
1664
|
+
const wrapperHeightDeal = calcValueByFontsize(stage.renderer.getDocument(), wrapperHeight);
|
|
1665
|
+
const scrollTopDeal = calcValueByFontsize(stage.renderer.getDocument(), scrollTop);
|
|
2155
1666
|
if (isPage(parentNode)) {
|
|
2156
|
-
|
|
2157
|
-
return (wrapperHeight - height) / 2 + scrollTop;
|
|
1667
|
+
return (wrapperHeightDeal - height) / 2 + scrollTopDeal;
|
|
2158
1668
|
}
|
|
2159
|
-
return (parentHeight - height) / 2;
|
|
1669
|
+
return (Math.min(parentHeight, wrapperHeightDeal) - height) / 2;
|
|
2160
1670
|
};
|
|
2161
1671
|
const getInitPositionStyle = (style = {}, layout) => {
|
|
2162
1672
|
if (layout === Layout.ABSOLUTE) {
|
|
@@ -2257,8 +1767,12 @@ const fixNodeLeft = (config, parent, doc) => {
|
|
|
2257
1767
|
const el = doc.getElementById(`${config.id}`);
|
|
2258
1768
|
const parentEl = doc.getElementById(`${parent.id}`);
|
|
2259
1769
|
const left = Number(config.style?.left) || 0;
|
|
2260
|
-
if (el && parentEl
|
|
2261
|
-
|
|
1770
|
+
if (el && parentEl) {
|
|
1771
|
+
const calcParentOffsetWidth = calcValueByFontsize(doc, parentEl.offsetWidth);
|
|
1772
|
+
const calcElOffsetWidth = calcValueByFontsize(doc, el.offsetWidth);
|
|
1773
|
+
if (calcElOffsetWidth + left > calcParentOffsetWidth) {
|
|
1774
|
+
return calcParentOffsetWidth - calcElOffsetWidth;
|
|
1775
|
+
}
|
|
2262
1776
|
}
|
|
2263
1777
|
return config.style.left;
|
|
2264
1778
|
};
|
|
@@ -3345,7 +2859,7 @@ class Editor extends BaseService {
|
|
|
3345
2859
|
const el = doc.getElementById(`${node.id}`);
|
|
3346
2860
|
const parentEl = layout === Layout.FIXED ? doc.body : el?.offsetParent;
|
|
3347
2861
|
if (parentEl && el) {
|
|
3348
|
-
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
|
|
2862
|
+
node.style.left = calcValueByFontsize(doc, (parentEl.clientWidth - el.clientWidth) / 2);
|
|
3349
2863
|
node.style.right = "";
|
|
3350
2864
|
}
|
|
3351
2865
|
} else if (parent.style && isNumber(parent.style?.width) && isNumber(node.style?.width)) {
|
|
@@ -3703,7 +3217,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
3703
3217
|
return newNode;
|
|
3704
3218
|
};
|
|
3705
3219
|
|
|
3706
|
-
const _sfc_main$
|
|
3220
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
3707
3221
|
...{
|
|
3708
3222
|
name: "MEditorCodeParams"
|
|
3709
3223
|
},
|
|
@@ -3753,68 +3267,9 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3753
3267
|
}
|
|
3754
3268
|
});
|
|
3755
3269
|
|
|
3756
|
-
const
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
const codeBlockEditor = ref();
|
|
3760
|
-
const createCodeBlock = async () => {
|
|
3761
|
-
if (!codeBlockService) {
|
|
3762
|
-
tMagicMessage.error("新增代码块失败");
|
|
3763
|
-
return;
|
|
3764
|
-
}
|
|
3765
|
-
codeConfig.value = {
|
|
3766
|
-
name: "",
|
|
3767
|
-
content: `({app, params}) => {
|
|
3768
|
-
// place your code here
|
|
3769
|
-
}`,
|
|
3770
|
-
params: []
|
|
3771
|
-
};
|
|
3772
|
-
codeId.value = await codeBlockService.getUniqueId();
|
|
3773
|
-
await nextTick();
|
|
3774
|
-
codeBlockEditor.value?.show();
|
|
3775
|
-
};
|
|
3776
|
-
const editCode = async (id) => {
|
|
3777
|
-
const codeBlock = await codeBlockService?.getCodeContentById(id);
|
|
3778
|
-
if (!codeBlock) {
|
|
3779
|
-
tMagicMessage.error("获取代码块内容失败");
|
|
3780
|
-
return;
|
|
3781
|
-
}
|
|
3782
|
-
let codeContent = codeBlock.content;
|
|
3783
|
-
if (typeof codeContent !== "string") {
|
|
3784
|
-
codeContent = codeContent.toString();
|
|
3785
|
-
}
|
|
3786
|
-
codeConfig.value = {
|
|
3787
|
-
...cloneDeep(codeBlock),
|
|
3788
|
-
content: codeContent
|
|
3789
|
-
};
|
|
3790
|
-
codeId.value = id;
|
|
3791
|
-
await nextTick();
|
|
3792
|
-
codeBlockEditor.value?.show();
|
|
3793
|
-
};
|
|
3794
|
-
const deleteCode = async (key) => {
|
|
3795
|
-
codeBlockService?.deleteCodeDslByIds([key]);
|
|
3796
|
-
};
|
|
3797
|
-
const submitCodeBlockHandler = async (values) => {
|
|
3798
|
-
if (!codeId.value)
|
|
3799
|
-
return;
|
|
3800
|
-
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3801
|
-
tMagicMessage.success("代码块保存成功");
|
|
3802
|
-
codeBlockEditor.value?.hide();
|
|
3803
|
-
};
|
|
3804
|
-
return {
|
|
3805
|
-
codeId,
|
|
3806
|
-
codeConfig,
|
|
3807
|
-
codeBlockEditor,
|
|
3808
|
-
createCodeBlock,
|
|
3809
|
-
editCode,
|
|
3810
|
-
deleteCode,
|
|
3811
|
-
submitCodeBlockHandler
|
|
3812
|
-
};
|
|
3813
|
-
};
|
|
3814
|
-
|
|
3815
|
-
const _hoisted_1$q = { class: "m-fields-code-select-col" };
|
|
3816
|
-
const _hoisted_2$j = { class: "code-select-container" };
|
|
3817
|
-
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
3270
|
+
const _hoisted_1$s = { class: "m-fields-code-select-col" };
|
|
3271
|
+
const _hoisted_2$k = { class: "code-select-container" };
|
|
3272
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
3818
3273
|
...{
|
|
3819
3274
|
name: "MFieldsCodeSelectCol"
|
|
3820
3275
|
},
|
|
@@ -3834,9 +3289,13 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3834
3289
|
setup(__props, { emit: __emit }) {
|
|
3835
3290
|
const mForm = inject("mForm");
|
|
3836
3291
|
const services = inject("services");
|
|
3292
|
+
const eventBus = inject("eventBus");
|
|
3837
3293
|
const emit = __emit;
|
|
3838
|
-
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
3839
3294
|
const props = __props;
|
|
3295
|
+
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
3296
|
+
const hasCodeBlockSidePanel = computed(
|
|
3297
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.CODE_BLOCK)
|
|
3298
|
+
);
|
|
3840
3299
|
const getParamItemsConfig = (codeId) => {
|
|
3841
3300
|
if (!codeDsl.value || !codeId)
|
|
3842
3301
|
return [];
|
|
@@ -3887,46 +3346,278 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3887
3346
|
props.model.params = value.params;
|
|
3888
3347
|
emit("change", props.model);
|
|
3889
3348
|
};
|
|
3890
|
-
const
|
|
3349
|
+
const editCode = (id) => {
|
|
3350
|
+
eventBus?.emit("edit-code", id);
|
|
3351
|
+
};
|
|
3891
3352
|
return (_ctx, _cache) => {
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
createVNode(_component_m_form_container, {
|
|
3353
|
+
return openBlock(), createElementBlock("div", _hoisted_1$s, [
|
|
3354
|
+
createElementVNode("div", _hoisted_2$k, [
|
|
3355
|
+
createVNode(unref(MContainer), {
|
|
3896
3356
|
class: "select",
|
|
3897
3357
|
config: selectConfig,
|
|
3898
3358
|
model: _ctx.model,
|
|
3899
3359
|
size: _ctx.size,
|
|
3900
3360
|
onChange: onParamsChangeHandler
|
|
3901
3361
|
}, null, 8, ["model", "size"]),
|
|
3902
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(
|
|
3362
|
+
_ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3903
3363
|
key: 0,
|
|
3904
|
-
class: "
|
|
3905
|
-
|
|
3906
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
3907
|
-
},
|
|
3364
|
+
class: "m-fields-select-action-button",
|
|
3365
|
+
size: _ctx.size,
|
|
3366
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editCode(_ctx.model[_ctx.name]))
|
|
3367
|
+
}, {
|
|
3368
|
+
default: withCtx(() => [
|
|
3369
|
+
createVNode(_sfc_main$U, {
|
|
3370
|
+
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
3371
|
+
}, null, 8, ["icon"])
|
|
3372
|
+
]),
|
|
3373
|
+
_: 1
|
|
3374
|
+
}, 8, ["size"])) : createCommentVNode("", true)
|
|
3908
3375
|
]),
|
|
3909
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3376
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$P, {
|
|
3910
3377
|
name: "params",
|
|
3911
3378
|
key: _ctx.model[_ctx.name],
|
|
3912
3379
|
model: _ctx.model,
|
|
3913
3380
|
size: _ctx.size,
|
|
3914
3381
|
"params-config": paramsConfig.value,
|
|
3915
3382
|
onChange: onParamsChangeHandler
|
|
3916
|
-
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true)
|
|
3917
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3918
|
-
key: 1,
|
|
3919
|
-
ref_key: "codeBlockEditor",
|
|
3920
|
-
ref: codeBlockEditor,
|
|
3921
|
-
disabled: notEditable.value,
|
|
3922
|
-
content: unref(codeConfig),
|
|
3923
|
-
onSubmit: unref(submitCodeBlockHandler)
|
|
3924
|
-
}, null, 8, ["disabled", "content", "onSubmit"])) : createCommentVNode("", true)
|
|
3383
|
+
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true)
|
|
3925
3384
|
]);
|
|
3926
3385
|
};
|
|
3927
3386
|
}
|
|
3928
3387
|
});
|
|
3929
3388
|
|
|
3389
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
3390
|
+
__name: "FloatingBox",
|
|
3391
|
+
props: /* @__PURE__ */ mergeModels({
|
|
3392
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
3393
|
+
title: { default: "" },
|
|
3394
|
+
beforeClose: {}
|
|
3395
|
+
}, {
|
|
3396
|
+
"width": { default: 0 },
|
|
3397
|
+
"widthModifiers": {},
|
|
3398
|
+
"height": { default: 0 },
|
|
3399
|
+
"heightModifiers": {},
|
|
3400
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
3401
|
+
"visibleModifiers": {}
|
|
3402
|
+
}),
|
|
3403
|
+
emits: ["update:width", "update:height", "update:visible"],
|
|
3404
|
+
setup(__props, { expose: __expose }) {
|
|
3405
|
+
const width = useModel(__props, "width");
|
|
3406
|
+
const height = useModel(__props, "height");
|
|
3407
|
+
const visible = useModel(__props, "visible");
|
|
3408
|
+
const props = __props;
|
|
3409
|
+
const target = ref();
|
|
3410
|
+
const titleEl = ref();
|
|
3411
|
+
const zIndex = useZIndex();
|
|
3412
|
+
const curZIndex = ref(0);
|
|
3413
|
+
const titleHeight = ref(0);
|
|
3414
|
+
const bodyHeight = computed(() => {
|
|
3415
|
+
if (height.value) {
|
|
3416
|
+
return height.value - titleHeight.value;
|
|
3417
|
+
}
|
|
3418
|
+
if (target.value) {
|
|
3419
|
+
return target.value.clientHeight - titleHeight.value;
|
|
3420
|
+
}
|
|
3421
|
+
return "auto";
|
|
3422
|
+
});
|
|
3423
|
+
const services = inject("services");
|
|
3424
|
+
const frameworkWidth = computed(() => services?.uiService.get("frameworkRect").width || 0);
|
|
3425
|
+
const style = computed(() => {
|
|
3426
|
+
let { left } = props.position;
|
|
3427
|
+
if (width.value) {
|
|
3428
|
+
left = left + width.value > frameworkWidth.value ? frameworkWidth.value - width.value : left;
|
|
3429
|
+
}
|
|
3430
|
+
return {
|
|
3431
|
+
left: `${left}px`,
|
|
3432
|
+
top: `${props.position.top}px`,
|
|
3433
|
+
width: width.value ? `${width.value}px` : "auto",
|
|
3434
|
+
height: height.value ? `${height.value}px` : "auto"
|
|
3435
|
+
};
|
|
3436
|
+
});
|
|
3437
|
+
let moveable = null;
|
|
3438
|
+
const initMoveable = () => {
|
|
3439
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
3440
|
+
className: "m-editor-floating-box-moveable",
|
|
3441
|
+
target: target.value,
|
|
3442
|
+
draggable: true,
|
|
3443
|
+
resizable: true,
|
|
3444
|
+
edge: true,
|
|
3445
|
+
keepRatio: false,
|
|
3446
|
+
origin: false,
|
|
3447
|
+
snappable: true,
|
|
3448
|
+
dragTarget: titleEl.value,
|
|
3449
|
+
dragTargetSelf: false,
|
|
3450
|
+
linePadding: 10,
|
|
3451
|
+
controlPadding: 10,
|
|
3452
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
3453
|
+
});
|
|
3454
|
+
moveable.on("drag", (e) => {
|
|
3455
|
+
e.target.style.transform = e.transform;
|
|
3456
|
+
});
|
|
3457
|
+
moveable.on("resize", (e) => {
|
|
3458
|
+
width.value = e.width;
|
|
3459
|
+
height.value = e.height;
|
|
3460
|
+
e.target.style.width = `${e.width}px`;
|
|
3461
|
+
e.target.style.height = `${e.height}px`;
|
|
3462
|
+
e.target.style.transform = e.drag.transform;
|
|
3463
|
+
});
|
|
3464
|
+
};
|
|
3465
|
+
const destroyMoveable = () => {
|
|
3466
|
+
moveable?.destroy();
|
|
3467
|
+
moveable = null;
|
|
3468
|
+
};
|
|
3469
|
+
watch(
|
|
3470
|
+
visible,
|
|
3471
|
+
async (visible2) => {
|
|
3472
|
+
if (visible2) {
|
|
3473
|
+
await nextTick();
|
|
3474
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3475
|
+
const targetRect = target.value?.getBoundingClientRect();
|
|
3476
|
+
if (targetRect) {
|
|
3477
|
+
width.value = targetRect.width;
|
|
3478
|
+
height.value = targetRect.height;
|
|
3479
|
+
initMoveable();
|
|
3480
|
+
}
|
|
3481
|
+
if (titleEl.value) {
|
|
3482
|
+
const titleRect = titleEl.value.getBoundingClientRect();
|
|
3483
|
+
titleHeight.value = titleRect.height;
|
|
3484
|
+
}
|
|
3485
|
+
} else {
|
|
3486
|
+
destroyMoveable();
|
|
3487
|
+
}
|
|
3488
|
+
},
|
|
3489
|
+
{
|
|
3490
|
+
immediate: true
|
|
3491
|
+
}
|
|
3492
|
+
);
|
|
3493
|
+
onBeforeUnmount(() => {
|
|
3494
|
+
destroyMoveable();
|
|
3495
|
+
});
|
|
3496
|
+
const hide = (cancel) => {
|
|
3497
|
+
if (cancel !== false) {
|
|
3498
|
+
visible.value = false;
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
const closeHandler = () => {
|
|
3502
|
+
if (typeof props.beforeClose === "function") {
|
|
3503
|
+
props.beforeClose(hide);
|
|
3504
|
+
} else {
|
|
3505
|
+
hide();
|
|
3506
|
+
}
|
|
3507
|
+
};
|
|
3508
|
+
const nextZIndex = () => {
|
|
3509
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
3510
|
+
};
|
|
3511
|
+
provide("parentFloating", target);
|
|
3512
|
+
__expose({
|
|
3513
|
+
bodyHeight,
|
|
3514
|
+
target,
|
|
3515
|
+
titleEl
|
|
3516
|
+
});
|
|
3517
|
+
return (_ctx, _cache) => {
|
|
3518
|
+
return visible.value ? (openBlock(), createBlock(Teleport, {
|
|
3519
|
+
key: 0,
|
|
3520
|
+
to: "body"
|
|
3521
|
+
}, [
|
|
3522
|
+
createElementVNode("div", {
|
|
3523
|
+
ref_key: "target",
|
|
3524
|
+
ref: target,
|
|
3525
|
+
class: "m-editor-float-box",
|
|
3526
|
+
style: normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
3527
|
+
onMousedown: nextZIndex
|
|
3528
|
+
}, [
|
|
3529
|
+
createElementVNode("div", {
|
|
3530
|
+
ref_key: "titleEl",
|
|
3531
|
+
ref: titleEl,
|
|
3532
|
+
class: "m-editor-float-box-title"
|
|
3533
|
+
}, [
|
|
3534
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
3535
|
+
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
3536
|
+
]),
|
|
3537
|
+
createElementVNode("div", null, [
|
|
3538
|
+
createVNode(unref(TMagicButton), {
|
|
3539
|
+
link: "",
|
|
3540
|
+
size: "small",
|
|
3541
|
+
onClick: closeHandler
|
|
3542
|
+
}, {
|
|
3543
|
+
default: withCtx(() => [
|
|
3544
|
+
createVNode(_sfc_main$U, { icon: unref(Close) }, null, 8, ["icon"])
|
|
3545
|
+
]),
|
|
3546
|
+
_: 1
|
|
3547
|
+
})
|
|
3548
|
+
])
|
|
3549
|
+
], 512),
|
|
3550
|
+
createElementVNode("div", {
|
|
3551
|
+
class: "m-editor-float-box-body",
|
|
3552
|
+
style: normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
3553
|
+
}, [
|
|
3554
|
+
renderSlot(_ctx.$slots, "body")
|
|
3555
|
+
], 4)
|
|
3556
|
+
], 36)
|
|
3557
|
+
])) : createCommentVNode("", true);
|
|
3558
|
+
};
|
|
3559
|
+
}
|
|
3560
|
+
});
|
|
3561
|
+
|
|
3562
|
+
const useCodeBlockEdit = (codeBlockService) => {
|
|
3563
|
+
const codeConfig = ref();
|
|
3564
|
+
const codeId = ref();
|
|
3565
|
+
const codeBlockEditor = ref();
|
|
3566
|
+
const createCodeBlock = async () => {
|
|
3567
|
+
if (!codeBlockService) {
|
|
3568
|
+
tMagicMessage.error("新增代码块失败");
|
|
3569
|
+
return;
|
|
3570
|
+
}
|
|
3571
|
+
codeConfig.value = {
|
|
3572
|
+
name: "",
|
|
3573
|
+
content: `({app, params}) => {
|
|
3574
|
+
// place your code here
|
|
3575
|
+
}`,
|
|
3576
|
+
params: []
|
|
3577
|
+
};
|
|
3578
|
+
codeId.value = await codeBlockService.getUniqueId();
|
|
3579
|
+
await nextTick();
|
|
3580
|
+
codeBlockEditor.value?.show();
|
|
3581
|
+
};
|
|
3582
|
+
const editCode = async (id) => {
|
|
3583
|
+
const codeBlock = await codeBlockService?.getCodeContentById(id);
|
|
3584
|
+
if (!codeBlock) {
|
|
3585
|
+
tMagicMessage.error("获取代码块内容失败");
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
let codeContent = codeBlock.content;
|
|
3589
|
+
if (typeof codeContent !== "string") {
|
|
3590
|
+
codeContent = codeContent.toString();
|
|
3591
|
+
}
|
|
3592
|
+
codeConfig.value = {
|
|
3593
|
+
...cloneDeep(codeBlock),
|
|
3594
|
+
content: codeContent
|
|
3595
|
+
};
|
|
3596
|
+
codeId.value = id;
|
|
3597
|
+
await nextTick();
|
|
3598
|
+
codeBlockEditor.value?.show();
|
|
3599
|
+
};
|
|
3600
|
+
const deleteCode = async (key) => {
|
|
3601
|
+
codeBlockService?.deleteCodeDslByIds([key]);
|
|
3602
|
+
};
|
|
3603
|
+
const submitCodeBlockHandler = async (values) => {
|
|
3604
|
+
if (!codeId.value)
|
|
3605
|
+
return;
|
|
3606
|
+
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3607
|
+
tMagicMessage.success("代码块保存成功");
|
|
3608
|
+
codeBlockEditor.value?.hide();
|
|
3609
|
+
};
|
|
3610
|
+
return {
|
|
3611
|
+
codeId,
|
|
3612
|
+
codeConfig,
|
|
3613
|
+
codeBlockEditor,
|
|
3614
|
+
createCodeBlock,
|
|
3615
|
+
editCode,
|
|
3616
|
+
deleteCode,
|
|
3617
|
+
submitCodeBlockHandler
|
|
3618
|
+
};
|
|
3619
|
+
};
|
|
3620
|
+
|
|
3930
3621
|
const useDataSourceMethod = () => {
|
|
3931
3622
|
const codeConfig = ref();
|
|
3932
3623
|
const codeBlockEditor = ref();
|
|
@@ -4021,6 +3712,7 @@ const state = reactive({
|
|
|
4021
3712
|
propsPanelSize: "small",
|
|
4022
3713
|
showAddPageButton: true,
|
|
4023
3714
|
hideSlideBar: false,
|
|
3715
|
+
sideBarItems: [],
|
|
4024
3716
|
navMenuRect: {
|
|
4025
3717
|
left: 0,
|
|
4026
3718
|
top: 0,
|
|
@@ -4264,9 +3956,70 @@ const useFloatBox = (slideKeys) => {
|
|
|
4264
3956
|
};
|
|
4265
3957
|
};
|
|
4266
3958
|
|
|
4267
|
-
const
|
|
4268
|
-
const
|
|
4269
|
-
const
|
|
3959
|
+
const useWindowRect = () => {
|
|
3960
|
+
const rect = reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
3961
|
+
const windowResizeHandler = () => {
|
|
3962
|
+
rect.width = globalThis.innerWidth;
|
|
3963
|
+
rect.height = globalThis.innerHeight;
|
|
3964
|
+
};
|
|
3965
|
+
globalThis.addEventListener("resize", windowResizeHandler);
|
|
3966
|
+
onBeforeUnmount(() => {
|
|
3967
|
+
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
3968
|
+
});
|
|
3969
|
+
return {
|
|
3970
|
+
rect
|
|
3971
|
+
};
|
|
3972
|
+
};
|
|
3973
|
+
|
|
3974
|
+
const useEditorContentHeight = () => {
|
|
3975
|
+
const services = inject("services");
|
|
3976
|
+
const frameworkHeight = computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
3977
|
+
const navMenuHeight = computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
3978
|
+
const editorContentHeight = computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
3979
|
+
const height = ref(0);
|
|
3980
|
+
watch(
|
|
3981
|
+
editorContentHeight,
|
|
3982
|
+
() => {
|
|
3983
|
+
if (height.value > 0 && height.value === editorContentHeight.value)
|
|
3984
|
+
return;
|
|
3985
|
+
height.value = editorContentHeight.value;
|
|
3986
|
+
},
|
|
3987
|
+
{
|
|
3988
|
+
immediate: true
|
|
3989
|
+
}
|
|
3990
|
+
);
|
|
3991
|
+
return {
|
|
3992
|
+
height
|
|
3993
|
+
};
|
|
3994
|
+
};
|
|
3995
|
+
|
|
3996
|
+
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
3997
|
+
const boxPosition = ref({
|
|
3998
|
+
left: 0,
|
|
3999
|
+
top: 0
|
|
4000
|
+
});
|
|
4001
|
+
const calcBoxPosition = () => {
|
|
4002
|
+
const columnWidth = uiService?.get("columnWidth");
|
|
4003
|
+
const navMenuRect = uiService?.get("navMenuRect");
|
|
4004
|
+
let left = columnWidth?.left ?? 0;
|
|
4005
|
+
if (parent?.value) {
|
|
4006
|
+
const rect = parent?.value?.getBoundingClientRect();
|
|
4007
|
+
left = (rect?.left ?? 0) + (rect?.width ?? 0);
|
|
4008
|
+
}
|
|
4009
|
+
boxPosition.value = {
|
|
4010
|
+
left,
|
|
4011
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
4012
|
+
};
|
|
4013
|
+
};
|
|
4014
|
+
return {
|
|
4015
|
+
boxPosition,
|
|
4016
|
+
calcBoxPosition
|
|
4017
|
+
};
|
|
4018
|
+
};
|
|
4019
|
+
|
|
4020
|
+
const _hoisted_1$r = { class: "m-editor-data-source-fields" };
|
|
4021
|
+
const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
|
|
4022
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
4270
4023
|
...{
|
|
4271
4024
|
name: "MFieldsDataSourceFields"
|
|
4272
4025
|
},
|
|
@@ -4521,12 +4274,12 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4521
4274
|
const parentFloating = inject("parentFloating", ref(null));
|
|
4522
4275
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4523
4276
|
return (_ctx, _cache) => {
|
|
4524
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4277
|
+
return openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
4525
4278
|
createVNode(unref(MagicTable), {
|
|
4526
4279
|
data: _ctx.model[_ctx.name],
|
|
4527
4280
|
columns: fieldColumns
|
|
4528
4281
|
}, null, 8, ["data"]),
|
|
4529
|
-
createElementVNode("div", _hoisted_2$
|
|
4282
|
+
createElementVNode("div", _hoisted_2$j, [
|
|
4530
4283
|
createVNode(unref(TMagicButton), {
|
|
4531
4284
|
size: "small",
|
|
4532
4285
|
disabled: _ctx.disabled,
|
|
@@ -4551,7 +4304,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4551
4304
|
_: 1
|
|
4552
4305
|
}, 8, ["disabled"])
|
|
4553
4306
|
]),
|
|
4554
|
-
createVNode(_sfc_main$
|
|
4307
|
+
createVNode(_sfc_main$N, {
|
|
4555
4308
|
visible: addDialogVisible.value,
|
|
4556
4309
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
|
4557
4310
|
width: width.value,
|
|
@@ -4574,7 +4327,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4574
4327
|
]),
|
|
4575
4328
|
_: 1
|
|
4576
4329
|
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4577
|
-
createVNode(_sfc_main$
|
|
4330
|
+
createVNode(_sfc_main$N, {
|
|
4578
4331
|
visible: addFromJsonDialogVisible.value,
|
|
4579
4332
|
"onUpdate:visible": _cache[5] || (_cache[5] = ($event) => addFromJsonDialogVisible.value = $event),
|
|
4580
4333
|
width: width.value,
|
|
@@ -4599,115 +4352,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4599
4352
|
}
|
|
4600
4353
|
});
|
|
4601
4354
|
|
|
4602
|
-
const
|
|
4603
|
-
|
|
4604
|
-
const editDialog = ref();
|
|
4605
|
-
const dataSourceValues = ref({});
|
|
4606
|
-
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
4607
|
-
const editHandler = (id) => {
|
|
4608
|
-
if (!editDialog.value)
|
|
4609
|
-
return;
|
|
4610
|
-
dataSourceValues.value = {
|
|
4611
|
-
...dataSourceService?.getDataSourceById(id)
|
|
4612
|
-
};
|
|
4613
|
-
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
4614
|
-
editDialog.value.show();
|
|
4615
|
-
};
|
|
4616
|
-
const submitDataSourceHandler = (value) => {
|
|
4617
|
-
if (value.id) {
|
|
4618
|
-
dataSourceService?.update(value);
|
|
4619
|
-
} else {
|
|
4620
|
-
dataSourceService?.add(value);
|
|
4621
|
-
}
|
|
4622
|
-
editDialog.value?.hide();
|
|
4623
|
-
};
|
|
4624
|
-
return {
|
|
4625
|
-
dialogTitle,
|
|
4626
|
-
editDialog,
|
|
4627
|
-
dataSourceValues,
|
|
4628
|
-
editable,
|
|
4629
|
-
editHandler,
|
|
4630
|
-
submitDataSourceHandler
|
|
4631
|
-
};
|
|
4632
|
-
};
|
|
4633
|
-
|
|
4634
|
-
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
4635
|
-
...{
|
|
4636
|
-
name: "MEditorDataSourceConfigPanel"
|
|
4637
|
-
},
|
|
4638
|
-
__name: "DataSourceConfigPanel",
|
|
4639
|
-
props: /* @__PURE__ */ mergeModels({
|
|
4640
|
-
title: {},
|
|
4641
|
-
values: {},
|
|
4642
|
-
disabled: { type: Boolean }
|
|
4643
|
-
}, {
|
|
4644
|
-
"visible": { type: Boolean, ...{ default: false } },
|
|
4645
|
-
"visibleModifiers": {},
|
|
4646
|
-
"width": { default: 670 },
|
|
4647
|
-
"widthModifiers": {}
|
|
4648
|
-
}),
|
|
4649
|
-
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
4650
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4651
|
-
const props = __props;
|
|
4652
|
-
const boxVisible = useModel(__props, "visible");
|
|
4653
|
-
const width = useModel(__props, "width");
|
|
4654
|
-
const emit = __emit;
|
|
4655
|
-
const services = inject("services");
|
|
4656
|
-
const initValues = ref({});
|
|
4657
|
-
const dataSourceConfig = ref([]);
|
|
4658
|
-
const { height: editorHeight } = useEditorContentHeight();
|
|
4659
|
-
const parentFloating = inject("parentFloating", ref(null));
|
|
4660
|
-
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4661
|
-
watchEffect(() => {
|
|
4662
|
-
initValues.value = props.values;
|
|
4663
|
-
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
4664
|
-
});
|
|
4665
|
-
const submitHandler = (values) => {
|
|
4666
|
-
emit("submit", values);
|
|
4667
|
-
};
|
|
4668
|
-
const errorHandler = (error) => {
|
|
4669
|
-
tMagicMessage.error(error.message);
|
|
4670
|
-
};
|
|
4671
|
-
__expose({
|
|
4672
|
-
show() {
|
|
4673
|
-
calcBoxPosition();
|
|
4674
|
-
boxVisible.value = true;
|
|
4675
|
-
},
|
|
4676
|
-
hide() {
|
|
4677
|
-
boxVisible.value = false;
|
|
4678
|
-
}
|
|
4679
|
-
});
|
|
4680
|
-
return (_ctx, _cache) => {
|
|
4681
|
-
return openBlock(), createBlock(_sfc_main$P, {
|
|
4682
|
-
visible: boxVisible.value,
|
|
4683
|
-
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
4684
|
-
width: width.value,
|
|
4685
|
-
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
4686
|
-
height: unref(editorHeight),
|
|
4687
|
-
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
4688
|
-
title: _ctx.title,
|
|
4689
|
-
position: unref(boxPosition)
|
|
4690
|
-
}, {
|
|
4691
|
-
body: withCtx(() => [
|
|
4692
|
-
createVNode(unref(MFormBox), {
|
|
4693
|
-
"label-width": "80px",
|
|
4694
|
-
title: _ctx.title,
|
|
4695
|
-
config: dataSourceConfig.value,
|
|
4696
|
-
values: initValues.value,
|
|
4697
|
-
disabled: _ctx.disabled,
|
|
4698
|
-
style: { "height": "100%" },
|
|
4699
|
-
onSubmit: submitHandler,
|
|
4700
|
-
onError: errorHandler
|
|
4701
|
-
}, null, 8, ["title", "config", "values", "disabled"])
|
|
4702
|
-
]),
|
|
4703
|
-
_: 1
|
|
4704
|
-
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
4705
|
-
};
|
|
4706
|
-
}
|
|
4707
|
-
});
|
|
4708
|
-
|
|
4709
|
-
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4710
|
-
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
4355
|
+
const _hoisted_1$q = { class: "m-fields-data-source-field-select" };
|
|
4356
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
4711
4357
|
...{
|
|
4712
4358
|
name: "MFieldsDataSourceFieldSelect"
|
|
4713
4359
|
},
|
|
@@ -4726,8 +4372,13 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4726
4372
|
emits: ["change"],
|
|
4727
4373
|
setup(__props, { emit: __emit }) {
|
|
4728
4374
|
const services = inject("services");
|
|
4375
|
+
const eventBus = inject("eventBus");
|
|
4729
4376
|
const emit = __emit;
|
|
4730
4377
|
const props = __props;
|
|
4378
|
+
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
4379
|
+
const hasDataSourceSidePanel = computed(
|
|
4380
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
4381
|
+
);
|
|
4731
4382
|
const selectedDataSourceId = computed(() => {
|
|
4732
4383
|
const value = props.model[props.name];
|
|
4733
4384
|
if (!Array.isArray(value) || !value.length) {
|
|
@@ -4736,33 +4387,6 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4736
4387
|
return value[0].replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, "");
|
|
4737
4388
|
});
|
|
4738
4389
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
4739
|
-
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4740
|
-
const child = [];
|
|
4741
|
-
fields.forEach((field) => {
|
|
4742
|
-
if (!dataSourceFieldType.length) {
|
|
4743
|
-
dataSourceFieldType.push("any");
|
|
4744
|
-
}
|
|
4745
|
-
const children = getOptionChildren(field.fields, dataSourceFieldType);
|
|
4746
|
-
const item = {
|
|
4747
|
-
label: field.title || field.name,
|
|
4748
|
-
value: field.name,
|
|
4749
|
-
children
|
|
4750
|
-
};
|
|
4751
|
-
const fieldType = field.type || "any";
|
|
4752
|
-
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
4753
|
-
child.push(item);
|
|
4754
|
-
return;
|
|
4755
|
-
}
|
|
4756
|
-
if (!dataSourceFieldType.includes(fieldType) && !["array", "object", "any"].includes(fieldType)) {
|
|
4757
|
-
return;
|
|
4758
|
-
}
|
|
4759
|
-
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
4760
|
-
return;
|
|
4761
|
-
}
|
|
4762
|
-
child.push(item);
|
|
4763
|
-
});
|
|
4764
|
-
return child;
|
|
4765
|
-
};
|
|
4766
4390
|
const cascaderConfig = computed(() => {
|
|
4767
4391
|
const valueIsKey = props.config.value === "key";
|
|
4768
4392
|
return {
|
|
@@ -4773,7 +4397,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4773
4397
|
const options = dataSources.value?.map((ds) => ({
|
|
4774
4398
|
label: ds.title || ds.id,
|
|
4775
4399
|
value: valueIsKey ? ds.id : `${DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
4776
|
-
children:
|
|
4400
|
+
children: getCascaderOptionsFromFields(ds.fields, props.config.dataSourceFieldType)
|
|
4777
4401
|
})) || [];
|
|
4778
4402
|
return options.filter((option) => option.children.length);
|
|
4779
4403
|
}
|
|
@@ -4819,13 +4443,12 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4819
4443
|
const onChangeHandler = (value) => {
|
|
4820
4444
|
emit("change", value);
|
|
4821
4445
|
};
|
|
4822
|
-
const
|
|
4823
|
-
|
|
4824
|
-
|
|
4446
|
+
const editHandler = (id) => {
|
|
4447
|
+
eventBus?.emit("edit-data-source", id);
|
|
4448
|
+
};
|
|
4825
4449
|
return (_ctx, _cache) => {
|
|
4826
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4450
|
+
return openBlock(), createElementBlock("div", _hoisted_1$q, [
|
|
4827
4451
|
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
4828
|
-
style: { "width": "100%" },
|
|
4829
4452
|
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
4830
4453
|
model: _ctx.model,
|
|
4831
4454
|
name: _ctx.name,
|
|
@@ -4837,14 +4460,16 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4837
4460
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4838
4461
|
onChange: onChangeHandler
|
|
4839
4462
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4840
|
-
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4463
|
+
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value && hasDataSourceSidePanel.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4841
4464
|
key: 0,
|
|
4842
|
-
|
|
4465
|
+
class: "m-fields-select-action-button",
|
|
4843
4466
|
size: _ctx.size,
|
|
4844
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
4467
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectedDataSourceId.value))
|
|
4845
4468
|
}, {
|
|
4846
4469
|
default: withCtx(() => [
|
|
4847
|
-
createVNode(_sfc_main$U, {
|
|
4470
|
+
createVNode(_sfc_main$U, {
|
|
4471
|
+
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
4472
|
+
}, null, 8, ["icon"])
|
|
4848
4473
|
]),
|
|
4849
4474
|
_: 1
|
|
4850
4475
|
}, 8, ["size"])) : createCommentVNode("", true),
|
|
@@ -4859,24 +4484,16 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4859
4484
|
createVNode(_sfc_main$U, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4860
4485
|
]),
|
|
4861
4486
|
_: 1
|
|
4862
|
-
}, 8, ["type", "size"])) : createCommentVNode("", true)
|
|
4863
|
-
createVNode(_sfc_main$K, {
|
|
4864
|
-
ref_key: "editDialog",
|
|
4865
|
-
ref: editDialog,
|
|
4866
|
-
disabled: !unref(editable),
|
|
4867
|
-
values: unref(dataSourceValues),
|
|
4868
|
-
title: unref(dialogTitle),
|
|
4869
|
-
onSubmit: unref(submitDataSourceHandler)
|
|
4870
|
-
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
4487
|
+
}, 8, ["type", "size"])) : createCommentVNode("", true)
|
|
4871
4488
|
]);
|
|
4872
4489
|
};
|
|
4873
4490
|
}
|
|
4874
4491
|
});
|
|
4875
4492
|
|
|
4876
|
-
const _hoisted_1$
|
|
4877
|
-
const _hoisted_2$
|
|
4878
|
-
const _hoisted_3$
|
|
4879
|
-
const _sfc_main$
|
|
4493
|
+
const _hoisted_1$p = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4494
|
+
const _hoisted_2$i = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4495
|
+
const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
|
|
4496
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
4880
4497
|
...{
|
|
4881
4498
|
name: "MFieldsDataSourceInput"
|
|
4882
4499
|
},
|
|
@@ -4983,138 +4600,435 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4983
4600
|
}
|
|
4984
4601
|
}
|
|
4985
4602
|
}
|
|
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
|
-
);
|
|
4603
|
+
if (curCharIsDot(dotIndex)) {
|
|
4604
|
+
result = fields || [];
|
|
4605
|
+
} else if (dotIndex > -1) {
|
|
4606
|
+
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
4607
|
+
result = fields.filter(
|
|
4608
|
+
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
4609
|
+
) || [];
|
|
4610
|
+
}
|
|
4611
|
+
cb(
|
|
4612
|
+
result.map((field) => ({
|
|
4613
|
+
value: field.name,
|
|
4614
|
+
text: field.title,
|
|
4615
|
+
type: "field"
|
|
4616
|
+
}))
|
|
4617
|
+
);
|
|
4618
|
+
};
|
|
4619
|
+
const querySearch = (queryString, cb) => {
|
|
4620
|
+
inputText = queryString;
|
|
4621
|
+
const selectionStart = getSelectionStart();
|
|
4622
|
+
const curQueryString = queryString.substring(0, selectionStart);
|
|
4623
|
+
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
4624
|
+
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
4625
|
+
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
4626
|
+
if (isFieldTip) {
|
|
4627
|
+
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
4628
|
+
} else {
|
|
4629
|
+
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
4630
|
+
}
|
|
4631
|
+
};
|
|
4632
|
+
const selectHandler = async ({ value, type }) => {
|
|
4633
|
+
const isDataSource = type === "dataSource";
|
|
4634
|
+
const selectionStart = input.value?.selectionStart || 0;
|
|
4635
|
+
let startText = inputText.substring(0, selectionStart);
|
|
4636
|
+
const dotIndex = startText.lastIndexOf(".");
|
|
4637
|
+
const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
|
|
4638
|
+
const endText = inputText.substring(selectionStart);
|
|
4639
|
+
let suggestText = value;
|
|
4640
|
+
if (isDataSource) {
|
|
4641
|
+
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
4642
|
+
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
4643
|
+
}
|
|
4644
|
+
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
4645
|
+
suggestText = `${suggestText}}`;
|
|
4646
|
+
}
|
|
4647
|
+
} else if (!curCharIsDot(dotIndex)) {
|
|
4648
|
+
startText = startText.substring(0, dotIndex + 1);
|
|
4649
|
+
}
|
|
4650
|
+
state.value = `${startText}${suggestText}${endText}`;
|
|
4651
|
+
await nextTick();
|
|
4652
|
+
let newSelectionStart = 0;
|
|
4653
|
+
if (isDataSource) {
|
|
4654
|
+
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
4655
|
+
} else {
|
|
4656
|
+
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4657
|
+
}
|
|
4658
|
+
input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
|
|
4659
|
+
changeHandler(state.value);
|
|
4660
|
+
};
|
|
4661
|
+
return (_ctx, _cache) => {
|
|
4662
|
+
return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getConfig$1)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
|
|
4663
|
+
{
|
|
4664
|
+
key: 0,
|
|
4665
|
+
class: "tmagic-design-auto-complete",
|
|
4666
|
+
ref_key: "autocomplete",
|
|
4667
|
+
ref: autocomplete,
|
|
4668
|
+
modelValue: state.value,
|
|
4669
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
|
|
4670
|
+
},
|
|
4671
|
+
unref(getConfig$1)("components")?.autocomplete.props({
|
|
4672
|
+
disabled: _ctx.disabled,
|
|
4673
|
+
size: _ctx.size,
|
|
4674
|
+
fetchSuggestions: querySearch,
|
|
4675
|
+
triggerOnFocus: false,
|
|
4676
|
+
clearable: true
|
|
4677
|
+
}) || {},
|
|
4678
|
+
{
|
|
4679
|
+
style: { "width": "100%" },
|
|
4680
|
+
onBlur: blurHandler,
|
|
4681
|
+
onInput: inputHandler,
|
|
4682
|
+
onSelect: selectHandler
|
|
4683
|
+
}
|
|
4684
|
+
), {
|
|
4685
|
+
suffix: withCtx(() => [
|
|
4686
|
+
createVNode(_sfc_main$U, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4687
|
+
]),
|
|
4688
|
+
default: withCtx(({ item }) => [
|
|
4689
|
+
createElementVNode("div", _hoisted_1$p, [
|
|
4690
|
+
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
4691
|
+
createElementVNode("span", _hoisted_2$i, toDisplayString(item.value), 1)
|
|
4692
|
+
])
|
|
4693
|
+
]),
|
|
4694
|
+
_: 1
|
|
4695
|
+
}, 16, ["modelValue"])) : (openBlock(), createElementBlock("div", {
|
|
4696
|
+
key: 1,
|
|
4697
|
+
class: normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
4698
|
+
onMouseup: mouseupHandler
|
|
4699
|
+
}, [
|
|
4700
|
+
createElementVNode("div", {
|
|
4701
|
+
class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
4702
|
+
}, [
|
|
4703
|
+
createElementVNode("div", _hoisted_3$8, [
|
|
4704
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
|
|
4705
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
4706
|
+
item.type === "text" ? (openBlock(), createElementBlock("span", {
|
|
4707
|
+
key: index,
|
|
4708
|
+
style: { "margin-right": "2px" }
|
|
4709
|
+
}, toDisplayString(item.value), 1)) : createCommentVNode("", true),
|
|
4710
|
+
item.type === "var" ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
4711
|
+
key: index,
|
|
4712
|
+
size: _ctx.size
|
|
4713
|
+
}, {
|
|
4714
|
+
default: withCtx(() => [
|
|
4715
|
+
createTextVNode(toDisplayString(item.value), 1)
|
|
4716
|
+
]),
|
|
4717
|
+
_: 2
|
|
4718
|
+
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
4719
|
+
], 64);
|
|
4720
|
+
}), 256)),
|
|
4721
|
+
createVNode(_sfc_main$U, {
|
|
4722
|
+
class: "tmagic-data-source-input-icon",
|
|
4723
|
+
icon: unref(Coin)
|
|
4724
|
+
}, null, 8, ["icon"])
|
|
4725
|
+
])
|
|
4726
|
+
], 2)
|
|
4727
|
+
], 34));
|
|
4728
|
+
};
|
|
4729
|
+
}
|
|
4730
|
+
});
|
|
4731
|
+
|
|
4732
|
+
const _hoisted_1$o = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
4733
|
+
const _hoisted_2$h = { style: { "flex": "1" } };
|
|
4734
|
+
const _hoisted_3$7 = { style: { "flex": "1" } };
|
|
4735
|
+
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
4736
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
4737
|
+
...{
|
|
4738
|
+
name: "MEditorCodeBlockEditor"
|
|
4739
|
+
},
|
|
4740
|
+
__name: "CodeBlockEditor",
|
|
4741
|
+
props: /* @__PURE__ */ mergeModels({
|
|
4742
|
+
content: {},
|
|
4743
|
+
disabled: { type: Boolean },
|
|
4744
|
+
isDataSource: { type: Boolean },
|
|
4745
|
+
dataSourceType: {}
|
|
4746
|
+
}, {
|
|
4747
|
+
"width": { default: 670 },
|
|
4748
|
+
"widthModifiers": {},
|
|
4749
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
4750
|
+
"visibleModifiers": {}
|
|
4751
|
+
}),
|
|
4752
|
+
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
4753
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4754
|
+
const width = useModel(__props, "width");
|
|
4755
|
+
const boxVisible = useModel(__props, "visible");
|
|
4756
|
+
const props = __props;
|
|
4757
|
+
const emit = __emit;
|
|
4758
|
+
const services = inject("services");
|
|
4759
|
+
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
4760
|
+
const difVisible = ref(false);
|
|
4761
|
+
const { rect: windowRect } = useWindowRect();
|
|
4762
|
+
const magicVsEditor = ref();
|
|
4763
|
+
const diffChange = () => {
|
|
4764
|
+
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
4765
|
+
return;
|
|
4766
|
+
}
|
|
4767
|
+
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
4768
|
+
difVisible.value = false;
|
|
4769
|
+
};
|
|
4770
|
+
const defaultParamColConfig = {
|
|
4771
|
+
type: "row",
|
|
4772
|
+
label: "参数类型",
|
|
4773
|
+
items: [
|
|
4774
|
+
{
|
|
4775
|
+
text: "参数类型",
|
|
4776
|
+
labelWidth: "70px",
|
|
4777
|
+
type: "select",
|
|
4778
|
+
name: "type",
|
|
4779
|
+
options: [
|
|
4780
|
+
{
|
|
4781
|
+
text: "数字",
|
|
4782
|
+
label: "数字",
|
|
4783
|
+
value: "number"
|
|
4784
|
+
},
|
|
4785
|
+
{
|
|
4786
|
+
text: "字符串",
|
|
4787
|
+
label: "字符串",
|
|
4788
|
+
value: "text"
|
|
4789
|
+
},
|
|
4790
|
+
{
|
|
4791
|
+
text: "组件",
|
|
4792
|
+
label: "组件",
|
|
4793
|
+
value: "ui-select"
|
|
4794
|
+
}
|
|
4795
|
+
]
|
|
4796
|
+
}
|
|
4797
|
+
]
|
|
4798
|
+
};
|
|
4799
|
+
const functionConfig = computed(() => [
|
|
4800
|
+
{
|
|
4801
|
+
text: "名称",
|
|
4802
|
+
name: "name",
|
|
4803
|
+
rules: [{ required: true, message: "请输入名称", trigger: "blur" }]
|
|
4804
|
+
},
|
|
4805
|
+
{
|
|
4806
|
+
text: "描述",
|
|
4807
|
+
name: "desc"
|
|
4808
|
+
},
|
|
4809
|
+
{
|
|
4810
|
+
text: "执行时机",
|
|
4811
|
+
name: "timing",
|
|
4812
|
+
type: "select",
|
|
4813
|
+
options: () => {
|
|
4814
|
+
const options = [
|
|
4815
|
+
{ text: "初始化前", value: "beforeInit" },
|
|
4816
|
+
{ text: "初始化后", value: "afterInit" }
|
|
4817
|
+
];
|
|
4818
|
+
if (props.dataSourceType !== "base") {
|
|
4819
|
+
options.push({ text: "请求前", value: "beforeRequest" });
|
|
4820
|
+
options.push({ text: "请求后", value: "afterRequest" });
|
|
4821
|
+
}
|
|
4822
|
+
return options;
|
|
4823
|
+
},
|
|
4824
|
+
display: () => props.isDataSource
|
|
4825
|
+
},
|
|
4826
|
+
{
|
|
4827
|
+
type: "table",
|
|
4828
|
+
border: true,
|
|
4829
|
+
text: "参数",
|
|
4830
|
+
enableFullscreen: false,
|
|
4831
|
+
enableToggleMode: false,
|
|
4832
|
+
name: "params",
|
|
4833
|
+
dropSort: false,
|
|
4834
|
+
items: [
|
|
4835
|
+
{
|
|
4836
|
+
type: "text",
|
|
4837
|
+
label: "参数名",
|
|
4838
|
+
name: "name"
|
|
4839
|
+
},
|
|
4840
|
+
{
|
|
4841
|
+
type: "text",
|
|
4842
|
+
label: "描述",
|
|
4843
|
+
name: "extra"
|
|
4844
|
+
},
|
|
4845
|
+
services?.codeBlockService.getParamsColConfig() || defaultParamColConfig
|
|
4846
|
+
]
|
|
4847
|
+
},
|
|
4848
|
+
{
|
|
4849
|
+
name: "content",
|
|
4850
|
+
type: "vs-code",
|
|
4851
|
+
options: inject("codeOptions", {}),
|
|
4852
|
+
height: "500px",
|
|
4853
|
+
onChange: (formState, code) => {
|
|
4854
|
+
try {
|
|
4855
|
+
getConfig("parseDSL")(code);
|
|
4856
|
+
return code;
|
|
4857
|
+
} catch (error) {
|
|
4858
|
+
tMagicMessage.error(error.message);
|
|
4859
|
+
throw error;
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
]);
|
|
4864
|
+
const submitForm = (values) => {
|
|
4865
|
+
changedValue.value = void 0;
|
|
4866
|
+
emit("submit", values);
|
|
5001
4867
|
};
|
|
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
|
-
}
|
|
4868
|
+
const errorHandler = (error) => {
|
|
4869
|
+
tMagicMessage.error(error.message);
|
|
5014
4870
|
};
|
|
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 nextTick();
|
|
5035
|
-
let newSelectionStart = 0;
|
|
5036
|
-
if (isDataSource) {
|
|
5037
|
-
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
5038
|
-
} else {
|
|
5039
|
-
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
4871
|
+
const formBox = ref();
|
|
4872
|
+
const changedValue = ref();
|
|
4873
|
+
const changeHandler = (values) => {
|
|
4874
|
+
changedValue.value = values;
|
|
4875
|
+
};
|
|
4876
|
+
const beforeClose = (done) => {
|
|
4877
|
+
if (!changedValue.value) {
|
|
4878
|
+
done();
|
|
4879
|
+
return;
|
|
5040
4880
|
}
|
|
5041
|
-
|
|
5042
|
-
|
|
4881
|
+
tMagicMessageBox.confirm("当前代码块已修改,是否保存?", "提示", {
|
|
4882
|
+
confirmButtonText: "保存并关闭",
|
|
4883
|
+
cancelButtonText: "不保存并关闭",
|
|
4884
|
+
type: "warning",
|
|
4885
|
+
distinguishCancelAndClose: true
|
|
4886
|
+
}).then(() => {
|
|
4887
|
+
changedValue.value && submitForm(changedValue.value);
|
|
4888
|
+
done();
|
|
4889
|
+
}).catch((action) => {
|
|
4890
|
+
done(action === "cancel");
|
|
4891
|
+
});
|
|
4892
|
+
};
|
|
4893
|
+
const closedHandler = () => {
|
|
4894
|
+
changedValue.value = void 0;
|
|
5043
4895
|
};
|
|
4896
|
+
const parentFloating = inject("parentFloating", ref(null));
|
|
4897
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4898
|
+
__expose({
|
|
4899
|
+
async show() {
|
|
4900
|
+
calcBoxPosition();
|
|
4901
|
+
boxVisible.value = true;
|
|
4902
|
+
},
|
|
4903
|
+
async hide() {
|
|
4904
|
+
boxVisible.value = false;
|
|
4905
|
+
}
|
|
4906
|
+
});
|
|
5044
4907
|
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: normalizeClass(`tmagic-data-source-input-text el-input t-input t-size-${_ctx.size?.[0]} el-input--${_ctx.size}`),
|
|
5081
|
-
onMouseup: mouseupHandler
|
|
5082
|
-
}, [
|
|
5083
|
-
createElementVNode("div", {
|
|
5084
|
-
class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
5085
|
-
}, [
|
|
5086
|
-
createElementVNode("div", _hoisted_3$7, [
|
|
5087
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
|
|
5088
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
5089
|
-
item.type === "text" ? (openBlock(), createElementBlock("span", {
|
|
5090
|
-
key: index,
|
|
5091
|
-
style: { "margin-right": "2px" }
|
|
5092
|
-
}, toDisplayString(item.value), 1)) : createCommentVNode("", true),
|
|
5093
|
-
item.type === "var" ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
5094
|
-
key: index,
|
|
5095
|
-
size: _ctx.size
|
|
4908
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
4909
|
+
createVNode(_sfc_main$N, {
|
|
4910
|
+
visible: boxVisible.value,
|
|
4911
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
4912
|
+
width: width.value,
|
|
4913
|
+
"onUpdate:width": _cache[2] || (_cache[2] = ($event) => width.value = $event),
|
|
4914
|
+
height: unref(codeBlockEditorHeight),
|
|
4915
|
+
"onUpdate:height": _cache[3] || (_cache[3] = ($event) => isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
4916
|
+
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
4917
|
+
position: unref(boxPosition),
|
|
4918
|
+
"before-close": beforeClose
|
|
4919
|
+
}, {
|
|
4920
|
+
body: withCtx(() => [
|
|
4921
|
+
createVNode(unref(MFormBox), {
|
|
4922
|
+
class: "m-editor-code-block-editor",
|
|
4923
|
+
ref_key: "formBox",
|
|
4924
|
+
ref: formBox,
|
|
4925
|
+
"label-width": "80px",
|
|
4926
|
+
"close-on-press-escape": false,
|
|
4927
|
+
title: _ctx.content.name,
|
|
4928
|
+
config: functionConfig.value,
|
|
4929
|
+
values: _ctx.content,
|
|
4930
|
+
disabled: _ctx.disabled,
|
|
4931
|
+
style: { "height": "100%" },
|
|
4932
|
+
onChange: changeHandler,
|
|
4933
|
+
onSubmit: submitForm,
|
|
4934
|
+
onError: errorHandler,
|
|
4935
|
+
onClosed: closedHandler
|
|
4936
|
+
}, {
|
|
4937
|
+
left: withCtx(() => [
|
|
4938
|
+
!_ctx.disabled ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4939
|
+
key: 0,
|
|
4940
|
+
type: "primary",
|
|
4941
|
+
link: "",
|
|
4942
|
+
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
5096
4943
|
}, {
|
|
5097
4944
|
default: withCtx(() => [
|
|
5098
|
-
createTextVNode(
|
|
4945
|
+
createTextVNode("查看修改")
|
|
5099
4946
|
]),
|
|
5100
|
-
_:
|
|
5101
|
-
}
|
|
5102
|
-
],
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
4947
|
+
_: 1
|
|
4948
|
+
})) : createCommentVNode("", true)
|
|
4949
|
+
]),
|
|
4950
|
+
_: 1
|
|
4951
|
+
}, 8, ["title", "config", "values", "disabled"])
|
|
4952
|
+
]),
|
|
4953
|
+
_: 1
|
|
4954
|
+
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4955
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4956
|
+
createVNode(unref(TMagicDialog), {
|
|
4957
|
+
title: "查看修改",
|
|
4958
|
+
modelValue: difVisible.value,
|
|
4959
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
4960
|
+
fullscreen: ""
|
|
4961
|
+
}, {
|
|
4962
|
+
footer: withCtx(() => [
|
|
4963
|
+
createElementVNode("span", _hoisted_4$7, [
|
|
4964
|
+
createVNode(unref(TMagicButton), {
|
|
4965
|
+
size: "small",
|
|
4966
|
+
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
4967
|
+
}, {
|
|
4968
|
+
default: withCtx(() => [
|
|
4969
|
+
createTextVNode("取消")
|
|
4970
|
+
]),
|
|
4971
|
+
_: 1
|
|
4972
|
+
}),
|
|
4973
|
+
createVNode(unref(TMagicButton), {
|
|
4974
|
+
size: "small",
|
|
4975
|
+
type: "primary",
|
|
4976
|
+
onClick: diffChange
|
|
4977
|
+
}, {
|
|
4978
|
+
default: withCtx(() => [
|
|
4979
|
+
createTextVNode("确定")
|
|
4980
|
+
]),
|
|
4981
|
+
_: 1
|
|
4982
|
+
})
|
|
4983
|
+
])
|
|
4984
|
+
]),
|
|
4985
|
+
default: withCtx(() => [
|
|
4986
|
+
createElementVNode("div", _hoisted_1$o, [
|
|
4987
|
+
createElementVNode("div", _hoisted_2$h, [
|
|
4988
|
+
createVNode(unref(TMagicTag), {
|
|
4989
|
+
size: "small",
|
|
4990
|
+
type: "info"
|
|
4991
|
+
}, {
|
|
4992
|
+
default: withCtx(() => [
|
|
4993
|
+
createTextVNode("修改前")
|
|
4994
|
+
]),
|
|
4995
|
+
_: 1
|
|
4996
|
+
})
|
|
4997
|
+
]),
|
|
4998
|
+
createElementVNode("div", _hoisted_3$7, [
|
|
4999
|
+
createVNode(unref(TMagicTag), {
|
|
5000
|
+
size: "small",
|
|
5001
|
+
type: "success"
|
|
5002
|
+
}, {
|
|
5003
|
+
default: withCtx(() => [
|
|
5004
|
+
createTextVNode("修改后")
|
|
5005
|
+
]),
|
|
5006
|
+
_: 1
|
|
5007
|
+
})
|
|
5008
|
+
])
|
|
5009
|
+
]),
|
|
5010
|
+
difVisible.value ? (openBlock(), createBlock(_sfc_main$T, {
|
|
5011
|
+
key: 0,
|
|
5012
|
+
ref_key: "magicVsEditor",
|
|
5013
|
+
ref: magicVsEditor,
|
|
5014
|
+
type: "diff",
|
|
5015
|
+
language: "json",
|
|
5016
|
+
initValues: _ctx.content.content,
|
|
5017
|
+
modifiedValues: formBox.value?.form?.values.content,
|
|
5018
|
+
style: normalizeStyle(`height: ${unref(windowRect).height - 150}px`)
|
|
5019
|
+
}, null, 8, ["initValues", "modifiedValues", "style"])) : createCommentVNode("", true)
|
|
5020
|
+
]),
|
|
5021
|
+
_: 1
|
|
5022
|
+
}, 8, ["modelValue"])
|
|
5023
|
+
]))
|
|
5024
|
+
], 64);
|
|
5111
5025
|
};
|
|
5112
5026
|
}
|
|
5113
5027
|
});
|
|
5114
5028
|
|
|
5115
|
-
const _hoisted_1$
|
|
5029
|
+
const _hoisted_1$n = { class: "m-editor-data-source-methods" };
|
|
5116
5030
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
5117
|
-
const _sfc_main$
|
|
5031
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
5118
5032
|
...{
|
|
5119
5033
|
name: "MFieldsDataSourceMethods"
|
|
5120
5034
|
},
|
|
@@ -5184,7 +5098,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5184
5098
|
emit("change", props.model[props.name]);
|
|
5185
5099
|
};
|
|
5186
5100
|
return (_ctx, _cache) => {
|
|
5187
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5101
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
5188
5102
|
createVNode(unref(MagicTable), {
|
|
5189
5103
|
data: _ctx.model[_ctx.name],
|
|
5190
5104
|
columns: methodColumns
|
|
@@ -5203,7 +5117,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5203
5117
|
_: 1
|
|
5204
5118
|
}, 8, ["disabled"])
|
|
5205
5119
|
]),
|
|
5206
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
5120
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$J, {
|
|
5207
5121
|
key: 0,
|
|
5208
5122
|
ref_key: "codeBlockEditor",
|
|
5209
5123
|
ref: codeBlockEditor,
|
|
@@ -5218,9 +5132,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5218
5132
|
}
|
|
5219
5133
|
});
|
|
5220
5134
|
|
|
5221
|
-
const _hoisted_1$
|
|
5135
|
+
const _hoisted_1$m = { class: "m-fields-data-source-method-select" };
|
|
5222
5136
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
5223
|
-
const _sfc_main$
|
|
5137
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
5224
5138
|
...{
|
|
5225
5139
|
name: "MFieldsDataSourceMethodSelect"
|
|
5226
5140
|
},
|
|
@@ -5240,9 +5154,13 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5240
5154
|
setup(__props, { emit: __emit }) {
|
|
5241
5155
|
const mForm = inject("mForm");
|
|
5242
5156
|
const services = inject("services");
|
|
5157
|
+
const eventBus = inject("eventBus");
|
|
5243
5158
|
const emit = __emit;
|
|
5244
5159
|
const dataSourceService = services?.dataSourceService;
|
|
5245
5160
|
const props = __props;
|
|
5161
|
+
const hasDataSourceSidePanel = computed(
|
|
5162
|
+
() => (services?.uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5163
|
+
);
|
|
5246
5164
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
5247
5165
|
const dataSources = computed(() => dataSourceService?.get("dataSources"));
|
|
5248
5166
|
const isCustomMethod = computed(() => {
|
|
@@ -5297,36 +5215,38 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5297
5215
|
props.model.params = value.params;
|
|
5298
5216
|
emit("change", props.model);
|
|
5299
5217
|
};
|
|
5300
|
-
const { codeBlockEditor, codeConfig, editCode, submitCode } = useDataSourceMethod();
|
|
5301
5218
|
const editCodeHandler = () => {
|
|
5302
|
-
const [id
|
|
5219
|
+
const [id] = props.model[props.name];
|
|
5303
5220
|
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5304
5221
|
if (!dataSource)
|
|
5305
5222
|
return;
|
|
5306
|
-
|
|
5307
|
-
setParamsConfig([id, name]);
|
|
5308
|
-
};
|
|
5309
|
-
const submitCodeBlockHandler = (value) => {
|
|
5310
|
-
submitCode(value);
|
|
5223
|
+
eventBus?.emit("edit-data-source", id);
|
|
5311
5224
|
};
|
|
5312
5225
|
return (_ctx, _cache) => {
|
|
5313
|
-
|
|
5314
|
-
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
5226
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
5315
5227
|
createElementVNode("div", _hoisted_2$f, [
|
|
5316
|
-
createVNode(
|
|
5228
|
+
createVNode(unref(MContainer), {
|
|
5317
5229
|
class: "select",
|
|
5318
5230
|
config: cascaderConfig.value,
|
|
5319
5231
|
model: _ctx.model,
|
|
5232
|
+
size: _ctx.size,
|
|
5320
5233
|
onChange: onChangeHandler
|
|
5321
|
-
}, null, 8, ["config", "model"]),
|
|
5322
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(
|
|
5234
|
+
}, null, 8, ["config", "model", "size"]),
|
|
5235
|
+
_ctx.model[_ctx.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5323
5236
|
key: 0,
|
|
5324
|
-
class: "
|
|
5325
|
-
|
|
5237
|
+
class: "m-fields-select-action-button",
|
|
5238
|
+
size: _ctx.size,
|
|
5326
5239
|
onClick: editCodeHandler
|
|
5327
|
-
},
|
|
5240
|
+
}, {
|
|
5241
|
+
default: withCtx(() => [
|
|
5242
|
+
createVNode(_sfc_main$U, {
|
|
5243
|
+
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
5244
|
+
}, null, 8, ["icon"])
|
|
5245
|
+
]),
|
|
5246
|
+
_: 1
|
|
5247
|
+
}, 8, ["size"])) : createCommentVNode("", true)
|
|
5328
5248
|
]),
|
|
5329
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
5249
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$P, {
|
|
5330
5250
|
key: 0,
|
|
5331
5251
|
name: "params",
|
|
5332
5252
|
model: _ctx.model,
|
|
@@ -5334,23 +5254,15 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5334
5254
|
disabled: _ctx.disabled,
|
|
5335
5255
|
"params-config": paramsConfig.value,
|
|
5336
5256
|
onChange: onChangeHandler
|
|
5337
|
-
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true)
|
|
5338
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
5339
|
-
key: 1,
|
|
5340
|
-
ref_key: "codeBlockEditor",
|
|
5341
|
-
ref: codeBlockEditor,
|
|
5342
|
-
disabled: notEditable.value,
|
|
5343
|
-
content: unref(codeConfig),
|
|
5344
|
-
onSubmit: submitCodeBlockHandler
|
|
5345
|
-
}, null, 8, ["disabled", "content"])) : createCommentVNode("", true)
|
|
5257
|
+
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true)
|
|
5346
5258
|
]);
|
|
5347
5259
|
};
|
|
5348
5260
|
}
|
|
5349
5261
|
});
|
|
5350
5262
|
|
|
5351
|
-
const _hoisted_1$
|
|
5263
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
5352
5264
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
5353
|
-
const _sfc_main$
|
|
5265
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
5354
5266
|
...{
|
|
5355
5267
|
name: "MFieldsDataSourceMocks"
|
|
5356
5268
|
},
|
|
@@ -5556,7 +5468,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
5556
5468
|
const parentFloating = inject("parentFloating", ref(null));
|
|
5557
5469
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5558
5470
|
return (_ctx, _cache) => {
|
|
5559
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5471
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
5560
5472
|
createVNode(unref(MagicTable), {
|
|
5561
5473
|
data: _ctx.model[_ctx.name],
|
|
5562
5474
|
columns
|
|
@@ -5575,7 +5487,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
5575
5487
|
_: 1
|
|
5576
5488
|
}, 8, ["disabled"])
|
|
5577
5489
|
]),
|
|
5578
|
-
createVNode(_sfc_main$
|
|
5490
|
+
createVNode(_sfc_main$N, {
|
|
5579
5491
|
visible: addDialogVisible.value,
|
|
5580
5492
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
5581
5493
|
width: width.value,
|
|
@@ -5603,7 +5515,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
5603
5515
|
}
|
|
5604
5516
|
});
|
|
5605
5517
|
|
|
5606
|
-
const
|
|
5518
|
+
const _hoisted_1$k = { class: "m-fields-data-source-select" };
|
|
5519
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5607
5520
|
...{
|
|
5608
5521
|
name: "MFieldsDataSourceSelect"
|
|
5609
5522
|
},
|
|
@@ -5623,8 +5536,14 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
5623
5536
|
setup(__props, { emit: __emit }) {
|
|
5624
5537
|
const emit = __emit;
|
|
5625
5538
|
const props = __props;
|
|
5626
|
-
const
|
|
5539
|
+
const mForm = inject("mForm");
|
|
5540
|
+
const { dataSourceService, uiService } = inject("services") || {};
|
|
5541
|
+
const eventBus = inject("eventBus");
|
|
5627
5542
|
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
5543
|
+
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
5544
|
+
const hasDataSourceSidePanel = computed(
|
|
5545
|
+
() => (uiService?.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE)
|
|
5546
|
+
);
|
|
5628
5547
|
const selectConfig = computed(() => {
|
|
5629
5548
|
const { type, dataSourceType, value, ...config } = props.config;
|
|
5630
5549
|
const valueIsId = props.config.value === "id";
|
|
@@ -5645,17 +5564,42 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
5645
5564
|
const changeHandler = (value) => {
|
|
5646
5565
|
emit("change", value);
|
|
5647
5566
|
};
|
|
5567
|
+
const editHandler = () => {
|
|
5568
|
+
const value = props.model[props.name];
|
|
5569
|
+
if (!value)
|
|
5570
|
+
return;
|
|
5571
|
+
const id = typeof value === "string" ? value : value.dataSourceId;
|
|
5572
|
+
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
5573
|
+
if (!dataSource)
|
|
5574
|
+
return;
|
|
5575
|
+
eventBus?.emit("edit-data-source", id);
|
|
5576
|
+
};
|
|
5648
5577
|
return (_ctx, _cache) => {
|
|
5649
|
-
return openBlock(),
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5578
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
5579
|
+
createVNode(unref(MSelect), {
|
|
5580
|
+
model: _ctx.model,
|
|
5581
|
+
name: _ctx.name,
|
|
5582
|
+
size: _ctx.size,
|
|
5583
|
+
prop: _ctx.prop,
|
|
5584
|
+
disabled: _ctx.disabled,
|
|
5585
|
+
config: selectConfig.value,
|
|
5586
|
+
"last-values": _ctx.lastValues,
|
|
5587
|
+
onChange: changeHandler
|
|
5588
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]),
|
|
5589
|
+
_ctx.model[_ctx.name] && hasDataSourceSidePanel.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5590
|
+
key: 0,
|
|
5591
|
+
class: "m-fields-select-action-button",
|
|
5592
|
+
size: _ctx.size,
|
|
5593
|
+
onClick: editHandler
|
|
5594
|
+
}, {
|
|
5595
|
+
default: withCtx(() => [
|
|
5596
|
+
createVNode(_sfc_main$U, {
|
|
5597
|
+
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
5598
|
+
}, null, 8, ["icon"])
|
|
5599
|
+
]),
|
|
5600
|
+
_: 1
|
|
5601
|
+
}, 8, ["size"])) : createCommentVNode("", true)
|
|
5602
|
+
]);
|
|
5659
5603
|
};
|
|
5660
5604
|
}
|
|
5661
5605
|
});
|
|
@@ -5665,7 +5609,7 @@ const _hoisted_2$d = {
|
|
|
5665
5609
|
key: 1,
|
|
5666
5610
|
class: "fullWidth"
|
|
5667
5611
|
};
|
|
5668
|
-
const _sfc_main$
|
|
5612
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
5669
5613
|
...{
|
|
5670
5614
|
name: "MFieldsEventSelect"
|
|
5671
5615
|
},
|
|
@@ -5691,24 +5635,41 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5691
5635
|
const eventsService = services?.eventsService;
|
|
5692
5636
|
const codeBlockService = services?.codeBlockService;
|
|
5693
5637
|
const eventNameConfig = computed(() => {
|
|
5638
|
+
const fieldType = props.config.src === "component" ? "select" : "cascader";
|
|
5694
5639
|
const defaultEventNameConfig = {
|
|
5695
5640
|
name: "name",
|
|
5696
5641
|
text: "事件",
|
|
5697
|
-
type:
|
|
5642
|
+
type: fieldType,
|
|
5698
5643
|
labelWidth: "40px",
|
|
5644
|
+
checkStrictly: true,
|
|
5645
|
+
valueSeparator: ".",
|
|
5699
5646
|
options: (mForm, { formValue }) => {
|
|
5700
5647
|
let events = [];
|
|
5701
5648
|
if (!eventsService || !dataSourceService)
|
|
5702
5649
|
return events;
|
|
5703
5650
|
if (props.config.src === "component") {
|
|
5704
5651
|
events = eventsService.getEvent(formValue.type);
|
|
5705
|
-
|
|
5652
|
+
return events.map((option) => ({
|
|
5653
|
+
text: option.label,
|
|
5654
|
+
value: option.value
|
|
5655
|
+
}));
|
|
5656
|
+
}
|
|
5657
|
+
if (props.config.src === "datasource") {
|
|
5706
5658
|
events = dataSourceService.getFormEvent(formValue.type);
|
|
5659
|
+
const dataSource = dataSourceService.getDataSourceById(formValue.id);
|
|
5660
|
+
const fields = dataSource?.fields || [];
|
|
5661
|
+
if (fields.length > 0) {
|
|
5662
|
+
return [
|
|
5663
|
+
...events,
|
|
5664
|
+
{
|
|
5665
|
+
label: "数据变化",
|
|
5666
|
+
value: DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX,
|
|
5667
|
+
children: getCascaderOptionsFromFields(fields)
|
|
5668
|
+
}
|
|
5669
|
+
];
|
|
5670
|
+
}
|
|
5671
|
+
return events;
|
|
5707
5672
|
}
|
|
5708
|
-
return events.map((option) => ({
|
|
5709
|
-
text: option.label,
|
|
5710
|
-
value: option.value
|
|
5711
|
-
}));
|
|
5712
5673
|
}
|
|
5713
5674
|
};
|
|
5714
5675
|
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
@@ -5823,6 +5784,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5823
5784
|
]
|
|
5824
5785
|
}));
|
|
5825
5786
|
const actionsConfig = computed(() => ({
|
|
5787
|
+
type: "panel",
|
|
5826
5788
|
items: [
|
|
5827
5789
|
{
|
|
5828
5790
|
type: "group-list",
|
|
@@ -5867,8 +5829,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5867
5829
|
};
|
|
5868
5830
|
return (_ctx, _cache) => {
|
|
5869
5831
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
5870
|
-
const _component_m_form_container = resolveComponent("m-form-container");
|
|
5871
|
-
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
5872
5832
|
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
5873
5833
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
5874
5834
|
key: 0,
|
|
@@ -5893,7 +5853,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5893
5853
|
_: 1
|
|
5894
5854
|
}, 8, ["size", "disabled"]),
|
|
5895
5855
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model[_ctx.name], (cardItem, index) => {
|
|
5896
|
-
return openBlock(), createBlock(
|
|
5856
|
+
return openBlock(), createBlock(unref(MPanel), {
|
|
5897
5857
|
key: index,
|
|
5898
5858
|
disabled: _ctx.disabled,
|
|
5899
5859
|
size: _ctx.size,
|
|
@@ -5903,7 +5863,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5903
5863
|
onChange: onChangeHandler
|
|
5904
5864
|
}, {
|
|
5905
5865
|
header: withCtx(() => [
|
|
5906
|
-
createVNode(
|
|
5866
|
+
createVNode(unref(MContainer), {
|
|
5907
5867
|
class: "fullWidth",
|
|
5908
5868
|
config: eventNameConfig.value,
|
|
5909
5869
|
model: cardItem,
|
|
@@ -5939,7 +5899,7 @@ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
|
|
|
5939
5899
|
const _hoisted_4$6 = [
|
|
5940
5900
|
_hoisted_2$c
|
|
5941
5901
|
];
|
|
5942
|
-
const _sfc_main$
|
|
5902
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
5943
5903
|
...{
|
|
5944
5904
|
name: "MEditorCodeIcon"
|
|
5945
5905
|
},
|
|
@@ -5954,7 +5914,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5954
5914
|
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5955
5915
|
const _hoisted_2$b = { key: 0 };
|
|
5956
5916
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5957
|
-
const _sfc_main$
|
|
5917
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5958
5918
|
...{
|
|
5959
5919
|
name: "MFieldsKeyValue"
|
|
5960
5920
|
},
|
|
@@ -6078,7 +6038,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6078
6038
|
size: "default",
|
|
6079
6039
|
disabled: _ctx.disabled,
|
|
6080
6040
|
link: "",
|
|
6081
|
-
icon: _sfc_main$
|
|
6041
|
+
icon: _sfc_main$D,
|
|
6082
6042
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
6083
6043
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
6084
6044
|
]);
|
|
@@ -6088,7 +6048,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6088
6048
|
|
|
6089
6049
|
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
6090
6050
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
6091
|
-
const _sfc_main$
|
|
6051
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
6092
6052
|
...{
|
|
6093
6053
|
name: "MFieldsPageFragmentSelect"
|
|
6094
6054
|
},
|
|
@@ -6160,7 +6120,7 @@ const _hoisted_1$f = {
|
|
|
6160
6120
|
class: "m-fields-ui-select",
|
|
6161
6121
|
style: { "display": "flex" }
|
|
6162
6122
|
};
|
|
6163
|
-
const _sfc_main$
|
|
6123
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
6164
6124
|
...{
|
|
6165
6125
|
name: "MFieldsUISelect"
|
|
6166
6126
|
},
|
|
@@ -6348,7 +6308,7 @@ const useGetSo = (target, emit) => {
|
|
|
6348
6308
|
};
|
|
6349
6309
|
};
|
|
6350
6310
|
|
|
6351
|
-
const _sfc_main$
|
|
6311
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
6352
6312
|
...{
|
|
6353
6313
|
name: "MEditorResizer"
|
|
6354
6314
|
},
|
|
@@ -6370,7 +6330,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6370
6330
|
}
|
|
6371
6331
|
});
|
|
6372
6332
|
|
|
6373
|
-
const _sfc_main$
|
|
6333
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6374
6334
|
...{
|
|
6375
6335
|
name: "MEditorSplitView"
|
|
6376
6336
|
},
|
|
@@ -6511,7 +6471,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6511
6471
|
}, [
|
|
6512
6472
|
renderSlot(_ctx.$slots, "left")
|
|
6513
6473
|
], 6),
|
|
6514
|
-
createVNode(_sfc_main$
|
|
6474
|
+
createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
6515
6475
|
], 64)) : createCommentVNode("", true),
|
|
6516
6476
|
createElementVNode("div", {
|
|
6517
6477
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6520,7 +6480,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
6520
6480
|
renderSlot(_ctx.$slots, "center")
|
|
6521
6481
|
], 6),
|
|
6522
6482
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6523
|
-
createVNode(_sfc_main$
|
|
6483
|
+
createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
6524
6484
|
createElementVNode("div", {
|
|
6525
6485
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6526
6486
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -6538,7 +6498,7 @@ const _hoisted_1$e = {
|
|
|
6538
6498
|
class: "menu-item-text"
|
|
6539
6499
|
};
|
|
6540
6500
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6541
|
-
const _sfc_main$
|
|
6501
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
6542
6502
|
...{
|
|
6543
6503
|
name: "MEditorToolButton"
|
|
6544
6504
|
},
|
|
@@ -6703,7 +6663,7 @@ const _hoisted_1$d = {
|
|
|
6703
6663
|
key: 1,
|
|
6704
6664
|
style: { "width": "21px" }
|
|
6705
6665
|
};
|
|
6706
|
-
const _sfc_main$
|
|
6666
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
6707
6667
|
...{
|
|
6708
6668
|
name: "MEditorPageBarAddButton"
|
|
6709
6669
|
},
|
|
@@ -6743,7 +6703,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
6743
6703
|
}
|
|
6744
6704
|
});
|
|
6745
6705
|
|
|
6746
|
-
const _sfc_main$
|
|
6706
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
6747
6707
|
...{
|
|
6748
6708
|
name: "MEditorPageBarScrollContainer"
|
|
6749
6709
|
},
|
|
@@ -6872,7 +6832,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6872
6832
|
}
|
|
6873
6833
|
});
|
|
6874
6834
|
|
|
6875
|
-
const _sfc_main$
|
|
6835
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
6876
6836
|
...{
|
|
6877
6837
|
name: "MEditorPageBarSwitchTypeButton"
|
|
6878
6838
|
},
|
|
@@ -6920,7 +6880,7 @@ const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
|
6920
6880
|
const _hoisted_2$8 = ["onClick"];
|
|
6921
6881
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
6922
6882
|
const _hoisted_4$5 = ["title"];
|
|
6923
|
-
const _sfc_main$
|
|
6883
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
6924
6884
|
...{
|
|
6925
6885
|
name: "MEditorPageBar"
|
|
6926
6886
|
},
|
|
@@ -6999,14 +6959,14 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6999
6959
|
};
|
|
7000
6960
|
return (_ctx, _cache) => {
|
|
7001
6961
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
7002
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$
|
|
6962
|
+
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$u, {
|
|
7003
6963
|
key: 0,
|
|
7004
6964
|
modelValue: active.value,
|
|
7005
6965
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
7006
6966
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
7007
|
-
createVNode(_sfc_main$
|
|
6967
|
+
createVNode(_sfc_main$v, { type: active.value }, {
|
|
7008
6968
|
prepend: withCtx(() => [
|
|
7009
|
-
createVNode(_sfc_main$
|
|
6969
|
+
createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
7010
6970
|
]),
|
|
7011
6971
|
default: withCtx(() => [
|
|
7012
6972
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
@@ -7039,7 +6999,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7039
6999
|
default: withCtx(() => [
|
|
7040
7000
|
createElementVNode("div", null, [
|
|
7041
7001
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
7042
|
-
createVNode(_sfc_main$
|
|
7002
|
+
createVNode(_sfc_main$x, {
|
|
7043
7003
|
data: {
|
|
7044
7004
|
type: "button",
|
|
7045
7005
|
text: "复制",
|
|
@@ -7047,7 +7007,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7047
7007
|
handler: () => copy(item)
|
|
7048
7008
|
}
|
|
7049
7009
|
}, null, 8, ["data"]),
|
|
7050
|
-
createVNode(_sfc_main$
|
|
7010
|
+
createVNode(_sfc_main$x, {
|
|
7051
7011
|
data: {
|
|
7052
7012
|
type: "button",
|
|
7053
7013
|
text: "删除",
|
|
@@ -7074,7 +7034,7 @@ const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
|
7074
7034
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
7075
7035
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
7076
7036
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
7077
|
-
const _sfc_main$
|
|
7037
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
7078
7038
|
...{
|
|
7079
7039
|
name: "MEditorAddPageBox"
|
|
7080
7040
|
},
|
|
@@ -7129,7 +7089,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
7129
7089
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
7130
7090
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
7131
7091
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
7132
|
-
const _sfc_main$
|
|
7092
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
7133
7093
|
...{
|
|
7134
7094
|
name: "MEditorFramework"
|
|
7135
7095
|
},
|
|
@@ -7213,7 +7173,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7213
7173
|
options: unref(codeOptions),
|
|
7214
7174
|
onSave: saveCode
|
|
7215
7175
|
}, null, 8, ["init-values", "options"])
|
|
7216
|
-
]) : withDirectives((openBlock(), createBlock(_sfc_main$
|
|
7176
|
+
]) : withDirectives((openBlock(), createBlock(_sfc_main$y, {
|
|
7217
7177
|
key: 1,
|
|
7218
7178
|
"element-loading-text": "Runtime 加载中...",
|
|
7219
7179
|
ref_key: "splitView",
|
|
@@ -7237,10 +7197,10 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7237
7197
|
]),
|
|
7238
7198
|
center: withCtx(() => [
|
|
7239
7199
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7240
|
-
createVNode(_sfc_main$
|
|
7200
|
+
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7241
7201
|
]),
|
|
7242
7202
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7243
|
-
createVNode(_sfc_main$
|
|
7203
|
+
createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
7244
7204
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
7245
7205
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7246
7206
|
]),
|
|
@@ -7275,7 +7235,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7275
7235
|
}
|
|
7276
7236
|
});
|
|
7277
7237
|
|
|
7278
|
-
const _sfc_main$
|
|
7238
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
7279
7239
|
...{
|
|
7280
7240
|
name: "MEditorNavMenu"
|
|
7281
7241
|
},
|
|
@@ -7457,7 +7417,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
7457
7417
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
7458
7418
|
}, [
|
|
7459
7419
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
7460
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7420
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
7461
7421
|
data: item,
|
|
7462
7422
|
key: index
|
|
7463
7423
|
}, null, 8, ["data"]);
|
|
@@ -7470,12 +7430,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
7470
7430
|
});
|
|
7471
7431
|
|
|
7472
7432
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
7473
|
-
const _sfc_main$
|
|
7433
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
7474
7434
|
...{
|
|
7475
7435
|
name: "MEditorPropsPanel"
|
|
7476
7436
|
},
|
|
7477
7437
|
__name: "PropsPanel",
|
|
7478
7438
|
props: {
|
|
7439
|
+
disabledShowSrc: { type: Boolean },
|
|
7479
7440
|
extendState: { type: Function }
|
|
7480
7441
|
},
|
|
7481
7442
|
emits: ["mounted", "submit-error", "form-error"],
|
|
@@ -7536,7 +7497,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7536
7497
|
createVNode(unref(MForm), {
|
|
7537
7498
|
ref_key: "configForm",
|
|
7538
7499
|
ref: configForm,
|
|
7539
|
-
class: normalizeClass(
|
|
7500
|
+
class: normalizeClass(propsPanelSize.value),
|
|
7540
7501
|
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
7541
7502
|
size: propsPanelSize.value,
|
|
7542
7503
|
"init-values": values.value,
|
|
@@ -7545,7 +7506,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7545
7506
|
onChange: submit,
|
|
7546
7507
|
onError: errorHandler
|
|
7547
7508
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"]),
|
|
7548
|
-
|
|
7509
|
+
!_ctx.disabledShowSrc ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
7510
|
+
key: 0,
|
|
7549
7511
|
class: "m-editor-props-panel-src-icon",
|
|
7550
7512
|
circle: "",
|
|
7551
7513
|
size: "large",
|
|
@@ -7557,9 +7519,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7557
7519
|
createVNode(_sfc_main$U, { icon: unref(Document) }, null, 8, ["icon"])
|
|
7558
7520
|
]),
|
|
7559
7521
|
_: 1
|
|
7560
|
-
}, 8, ["type"]),
|
|
7522
|
+
}, 8, ["type"])) : createCommentVNode("", true),
|
|
7561
7523
|
showSrc.value ? (openBlock(), createBlock(_sfc_main$T, {
|
|
7562
|
-
key:
|
|
7524
|
+
key: 1,
|
|
7563
7525
|
height: `${unref(editorContentHeight)}px`,
|
|
7564
7526
|
"init-values": values.value,
|
|
7565
7527
|
options: unref(codeOptions),
|
|
@@ -7573,7 +7535,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7573
7535
|
}
|
|
7574
7536
|
});
|
|
7575
7537
|
|
|
7576
|
-
const _sfc_main$
|
|
7538
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
7577
7539
|
...{
|
|
7578
7540
|
name: "MEditorSearchInput"
|
|
7579
7541
|
},
|
|
@@ -7631,7 +7593,7 @@ const _hoisted_4$3 = {
|
|
|
7631
7593
|
key: 0,
|
|
7632
7594
|
class: "m-editor-tree-node-children"
|
|
7633
7595
|
};
|
|
7634
|
-
const _sfc_main$
|
|
7596
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
7635
7597
|
...{
|
|
7636
7598
|
name: "MEditorTreeNode"
|
|
7637
7599
|
},
|
|
@@ -7752,7 +7714,7 @@ const _hoisted_1$8 = {
|
|
|
7752
7714
|
key: 1,
|
|
7753
7715
|
class: "m-editor-tree-empty"
|
|
7754
7716
|
};
|
|
7755
|
-
const _sfc_main$
|
|
7717
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
7756
7718
|
...{
|
|
7757
7719
|
name: "MEditorTree"
|
|
7758
7720
|
},
|
|
@@ -7776,7 +7738,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7776
7738
|
onDragover: handleDragOver
|
|
7777
7739
|
}, [
|
|
7778
7740
|
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
7779
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7741
|
+
return openBlock(), createBlock(_sfc_main$n, {
|
|
7780
7742
|
key: item.id,
|
|
7781
7743
|
data: item,
|
|
7782
7744
|
indent: _ctx.indent,
|
|
@@ -7873,7 +7835,7 @@ const useNodeStatus$1 = (nodeData) => {
|
|
|
7873
7835
|
};
|
|
7874
7836
|
};
|
|
7875
7837
|
|
|
7876
|
-
const _sfc_main$
|
|
7838
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
7877
7839
|
...{
|
|
7878
7840
|
name: "MEditorCodeBlockList"
|
|
7879
7841
|
},
|
|
@@ -7955,7 +7917,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7955
7917
|
filter: filterTextChangeHandler
|
|
7956
7918
|
});
|
|
7957
7919
|
return (_ctx, _cache) => {
|
|
7958
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7920
|
+
return openBlock(), createBlock(_sfc_main$m, {
|
|
7959
7921
|
data: codeList.value,
|
|
7960
7922
|
"node-status-map": unref(nodeStatusMap),
|
|
7961
7923
|
onNodeClick: clickHandler
|
|
@@ -8012,7 +7974,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
8012
7974
|
});
|
|
8013
7975
|
|
|
8014
7976
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
8015
|
-
const _sfc_main$
|
|
7977
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
8016
7978
|
...{
|
|
8017
7979
|
name: "MEditorCodeBlockListPanel"
|
|
8018
7980
|
},
|
|
@@ -8021,6 +7983,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8021
7983
|
customError: { type: Function }
|
|
8022
7984
|
},
|
|
8023
7985
|
setup(__props) {
|
|
7986
|
+
const eventBus = inject("eventBus");
|
|
8024
7987
|
const { codeBlockService } = inject("services") || {};
|
|
8025
7988
|
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
8026
7989
|
const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
@@ -8028,13 +7991,16 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8028
7991
|
const filterTextChangeHandler = (val) => {
|
|
8029
7992
|
codeBlockList.value?.filter(val);
|
|
8030
7993
|
};
|
|
7994
|
+
eventBus?.on("edit-code", (id) => {
|
|
7995
|
+
editCode(id);
|
|
7996
|
+
});
|
|
8031
7997
|
return (_ctx, _cache) => {
|
|
8032
7998
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8033
7999
|
createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
8034
8000
|
default: withCtx(() => [
|
|
8035
8001
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
8036
8002
|
createElementVNode("div", _hoisted_1$7, [
|
|
8037
|
-
createVNode(_sfc_main$
|
|
8003
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8038
8004
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
8039
8005
|
key: 0,
|
|
8040
8006
|
class: "create-code-button",
|
|
@@ -8050,7 +8016,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8050
8016
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
8051
8017
|
])
|
|
8052
8018
|
]),
|
|
8053
|
-
createVNode(_sfc_main$
|
|
8019
|
+
createVNode(_sfc_main$l, {
|
|
8054
8020
|
ref_key: "codeBlockList",
|
|
8055
8021
|
ref: codeBlockList,
|
|
8056
8022
|
"custom-error": _ctx.customError,
|
|
@@ -8068,7 +8034,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8068
8034
|
]),
|
|
8069
8035
|
_: 3
|
|
8070
8036
|
}),
|
|
8071
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
8037
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$J, {
|
|
8072
8038
|
key: 0,
|
|
8073
8039
|
ref_key: "codeBlockEditor",
|
|
8074
8040
|
ref: codeBlockEditor,
|
|
@@ -8081,6 +8047,113 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8081
8047
|
}
|
|
8082
8048
|
});
|
|
8083
8049
|
|
|
8050
|
+
const useDataSourceEdit = (dataSourceService) => {
|
|
8051
|
+
const dialogTitle = ref("");
|
|
8052
|
+
const editDialog = ref();
|
|
8053
|
+
const dataSourceValues = ref({});
|
|
8054
|
+
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
8055
|
+
const editHandler = (id) => {
|
|
8056
|
+
if (!editDialog.value)
|
|
8057
|
+
return;
|
|
8058
|
+
dataSourceValues.value = {
|
|
8059
|
+
...dataSourceService?.getDataSourceById(id)
|
|
8060
|
+
};
|
|
8061
|
+
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8062
|
+
editDialog.value.show();
|
|
8063
|
+
};
|
|
8064
|
+
const submitDataSourceHandler = (value) => {
|
|
8065
|
+
if (value.id) {
|
|
8066
|
+
dataSourceService?.update(value);
|
|
8067
|
+
} else {
|
|
8068
|
+
dataSourceService?.add(value);
|
|
8069
|
+
}
|
|
8070
|
+
editDialog.value?.hide();
|
|
8071
|
+
};
|
|
8072
|
+
return {
|
|
8073
|
+
dialogTitle,
|
|
8074
|
+
editDialog,
|
|
8075
|
+
dataSourceValues,
|
|
8076
|
+
editable,
|
|
8077
|
+
editHandler,
|
|
8078
|
+
submitDataSourceHandler
|
|
8079
|
+
};
|
|
8080
|
+
};
|
|
8081
|
+
|
|
8082
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
8083
|
+
...{
|
|
8084
|
+
name: "MEditorDataSourceConfigPanel"
|
|
8085
|
+
},
|
|
8086
|
+
__name: "DataSourceConfigPanel",
|
|
8087
|
+
props: /* @__PURE__ */ mergeModels({
|
|
8088
|
+
title: {},
|
|
8089
|
+
values: {},
|
|
8090
|
+
disabled: { type: Boolean }
|
|
8091
|
+
}, {
|
|
8092
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
8093
|
+
"visibleModifiers": {},
|
|
8094
|
+
"width": { default: 670 },
|
|
8095
|
+
"widthModifiers": {}
|
|
8096
|
+
}),
|
|
8097
|
+
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
8098
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8099
|
+
const props = __props;
|
|
8100
|
+
const boxVisible = useModel(__props, "visible");
|
|
8101
|
+
const width = useModel(__props, "width");
|
|
8102
|
+
const emit = __emit;
|
|
8103
|
+
const services = inject("services");
|
|
8104
|
+
const initValues = ref({});
|
|
8105
|
+
const dataSourceConfig = ref([]);
|
|
8106
|
+
const { height: editorHeight } = useEditorContentHeight();
|
|
8107
|
+
const parentFloating = inject("parentFloating", ref(null));
|
|
8108
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
8109
|
+
watchEffect(() => {
|
|
8110
|
+
initValues.value = props.values;
|
|
8111
|
+
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
8112
|
+
});
|
|
8113
|
+
const submitHandler = (values) => {
|
|
8114
|
+
emit("submit", values);
|
|
8115
|
+
};
|
|
8116
|
+
const errorHandler = (error) => {
|
|
8117
|
+
tMagicMessage.error(error.message);
|
|
8118
|
+
};
|
|
8119
|
+
__expose({
|
|
8120
|
+
show() {
|
|
8121
|
+
calcBoxPosition();
|
|
8122
|
+
boxVisible.value = true;
|
|
8123
|
+
},
|
|
8124
|
+
hide() {
|
|
8125
|
+
boxVisible.value = false;
|
|
8126
|
+
}
|
|
8127
|
+
});
|
|
8128
|
+
return (_ctx, _cache) => {
|
|
8129
|
+
return openBlock(), createBlock(_sfc_main$N, {
|
|
8130
|
+
visible: boxVisible.value,
|
|
8131
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
8132
|
+
width: width.value,
|
|
8133
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
8134
|
+
height: unref(editorHeight),
|
|
8135
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
8136
|
+
title: _ctx.title,
|
|
8137
|
+
position: unref(boxPosition)
|
|
8138
|
+
}, {
|
|
8139
|
+
body: withCtx(() => [
|
|
8140
|
+
createVNode(unref(MFormBox), {
|
|
8141
|
+
"label-width": "80px",
|
|
8142
|
+
title: _ctx.title,
|
|
8143
|
+
config: dataSourceConfig.value,
|
|
8144
|
+
values: initValues.value,
|
|
8145
|
+
disabled: _ctx.disabled,
|
|
8146
|
+
style: { "height": "100%" },
|
|
8147
|
+
onSubmit: submitHandler,
|
|
8148
|
+
onError: errorHandler
|
|
8149
|
+
}, null, 8, ["title", "config", "values", "disabled"])
|
|
8150
|
+
]),
|
|
8151
|
+
_: 1
|
|
8152
|
+
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
8153
|
+
};
|
|
8154
|
+
}
|
|
8155
|
+
});
|
|
8156
|
+
|
|
8084
8157
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
8085
8158
|
...{
|
|
8086
8159
|
name: "MEditorDataSourceList"
|
|
@@ -8170,7 +8243,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8170
8243
|
filter: filterTextChangeHandler
|
|
8171
8244
|
});
|
|
8172
8245
|
return (_ctx, _cache) => {
|
|
8173
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8246
|
+
return openBlock(), createBlock(_sfc_main$m, {
|
|
8174
8247
|
data: list.value,
|
|
8175
8248
|
"node-status-map": unref(nodeStatusMap),
|
|
8176
8249
|
onNodeClick: clickHandler
|
|
@@ -8231,6 +8304,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8231
8304
|
},
|
|
8232
8305
|
__name: "DataSourceListPanel",
|
|
8233
8306
|
setup(__props) {
|
|
8307
|
+
const eventBus = inject("eventBus");
|
|
8234
8308
|
const { dataSourceService } = inject("services") || {};
|
|
8235
8309
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
8236
8310
|
const datasourceTypeList = computed(
|
|
@@ -8262,12 +8336,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8262
8336
|
const filterTextChangeHandler = (val) => {
|
|
8263
8337
|
dataSourceList.value?.filter(val);
|
|
8264
8338
|
};
|
|
8339
|
+
eventBus?.on("edit-data-source", (id) => {
|
|
8340
|
+
editHandler(id);
|
|
8341
|
+
});
|
|
8265
8342
|
return (_ctx, _cache) => {
|
|
8266
8343
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8267
8344
|
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8268
8345
|
default: withCtx(() => [
|
|
8269
8346
|
createElementVNode("div", _hoisted_1$6, [
|
|
8270
|
-
createVNode(_sfc_main$
|
|
8347
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8271
8348
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
8272
8349
|
key: 0,
|
|
8273
8350
|
placement: "right"
|
|
@@ -8286,7 +8363,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8286
8363
|
default: withCtx(() => [
|
|
8287
8364
|
createElementVNode("div", _hoisted_2$5, [
|
|
8288
8365
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
8289
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8366
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
8290
8367
|
data: {
|
|
8291
8368
|
type: "button",
|
|
8292
8369
|
text: item.text,
|
|
@@ -8312,7 +8389,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8312
8389
|
]),
|
|
8313
8390
|
_: 3
|
|
8314
8391
|
}),
|
|
8315
|
-
createVNode(_sfc_main$
|
|
8392
|
+
createVNode(_sfc_main$j, {
|
|
8316
8393
|
ref_key: "editDialog",
|
|
8317
8394
|
ref: editDialog,
|
|
8318
8395
|
disabled: !unref(editable),
|
|
@@ -8456,7 +8533,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
8456
8533
|
renderSlot(_ctx.$slots, "title"),
|
|
8457
8534
|
createElementVNode("div", null, [
|
|
8458
8535
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
8459
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8536
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
8460
8537
|
"event-type": "mouseup",
|
|
8461
8538
|
ref_for: true,
|
|
8462
8539
|
ref_key: "buttons",
|
|
@@ -8558,8 +8635,8 @@ const usePasteMenu = (menu) => ({
|
|
|
8558
8635
|
const stage = services?.editorService?.get("stage");
|
|
8559
8636
|
const rect = menu.value.$el.getBoundingClientRect();
|
|
8560
8637
|
const parentRect = stage?.container?.getBoundingClientRect();
|
|
8561
|
-
const initialLeft = (rect.left || 0) - (parentRect?.left || 0);
|
|
8562
|
-
const initialTop = (rect.top || 0) - (parentRect?.top || 0);
|
|
8638
|
+
const initialLeft = calcValueByFontsize(stage?.renderer.getDocument(), (rect.left || 0) - (parentRect?.left || 0)) / services.uiService.get("zoom");
|
|
8639
|
+
const initialTop = calcValueByFontsize(stage?.renderer.getDocument(), (rect.top || 0) - (parentRect?.top || 0)) / services.uiService.get("zoom");
|
|
8563
8640
|
services?.editorService?.paste({ left: initialLeft, top: initialTop });
|
|
8564
8641
|
} else {
|
|
8565
8642
|
services?.editorService?.paste();
|
|
@@ -9232,8 +9309,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
9232
9309
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9233
9310
|
default: withCtx(() => [
|
|
9234
9311
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9235
|
-
createVNode(_sfc_main$
|
|
9236
|
-
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$
|
|
9312
|
+
createVNode(_sfc_main$o, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
9313
|
+
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
9237
9314
|
key: 0,
|
|
9238
9315
|
tabindex: "-1",
|
|
9239
9316
|
ref_key: "tree",
|
|
@@ -9359,7 +9436,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
9359
9436
|
"model-value": collapseValue.value
|
|
9360
9437
|
}, {
|
|
9361
9438
|
default: withCtx(() => [
|
|
9362
|
-
createVNode(_sfc_main$
|
|
9439
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
9363
9440
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
9364
9441
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
9365
9442
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -9432,7 +9509,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9432
9509
|
},
|
|
9433
9510
|
__name: "Sidebar",
|
|
9434
9511
|
props: {
|
|
9435
|
-
data: { default: () => ({
|
|
9512
|
+
data: { default: () => ({
|
|
9513
|
+
type: "tabs",
|
|
9514
|
+
status: "组件",
|
|
9515
|
+
items: [SideItemKey.COMPONENT_LIST, SideItemKey.LAYER, SideItemKey.CODE_BLOCK, SideItemKey.DATA_SOURCE]
|
|
9516
|
+
}) },
|
|
9436
9517
|
layerContentMenu: {},
|
|
9437
9518
|
customContentMenu: {}
|
|
9438
9519
|
},
|
|
@@ -9444,8 +9525,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9444
9525
|
const activeTabName = ref(props.data?.status);
|
|
9445
9526
|
const getItemConfig = (data) => {
|
|
9446
9527
|
const map = {
|
|
9447
|
-
|
|
9448
|
-
$key:
|
|
9528
|
+
[SideItemKey.COMPONENT_LIST]: {
|
|
9529
|
+
$key: SideItemKey.COMPONENT_LIST,
|
|
9449
9530
|
type: "component",
|
|
9450
9531
|
icon: Goods,
|
|
9451
9532
|
text: "组件",
|
|
@@ -9464,16 +9545,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9464
9545
|
component: _sfc_main$c,
|
|
9465
9546
|
slots: {}
|
|
9466
9547
|
},
|
|
9467
|
-
|
|
9548
|
+
[SideItemKey.CODE_BLOCK]: {
|
|
9468
9549
|
$key: "code-block",
|
|
9469
9550
|
type: "component",
|
|
9470
9551
|
icon: EditPen,
|
|
9471
9552
|
text: "代码编辑",
|
|
9472
|
-
component: _sfc_main$
|
|
9553
|
+
component: _sfc_main$k,
|
|
9473
9554
|
slots: {}
|
|
9474
9555
|
},
|
|
9475
|
-
|
|
9476
|
-
$key:
|
|
9556
|
+
[SideItemKey.DATA_SOURCE]: {
|
|
9557
|
+
$key: SideItemKey.DATA_SOURCE,
|
|
9477
9558
|
type: "component",
|
|
9478
9559
|
icon: Coin,
|
|
9479
9560
|
text: "数据源",
|
|
@@ -9484,6 +9565,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9484
9565
|
return typeof data === "string" ? map[data] : data;
|
|
9485
9566
|
};
|
|
9486
9567
|
const sideBarItems = computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
9568
|
+
watch(
|
|
9569
|
+
sideBarItems,
|
|
9570
|
+
(items) => {
|
|
9571
|
+
services?.uiService.set("sideBarItems", items);
|
|
9572
|
+
},
|
|
9573
|
+
{
|
|
9574
|
+
immediate: true
|
|
9575
|
+
}
|
|
9576
|
+
);
|
|
9487
9577
|
watch(
|
|
9488
9578
|
() => props.data.status,
|
|
9489
9579
|
(status) => {
|
|
@@ -9522,7 +9612,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9522
9612
|
class: normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
9523
9613
|
draggable: "true",
|
|
9524
9614
|
key: config.$key ?? index,
|
|
9525
|
-
|
|
9615
|
+
style: normalizeStyle(config.tabStyle || {}),
|
|
9616
|
+
onClick: ($event) => activeTabName.value = config.text || config.$key || `${index}`,
|
|
9526
9617
|
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
9527
9618
|
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
9528
9619
|
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
@@ -9532,7 +9623,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9532
9623
|
icon: config.icon
|
|
9533
9624
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
9534
9625
|
config.text ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
9535
|
-
],
|
|
9626
|
+
], 46, _hoisted_3$1)), [
|
|
9536
9627
|
[vShow, !unref(floatBoxStates)[config.$key]?.status]
|
|
9537
9628
|
]);
|
|
9538
9629
|
}), 128))
|
|
@@ -9542,7 +9633,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9542
9633
|
class: "m-editor-sidebar-content",
|
|
9543
9634
|
key: config.$key ?? index
|
|
9544
9635
|
}, [
|
|
9545
|
-
config && !unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
|
|
9636
|
+
config && !unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
|
|
9637
|
+
key: 0,
|
|
9638
|
+
ref_for: true
|
|
9639
|
+
}, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
|
|
9546
9640
|
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
9547
9641
|
name: "component-list-panel-header",
|
|
9548
9642
|
fn: withCtx(() => [
|
|
@@ -9653,14 +9747,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9653
9747
|
} : void 0
|
|
9654
9748
|
]), 1040)) : createCommentVNode("", true)
|
|
9655
9749
|
])), [
|
|
9656
|
-
[vShow,
|
|
9750
|
+
[vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
|
|
9657
9751
|
]);
|
|
9658
9752
|
}), 128))
|
|
9659
9753
|
])) : createCommentVNode("", true),
|
|
9660
9754
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
9661
9755
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
9662
9756
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
9663
|
-
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$
|
|
9757
|
+
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$N, {
|
|
9664
9758
|
key: config.$key ?? index,
|
|
9665
9759
|
visible: unref(floatBoxStates)[config.$key].status,
|
|
9666
9760
|
"onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -9675,7 +9769,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9675
9769
|
}, {
|
|
9676
9770
|
body: withCtx(() => [
|
|
9677
9771
|
createElementVNode("div", _hoisted_5$1, [
|
|
9678
|
-
config && unref(floatBoxStates)[config.$key].status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
|
|
9772
|
+
config && unref(floatBoxStates)[config.$key].status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
|
|
9773
|
+
key: 0,
|
|
9774
|
+
ref_for: true
|
|
9775
|
+
}, config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
|
|
9679
9776
|
])
|
|
9680
9777
|
]),
|
|
9681
9778
|
_: 2
|
|
@@ -10093,7 +10190,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10093
10190
|
]),
|
|
10094
10191
|
_: 1
|
|
10095
10192
|
})) : createCommentVNode("", true),
|
|
10096
|
-
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
10193
|
+
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$N, {
|
|
10097
10194
|
key: 1,
|
|
10098
10195
|
ref_key: "box",
|
|
10099
10196
|
ref: box,
|
|
@@ -10103,7 +10200,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10103
10200
|
position: menuPosition.value
|
|
10104
10201
|
}, {
|
|
10105
10202
|
body: withCtx(() => [
|
|
10106
|
-
createVNode(_sfc_main$
|
|
10203
|
+
createVNode(_sfc_main$m, {
|
|
10107
10204
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10108
10205
|
data: nodeData.value,
|
|
10109
10206
|
"node-status-map": unref(nodeStatusMap),
|
|
@@ -10496,17 +10593,17 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10496
10593
|
position = "absolute";
|
|
10497
10594
|
top = e.clientY - containerRect.top + scrollTop;
|
|
10498
10595
|
left = e.clientX - containerRect.left + scrollLeft;
|
|
10499
|
-
if (parentEl
|
|
10596
|
+
if (parentEl) {
|
|
10500
10597
|
const { left: parentLeft, top: parentTop } = getOffset(parentEl);
|
|
10501
|
-
left = left -
|
|
10502
|
-
top = top -
|
|
10598
|
+
left = left - parentLeft * zoom.value;
|
|
10599
|
+
top = top - parentTop * zoom.value;
|
|
10503
10600
|
}
|
|
10504
10601
|
}
|
|
10505
10602
|
config.data.style = {
|
|
10506
10603
|
...style,
|
|
10507
10604
|
position,
|
|
10508
|
-
top: top / zoom.value,
|
|
10509
|
-
left: left / zoom.value
|
|
10605
|
+
top: calcValueByFontsize(doc, top / zoom.value),
|
|
10606
|
+
left: calcValueByFontsize(doc, left / zoom.value)
|
|
10510
10607
|
};
|
|
10511
10608
|
config.data.inputEvent = e;
|
|
10512
10609
|
services?.editorService.add(config.data, parent);
|
|
@@ -11253,6 +11350,7 @@ const defaultEditorProps = {
|
|
|
11253
11350
|
containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
11254
11351
|
containerHighlightDuration: 800,
|
|
11255
11352
|
containerHighlightType: ContainerHighlightType.DEFAULT,
|
|
11353
|
+
disabledShowSrc: false,
|
|
11256
11354
|
componentGroupList: () => [],
|
|
11257
11355
|
datasourceList: () => [],
|
|
11258
11356
|
menu: () => ({ left: [], right: [] }),
|
|
@@ -11634,6 +11732,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11634
11732
|
disabledMultiSelect: { type: Boolean },
|
|
11635
11733
|
disabledPageFragment: { type: Boolean },
|
|
11636
11734
|
disabledStageOverlay: { type: Boolean },
|
|
11735
|
+
disabledShowSrc: { type: Boolean },
|
|
11637
11736
|
render: { type: Function },
|
|
11638
11737
|
updateDragEl: { type: Function },
|
|
11639
11738
|
canSelect: { type: Function },
|
|
@@ -11683,15 +11782,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11683
11782
|
provide("services", services);
|
|
11684
11783
|
provide("codeOptions", props.codeOptions);
|
|
11685
11784
|
provide("stageOptions", stageOptions);
|
|
11785
|
+
provide("eventBus", new EventEmitter());
|
|
11686
11786
|
__expose(services);
|
|
11687
11787
|
return (_ctx, _cache) => {
|
|
11688
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11788
|
+
return openBlock(), createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11689
11789
|
header: withCtx(() => [
|
|
11690
11790
|
renderSlot(_ctx.$slots, "header")
|
|
11691
11791
|
]),
|
|
11692
11792
|
nav: withCtx(() => [
|
|
11693
11793
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
11694
|
-
createVNode(_sfc_main$
|
|
11794
|
+
createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11695
11795
|
])
|
|
11696
11796
|
]),
|
|
11697
11797
|
"content-before": withCtx(() => [
|
|
@@ -11766,8 +11866,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11766
11866
|
]),
|
|
11767
11867
|
"props-panel": withCtx(() => [
|
|
11768
11868
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11769
|
-
createVNode(_sfc_main$
|
|
11869
|
+
createVNode(_sfc_main$p, {
|
|
11770
11870
|
"extend-state": _ctx.extendFormState,
|
|
11871
|
+
"disabled-show-src": _ctx.disabledShowSrc,
|
|
11771
11872
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11772
11873
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
11773
11874
|
onSubmitError: _cache[2] || (_cache[2] = (e) => _ctx.$emit("props-submit-error", e))
|
|
@@ -11776,7 +11877,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11776
11877
|
renderSlot(_ctx.$slots, "props-panel-header")
|
|
11777
11878
|
]),
|
|
11778
11879
|
_: 3
|
|
11779
|
-
}, 8, ["extend-state"])
|
|
11880
|
+
}, 8, ["extend-state", "disabled-show-src"])
|
|
11780
11881
|
])
|
|
11781
11882
|
]),
|
|
11782
11883
|
empty: withCtx(() => [
|
|
@@ -11814,22 +11915,22 @@ const index = {
|
|
|
11814
11915
|
setConfig(option);
|
|
11815
11916
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11816
11917
|
app.component("magic-code-editor", _sfc_main$T);
|
|
11817
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
11918
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11818
11919
|
app.component("m-fields-code-link", _sfc_main$R);
|
|
11819
11920
|
app.component("m-fields-vs-code", _sfc_main$S);
|
|
11820
11921
|
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$
|
|
11922
|
+
app.component("m-fields-code-select-col", _sfc_main$O);
|
|
11923
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11924
|
+
app.component("m-fields-data-source-fields", _sfc_main$M);
|
|
11925
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11926
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11927
|
+
app.component("m-fields-data-source-input", _sfc_main$K);
|
|
11928
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11929
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11930
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11931
|
+
app.component("m-fields-data-source-field-select", _sfc_main$L);
|
|
11932
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11832
11933
|
}
|
|
11833
11934
|
};
|
|
11834
11935
|
|
|
11835
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
11936
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$J as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$O as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$U as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$y as LayoutContainer, _sfc_main$B as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$z as Resizer, SideItemKey, _sfc_main$y as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFloatBox, useStage, useWindowRect, warn };
|