@tmagic/editor 1.3.15 → 1.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +17 -3
- package/dist/tmagic-editor.js +875 -530
- package/dist/tmagic-editor.umd.cjs +891 -545
- package/package.json +23 -21
- package/src/Editor.vue +8 -0
- package/src/components/CodeBlockEditor.vue +50 -24
- package/src/components/FloatingBox.vue +53 -12
- 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/use-code-block-edit.ts +0 -1
- package/src/index.ts +3 -2
- package/src/layouts/NavMenu.vue +21 -2
- package/src/layouts/sidebar/Sidebar.vue +16 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +3 -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 +14 -7
- package/src/services/storage.ts +14 -8
- package/src/services/ui.ts +20 -19
- package/src/theme/code-editor.scss +6 -0
- package/src/theme/component-list-panel.scss +79 -71
- package/src/theme/floating-box.scss +2 -0
- package/src/theme/layer-panel.scss +1 -0
- package/src/theme/sidebar.scss +6 -3
- package/src/type.ts +82 -37
- package/src/utils/operator.ts +37 -39
- package/src/utils/props.ts +174 -37
- package/types/components/CodeBlockEditor.vue.d.ts +4 -4
- 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 +14 -12
- 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 +11 -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/use-code-block-edit.d.ts +51 -89
- package/types/hooks/use-data-source-method.d.ts +51 -89
- package/types/hooks/use-node-status.d.ts +6 -1
- 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/index.d.ts +1 -0
- 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 +12 -12
- 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 +8 -1
- package/types/services/storage.d.ts +8 -0
- package/types/services/ui.d.ts +15 -9
- package/types/type.d.ts +51 -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, watchEffect, nextTick, renderSlot, toDisplayString, createCommentVNode, Fragment, 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, 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';
|
|
@@ -27,7 +27,7 @@ const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
|
27
27
|
emmetHTML(monaco);
|
|
28
28
|
emmetCSS(monaco, ["css", "scss"]);
|
|
29
29
|
|
|
30
|
-
const _hoisted_1$
|
|
30
|
+
const _hoisted_1$u = {
|
|
31
31
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
32
32
|
};
|
|
33
33
|
const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
@@ -188,7 +188,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
190
|
return (_ctx, _cache) => {
|
|
191
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
191
|
+
return openBlock(), createElementBlock("div", _hoisted_1$u, [
|
|
192
192
|
(openBlock(), createBlock(Teleport, {
|
|
193
193
|
to: "body",
|
|
194
194
|
disabled: !fullScreen.value
|
|
@@ -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,11 +454,150 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
|
|
457
|
+
const _hoisted_1$t = { class: "m-editor-float-box-body" };
|
|
458
|
+
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
459
|
+
__name: "FloatingBox",
|
|
460
|
+
props: {
|
|
461
|
+
visible: { type: Boolean, default: false },
|
|
462
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
463
|
+
rect: { default: () => ({ width: "auto", height: "auto" }) },
|
|
464
|
+
title: { default: "" },
|
|
465
|
+
beforeClose: {}
|
|
466
|
+
},
|
|
467
|
+
emits: ["update:visible"],
|
|
468
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
469
|
+
const props = __props;
|
|
470
|
+
const emit = __emit;
|
|
471
|
+
const target = ref();
|
|
472
|
+
const dragTarget = ref();
|
|
473
|
+
const zIndex = useZIndex();
|
|
474
|
+
const curZIndex = ref(zIndex.nextZIndex());
|
|
475
|
+
const rect = ref({
|
|
476
|
+
width: props.rect.width,
|
|
477
|
+
height: props.rect.height
|
|
478
|
+
});
|
|
479
|
+
watchEffect(() => {
|
|
480
|
+
rect.value = {
|
|
481
|
+
width: props.rect.width,
|
|
482
|
+
height: props.rect.height
|
|
483
|
+
};
|
|
484
|
+
});
|
|
485
|
+
const style = computed(() => ({
|
|
486
|
+
left: `${props.position.left}px`,
|
|
487
|
+
top: `${props.position.top}px`,
|
|
488
|
+
width: typeof rect.value.width === "string" ? rect.value.width : `${rect.value.width}px`,
|
|
489
|
+
height: typeof rect.value.height === "string" ? rect.value.height : `${rect.value.height}px`
|
|
490
|
+
}));
|
|
491
|
+
let moveable = null;
|
|
492
|
+
const initMoveable = () => {
|
|
493
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
494
|
+
className: "m-editor-floating-box-moveable",
|
|
495
|
+
target: target.value,
|
|
496
|
+
draggable: true,
|
|
497
|
+
resizable: true,
|
|
498
|
+
edge: true,
|
|
499
|
+
keepRatio: false,
|
|
500
|
+
origin: false,
|
|
501
|
+
snappable: true,
|
|
502
|
+
dragTarget: dragTarget.value,
|
|
503
|
+
dragTargetSelf: false,
|
|
504
|
+
linePadding: 10,
|
|
505
|
+
controlPadding: 10,
|
|
506
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
507
|
+
});
|
|
508
|
+
moveable.on("drag", (e) => {
|
|
509
|
+
e.target.style.transform = e.transform;
|
|
510
|
+
});
|
|
511
|
+
moveable.on("resize", (e) => {
|
|
512
|
+
rect.value.width = e.width;
|
|
513
|
+
rect.value.height = e.height;
|
|
514
|
+
e.target.style.width = `${e.width}px`;
|
|
515
|
+
e.target.style.height = `${e.height}px`;
|
|
516
|
+
e.target.style.transform = e.drag.transform;
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
const destroyMoveable = () => {
|
|
520
|
+
moveable?.destroy();
|
|
521
|
+
moveable = null;
|
|
522
|
+
};
|
|
523
|
+
watch(
|
|
524
|
+
() => props.visible,
|
|
525
|
+
async (visible) => {
|
|
526
|
+
if (visible) {
|
|
527
|
+
await nextTick();
|
|
528
|
+
initMoveable();
|
|
529
|
+
} else {
|
|
530
|
+
destroyMoveable();
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
immediate: true
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
onBeforeUnmount(() => {
|
|
538
|
+
destroyMoveable();
|
|
539
|
+
});
|
|
540
|
+
const hide = (cancel) => {
|
|
541
|
+
if (cancel !== false) {
|
|
542
|
+
emit("update:visible", false);
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const closeHandler = () => {
|
|
546
|
+
if (typeof props.beforeClose === "function") {
|
|
547
|
+
props.beforeClose(hide);
|
|
548
|
+
} else {
|
|
549
|
+
hide();
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
const nextZIndex = () => {
|
|
553
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
554
|
+
};
|
|
555
|
+
__expose({
|
|
556
|
+
target
|
|
557
|
+
});
|
|
558
|
+
return (_ctx, _cache) => {
|
|
559
|
+
return _ctx.visible ? (openBlock(), createBlock(Teleport, {
|
|
560
|
+
key: 0,
|
|
561
|
+
to: "body"
|
|
562
|
+
}, [
|
|
563
|
+
createElementVNode("div", {
|
|
564
|
+
ref_key: "target",
|
|
565
|
+
ref: target,
|
|
566
|
+
class: "m-editor-float-box",
|
|
567
|
+
style: normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
568
|
+
onMousedown: nextZIndex
|
|
569
|
+
}, [
|
|
570
|
+
createElementVNode("div", {
|
|
571
|
+
ref_key: "dragTarget",
|
|
572
|
+
ref: dragTarget,
|
|
573
|
+
class: "m-editor-float-box-title"
|
|
574
|
+
}, [
|
|
575
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
576
|
+
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
577
|
+
]),
|
|
578
|
+
createElementVNode("div", null, [
|
|
579
|
+
createVNode(unref(TMagicButton), {
|
|
580
|
+
link: "",
|
|
581
|
+
size: "small",
|
|
582
|
+
icon: unref(Close),
|
|
583
|
+
onClick: closeHandler
|
|
584
|
+
}, null, 8, ["icon"])
|
|
585
|
+
])
|
|
586
|
+
], 512),
|
|
587
|
+
createElementVNode("div", _hoisted_1$t, [
|
|
588
|
+
renderSlot(_ctx.$slots, "body")
|
|
589
|
+
])
|
|
590
|
+
], 36)
|
|
591
|
+
])) : createCommentVNode("", true);
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
457
596
|
const _hoisted_1$s = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
458
597
|
const _hoisted_2$k = { style: { "flex": "1" } };
|
|
459
598
|
const _hoisted_3$8 = { style: { "flex": "1" } };
|
|
460
599
|
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
461
|
-
const _sfc_main$
|
|
600
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
462
601
|
...{
|
|
463
602
|
name: "MEditorCodeBlockEditor"
|
|
464
603
|
},
|
|
@@ -624,14 +763,30 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
624
763
|
changedValue.value && submitForm(changedValue.value);
|
|
625
764
|
done();
|
|
626
765
|
}).catch((action) => {
|
|
627
|
-
done(action === "
|
|
766
|
+
done(action === "cancel");
|
|
628
767
|
});
|
|
629
768
|
};
|
|
630
769
|
const closedHandler = () => {
|
|
631
770
|
changedValue.value = void 0;
|
|
632
771
|
};
|
|
772
|
+
const boxVisible = ref(false);
|
|
773
|
+
const editVisible = ref(false);
|
|
774
|
+
const floatingBoxBody = ref();
|
|
775
|
+
const boxPosition = computed(() => {
|
|
776
|
+
const columnWidth2 = services?.uiService?.get("columnWidth");
|
|
777
|
+
const navMenuRect = services?.uiService?.get("navMenuRect");
|
|
778
|
+
return {
|
|
779
|
+
left: columnWidth2?.left ?? 0,
|
|
780
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
781
|
+
};
|
|
782
|
+
});
|
|
633
783
|
__expose({
|
|
634
|
-
show() {
|
|
784
|
+
async show() {
|
|
785
|
+
if (props.slideType !== "box") {
|
|
786
|
+
boxVisible.value = true;
|
|
787
|
+
}
|
|
788
|
+
await nextTick();
|
|
789
|
+
editVisible.value = true;
|
|
635
790
|
fomDrawer.value?.show();
|
|
636
791
|
},
|
|
637
792
|
hide() {
|
|
@@ -640,41 +795,61 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
640
795
|
});
|
|
641
796
|
return (_ctx, _cache) => {
|
|
642
797
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
643
|
-
(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
"close
|
|
649
|
-
title: _ctx.content.name,
|
|
650
|
-
width: size.value,
|
|
651
|
-
config: functionConfig.value,
|
|
652
|
-
values: _ctx.content,
|
|
653
|
-
disabled: _ctx.disabled,
|
|
654
|
-
"before-close": beforeClose,
|
|
655
|
-
onChange: changeHandler,
|
|
656
|
-
onSubmit: submitForm,
|
|
657
|
-
onError: errorHandler,
|
|
658
|
-
onOpen: openHandler,
|
|
659
|
-
onClosed: closedHandler
|
|
798
|
+
createVNode(_sfc_main$Q, {
|
|
799
|
+
visible: boxVisible.value,
|
|
800
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
801
|
+
title: "代码编辑",
|
|
802
|
+
position: boxPosition.value,
|
|
803
|
+
"before-close": beforeClose
|
|
660
804
|
}, {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
}, {
|
|
667
|
-
default: withCtx(() => [
|
|
668
|
-
createTextVNode("查看修改")
|
|
669
|
-
]),
|
|
670
|
-
_: 1
|
|
671
|
-
})
|
|
805
|
+
body: withCtx(() => [
|
|
806
|
+
createElementVNode("div", {
|
|
807
|
+
ref_key: "floatingBoxBody",
|
|
808
|
+
ref: floatingBoxBody
|
|
809
|
+
}, null, 512)
|
|
672
810
|
]),
|
|
673
811
|
_: 1
|
|
674
|
-
},
|
|
812
|
+
}, 8, ["visible", "position"]),
|
|
813
|
+
editVisible.value ? (openBlock(), createBlock(Teleport, {
|
|
814
|
+
key: 0,
|
|
815
|
+
to: floatingBoxBody.value,
|
|
816
|
+
disabled: _ctx.slideType === "box"
|
|
817
|
+
}, [
|
|
818
|
+
createVNode(unref(MFormBox), {
|
|
819
|
+
class: "m-editor-code-block-editor",
|
|
820
|
+
ref_key: "fomDrawer",
|
|
821
|
+
ref: fomDrawer,
|
|
822
|
+
"label-width": "80px",
|
|
823
|
+
"close-on-press-escape": false,
|
|
824
|
+
title: _ctx.content.name,
|
|
825
|
+
width: size.value,
|
|
826
|
+
config: functionConfig.value,
|
|
827
|
+
values: _ctx.content,
|
|
828
|
+
disabled: _ctx.disabled,
|
|
829
|
+
onChange: changeHandler,
|
|
830
|
+
onSubmit: submitForm,
|
|
831
|
+
onError: errorHandler,
|
|
832
|
+
onOpen: openHandler,
|
|
833
|
+
onClosed: closedHandler
|
|
834
|
+
}, {
|
|
835
|
+
left: withCtx(() => [
|
|
836
|
+
createVNode(unref(TMagicButton), {
|
|
837
|
+
type: "primary",
|
|
838
|
+
link: "",
|
|
839
|
+
onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = true)
|
|
840
|
+
}, {
|
|
841
|
+
default: withCtx(() => [
|
|
842
|
+
createTextVNode("查看修改")
|
|
843
|
+
]),
|
|
844
|
+
_: 1
|
|
845
|
+
})
|
|
846
|
+
]),
|
|
847
|
+
_: 1
|
|
848
|
+
}, 8, ["title", "width", "config", "values", "disabled"])
|
|
849
|
+
], 8, ["to", "disabled"])) : createCommentVNode("", true),
|
|
675
850
|
createVNode(unref(TMagicDialog), {
|
|
676
851
|
modelValue: difVisible.value,
|
|
677
|
-
"onUpdate:modelValue": _cache[
|
|
852
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => difVisible.value = $event),
|
|
678
853
|
title: "查看修改",
|
|
679
854
|
fullscreen: ""
|
|
680
855
|
}, {
|
|
@@ -682,7 +857,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
682
857
|
createElementVNode("span", _hoisted_4$7, [
|
|
683
858
|
createVNode(unref(TMagicButton), {
|
|
684
859
|
size: "small",
|
|
685
|
-
onClick: _cache[
|
|
860
|
+
onClick: _cache[2] || (_cache[2] = ($event) => difVisible.value = false)
|
|
686
861
|
}, {
|
|
687
862
|
default: withCtx(() => [
|
|
688
863
|
createTextVNode("取消")
|
|
@@ -1141,6 +1316,9 @@ class BaseService extends EventEmitter {
|
|
|
1141
1316
|
});
|
|
1142
1317
|
});
|
|
1143
1318
|
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @deprecated 请使用usePlugin代替
|
|
1321
|
+
*/
|
|
1144
1322
|
use(options) {
|
|
1145
1323
|
Object.entries(options).forEach(([methodName2, method]) => {
|
|
1146
1324
|
if (typeof method === "function")
|
|
@@ -1172,6 +1350,23 @@ class BaseService extends EventEmitter {
|
|
|
1172
1350
|
}
|
|
1173
1351
|
}
|
|
1174
1352
|
|
|
1353
|
+
const canUsePluginMethods$6 = {
|
|
1354
|
+
async: [],
|
|
1355
|
+
sync: [
|
|
1356
|
+
"getFormConfig",
|
|
1357
|
+
"setFormConfig",
|
|
1358
|
+
"getFormValue",
|
|
1359
|
+
"setFormValue",
|
|
1360
|
+
"getFormEvent",
|
|
1361
|
+
"setFormEvent",
|
|
1362
|
+
"getFormMethod",
|
|
1363
|
+
"setFormMethod",
|
|
1364
|
+
"add",
|
|
1365
|
+
"update",
|
|
1366
|
+
"remove",
|
|
1367
|
+
"createId"
|
|
1368
|
+
]
|
|
1369
|
+
};
|
|
1175
1370
|
class DataSource extends BaseService {
|
|
1176
1371
|
state = reactive({
|
|
1177
1372
|
datasourceTypeList: [],
|
|
@@ -1183,20 +1378,7 @@ class DataSource extends BaseService {
|
|
|
1183
1378
|
methods: {}
|
|
1184
1379
|
});
|
|
1185
1380
|
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
|
-
]);
|
|
1381
|
+
super(canUsePluginMethods$6.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
1200
1382
|
}
|
|
1201
1383
|
set(name, value) {
|
|
1202
1384
|
this.state[name] = value;
|
|
@@ -1205,28 +1387,28 @@ class DataSource extends BaseService {
|
|
|
1205
1387
|
return this.state[name];
|
|
1206
1388
|
}
|
|
1207
1389
|
getFormConfig(type = "base") {
|
|
1208
|
-
return getFormConfig(type, this.get("configs"));
|
|
1390
|
+
return getFormConfig(toLine(type), this.get("configs"));
|
|
1209
1391
|
}
|
|
1210
1392
|
setFormConfig(type, config) {
|
|
1211
|
-
this.get("configs")[type] = config;
|
|
1393
|
+
this.get("configs")[toLine(type)] = config;
|
|
1212
1394
|
}
|
|
1213
1395
|
getFormValue(type = "base") {
|
|
1214
|
-
return getFormValue(type, this.get("values")[type]);
|
|
1396
|
+
return getFormValue(toLine(type), this.get("values")[type]);
|
|
1215
1397
|
}
|
|
1216
1398
|
setFormValue(type, value) {
|
|
1217
|
-
this.get("values")[type] = value;
|
|
1399
|
+
this.get("values")[toLine(type)] = value;
|
|
1218
1400
|
}
|
|
1219
1401
|
getFormEvent(type = "base") {
|
|
1220
|
-
return this.get("events")[type] || [];
|
|
1402
|
+
return this.get("events")[toLine(type)] || [];
|
|
1221
1403
|
}
|
|
1222
1404
|
setFormEvent(type, value = []) {
|
|
1223
|
-
this.get("events")[type] = value;
|
|
1405
|
+
this.get("events")[toLine(type)] = value;
|
|
1224
1406
|
}
|
|
1225
1407
|
getFormMethod(type = "base") {
|
|
1226
|
-
return this.get("methods")[type] || [];
|
|
1408
|
+
return this.get("methods")[toLine(type)] || [];
|
|
1227
1409
|
}
|
|
1228
1410
|
setFormMethod(type, value = []) {
|
|
1229
|
-
this.get("methods")[type] = value;
|
|
1411
|
+
this.get("methods")[toLine(type)] = value;
|
|
1230
1412
|
}
|
|
1231
1413
|
add(config) {
|
|
1232
1414
|
const newConfig = {
|
|
@@ -1250,6 +1432,9 @@ class DataSource extends BaseService {
|
|
|
1250
1432
|
dataSources.splice(index, 1);
|
|
1251
1433
|
this.emit("remove", id);
|
|
1252
1434
|
}
|
|
1435
|
+
createId() {
|
|
1436
|
+
return `ds_${guid()}`;
|
|
1437
|
+
}
|
|
1253
1438
|
getDataSourceById(id) {
|
|
1254
1439
|
return this.get("dataSources").find((ds) => ds.id === id);
|
|
1255
1440
|
}
|
|
@@ -1261,8 +1446,8 @@ class DataSource extends BaseService {
|
|
|
1261
1446
|
this.resetState();
|
|
1262
1447
|
this.removeAllPlugins();
|
|
1263
1448
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1449
|
+
usePlugin(options) {
|
|
1450
|
+
super.usePlugin(options);
|
|
1266
1451
|
}
|
|
1267
1452
|
}
|
|
1268
1453
|
const dataSourceService = new DataSource();
|
|
@@ -1285,7 +1470,6 @@ const numberOptions = [
|
|
|
1285
1470
|
];
|
|
1286
1471
|
const styleTabConfig = {
|
|
1287
1472
|
title: "样式",
|
|
1288
|
-
labelWidth: "80px",
|
|
1289
1473
|
items: [
|
|
1290
1474
|
{
|
|
1291
1475
|
name: "style",
|
|
@@ -1295,29 +1479,58 @@ const styleTabConfig = {
|
|
|
1295
1479
|
legend: "位置",
|
|
1296
1480
|
items: [
|
|
1297
1481
|
{
|
|
1482
|
+
type: "data-source-field-select",
|
|
1298
1483
|
name: "position",
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1484
|
+
text: "固定定位",
|
|
1485
|
+
checkStrictly: false,
|
|
1486
|
+
dataSourceFieldType: ["string"],
|
|
1487
|
+
fieldConfig: {
|
|
1488
|
+
type: "checkbox",
|
|
1489
|
+
activeValue: "fixed",
|
|
1490
|
+
inactiveValue: "absolute",
|
|
1491
|
+
defaultValue: "absolute"
|
|
1492
|
+
}
|
|
1304
1493
|
},
|
|
1305
1494
|
{
|
|
1495
|
+
type: "data-source-field-select",
|
|
1306
1496
|
name: "left",
|
|
1307
|
-
text: "left"
|
|
1497
|
+
text: "left",
|
|
1498
|
+
checkStrictly: false,
|
|
1499
|
+
dataSourceFieldType: ["string", "number"],
|
|
1500
|
+
fieldConfig: {
|
|
1501
|
+
type: "text"
|
|
1502
|
+
}
|
|
1308
1503
|
},
|
|
1309
1504
|
{
|
|
1505
|
+
type: "data-source-field-select",
|
|
1310
1506
|
name: "top",
|
|
1311
1507
|
text: "top",
|
|
1508
|
+
checkStrictly: false,
|
|
1509
|
+
dataSourceFieldType: ["string", "number"],
|
|
1510
|
+
fieldConfig: {
|
|
1511
|
+
type: "text"
|
|
1512
|
+
},
|
|
1312
1513
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
|
|
1313
1514
|
},
|
|
1314
1515
|
{
|
|
1516
|
+
type: "data-source-field-select",
|
|
1315
1517
|
name: "right",
|
|
1316
|
-
text: "right"
|
|
1518
|
+
text: "right",
|
|
1519
|
+
checkStrictly: false,
|
|
1520
|
+
dataSourceFieldType: ["string", "number"],
|
|
1521
|
+
fieldConfig: {
|
|
1522
|
+
type: "text"
|
|
1523
|
+
}
|
|
1317
1524
|
},
|
|
1318
1525
|
{
|
|
1526
|
+
type: "data-source-field-select",
|
|
1319
1527
|
name: "bottom",
|
|
1320
1528
|
text: "bottom",
|
|
1529
|
+
checkStrictly: false,
|
|
1530
|
+
dataSourceFieldType: ["string", "number"],
|
|
1531
|
+
fieldConfig: {
|
|
1532
|
+
type: "text"
|
|
1533
|
+
},
|
|
1321
1534
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
|
|
1322
1535
|
}
|
|
1323
1536
|
]
|
|
@@ -1327,12 +1540,42 @@ const styleTabConfig = {
|
|
|
1327
1540
|
legend: "盒子",
|
|
1328
1541
|
items: [
|
|
1329
1542
|
{
|
|
1543
|
+
type: "data-source-field-select",
|
|
1330
1544
|
name: "width",
|
|
1331
|
-
text: "宽度"
|
|
1545
|
+
text: "宽度",
|
|
1546
|
+
checkStrictly: false,
|
|
1547
|
+
dataSourceFieldType: ["string", "number"],
|
|
1548
|
+
fieldConfig: {
|
|
1549
|
+
type: "text"
|
|
1550
|
+
}
|
|
1332
1551
|
},
|
|
1333
1552
|
{
|
|
1553
|
+
type: "data-source-field-select",
|
|
1334
1554
|
name: "height",
|
|
1335
|
-
text: "高度"
|
|
1555
|
+
text: "高度",
|
|
1556
|
+
checkStrictly: false,
|
|
1557
|
+
dataSourceFieldType: ["string", "number"],
|
|
1558
|
+
fieldConfig: {
|
|
1559
|
+
type: "text"
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
type: "data-source-field-select",
|
|
1564
|
+
text: "overflow",
|
|
1565
|
+
name: "overflow",
|
|
1566
|
+
checkStrictly: false,
|
|
1567
|
+
dataSourceFieldType: ["string"],
|
|
1568
|
+
fieldConfig: {
|
|
1569
|
+
type: "select",
|
|
1570
|
+
options: [
|
|
1571
|
+
{ text: "visible", value: "visible" },
|
|
1572
|
+
{ text: "hidden", value: "hidden" },
|
|
1573
|
+
{ text: "clip", value: "clip" },
|
|
1574
|
+
{ text: "scroll", value: "scroll" },
|
|
1575
|
+
{ text: "auto", value: "auto" },
|
|
1576
|
+
{ text: "overlay", value: "overlay" }
|
|
1577
|
+
]
|
|
1578
|
+
}
|
|
1336
1579
|
}
|
|
1337
1580
|
]
|
|
1338
1581
|
},
|
|
@@ -1341,32 +1584,48 @@ const styleTabConfig = {
|
|
|
1341
1584
|
legend: "边框",
|
|
1342
1585
|
items: [
|
|
1343
1586
|
{
|
|
1587
|
+
type: "data-source-field-select",
|
|
1344
1588
|
name: "borderWidth",
|
|
1345
1589
|
text: "宽度",
|
|
1346
|
-
defaultValue: "0"
|
|
1590
|
+
defaultValue: "0",
|
|
1591
|
+
checkStrictly: false,
|
|
1592
|
+
dataSourceFieldType: ["string", "number"],
|
|
1593
|
+
fieldConfig: {
|
|
1594
|
+
type: "text"
|
|
1595
|
+
}
|
|
1347
1596
|
},
|
|
1348
1597
|
{
|
|
1598
|
+
type: "data-source-field-select",
|
|
1349
1599
|
name: "borderColor",
|
|
1350
1600
|
text: "颜色",
|
|
1351
|
-
|
|
1601
|
+
checkStrictly: false,
|
|
1602
|
+
dataSourceFieldType: ["string"],
|
|
1603
|
+
fieldConfig: {
|
|
1604
|
+
type: "text"
|
|
1605
|
+
}
|
|
1352
1606
|
},
|
|
1353
1607
|
{
|
|
1608
|
+
type: "data-source-field-select",
|
|
1354
1609
|
name: "borderStyle",
|
|
1355
1610
|
text: "样式",
|
|
1356
|
-
type: "select",
|
|
1357
1611
|
defaultValue: "none",
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1612
|
+
checkStrictly: false,
|
|
1613
|
+
dataSourceFieldType: ["string"],
|
|
1614
|
+
fieldConfig: {
|
|
1615
|
+
type: "select",
|
|
1616
|
+
options: [
|
|
1617
|
+
{ text: "none", value: "none" },
|
|
1618
|
+
{ text: "hidden", value: "hidden" },
|
|
1619
|
+
{ text: "dotted", value: "dotted" },
|
|
1620
|
+
{ text: "dashed", value: "dashed" },
|
|
1621
|
+
{ text: "solid", value: "solid" },
|
|
1622
|
+
{ text: "double", value: "double" },
|
|
1623
|
+
{ text: "groove", value: "groove" },
|
|
1624
|
+
{ text: "ridge", value: "ridge" },
|
|
1625
|
+
{ text: "inset", value: "inset" },
|
|
1626
|
+
{ text: "outset", value: "outset" }
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1370
1629
|
}
|
|
1371
1630
|
]
|
|
1372
1631
|
},
|
|
@@ -1375,31 +1634,53 @@ const styleTabConfig = {
|
|
|
1375
1634
|
legend: "背景",
|
|
1376
1635
|
items: [
|
|
1377
1636
|
{
|
|
1637
|
+
type: "data-source-field-select",
|
|
1378
1638
|
name: "backgroundImage",
|
|
1379
|
-
text: "背景图"
|
|
1639
|
+
text: "背景图",
|
|
1640
|
+
checkStrictly: false,
|
|
1641
|
+
dataSourceFieldType: ["string"],
|
|
1642
|
+
fieldConfig: {
|
|
1643
|
+
type: "text"
|
|
1644
|
+
}
|
|
1380
1645
|
},
|
|
1381
1646
|
{
|
|
1647
|
+
type: "data-source-field-select",
|
|
1382
1648
|
name: "backgroundColor",
|
|
1383
1649
|
text: "背景颜色",
|
|
1384
|
-
|
|
1650
|
+
checkStrictly: false,
|
|
1651
|
+
dataSourceFieldType: ["string"],
|
|
1652
|
+
fieldConfig: {
|
|
1653
|
+
type: "colorPicker"
|
|
1654
|
+
}
|
|
1385
1655
|
},
|
|
1386
1656
|
{
|
|
1657
|
+
type: "data-source-field-select",
|
|
1387
1658
|
name: "backgroundRepeat",
|
|
1388
1659
|
text: "背景图重复",
|
|
1389
|
-
type: "select",
|
|
1390
1660
|
defaultValue: "no-repeat",
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1661
|
+
checkStrictly: false,
|
|
1662
|
+
dataSourceFieldType: ["string"],
|
|
1663
|
+
fieldConfig: {
|
|
1664
|
+
type: "select",
|
|
1665
|
+
options: [
|
|
1666
|
+
{ text: "repeat", value: "repeat" },
|
|
1667
|
+
{ text: "repeat-x", value: "repeat-x" },
|
|
1668
|
+
{ text: "repeat-y", value: "repeat-y" },
|
|
1669
|
+
{ text: "no-repeat", value: "no-repeat" },
|
|
1670
|
+
{ text: "inherit", value: "inherit" }
|
|
1671
|
+
]
|
|
1672
|
+
}
|
|
1398
1673
|
},
|
|
1399
1674
|
{
|
|
1675
|
+
type: "data-source-field-select",
|
|
1400
1676
|
name: "backgroundSize",
|
|
1401
1677
|
text: "背景图大小",
|
|
1402
|
-
defaultValue: "100% 100%"
|
|
1678
|
+
defaultValue: "100% 100%",
|
|
1679
|
+
checkStrictly: false,
|
|
1680
|
+
dataSourceFieldType: ["string"],
|
|
1681
|
+
fieldConfig: {
|
|
1682
|
+
type: "text"
|
|
1683
|
+
}
|
|
1403
1684
|
}
|
|
1404
1685
|
]
|
|
1405
1686
|
},
|
|
@@ -1408,17 +1689,34 @@ const styleTabConfig = {
|
|
|
1408
1689
|
legend: "字体",
|
|
1409
1690
|
items: [
|
|
1410
1691
|
{
|
|
1692
|
+
type: "data-source-field-select",
|
|
1411
1693
|
name: "color",
|
|
1412
1694
|
text: "颜色",
|
|
1413
|
-
|
|
1695
|
+
checkStrictly: false,
|
|
1696
|
+
dataSourceFieldType: ["string"],
|
|
1697
|
+
fieldConfig: {
|
|
1698
|
+
type: "colorPicker"
|
|
1699
|
+
}
|
|
1414
1700
|
},
|
|
1415
1701
|
{
|
|
1702
|
+
type: "data-source-field-select",
|
|
1416
1703
|
name: "fontSize",
|
|
1417
|
-
text: "大小"
|
|
1704
|
+
text: "大小",
|
|
1705
|
+
checkStrictly: false,
|
|
1706
|
+
dataSourceFieldType: ["string", "number"],
|
|
1707
|
+
fieldConfig: {
|
|
1708
|
+
type: "text"
|
|
1709
|
+
}
|
|
1418
1710
|
},
|
|
1419
1711
|
{
|
|
1712
|
+
type: "data-source-field-select",
|
|
1420
1713
|
name: "fontWeight",
|
|
1421
|
-
text: "粗细"
|
|
1714
|
+
text: "粗细",
|
|
1715
|
+
checkStrictly: false,
|
|
1716
|
+
dataSourceFieldType: ["string", "number"],
|
|
1717
|
+
fieldConfig: {
|
|
1718
|
+
type: "text"
|
|
1719
|
+
}
|
|
1422
1720
|
}
|
|
1423
1721
|
]
|
|
1424
1722
|
},
|
|
@@ -1428,12 +1726,24 @@ const styleTabConfig = {
|
|
|
1428
1726
|
name: "transform",
|
|
1429
1727
|
items: [
|
|
1430
1728
|
{
|
|
1729
|
+
type: "data-source-field-select",
|
|
1431
1730
|
name: "rotate",
|
|
1432
|
-
text: "旋转角度"
|
|
1731
|
+
text: "旋转角度",
|
|
1732
|
+
checkStrictly: false,
|
|
1733
|
+
dataSourceFieldType: ["string"],
|
|
1734
|
+
fieldConfig: {
|
|
1735
|
+
type: "text"
|
|
1736
|
+
}
|
|
1433
1737
|
},
|
|
1434
1738
|
{
|
|
1739
|
+
type: "data-source-field-select",
|
|
1435
1740
|
name: "scale",
|
|
1436
|
-
text: "缩放"
|
|
1741
|
+
text: "缩放",
|
|
1742
|
+
checkStrictly: false,
|
|
1743
|
+
dataSourceFieldType: ["number", "string"],
|
|
1744
|
+
fieldConfig: {
|
|
1745
|
+
type: "text"
|
|
1746
|
+
}
|
|
1437
1747
|
}
|
|
1438
1748
|
]
|
|
1439
1749
|
}
|
|
@@ -1459,13 +1769,11 @@ const advancedTabConfig = {
|
|
|
1459
1769
|
{
|
|
1460
1770
|
name: "created",
|
|
1461
1771
|
text: "created",
|
|
1462
|
-
labelWidth: "100px",
|
|
1463
1772
|
type: "code-select"
|
|
1464
1773
|
},
|
|
1465
1774
|
{
|
|
1466
1775
|
name: "mounted",
|
|
1467
1776
|
text: "mounted",
|
|
1468
|
-
labelWidth: "100px",
|
|
1469
1777
|
type: "code-select"
|
|
1470
1778
|
}
|
|
1471
1779
|
]
|
|
@@ -1488,14 +1796,22 @@ const displayTabConfig = {
|
|
|
1488
1796
|
type: "data-source-field-select",
|
|
1489
1797
|
name: "field",
|
|
1490
1798
|
value: "key",
|
|
1491
|
-
label: "字段"
|
|
1799
|
+
label: "字段",
|
|
1800
|
+
checkStrictly: false,
|
|
1801
|
+
dataSourceFieldType: ["string", "number", "boolean", "any"]
|
|
1492
1802
|
},
|
|
1493
1803
|
{
|
|
1494
1804
|
type: "select",
|
|
1495
1805
|
options: (mForm, { model }) => {
|
|
1496
|
-
const [id,
|
|
1806
|
+
const [id, ...fieldNames] = model.field;
|
|
1497
1807
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1498
|
-
|
|
1808
|
+
let fields = ds?.fields || [];
|
|
1809
|
+
let type = "";
|
|
1810
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1811
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1812
|
+
fields = field?.fields || [];
|
|
1813
|
+
type = field?.type || "";
|
|
1814
|
+
});
|
|
1499
1815
|
if (type === "array") {
|
|
1500
1816
|
return arrayOptions;
|
|
1501
1817
|
}
|
|
@@ -1522,9 +1838,15 @@ const displayTabConfig = {
|
|
|
1522
1838
|
{
|
|
1523
1839
|
name: "value",
|
|
1524
1840
|
type: (mForm, { model }) => {
|
|
1525
|
-
const [id,
|
|
1841
|
+
const [id, ...fieldNames] = model.field;
|
|
1526
1842
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1527
|
-
|
|
1843
|
+
let fields = ds?.fields || [];
|
|
1844
|
+
let type = "";
|
|
1845
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1846
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1847
|
+
fields = field?.fields || [];
|
|
1848
|
+
type = field?.type || "";
|
|
1849
|
+
});
|
|
1528
1850
|
if (type === "number") {
|
|
1529
1851
|
return "number";
|
|
1530
1852
|
}
|
|
@@ -1552,13 +1874,13 @@ const displayTabConfig = {
|
|
|
1552
1874
|
}
|
|
1553
1875
|
]
|
|
1554
1876
|
};
|
|
1555
|
-
const fillConfig = (config = []) => [
|
|
1877
|
+
const fillConfig = (config = [], labelWidth = "80px") => [
|
|
1556
1878
|
{
|
|
1557
1879
|
type: "tab",
|
|
1880
|
+
labelWidth,
|
|
1558
1881
|
items: [
|
|
1559
1882
|
{
|
|
1560
1883
|
title: "属性",
|
|
1561
|
-
labelWidth: "80px",
|
|
1562
1884
|
items: [
|
|
1563
1885
|
// 组件类型,必须要有
|
|
1564
1886
|
{
|
|
@@ -1895,6 +2217,17 @@ class Dep extends BaseService {
|
|
|
1895
2217
|
}
|
|
1896
2218
|
const depService = new Dep();
|
|
1897
2219
|
|
|
2220
|
+
const canUsePluginMethods$5 = {
|
|
2221
|
+
async: [
|
|
2222
|
+
"setPropsConfig",
|
|
2223
|
+
"getPropsConfig",
|
|
2224
|
+
"setPropsValue",
|
|
2225
|
+
"getPropsValue",
|
|
2226
|
+
"fillConfig",
|
|
2227
|
+
"getDefaultPropsValue"
|
|
2228
|
+
],
|
|
2229
|
+
sync: ["createId", "setNewItemId"]
|
|
2230
|
+
};
|
|
1898
2231
|
class Props extends BaseService {
|
|
1899
2232
|
state = reactive({
|
|
1900
2233
|
propsConfigMap: {},
|
|
@@ -1903,14 +2236,8 @@ class Props extends BaseService {
|
|
|
1903
2236
|
});
|
|
1904
2237
|
constructor() {
|
|
1905
2238
|
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 }
|
|
2239
|
+
...canUsePluginMethods$5.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2240
|
+
...canUsePluginMethods$5.sync.map((methodName) => ({ name: methodName, isAsync: false }))
|
|
1914
2241
|
]);
|
|
1915
2242
|
}
|
|
1916
2243
|
setPropsConfigs(configs) {
|
|
@@ -1919,16 +2246,11 @@ class Props extends BaseService {
|
|
|
1919
2246
|
});
|
|
1920
2247
|
this.emit("props-configs-change");
|
|
1921
2248
|
}
|
|
1922
|
-
async fillConfig(config) {
|
|
1923
|
-
return fillConfig(config);
|
|
2249
|
+
async fillConfig(config, labelWidth) {
|
|
2250
|
+
return fillConfig(config, typeof labelWidth !== "function" ? labelWidth : "80px");
|
|
1924
2251
|
}
|
|
1925
|
-
/**
|
|
1926
|
-
* 为指定类型组件设置组件属性表单配置
|
|
1927
|
-
* @param type 组件类型
|
|
1928
|
-
* @param config 组件属性表单配置
|
|
1929
|
-
*/
|
|
1930
2252
|
async setPropsConfig(type, config) {
|
|
1931
|
-
this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
2253
|
+
this.state.propsConfigMap[toLine(type)] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
1932
2254
|
}
|
|
1933
2255
|
/**
|
|
1934
2256
|
* 获取指点类型的组件属性表单配置
|
|
@@ -1939,7 +2261,7 @@ class Props extends BaseService {
|
|
|
1939
2261
|
if (type === "area") {
|
|
1940
2262
|
return await this.getPropsConfig("button");
|
|
1941
2263
|
}
|
|
1942
|
-
return cloneDeep(this.state.propsConfigMap[type] || await this.fillConfig([]));
|
|
2264
|
+
return cloneDeep(this.state.propsConfigMap[toLine(type)] || await this.fillConfig([]));
|
|
1943
2265
|
}
|
|
1944
2266
|
setPropsValues(values) {
|
|
1945
2267
|
Object.keys(values).forEach((type) => {
|
|
@@ -1952,14 +2274,15 @@ class Props extends BaseService {
|
|
|
1952
2274
|
* @param value 组件初始值
|
|
1953
2275
|
*/
|
|
1954
2276
|
async setPropsValue(type, value) {
|
|
1955
|
-
this.state.propsValueMap[type] = value;
|
|
2277
|
+
this.state.propsValueMap[toLine(type)] = value;
|
|
1956
2278
|
}
|
|
1957
2279
|
/**
|
|
1958
2280
|
* 获取指定类型的组件初始值
|
|
1959
2281
|
* @param type 组件类型
|
|
1960
2282
|
* @returns 组件初始值
|
|
1961
2283
|
*/
|
|
1962
|
-
async getPropsValue(
|
|
2284
|
+
async getPropsValue(componentType, { inputEvent, ...defaultValue } = {}) {
|
|
2285
|
+
const type = toLine(componentType);
|
|
1963
2286
|
if (type === "area") {
|
|
1964
2287
|
const value = await this.getPropsValue("button");
|
|
1965
2288
|
value.className = "action-area";
|
|
@@ -1969,23 +2292,21 @@ class Props extends BaseService {
|
|
|
1969
2292
|
}
|
|
1970
2293
|
return value;
|
|
1971
2294
|
}
|
|
1972
|
-
const
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
)
|
|
1981
|
-
]);
|
|
2295
|
+
const id = this.createId(type);
|
|
2296
|
+
const defaultPropsValue = this.getDefaultPropsValue(type);
|
|
2297
|
+
const data = this.setNewItemId(
|
|
2298
|
+
cloneDeep({
|
|
2299
|
+
type,
|
|
2300
|
+
...defaultValue
|
|
2301
|
+
})
|
|
2302
|
+
);
|
|
1982
2303
|
return {
|
|
1983
2304
|
id,
|
|
1984
2305
|
...defaultPropsValue,
|
|
1985
2306
|
...mergeWith({}, cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
1986
2307
|
};
|
|
1987
2308
|
}
|
|
1988
|
-
|
|
2309
|
+
createId(type) {
|
|
1989
2310
|
return `${type}_${guid()}`;
|
|
1990
2311
|
}
|
|
1991
2312
|
/**
|
|
@@ -1995,15 +2316,15 @@ class Props extends BaseService {
|
|
|
1995
2316
|
* @param {Boolean} force 是否强制设置新的ID
|
|
1996
2317
|
*/
|
|
1997
2318
|
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
1998
|
-
|
|
2319
|
+
setNewItemId(config, force = true) {
|
|
1999
2320
|
if (force || editorService.getNodeById(config.id)) {
|
|
2000
|
-
const newId =
|
|
2321
|
+
const newId = this.createId(config.type || "component");
|
|
2001
2322
|
this.setRelateId(config.id, newId);
|
|
2002
2323
|
config.id = newId;
|
|
2003
2324
|
}
|
|
2004
2325
|
if (config.items && Array.isArray(config.items)) {
|
|
2005
2326
|
for (const item of config.items) {
|
|
2006
|
-
|
|
2327
|
+
this.setNewItemId(item);
|
|
2007
2328
|
}
|
|
2008
2329
|
}
|
|
2009
2330
|
return config;
|
|
@@ -2013,7 +2334,7 @@ class Props extends BaseService {
|
|
|
2013
2334
|
* @param type 组件类型
|
|
2014
2335
|
* @returns Object
|
|
2015
2336
|
*/
|
|
2016
|
-
|
|
2337
|
+
getDefaultPropsValue(type) {
|
|
2017
2338
|
return ["page", "container"].includes(type) ? {
|
|
2018
2339
|
type,
|
|
2019
2340
|
layout: "absolute",
|
|
@@ -2067,6 +2388,9 @@ class Props extends BaseService {
|
|
|
2067
2388
|
this.removeAllListeners();
|
|
2068
2389
|
this.removeAllPlugins();
|
|
2069
2390
|
}
|
|
2391
|
+
usePlugin(options) {
|
|
2392
|
+
super.usePlugin(options);
|
|
2393
|
+
}
|
|
2070
2394
|
/**
|
|
2071
2395
|
* 获取setNewItemId前后映射关系
|
|
2072
2396
|
* @param oldId 原组件ID
|
|
@@ -2226,18 +2550,15 @@ var Protocol = /* @__PURE__ */ ((Protocol2) => {
|
|
|
2226
2550
|
Protocol2["BOOLEAN"] = "boolean";
|
|
2227
2551
|
return Protocol2;
|
|
2228
2552
|
})(Protocol || {});
|
|
2553
|
+
const canUsePluginMethods$4 = {
|
|
2554
|
+
async: [],
|
|
2555
|
+
sync: ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]
|
|
2556
|
+
};
|
|
2229
2557
|
class WebStorage extends BaseService {
|
|
2230
2558
|
storage = globalThis.localStorage;
|
|
2231
2559
|
namespace = "tmagic";
|
|
2232
2560
|
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
|
-
]);
|
|
2561
|
+
super(canUsePluginMethods$4.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
2241
2562
|
}
|
|
2242
2563
|
/**
|
|
2243
2564
|
* 获取数据存储对象,可以通过
|
|
@@ -2320,6 +2641,9 @@ class WebStorage extends BaseService {
|
|
|
2320
2641
|
this.removeAllListeners();
|
|
2321
2642
|
this.removeAllPlugins();
|
|
2322
2643
|
}
|
|
2644
|
+
usePlugin(options) {
|
|
2645
|
+
super.usePlugin(options);
|
|
2646
|
+
}
|
|
2323
2647
|
getValueAndProtocol(value) {
|
|
2324
2648
|
let protocol = "";
|
|
2325
2649
|
if (value === null) {
|
|
@@ -2340,6 +2664,33 @@ class WebStorage extends BaseService {
|
|
|
2340
2664
|
}
|
|
2341
2665
|
const storageService = new WebStorage();
|
|
2342
2666
|
|
|
2667
|
+
const canUsePluginMethods$3 = {
|
|
2668
|
+
async: [
|
|
2669
|
+
"getLayout",
|
|
2670
|
+
"highlight",
|
|
2671
|
+
"select",
|
|
2672
|
+
"multiSelect",
|
|
2673
|
+
"doAdd",
|
|
2674
|
+
"add",
|
|
2675
|
+
"doRemove",
|
|
2676
|
+
"remove",
|
|
2677
|
+
"doUpdate",
|
|
2678
|
+
"update",
|
|
2679
|
+
"sort",
|
|
2680
|
+
"copy",
|
|
2681
|
+
"paste",
|
|
2682
|
+
"doPaste",
|
|
2683
|
+
"doAlignCenter",
|
|
2684
|
+
"alignCenter",
|
|
2685
|
+
"moveLayer",
|
|
2686
|
+
"moveToContainer",
|
|
2687
|
+
"dragTo",
|
|
2688
|
+
"undo",
|
|
2689
|
+
"redo",
|
|
2690
|
+
"move"
|
|
2691
|
+
],
|
|
2692
|
+
sync: []
|
|
2693
|
+
};
|
|
2343
2694
|
class Editor extends BaseService {
|
|
2344
2695
|
state = reactive({
|
|
2345
2696
|
root: null,
|
|
@@ -2358,29 +2709,7 @@ class Editor extends BaseService {
|
|
|
2358
2709
|
isHistoryStateChange = false;
|
|
2359
2710
|
constructor() {
|
|
2360
2711
|
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
|
-
],
|
|
2712
|
+
canUsePluginMethods$3.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2384
2713
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2385
2714
|
["select", "update", "moveLayer"]
|
|
2386
2715
|
);
|
|
@@ -2882,7 +3211,7 @@ class Editor extends BaseService {
|
|
|
2882
3211
|
}
|
|
2883
3212
|
async doPaste(config, position = {}) {
|
|
2884
3213
|
propsService.clearRelateId();
|
|
2885
|
-
const pasteConfigs =
|
|
3214
|
+
const pasteConfigs = beforePaste(position, cloneDeep(config));
|
|
2886
3215
|
return pasteConfigs;
|
|
2887
3216
|
}
|
|
2888
3217
|
async doAlignCenter(config) {
|
|
@@ -3120,6 +3449,9 @@ class Editor extends BaseService {
|
|
|
3120
3449
|
resetModifiedNodeId() {
|
|
3121
3450
|
this.get("modifiedNodeIds").clear();
|
|
3122
3451
|
}
|
|
3452
|
+
usePlugin(options) {
|
|
3453
|
+
super.usePlugin(options);
|
|
3454
|
+
}
|
|
3123
3455
|
addModifiedNodeId(id) {
|
|
3124
3456
|
if (!this.isHistoryStateChange) {
|
|
3125
3457
|
this.get("modifiedNodeIds").set(id, id);
|
|
@@ -3187,45 +3519,43 @@ class Editor extends BaseService {
|
|
|
3187
3519
|
}
|
|
3188
3520
|
const editorService = new Editor();
|
|
3189
3521
|
|
|
3190
|
-
const beforePaste =
|
|
3522
|
+
const beforePaste = (position, config) => {
|
|
3191
3523
|
if (!config[0]?.style)
|
|
3192
3524
|
return config;
|
|
3193
3525
|
const curNode = editorService.get("node");
|
|
3194
3526
|
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
|
-
);
|
|
3527
|
+
const pasteConfigs = config.map((configItem) => {
|
|
3528
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
3529
|
+
let pastePosition = positionClone;
|
|
3530
|
+
if (!isEmpty(pastePosition) && curNode?.items) {
|
|
3531
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
3532
|
+
}
|
|
3533
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
3534
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
3535
|
+
}
|
|
3536
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
3537
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
3538
|
+
}
|
|
3539
|
+
const pasteConfig = propsService.setNewItemId(configItem, false);
|
|
3540
|
+
if (pasteConfig.style) {
|
|
3541
|
+
const { left, top } = pasteConfig.style;
|
|
3542
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
3543
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
3544
|
+
}
|
|
3545
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
3546
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
3547
|
+
}
|
|
3548
|
+
pasteConfig.style = {
|
|
3549
|
+
...pasteConfig.style,
|
|
3550
|
+
...pastePosition
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
const root = editorService.get("root");
|
|
3554
|
+
if ((isPage(pasteConfig) || isPageFragment(pasteConfig)) && root) {
|
|
3555
|
+
pasteConfig.name = generatePageNameByApp(root, isPage(pasteConfig) ? NodeType.PAGE : NodeType.PAGE_FRAGMENT);
|
|
3556
|
+
}
|
|
3557
|
+
return pasteConfig;
|
|
3558
|
+
});
|
|
3229
3559
|
return pasteConfigs;
|
|
3230
3560
|
};
|
|
3231
3561
|
const getPositionInContainer = (position = {}, id) => {
|
|
@@ -3259,7 +3589,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
3259
3589
|
return newNode;
|
|
3260
3590
|
};
|
|
3261
3591
|
|
|
3262
|
-
const _sfc_main$
|
|
3592
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
3263
3593
|
...{
|
|
3264
3594
|
name: "MEditorCodeParams"
|
|
3265
3595
|
},
|
|
@@ -3310,7 +3640,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
3310
3640
|
});
|
|
3311
3641
|
|
|
3312
3642
|
const _hoisted_1$r = ["src"];
|
|
3313
|
-
const _sfc_main$
|
|
3643
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
3314
3644
|
...{
|
|
3315
3645
|
name: "MEditorIcon"
|
|
3316
3646
|
},
|
|
@@ -3414,9 +3744,9 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3414
3744
|
|
|
3415
3745
|
const _hoisted_1$q = { class: "m-fields-code-select-col" };
|
|
3416
3746
|
const _hoisted_2$j = { class: "code-select-container" };
|
|
3417
|
-
const _sfc_main$
|
|
3747
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
3418
3748
|
...{
|
|
3419
|
-
name: "
|
|
3749
|
+
name: "MFieldsCodeSelectCol"
|
|
3420
3750
|
},
|
|
3421
3751
|
__name: "CodeSelectCol",
|
|
3422
3752
|
props: {
|
|
@@ -3499,14 +3829,14 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3499
3829
|
size: _ctx.size,
|
|
3500
3830
|
onChange: onParamsChangeHandler
|
|
3501
3831
|
}, null, 8, ["model", "size"]),
|
|
3502
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
3832
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
|
|
3503
3833
|
key: 0,
|
|
3504
3834
|
class: "icon",
|
|
3505
3835
|
icon: !notEditable.value ? unref(Edit) : unref(View),
|
|
3506
3836
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
|
|
3507
3837
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3508
3838
|
]),
|
|
3509
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3839
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3510
3840
|
name: "params",
|
|
3511
3841
|
key: _ctx.model[_ctx.name],
|
|
3512
3842
|
model: _ctx.model,
|
|
@@ -3514,7 +3844,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3514
3844
|
"params-config": paramsConfig.value,
|
|
3515
3845
|
onChange: onParamsChangeHandler
|
|
3516
3846
|
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
|
|
3517
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
3847
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
3518
3848
|
key: 1,
|
|
3519
3849
|
ref_key: "codeBlockEditor",
|
|
3520
3850
|
ref: codeBlockEditor,
|
|
@@ -3529,9 +3859,9 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3529
3859
|
|
|
3530
3860
|
const _hoisted_1$p = { class: "m-editor-data-source-fields" };
|
|
3531
3861
|
const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
|
|
3532
|
-
const _sfc_main$
|
|
3862
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
3533
3863
|
...{
|
|
3534
|
-
name: "
|
|
3864
|
+
name: "MFieldsDataSourceFields"
|
|
3535
3865
|
},
|
|
3536
3866
|
__name: "DataSourceFields",
|
|
3537
3867
|
props: {
|
|
@@ -3583,7 +3913,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3583
3913
|
},
|
|
3584
3914
|
{
|
|
3585
3915
|
label: "默认值",
|
|
3586
|
-
prop: "defaultValue"
|
|
3916
|
+
prop: "defaultValue",
|
|
3917
|
+
formatter(item, row) {
|
|
3918
|
+
try {
|
|
3919
|
+
return JSON.stringify(row.defaultValue);
|
|
3920
|
+
} catch (e) {
|
|
3921
|
+
return row.defaultValue;
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3587
3924
|
},
|
|
3588
3925
|
{
|
|
3589
3926
|
label: "操作",
|
|
@@ -3821,7 +4158,11 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3821
4158
|
}
|
|
3822
4159
|
});
|
|
3823
4160
|
|
|
3824
|
-
const
|
|
4161
|
+
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4162
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
4163
|
+
...{
|
|
4164
|
+
name: "MFieldsDataSourceFieldSelect"
|
|
4165
|
+
},
|
|
3825
4166
|
__name: "DataSourceFieldSelect",
|
|
3826
4167
|
props: {
|
|
3827
4168
|
config: {},
|
|
@@ -3840,48 +4181,117 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3840
4181
|
const emit = __emit;
|
|
3841
4182
|
const props = __props;
|
|
3842
4183
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
3843
|
-
const getOptionChildren = (fields = []
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
4184
|
+
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4185
|
+
const child = [];
|
|
4186
|
+
fields.forEach((field) => {
|
|
4187
|
+
if (!dataSourceFieldType.length) {
|
|
4188
|
+
dataSourceFieldType.push("any");
|
|
4189
|
+
}
|
|
4190
|
+
const children = getOptionChildren(field.fields, dataSourceFieldType);
|
|
4191
|
+
const item = {
|
|
4192
|
+
label: field.title || field.name,
|
|
4193
|
+
value: field.name,
|
|
4194
|
+
children
|
|
4195
|
+
};
|
|
4196
|
+
const fieldType = field.type || "any";
|
|
4197
|
+
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
4198
|
+
child.push(item);
|
|
4199
|
+
return;
|
|
4200
|
+
}
|
|
4201
|
+
if (!dataSourceFieldType.includes(fieldType) && fieldType !== "object") {
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4204
|
+
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
4205
|
+
return;
|
|
4206
|
+
}
|
|
4207
|
+
child.push(item);
|
|
4208
|
+
});
|
|
4209
|
+
return child;
|
|
4210
|
+
};
|
|
3848
4211
|
const cascaderConfig = computed(() => {
|
|
3849
4212
|
const valueIsKey = props.config.value === "key";
|
|
3850
4213
|
return {
|
|
3851
4214
|
type: "cascader",
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
4215
|
+
checkStrictly: props.config.checkStrictly ?? !valueIsKey,
|
|
4216
|
+
popperClass: "m-editor-data-source-field-select-popper",
|
|
4217
|
+
options: () => {
|
|
4218
|
+
const options = dataSources.value?.map((ds) => ({
|
|
4219
|
+
label: ds.title || ds.id,
|
|
4220
|
+
value: valueIsKey ? ds.id : `${DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
4221
|
+
children: getOptionChildren(ds.fields, props.config.dataSourceFieldType)
|
|
4222
|
+
})) || [];
|
|
4223
|
+
return options.filter((option) => option.children.length);
|
|
4224
|
+
}
|
|
3860
4225
|
};
|
|
3861
4226
|
});
|
|
4227
|
+
const showDataSourceFieldSelect = ref(false);
|
|
4228
|
+
onMounted(() => {
|
|
4229
|
+
const value = props.model[props.name];
|
|
4230
|
+
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4231
|
+
return showDataSourceFieldSelect.value = true;
|
|
4232
|
+
}
|
|
4233
|
+
});
|
|
4234
|
+
const mForm = inject("mForm");
|
|
4235
|
+
const type = computed(() => {
|
|
4236
|
+
let type2 = props.config.fieldConfig?.type;
|
|
4237
|
+
if (typeof type2 === "function") {
|
|
4238
|
+
type2 = type2(mForm, {
|
|
4239
|
+
model: props.model
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
if (type2 === "form")
|
|
4243
|
+
return "";
|
|
4244
|
+
if (type2 === "container")
|
|
4245
|
+
return "";
|
|
4246
|
+
return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.items ? "" : "text");
|
|
4247
|
+
});
|
|
4248
|
+
const tagName = computed(() => {
|
|
4249
|
+
if (showDataSourceFieldSelect.value || !props.config.fieldConfig) {
|
|
4250
|
+
return MCascader;
|
|
4251
|
+
}
|
|
4252
|
+
const component = resolveComponent(`m-${props.config.items ? "form" : "fields"}-${type.value}`);
|
|
4253
|
+
if (typeof component !== "string")
|
|
4254
|
+
return component;
|
|
4255
|
+
return "m-fields-text";
|
|
4256
|
+
});
|
|
3862
4257
|
const onChangeHandler = (value) => {
|
|
3863
4258
|
emit("change", value);
|
|
3864
4259
|
};
|
|
3865
4260
|
return (_ctx, _cache) => {
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
4261
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
4262
|
+
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
4263
|
+
style: { "width": "100%" },
|
|
4264
|
+
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
4265
|
+
model: _ctx.model,
|
|
4266
|
+
name: _ctx.name,
|
|
4267
|
+
disabled: _ctx.disabled,
|
|
4268
|
+
size: _ctx.size,
|
|
4269
|
+
"last-values": _ctx.lastValues,
|
|
4270
|
+
"init-values": _ctx.initValues,
|
|
4271
|
+
values: _ctx.values,
|
|
4272
|
+
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4273
|
+
onChange: onChangeHandler
|
|
4274
|
+
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4275
|
+
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4276
|
+
key: 0,
|
|
4277
|
+
style: { "margin-left": "5px" },
|
|
4278
|
+
link: "",
|
|
4279
|
+
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4280
|
+
icon: unref(Coin),
|
|
4281
|
+
size: _ctx.size,
|
|
4282
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4283
|
+
}, null, 8, ["type", "icon", "size"])) : createCommentVNode("", true)
|
|
4284
|
+
]);
|
|
3875
4285
|
};
|
|
3876
4286
|
}
|
|
3877
4287
|
});
|
|
3878
4288
|
|
|
3879
|
-
const _hoisted_1$
|
|
4289
|
+
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3880
4290
|
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3881
4291
|
const _hoisted_3$7 = { class: "el-input__inner" };
|
|
3882
|
-
const _sfc_main$
|
|
4292
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
3883
4293
|
...{
|
|
3884
|
-
name: "
|
|
4294
|
+
name: "MFieldsDataSourceInput"
|
|
3885
4295
|
},
|
|
3886
4296
|
__name: "DataSourceInput",
|
|
3887
4297
|
props: {
|
|
@@ -4069,10 +4479,10 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4069
4479
|
}
|
|
4070
4480
|
), {
|
|
4071
4481
|
suffix: withCtx(() => [
|
|
4072
|
-
createVNode(_sfc_main$
|
|
4482
|
+
createVNode(_sfc_main$N, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4073
4483
|
]),
|
|
4074
4484
|
default: withCtx(({ item }) => [
|
|
4075
|
-
createElementVNode("div", _hoisted_1$
|
|
4485
|
+
createElementVNode("div", _hoisted_1$n, [
|
|
4076
4486
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
4077
4487
|
createElementVNode("span", _hoisted_2$h, toDisplayString(item.value), 1)
|
|
4078
4488
|
])
|
|
@@ -4104,7 +4514,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4104
4514
|
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
4105
4515
|
], 64);
|
|
4106
4516
|
}), 256)),
|
|
4107
|
-
createVNode(_sfc_main$
|
|
4517
|
+
createVNode(_sfc_main$N, {
|
|
4108
4518
|
class: "tmagic-data-source-input-icon",
|
|
4109
4519
|
icon: unref(Coin)
|
|
4110
4520
|
}, null, 8, ["icon"])
|
|
@@ -4187,11 +4597,11 @@ const useDataSourceMethod = () => {
|
|
|
4187
4597
|
};
|
|
4188
4598
|
};
|
|
4189
4599
|
|
|
4190
|
-
const _hoisted_1$
|
|
4600
|
+
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4191
4601
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
4192
|
-
const _sfc_main$
|
|
4602
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
4193
4603
|
...{
|
|
4194
|
-
name: "
|
|
4604
|
+
name: "MFieldsDataSourceMethods"
|
|
4195
4605
|
},
|
|
4196
4606
|
__name: "DataSourceMethods",
|
|
4197
4607
|
props: {
|
|
@@ -4259,7 +4669,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4259
4669
|
emit("change", props.model[props.name]);
|
|
4260
4670
|
};
|
|
4261
4671
|
return (_ctx, _cache) => {
|
|
4262
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4672
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
4263
4673
|
createVNode(unref(MagicTable), {
|
|
4264
4674
|
data: _ctx.model[_ctx.name],
|
|
4265
4675
|
columns: methodColumns
|
|
@@ -4278,7 +4688,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4278
4688
|
_: 1
|
|
4279
4689
|
}, 8, ["disabled"])
|
|
4280
4690
|
]),
|
|
4281
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4691
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
4282
4692
|
key: 0,
|
|
4283
4693
|
ref_key: "codeBlockEditor",
|
|
4284
4694
|
ref: codeBlockEditor,
|
|
@@ -4293,11 +4703,11 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4293
4703
|
}
|
|
4294
4704
|
});
|
|
4295
4705
|
|
|
4296
|
-
const _hoisted_1$
|
|
4706
|
+
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
4297
4707
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
4298
|
-
const _sfc_main$
|
|
4708
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
4299
4709
|
...{
|
|
4300
|
-
name: "
|
|
4710
|
+
name: "MFieldsDataSourceMethodSelect"
|
|
4301
4711
|
},
|
|
4302
4712
|
__name: "DataSourceMethodSelect",
|
|
4303
4713
|
props: {
|
|
@@ -4386,7 +4796,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4386
4796
|
};
|
|
4387
4797
|
return (_ctx, _cache) => {
|
|
4388
4798
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4389
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4799
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
4390
4800
|
createElementVNode("div", _hoisted_2$f, [
|
|
4391
4801
|
createVNode(_component_m_form_container, {
|
|
4392
4802
|
class: "select",
|
|
@@ -4394,14 +4804,14 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4394
4804
|
model: _ctx.model,
|
|
4395
4805
|
onChange: onChangeHandler
|
|
4396
4806
|
}, null, 8, ["config", "model"]),
|
|
4397
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$
|
|
4807
|
+
_ctx.model[_ctx.name] && isCustomMethod.value ? (openBlock(), createBlock(_sfc_main$N, {
|
|
4398
4808
|
key: 0,
|
|
4399
4809
|
class: "icon",
|
|
4400
4810
|
icon: !notEditable.value ? unref(Edit) : unref(View),
|
|
4401
4811
|
onClick: editCodeHandler
|
|
4402
4812
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
4403
4813
|
]),
|
|
4404
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4814
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
|
|
4405
4815
|
key: 0,
|
|
4406
4816
|
name: "params",
|
|
4407
4817
|
model: _ctx.model,
|
|
@@ -4410,7 +4820,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4410
4820
|
"params-config": paramsConfig.value,
|
|
4411
4821
|
onChange: onChangeHandler
|
|
4412
4822
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
|
|
4413
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4823
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
4414
4824
|
key: 1,
|
|
4415
4825
|
ref_key: "codeBlockEditor",
|
|
4416
4826
|
ref: codeBlockEditor,
|
|
@@ -4423,11 +4833,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4423
4833
|
}
|
|
4424
4834
|
});
|
|
4425
4835
|
|
|
4426
|
-
const _hoisted_1$
|
|
4836
|
+
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
4427
4837
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
4428
|
-
const _sfc_main$
|
|
4838
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
4429
4839
|
...{
|
|
4430
|
-
name: "
|
|
4840
|
+
name: "MFieldsDataSourceMocks"
|
|
4431
4841
|
},
|
|
4432
4842
|
__name: "DataSourceMocks",
|
|
4433
4843
|
props: {
|
|
@@ -4621,7 +5031,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4621
5031
|
});
|
|
4622
5032
|
};
|
|
4623
5033
|
return (_ctx, _cache) => {
|
|
4624
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5034
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
4625
5035
|
createVNode(unref(MagicTable), {
|
|
4626
5036
|
data: _ctx.model[_ctx.name],
|
|
4627
5037
|
columns
|
|
@@ -4657,9 +5067,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4657
5067
|
}
|
|
4658
5068
|
});
|
|
4659
5069
|
|
|
4660
|
-
const _sfc_main$
|
|
5070
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
4661
5071
|
...{
|
|
4662
|
-
name: "
|
|
5072
|
+
name: "MFieldsDataSourceSelect"
|
|
4663
5073
|
},
|
|
4664
5074
|
__name: "DataSourceSelect",
|
|
4665
5075
|
props: {
|
|
@@ -4714,14 +5124,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4714
5124
|
}
|
|
4715
5125
|
});
|
|
4716
5126
|
|
|
4717
|
-
const _hoisted_1$
|
|
5127
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
4718
5128
|
const _hoisted_2$d = {
|
|
4719
5129
|
key: 1,
|
|
4720
5130
|
class: "fullWidth"
|
|
4721
5131
|
};
|
|
4722
|
-
const _sfc_main$
|
|
5132
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
4723
5133
|
...{
|
|
4724
|
-
name: "
|
|
5134
|
+
name: "MFieldsEventSelect"
|
|
4725
5135
|
},
|
|
4726
5136
|
__name: "EventSelect",
|
|
4727
5137
|
props: {
|
|
@@ -4923,7 +5333,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4923
5333
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4924
5334
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4925
5335
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
4926
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5336
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
4927
5337
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
4928
5338
|
key: 0,
|
|
4929
5339
|
ref: "eventForm",
|
|
@@ -4983,7 +5393,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4983
5393
|
}
|
|
4984
5394
|
});
|
|
4985
5395
|
|
|
4986
|
-
const _hoisted_1$
|
|
5396
|
+
const _hoisted_1$i = {
|
|
4987
5397
|
viewBox: "0 0 32 32",
|
|
4988
5398
|
version: "1.1",
|
|
4989
5399
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4993,24 +5403,24 @@ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
|
|
|
4993
5403
|
const _hoisted_4$6 = [
|
|
4994
5404
|
_hoisted_2$c
|
|
4995
5405
|
];
|
|
4996
|
-
const _sfc_main$
|
|
5406
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
4997
5407
|
...{
|
|
4998
5408
|
name: "MEditorCodeIcon"
|
|
4999
5409
|
},
|
|
5000
5410
|
__name: "CodeIcon",
|
|
5001
5411
|
setup(__props) {
|
|
5002
5412
|
return (_ctx, _cache) => {
|
|
5003
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
5413
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_4$6);
|
|
5004
5414
|
};
|
|
5005
5415
|
}
|
|
5006
5416
|
});
|
|
5007
5417
|
|
|
5008
|
-
const _hoisted_1$
|
|
5418
|
+
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5009
5419
|
const _hoisted_2$b = { key: 0 };
|
|
5010
5420
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5011
|
-
const _sfc_main$
|
|
5421
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5012
5422
|
...{
|
|
5013
|
-
name: "
|
|
5423
|
+
name: "MFieldsKeyValue"
|
|
5014
5424
|
},
|
|
5015
5425
|
__name: "KeyValue",
|
|
5016
5426
|
props: {
|
|
@@ -5066,7 +5476,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5066
5476
|
emit("change", v);
|
|
5067
5477
|
};
|
|
5068
5478
|
return (_ctx, _cache) => {
|
|
5069
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5479
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
5070
5480
|
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
|
|
5071
5481
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
5072
5482
|
return openBlock(), createElementBlock("div", {
|
|
@@ -5132,7 +5542,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5132
5542
|
size: "default",
|
|
5133
5543
|
disabled: _ctx.disabled,
|
|
5134
5544
|
link: "",
|
|
5135
|
-
icon: _sfc_main$
|
|
5545
|
+
icon: _sfc_main$D,
|
|
5136
5546
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5137
5547
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
5138
5548
|
]);
|
|
@@ -5140,11 +5550,11 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5140
5550
|
}
|
|
5141
5551
|
});
|
|
5142
5552
|
|
|
5143
|
-
const _hoisted_1$
|
|
5553
|
+
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
5144
5554
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
5145
|
-
const _sfc_main$
|
|
5555
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
5146
5556
|
...{
|
|
5147
|
-
name: "
|
|
5557
|
+
name: "MFieldsPageFragmentSelect"
|
|
5148
5558
|
},
|
|
5149
5559
|
__name: "PageFragmentSelect",
|
|
5150
5560
|
props: {
|
|
@@ -5188,7 +5598,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5188
5598
|
};
|
|
5189
5599
|
return (_ctx, _cache) => {
|
|
5190
5600
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
5191
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5601
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
5192
5602
|
createElementVNode("div", _hoisted_2$a, [
|
|
5193
5603
|
createVNode(_component_m_form_container, {
|
|
5194
5604
|
class: "select",
|
|
@@ -5197,7 +5607,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5197
5607
|
size: _ctx.size,
|
|
5198
5608
|
onChange: changeHandler
|
|
5199
5609
|
}, null, 8, ["model", "size"]),
|
|
5200
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
5610
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5201
5611
|
key: 0,
|
|
5202
5612
|
class: "icon",
|
|
5203
5613
|
icon: unref(Edit),
|
|
@@ -5209,14 +5619,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5209
5619
|
}
|
|
5210
5620
|
});
|
|
5211
5621
|
|
|
5212
|
-
const _hoisted_1$
|
|
5622
|
+
const _hoisted_1$f = {
|
|
5213
5623
|
key: 1,
|
|
5214
5624
|
class: "m-fields-ui-select",
|
|
5215
5625
|
style: { "display": "flex" }
|
|
5216
5626
|
};
|
|
5217
|
-
const _sfc_main$
|
|
5627
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
5218
5628
|
...{
|
|
5219
|
-
name: "
|
|
5629
|
+
name: "MFieldsUISelect"
|
|
5220
5630
|
},
|
|
5221
5631
|
__name: "UISelect",
|
|
5222
5632
|
props: {
|
|
@@ -5283,7 +5693,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5283
5693
|
services?.editorService.get("stage")?.highlight(id);
|
|
5284
5694
|
services?.stageOverlayService.get("stage")?.highlight(id);
|
|
5285
5695
|
}, 150);
|
|
5286
|
-
const
|
|
5696
|
+
const unhighlight = () => {
|
|
5287
5697
|
services?.editorService.set("highlightNode", null);
|
|
5288
5698
|
services?.editorService.get("stage")?.clearHighlight();
|
|
5289
5699
|
services?.stageOverlayService.get("stage")?.clearHighlight();
|
|
@@ -5307,7 +5717,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5307
5717
|
]),
|
|
5308
5718
|
_: 1
|
|
5309
5719
|
}, 8, ["icon", "disabled", "size"])
|
|
5310
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5720
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
5311
5721
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5312
5722
|
createVNode(unref(TMagicTooltip), {
|
|
5313
5723
|
content: "清除",
|
|
@@ -5322,7 +5732,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5322
5732
|
size: _ctx.size,
|
|
5323
5733
|
link: "",
|
|
5324
5734
|
onClick: withModifiers(deleteHandler, ["stop"])
|
|
5325
|
-
}, null, 8, ["icon", "disabled", "size"
|
|
5735
|
+
}, null, 8, ["icon", "disabled", "size"])
|
|
5326
5736
|
]),
|
|
5327
5737
|
_: 1
|
|
5328
5738
|
}),
|
|
@@ -5338,7 +5748,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5338
5748
|
size: _ctx.size,
|
|
5339
5749
|
onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
|
|
5340
5750
|
onMouseenter: _cache[1] || (_cache[1] = ($event) => unref(highlight)(val.value)),
|
|
5341
|
-
onMouseleave:
|
|
5751
|
+
onMouseleave: unhighlight
|
|
5342
5752
|
}, {
|
|
5343
5753
|
default: withCtx(() => [
|
|
5344
5754
|
createTextVNode(toDisplayString(`${toName.value}_${val.value}`), 1)
|
|
@@ -5402,7 +5812,7 @@ const useGetSo = (target, emit) => {
|
|
|
5402
5812
|
};
|
|
5403
5813
|
};
|
|
5404
5814
|
|
|
5405
|
-
const _sfc_main$
|
|
5815
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
5406
5816
|
...{
|
|
5407
5817
|
name: "MEditorResizer"
|
|
5408
5818
|
},
|
|
@@ -5424,7 +5834,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
5424
5834
|
}
|
|
5425
5835
|
});
|
|
5426
5836
|
|
|
5427
|
-
const _sfc_main$
|
|
5837
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
5428
5838
|
...{
|
|
5429
5839
|
name: "MEditorSplitView"
|
|
5430
5840
|
},
|
|
@@ -5551,7 +5961,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5551
5961
|
}, [
|
|
5552
5962
|
renderSlot(_ctx.$slots, "left")
|
|
5553
5963
|
], 6),
|
|
5554
|
-
createVNode(_sfc_main$
|
|
5964
|
+
createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
5555
5965
|
], 64)) : createCommentVNode("", true),
|
|
5556
5966
|
createElementVNode("div", {
|
|
5557
5967
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -5560,7 +5970,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5560
5970
|
renderSlot(_ctx.$slots, "center")
|
|
5561
5971
|
], 6),
|
|
5562
5972
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5563
|
-
createVNode(_sfc_main$
|
|
5973
|
+
createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
5564
5974
|
createElementVNode("div", {
|
|
5565
5975
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
5566
5976
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -5573,12 +5983,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5573
5983
|
}
|
|
5574
5984
|
});
|
|
5575
5985
|
|
|
5576
|
-
const _hoisted_1$
|
|
5986
|
+
const _hoisted_1$e = {
|
|
5577
5987
|
key: 1,
|
|
5578
5988
|
class: "menu-item-text"
|
|
5579
5989
|
};
|
|
5580
5990
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
5581
|
-
const _sfc_main$
|
|
5991
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
5582
5992
|
...{
|
|
5583
5993
|
name: "MEditorToolButton"
|
|
5584
5994
|
},
|
|
@@ -5657,7 +6067,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5657
6067
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
5658
6068
|
key: 0,
|
|
5659
6069
|
direction: _ctx.data.direction || "vertical"
|
|
5660
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6070
|
+
}, 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
6071
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
5662
6072
|
key: 0,
|
|
5663
6073
|
effect: "dark",
|
|
@@ -5671,7 +6081,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5671
6081
|
disabled: disabled.value
|
|
5672
6082
|
}, {
|
|
5673
6083
|
default: withCtx(() => [
|
|
5674
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
6084
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5675
6085
|
key: 0,
|
|
5676
6086
|
icon: _ctx.data.icon
|
|
5677
6087
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5689,7 +6099,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5689
6099
|
title: _ctx.data.text
|
|
5690
6100
|
}, {
|
|
5691
6101
|
default: withCtx(() => [
|
|
5692
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
6102
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5693
6103
|
key: 0,
|
|
5694
6104
|
icon: _ctx.data.icon
|
|
5695
6105
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5739,11 +6149,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5739
6149
|
}
|
|
5740
6150
|
});
|
|
5741
6151
|
|
|
5742
|
-
const _hoisted_1$
|
|
6152
|
+
const _hoisted_1$d = {
|
|
5743
6153
|
key: 1,
|
|
5744
6154
|
style: { "width": "21px" }
|
|
5745
6155
|
};
|
|
5746
|
-
const _sfc_main$
|
|
6156
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
5747
6157
|
...{
|
|
5748
6158
|
name: "MEditorPageBarAddButton"
|
|
5749
6159
|
},
|
|
@@ -5777,13 +6187,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5777
6187
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5778
6188
|
onClick: addPage
|
|
5779
6189
|
}, [
|
|
5780
|
-
createVNode(_sfc_main$
|
|
5781
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6190
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6191
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$d));
|
|
5782
6192
|
};
|
|
5783
6193
|
}
|
|
5784
6194
|
});
|
|
5785
6195
|
|
|
5786
|
-
const _sfc_main$
|
|
6196
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
5787
6197
|
...{
|
|
5788
6198
|
name: "MEditorPageBarScrollContainer"
|
|
5789
6199
|
},
|
|
@@ -5889,7 +6299,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5889
6299
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5890
6300
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5891
6301
|
}, [
|
|
5892
|
-
createVNode(_sfc_main$
|
|
6302
|
+
createVNode(_sfc_main$N, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
5893
6303
|
])) : createCommentVNode("", true),
|
|
5894
6304
|
_ctx.type === unref(NodeType).PAGE && pageLength.value || _ctx.type === unref(NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (openBlock(), createElementBlock("div", {
|
|
5895
6305
|
key: 1,
|
|
@@ -5905,14 +6315,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5905
6315
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5906
6316
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5907
6317
|
}, [
|
|
5908
|
-
createVNode(_sfc_main$
|
|
6318
|
+
createVNode(_sfc_main$N, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
5909
6319
|
])) : createCommentVNode("", true)
|
|
5910
6320
|
], 512);
|
|
5911
6321
|
};
|
|
5912
6322
|
}
|
|
5913
6323
|
});
|
|
5914
6324
|
|
|
5915
|
-
const _sfc_main$
|
|
6325
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
5916
6326
|
...{
|
|
5917
6327
|
name: "MEditorPageBarSwitchTypeButton"
|
|
5918
6328
|
},
|
|
@@ -5956,11 +6366,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5956
6366
|
}
|
|
5957
6367
|
});
|
|
5958
6368
|
|
|
5959
|
-
const _hoisted_1$
|
|
6369
|
+
const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
5960
6370
|
const _hoisted_2$8 = ["onClick"];
|
|
5961
6371
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
5962
6372
|
const _hoisted_4$5 = ["title"];
|
|
5963
|
-
const _sfc_main$
|
|
6373
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
5964
6374
|
...{
|
|
5965
6375
|
name: "MEditorPageBar"
|
|
5966
6376
|
},
|
|
@@ -6038,15 +6448,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6038
6448
|
editorService?.remove(node);
|
|
6039
6449
|
};
|
|
6040
6450
|
return (_ctx, _cache) => {
|
|
6041
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6042
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$
|
|
6451
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
6452
|
+
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$u, {
|
|
6043
6453
|
key: 0,
|
|
6044
6454
|
modelValue: active.value,
|
|
6045
6455
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
6046
6456
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
6047
|
-
createVNode(_sfc_main$
|
|
6457
|
+
createVNode(_sfc_main$v, { type: active.value }, {
|
|
6048
6458
|
prepend: withCtx(() => [
|
|
6049
|
-
createVNode(_sfc_main$
|
|
6459
|
+
createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
6050
6460
|
]),
|
|
6051
6461
|
default: withCtx(() => [
|
|
6052
6462
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
@@ -6079,7 +6489,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6079
6489
|
default: withCtx(() => [
|
|
6080
6490
|
createElementVNode("div", null, [
|
|
6081
6491
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
6082
|
-
createVNode(_sfc_main$
|
|
6492
|
+
createVNode(_sfc_main$x, {
|
|
6083
6493
|
data: {
|
|
6084
6494
|
type: "button",
|
|
6085
6495
|
text: "复制",
|
|
@@ -6087,7 +6497,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6087
6497
|
handler: () => copy(item)
|
|
6088
6498
|
}
|
|
6089
6499
|
}, null, 8, ["data"]),
|
|
6090
|
-
createVNode(_sfc_main$
|
|
6500
|
+
createVNode(_sfc_main$x, {
|
|
6091
6501
|
data: {
|
|
6092
6502
|
type: "button",
|
|
6093
6503
|
text: "删除",
|
|
@@ -6110,11 +6520,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
6110
6520
|
}
|
|
6111
6521
|
});
|
|
6112
6522
|
|
|
6113
|
-
const _hoisted_1$
|
|
6523
|
+
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
6114
6524
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
6115
6525
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
6116
6526
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
6117
|
-
const _sfc_main$
|
|
6527
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6118
6528
|
...{
|
|
6119
6529
|
name: "MEditorAddPageBox"
|
|
6120
6530
|
},
|
|
@@ -6138,14 +6548,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6138
6548
|
});
|
|
6139
6549
|
};
|
|
6140
6550
|
return (_ctx, _cache) => {
|
|
6141
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6551
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
6142
6552
|
createElementVNode("div", _hoisted_2$7, [
|
|
6143
6553
|
createElementVNode("div", {
|
|
6144
6554
|
class: "m-editor-empty-button",
|
|
6145
6555
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
|
|
6146
6556
|
}, [
|
|
6147
6557
|
createElementVNode("div", null, [
|
|
6148
|
-
createVNode(_sfc_main$
|
|
6558
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6149
6559
|
]),
|
|
6150
6560
|
_hoisted_3$4
|
|
6151
6561
|
]),
|
|
@@ -6155,7 +6565,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6155
6565
|
onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(unref(NodeType).PAGE_FRAGMENT))
|
|
6156
6566
|
}, [
|
|
6157
6567
|
createElementVNode("div", null, [
|
|
6158
|
-
createVNode(_sfc_main$
|
|
6568
|
+
createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6159
6569
|
]),
|
|
6160
6570
|
_hoisted_4$4
|
|
6161
6571
|
])) : createCommentVNode("", true)
|
|
@@ -6169,7 +6579,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
6169
6579
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
6170
6580
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
6171
6581
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
6172
|
-
const _sfc_main$
|
|
6582
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6173
6583
|
...{
|
|
6174
6584
|
name: "MEditorFramework"
|
|
6175
6585
|
},
|
|
@@ -6256,7 +6666,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6256
6666
|
options: unref(codeOptions),
|
|
6257
6667
|
onSave: saveCode
|
|
6258
6668
|
}, null, 8, ["init-values", "options"])
|
|
6259
|
-
]) : withDirectives((openBlock(), createBlock(_sfc_main$
|
|
6669
|
+
]) : withDirectives((openBlock(), createBlock(_sfc_main$y, {
|
|
6260
6670
|
key: 1,
|
|
6261
6671
|
"element-loading-text": "Runtime 加载中...",
|
|
6262
6672
|
ref_key: "splitView",
|
|
@@ -6279,10 +6689,10 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6279
6689
|
]),
|
|
6280
6690
|
center: withCtx(() => [
|
|
6281
6691
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
6282
|
-
createVNode(_sfc_main$
|
|
6692
|
+
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
6283
6693
|
]),
|
|
6284
6694
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
6285
|
-
createVNode(_sfc_main$
|
|
6695
|
+
createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
6286
6696
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
6287
6697
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6288
6698
|
]),
|
|
@@ -6317,7 +6727,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
6317
6727
|
}
|
|
6318
6728
|
});
|
|
6319
6729
|
|
|
6320
|
-
const _sfc_main$
|
|
6730
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
6321
6731
|
...{
|
|
6322
6732
|
name: "MEditorNavMenu"
|
|
6323
6733
|
},
|
|
@@ -6467,10 +6877,30 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6467
6877
|
});
|
|
6468
6878
|
return data;
|
|
6469
6879
|
});
|
|
6880
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
6881
|
+
const rect = navMenu.value?.getBoundingClientRect();
|
|
6882
|
+
if (rect) {
|
|
6883
|
+
uiService?.set("navMenuRect", {
|
|
6884
|
+
left: rect.left,
|
|
6885
|
+
top: rect.top,
|
|
6886
|
+
width: rect.width,
|
|
6887
|
+
height: rect.height
|
|
6888
|
+
});
|
|
6889
|
+
}
|
|
6890
|
+
});
|
|
6891
|
+
const navMenu = ref();
|
|
6892
|
+
onMounted(() => {
|
|
6893
|
+
navMenu.value && resizeObserver.observe(navMenu.value);
|
|
6894
|
+
});
|
|
6895
|
+
onBeforeUnmount(() => {
|
|
6896
|
+
resizeObserver.disconnect();
|
|
6897
|
+
});
|
|
6470
6898
|
return (_ctx, _cache) => {
|
|
6471
6899
|
return openBlock(), createElementBlock("div", {
|
|
6472
6900
|
class: "m-editor-nav-menu",
|
|
6473
|
-
style: normalizeStyle({ height: `${_ctx.height}px` })
|
|
6901
|
+
style: normalizeStyle({ height: `${_ctx.height}px` }),
|
|
6902
|
+
ref_key: "navMenu",
|
|
6903
|
+
ref: navMenu
|
|
6474
6904
|
}, [
|
|
6475
6905
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(keys), (key) => {
|
|
6476
6906
|
return openBlock(), createElementBlock("div", {
|
|
@@ -6479,7 +6909,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6479
6909
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
6480
6910
|
}, [
|
|
6481
6911
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
6482
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6912
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
6483
6913
|
data: item,
|
|
6484
6914
|
key: index
|
|
6485
6915
|
}, null, 8, ["data"]);
|
|
@@ -6491,8 +6921,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6491
6921
|
}
|
|
6492
6922
|
});
|
|
6493
6923
|
|
|
6494
|
-
const _hoisted_1$
|
|
6495
|
-
const _sfc_main$
|
|
6924
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
6925
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
6496
6926
|
...{
|
|
6497
6927
|
name: "MEditorPropsPanel"
|
|
6498
6928
|
},
|
|
@@ -6547,7 +6977,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6547
6977
|
};
|
|
6548
6978
|
__expose({ configForm, submit });
|
|
6549
6979
|
return (_ctx, _cache) => {
|
|
6550
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
6980
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
6551
6981
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
6552
6982
|
createVNode(unref(MForm), {
|
|
6553
6983
|
ref_key: "configForm",
|
|
@@ -6568,116 +6998,6 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6568
6998
|
}
|
|
6569
6999
|
});
|
|
6570
7000
|
|
|
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
7001
|
const useFloatBox = (slideKeys) => {
|
|
6682
7002
|
const floatBoxStates = ref(
|
|
6683
7003
|
slideKeys.value.reduce(
|
|
@@ -6861,7 +7181,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6861
7181
|
onContextmenu: nodeContentmenuHandler,
|
|
6862
7182
|
onMouseenter: mouseenterHandler
|
|
6863
7183
|
}, [
|
|
6864
|
-
createVNode(_sfc_main$
|
|
7184
|
+
createVNode(_sfc_main$N, {
|
|
6865
7185
|
class: "expand-icon",
|
|
6866
7186
|
style: normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
|
|
6867
7187
|
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
@@ -7140,7 +7460,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7140
7460
|
placement: "bottom"
|
|
7141
7461
|
}, {
|
|
7142
7462
|
default: withCtx(() => [
|
|
7143
|
-
createVNode(_sfc_main$
|
|
7463
|
+
createVNode(_sfc_main$N, {
|
|
7144
7464
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
7145
7465
|
class: "edit-icon",
|
|
7146
7466
|
onClick: withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
@@ -7155,7 +7475,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7155
7475
|
placement: "bottom"
|
|
7156
7476
|
}, {
|
|
7157
7477
|
default: withCtx(() => [
|
|
7158
|
-
createVNode(_sfc_main$
|
|
7478
|
+
createVNode(_sfc_main$N, {
|
|
7159
7479
|
icon: unref(Close),
|
|
7160
7480
|
class: "edit-icon",
|
|
7161
7481
|
onClick: withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
@@ -7232,7 +7552,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7232
7552
|
]),
|
|
7233
7553
|
_: 3
|
|
7234
7554
|
}),
|
|
7235
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
7555
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
7236
7556
|
key: 0,
|
|
7237
7557
|
ref_key: "codeBlockEditor",
|
|
7238
7558
|
ref: codeBlockEditor,
|
|
@@ -7413,7 +7733,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7413
7733
|
placement: "bottom"
|
|
7414
7734
|
}, {
|
|
7415
7735
|
default: withCtx(() => [
|
|
7416
|
-
createVNode(_sfc_main$
|
|
7736
|
+
createVNode(_sfc_main$N, {
|
|
7417
7737
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
7418
7738
|
class: "edit-icon",
|
|
7419
7739
|
onClick: withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
@@ -7428,7 +7748,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7428
7748
|
placement: "bottom"
|
|
7429
7749
|
}, {
|
|
7430
7750
|
default: withCtx(() => [
|
|
7431
|
-
createVNode(_sfc_main$
|
|
7751
|
+
createVNode(_sfc_main$N, {
|
|
7432
7752
|
icon: unref(Close),
|
|
7433
7753
|
class: "edit-icon",
|
|
7434
7754
|
onClick: withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
@@ -7530,7 +7850,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7530
7850
|
default: withCtx(() => [
|
|
7531
7851
|
createElementVNode("div", _hoisted_2$5, [
|
|
7532
7852
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
7533
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7853
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
7534
7854
|
data: {
|
|
7535
7855
|
type: "button",
|
|
7536
7856
|
text: item.text,
|
|
@@ -7544,14 +7864,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7544
7864
|
])
|
|
7545
7865
|
]),
|
|
7546
7866
|
_: 1
|
|
7547
|
-
})) : createCommentVNode("", true)
|
|
7867
|
+
})) : createCommentVNode("", true),
|
|
7868
|
+
renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
7548
7869
|
]),
|
|
7549
7870
|
createVNode(_sfc_main$i, {
|
|
7550
7871
|
onEdit: editHandler,
|
|
7551
7872
|
onRemove: removeHandler
|
|
7552
7873
|
})
|
|
7553
7874
|
]),
|
|
7554
|
-
_:
|
|
7875
|
+
_: 3
|
|
7555
7876
|
}),
|
|
7556
7877
|
createVNode(_sfc_main$j, {
|
|
7557
7878
|
ref_key: "editDialog",
|
|
@@ -7698,7 +8019,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7698
8019
|
renderSlot(_ctx.$slots, "title"),
|
|
7699
8020
|
createElementVNode("div", null, [
|
|
7700
8021
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
7701
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8022
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
7702
8023
|
"event-type": "mouseup",
|
|
7703
8024
|
ref_for: true,
|
|
7704
8025
|
ref_key: "buttons",
|
|
@@ -7963,12 +8284,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
7963
8284
|
};
|
|
7964
8285
|
return (_ctx, _cache) => {
|
|
7965
8286
|
return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
7966
|
-
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$
|
|
8287
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$N, {
|
|
7967
8288
|
key: 0,
|
|
7968
8289
|
icon: unref(Hide),
|
|
7969
8290
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
7970
8291
|
title: "点击显示"
|
|
7971
|
-
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$
|
|
8292
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$N, {
|
|
7972
8293
|
key: 1,
|
|
7973
8294
|
icon: unref(View),
|
|
7974
8295
|
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -8609,7 +8930,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
8609
8930
|
name: `${index}`
|
|
8610
8931
|
}, {
|
|
8611
8932
|
title: withCtx(() => [
|
|
8612
|
-
createVNode(_sfc_main$
|
|
8933
|
+
createVNode(_sfc_main$N, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
8613
8934
|
createTextVNode(toDisplayString(group.title), 1)
|
|
8614
8935
|
]),
|
|
8615
8936
|
default: withCtx(() => [
|
|
@@ -8630,7 +8951,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
8630
8951
|
content: item.desc
|
|
8631
8952
|
}, {
|
|
8632
8953
|
default: withCtx(() => [
|
|
8633
|
-
createVNode(_sfc_main$
|
|
8954
|
+
createVNode(_sfc_main$N, {
|
|
8634
8955
|
icon: item.icon
|
|
8635
8956
|
}, null, 8, ["icon"])
|
|
8636
8957
|
]),
|
|
@@ -8710,7 +9031,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8710
9031
|
icon: EditPen,
|
|
8711
9032
|
text: "代码编辑",
|
|
8712
9033
|
component: _sfc_main$k,
|
|
8713
|
-
slots: {}
|
|
9034
|
+
slots: {},
|
|
9035
|
+
boxComponentConfig: {
|
|
9036
|
+
props: {
|
|
9037
|
+
slideType: "box"
|
|
9038
|
+
}
|
|
9039
|
+
}
|
|
8714
9040
|
},
|
|
8715
9041
|
"data-source": {
|
|
8716
9042
|
$key: "data-source",
|
|
@@ -8767,7 +9093,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8767
9093
|
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
8768
9094
|
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
8769
9095
|
}, [
|
|
8770
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
9096
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
8771
9097
|
key: 0,
|
|
8772
9098
|
icon: config.icon
|
|
8773
9099
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -8828,6 +9154,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8828
9154
|
]),
|
|
8829
9155
|
key: "4"
|
|
8830
9156
|
} : void 0,
|
|
9157
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
|
|
9158
|
+
name: "code-block-panel-search",
|
|
9159
|
+
fn: withCtx(() => [
|
|
9160
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : createCommentVNode("", true)
|
|
9161
|
+
]),
|
|
9162
|
+
key: "5"
|
|
9163
|
+
} : void 0,
|
|
8831
9164
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
8832
9165
|
name: "layer-node-content",
|
|
8833
9166
|
fn: withCtx(({ data: nodeData }) => [
|
|
@@ -8839,7 +9172,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8839
9172
|
data: nodeData
|
|
8840
9173
|
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8841
9174
|
]),
|
|
8842
|
-
key: "
|
|
9175
|
+
key: "6"
|
|
8843
9176
|
} : void 0,
|
|
8844
9177
|
config.$key === "layer" || config.slots?.layerNodeLabel ? {
|
|
8845
9178
|
name: "layer-node-label",
|
|
@@ -8852,7 +9185,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8852
9185
|
data: nodeData
|
|
8853
9186
|
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8854
9187
|
]),
|
|
8855
|
-
key: "
|
|
9188
|
+
key: "7"
|
|
8856
9189
|
} : void 0,
|
|
8857
9190
|
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
8858
9191
|
name: "layer-node-tool",
|
|
@@ -8865,9 +9198,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8865
9198
|
data: nodeData
|
|
8866
9199
|
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8867
9200
|
]),
|
|
8868
|
-
key: "
|
|
9201
|
+
key: "8"
|
|
8869
9202
|
} : void 0,
|
|
8870
|
-
config.$key === "data-source" || config.slots?.
|
|
9203
|
+
config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
|
|
8871
9204
|
name: "data-source-panel-tool",
|
|
8872
9205
|
fn: withCtx(({ data }) => [
|
|
8873
9206
|
config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
@@ -8875,7 +9208,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8875
9208
|
data
|
|
8876
9209
|
}) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
8877
9210
|
]),
|
|
8878
|
-
key: "
|
|
9211
|
+
key: "9"
|
|
9212
|
+
} : void 0,
|
|
9213
|
+
config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
|
|
9214
|
+
name: "data-source-panel-search",
|
|
9215
|
+
fn: withCtx(() => [
|
|
9216
|
+
config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : createCommentVNode("", true)
|
|
9217
|
+
]),
|
|
9218
|
+
key: "10"
|
|
8879
9219
|
} : void 0
|
|
8880
9220
|
]), 1040)) : createCommentVNode("", true)
|
|
8881
9221
|
])), [
|
|
@@ -8886,7 +9226,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
8886
9226
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
8887
9227
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
8888
9228
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8889
|
-
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$
|
|
9229
|
+
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
8890
9230
|
key: config.$key ?? index,
|
|
8891
9231
|
visible: unref(floatBoxStates)[config.$key].status,
|
|
8892
9232
|
"onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -9255,15 +9595,21 @@ const state = reactive({
|
|
|
9255
9595
|
showRule: true,
|
|
9256
9596
|
propsPanelSize: "small",
|
|
9257
9597
|
showAddPageButton: true,
|
|
9258
|
-
|
|
9259
|
-
|
|
9598
|
+
hideSlideBar: false,
|
|
9599
|
+
navMenuRect: {
|
|
9600
|
+
left: 0,
|
|
9601
|
+
top: 0,
|
|
9602
|
+
width: 0,
|
|
9603
|
+
height: 0
|
|
9604
|
+
}
|
|
9260
9605
|
});
|
|
9606
|
+
const canUsePluginMethods$2 = {
|
|
9607
|
+
async: ["zoom", "calcZoom"],
|
|
9608
|
+
sync: []
|
|
9609
|
+
};
|
|
9261
9610
|
class Ui extends BaseService {
|
|
9262
9611
|
constructor() {
|
|
9263
|
-
super(
|
|
9264
|
-
{ name: "zoom", isAsync: true },
|
|
9265
|
-
{ name: "calcZoom", isAsync: true }
|
|
9266
|
-
]);
|
|
9612
|
+
super(canUsePluginMethods$2.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
9267
9613
|
}
|
|
9268
9614
|
set(name, value) {
|
|
9269
9615
|
const mask = editorService.get("stage")?.mask;
|
|
@@ -9301,19 +9647,6 @@ class Ui extends BaseService {
|
|
|
9301
9647
|
}
|
|
9302
9648
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
9303
9649
|
}
|
|
9304
|
-
async setFloatBox(keys) {
|
|
9305
|
-
const map = state.floatBox;
|
|
9306
|
-
for (const key of keys) {
|
|
9307
|
-
if (map.get(key))
|
|
9308
|
-
continue;
|
|
9309
|
-
map.set(key, {
|
|
9310
|
-
status: false,
|
|
9311
|
-
zIndex: 99,
|
|
9312
|
-
top: 0,
|
|
9313
|
-
left: 0
|
|
9314
|
-
});
|
|
9315
|
-
}
|
|
9316
|
-
}
|
|
9317
9650
|
resetState() {
|
|
9318
9651
|
this.set("showSrc", false);
|
|
9319
9652
|
this.set("uiSelectMode", false);
|
|
@@ -9328,6 +9661,9 @@ class Ui extends BaseService {
|
|
|
9328
9661
|
this.removeAllListeners();
|
|
9329
9662
|
this.removeAllPlugins();
|
|
9330
9663
|
}
|
|
9664
|
+
usePlugin(options) {
|
|
9665
|
+
super.usePlugin(options);
|
|
9666
|
+
}
|
|
9331
9667
|
async setStageRect(value) {
|
|
9332
9668
|
state.stageRect = {
|
|
9333
9669
|
...state.stageRect,
|
|
@@ -9519,7 +9855,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
9519
9855
|
]),
|
|
9520
9856
|
_: 1
|
|
9521
9857
|
})) : createCommentVNode("", true),
|
|
9522
|
-
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
9858
|
+
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
9523
9859
|
key: 1,
|
|
9524
9860
|
ref_key: "box",
|
|
9525
9861
|
ref: box,
|
|
@@ -10061,6 +10397,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10061
10397
|
}
|
|
10062
10398
|
});
|
|
10063
10399
|
|
|
10400
|
+
const canUsePluginMethods$1 = {
|
|
10401
|
+
async: ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"],
|
|
10402
|
+
sync: []
|
|
10403
|
+
};
|
|
10064
10404
|
class CodeBlock extends BaseService {
|
|
10065
10405
|
state = reactive({
|
|
10066
10406
|
codeDsl: null,
|
|
@@ -10070,13 +10410,7 @@ class CodeBlock extends BaseService {
|
|
|
10070
10410
|
paramsColConfig: void 0
|
|
10071
10411
|
});
|
|
10072
10412
|
constructor() {
|
|
10073
|
-
super(
|
|
10074
|
-
{ name: "setCodeDslById", isAsync: true },
|
|
10075
|
-
{ name: "setEditStatus", isAsync: true },
|
|
10076
|
-
{ name: "setCombineIds", isAsync: true },
|
|
10077
|
-
{ name: "setUndeleteableList", isAsync: true },
|
|
10078
|
-
{ name: "deleteCodeDslByIds", isAsync: true }
|
|
10079
|
-
]);
|
|
10413
|
+
super(canUsePluginMethods$1.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
10080
10414
|
}
|
|
10081
10415
|
/**
|
|
10082
10416
|
* 设置活动的代码块dsl数据源
|
|
@@ -10249,6 +10583,9 @@ class CodeBlock extends BaseService {
|
|
|
10249
10583
|
this.removeAllListeners();
|
|
10250
10584
|
this.removeAllPlugins();
|
|
10251
10585
|
}
|
|
10586
|
+
usePlugin(options) {
|
|
10587
|
+
super.usePlugin(options);
|
|
10588
|
+
}
|
|
10252
10589
|
}
|
|
10253
10590
|
const codeBlockService = new CodeBlock();
|
|
10254
10591
|
|
|
@@ -10304,10 +10641,10 @@ class Events extends BaseService {
|
|
|
10304
10641
|
});
|
|
10305
10642
|
}
|
|
10306
10643
|
setEvent(type, events) {
|
|
10307
|
-
eventMap[type] = [...DEFAULT_EVENTS, ...events];
|
|
10644
|
+
eventMap[toLine(type)] = [...DEFAULT_EVENTS, ...events];
|
|
10308
10645
|
}
|
|
10309
10646
|
getEvent(type) {
|
|
10310
|
-
return cloneDeep(eventMap[type] || DEFAULT_EVENTS);
|
|
10647
|
+
return cloneDeep(eventMap[toLine(type)] || DEFAULT_EVENTS);
|
|
10311
10648
|
}
|
|
10312
10649
|
setMethods(methods) {
|
|
10313
10650
|
Object.keys(methods).forEach((type) => {
|
|
@@ -10315,10 +10652,10 @@ class Events extends BaseService {
|
|
|
10315
10652
|
});
|
|
10316
10653
|
}
|
|
10317
10654
|
setMethod(type, method) {
|
|
10318
|
-
methodMap[type] = [...DEFAULT_METHODS, ...method];
|
|
10655
|
+
methodMap[toLine(type)] = [...DEFAULT_METHODS, ...method];
|
|
10319
10656
|
}
|
|
10320
10657
|
getMethod(type) {
|
|
10321
|
-
return cloneDeep(methodMap[type] || DEFAULT_METHODS);
|
|
10658
|
+
return cloneDeep(methodMap[toLine(type)] || DEFAULT_METHODS);
|
|
10322
10659
|
}
|
|
10323
10660
|
resetState() {
|
|
10324
10661
|
eventMap = reactive({});
|
|
@@ -10512,6 +10849,10 @@ class Keybinding extends BaseService {
|
|
|
10512
10849
|
}
|
|
10513
10850
|
const keybindingService = new Keybinding();
|
|
10514
10851
|
|
|
10852
|
+
const canUsePluginMethods = {
|
|
10853
|
+
async: [],
|
|
10854
|
+
sync: ["openOverlay", "closeOverlay", "updateOverlay", "createStage"]
|
|
10855
|
+
};
|
|
10515
10856
|
class StageOverlay extends BaseService {
|
|
10516
10857
|
state = reactive({
|
|
10517
10858
|
wrapDiv: document.createElement("div"),
|
|
@@ -10524,12 +10865,7 @@ class StageOverlay extends BaseService {
|
|
|
10524
10865
|
stageOverlayVisible: false
|
|
10525
10866
|
});
|
|
10526
10867
|
constructor() {
|
|
10527
|
-
super(
|
|
10528
|
-
{ name: "openOverlay", isAsync: false },
|
|
10529
|
-
{ name: "closeOverlay", isAsync: false },
|
|
10530
|
-
{ name: "updateOverlay", isAsync: false },
|
|
10531
|
-
{ name: "createStage", isAsync: false }
|
|
10532
|
-
]);
|
|
10868
|
+
super(canUsePluginMethods.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
10533
10869
|
this.get("wrapDiv").classList.add("tmagic-editor-sub-stage-wrap");
|
|
10534
10870
|
}
|
|
10535
10871
|
get(name) {
|
|
@@ -10596,6 +10932,9 @@ class StageOverlay extends BaseService {
|
|
|
10596
10932
|
}
|
|
10597
10933
|
});
|
|
10598
10934
|
}
|
|
10935
|
+
usePlugin(options) {
|
|
10936
|
+
super.usePlugin(options);
|
|
10937
|
+
}
|
|
10599
10938
|
createContentEl() {
|
|
10600
10939
|
const sourceEl = this.get("sourceEl");
|
|
10601
10940
|
if (!sourceEl)
|
|
@@ -11027,7 +11366,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11027
11366
|
name: "MEditor"
|
|
11028
11367
|
},
|
|
11029
11368
|
__name: "Editor",
|
|
11030
|
-
props: mergeDefaults({
|
|
11369
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
11031
11370
|
modelValue: {},
|
|
11032
11371
|
componentGroupList: {},
|
|
11033
11372
|
datasourceList: {},
|
|
@@ -11044,7 +11383,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11044
11383
|
datasourceValues: {},
|
|
11045
11384
|
datasourceConfigs: {},
|
|
11046
11385
|
datasourceEventMethodList: {},
|
|
11047
|
-
moveableOptions: { type: Function },
|
|
11386
|
+
moveableOptions: { type: [Object, Function] },
|
|
11048
11387
|
defaultSelected: {},
|
|
11049
11388
|
containerHighlightClassName: {},
|
|
11050
11389
|
containerHighlightDuration: {},
|
|
@@ -11108,13 +11447,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11108
11447
|
provide("stageOptions", stageOptions);
|
|
11109
11448
|
__expose(services);
|
|
11110
11449
|
return (_ctx, _cache) => {
|
|
11111
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11450
|
+
return openBlock(), createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11112
11451
|
header: withCtx(() => [
|
|
11113
11452
|
renderSlot(_ctx.$slots, "header")
|
|
11114
11453
|
]),
|
|
11115
11454
|
nav: withCtx(() => [
|
|
11116
11455
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
11117
|
-
createVNode(_sfc_main$
|
|
11456
|
+
createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11118
11457
|
])
|
|
11119
11458
|
]),
|
|
11120
11459
|
"content-before": withCtx(() => [
|
|
@@ -11157,9 +11496,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11157
11496
|
data
|
|
11158
11497
|
})
|
|
11159
11498
|
]),
|
|
11499
|
+
"code-block-panel-search": withCtx(() => [
|
|
11500
|
+
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
11501
|
+
]),
|
|
11160
11502
|
"data-source-panel-tool": withCtx(({ data }) => [
|
|
11161
11503
|
renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
|
|
11162
11504
|
]),
|
|
11505
|
+
"data-source-panel-search": withCtx(() => [
|
|
11506
|
+
renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
11507
|
+
]),
|
|
11163
11508
|
_: 3
|
|
11164
11509
|
}, 8, ["data", "layer-content-menu", "custom-content-menu"])
|
|
11165
11510
|
])
|
|
@@ -11183,7 +11528,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11183
11528
|
]),
|
|
11184
11529
|
"props-panel": withCtx(() => [
|
|
11185
11530
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11186
|
-
createVNode(_sfc_main$
|
|
11531
|
+
createVNode(_sfc_main$p, {
|
|
11187
11532
|
"extend-state": _ctx.extendFormState,
|
|
11188
11533
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11189
11534
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
@@ -11229,24 +11574,24 @@ const index = {
|
|
|
11229
11574
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
11230
11575
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
11231
11576
|
setConfig(option);
|
|
11232
|
-
app.component(_sfc_main.name
|
|
11233
|
-
app.component("
|
|
11577
|
+
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11578
|
+
app.component("magic-code-editor", _sfc_main$U);
|
|
11579
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11234
11580
|
app.component("m-fields-code-link", _sfc_main$S);
|
|
11235
11581
|
app.component("m-fields-vs-code", _sfc_main$T);
|
|
11236
|
-
app.component("magic-code-editor", _sfc_main$U);
|
|
11237
11582
|
app.component("m-fields-code-select", _sfc_main$R);
|
|
11238
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
11239
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11240
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
11241
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11242
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11243
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11244
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11245
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11246
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11247
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11248
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11583
|
+
app.component("m-fields-code-select-col", _sfc_main$M);
|
|
11584
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11585
|
+
app.component("m-fields-data-source-fields", _sfc_main$L);
|
|
11586
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11587
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11588
|
+
app.component("m-fields-data-source-input", _sfc_main$J);
|
|
11589
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11590
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11591
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11592
|
+
app.component("m-fields-data-source-field-select", _sfc_main$K);
|
|
11593
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11249
11594
|
}
|
|
11250
11595
|
};
|
|
11251
11596
|
|
|
11252
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
11597
|
+
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, useFloatBox, useStage, warn };
|