@tmagic/editor 1.3.16 → 1.4.0-beta.2
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 +25 -9
- package/dist/tmagic-editor.js +1048 -632
- package/dist/tmagic-editor.umd.cjs +1065 -647
- package/package.json +23 -21
- package/src/components/CodeBlockEditor.vue +82 -59
- package/src/components/FloatingBox.vue +71 -25
- package/src/components/SplitView.vue +46 -35
- package/src/fields/Code.vue +12 -10
- package/src/fields/CodeLink.vue +9 -9
- package/src/fields/CodeSelect.vue +7 -5
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/DataSourceFieldSelect.vue +118 -27
- package/src/fields/DataSourceFields.vue +10 -3
- package/src/fields/DataSourceInput.vue +7 -7
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +3 -3
- package/src/fields/DataSourceMocks.vue +3 -3
- package/src/fields/DataSourceSelect.vue +6 -18
- package/src/fields/EventSelect.vue +1 -1
- package/src/fields/KeyValue.vue +8 -8
- package/src/fields/PageFragmentSelect.vue +1 -1
- package/src/fields/UISelect.vue +5 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-code-block-edit.ts +1 -2
- package/src/hooks/use-editor-content-height.ts +20 -0
- package/src/hooks/use-float-box.ts +8 -8
- package/src/hooks/use-window-rect.ts +20 -0
- package/src/index.ts +2 -2
- package/src/layouts/Framework.vue +33 -34
- package/src/layouts/NavMenu.vue +21 -2
- package/src/layouts/PropsPanel.vue +35 -0
- package/src/layouts/sidebar/Sidebar.vue +18 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -0
- package/src/services/BaseService.ts +5 -2
- package/src/services/codeBlock.ts +14 -8
- package/src/services/dataSource.ts +39 -26
- package/src/services/editor.ts +46 -25
- package/src/services/events.ts +4 -4
- package/src/services/props.ts +44 -35
- package/src/services/stageOverlay.ts +16 -9
- package/src/services/storage.ts +14 -8
- package/src/services/ui.ts +26 -19
- package/src/theme/code-block.scss +0 -5
- package/src/theme/code-editor.scss +6 -0
- package/src/theme/floating-box.scss +4 -2
- package/src/theme/props-panel.scss +14 -0
- package/src/theme/sidebar.scss +6 -3
- package/src/type.ts +87 -37
- package/src/utils/operator.ts +37 -39
- package/src/utils/props.ts +174 -37
- package/types/components/CodeBlockEditor.vue.d.ts +46 -25
- package/types/components/CodeParams.vue.d.ts +5 -5
- package/types/components/ContentMenu.vue.d.ts +12 -12
- package/types/components/FloatingBox.vue.d.ts +42 -55
- package/types/components/Icon.vue.d.ts +3 -3
- package/types/components/Resizer.vue.d.ts +3 -3
- package/types/components/ScrollBar.vue.d.ts +3 -3
- package/types/components/ScrollViewer.vue.d.ts +12 -12
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/SplitView.vue.d.ts +13 -11
- package/types/components/ToolButton.vue.d.ts +13 -13
- package/types/components/Tree.vue.d.ts +24 -14
- package/types/components/TreeNode.vue.d.ts +22 -12
- package/types/fields/Code.vue.d.ts +14 -14
- package/types/fields/CodeLink.vue.d.ts +6 -10
- package/types/fields/CodeSelect.vue.d.ts +14 -14
- package/types/fields/CodeSelectCol.vue.d.ts +11 -11
- package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceFields.vue.d.ts +11 -11
- package/types/fields/DataSourceInput.vue.d.ts +14 -18
- package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceMethods.vue.d.ts +11 -11
- package/types/fields/DataSourceMocks.vue.d.ts +11 -11
- package/types/fields/DataSourceSelect.vue.d.ts +13 -26
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +14 -18
- package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
- package/types/fields/UISelect.vue.d.ts +8 -4
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/use-code-block-edit.d.ts +66 -90
- package/types/hooks/use-data-source-method.d.ts +66 -90
- package/types/hooks/use-editor-content-height.d.ts +3 -0
- package/types/hooks/use-node-status.d.ts +6 -1
- package/types/hooks/use-window-rect.d.ts +6 -0
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +1 -1
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
- package/types/icons/PinIcon.vue.d.ts +1 -1
- package/types/icons/PinnedIcon.vue.d.ts +1 -1
- package/types/layouts/AddPageBox.vue.d.ts +3 -3
- package/types/layouts/CodeEditor.vue.d.ts +12 -12
- package/types/layouts/Framework.vue.d.ts +9 -9
- package/types/layouts/NavMenu.vue.d.ts +11 -11
- package/types/layouts/PropsPanel.vue.d.ts +193 -243
- package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
- package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +13 -13
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
- package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
- package/types/services/BaseService.d.ts +5 -2
- package/types/services/codeBlock.d.ts +8 -0
- package/types/services/dataSource.d.ts +9 -2
- package/types/services/editor.d.ts +8 -1
- package/types/services/props.d.ts +15 -22
- package/types/services/stageOverlay.d.ts +9 -2
- package/types/services/storage.d.ts +8 -0
- package/types/services/ui.d.ts +20 -8
- package/types/type.d.ts +56 -32
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +2 -13
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx,
|
|
2
|
-
import { FullScreen, Edit, View, Coin, Delete, Plus,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, mergeModels, useModel, nextTick, renderSlot, toDisplayString, createCommentVNode, watchEffect, Fragment, isRef, createTextVNode, toRaw, resolveDynamicComponent, mergeProps, renderList, createStaticVNode, withModifiers, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, mergeDefaults } from 'vue';
|
|
2
|
+
import { FullScreen, Close, Edit, View, 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 { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
5
|
+
import { TMagicButton, TMagicCard, useZIndex, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, 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
8
|
import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
9
|
-
import { MFormBox,
|
|
9
|
+
import { MFormBox, MForm, filterFunction, createValues, MFormDrawer, MCascader, MSelect } from '@tmagic/form';
|
|
10
|
+
import VanillaMoveable from 'moveable';
|
|
10
11
|
import { MagicTable } from '@tmagic/table';
|
|
11
|
-
import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber,
|
|
12
|
+
import { toLine, guid, isPage, isPageFragment, isPop, getNodePath, isNumber, getValueByKeyPath, setValueByKeyPath, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
|
|
12
13
|
import Gesto from 'gesto';
|
|
13
|
-
import VanillaMoveable from 'moveable';
|
|
14
14
|
import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
15
15
|
export { DepTargetType } from '@tmagic/dep';
|
|
16
16
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
@@ -218,7 +218,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
218
218
|
|
|
219
219
|
const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
220
220
|
...{
|
|
221
|
-
name: "
|
|
221
|
+
name: "MFieldsVsCode"
|
|
222
222
|
},
|
|
223
223
|
__name: "Code",
|
|
224
224
|
props: {
|
|
@@ -258,7 +258,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
258
258
|
|
|
259
259
|
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
260
260
|
...{
|
|
261
|
-
name: "
|
|
261
|
+
name: "MFieldsCodeLink"
|
|
262
262
|
},
|
|
263
263
|
__name: "CodeLink",
|
|
264
264
|
props: {
|
|
@@ -338,7 +338,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
338
338
|
|
|
339
339
|
const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
340
340
|
...{
|
|
341
|
-
name: "
|
|
341
|
+
name: "MFieldsCodeSelect"
|
|
342
342
|
},
|
|
343
343
|
__name: "CodeSelect",
|
|
344
344
|
props: {
|
|
@@ -454,49 +454,235 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
|
|
457
|
+
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
458
|
+
__name: "FloatingBox",
|
|
459
|
+
props: /* @__PURE__ */ mergeModels({
|
|
460
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
461
|
+
title: { default: "" },
|
|
462
|
+
beforeClose: {}
|
|
463
|
+
}, {
|
|
464
|
+
"width": { default: 0 },
|
|
465
|
+
"widthModifiers": {},
|
|
466
|
+
"height": { default: 0 },
|
|
467
|
+
"heightModifiers": {},
|
|
468
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
469
|
+
"visibleModifiers": {}
|
|
470
|
+
}),
|
|
471
|
+
emits: ["update:width", "update:height", "update:visible"],
|
|
472
|
+
setup(__props, { expose: __expose }) {
|
|
473
|
+
const width = useModel(__props, "width");
|
|
474
|
+
const height = useModel(__props, "height");
|
|
475
|
+
const visible = useModel(__props, "visible");
|
|
476
|
+
const props = __props;
|
|
477
|
+
const target = ref();
|
|
478
|
+
const titleEl = ref();
|
|
479
|
+
const zIndex = useZIndex();
|
|
480
|
+
const curZIndex = ref(zIndex.nextZIndex());
|
|
481
|
+
const titleHeight = ref(0);
|
|
482
|
+
const bodyHeight = computed(() => {
|
|
483
|
+
if (height.value) {
|
|
484
|
+
return height.value - titleHeight.value;
|
|
485
|
+
}
|
|
486
|
+
if (target.value) {
|
|
487
|
+
return target.value.clientHeight - titleHeight.value;
|
|
488
|
+
}
|
|
489
|
+
return "auto";
|
|
490
|
+
});
|
|
491
|
+
const style = computed(() => ({
|
|
492
|
+
left: `${props.position.left}px`,
|
|
493
|
+
top: `${props.position.top}px`,
|
|
494
|
+
width: width.value ? `${width.value}px` : "auto",
|
|
495
|
+
height: height.value ? `${height.value}px` : "auto"
|
|
496
|
+
}));
|
|
497
|
+
let moveable = null;
|
|
498
|
+
const initMoveable = () => {
|
|
499
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
500
|
+
className: "m-editor-floating-box-moveable",
|
|
501
|
+
target: target.value,
|
|
502
|
+
draggable: true,
|
|
503
|
+
resizable: true,
|
|
504
|
+
edge: true,
|
|
505
|
+
keepRatio: false,
|
|
506
|
+
origin: false,
|
|
507
|
+
snappable: true,
|
|
508
|
+
dragTarget: titleEl.value,
|
|
509
|
+
dragTargetSelf: false,
|
|
510
|
+
linePadding: 10,
|
|
511
|
+
controlPadding: 10,
|
|
512
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
513
|
+
});
|
|
514
|
+
moveable.on("drag", (e) => {
|
|
515
|
+
e.target.style.transform = e.transform;
|
|
516
|
+
});
|
|
517
|
+
moveable.on("resize", (e) => {
|
|
518
|
+
width.value = e.width;
|
|
519
|
+
height.value = e.height;
|
|
520
|
+
e.target.style.width = `${e.width}px`;
|
|
521
|
+
e.target.style.height = `${e.height}px`;
|
|
522
|
+
e.target.style.transform = e.drag.transform;
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
const destroyMoveable = () => {
|
|
526
|
+
moveable?.destroy();
|
|
527
|
+
moveable = null;
|
|
528
|
+
};
|
|
529
|
+
watch(
|
|
530
|
+
visible,
|
|
531
|
+
async (visible2) => {
|
|
532
|
+
if (visible2) {
|
|
533
|
+
await nextTick();
|
|
534
|
+
const targetRect = target.value?.getBoundingClientRect();
|
|
535
|
+
if (targetRect) {
|
|
536
|
+
width.value = targetRect.width;
|
|
537
|
+
height.value = targetRect.height;
|
|
538
|
+
initMoveable();
|
|
539
|
+
}
|
|
540
|
+
if (titleEl.value) {
|
|
541
|
+
const titleRect = titleEl.value.getBoundingClientRect();
|
|
542
|
+
titleHeight.value = titleRect.height;
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
destroyMoveable();
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
immediate: true
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
onBeforeUnmount(() => {
|
|
553
|
+
destroyMoveable();
|
|
554
|
+
});
|
|
555
|
+
const hide = (cancel) => {
|
|
556
|
+
if (cancel !== false) {
|
|
557
|
+
visible.value = false;
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
const closeHandler = () => {
|
|
561
|
+
if (typeof props.beforeClose === "function") {
|
|
562
|
+
props.beforeClose(hide);
|
|
563
|
+
} else {
|
|
564
|
+
hide();
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
const nextZIndex = () => {
|
|
568
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
569
|
+
};
|
|
570
|
+
__expose({
|
|
571
|
+
bodyHeight,
|
|
572
|
+
target,
|
|
573
|
+
titleEl
|
|
574
|
+
});
|
|
575
|
+
return (_ctx, _cache) => {
|
|
576
|
+
return visible.value ? (openBlock(), createBlock(Teleport, {
|
|
577
|
+
key: 0,
|
|
578
|
+
to: "body"
|
|
579
|
+
}, [
|
|
580
|
+
createElementVNode("div", {
|
|
581
|
+
ref_key: "target",
|
|
582
|
+
ref: target,
|
|
583
|
+
class: "m-editor-float-box",
|
|
584
|
+
style: normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
585
|
+
onMousedown: nextZIndex
|
|
586
|
+
}, [
|
|
587
|
+
createElementVNode("div", {
|
|
588
|
+
ref_key: "titleEl",
|
|
589
|
+
ref: titleEl,
|
|
590
|
+
class: "m-editor-float-box-title"
|
|
591
|
+
}, [
|
|
592
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
593
|
+
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
594
|
+
]),
|
|
595
|
+
createElementVNode("div", null, [
|
|
596
|
+
createVNode(unref(TMagicButton), {
|
|
597
|
+
link: "",
|
|
598
|
+
size: "small",
|
|
599
|
+
icon: unref(Close),
|
|
600
|
+
onClick: closeHandler
|
|
601
|
+
}, null, 8, ["icon"])
|
|
602
|
+
])
|
|
603
|
+
], 512),
|
|
604
|
+
createElementVNode("div", {
|
|
605
|
+
class: "m-editor-float-box-body",
|
|
606
|
+
style: normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
607
|
+
}, [
|
|
608
|
+
renderSlot(_ctx.$slots, "body")
|
|
609
|
+
], 4)
|
|
610
|
+
], 36)
|
|
611
|
+
])) : createCommentVNode("", true);
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
const useEditorContentHeight = () => {
|
|
617
|
+
const services = inject("services");
|
|
618
|
+
const frameworkHeight = computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
619
|
+
const navMenuHeight = computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
620
|
+
const editorContentHeight = computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
621
|
+
const height = ref(0);
|
|
622
|
+
watchEffect(() => {
|
|
623
|
+
if (height.value > 0)
|
|
624
|
+
return;
|
|
625
|
+
height.value = editorContentHeight.value;
|
|
626
|
+
});
|
|
627
|
+
return {
|
|
628
|
+
height
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
const useWindowRect = () => {
|
|
633
|
+
const rect = reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
634
|
+
const windowResizeHandler = () => {
|
|
635
|
+
rect.width = globalThis.innerWidth;
|
|
636
|
+
rect.height = globalThis.innerHeight;
|
|
637
|
+
};
|
|
638
|
+
globalThis.addEventListener("resize", windowResizeHandler);
|
|
639
|
+
onBeforeUnmount(() => {
|
|
640
|
+
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
641
|
+
});
|
|
642
|
+
return {
|
|
643
|
+
rect
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
|
|
457
647
|
const _hoisted_1$s = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
458
648
|
const _hoisted_2$k = { style: { "flex": "1" } };
|
|
459
649
|
const _hoisted_3$8 = { style: { "flex": "1" } };
|
|
460
650
|
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
461
|
-
const _sfc_main$
|
|
651
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
462
652
|
...{
|
|
463
653
|
name: "MEditorCodeBlockEditor"
|
|
464
654
|
},
|
|
465
655
|
__name: "CodeBlockEditor",
|
|
466
|
-
props: {
|
|
656
|
+
props: /* @__PURE__ */ mergeModels({
|
|
467
657
|
content: {},
|
|
468
658
|
disabled: { type: Boolean },
|
|
469
659
|
isDataSource: { type: Boolean },
|
|
470
660
|
dataSourceType: {},
|
|
471
661
|
slideType: {}
|
|
472
|
-
},
|
|
473
|
-
|
|
662
|
+
}, {
|
|
663
|
+
"width": { default: 670 },
|
|
664
|
+
"widthModifiers": {},
|
|
665
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
666
|
+
"visibleModifiers": {}
|
|
667
|
+
}),
|
|
668
|
+
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
474
669
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
670
|
+
const width = useModel(__props, "width");
|
|
671
|
+
const boxVisible = useModel(__props, "visible");
|
|
475
672
|
const props = __props;
|
|
476
673
|
const emit = __emit;
|
|
477
674
|
const services = inject("services");
|
|
675
|
+
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
478
676
|
const difVisible = ref(false);
|
|
479
|
-
const
|
|
480
|
-
const windowReizehandler = () => {
|
|
481
|
-
height.value = globalThis.innerHeight;
|
|
482
|
-
};
|
|
483
|
-
globalThis.addEventListener("resize", windowReizehandler);
|
|
484
|
-
onBeforeUnmount(() => {
|
|
485
|
-
globalThis.removeEventListener("resize", windowReizehandler);
|
|
486
|
-
});
|
|
677
|
+
const { rect: windowRect } = useWindowRect();
|
|
487
678
|
const magicVsEditor = ref();
|
|
488
679
|
const diffChange = () => {
|
|
489
|
-
if (!magicVsEditor.value || !
|
|
680
|
+
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
490
681
|
return;
|
|
491
682
|
}
|
|
492
|
-
|
|
683
|
+
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
493
684
|
difVisible.value = false;
|
|
494
685
|
};
|
|
495
|
-
const columnWidth = computed(() => services?.uiService.get("columnWidth"));
|
|
496
|
-
const size = computed(
|
|
497
|
-
() => columnWidth.value ? columnWidth.value.center + columnWidth.value.right - (props.isDataSource ? 100 : 0) : 600
|
|
498
|
-
);
|
|
499
|
-
const codeEditorHeight = ref("600px");
|
|
500
686
|
const defaultParamColConfig = {
|
|
501
687
|
type: "row",
|
|
502
688
|
label: "参数类型",
|
|
@@ -579,7 +765,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
579
765
|
name: "content",
|
|
580
766
|
type: "vs-code",
|
|
581
767
|
options: inject("codeOptions", {}),
|
|
582
|
-
height:
|
|
768
|
+
height: "500px",
|
|
583
769
|
onChange: (formState, code) => {
|
|
584
770
|
try {
|
|
585
771
|
getConfig("parseDSL")(code);
|
|
@@ -592,26 +778,20 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
592
778
|
}
|
|
593
779
|
]);
|
|
594
780
|
const submitForm = (values) => {
|
|
781
|
+
changedValue.value = void 0;
|
|
595
782
|
emit("submit", values);
|
|
596
783
|
};
|
|
597
784
|
const errorHandler = (error) => {
|
|
598
785
|
tMagicMessage.error(error.message);
|
|
599
786
|
};
|
|
600
|
-
const
|
|
601
|
-
const openHandler = () => {
|
|
602
|
-
setTimeout(() => {
|
|
603
|
-
if (fomDrawer.value) {
|
|
604
|
-
const height2 = fomDrawer.value?.bodyHeight - 348 - (props.isDataSource ? 50 : 0);
|
|
605
|
-
codeEditorHeight.value = `${height2 > 100 ? height2 : 600}px`;
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
};
|
|
787
|
+
const formBox = ref();
|
|
609
788
|
const changedValue = ref();
|
|
610
789
|
const changeHandler = (values) => {
|
|
611
790
|
changedValue.value = values;
|
|
612
791
|
};
|
|
613
792
|
const beforeClose = (done) => {
|
|
614
793
|
if (!changedValue.value) {
|
|
794
|
+
editVisible.value = false;
|
|
615
795
|
done();
|
|
616
796
|
return;
|
|
617
797
|
}
|
|
@@ -622,59 +802,106 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
622
802
|
distinguishCancelAndClose: true
|
|
623
803
|
}).then(() => {
|
|
624
804
|
changedValue.value && submitForm(changedValue.value);
|
|
805
|
+
editVisible.value = false;
|
|
625
806
|
done();
|
|
626
807
|
}).catch((action) => {
|
|
627
|
-
|
|
808
|
+
if (action === "cancel") {
|
|
809
|
+
editVisible.value = false;
|
|
810
|
+
}
|
|
811
|
+
done(action === "cancel");
|
|
628
812
|
});
|
|
629
813
|
};
|
|
630
814
|
const closedHandler = () => {
|
|
631
815
|
changedValue.value = void 0;
|
|
632
816
|
};
|
|
817
|
+
const editVisible = ref(false);
|
|
818
|
+
const floatingBoxBody = ref();
|
|
819
|
+
const boxPosition = computed(() => {
|
|
820
|
+
const columnWidth = services?.uiService?.get("columnWidth");
|
|
821
|
+
const navMenuRect = services?.uiService?.get("navMenuRect");
|
|
822
|
+
return {
|
|
823
|
+
left: columnWidth?.left ?? 0,
|
|
824
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
825
|
+
};
|
|
826
|
+
});
|
|
633
827
|
__expose({
|
|
634
|
-
show() {
|
|
635
|
-
|
|
828
|
+
async show() {
|
|
829
|
+
if (props.slideType !== "box") {
|
|
830
|
+
boxVisible.value = true;
|
|
831
|
+
await nextTick();
|
|
832
|
+
}
|
|
833
|
+
editVisible.value = true;
|
|
636
834
|
},
|
|
637
|
-
hide() {
|
|
638
|
-
|
|
835
|
+
async hide() {
|
|
836
|
+
editVisible.value = false;
|
|
837
|
+
if (props.slideType !== "box") {
|
|
838
|
+
await nextTick();
|
|
839
|
+
boxVisible.value = false;
|
|
840
|
+
}
|
|
639
841
|
}
|
|
640
842
|
});
|
|
641
843
|
return (_ctx, _cache) => {
|
|
642
844
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
643
|
-
(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
"
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
disabled: _ctx.disabled,
|
|
654
|
-
"before-close": beforeClose,
|
|
655
|
-
onChange: changeHandler,
|
|
656
|
-
onSubmit: submitForm,
|
|
657
|
-
onError: errorHandler,
|
|
658
|
-
onOpen: openHandler,
|
|
659
|
-
onClosed: closedHandler
|
|
845
|
+
createVNode(_sfc_main$Q, {
|
|
846
|
+
visible: boxVisible.value,
|
|
847
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
848
|
+
width: width.value,
|
|
849
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
850
|
+
height: unref(codeBlockEditorHeight),
|
|
851
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
852
|
+
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
853
|
+
position: boxPosition.value,
|
|
854
|
+
"before-close": beforeClose
|
|
660
855
|
}, {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
},
|
|
667
|
-
default: withCtx(() => [
|
|
668
|
-
createTextVNode("查看修改")
|
|
669
|
-
]),
|
|
670
|
-
_: 1
|
|
671
|
-
})
|
|
856
|
+
body: withCtx(() => [
|
|
857
|
+
createElementVNode("div", {
|
|
858
|
+
ref_key: "floatingBoxBody",
|
|
859
|
+
ref: floatingBoxBody,
|
|
860
|
+
style: { "height": "100%" }
|
|
861
|
+
}, null, 512)
|
|
672
862
|
]),
|
|
673
863
|
_: 1
|
|
674
|
-
},
|
|
864
|
+
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
865
|
+
editVisible.value ? (openBlock(), createBlock(Teleport, {
|
|
866
|
+
key: 0,
|
|
867
|
+
to: floatingBoxBody.value,
|
|
868
|
+
disabled: _ctx.slideType === "box"
|
|
869
|
+
}, [
|
|
870
|
+
createVNode(unref(MFormBox), {
|
|
871
|
+
class: "m-editor-code-block-editor",
|
|
872
|
+
ref_key: "formBox",
|
|
873
|
+
ref: formBox,
|
|
874
|
+
"label-width": "80px",
|
|
875
|
+
"close-on-press-escape": false,
|
|
876
|
+
title: _ctx.content.name,
|
|
877
|
+
config: functionConfig.value,
|
|
878
|
+
values: _ctx.content,
|
|
879
|
+
disabled: _ctx.disabled,
|
|
880
|
+
height: floatingBoxBody.value?.clientHeight,
|
|
881
|
+
onChange: changeHandler,
|
|
882
|
+
onSubmit: submitForm,
|
|
883
|
+
onError: errorHandler,
|
|
884
|
+
onClosed: closedHandler
|
|
885
|
+
}, {
|
|
886
|
+
left: withCtx(() => [
|
|
887
|
+
!_ctx.disabled ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
888
|
+
key: 0,
|
|
889
|
+
type: "primary",
|
|
890
|
+
link: "",
|
|
891
|
+
onClick: _cache[3] || (_cache[3] = ($event) => difVisible.value = true)
|
|
892
|
+
}, {
|
|
893
|
+
default: withCtx(() => [
|
|
894
|
+
createTextVNode("查看修改")
|
|
895
|
+
]),
|
|
896
|
+
_: 1
|
|
897
|
+
})) : createCommentVNode("", true)
|
|
898
|
+
]),
|
|
899
|
+
_: 1
|
|
900
|
+
}, 8, ["title", "config", "values", "disabled", "height"])
|
|
901
|
+
], 8, ["to", "disabled"])) : createCommentVNode("", true),
|
|
675
902
|
createVNode(unref(TMagicDialog), {
|
|
676
903
|
modelValue: difVisible.value,
|
|
677
|
-
"onUpdate:modelValue": _cache[
|
|
904
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
678
905
|
title: "查看修改",
|
|
679
906
|
fullscreen: ""
|
|
680
907
|
}, {
|
|
@@ -682,7 +909,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
682
909
|
createElementVNode("span", _hoisted_4$7, [
|
|
683
910
|
createVNode(unref(TMagicButton), {
|
|
684
911
|
size: "small",
|
|
685
|
-
onClick: _cache[
|
|
912
|
+
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
686
913
|
}, {
|
|
687
914
|
default: withCtx(() => [
|
|
688
915
|
createTextVNode("取消")
|
|
@@ -733,8 +960,8 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
733
960
|
type: "diff",
|
|
734
961
|
language: "json",
|
|
735
962
|
initValues: _ctx.content.content,
|
|
736
|
-
modifiedValues:
|
|
737
|
-
style: normalizeStyle(`height: ${height
|
|
963
|
+
modifiedValues: formBox.value?.form?.values.content,
|
|
964
|
+
style: normalizeStyle(`height: ${unref(windowRect).height - 150}px`)
|
|
738
965
|
}, null, 8, ["initValues", "modifiedValues", "style"])) : createCommentVNode("", true)
|
|
739
966
|
]),
|
|
740
967
|
_: 1
|
|
@@ -1141,6 +1368,9 @@ class BaseService extends EventEmitter {
|
|
|
1141
1368
|
});
|
|
1142
1369
|
});
|
|
1143
1370
|
}
|
|
1371
|
+
/**
|
|
1372
|
+
* @deprecated 请使用usePlugin代替
|
|
1373
|
+
*/
|
|
1144
1374
|
use(options) {
|
|
1145
1375
|
Object.entries(options).forEach(([methodName2, method]) => {
|
|
1146
1376
|
if (typeof method === "function")
|
|
@@ -1172,6 +1402,23 @@ class BaseService extends EventEmitter {
|
|
|
1172
1402
|
}
|
|
1173
1403
|
}
|
|
1174
1404
|
|
|
1405
|
+
const canUsePluginMethods$6 = {
|
|
1406
|
+
async: [],
|
|
1407
|
+
sync: [
|
|
1408
|
+
"getFormConfig",
|
|
1409
|
+
"setFormConfig",
|
|
1410
|
+
"getFormValue",
|
|
1411
|
+
"setFormValue",
|
|
1412
|
+
"getFormEvent",
|
|
1413
|
+
"setFormEvent",
|
|
1414
|
+
"getFormMethod",
|
|
1415
|
+
"setFormMethod",
|
|
1416
|
+
"add",
|
|
1417
|
+
"update",
|
|
1418
|
+
"remove",
|
|
1419
|
+
"createId"
|
|
1420
|
+
]
|
|
1421
|
+
};
|
|
1175
1422
|
class DataSource extends BaseService {
|
|
1176
1423
|
state = reactive({
|
|
1177
1424
|
datasourceTypeList: [],
|
|
@@ -1183,20 +1430,7 @@ class DataSource extends BaseService {
|
|
|
1183
1430
|
methods: {}
|
|
1184
1431
|
});
|
|
1185
1432
|
constructor() {
|
|
1186
|
-
super(
|
|
1187
|
-
{ name: "getFormConfig", isAsync: false },
|
|
1188
|
-
{ name: "setFormConfig", isAsync: false },
|
|
1189
|
-
{ name: "getFormValue", isAsync: false },
|
|
1190
|
-
{ name: "setFormValue", isAsync: false },
|
|
1191
|
-
{ name: "getFormEvent", isAsync: false },
|
|
1192
|
-
{ name: "setFormEvent", isAsync: false },
|
|
1193
|
-
{ name: "getFormMethod", isAsync: false },
|
|
1194
|
-
{ name: "setFormMethod", isAsync: false },
|
|
1195
|
-
{ name: "add", isAsync: false },
|
|
1196
|
-
{ name: "update", isAsync: false },
|
|
1197
|
-
{ name: "remove", isAsync: false },
|
|
1198
|
-
{ name: "createId", isAsync: false }
|
|
1199
|
-
]);
|
|
1433
|
+
super(canUsePluginMethods$6.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
1200
1434
|
}
|
|
1201
1435
|
set(name, value) {
|
|
1202
1436
|
this.state[name] = value;
|
|
@@ -1205,28 +1439,28 @@ class DataSource extends BaseService {
|
|
|
1205
1439
|
return this.state[name];
|
|
1206
1440
|
}
|
|
1207
1441
|
getFormConfig(type = "base") {
|
|
1208
|
-
return getFormConfig(type, this.get("configs"));
|
|
1442
|
+
return getFormConfig(toLine(type), this.get("configs"));
|
|
1209
1443
|
}
|
|
1210
1444
|
setFormConfig(type, config) {
|
|
1211
|
-
this.get("configs")[type] = config;
|
|
1445
|
+
this.get("configs")[toLine(type)] = config;
|
|
1212
1446
|
}
|
|
1213
1447
|
getFormValue(type = "base") {
|
|
1214
|
-
return getFormValue(type, this.get("values")[type]);
|
|
1448
|
+
return getFormValue(toLine(type), this.get("values")[type]);
|
|
1215
1449
|
}
|
|
1216
1450
|
setFormValue(type, value) {
|
|
1217
|
-
this.get("values")[type] = value;
|
|
1451
|
+
this.get("values")[toLine(type)] = value;
|
|
1218
1452
|
}
|
|
1219
1453
|
getFormEvent(type = "base") {
|
|
1220
|
-
return this.get("events")[type] || [];
|
|
1454
|
+
return this.get("events")[toLine(type)] || [];
|
|
1221
1455
|
}
|
|
1222
1456
|
setFormEvent(type, value = []) {
|
|
1223
|
-
this.get("events")[type] = value;
|
|
1457
|
+
this.get("events")[toLine(type)] = value;
|
|
1224
1458
|
}
|
|
1225
1459
|
getFormMethod(type = "base") {
|
|
1226
|
-
return this.get("methods")[type] || [];
|
|
1460
|
+
return this.get("methods")[toLine(type)] || [];
|
|
1227
1461
|
}
|
|
1228
1462
|
setFormMethod(type, value = []) {
|
|
1229
|
-
this.get("methods")[type] = value;
|
|
1463
|
+
this.get("methods")[toLine(type)] = value;
|
|
1230
1464
|
}
|
|
1231
1465
|
add(config) {
|
|
1232
1466
|
const newConfig = {
|
|
@@ -1250,6 +1484,9 @@ class DataSource extends BaseService {
|
|
|
1250
1484
|
dataSources.splice(index, 1);
|
|
1251
1485
|
this.emit("remove", id);
|
|
1252
1486
|
}
|
|
1487
|
+
createId() {
|
|
1488
|
+
return `ds_${guid()}`;
|
|
1489
|
+
}
|
|
1253
1490
|
getDataSourceById(id) {
|
|
1254
1491
|
return this.get("dataSources").find((ds) => ds.id === id);
|
|
1255
1492
|
}
|
|
@@ -1261,8 +1498,8 @@ class DataSource extends BaseService {
|
|
|
1261
1498
|
this.resetState();
|
|
1262
1499
|
this.removeAllPlugins();
|
|
1263
1500
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1501
|
+
usePlugin(options) {
|
|
1502
|
+
super.usePlugin(options);
|
|
1266
1503
|
}
|
|
1267
1504
|
}
|
|
1268
1505
|
const dataSourceService = new DataSource();
|
|
@@ -1285,7 +1522,6 @@ const numberOptions = [
|
|
|
1285
1522
|
];
|
|
1286
1523
|
const styleTabConfig = {
|
|
1287
1524
|
title: "样式",
|
|
1288
|
-
labelWidth: "80px",
|
|
1289
1525
|
items: [
|
|
1290
1526
|
{
|
|
1291
1527
|
name: "style",
|
|
@@ -1295,29 +1531,58 @@ const styleTabConfig = {
|
|
|
1295
1531
|
legend: "位置",
|
|
1296
1532
|
items: [
|
|
1297
1533
|
{
|
|
1534
|
+
type: "data-source-field-select",
|
|
1298
1535
|
name: "position",
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1536
|
+
text: "固定定位",
|
|
1537
|
+
checkStrictly: false,
|
|
1538
|
+
dataSourceFieldType: ["string"],
|
|
1539
|
+
fieldConfig: {
|
|
1540
|
+
type: "checkbox",
|
|
1541
|
+
activeValue: "fixed",
|
|
1542
|
+
inactiveValue: "absolute",
|
|
1543
|
+
defaultValue: "absolute"
|
|
1544
|
+
}
|
|
1304
1545
|
},
|
|
1305
1546
|
{
|
|
1547
|
+
type: "data-source-field-select",
|
|
1306
1548
|
name: "left",
|
|
1307
|
-
text: "left"
|
|
1549
|
+
text: "left",
|
|
1550
|
+
checkStrictly: false,
|
|
1551
|
+
dataSourceFieldType: ["string", "number"],
|
|
1552
|
+
fieldConfig: {
|
|
1553
|
+
type: "text"
|
|
1554
|
+
}
|
|
1308
1555
|
},
|
|
1309
1556
|
{
|
|
1557
|
+
type: "data-source-field-select",
|
|
1310
1558
|
name: "top",
|
|
1311
1559
|
text: "top",
|
|
1560
|
+
checkStrictly: false,
|
|
1561
|
+
dataSourceFieldType: ["string", "number"],
|
|
1562
|
+
fieldConfig: {
|
|
1563
|
+
type: "text"
|
|
1564
|
+
},
|
|
1312
1565
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
|
|
1313
1566
|
},
|
|
1314
1567
|
{
|
|
1568
|
+
type: "data-source-field-select",
|
|
1315
1569
|
name: "right",
|
|
1316
|
-
text: "right"
|
|
1570
|
+
text: "right",
|
|
1571
|
+
checkStrictly: false,
|
|
1572
|
+
dataSourceFieldType: ["string", "number"],
|
|
1573
|
+
fieldConfig: {
|
|
1574
|
+
type: "text"
|
|
1575
|
+
}
|
|
1317
1576
|
},
|
|
1318
1577
|
{
|
|
1578
|
+
type: "data-source-field-select",
|
|
1319
1579
|
name: "bottom",
|
|
1320
1580
|
text: "bottom",
|
|
1581
|
+
checkStrictly: false,
|
|
1582
|
+
dataSourceFieldType: ["string", "number"],
|
|
1583
|
+
fieldConfig: {
|
|
1584
|
+
type: "text"
|
|
1585
|
+
},
|
|
1321
1586
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
|
|
1322
1587
|
}
|
|
1323
1588
|
]
|
|
@@ -1327,12 +1592,42 @@ const styleTabConfig = {
|
|
|
1327
1592
|
legend: "盒子",
|
|
1328
1593
|
items: [
|
|
1329
1594
|
{
|
|
1595
|
+
type: "data-source-field-select",
|
|
1330
1596
|
name: "width",
|
|
1331
|
-
text: "宽度"
|
|
1597
|
+
text: "宽度",
|
|
1598
|
+
checkStrictly: false,
|
|
1599
|
+
dataSourceFieldType: ["string", "number"],
|
|
1600
|
+
fieldConfig: {
|
|
1601
|
+
type: "text"
|
|
1602
|
+
}
|
|
1332
1603
|
},
|
|
1333
1604
|
{
|
|
1605
|
+
type: "data-source-field-select",
|
|
1334
1606
|
name: "height",
|
|
1335
|
-
text: "高度"
|
|
1607
|
+
text: "高度",
|
|
1608
|
+
checkStrictly: false,
|
|
1609
|
+
dataSourceFieldType: ["string", "number"],
|
|
1610
|
+
fieldConfig: {
|
|
1611
|
+
type: "text"
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
type: "data-source-field-select",
|
|
1616
|
+
text: "overflow",
|
|
1617
|
+
name: "overflow",
|
|
1618
|
+
checkStrictly: false,
|
|
1619
|
+
dataSourceFieldType: ["string"],
|
|
1620
|
+
fieldConfig: {
|
|
1621
|
+
type: "select",
|
|
1622
|
+
options: [
|
|
1623
|
+
{ text: "visible", value: "visible" },
|
|
1624
|
+
{ text: "hidden", value: "hidden" },
|
|
1625
|
+
{ text: "clip", value: "clip" },
|
|
1626
|
+
{ text: "scroll", value: "scroll" },
|
|
1627
|
+
{ text: "auto", value: "auto" },
|
|
1628
|
+
{ text: "overlay", value: "overlay" }
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1336
1631
|
}
|
|
1337
1632
|
]
|
|
1338
1633
|
},
|
|
@@ -1341,32 +1636,48 @@ const styleTabConfig = {
|
|
|
1341
1636
|
legend: "边框",
|
|
1342
1637
|
items: [
|
|
1343
1638
|
{
|
|
1639
|
+
type: "data-source-field-select",
|
|
1344
1640
|
name: "borderWidth",
|
|
1345
1641
|
text: "宽度",
|
|
1346
|
-
defaultValue: "0"
|
|
1642
|
+
defaultValue: "0",
|
|
1643
|
+
checkStrictly: false,
|
|
1644
|
+
dataSourceFieldType: ["string", "number"],
|
|
1645
|
+
fieldConfig: {
|
|
1646
|
+
type: "text"
|
|
1647
|
+
}
|
|
1347
1648
|
},
|
|
1348
1649
|
{
|
|
1650
|
+
type: "data-source-field-select",
|
|
1349
1651
|
name: "borderColor",
|
|
1350
1652
|
text: "颜色",
|
|
1351
|
-
|
|
1653
|
+
checkStrictly: false,
|
|
1654
|
+
dataSourceFieldType: ["string"],
|
|
1655
|
+
fieldConfig: {
|
|
1656
|
+
type: "text"
|
|
1657
|
+
}
|
|
1352
1658
|
},
|
|
1353
1659
|
{
|
|
1660
|
+
type: "data-source-field-select",
|
|
1354
1661
|
name: "borderStyle",
|
|
1355
1662
|
text: "样式",
|
|
1356
|
-
type: "select",
|
|
1357
1663
|
defaultValue: "none",
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1664
|
+
checkStrictly: false,
|
|
1665
|
+
dataSourceFieldType: ["string"],
|
|
1666
|
+
fieldConfig: {
|
|
1667
|
+
type: "select",
|
|
1668
|
+
options: [
|
|
1669
|
+
{ text: "none", value: "none" },
|
|
1670
|
+
{ text: "hidden", value: "hidden" },
|
|
1671
|
+
{ text: "dotted", value: "dotted" },
|
|
1672
|
+
{ text: "dashed", value: "dashed" },
|
|
1673
|
+
{ text: "solid", value: "solid" },
|
|
1674
|
+
{ text: "double", value: "double" },
|
|
1675
|
+
{ text: "groove", value: "groove" },
|
|
1676
|
+
{ text: "ridge", value: "ridge" },
|
|
1677
|
+
{ text: "inset", value: "inset" },
|
|
1678
|
+
{ text: "outset", value: "outset" }
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1370
1681
|
}
|
|
1371
1682
|
]
|
|
1372
1683
|
},
|
|
@@ -1375,31 +1686,53 @@ const styleTabConfig = {
|
|
|
1375
1686
|
legend: "背景",
|
|
1376
1687
|
items: [
|
|
1377
1688
|
{
|
|
1689
|
+
type: "data-source-field-select",
|
|
1378
1690
|
name: "backgroundImage",
|
|
1379
|
-
text: "背景图"
|
|
1691
|
+
text: "背景图",
|
|
1692
|
+
checkStrictly: false,
|
|
1693
|
+
dataSourceFieldType: ["string"],
|
|
1694
|
+
fieldConfig: {
|
|
1695
|
+
type: "text"
|
|
1696
|
+
}
|
|
1380
1697
|
},
|
|
1381
1698
|
{
|
|
1699
|
+
type: "data-source-field-select",
|
|
1382
1700
|
name: "backgroundColor",
|
|
1383
1701
|
text: "背景颜色",
|
|
1384
|
-
|
|
1702
|
+
checkStrictly: false,
|
|
1703
|
+
dataSourceFieldType: ["string"],
|
|
1704
|
+
fieldConfig: {
|
|
1705
|
+
type: "colorPicker"
|
|
1706
|
+
}
|
|
1385
1707
|
},
|
|
1386
1708
|
{
|
|
1709
|
+
type: "data-source-field-select",
|
|
1387
1710
|
name: "backgroundRepeat",
|
|
1388
1711
|
text: "背景图重复",
|
|
1389
|
-
type: "select",
|
|
1390
1712
|
defaultValue: "no-repeat",
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1713
|
+
checkStrictly: false,
|
|
1714
|
+
dataSourceFieldType: ["string"],
|
|
1715
|
+
fieldConfig: {
|
|
1716
|
+
type: "select",
|
|
1717
|
+
options: [
|
|
1718
|
+
{ text: "repeat", value: "repeat" },
|
|
1719
|
+
{ text: "repeat-x", value: "repeat-x" },
|
|
1720
|
+
{ text: "repeat-y", value: "repeat-y" },
|
|
1721
|
+
{ text: "no-repeat", value: "no-repeat" },
|
|
1722
|
+
{ text: "inherit", value: "inherit" }
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1398
1725
|
},
|
|
1399
1726
|
{
|
|
1727
|
+
type: "data-source-field-select",
|
|
1400
1728
|
name: "backgroundSize",
|
|
1401
1729
|
text: "背景图大小",
|
|
1402
|
-
defaultValue: "100% 100%"
|
|
1730
|
+
defaultValue: "100% 100%",
|
|
1731
|
+
checkStrictly: false,
|
|
1732
|
+
dataSourceFieldType: ["string"],
|
|
1733
|
+
fieldConfig: {
|
|
1734
|
+
type: "text"
|
|
1735
|
+
}
|
|
1403
1736
|
}
|
|
1404
1737
|
]
|
|
1405
1738
|
},
|
|
@@ -1408,17 +1741,34 @@ const styleTabConfig = {
|
|
|
1408
1741
|
legend: "字体",
|
|
1409
1742
|
items: [
|
|
1410
1743
|
{
|
|
1744
|
+
type: "data-source-field-select",
|
|
1411
1745
|
name: "color",
|
|
1412
1746
|
text: "颜色",
|
|
1413
|
-
|
|
1747
|
+
checkStrictly: false,
|
|
1748
|
+
dataSourceFieldType: ["string"],
|
|
1749
|
+
fieldConfig: {
|
|
1750
|
+
type: "colorPicker"
|
|
1751
|
+
}
|
|
1414
1752
|
},
|
|
1415
1753
|
{
|
|
1754
|
+
type: "data-source-field-select",
|
|
1416
1755
|
name: "fontSize",
|
|
1417
|
-
text: "大小"
|
|
1756
|
+
text: "大小",
|
|
1757
|
+
checkStrictly: false,
|
|
1758
|
+
dataSourceFieldType: ["string", "number"],
|
|
1759
|
+
fieldConfig: {
|
|
1760
|
+
type: "text"
|
|
1761
|
+
}
|
|
1418
1762
|
},
|
|
1419
1763
|
{
|
|
1764
|
+
type: "data-source-field-select",
|
|
1420
1765
|
name: "fontWeight",
|
|
1421
|
-
text: "粗细"
|
|
1766
|
+
text: "粗细",
|
|
1767
|
+
checkStrictly: false,
|
|
1768
|
+
dataSourceFieldType: ["string", "number"],
|
|
1769
|
+
fieldConfig: {
|
|
1770
|
+
type: "text"
|
|
1771
|
+
}
|
|
1422
1772
|
}
|
|
1423
1773
|
]
|
|
1424
1774
|
},
|
|
@@ -1428,12 +1778,24 @@ const styleTabConfig = {
|
|
|
1428
1778
|
name: "transform",
|
|
1429
1779
|
items: [
|
|
1430
1780
|
{
|
|
1781
|
+
type: "data-source-field-select",
|
|
1431
1782
|
name: "rotate",
|
|
1432
|
-
text: "旋转角度"
|
|
1783
|
+
text: "旋转角度",
|
|
1784
|
+
checkStrictly: false,
|
|
1785
|
+
dataSourceFieldType: ["string"],
|
|
1786
|
+
fieldConfig: {
|
|
1787
|
+
type: "text"
|
|
1788
|
+
}
|
|
1433
1789
|
},
|
|
1434
1790
|
{
|
|
1791
|
+
type: "data-source-field-select",
|
|
1435
1792
|
name: "scale",
|
|
1436
|
-
text: "缩放"
|
|
1793
|
+
text: "缩放",
|
|
1794
|
+
checkStrictly: false,
|
|
1795
|
+
dataSourceFieldType: ["number", "string"],
|
|
1796
|
+
fieldConfig: {
|
|
1797
|
+
type: "text"
|
|
1798
|
+
}
|
|
1437
1799
|
}
|
|
1438
1800
|
]
|
|
1439
1801
|
}
|
|
@@ -1459,13 +1821,11 @@ const advancedTabConfig = {
|
|
|
1459
1821
|
{
|
|
1460
1822
|
name: "created",
|
|
1461
1823
|
text: "created",
|
|
1462
|
-
labelWidth: "100px",
|
|
1463
1824
|
type: "code-select"
|
|
1464
1825
|
},
|
|
1465
1826
|
{
|
|
1466
1827
|
name: "mounted",
|
|
1467
1828
|
text: "mounted",
|
|
1468
|
-
labelWidth: "100px",
|
|
1469
1829
|
type: "code-select"
|
|
1470
1830
|
}
|
|
1471
1831
|
]
|
|
@@ -1488,14 +1848,22 @@ const displayTabConfig = {
|
|
|
1488
1848
|
type: "data-source-field-select",
|
|
1489
1849
|
name: "field",
|
|
1490
1850
|
value: "key",
|
|
1491
|
-
label: "字段"
|
|
1851
|
+
label: "字段",
|
|
1852
|
+
checkStrictly: false,
|
|
1853
|
+
dataSourceFieldType: ["string", "number", "boolean", "any"]
|
|
1492
1854
|
},
|
|
1493
1855
|
{
|
|
1494
1856
|
type: "select",
|
|
1495
1857
|
options: (mForm, { model }) => {
|
|
1496
|
-
const [id,
|
|
1858
|
+
const [id, ...fieldNames] = model.field;
|
|
1497
1859
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1498
|
-
|
|
1860
|
+
let fields = ds?.fields || [];
|
|
1861
|
+
let type = "";
|
|
1862
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1863
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1864
|
+
fields = field?.fields || [];
|
|
1865
|
+
type = field?.type || "";
|
|
1866
|
+
});
|
|
1499
1867
|
if (type === "array") {
|
|
1500
1868
|
return arrayOptions;
|
|
1501
1869
|
}
|
|
@@ -1522,9 +1890,15 @@ const displayTabConfig = {
|
|
|
1522
1890
|
{
|
|
1523
1891
|
name: "value",
|
|
1524
1892
|
type: (mForm, { model }) => {
|
|
1525
|
-
const [id,
|
|
1893
|
+
const [id, ...fieldNames] = model.field;
|
|
1526
1894
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1527
|
-
|
|
1895
|
+
let fields = ds?.fields || [];
|
|
1896
|
+
let type = "";
|
|
1897
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1898
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1899
|
+
fields = field?.fields || [];
|
|
1900
|
+
type = field?.type || "";
|
|
1901
|
+
});
|
|
1528
1902
|
if (type === "number") {
|
|
1529
1903
|
return "number";
|
|
1530
1904
|
}
|
|
@@ -1552,13 +1926,13 @@ const displayTabConfig = {
|
|
|
1552
1926
|
}
|
|
1553
1927
|
]
|
|
1554
1928
|
};
|
|
1555
|
-
const fillConfig = (config = []) => [
|
|
1929
|
+
const fillConfig = (config = [], labelWidth = "80px") => [
|
|
1556
1930
|
{
|
|
1557
1931
|
type: "tab",
|
|
1932
|
+
labelWidth,
|
|
1558
1933
|
items: [
|
|
1559
1934
|
{
|
|
1560
1935
|
title: "属性",
|
|
1561
|
-
labelWidth: "80px",
|
|
1562
1936
|
items: [
|
|
1563
1937
|
// 组件类型,必须要有
|
|
1564
1938
|
{
|
|
@@ -1895,6 +2269,17 @@ class Dep extends BaseService {
|
|
|
1895
2269
|
}
|
|
1896
2270
|
const depService = new Dep();
|
|
1897
2271
|
|
|
2272
|
+
const canUsePluginMethods$5 = {
|
|
2273
|
+
async: [
|
|
2274
|
+
"setPropsConfig",
|
|
2275
|
+
"getPropsConfig",
|
|
2276
|
+
"setPropsValue",
|
|
2277
|
+
"getPropsValue",
|
|
2278
|
+
"fillConfig",
|
|
2279
|
+
"getDefaultPropsValue"
|
|
2280
|
+
],
|
|
2281
|
+
sync: ["createId", "setNewItemId"]
|
|
2282
|
+
};
|
|
1898
2283
|
class Props extends BaseService {
|
|
1899
2284
|
state = reactive({
|
|
1900
2285
|
propsConfigMap: {},
|
|
@@ -1903,14 +2288,8 @@ class Props extends BaseService {
|
|
|
1903
2288
|
});
|
|
1904
2289
|
constructor() {
|
|
1905
2290
|
super([
|
|
1906
|
-
{ name:
|
|
1907
|
-
{ name:
|
|
1908
|
-
{ name: "setPropsValue", isAsync: true },
|
|
1909
|
-
{ name: "getPropsValue", isAsync: true },
|
|
1910
|
-
{ name: "createId", isAsync: false },
|
|
1911
|
-
{ name: "setNewItemId", isAsync: true },
|
|
1912
|
-
{ name: "fillConfig", isAsync: true },
|
|
1913
|
-
{ name: "getDefaultPropsValue", isAsync: true }
|
|
2291
|
+
...canUsePluginMethods$5.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2292
|
+
...canUsePluginMethods$5.sync.map((methodName) => ({ name: methodName, isAsync: false }))
|
|
1914
2293
|
]);
|
|
1915
2294
|
}
|
|
1916
2295
|
setPropsConfigs(configs) {
|
|
@@ -1919,16 +2298,11 @@ class Props extends BaseService {
|
|
|
1919
2298
|
});
|
|
1920
2299
|
this.emit("props-configs-change");
|
|
1921
2300
|
}
|
|
1922
|
-
async fillConfig(config) {
|
|
1923
|
-
return fillConfig(config);
|
|
2301
|
+
async fillConfig(config, labelWidth) {
|
|
2302
|
+
return fillConfig(config, typeof labelWidth !== "function" ? labelWidth : "80px");
|
|
1924
2303
|
}
|
|
1925
|
-
/**
|
|
1926
|
-
* 为指定类型组件设置组件属性表单配置
|
|
1927
|
-
* @param type 组件类型
|
|
1928
|
-
* @param config 组件属性表单配置
|
|
1929
|
-
*/
|
|
1930
2304
|
async setPropsConfig(type, config) {
|
|
1931
|
-
this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
2305
|
+
this.state.propsConfigMap[toLine(type)] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
1932
2306
|
}
|
|
1933
2307
|
/**
|
|
1934
2308
|
* 获取指点类型的组件属性表单配置
|
|
@@ -1939,7 +2313,7 @@ class Props extends BaseService {
|
|
|
1939
2313
|
if (type === "area") {
|
|
1940
2314
|
return await this.getPropsConfig("button");
|
|
1941
2315
|
}
|
|
1942
|
-
return cloneDeep(this.state.propsConfigMap[type] || await this.fillConfig([]));
|
|
2316
|
+
return cloneDeep(this.state.propsConfigMap[toLine(type)] || await this.fillConfig([]));
|
|
1943
2317
|
}
|
|
1944
2318
|
setPropsValues(values) {
|
|
1945
2319
|
Object.keys(values).forEach((type) => {
|
|
@@ -1952,14 +2326,15 @@ class Props extends BaseService {
|
|
|
1952
2326
|
* @param value 组件初始值
|
|
1953
2327
|
*/
|
|
1954
2328
|
async setPropsValue(type, value) {
|
|
1955
|
-
this.state.propsValueMap[type] = value;
|
|
2329
|
+
this.state.propsValueMap[toLine(type)] = value;
|
|
1956
2330
|
}
|
|
1957
2331
|
/**
|
|
1958
2332
|
* 获取指定类型的组件初始值
|
|
1959
2333
|
* @param type 组件类型
|
|
1960
2334
|
* @returns 组件初始值
|
|
1961
2335
|
*/
|
|
1962
|
-
async getPropsValue(
|
|
2336
|
+
async getPropsValue(componentType, { inputEvent, ...defaultValue } = {}) {
|
|
2337
|
+
const type = toLine(componentType);
|
|
1963
2338
|
if (type === "area") {
|
|
1964
2339
|
const value = await this.getPropsValue("button");
|
|
1965
2340
|
value.className = "action-area";
|
|
@@ -1969,23 +2344,21 @@ class Props extends BaseService {
|
|
|
1969
2344
|
}
|
|
1970
2345
|
return value;
|
|
1971
2346
|
}
|
|
1972
|
-
const
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
)
|
|
1981
|
-
]);
|
|
2347
|
+
const id = this.createId(type);
|
|
2348
|
+
const defaultPropsValue = this.getDefaultPropsValue(type);
|
|
2349
|
+
const data = this.setNewItemId(
|
|
2350
|
+
cloneDeep({
|
|
2351
|
+
type,
|
|
2352
|
+
...defaultValue
|
|
2353
|
+
})
|
|
2354
|
+
);
|
|
1982
2355
|
return {
|
|
1983
2356
|
id,
|
|
1984
2357
|
...defaultPropsValue,
|
|
1985
2358
|
...mergeWith({}, cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
1986
2359
|
};
|
|
1987
2360
|
}
|
|
1988
|
-
|
|
2361
|
+
createId(type) {
|
|
1989
2362
|
return `${type}_${guid()}`;
|
|
1990
2363
|
}
|
|
1991
2364
|
/**
|
|
@@ -1995,15 +2368,15 @@ class Props extends BaseService {
|
|
|
1995
2368
|
* @param {Boolean} force 是否强制设置新的ID
|
|
1996
2369
|
*/
|
|
1997
2370
|
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
1998
|
-
|
|
2371
|
+
setNewItemId(config, force = true) {
|
|
1999
2372
|
if (force || editorService.getNodeById(config.id)) {
|
|
2000
|
-
const newId =
|
|
2373
|
+
const newId = this.createId(config.type || "component");
|
|
2001
2374
|
this.setRelateId(config.id, newId);
|
|
2002
2375
|
config.id = newId;
|
|
2003
2376
|
}
|
|
2004
2377
|
if (config.items && Array.isArray(config.items)) {
|
|
2005
2378
|
for (const item of config.items) {
|
|
2006
|
-
|
|
2379
|
+
this.setNewItemId(item);
|
|
2007
2380
|
}
|
|
2008
2381
|
}
|
|
2009
2382
|
return config;
|
|
@@ -2013,7 +2386,7 @@ class Props extends BaseService {
|
|
|
2013
2386
|
* @param type 组件类型
|
|
2014
2387
|
* @returns Object
|
|
2015
2388
|
*/
|
|
2016
|
-
|
|
2389
|
+
getDefaultPropsValue(type) {
|
|
2017
2390
|
return ["page", "container"].includes(type) ? {
|
|
2018
2391
|
type,
|
|
2019
2392
|
layout: "absolute",
|
|
@@ -2067,6 +2440,9 @@ class Props extends BaseService {
|
|
|
2067
2440
|
this.removeAllListeners();
|
|
2068
2441
|
this.removeAllPlugins();
|
|
2069
2442
|
}
|
|
2443
|
+
usePlugin(options) {
|
|
2444
|
+
super.usePlugin(options);
|
|
2445
|
+
}
|
|
2070
2446
|
/**
|
|
2071
2447
|
* 获取setNewItemId前后映射关系
|
|
2072
2448
|
* @param oldId 原组件ID
|
|
@@ -2226,18 +2602,15 @@ var Protocol = /* @__PURE__ */ ((Protocol2) => {
|
|
|
2226
2602
|
Protocol2["BOOLEAN"] = "boolean";
|
|
2227
2603
|
return Protocol2;
|
|
2228
2604
|
})(Protocol || {});
|
|
2605
|
+
const canUsePluginMethods$4 = {
|
|
2606
|
+
async: [],
|
|
2607
|
+
sync: ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]
|
|
2608
|
+
};
|
|
2229
2609
|
class WebStorage extends BaseService {
|
|
2230
2610
|
storage = globalThis.localStorage;
|
|
2231
2611
|
namespace = "tmagic";
|
|
2232
2612
|
constructor() {
|
|
2233
|
-
super(
|
|
2234
|
-
{ name: "getStorage", isAsync: false },
|
|
2235
|
-
{ name: "getNamespace", isAsync: false },
|
|
2236
|
-
{ name: "clear", isAsync: false },
|
|
2237
|
-
{ name: "getItem", isAsync: false },
|
|
2238
|
-
{ name: "removeItem", isAsync: false },
|
|
2239
|
-
{ name: "setItem", isAsync: false }
|
|
2240
|
-
]);
|
|
2613
|
+
super(canUsePluginMethods$4.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
2241
2614
|
}
|
|
2242
2615
|
/**
|
|
2243
2616
|
* 获取数据存储对象,可以通过
|
|
@@ -2320,6 +2693,9 @@ class WebStorage extends BaseService {
|
|
|
2320
2693
|
this.removeAllListeners();
|
|
2321
2694
|
this.removeAllPlugins();
|
|
2322
2695
|
}
|
|
2696
|
+
usePlugin(options) {
|
|
2697
|
+
super.usePlugin(options);
|
|
2698
|
+
}
|
|
2323
2699
|
getValueAndProtocol(value) {
|
|
2324
2700
|
let protocol = "";
|
|
2325
2701
|
if (value === null) {
|
|
@@ -2340,6 +2716,33 @@ class WebStorage extends BaseService {
|
|
|
2340
2716
|
}
|
|
2341
2717
|
const storageService = new WebStorage();
|
|
2342
2718
|
|
|
2719
|
+
const canUsePluginMethods$3 = {
|
|
2720
|
+
async: [
|
|
2721
|
+
"getLayout",
|
|
2722
|
+
"highlight",
|
|
2723
|
+
"select",
|
|
2724
|
+
"multiSelect",
|
|
2725
|
+
"doAdd",
|
|
2726
|
+
"add",
|
|
2727
|
+
"doRemove",
|
|
2728
|
+
"remove",
|
|
2729
|
+
"doUpdate",
|
|
2730
|
+
"update",
|
|
2731
|
+
"sort",
|
|
2732
|
+
"copy",
|
|
2733
|
+
"paste",
|
|
2734
|
+
"doPaste",
|
|
2735
|
+
"doAlignCenter",
|
|
2736
|
+
"alignCenter",
|
|
2737
|
+
"moveLayer",
|
|
2738
|
+
"moveToContainer",
|
|
2739
|
+
"dragTo",
|
|
2740
|
+
"undo",
|
|
2741
|
+
"redo",
|
|
2742
|
+
"move"
|
|
2743
|
+
],
|
|
2744
|
+
sync: []
|
|
2745
|
+
};
|
|
2343
2746
|
class Editor extends BaseService {
|
|
2344
2747
|
state = reactive({
|
|
2345
2748
|
root: null,
|
|
@@ -2358,29 +2761,7 @@ class Editor extends BaseService {
|
|
|
2358
2761
|
isHistoryStateChange = false;
|
|
2359
2762
|
constructor() {
|
|
2360
2763
|
super(
|
|
2361
|
-
|
|
2362
|
-
{ name: "getLayout", isAsync: true },
|
|
2363
|
-
{ name: "select", isAsync: true },
|
|
2364
|
-
{ name: "doAdd", isAsync: true },
|
|
2365
|
-
{ name: "add", isAsync: true },
|
|
2366
|
-
{ name: "doRemove", isAsync: true },
|
|
2367
|
-
{ name: "remove", isAsync: true },
|
|
2368
|
-
{ name: "doUpdate", isAsync: true },
|
|
2369
|
-
{ name: "update", isAsync: true },
|
|
2370
|
-
{ name: "sort", isAsync: true },
|
|
2371
|
-
{ name: "copy", isAsync: true },
|
|
2372
|
-
{ name: "paste", isAsync: true },
|
|
2373
|
-
{ name: "doPaste", isAsync: true },
|
|
2374
|
-
{ name: "doAlignCenter", isAsync: true },
|
|
2375
|
-
{ name: "alignCenter", isAsync: true },
|
|
2376
|
-
{ name: "moveLayer", isAsync: true },
|
|
2377
|
-
{ name: "moveToContainer", isAsync: true },
|
|
2378
|
-
{ name: "move", isAsync: true },
|
|
2379
|
-
{ name: "undo", isAsync: true },
|
|
2380
|
-
{ name: "redo", isAsync: true },
|
|
2381
|
-
{ name: "highlight", isAsync: true },
|
|
2382
|
-
{ name: "dragTo", isAsync: true }
|
|
2383
|
-
],
|
|
2764
|
+
canUsePluginMethods$3.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2384
2765
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2385
2766
|
["select", "update", "moveLayer"]
|
|
2386
2767
|
);
|
|
@@ -2882,7 +3263,7 @@ class Editor extends BaseService {
|
|
|
2882
3263
|
}
|
|
2883
3264
|
async doPaste(config, position = {}) {
|
|
2884
3265
|
propsService.clearRelateId();
|
|
2885
|
-
const pasteConfigs =
|
|
3266
|
+
const pasteConfigs = beforePaste(position, cloneDeep(config));
|
|
2886
3267
|
return pasteConfigs;
|
|
2887
3268
|
}
|
|
2888
3269
|
async doAlignCenter(config) {
|
|
@@ -3120,6 +3501,9 @@ class Editor extends BaseService {
|
|
|
3120
3501
|
resetModifiedNodeId() {
|
|
3121
3502
|
this.get("modifiedNodeIds").clear();
|
|
3122
3503
|
}
|
|
3504
|
+
usePlugin(options) {
|
|
3505
|
+
super.usePlugin(options);
|
|
3506
|
+
}
|
|
3123
3507
|
addModifiedNodeId(id) {
|
|
3124
3508
|
if (!this.isHistoryStateChange) {
|
|
3125
3509
|
this.get("modifiedNodeIds").set(id, id);
|
|
@@ -3187,45 +3571,43 @@ class Editor extends BaseService {
|
|
|
3187
3571
|
}
|
|
3188
3572
|
const editorService = new Editor();
|
|
3189
3573
|
|
|
3190
|
-
const beforePaste =
|
|
3574
|
+
const beforePaste = (position, config) => {
|
|
3191
3575
|
if (!config[0]?.style)
|
|
3192
3576
|
return config;
|
|
3193
3577
|
const curNode = editorService.get("node");
|
|
3194
3578
|
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
3195
|
-
const pasteConfigs =
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
pasteConfig.style
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
})
|
|
3228
|
-
);
|
|
3579
|
+
const pasteConfigs = config.map((configItem) => {
|
|
3580
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
3581
|
+
let pastePosition = positionClone;
|
|
3582
|
+
if (!isEmpty(pastePosition) && curNode?.items) {
|
|
3583
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
3584
|
+
}
|
|
3585
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
3586
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
3587
|
+
}
|
|
3588
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
3589
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
3590
|
+
}
|
|
3591
|
+
const pasteConfig = propsService.setNewItemId(configItem, false);
|
|
3592
|
+
if (pasteConfig.style) {
|
|
3593
|
+
const { left, top } = pasteConfig.style;
|
|
3594
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
3595
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
3596
|
+
}
|
|
3597
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
3598
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
3599
|
+
}
|
|
3600
|
+
pasteConfig.style = {
|
|
3601
|
+
...pasteConfig.style,
|
|
3602
|
+
...pastePosition
|
|
3603
|
+
};
|
|
3604
|
+
}
|
|
3605
|
+
const root = editorService.get("root");
|
|
3606
|
+
if ((isPage(pasteConfig) || isPageFragment(pasteConfig)) && root) {
|
|
3607
|
+
pasteConfig.name = generatePageNameByApp(root, isPage(pasteConfig) ? NodeType.PAGE : NodeType.PAGE_FRAGMENT);
|
|
3608
|
+
}
|
|
3609
|
+
return pasteConfig;
|
|
3610
|
+
});
|
|
3229
3611
|
return pasteConfigs;
|
|
3230
3612
|
};
|
|
3231
3613
|
const getPositionInContainer = (position = {}, id) => {
|
|
@@ -3259,7 +3641,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
3259
3641
|
return newNode;
|
|
3260
3642
|
};
|
|
3261
3643
|
|
|
3262
|
-
const _sfc_main$
|
|
3644
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
3263
3645
|
...{
|
|
3264
3646
|
name: "MEditorCodeParams"
|
|
3265
3647
|
},
|
|
@@ -3310,7 +3692,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
3310
3692
|
});
|
|
3311
3693
|
|
|
3312
3694
|
const _hoisted_1$r = ["src"];
|
|
3313
|
-
const _sfc_main$
|
|
3695
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
3314
3696
|
...{
|
|
3315
3697
|
name: "MEditorIcon"
|
|
3316
3698
|
},
|
|
@@ -3363,7 +3745,7 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3363
3745
|
return;
|
|
3364
3746
|
}
|
|
3365
3747
|
codeConfig.value = {
|
|
3366
|
-
name: "
|
|
3748
|
+
name: "",
|
|
3367
3749
|
content: `({app, params}) => {
|
|
3368
3750
|
// place your code here
|
|
3369
3751
|
}`,
|
|
@@ -3414,9 +3796,9 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3414
3796
|
|
|
3415
3797
|
const _hoisted_1$q = { class: "m-fields-code-select-col" };
|
|
3416
3798
|
const _hoisted_2$j = { class: "code-select-container" };
|
|
3417
|
-
const _sfc_main$
|
|
3799
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
3418
3800
|
...{
|
|
3419
|
-
name: "
|
|
3801
|
+
name: "MFieldsCodeSelectCol"
|
|
3420
3802
|
},
|
|
3421
3803
|
__name: "CodeSelectCol",
|
|
3422
3804
|
props: {
|
|
@@ -3499,14 +3881,14 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3499
3881
|
size: _ctx.size,
|
|
3500
3882
|
onChange: onParamsChangeHandler
|
|
3501
3883
|
}, null, 8, ["model", "size"]),
|
|
3502
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
3884
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
|
|
3503
3885
|
key: 0,
|
|
3504
3886
|
class: "icon",
|
|
3505
3887
|
icon: !notEditable.value ? unref(Edit) : unref(View),
|
|
3506
3888
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
|
|
3507
3889
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3508
3890
|
]),
|
|
3509
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3891
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3510
3892
|
name: "params",
|
|
3511
3893
|
key: _ctx.model[_ctx.name],
|
|
3512
3894
|
model: _ctx.model,
|
|
@@ -3514,7 +3896,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3514
3896
|
"params-config": paramsConfig.value,
|
|
3515
3897
|
onChange: onParamsChangeHandler
|
|
3516
3898
|
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
|
|
3517
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
3899
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
3518
3900
|
key: 1,
|
|
3519
3901
|
ref_key: "codeBlockEditor",
|
|
3520
3902
|
ref: codeBlockEditor,
|
|
@@ -3529,9 +3911,9 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3529
3911
|
|
|
3530
3912
|
const _hoisted_1$p = { class: "m-editor-data-source-fields" };
|
|
3531
3913
|
const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
|
|
3532
|
-
const _sfc_main$
|
|
3914
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
3533
3915
|
...{
|
|
3534
|
-
name: "
|
|
3916
|
+
name: "MFieldsDataSourceFields"
|
|
3535
3917
|
},
|
|
3536
3918
|
__name: "DataSourceFields",
|
|
3537
3919
|
props: {
|
|
@@ -3583,7 +3965,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3583
3965
|
},
|
|
3584
3966
|
{
|
|
3585
3967
|
label: "默认值",
|
|
3586
|
-
prop: "defaultValue"
|
|
3968
|
+
prop: "defaultValue",
|
|
3969
|
+
formatter(item, row) {
|
|
3970
|
+
try {
|
|
3971
|
+
return JSON.stringify(row.defaultValue);
|
|
3972
|
+
} catch (e) {
|
|
3973
|
+
return row.defaultValue;
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3587
3976
|
},
|
|
3588
3977
|
{
|
|
3589
3978
|
label: "操作",
|
|
@@ -3821,7 +4210,11 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3821
4210
|
}
|
|
3822
4211
|
});
|
|
3823
4212
|
|
|
3824
|
-
const
|
|
4213
|
+
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4214
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
4215
|
+
...{
|
|
4216
|
+
name: "MFieldsDataSourceFieldSelect"
|
|
4217
|
+
},
|
|
3825
4218
|
__name: "DataSourceFieldSelect",
|
|
3826
4219
|
props: {
|
|
3827
4220
|
config: {},
|
|
@@ -3840,48 +4233,117 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3840
4233
|
const emit = __emit;
|
|
3841
4234
|
const props = __props;
|
|
3842
4235
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
3843
|
-
const getOptionChildren = (fields = []
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
4236
|
+
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4237
|
+
const child = [];
|
|
4238
|
+
fields.forEach((field) => {
|
|
4239
|
+
if (!dataSourceFieldType.length) {
|
|
4240
|
+
dataSourceFieldType.push("any");
|
|
4241
|
+
}
|
|
4242
|
+
const children = getOptionChildren(field.fields, dataSourceFieldType);
|
|
4243
|
+
const item = {
|
|
4244
|
+
label: field.title || field.name,
|
|
4245
|
+
value: field.name,
|
|
4246
|
+
children
|
|
4247
|
+
};
|
|
4248
|
+
const fieldType = field.type || "any";
|
|
4249
|
+
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
4250
|
+
child.push(item);
|
|
4251
|
+
return;
|
|
4252
|
+
}
|
|
4253
|
+
if (!dataSourceFieldType.includes(fieldType) && fieldType !== "object") {
|
|
4254
|
+
return;
|
|
4255
|
+
}
|
|
4256
|
+
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
4257
|
+
return;
|
|
4258
|
+
}
|
|
4259
|
+
child.push(item);
|
|
4260
|
+
});
|
|
4261
|
+
return child;
|
|
4262
|
+
};
|
|
3848
4263
|
const cascaderConfig = computed(() => {
|
|
3849
4264
|
const valueIsKey = props.config.value === "key";
|
|
3850
4265
|
return {
|
|
3851
4266
|
type: "cascader",
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
4267
|
+
checkStrictly: props.config.checkStrictly ?? !valueIsKey,
|
|
4268
|
+
popperClass: "m-editor-data-source-field-select-popper",
|
|
4269
|
+
options: () => {
|
|
4270
|
+
const options = dataSources.value?.map((ds) => ({
|
|
4271
|
+
label: ds.title || ds.id,
|
|
4272
|
+
value: valueIsKey ? ds.id : `${DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
4273
|
+
children: getOptionChildren(ds.fields, props.config.dataSourceFieldType)
|
|
4274
|
+
})) || [];
|
|
4275
|
+
return options.filter((option) => option.children.length);
|
|
4276
|
+
}
|
|
3860
4277
|
};
|
|
3861
4278
|
});
|
|
4279
|
+
const showDataSourceFieldSelect = ref(false);
|
|
4280
|
+
onMounted(() => {
|
|
4281
|
+
const value = props.model[props.name];
|
|
4282
|
+
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4283
|
+
return showDataSourceFieldSelect.value = true;
|
|
4284
|
+
}
|
|
4285
|
+
});
|
|
4286
|
+
const mForm = inject("mForm");
|
|
4287
|
+
const type = computed(() => {
|
|
4288
|
+
let type2 = props.config.fieldConfig?.type;
|
|
4289
|
+
if (typeof type2 === "function") {
|
|
4290
|
+
type2 = type2(mForm, {
|
|
4291
|
+
model: props.model
|
|
4292
|
+
});
|
|
4293
|
+
}
|
|
4294
|
+
if (type2 === "form")
|
|
4295
|
+
return "";
|
|
4296
|
+
if (type2 === "container")
|
|
4297
|
+
return "";
|
|
4298
|
+
return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.items ? "" : "text");
|
|
4299
|
+
});
|
|
4300
|
+
const tagName = computed(() => {
|
|
4301
|
+
if (showDataSourceFieldSelect.value || !props.config.fieldConfig) {
|
|
4302
|
+
return MCascader;
|
|
4303
|
+
}
|
|
4304
|
+
const component = resolveComponent(`m-${props.config.items ? "form" : "fields"}-${type.value}`);
|
|
4305
|
+
if (typeof component !== "string")
|
|
4306
|
+
return component;
|
|
4307
|
+
return "m-fields-text";
|
|
4308
|
+
});
|
|
3862
4309
|
const onChangeHandler = (value) => {
|
|
3863
4310
|
emit("change", value);
|
|
3864
4311
|
};
|
|
3865
4312
|
return (_ctx, _cache) => {
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
4313
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
4314
|
+
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
4315
|
+
style: { "width": "100%" },
|
|
4316
|
+
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
4317
|
+
model: _ctx.model,
|
|
4318
|
+
name: _ctx.name,
|
|
4319
|
+
disabled: _ctx.disabled,
|
|
4320
|
+
size: _ctx.size,
|
|
4321
|
+
"last-values": _ctx.lastValues,
|
|
4322
|
+
"init-values": _ctx.initValues,
|
|
4323
|
+
values: _ctx.values,
|
|
4324
|
+
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4325
|
+
onChange: onChangeHandler
|
|
4326
|
+
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4327
|
+
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4328
|
+
key: 0,
|
|
4329
|
+
style: { "margin-left": "5px" },
|
|
4330
|
+
link: "",
|
|
4331
|
+
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4332
|
+
icon: unref(Coin),
|
|
4333
|
+
size: _ctx.size,
|
|
4334
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4335
|
+
}, null, 8, ["type", "icon", "size"])) : createCommentVNode("", true)
|
|
4336
|
+
]);
|
|
3875
4337
|
};
|
|
3876
4338
|
}
|
|
3877
4339
|
});
|
|
3878
4340
|
|
|
3879
|
-
const _hoisted_1$
|
|
4341
|
+
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3880
4342
|
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3881
4343
|
const _hoisted_3$7 = { class: "el-input__inner" };
|
|
3882
|
-
const _sfc_main$
|
|
4344
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
3883
4345
|
...{
|
|
3884
|
-
name: "
|
|
4346
|
+
name: "MFieldsDataSourceInput"
|
|
3885
4347
|
},
|
|
3886
4348
|
__name: "DataSourceInput",
|
|
3887
4349
|
props: {
|
|
@@ -4069,10 +4531,10 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4069
4531
|
}
|
|
4070
4532
|
), {
|
|
4071
4533
|
suffix: withCtx(() => [
|
|
4072
|
-
createVNode(_sfc_main$
|
|
4534
|
+
createVNode(_sfc_main$N, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4073
4535
|
]),
|
|
4074
4536
|
default: withCtx(({ item }) => [
|
|
4075
|
-
createElementVNode("div", _hoisted_1$
|
|
4537
|
+
createElementVNode("div", _hoisted_1$n, [
|
|
4076
4538
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
4077
4539
|
createElementVNode("span", _hoisted_2$h, toDisplayString(item.value), 1)
|
|
4078
4540
|
])
|
|
@@ -4104,7 +4566,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4104
4566
|
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
4105
4567
|
], 64);
|
|
4106
4568
|
}), 256)),
|
|
4107
|
-
createVNode(_sfc_main$
|
|
4569
|
+
createVNode(_sfc_main$N, {
|
|
4108
4570
|
class: "tmagic-data-source-input-icon",
|
|
4109
4571
|
icon: unref(Coin)
|
|
4110
4572
|
}, null, 8, ["icon"])
|
|
@@ -4187,11 +4649,11 @@ const useDataSourceMethod = () => {
|
|
|
4187
4649
|
};
|
|
4188
4650
|
};
|
|
4189
4651
|
|
|
4190
|
-
const _hoisted_1$
|
|
4652
|
+
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4191
4653
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
4192
|
-
const _sfc_main$
|
|
4654
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
4193
4655
|
...{
|
|
4194
|
-
name: "
|
|
4656
|
+
name: "MFieldsDataSourceMethods"
|
|
4195
4657
|
},
|
|
4196
4658
|
__name: "DataSourceMethods",
|
|
4197
4659
|
props: {
|
|
@@ -4259,7 +4721,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4259
4721
|
emit("change", props.model[props.name]);
|
|
4260
4722
|
};
|
|
4261
4723
|
return (_ctx, _cache) => {
|
|
4262
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4724
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
4263
4725
|
createVNode(unref(MagicTable), {
|
|
4264
4726
|
data: _ctx.model[_ctx.name],
|
|
4265
4727
|
columns: methodColumns
|
|
@@ -4278,7 +4740,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4278
4740
|
_: 1
|
|
4279
4741
|
}, 8, ["disabled"])
|
|
4280
4742
|
]),
|
|
4281
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4743
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
4282
4744
|
key: 0,
|
|
4283
4745
|
ref_key: "codeBlockEditor",
|
|
4284
4746
|
ref: codeBlockEditor,
|
|
@@ -4293,11 +4755,11 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4293
4755
|
}
|
|
4294
4756
|
});
|
|
4295
4757
|
|
|
4296
|
-
const _hoisted_1$
|
|
4758
|
+
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
4297
4759
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
4298
|
-
const _sfc_main$
|
|
4760
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
4299
4761
|
...{
|
|
4300
|
-
name: "
|
|
4762
|
+
name: "MFieldsDataSourceMethodSelect"
|
|
4301
4763
|
},
|
|
4302
4764
|
__name: "DataSourceMethodSelect",
|
|
4303
4765
|
props: {
|
|
@@ -4386,7 +4848,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4386
4848
|
};
|
|
4387
4849
|
return (_ctx, _cache) => {
|
|
4388
4850
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4389
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4851
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
4390
4852
|
createElementVNode("div", _hoisted_2$f, [
|
|
4391
4853
|
createVNode(_component_m_form_container, {
|
|
4392
4854
|
class: "select",
|
|
@@ -4394,14 +4856,14 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4394
4856
|
model: _ctx.model,
|
|
4395
4857
|
onChange: onChangeHandler
|
|
4396
4858
|
}, null, 8, ["config", "model"]),
|
|
4397
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$
|
|
4859
|
+
_ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$N, {
|
|
4398
4860
|
key: 0,
|
|
4399
4861
|
class: "icon",
|
|
4400
4862
|
icon: !notEditable.value ? unref(Edit) : unref(View),
|
|
4401
4863
|
onClick: editCodeHandler
|
|
4402
4864
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
4403
4865
|
]),
|
|
4404
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4866
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
|
|
4405
4867
|
key: 0,
|
|
4406
4868
|
name: "params",
|
|
4407
4869
|
model: _ctx.model,
|
|
@@ -4410,7 +4872,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4410
4872
|
"params-config": paramsConfig.value,
|
|
4411
4873
|
onChange: onChangeHandler
|
|
4412
4874
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
|
|
4413
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4875
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
4414
4876
|
key: 1,
|
|
4415
4877
|
ref_key: "codeBlockEditor",
|
|
4416
4878
|
ref: codeBlockEditor,
|
|
@@ -4423,11 +4885,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4423
4885
|
}
|
|
4424
4886
|
});
|
|
4425
4887
|
|
|
4426
|
-
const _hoisted_1$
|
|
4888
|
+
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
4427
4889
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
4428
|
-
const _sfc_main$
|
|
4890
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
4429
4891
|
...{
|
|
4430
|
-
name: "
|
|
4892
|
+
name: "MFieldsDataSourceMocks"
|
|
4431
4893
|
},
|
|
4432
4894
|
__name: "DataSourceMocks",
|
|
4433
4895
|
props: {
|
|
@@ -4621,7 +5083,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4621
5083
|
});
|
|
4622
5084
|
};
|
|
4623
5085
|
return (_ctx, _cache) => {
|
|
4624
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5086
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
4625
5087
|
createVNode(unref(MagicTable), {
|
|
4626
5088
|
data: _ctx.model[_ctx.name],
|
|
4627
5089
|
columns
|
|
@@ -4657,9 +5119,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4657
5119
|
}
|
|
4658
5120
|
});
|
|
4659
5121
|
|
|
4660
|
-
const _sfc_main$
|
|
5122
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
4661
5123
|
...{
|
|
4662
|
-
name: "
|
|
5124
|
+
name: "MFieldsDataSourceSelect"
|
|
4663
5125
|
},
|
|
4664
5126
|
__name: "DataSourceSelect",
|
|
4665
5127
|
props: {
|
|
@@ -4714,14 +5176,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4714
5176
|
}
|
|
4715
5177
|
});
|
|
4716
5178
|
|
|
4717
|
-
const _hoisted_1$
|
|
5179
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
4718
5180
|
const _hoisted_2$d = {
|
|
4719
5181
|
key: 1,
|
|
4720
5182
|
class: "fullWidth"
|
|
4721
5183
|
};
|
|
4722
|
-
const _sfc_main$
|
|
5184
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
4723
5185
|
...{
|
|
4724
|
-
name: "
|
|
5186
|
+
name: "MFieldsEventSelect"
|
|
4725
5187
|
},
|
|
4726
5188
|
__name: "EventSelect",
|
|
4727
5189
|
props: {
|
|
@@ -4923,7 +5385,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4923
5385
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4924
5386
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4925
5387
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
4926
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5388
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
4927
5389
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
4928
5390
|
key: 0,
|
|
4929
5391
|
ref: "eventForm",
|
|
@@ -4983,7 +5445,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4983
5445
|
}
|
|
4984
5446
|
});
|
|
4985
5447
|
|
|
4986
|
-
const _hoisted_1$
|
|
5448
|
+
const _hoisted_1$i = {
|
|
4987
5449
|
viewBox: "0 0 32 32",
|
|
4988
5450
|
version: "1.1",
|
|
4989
5451
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4993,24 +5455,24 @@ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
|
|
|
4993
5455
|
const _hoisted_4$6 = [
|
|
4994
5456
|
_hoisted_2$c
|
|
4995
5457
|
];
|
|
4996
|
-
const _sfc_main$
|
|
5458
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
4997
5459
|
...{
|
|
4998
5460
|
name: "MEditorCodeIcon"
|
|
4999
5461
|
},
|
|
5000
5462
|
__name: "CodeIcon",
|
|
5001
5463
|
setup(__props) {
|
|
5002
5464
|
return (_ctx, _cache) => {
|
|
5003
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
5465
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_4$6);
|
|
5004
5466
|
};
|
|
5005
5467
|
}
|
|
5006
5468
|
});
|
|
5007
5469
|
|
|
5008
|
-
const _hoisted_1$
|
|
5470
|
+
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5009
5471
|
const _hoisted_2$b = { key: 0 };
|
|
5010
5472
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5011
|
-
const _sfc_main$
|
|
5473
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5012
5474
|
...{
|
|
5013
|
-
name: "
|
|
5475
|
+
name: "MFieldsKeyValue"
|
|
5014
5476
|
},
|
|
5015
5477
|
__name: "KeyValue",
|
|
5016
5478
|
props: {
|
|
@@ -5066,7 +5528,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5066
5528
|
emit("change", v);
|
|
5067
5529
|
};
|
|
5068
5530
|
return (_ctx, _cache) => {
|
|
5069
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5531
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
5070
5532
|
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
|
|
5071
5533
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
5072
5534
|
return openBlock(), createElementBlock("div", {
|
|
@@ -5132,7 +5594,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5132
5594
|
size: "default",
|
|
5133
5595
|
disabled: _ctx.disabled,
|
|
5134
5596
|
link: "",
|
|
5135
|
-
icon: _sfc_main$
|
|
5597
|
+
icon: _sfc_main$D,
|
|
5136
5598
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5137
5599
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
5138
5600
|
]);
|
|
@@ -5140,11 +5602,11 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5140
5602
|
}
|
|
5141
5603
|
});
|
|
5142
5604
|
|
|
5143
|
-
const _hoisted_1$
|
|
5605
|
+
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
5144
5606
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
5145
|
-
const _sfc_main$
|
|
5607
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
5146
5608
|
...{
|
|
5147
|
-
name: "
|
|
5609
|
+
name: "MFieldsPageFragmentSelect"
|
|
5148
5610
|
},
|
|
5149
5611
|
__name: "PageFragmentSelect",
|
|
5150
5612
|
props: {
|
|
@@ -5188,7 +5650,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5188
5650
|
};
|
|
5189
5651
|
return (_ctx, _cache) => {
|
|
5190
5652
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
5191
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5653
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
5192
5654
|
createElementVNode("div", _hoisted_2$a, [
|
|
5193
5655
|
createVNode(_component_m_form_container, {
|
|
5194
5656
|
class: "select",
|
|
@@ -5197,7 +5659,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5197
5659
|
size: _ctx.size,
|
|
5198
5660
|
onChange: changeHandler
|
|
5199
5661
|
}, null, 8, ["model", "size"]),
|
|
5200
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
5662
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5201
5663
|
key: 0,
|
|
5202
5664
|
class: "icon",
|
|
5203
5665
|
icon: unref(Edit),
|
|
@@ -5209,14 +5671,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5209
5671
|
}
|
|
5210
5672
|
});
|
|
5211
5673
|
|
|
5212
|
-
const _hoisted_1$
|
|
5674
|
+
const _hoisted_1$f = {
|
|
5213
5675
|
key: 1,
|
|
5214
5676
|
class: "m-fields-ui-select",
|
|
5215
5677
|
style: { "display": "flex" }
|
|
5216
5678
|
};
|
|
5217
|
-
const _sfc_main$
|
|
5679
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
5218
5680
|
...{
|
|
5219
|
-
name: "
|
|
5681
|
+
name: "MFieldsUISelect"
|
|
5220
5682
|
},
|
|
5221
5683
|
__name: "UISelect",
|
|
5222
5684
|
props: {
|
|
@@ -5283,7 +5745,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5283
5745
|
services?.editorService.get("stage")?.highlight(id);
|
|
5284
5746
|
services?.stageOverlayService.get("stage")?.highlight(id);
|
|
5285
5747
|
}, 150);
|
|
5286
|
-
const
|
|
5748
|
+
const unhighlight = () => {
|
|
5287
5749
|
services?.editorService.set("highlightNode", null);
|
|
5288
5750
|
services?.editorService.get("stage")?.clearHighlight();
|
|
5289
5751
|
services?.stageOverlayService.get("stage")?.clearHighlight();
|
|
@@ -5307,7 +5769,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5307
5769
|
]),
|
|
5308
5770
|
_: 1
|
|
5309
5771
|
}, 8, ["icon", "disabled", "size"])
|
|
5310
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5772
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
5311
5773
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5312
5774
|
createVNode(unref(TMagicTooltip), {
|
|
5313
5775
|
content: "清除",
|
|
@@ -5322,7 +5784,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5322
5784
|
size: _ctx.size,
|
|
5323
5785
|
link: "",
|
|
5324
5786
|
onClick: withModifiers(deleteHandler, ["stop"])
|
|
5325
|
-
}, null, 8, ["icon", "disabled", "size"
|
|
5787
|
+
}, null, 8, ["icon", "disabled", "size"])
|
|
5326
5788
|
]),
|
|
5327
5789
|
_: 1
|
|
5328
5790
|
}),
|
|
@@ -5338,7 +5800,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5338
5800
|
size: _ctx.size,
|
|
5339
5801
|
onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
|
|
5340
5802
|
onMouseenter: _cache[1] || (_cache[1] = ($event) => unref(highlight)(val.value)),
|
|
5341
|
-
onMouseleave:
|
|
5803
|
+
onMouseleave: unhighlight
|
|
5342
5804
|
}, {
|
|
5343
5805
|
default: withCtx(() => [
|
|
5344
5806
|
createTextVNode(toDisplayString(`${toName.value}_${val.value}`), 1)
|
|
@@ -5402,7 +5864,7 @@ const useGetSo = (target, emit) => {
|
|
|
5402
5864
|
};
|
|
5403
5865
|
};
|
|
5404
5866
|
|
|
5405
|
-
const _sfc_main$
|
|
5867
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
5406
5868
|
...{
|
|
5407
5869
|
name: "MEditorResizer"
|
|
5408
5870
|
},
|
|
@@ -5424,12 +5886,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
5424
5886
|
}
|
|
5425
5887
|
});
|
|
5426
5888
|
|
|
5427
|
-
const _sfc_main$
|
|
5889
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
5428
5890
|
...{
|
|
5429
5891
|
name: "MEditorSplitView"
|
|
5430
5892
|
},
|
|
5431
5893
|
__name: "SplitView",
|
|
5432
5894
|
props: {
|
|
5895
|
+
width: {},
|
|
5433
5896
|
left: {},
|
|
5434
5897
|
right: {},
|
|
5435
5898
|
minLeft: { default: 46 },
|
|
@@ -5446,17 +5909,19 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5446
5909
|
const el = ref();
|
|
5447
5910
|
const hasLeft = computed(() => typeof props.left !== "undefined");
|
|
5448
5911
|
const hasRight = computed(() => typeof props.right !== "undefined");
|
|
5449
|
-
const
|
|
5912
|
+
const center = ref(0);
|
|
5913
|
+
let clientWidth = 0;
|
|
5914
|
+
const getCenterWidth = (l = 0, r = 0) => {
|
|
5450
5915
|
let right = r > 0 ? r : 0;
|
|
5451
5916
|
let left = l > 0 ? l : 0;
|
|
5452
|
-
let center2 =
|
|
5917
|
+
let center2 = clientWidth - left - right;
|
|
5453
5918
|
if (center2 < props.minCenter) {
|
|
5454
5919
|
center2 = props.minCenter;
|
|
5455
5920
|
if (right > center2 + props.minRight) {
|
|
5456
|
-
right =
|
|
5921
|
+
right = clientWidth - left - center2;
|
|
5457
5922
|
} else {
|
|
5458
5923
|
right = props.minRight;
|
|
5459
|
-
left =
|
|
5924
|
+
left = clientWidth - right - center2;
|
|
5460
5925
|
}
|
|
5461
5926
|
}
|
|
5462
5927
|
return {
|
|
@@ -5465,36 +5930,43 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5465
5930
|
right
|
|
5466
5931
|
};
|
|
5467
5932
|
};
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
clientWidth = contentRect.width;
|
|
5472
|
-
let left = props.left || 0;
|
|
5473
|
-
let right = props.right || 0;
|
|
5474
|
-
if (left > clientWidth) {
|
|
5475
|
-
left = clientWidth / 3;
|
|
5476
|
-
}
|
|
5477
|
-
if (right > clientWidth) {
|
|
5478
|
-
right = clientWidth / 3;
|
|
5479
|
-
}
|
|
5480
|
-
const columnWidth = getCenterWidth(clientWidth, left, right);
|
|
5481
|
-
center.value = columnWidth.center;
|
|
5482
|
-
emit("change", {
|
|
5483
|
-
left: columnWidth.left,
|
|
5484
|
-
center: center.value,
|
|
5485
|
-
right: columnWidth.right
|
|
5486
|
-
});
|
|
5933
|
+
const widthChange = (width) => {
|
|
5934
|
+
if (width <= 0) {
|
|
5935
|
+
return;
|
|
5487
5936
|
}
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5937
|
+
clientWidth = width;
|
|
5938
|
+
let left = props.left || 0;
|
|
5939
|
+
let right = props.right || 0;
|
|
5940
|
+
if (left > clientWidth) {
|
|
5941
|
+
left = clientWidth / 3;
|
|
5492
5942
|
}
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5943
|
+
if (right > clientWidth) {
|
|
5944
|
+
right = clientWidth / 3;
|
|
5945
|
+
}
|
|
5946
|
+
const columnWidth = getCenterWidth(left, right);
|
|
5947
|
+
center.value = columnWidth.center;
|
|
5948
|
+
emit("change", columnWidth);
|
|
5949
|
+
};
|
|
5950
|
+
if (typeof props.width !== "number") {
|
|
5951
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
5952
|
+
for (const { contentRect } of entries) {
|
|
5953
|
+
widthChange(contentRect.width);
|
|
5954
|
+
}
|
|
5955
|
+
});
|
|
5956
|
+
onMounted(() => {
|
|
5957
|
+
if (el.value) {
|
|
5958
|
+
resizerObserver.observe(el.value);
|
|
5959
|
+
}
|
|
5960
|
+
});
|
|
5961
|
+
onBeforeUnmount(() => {
|
|
5962
|
+
resizerObserver.disconnect();
|
|
5963
|
+
});
|
|
5964
|
+
} else {
|
|
5965
|
+
watchEffect(() => {
|
|
5966
|
+
if (typeof props.width === "number")
|
|
5967
|
+
widthChange(props.width);
|
|
5968
|
+
});
|
|
5969
|
+
}
|
|
5498
5970
|
const changeLeft = ({ deltaX }) => {
|
|
5499
5971
|
if (typeof props.left === "undefined")
|
|
5500
5972
|
return;
|
|
@@ -5503,7 +5975,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5503
5975
|
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
5504
5976
|
left = props.left;
|
|
5505
5977
|
}
|
|
5506
|
-
const columnWidth = getCenterWidth(
|
|
5978
|
+
const columnWidth = getCenterWidth(left, props.right || 0);
|
|
5507
5979
|
center.value = columnWidth.center;
|
|
5508
5980
|
emit("change", {
|
|
5509
5981
|
left: columnWidth.left,
|
|
@@ -5519,7 +5991,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5519
5991
|
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
5520
5992
|
right = props.right;
|
|
5521
5993
|
}
|
|
5522
|
-
const columnWidth = getCenterWidth(
|
|
5994
|
+
const columnWidth = getCenterWidth(props.left, right);
|
|
5523
5995
|
center.value = columnWidth.center;
|
|
5524
5996
|
emit("change", {
|
|
5525
5997
|
left: columnWidth.left,
|
|
@@ -5529,7 +6001,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5529
6001
|
};
|
|
5530
6002
|
__expose({
|
|
5531
6003
|
updateWidth() {
|
|
5532
|
-
|
|
6004
|
+
clientWidth = props.width ?? el.value?.clientWidth ?? clientWidth;
|
|
6005
|
+
const columnWidth = getCenterWidth(props.left, props.right);
|
|
5533
6006
|
emit("change", {
|
|
5534
6007
|
left: columnWidth.left,
|
|
5535
6008
|
center: center.value,
|
|
@@ -5551,7 +6024,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5551
6024
|
}, [
|
|
5552
6025
|
renderSlot(_ctx.$slots, "left")
|
|
5553
6026
|
], 6),
|
|
5554
|
-
createVNode(_sfc_main$
|
|
6027
|
+
createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
5555
6028
|
], 64)) : createCommentVNode("", true),
|
|
5556
6029
|
createElementVNode("div", {
|
|
5557
6030
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -5560,7 +6033,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5560
6033
|
renderSlot(_ctx.$slots, "center")
|
|
5561
6034
|
], 6),
|
|
5562
6035
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5563
|
-
createVNode(_sfc_main$
|
|
6036
|
+
createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
5564
6037
|
createElementVNode("div", {
|
|
5565
6038
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
5566
6039
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -5573,12 +6046,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5573
6046
|
}
|
|
5574
6047
|
});
|
|
5575
6048
|
|
|
5576
|
-
const _hoisted_1$
|
|
6049
|
+
const _hoisted_1$e = {
|
|
5577
6050
|
key: 1,
|
|
5578
6051
|
class: "menu-item-text"
|
|
5579
6052
|
};
|
|
5580
6053
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
5581
|
-
const _sfc_main$
|
|
6054
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
5582
6055
|
...{
|
|
5583
6056
|
name: "MEditorToolButton"
|
|
5584
6057
|
},
|
|
@@ -5657,7 +6130,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5657
6130
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
5658
6131
|
key: 0,
|
|
5659
6132
|
direction: _ctx.data.direction || "vertical"
|
|
5660
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6133
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$e, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
5661
6134
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
5662
6135
|
key: 0,
|
|
5663
6136
|
effect: "dark",
|
|
@@ -5671,7 +6144,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5671
6144
|
disabled: disabled.value
|
|
5672
6145
|
}, {
|
|
5673
6146
|
default: withCtx(() => [
|
|
5674
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
6147
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5675
6148
|
key: 0,
|
|
5676
6149
|
icon: _ctx.data.icon
|
|
5677
6150
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5689,7 +6162,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5689
6162
|
title: _ctx.data.text
|
|
5690
6163
|
}, {
|
|
5691
6164
|
default: withCtx(() => [
|
|
5692
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
6165
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5693
6166
|
key: 0,
|
|
5694
6167
|
icon: _ctx.data.icon
|
|
5695
6168
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5739,11 +6212,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5739
6212
|
}
|
|
5740
6213
|
});
|
|
5741
6214
|
|
|
5742
|
-
const _hoisted_1$
|
|
6215
|
+
const _hoisted_1$d = {
|
|
5743
6216
|
key: 1,
|
|
5744
6217
|
style: { "width": "21px" }
|
|
5745
6218
|
};
|
|
5746
|
-
const _sfc_main$
|
|
6219
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
5747
6220
|
...{
|
|
5748
6221
|
name: "MEditorPageBarAddButton"
|
|
5749
6222
|
},
|
|
@@ -5777,13 +6250,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5777
6250
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5778
6251
|
onClick: addPage
|
|
5779
6252
|
}, [
|
|
5780
|
-
createVNode(_sfc_main$
|
|
5781
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6253
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6254
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$d));
|
|
5782
6255
|
};
|
|
5783
6256
|
}
|
|
5784
6257
|
});
|
|
5785
6258
|
|
|
5786
|
-
const _sfc_main$
|
|
6259
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
5787
6260
|
...{
|
|
5788
6261
|
name: "MEditorPageBarScrollContainer"
|
|
5789
6262
|
},
|
|
@@ -5889,7 +6362,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5889
6362
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5890
6363
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5891
6364
|
}, [
|
|
5892
|
-
createVNode(_sfc_main$
|
|
6365
|
+
createVNode(_sfc_main$N, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
5893
6366
|
])) : createCommentVNode("", true),
|
|
5894
6367
|
_ctx.type === unref(NodeType).PAGE && pageLength.value || _ctx.type === unref(NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (openBlock(), createElementBlock("div", {
|
|
5895
6368
|
key: 1,
|
|
@@ -5905,14 +6378,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5905
6378
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5906
6379
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5907
6380
|
}, [
|
|
5908
|
-
createVNode(_sfc_main$
|
|
6381
|
+
createVNode(_sfc_main$N, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
5909
6382
|
])) : createCommentVNode("", true)
|
|
5910
6383
|
], 512);
|
|
5911
6384
|
};
|
|
5912
6385
|
}
|
|
5913
6386
|
});
|
|
5914
6387
|
|
|
5915
|
-
const _sfc_main$
|
|
6388
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
5916
6389
|
...{
|
|
5917
6390
|
name: "MEditorPageBarSwitchTypeButton"
|
|
5918
6391
|
},
|
|
@@ -5956,11 +6429,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5956
6429
|
}
|
|
5957
6430
|
});
|
|
5958
6431
|
|
|
5959
|
-
const _hoisted_1$
|
|
6432
|
+
const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
5960
6433
|
const _hoisted_2$8 = ["onClick"];
|
|
5961
6434
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
5962
6435
|
const _hoisted_4$5 = ["title"];
|
|
5963
|
-
const _sfc_main$
|
|
6436
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
5964
6437
|
...{
|
|
5965
6438
|
name: "MEditorPageBar"
|
|
5966
6439
|
},
|
|
@@ -6038,15 +6511,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6038
6511
|
editorService?.remove(node);
|
|
6039
6512
|
};
|
|
6040
6513
|
return (_ctx, _cache) => {
|
|
6041
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6042
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$
|
|
6514
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
6515
|
+
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$u, {
|
|
6043
6516
|
key: 0,
|
|
6044
6517
|
modelValue: active.value,
|
|
6045
6518
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
6046
6519
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
6047
|
-
createVNode(_sfc_main$
|
|
6520
|
+
createVNode(_sfc_main$v, { type: active.value }, {
|
|
6048
6521
|
prepend: withCtx(() => [
|
|
6049
|
-
createVNode(_sfc_main$
|
|
6522
|
+
createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
6050
6523
|
]),
|
|
6051
6524
|
default: withCtx(() => [
|
|
6052
6525
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
@@ -6079,7 +6552,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6079
6552
|
default: withCtx(() => [
|
|
6080
6553
|
createElementVNode("div", null, [
|
|
6081
6554
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
6082
|
-
createVNode(_sfc_main$
|
|
6555
|
+
createVNode(_sfc_main$x, {
|
|
6083
6556
|
data: {
|
|
6084
6557
|
type: "button",
|
|
6085
6558
|
text: "复制",
|
|
@@ -6087,7 +6560,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6087
6560
|
handler: () => copy(item)
|
|
6088
6561
|
}
|
|
6089
6562
|
}, null, 8, ["data"]),
|
|
6090
|
-
createVNode(_sfc_main$
|
|
6563
|
+
createVNode(_sfc_main$x, {
|
|
6091
6564
|
data: {
|
|
6092
6565
|
type: "button",
|
|
6093
6566
|
text: "删除",
|
|
@@ -6110,11 +6583,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6110
6583
|
}
|
|
6111
6584
|
});
|
|
6112
6585
|
|
|
6113
|
-
const _hoisted_1$
|
|
6586
|
+
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
6114
6587
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
6115
6588
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
6116
6589
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
6117
|
-
const _sfc_main$
|
|
6590
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6118
6591
|
...{
|
|
6119
6592
|
name: "MEditorAddPageBox"
|
|
6120
6593
|
},
|
|
@@ -6138,14 +6611,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6138
6611
|
});
|
|
6139
6612
|
};
|
|
6140
6613
|
return (_ctx, _cache) => {
|
|
6141
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6614
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
6142
6615
|
createElementVNode("div", _hoisted_2$7, [
|
|
6143
6616
|
createElementVNode("div", {
|
|
6144
6617
|
class: "m-editor-empty-button",
|
|
6145
6618
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
|
|
6146
6619
|
}, [
|
|
6147
6620
|
createElementVNode("div", null, [
|
|
6148
|
-
createVNode(_sfc_main$
|
|
6621
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6149
6622
|
]),
|
|
6150
6623
|
_hoisted_3$4
|
|
6151
6624
|
]),
|
|
@@ -6155,7 +6628,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6155
6628
|
onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(unref(NodeType).PAGE_FRAGMENT))
|
|
6156
6629
|
}, [
|
|
6157
6630
|
createElementVNode("div", null, [
|
|
6158
|
-
createVNode(_sfc_main$
|
|
6631
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6159
6632
|
]),
|
|
6160
6633
|
_hoisted_4$4
|
|
6161
6634
|
])) : createCommentVNode("", true)
|
|
@@ -6169,7 +6642,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
6169
6642
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
6170
6643
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
6171
6644
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
6172
|
-
const _sfc_main$
|
|
6645
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6173
6646
|
...{
|
|
6174
6647
|
name: "MEditorFramework"
|
|
6175
6648
|
},
|
|
@@ -6188,36 +6661,14 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6188
6661
|
const stageLoading = computed(() => editorService?.get("stageLoading") || false);
|
|
6189
6662
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
6190
6663
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
6191
|
-
const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
|
|
6192
|
-
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
6193
6664
|
const columnWidth = ref({
|
|
6194
|
-
left:
|
|
6665
|
+
left: getLeftColumnWidthCacheData(),
|
|
6195
6666
|
center: 0,
|
|
6196
|
-
right:
|
|
6667
|
+
right: Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH
|
|
6668
|
+
});
|
|
6669
|
+
watch(pageLength, () => {
|
|
6670
|
+
splitView.value?.updateWidth();
|
|
6197
6671
|
});
|
|
6198
|
-
watch(
|
|
6199
|
-
[pageLength, splitView],
|
|
6200
|
-
() => {
|
|
6201
|
-
splitView.value?.updateWidth();
|
|
6202
|
-
},
|
|
6203
|
-
{
|
|
6204
|
-
immediate: true
|
|
6205
|
-
}
|
|
6206
|
-
);
|
|
6207
|
-
watch(
|
|
6208
|
-
() => columnWidth.value.right,
|
|
6209
|
-
(right) => {
|
|
6210
|
-
if (typeof right === "undefined")
|
|
6211
|
-
return;
|
|
6212
|
-
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
|
|
6213
|
-
}
|
|
6214
|
-
);
|
|
6215
|
-
watch(
|
|
6216
|
-
() => columnWidth.value.left,
|
|
6217
|
-
(left) => {
|
|
6218
|
-
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
6219
|
-
}
|
|
6220
|
-
);
|
|
6221
6672
|
watch(
|
|
6222
6673
|
() => uiService?.get("hideSlideBar"),
|
|
6223
6674
|
(hideSlideBar) => {
|
|
@@ -6225,11 +6676,29 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6225
6676
|
}
|
|
6226
6677
|
);
|
|
6227
6678
|
const columnWidthChange = (columnW) => {
|
|
6228
|
-
columnWidth.value
|
|
6229
|
-
|
|
6230
|
-
|
|
6679
|
+
columnWidth.value = columnW;
|
|
6680
|
+
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.left}`);
|
|
6681
|
+
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.right}`);
|
|
6231
6682
|
uiService?.set("columnWidth", columnW);
|
|
6232
6683
|
};
|
|
6684
|
+
const frameworkRect = computed(() => uiService?.get("frameworkRect"));
|
|
6685
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
6686
|
+
const { contentRect } = entries[0];
|
|
6687
|
+
uiService?.set("frameworkRect", {
|
|
6688
|
+
width: contentRect.width,
|
|
6689
|
+
height: contentRect.height,
|
|
6690
|
+
left: contentRect.left,
|
|
6691
|
+
top: contentRect.top
|
|
6692
|
+
});
|
|
6693
|
+
});
|
|
6694
|
+
onMounted(() => {
|
|
6695
|
+
if (content.value) {
|
|
6696
|
+
resizerObserver.observe(content.value);
|
|
6697
|
+
}
|
|
6698
|
+
});
|
|
6699
|
+
onBeforeUnmount(() => {
|
|
6700
|
+
resizerObserver.disconnect();
|
|
6701
|
+
});
|
|
6233
6702
|
const saveCode = (value) => {
|
|
6234
6703
|
try {
|
|
6235
6704
|
const parseDSL = getConfig("parseDSL");
|
|
@@ -6256,7 +6725,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6256
6725
|
options: unref(codeOptions),
|
|
6257
6726
|
onSave: saveCode
|
|
6258
6727
|
}, null, 8, ["init-values", "options"])
|
|
6259
|
-
]) : withDirectives((openBlock(), createBlock(_sfc_main$
|
|
6728
|
+
]) : withDirectives((openBlock(), createBlock(_sfc_main$y, {
|
|
6260
6729
|
key: 1,
|
|
6261
6730
|
"element-loading-text": "Runtime 加载中...",
|
|
6262
6731
|
ref_key: "splitView",
|
|
@@ -6272,6 +6741,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6272
6741
|
"min-left": 65,
|
|
6273
6742
|
"min-right": 20,
|
|
6274
6743
|
"min-center": 100,
|
|
6744
|
+
width: frameworkRect.value?.width || 0,
|
|
6275
6745
|
onChange: columnWidthChange
|
|
6276
6746
|
}, createSlots({
|
|
6277
6747
|
left: withCtx(() => [
|
|
@@ -6279,10 +6749,10 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6279
6749
|
]),
|
|
6280
6750
|
center: withCtx(() => [
|
|
6281
6751
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
6282
|
-
createVNode(_sfc_main$
|
|
6752
|
+
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
6283
6753
|
]),
|
|
6284
6754
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
6285
|
-
createVNode(_sfc_main$
|
|
6755
|
+
createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
6286
6756
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
6287
6757
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6288
6758
|
]),
|
|
@@ -6307,7 +6777,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6307
6777
|
]),
|
|
6308
6778
|
key: "0"
|
|
6309
6779
|
} : void 0
|
|
6310
|
-
]), 1032, ["left", "right"])), [
|
|
6780
|
+
]), 1032, ["left", "right", "width"])), [
|
|
6311
6781
|
[_directive_loading, stageLoading.value]
|
|
6312
6782
|
]),
|
|
6313
6783
|
renderSlot(_ctx.$slots, "content-after"),
|
|
@@ -6317,7 +6787,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6317
6787
|
}
|
|
6318
6788
|
});
|
|
6319
6789
|
|
|
6320
|
-
const _sfc_main$
|
|
6790
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
6321
6791
|
...{
|
|
6322
6792
|
name: "MEditorNavMenu"
|
|
6323
6793
|
},
|
|
@@ -6467,10 +6937,30 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6467
6937
|
});
|
|
6468
6938
|
return data;
|
|
6469
6939
|
});
|
|
6940
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
6941
|
+
const rect = navMenu.value?.getBoundingClientRect();
|
|
6942
|
+
if (rect) {
|
|
6943
|
+
uiService?.set("navMenuRect", {
|
|
6944
|
+
left: rect.left,
|
|
6945
|
+
top: rect.top,
|
|
6946
|
+
width: rect.width,
|
|
6947
|
+
height: rect.height
|
|
6948
|
+
});
|
|
6949
|
+
}
|
|
6950
|
+
});
|
|
6951
|
+
const navMenu = ref();
|
|
6952
|
+
onMounted(() => {
|
|
6953
|
+
navMenu.value && resizeObserver.observe(navMenu.value);
|
|
6954
|
+
});
|
|
6955
|
+
onBeforeUnmount(() => {
|
|
6956
|
+
resizeObserver.disconnect();
|
|
6957
|
+
});
|
|
6470
6958
|
return (_ctx, _cache) => {
|
|
6471
6959
|
return openBlock(), createElementBlock("div", {
|
|
6472
6960
|
class: "m-editor-nav-menu",
|
|
6473
|
-
style: normalizeStyle({ height: `${_ctx.height}px` })
|
|
6961
|
+
style: normalizeStyle({ height: `${_ctx.height}px` }),
|
|
6962
|
+
ref_key: "navMenu",
|
|
6963
|
+
ref: navMenu
|
|
6474
6964
|
}, [
|
|
6475
6965
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(keys), (key) => {
|
|
6476
6966
|
return openBlock(), createElementBlock("div", {
|
|
@@ -6479,7 +6969,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6479
6969
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
6480
6970
|
}, [
|
|
6481
6971
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
6482
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6972
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
6483
6973
|
data: item,
|
|
6484
6974
|
key: index
|
|
6485
6975
|
}, null, 8, ["data"]);
|
|
@@ -6491,8 +6981,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6491
6981
|
}
|
|
6492
6982
|
});
|
|
6493
6983
|
|
|
6494
|
-
const _hoisted_1$
|
|
6495
|
-
const _sfc_main$
|
|
6984
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
6985
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
6496
6986
|
...{
|
|
6497
6987
|
name: "MEditorPropsPanel"
|
|
6498
6988
|
},
|
|
@@ -6502,7 +6992,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6502
6992
|
},
|
|
6503
6993
|
emits: ["mounted", "submit-error", "form-error"],
|
|
6504
6994
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6995
|
+
const codeOptions = inject("codeOptions", {});
|
|
6505
6996
|
const emit = __emit;
|
|
6997
|
+
const showSrc = ref(false);
|
|
6506
6998
|
const internalInstance = getCurrentInstance();
|
|
6507
6999
|
const values = ref({});
|
|
6508
7000
|
const configForm = ref();
|
|
@@ -6512,6 +7004,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6512
7004
|
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
6513
7005
|
const propsPanelSize = computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
6514
7006
|
const stage = computed(() => services?.editorService.get("stage"));
|
|
7007
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
6515
7008
|
const init = async () => {
|
|
6516
7009
|
if (!node.value) {
|
|
6517
7010
|
curFormConfig.value = [];
|
|
@@ -6545,9 +7038,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6545
7038
|
const errorHandler = (e) => {
|
|
6546
7039
|
emit("form-error", e);
|
|
6547
7040
|
};
|
|
7041
|
+
const saveCode = (values2) => {
|
|
7042
|
+
services?.editorService.update(values2);
|
|
7043
|
+
};
|
|
6548
7044
|
__expose({ configForm, submit });
|
|
6549
7045
|
return (_ctx, _cache) => {
|
|
6550
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
7046
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
6551
7047
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
6552
7048
|
createVNode(unref(MForm), {
|
|
6553
7049
|
ref_key: "configForm",
|
|
@@ -6560,7 +7056,24 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6560
7056
|
"extend-state": _ctx.extendState,
|
|
6561
7057
|
onChange: submit,
|
|
6562
7058
|
onError: errorHandler
|
|
6563
|
-
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
|
|
7059
|
+
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"]),
|
|
7060
|
+
createVNode(unref(TMagicButton), {
|
|
7061
|
+
class: "m-editor-props-panel-src-icon",
|
|
7062
|
+
circle: "",
|
|
7063
|
+
size: "large",
|
|
7064
|
+
title: "源码",
|
|
7065
|
+
icon: unref(Document),
|
|
7066
|
+
type: showSrc.value ? "primary" : "",
|
|
7067
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
7068
|
+
}, null, 8, ["icon", "type"]),
|
|
7069
|
+
showSrc.value ? (openBlock(), createBlock(_sfc_main$U, {
|
|
7070
|
+
key: 0,
|
|
7071
|
+
height: `${unref(editorContentHeight)}px`,
|
|
7072
|
+
"init-values": values.value,
|
|
7073
|
+
options: unref(codeOptions),
|
|
7074
|
+
parse: true,
|
|
7075
|
+
onSave: saveCode
|
|
7076
|
+
}, null, 8, ["height", "init-values", "options"])) : createCommentVNode("", true)
|
|
6564
7077
|
], 512)), [
|
|
6565
7078
|
[vShow, nodes.value.length === 1]
|
|
6566
7079
|
]);
|
|
@@ -6568,116 +7081,6 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6568
7081
|
}
|
|
6569
7082
|
});
|
|
6570
7083
|
|
|
6571
|
-
const _hoisted_1$a = { class: "m-editor-float-box-body" };
|
|
6572
|
-
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
6573
|
-
__name: "FloatingBox",
|
|
6574
|
-
props: {
|
|
6575
|
-
visible: { type: Boolean, default: false },
|
|
6576
|
-
position: { default: () => ({ left: 0, top: 0 }) },
|
|
6577
|
-
rect: { default: () => ({ width: "auto", height: "auto" }) },
|
|
6578
|
-
title: { default: "" }
|
|
6579
|
-
},
|
|
6580
|
-
emits: ["update:visible"],
|
|
6581
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6582
|
-
const props = __props;
|
|
6583
|
-
const emit = __emit;
|
|
6584
|
-
const target = ref();
|
|
6585
|
-
const dragTarget = ref();
|
|
6586
|
-
const style = computed(() => ({
|
|
6587
|
-
left: `${props.position.left}px`,
|
|
6588
|
-
top: `${props.position.top}px`,
|
|
6589
|
-
width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
|
|
6590
|
-
height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
|
|
6591
|
-
}));
|
|
6592
|
-
let moveable = null;
|
|
6593
|
-
const initMoveable = () => {
|
|
6594
|
-
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
6595
|
-
className: "m-editor-floating-box-moveable",
|
|
6596
|
-
target: target.value,
|
|
6597
|
-
draggable: true,
|
|
6598
|
-
resizable: true,
|
|
6599
|
-
edge: true,
|
|
6600
|
-
keepRatio: false,
|
|
6601
|
-
origin: false,
|
|
6602
|
-
snappable: true,
|
|
6603
|
-
dragTarget: dragTarget.value,
|
|
6604
|
-
dragTargetSelf: false,
|
|
6605
|
-
linePadding: 10,
|
|
6606
|
-
controlPadding: 10
|
|
6607
|
-
});
|
|
6608
|
-
moveable.on("drag", (e) => {
|
|
6609
|
-
e.target.style.transform = e.transform;
|
|
6610
|
-
});
|
|
6611
|
-
moveable.on("resize", (e) => {
|
|
6612
|
-
e.target.style.width = `${e.width}px`;
|
|
6613
|
-
e.target.style.height = `${e.height}px`;
|
|
6614
|
-
e.target.style.transform = e.drag.transform;
|
|
6615
|
-
});
|
|
6616
|
-
};
|
|
6617
|
-
const destroyMoveable = () => {
|
|
6618
|
-
moveable?.destroy();
|
|
6619
|
-
moveable = null;
|
|
6620
|
-
};
|
|
6621
|
-
watch(
|
|
6622
|
-
() => props.visible,
|
|
6623
|
-
async (visible) => {
|
|
6624
|
-
if (visible) {
|
|
6625
|
-
await nextTick();
|
|
6626
|
-
initMoveable();
|
|
6627
|
-
} else {
|
|
6628
|
-
destroyMoveable();
|
|
6629
|
-
}
|
|
6630
|
-
},
|
|
6631
|
-
{
|
|
6632
|
-
immediate: true
|
|
6633
|
-
}
|
|
6634
|
-
);
|
|
6635
|
-
onBeforeUnmount(() => {
|
|
6636
|
-
destroyMoveable();
|
|
6637
|
-
});
|
|
6638
|
-
const closeHandler = () => {
|
|
6639
|
-
emit("update:visible", false);
|
|
6640
|
-
};
|
|
6641
|
-
__expose({
|
|
6642
|
-
target
|
|
6643
|
-
});
|
|
6644
|
-
return (_ctx, _cache) => {
|
|
6645
|
-
return _ctx.visible ? (openBlock(), createBlock(Teleport, {
|
|
6646
|
-
key: 0,
|
|
6647
|
-
to: "body"
|
|
6648
|
-
}, [
|
|
6649
|
-
createElementVNode("div", {
|
|
6650
|
-
ref_key: "target",
|
|
6651
|
-
ref: target,
|
|
6652
|
-
class: "m-editor-float-box",
|
|
6653
|
-
style: normalizeStyle(style.value)
|
|
6654
|
-
}, [
|
|
6655
|
-
createElementVNode("div", {
|
|
6656
|
-
ref_key: "dragTarget",
|
|
6657
|
-
ref: dragTarget,
|
|
6658
|
-
class: "m-editor-float-box-title"
|
|
6659
|
-
}, [
|
|
6660
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
6661
|
-
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
6662
|
-
]),
|
|
6663
|
-
createElementVNode("div", null, [
|
|
6664
|
-
createVNode(unref(TMagicButton), {
|
|
6665
|
-
link: "",
|
|
6666
|
-
size: "small",
|
|
6667
|
-
icon: unref(Close),
|
|
6668
|
-
onClick: closeHandler
|
|
6669
|
-
}, null, 8, ["icon"])
|
|
6670
|
-
])
|
|
6671
|
-
], 512),
|
|
6672
|
-
createElementVNode("div", _hoisted_1$a, [
|
|
6673
|
-
renderSlot(_ctx.$slots, "body")
|
|
6674
|
-
])
|
|
6675
|
-
], 4)
|
|
6676
|
-
])) : createCommentVNode("", true);
|
|
6677
|
-
};
|
|
6678
|
-
}
|
|
6679
|
-
});
|
|
6680
|
-
|
|
6681
7084
|
const useFloatBox = (slideKeys) => {
|
|
6682
7085
|
const floatBoxStates = ref(
|
|
6683
7086
|
slideKeys.value.reduce(
|
|
@@ -6695,33 +7098,33 @@ const useFloatBox = (slideKeys) => {
|
|
|
6695
7098
|
const showingBoxKeys = computed(
|
|
6696
7099
|
() => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
|
|
6697
7100
|
);
|
|
6698
|
-
const
|
|
6699
|
-
const dragstartHandler = () =>
|
|
7101
|
+
const isDragging = ref(false);
|
|
7102
|
+
const dragstartHandler = () => isDragging.value = true;
|
|
6700
7103
|
const dragendHandler = (key, e) => {
|
|
6701
7104
|
floatBoxStates.value[key] = {
|
|
6702
7105
|
left: e.clientX,
|
|
6703
7106
|
top: e.clientY,
|
|
6704
7107
|
status: true
|
|
6705
7108
|
};
|
|
6706
|
-
|
|
7109
|
+
isDragging.value = false;
|
|
6707
7110
|
};
|
|
6708
7111
|
document.body.addEventListener("dragover", (e) => {
|
|
6709
|
-
if (!
|
|
7112
|
+
if (!isDragging.value)
|
|
6710
7113
|
return;
|
|
6711
7114
|
e.preventDefault();
|
|
6712
7115
|
});
|
|
6713
7116
|
watch(
|
|
6714
7117
|
() => slideKeys.value,
|
|
6715
|
-
() => {
|
|
6716
|
-
|
|
7118
|
+
(slideKeys2) => {
|
|
7119
|
+
slideKeys2.forEach((key) => {
|
|
6717
7120
|
if (floatBoxStates.value[key])
|
|
6718
|
-
|
|
7121
|
+
return;
|
|
6719
7122
|
floatBoxStates.value[key] = {
|
|
6720
7123
|
status: false,
|
|
6721
7124
|
top: 0,
|
|
6722
7125
|
left: 0
|
|
6723
7126
|
};
|
|
6724
|
-
}
|
|
7127
|
+
});
|
|
6725
7128
|
},
|
|
6726
7129
|
{
|
|
6727
7130
|
deep: true,
|
|
@@ -6861,7 +7264,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6861
7264
|
onContextmenu: nodeContentmenuHandler,
|
|
6862
7265
|
onMouseenter: mouseenterHandler
|
|
6863
7266
|
}, [
|
|
6864
|
-
createVNode(_sfc_main$
|
|
7267
|
+
createVNode(_sfc_main$N, {
|
|
6865
7268
|
class: "expand-icon",
|
|
6866
7269
|
style: normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
|
|
6867
7270
|
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
@@ -7140,7 +7543,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7140
7543
|
placement: "bottom"
|
|
7141
7544
|
}, {
|
|
7142
7545
|
default: withCtx(() => [
|
|
7143
|
-
createVNode(_sfc_main$
|
|
7546
|
+
createVNode(_sfc_main$N, {
|
|
7144
7547
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
7145
7548
|
class: "edit-icon",
|
|
7146
7549
|
onClick: withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
@@ -7155,7 +7558,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7155
7558
|
placement: "bottom"
|
|
7156
7559
|
}, {
|
|
7157
7560
|
default: withCtx(() => [
|
|
7158
|
-
createVNode(_sfc_main$
|
|
7561
|
+
createVNode(_sfc_main$N, {
|
|
7159
7562
|
icon: unref(Close),
|
|
7160
7563
|
class: "edit-icon",
|
|
7161
7564
|
onClick: withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
@@ -7232,7 +7635,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7232
7635
|
]),
|
|
7233
7636
|
_: 3
|
|
7234
7637
|
}),
|
|
7235
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
7638
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
7236
7639
|
key: 0,
|
|
7237
7640
|
ref_key: "codeBlockEditor",
|
|
7238
7641
|
ref: codeBlockEditor,
|
|
@@ -7413,7 +7816,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7413
7816
|
placement: "bottom"
|
|
7414
7817
|
}, {
|
|
7415
7818
|
default: withCtx(() => [
|
|
7416
|
-
createVNode(_sfc_main$
|
|
7819
|
+
createVNode(_sfc_main$N, {
|
|
7417
7820
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
7418
7821
|
class: "edit-icon",
|
|
7419
7822
|
onClick: withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
@@ -7428,7 +7831,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7428
7831
|
placement: "bottom"
|
|
7429
7832
|
}, {
|
|
7430
7833
|
default: withCtx(() => [
|
|
7431
|
-
createVNode(_sfc_main$
|
|
7834
|
+
createVNode(_sfc_main$N, {
|
|
7432
7835
|
icon: unref(Close),
|
|
7433
7836
|
class: "edit-icon",
|
|
7434
7837
|
onClick: withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
@@ -7530,7 +7933,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7530
7933
|
default: withCtx(() => [
|
|
7531
7934
|
createElementVNode("div", _hoisted_2$5, [
|
|
7532
7935
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
7533
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7936
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
7534
7937
|
data: {
|
|
7535
7938
|
type: "button",
|
|
7536
7939
|
text: item.text,
|
|
@@ -7699,7 +8102,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7699
8102
|
renderSlot(_ctx.$slots, "title"),
|
|
7700
8103
|
createElementVNode("div", null, [
|
|
7701
8104
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
7702
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8105
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
7703
8106
|
"event-type": "mouseup",
|
|
7704
8107
|
ref_for: true,
|
|
7705
8108
|
ref_key: "buttons",
|
|
@@ -7964,12 +8367,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
7964
8367
|
};
|
|
7965
8368
|
return (_ctx, _cache) => {
|
|
7966
8369
|
return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
7967
|
-
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$
|
|
8370
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$N, {
|
|
7968
8371
|
key: 0,
|
|
7969
8372
|
icon: unref(Hide),
|
|
7970
8373
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
7971
8374
|
title: "点击显示"
|
|
7972
|
-
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$
|
|
8375
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$N, {
|
|
7973
8376
|
key: 1,
|
|
7974
8377
|
icon: unref(View),
|
|
7975
8378
|
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -8610,7 +9013,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
8610
9013
|
name: `${index}`
|
|
8611
9014
|
}, {
|
|
8612
9015
|
title: withCtx(() => [
|
|
8613
|
-
createVNode(_sfc_main$
|
|
9016
|
+
createVNode(_sfc_main$N, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
8614
9017
|
createTextVNode(toDisplayString(group.title), 1)
|
|
8615
9018
|
]),
|
|
8616
9019
|
default: withCtx(() => [
|
|
@@ -8631,7 +9034,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
8631
9034
|
content: item.desc
|
|
8632
9035
|
}, {
|
|
8633
9036
|
default: withCtx(() => [
|
|
8634
|
-
createVNode(_sfc_main$
|
|
9037
|
+
createVNode(_sfc_main$N, {
|
|
8635
9038
|
icon: item.icon
|
|
8636
9039
|
}, null, 8, ["icon"])
|
|
8637
9040
|
]),
|
|
@@ -8682,6 +9085,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8682
9085
|
setup(__props, { expose: __expose }) {
|
|
8683
9086
|
const props = __props;
|
|
8684
9087
|
const services = inject("services");
|
|
9088
|
+
const columnLeftWitch = computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
|
|
8685
9089
|
const activeTabName = ref(props.data?.status);
|
|
8686
9090
|
const getItemConfig = (data) => {
|
|
8687
9091
|
const map = {
|
|
@@ -8711,7 +9115,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8711
9115
|
icon: EditPen,
|
|
8712
9116
|
text: "代码编辑",
|
|
8713
9117
|
component: _sfc_main$k,
|
|
8714
|
-
slots: {}
|
|
9118
|
+
slots: {},
|
|
9119
|
+
boxComponentConfig: {
|
|
9120
|
+
props: {
|
|
9121
|
+
slideType: "box"
|
|
9122
|
+
}
|
|
9123
|
+
}
|
|
8715
9124
|
},
|
|
8716
9125
|
"data-source": {
|
|
8717
9126
|
$key: "data-source",
|
|
@@ -8768,7 +9177,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8768
9177
|
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
8769
9178
|
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
8770
9179
|
}, [
|
|
8771
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
9180
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
8772
9181
|
key: 0,
|
|
8773
9182
|
icon: config.icon
|
|
8774
9183
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -8901,10 +9310,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8901
9310
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
8902
9311
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
8903
9312
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8904
|
-
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$
|
|
9313
|
+
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
8905
9314
|
key: config.$key ?? index,
|
|
8906
9315
|
visible: unref(floatBoxStates)[config.$key].status,
|
|
8907
9316
|
"onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
|
|
9317
|
+
width: columnLeftWitch.value,
|
|
9318
|
+
height: 600,
|
|
8908
9319
|
title: config.text,
|
|
8909
9320
|
position: {
|
|
8910
9321
|
left: unref(floatBoxStates)[config.$key].left,
|
|
@@ -8917,7 +9328,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8917
9328
|
])
|
|
8918
9329
|
]),
|
|
8919
9330
|
_: 2
|
|
8920
|
-
}, 1032, ["visible", "onUpdate:visible", "title", "position"])) : createCommentVNode("", true)
|
|
9331
|
+
}, 1032, ["visible", "onUpdate:visible", "width", "title", "position"])) : createCommentVNode("", true)
|
|
8921
9332
|
], 64);
|
|
8922
9333
|
}), 256))
|
|
8923
9334
|
]))
|
|
@@ -9270,15 +9681,27 @@ const state = reactive({
|
|
|
9270
9681
|
showRule: true,
|
|
9271
9682
|
propsPanelSize: "small",
|
|
9272
9683
|
showAddPageButton: true,
|
|
9273
|
-
|
|
9274
|
-
|
|
9684
|
+
hideSlideBar: false,
|
|
9685
|
+
navMenuRect: {
|
|
9686
|
+
left: 0,
|
|
9687
|
+
top: 0,
|
|
9688
|
+
width: 0,
|
|
9689
|
+
height: 0
|
|
9690
|
+
},
|
|
9691
|
+
frameworkRect: {
|
|
9692
|
+
width: 0,
|
|
9693
|
+
height: 0,
|
|
9694
|
+
left: 0,
|
|
9695
|
+
top: 0
|
|
9696
|
+
}
|
|
9275
9697
|
});
|
|
9698
|
+
const canUsePluginMethods$2 = {
|
|
9699
|
+
async: ["zoom", "calcZoom"],
|
|
9700
|
+
sync: []
|
|
9701
|
+
};
|
|
9276
9702
|
class Ui extends BaseService {
|
|
9277
9703
|
constructor() {
|
|
9278
|
-
super(
|
|
9279
|
-
{ name: "zoom", isAsync: true },
|
|
9280
|
-
{ name: "calcZoom", isAsync: true }
|
|
9281
|
-
]);
|
|
9704
|
+
super(canUsePluginMethods$2.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
9282
9705
|
}
|
|
9283
9706
|
set(name, value) {
|
|
9284
9707
|
const mask = editorService.get("stage")?.mask;
|
|
@@ -9316,19 +9739,6 @@ class Ui extends BaseService {
|
|
|
9316
9739
|
}
|
|
9317
9740
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
9318
9741
|
}
|
|
9319
|
-
async setFloatBox(keys) {
|
|
9320
|
-
const map = state.floatBox;
|
|
9321
|
-
for (const key of keys) {
|
|
9322
|
-
if (map.get(key))
|
|
9323
|
-
continue;
|
|
9324
|
-
map.set(key, {
|
|
9325
|
-
status: false,
|
|
9326
|
-
zIndex: 99,
|
|
9327
|
-
top: 0,
|
|
9328
|
-
left: 0
|
|
9329
|
-
});
|
|
9330
|
-
}
|
|
9331
|
-
}
|
|
9332
9742
|
resetState() {
|
|
9333
9743
|
this.set("showSrc", false);
|
|
9334
9744
|
this.set("uiSelectMode", false);
|
|
@@ -9343,6 +9753,9 @@ class Ui extends BaseService {
|
|
|
9343
9753
|
this.removeAllListeners();
|
|
9344
9754
|
this.removeAllPlugins();
|
|
9345
9755
|
}
|
|
9756
|
+
usePlugin(options) {
|
|
9757
|
+
super.usePlugin(options);
|
|
9758
|
+
}
|
|
9346
9759
|
async setStageRect(value) {
|
|
9347
9760
|
state.stageRect = {
|
|
9348
9761
|
...state.stageRect,
|
|
@@ -9534,7 +9947,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
9534
9947
|
]),
|
|
9535
9948
|
_: 1
|
|
9536
9949
|
})) : createCommentVNode("", true),
|
|
9537
|
-
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
9950
|
+
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
9538
9951
|
key: 1,
|
|
9539
9952
|
ref_key: "box",
|
|
9540
9953
|
ref: box,
|
|
@@ -10076,6 +10489,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10076
10489
|
}
|
|
10077
10490
|
});
|
|
10078
10491
|
|
|
10492
|
+
const canUsePluginMethods$1 = {
|
|
10493
|
+
async: ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"],
|
|
10494
|
+
sync: []
|
|
10495
|
+
};
|
|
10079
10496
|
class CodeBlock extends BaseService {
|
|
10080
10497
|
state = reactive({
|
|
10081
10498
|
codeDsl: null,
|
|
@@ -10085,13 +10502,7 @@ class CodeBlock extends BaseService {
|
|
|
10085
10502
|
paramsColConfig: void 0
|
|
10086
10503
|
});
|
|
10087
10504
|
constructor() {
|
|
10088
|
-
super(
|
|
10089
|
-
{ name: "setCodeDslById", isAsync: true },
|
|
10090
|
-
{ name: "setEditStatus", isAsync: true },
|
|
10091
|
-
{ name: "setCombineIds", isAsync: true },
|
|
10092
|
-
{ name: "setUndeleteableList", isAsync: true },
|
|
10093
|
-
{ name: "deleteCodeDslByIds", isAsync: true }
|
|
10094
|
-
]);
|
|
10505
|
+
super(canUsePluginMethods$1.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
10095
10506
|
}
|
|
10096
10507
|
/**
|
|
10097
10508
|
* 设置活动的代码块dsl数据源
|
|
@@ -10264,6 +10675,9 @@ class CodeBlock extends BaseService {
|
|
|
10264
10675
|
this.removeAllListeners();
|
|
10265
10676
|
this.removeAllPlugins();
|
|
10266
10677
|
}
|
|
10678
|
+
usePlugin(options) {
|
|
10679
|
+
super.usePlugin(options);
|
|
10680
|
+
}
|
|
10267
10681
|
}
|
|
10268
10682
|
const codeBlockService = new CodeBlock();
|
|
10269
10683
|
|
|
@@ -10319,10 +10733,10 @@ class Events extends BaseService {
|
|
|
10319
10733
|
});
|
|
10320
10734
|
}
|
|
10321
10735
|
setEvent(type, events) {
|
|
10322
|
-
eventMap[type] = [...DEFAULT_EVENTS, ...events];
|
|
10736
|
+
eventMap[toLine(type)] = [...DEFAULT_EVENTS, ...events];
|
|
10323
10737
|
}
|
|
10324
10738
|
getEvent(type) {
|
|
10325
|
-
return cloneDeep(eventMap[type] || DEFAULT_EVENTS);
|
|
10739
|
+
return cloneDeep(eventMap[toLine(type)] || DEFAULT_EVENTS);
|
|
10326
10740
|
}
|
|
10327
10741
|
setMethods(methods) {
|
|
10328
10742
|
Object.keys(methods).forEach((type) => {
|
|
@@ -10330,10 +10744,10 @@ class Events extends BaseService {
|
|
|
10330
10744
|
});
|
|
10331
10745
|
}
|
|
10332
10746
|
setMethod(type, method) {
|
|
10333
|
-
methodMap[type] = [...DEFAULT_METHODS, ...method];
|
|
10747
|
+
methodMap[toLine(type)] = [...DEFAULT_METHODS, ...method];
|
|
10334
10748
|
}
|
|
10335
10749
|
getMethod(type) {
|
|
10336
|
-
return cloneDeep(methodMap[type] || DEFAULT_METHODS);
|
|
10750
|
+
return cloneDeep(methodMap[toLine(type)] || DEFAULT_METHODS);
|
|
10337
10751
|
}
|
|
10338
10752
|
resetState() {
|
|
10339
10753
|
eventMap = reactive({});
|
|
@@ -10527,6 +10941,10 @@ class Keybinding extends BaseService {
|
|
|
10527
10941
|
}
|
|
10528
10942
|
const keybindingService = new Keybinding();
|
|
10529
10943
|
|
|
10944
|
+
const canUsePluginMethods = {
|
|
10945
|
+
async: [],
|
|
10946
|
+
sync: ["openOverlay", "closeOverlay", "updateOverlay", "createStage"]
|
|
10947
|
+
};
|
|
10530
10948
|
class StageOverlay extends BaseService {
|
|
10531
10949
|
state = reactive({
|
|
10532
10950
|
wrapDiv: document.createElement("div"),
|
|
@@ -10539,12 +10957,7 @@ class StageOverlay extends BaseService {
|
|
|
10539
10957
|
stageOverlayVisible: false
|
|
10540
10958
|
});
|
|
10541
10959
|
constructor() {
|
|
10542
|
-
super(
|
|
10543
|
-
{ name: "openOverlay", isAsync: false },
|
|
10544
|
-
{ name: "closeOverlay", isAsync: false },
|
|
10545
|
-
{ name: "updateOverlay", isAsync: false },
|
|
10546
|
-
{ name: "createStage", isAsync: false }
|
|
10547
|
-
]);
|
|
10960
|
+
super(canUsePluginMethods.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
10548
10961
|
this.get("wrapDiv").classList.add("tmagic-editor-sub-stage-wrap");
|
|
10549
10962
|
}
|
|
10550
10963
|
get(name) {
|
|
@@ -10611,6 +11024,9 @@ class StageOverlay extends BaseService {
|
|
|
10611
11024
|
}
|
|
10612
11025
|
});
|
|
10613
11026
|
}
|
|
11027
|
+
usePlugin(options) {
|
|
11028
|
+
super.usePlugin(options);
|
|
11029
|
+
}
|
|
10614
11030
|
createContentEl() {
|
|
10615
11031
|
const sourceEl = this.get("sourceEl");
|
|
10616
11032
|
if (!sourceEl)
|
|
@@ -10651,7 +11067,7 @@ class StageOverlay extends BaseService {
|
|
|
10651
11067
|
subStage?.renderer.contentWindow?.magic.onPageElUpdate(wrapDiv);
|
|
10652
11068
|
});
|
|
10653
11069
|
if (await stageOptions?.canSelect?.(contentEl)) {
|
|
10654
|
-
subStage?.select(contentEl);
|
|
11070
|
+
subStage?.select(contentEl.id);
|
|
10655
11071
|
}
|
|
10656
11072
|
}
|
|
10657
11073
|
updateHandler = () => {
|
|
@@ -11042,7 +11458,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11042
11458
|
name: "MEditor"
|
|
11043
11459
|
},
|
|
11044
11460
|
__name: "Editor",
|
|
11045
|
-
props: mergeDefaults({
|
|
11461
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
11046
11462
|
modelValue: {},
|
|
11047
11463
|
componentGroupList: {},
|
|
11048
11464
|
datasourceList: {},
|
|
@@ -11059,7 +11475,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11059
11475
|
datasourceValues: {},
|
|
11060
11476
|
datasourceConfigs: {},
|
|
11061
11477
|
datasourceEventMethodList: {},
|
|
11062
|
-
moveableOptions: { type: Function },
|
|
11478
|
+
moveableOptions: { type: [Object, Function] },
|
|
11063
11479
|
defaultSelected: {},
|
|
11064
11480
|
containerHighlightClassName: {},
|
|
11065
11481
|
containerHighlightDuration: {},
|
|
@@ -11123,13 +11539,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11123
11539
|
provide("stageOptions", stageOptions);
|
|
11124
11540
|
__expose(services);
|
|
11125
11541
|
return (_ctx, _cache) => {
|
|
11126
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11542
|
+
return openBlock(), createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11127
11543
|
header: withCtx(() => [
|
|
11128
11544
|
renderSlot(_ctx.$slots, "header")
|
|
11129
11545
|
]),
|
|
11130
11546
|
nav: withCtx(() => [
|
|
11131
11547
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
11132
|
-
createVNode(_sfc_main$
|
|
11548
|
+
createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11133
11549
|
])
|
|
11134
11550
|
]),
|
|
11135
11551
|
"content-before": withCtx(() => [
|
|
@@ -11204,7 +11620,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11204
11620
|
]),
|
|
11205
11621
|
"props-panel": withCtx(() => [
|
|
11206
11622
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11207
|
-
createVNode(_sfc_main$
|
|
11623
|
+
createVNode(_sfc_main$p, {
|
|
11208
11624
|
"extend-state": _ctx.extendFormState,
|
|
11209
11625
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11210
11626
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
@@ -11250,24 +11666,24 @@ const index = {
|
|
|
11250
11666
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
11251
11667
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
11252
11668
|
setConfig(option);
|
|
11253
|
-
app.component(_sfc_main.name
|
|
11254
|
-
app.component("
|
|
11669
|
+
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11670
|
+
app.component("magic-code-editor", _sfc_main$U);
|
|
11671
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11255
11672
|
app.component("m-fields-code-link", _sfc_main$S);
|
|
11256
11673
|
app.component("m-fields-vs-code", _sfc_main$T);
|
|
11257
|
-
app.component("magic-code-editor", _sfc_main$U);
|
|
11258
11674
|
app.component("m-fields-code-select", _sfc_main$R);
|
|
11259
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
11260
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11261
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
11262
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11263
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11264
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11265
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11266
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11267
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11268
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11269
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11675
|
+
app.component("m-fields-code-select-col", _sfc_main$M);
|
|
11676
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11677
|
+
app.component("m-fields-data-source-fields", _sfc_main$L);
|
|
11678
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11679
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11680
|
+
app.component("m-fields-data-source-input", _sfc_main$J);
|
|
11681
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11682
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11683
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11684
|
+
app.component("m-fields-data-source-field-select", _sfc_main$K);
|
|
11685
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11270
11686
|
}
|
|
11271
11687
|
};
|
|
11272
11688
|
|
|
11273
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
11689
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N 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, _sfc_main$y as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, 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 };
|