@tmagic/editor 1.3.16 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +25 -9
- package/dist/tmagic-editor.js +1048 -632
- package/dist/tmagic-editor.umd.cjs +1065 -647
- package/package.json +23 -21
- package/src/components/CodeBlockEditor.vue +82 -59
- package/src/components/FloatingBox.vue +71 -25
- package/src/components/SplitView.vue +46 -35
- package/src/fields/Code.vue +12 -10
- package/src/fields/CodeLink.vue +9 -9
- package/src/fields/CodeSelect.vue +7 -5
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/DataSourceFieldSelect.vue +118 -27
- package/src/fields/DataSourceFields.vue +10 -3
- package/src/fields/DataSourceInput.vue +7 -7
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +3 -3
- package/src/fields/DataSourceMocks.vue +3 -3
- package/src/fields/DataSourceSelect.vue +6 -18
- package/src/fields/EventSelect.vue +1 -1
- package/src/fields/KeyValue.vue +8 -8
- package/src/fields/PageFragmentSelect.vue +1 -1
- package/src/fields/UISelect.vue +5 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-code-block-edit.ts +1 -2
- package/src/hooks/use-editor-content-height.ts +20 -0
- package/src/hooks/use-float-box.ts +8 -8
- package/src/hooks/use-window-rect.ts +20 -0
- package/src/index.ts +2 -2
- package/src/layouts/Framework.vue +33 -34
- package/src/layouts/NavMenu.vue +21 -2
- package/src/layouts/PropsPanel.vue +35 -0
- package/src/layouts/sidebar/Sidebar.vue +18 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -0
- package/src/services/BaseService.ts +5 -2
- package/src/services/codeBlock.ts +14 -8
- package/src/services/dataSource.ts +39 -26
- package/src/services/editor.ts +46 -25
- package/src/services/events.ts +4 -4
- package/src/services/props.ts +44 -35
- package/src/services/stageOverlay.ts +16 -9
- package/src/services/storage.ts +14 -8
- package/src/services/ui.ts +26 -19
- package/src/theme/code-block.scss +0 -5
- package/src/theme/code-editor.scss +6 -0
- package/src/theme/floating-box.scss +4 -2
- package/src/theme/props-panel.scss +14 -0
- package/src/theme/sidebar.scss +6 -3
- package/src/type.ts +87 -37
- package/src/utils/operator.ts +37 -39
- package/src/utils/props.ts +174 -37
- package/types/components/CodeBlockEditor.vue.d.ts +46 -25
- package/types/components/CodeParams.vue.d.ts +5 -5
- package/types/components/ContentMenu.vue.d.ts +12 -12
- package/types/components/FloatingBox.vue.d.ts +42 -55
- package/types/components/Icon.vue.d.ts +3 -3
- package/types/components/Resizer.vue.d.ts +3 -3
- package/types/components/ScrollBar.vue.d.ts +3 -3
- package/types/components/ScrollViewer.vue.d.ts +12 -12
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/SplitView.vue.d.ts +13 -11
- package/types/components/ToolButton.vue.d.ts +13 -13
- package/types/components/Tree.vue.d.ts +24 -14
- package/types/components/TreeNode.vue.d.ts +22 -12
- package/types/fields/Code.vue.d.ts +14 -14
- package/types/fields/CodeLink.vue.d.ts +6 -10
- package/types/fields/CodeSelect.vue.d.ts +14 -14
- package/types/fields/CodeSelectCol.vue.d.ts +11 -11
- package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceFields.vue.d.ts +11 -11
- package/types/fields/DataSourceInput.vue.d.ts +14 -18
- package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceMethods.vue.d.ts +11 -11
- package/types/fields/DataSourceMocks.vue.d.ts +11 -11
- package/types/fields/DataSourceSelect.vue.d.ts +13 -26
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +14 -18
- package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
- package/types/fields/UISelect.vue.d.ts +8 -4
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/use-code-block-edit.d.ts +66 -90
- package/types/hooks/use-data-source-method.d.ts +66 -90
- package/types/hooks/use-editor-content-height.d.ts +3 -0
- package/types/hooks/use-node-status.d.ts +6 -1
- package/types/hooks/use-window-rect.d.ts +6 -0
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +1 -1
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
- package/types/icons/PinIcon.vue.d.ts +1 -1
- package/types/icons/PinnedIcon.vue.d.ts +1 -1
- package/types/layouts/AddPageBox.vue.d.ts +3 -3
- package/types/layouts/CodeEditor.vue.d.ts +12 -12
- package/types/layouts/Framework.vue.d.ts +9 -9
- package/types/layouts/NavMenu.vue.d.ts +11 -11
- package/types/layouts/PropsPanel.vue.d.ts +193 -243
- package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
- package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +13 -13
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
- package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
- package/types/services/BaseService.d.ts +5 -2
- package/types/services/codeBlock.d.ts +8 -0
- package/types/services/dataSource.d.ts +9 -2
- package/types/services/editor.d.ts +8 -1
- package/types/services/props.d.ts +15 -22
- package/types/services/stageOverlay.d.ts +9 -2
- package/types/services/storage.d.ts +8 -0
- package/types/services/ui.d.ts +20 -8
- package/types/type.d.ts +56 -32
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +2 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.
|
|
5
|
-
})(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('moveable'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', 'moveable', '@tmagic/table', '@tmagic/utils', 'gesto', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.VanillaMoveable, global.table, global.utils, global.Gesto, global.dep, global.StageCore, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, VanillaMoveable, table, utils, Gesto, dep, StageCore, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
|
|
224
224
|
const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
225
225
|
...{
|
|
226
|
-
name: "
|
|
226
|
+
name: "MFieldsVsCode"
|
|
227
227
|
},
|
|
228
228
|
__name: "Code",
|
|
229
229
|
props: {
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
|
|
264
264
|
const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
265
265
|
...{
|
|
266
|
-
name: "
|
|
266
|
+
name: "MFieldsCodeLink"
|
|
267
267
|
},
|
|
268
268
|
__name: "CodeLink",
|
|
269
269
|
props: {
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
|
|
344
344
|
const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
345
345
|
...{
|
|
346
|
-
name: "
|
|
346
|
+
name: "MFieldsCodeSelect"
|
|
347
347
|
},
|
|
348
348
|
__name: "CodeSelect",
|
|
349
349
|
props: {
|
|
@@ -459,49 +459,235 @@
|
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
|
|
462
|
+
const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
463
|
+
__name: "FloatingBox",
|
|
464
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
465
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
466
|
+
title: { default: "" },
|
|
467
|
+
beforeClose: {}
|
|
468
|
+
}, {
|
|
469
|
+
"width": { default: 0 },
|
|
470
|
+
"widthModifiers": {},
|
|
471
|
+
"height": { default: 0 },
|
|
472
|
+
"heightModifiers": {},
|
|
473
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
474
|
+
"visibleModifiers": {}
|
|
475
|
+
}),
|
|
476
|
+
emits: ["update:width", "update:height", "update:visible"],
|
|
477
|
+
setup(__props, { expose: __expose }) {
|
|
478
|
+
const width = vue.useModel(__props, "width");
|
|
479
|
+
const height = vue.useModel(__props, "height");
|
|
480
|
+
const visible = vue.useModel(__props, "visible");
|
|
481
|
+
const props = __props;
|
|
482
|
+
const target = vue.ref();
|
|
483
|
+
const titleEl = vue.ref();
|
|
484
|
+
const zIndex = design.useZIndex();
|
|
485
|
+
const curZIndex = vue.ref(zIndex.nextZIndex());
|
|
486
|
+
const titleHeight = vue.ref(0);
|
|
487
|
+
const bodyHeight = vue.computed(() => {
|
|
488
|
+
if (height.value) {
|
|
489
|
+
return height.value - titleHeight.value;
|
|
490
|
+
}
|
|
491
|
+
if (target.value) {
|
|
492
|
+
return target.value.clientHeight - titleHeight.value;
|
|
493
|
+
}
|
|
494
|
+
return "auto";
|
|
495
|
+
});
|
|
496
|
+
const style = vue.computed(() => ({
|
|
497
|
+
left: `${props.position.left}px`,
|
|
498
|
+
top: `${props.position.top}px`,
|
|
499
|
+
width: width.value ? `${width.value}px` : "auto",
|
|
500
|
+
height: height.value ? `${height.value}px` : "auto"
|
|
501
|
+
}));
|
|
502
|
+
let moveable = null;
|
|
503
|
+
const initMoveable = () => {
|
|
504
|
+
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
505
|
+
className: "m-editor-floating-box-moveable",
|
|
506
|
+
target: target.value,
|
|
507
|
+
draggable: true,
|
|
508
|
+
resizable: true,
|
|
509
|
+
edge: true,
|
|
510
|
+
keepRatio: false,
|
|
511
|
+
origin: false,
|
|
512
|
+
snappable: true,
|
|
513
|
+
dragTarget: titleEl.value,
|
|
514
|
+
dragTargetSelf: false,
|
|
515
|
+
linePadding: 10,
|
|
516
|
+
controlPadding: 10,
|
|
517
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
518
|
+
});
|
|
519
|
+
moveable.on("drag", (e) => {
|
|
520
|
+
e.target.style.transform = e.transform;
|
|
521
|
+
});
|
|
522
|
+
moveable.on("resize", (e) => {
|
|
523
|
+
width.value = e.width;
|
|
524
|
+
height.value = e.height;
|
|
525
|
+
e.target.style.width = `${e.width}px`;
|
|
526
|
+
e.target.style.height = `${e.height}px`;
|
|
527
|
+
e.target.style.transform = e.drag.transform;
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
const destroyMoveable = () => {
|
|
531
|
+
moveable?.destroy();
|
|
532
|
+
moveable = null;
|
|
533
|
+
};
|
|
534
|
+
vue.watch(
|
|
535
|
+
visible,
|
|
536
|
+
async (visible2) => {
|
|
537
|
+
if (visible2) {
|
|
538
|
+
await vue.nextTick();
|
|
539
|
+
const targetRect = target.value?.getBoundingClientRect();
|
|
540
|
+
if (targetRect) {
|
|
541
|
+
width.value = targetRect.width;
|
|
542
|
+
height.value = targetRect.height;
|
|
543
|
+
initMoveable();
|
|
544
|
+
}
|
|
545
|
+
if (titleEl.value) {
|
|
546
|
+
const titleRect = titleEl.value.getBoundingClientRect();
|
|
547
|
+
titleHeight.value = titleRect.height;
|
|
548
|
+
}
|
|
549
|
+
} else {
|
|
550
|
+
destroyMoveable();
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
immediate: true
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
vue.onBeforeUnmount(() => {
|
|
558
|
+
destroyMoveable();
|
|
559
|
+
});
|
|
560
|
+
const hide = (cancel) => {
|
|
561
|
+
if (cancel !== false) {
|
|
562
|
+
visible.value = false;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
const closeHandler = () => {
|
|
566
|
+
if (typeof props.beforeClose === "function") {
|
|
567
|
+
props.beforeClose(hide);
|
|
568
|
+
} else {
|
|
569
|
+
hide();
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
const nextZIndex = () => {
|
|
573
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
574
|
+
};
|
|
575
|
+
__expose({
|
|
576
|
+
bodyHeight,
|
|
577
|
+
target,
|
|
578
|
+
titleEl
|
|
579
|
+
});
|
|
580
|
+
return (_ctx, _cache) => {
|
|
581
|
+
return visible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
582
|
+
key: 0,
|
|
583
|
+
to: "body"
|
|
584
|
+
}, [
|
|
585
|
+
vue.createElementVNode("div", {
|
|
586
|
+
ref_key: "target",
|
|
587
|
+
ref: target,
|
|
588
|
+
class: "m-editor-float-box",
|
|
589
|
+
style: vue.normalizeStyle({ ...style.value, zIndex: curZIndex.value }),
|
|
590
|
+
onMousedown: nextZIndex
|
|
591
|
+
}, [
|
|
592
|
+
vue.createElementVNode("div", {
|
|
593
|
+
ref_key: "titleEl",
|
|
594
|
+
ref: titleEl,
|
|
595
|
+
class: "m-editor-float-box-title"
|
|
596
|
+
}, [
|
|
597
|
+
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
598
|
+
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
|
|
599
|
+
]),
|
|
600
|
+
vue.createElementVNode("div", null, [
|
|
601
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
602
|
+
link: "",
|
|
603
|
+
size: "small",
|
|
604
|
+
icon: vue.unref(iconsVue.Close),
|
|
605
|
+
onClick: closeHandler
|
|
606
|
+
}, null, 8, ["icon"])
|
|
607
|
+
])
|
|
608
|
+
], 512),
|
|
609
|
+
vue.createElementVNode("div", {
|
|
610
|
+
class: "m-editor-float-box-body",
|
|
611
|
+
style: vue.normalizeStyle({ height: `${bodyHeight.value}px` })
|
|
612
|
+
}, [
|
|
613
|
+
vue.renderSlot(_ctx.$slots, "body")
|
|
614
|
+
], 4)
|
|
615
|
+
], 36)
|
|
616
|
+
])) : vue.createCommentVNode("", true);
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
const useEditorContentHeight = () => {
|
|
622
|
+
const services = vue.inject("services");
|
|
623
|
+
const frameworkHeight = vue.computed(() => services?.uiService.get("frameworkRect").height || 0);
|
|
624
|
+
const navMenuHeight = vue.computed(() => services?.uiService.get("navMenuRect").height || 0);
|
|
625
|
+
const editorContentHeight = vue.computed(() => frameworkHeight.value - navMenuHeight.value);
|
|
626
|
+
const height = vue.ref(0);
|
|
627
|
+
vue.watchEffect(() => {
|
|
628
|
+
if (height.value > 0)
|
|
629
|
+
return;
|
|
630
|
+
height.value = editorContentHeight.value;
|
|
631
|
+
});
|
|
632
|
+
return {
|
|
633
|
+
height
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
const useWindowRect = () => {
|
|
638
|
+
const rect = vue.reactive({ width: globalThis.innerWidth, height: globalThis.innerHeight });
|
|
639
|
+
const windowResizeHandler = () => {
|
|
640
|
+
rect.width = globalThis.innerWidth;
|
|
641
|
+
rect.height = globalThis.innerHeight;
|
|
642
|
+
};
|
|
643
|
+
globalThis.addEventListener("resize", windowResizeHandler);
|
|
644
|
+
vue.onBeforeUnmount(() => {
|
|
645
|
+
globalThis.removeEventListener("resize", windowResizeHandler);
|
|
646
|
+
});
|
|
647
|
+
return {
|
|
648
|
+
rect
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
|
|
462
652
|
const _hoisted_1$s = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
463
653
|
const _hoisted_2$k = { style: { "flex": "1" } };
|
|
464
654
|
const _hoisted_3$8 = { style: { "flex": "1" } };
|
|
465
655
|
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
466
|
-
const _sfc_main$
|
|
656
|
+
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
467
657
|
...{
|
|
468
658
|
name: "MEditorCodeBlockEditor"
|
|
469
659
|
},
|
|
470
660
|
__name: "CodeBlockEditor",
|
|
471
|
-
props: {
|
|
661
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
472
662
|
content: {},
|
|
473
663
|
disabled: { type: Boolean },
|
|
474
664
|
isDataSource: { type: Boolean },
|
|
475
665
|
dataSourceType: {},
|
|
476
666
|
slideType: {}
|
|
477
|
-
},
|
|
478
|
-
|
|
667
|
+
}, {
|
|
668
|
+
"width": { default: 670 },
|
|
669
|
+
"widthModifiers": {},
|
|
670
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
671
|
+
"visibleModifiers": {}
|
|
672
|
+
}),
|
|
673
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:width", "update:visible"]),
|
|
479
674
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
675
|
+
const width = vue.useModel(__props, "width");
|
|
676
|
+
const boxVisible = vue.useModel(__props, "visible");
|
|
480
677
|
const props = __props;
|
|
481
678
|
const emit = __emit;
|
|
482
679
|
const services = vue.inject("services");
|
|
680
|
+
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
483
681
|
const difVisible = vue.ref(false);
|
|
484
|
-
const
|
|
485
|
-
const windowReizehandler = () => {
|
|
486
|
-
height.value = globalThis.innerHeight;
|
|
487
|
-
};
|
|
488
|
-
globalThis.addEventListener("resize", windowReizehandler);
|
|
489
|
-
vue.onBeforeUnmount(() => {
|
|
490
|
-
globalThis.removeEventListener("resize", windowReizehandler);
|
|
491
|
-
});
|
|
682
|
+
const { rect: windowRect } = useWindowRect();
|
|
492
683
|
const magicVsEditor = vue.ref();
|
|
493
684
|
const diffChange = () => {
|
|
494
|
-
if (!magicVsEditor.value || !
|
|
685
|
+
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
495
686
|
return;
|
|
496
687
|
}
|
|
497
|
-
|
|
688
|
+
formBox.value.form.values.content = magicVsEditor.value.getEditorValue();
|
|
498
689
|
difVisible.value = false;
|
|
499
690
|
};
|
|
500
|
-
const columnWidth = vue.computed(() => services?.uiService.get("columnWidth"));
|
|
501
|
-
const size = vue.computed(
|
|
502
|
-
() => columnWidth.value ? columnWidth.value.center + columnWidth.value.right - (props.isDataSource ? 100 : 0) : 600
|
|
503
|
-
);
|
|
504
|
-
const codeEditorHeight = vue.ref("600px");
|
|
505
691
|
const defaultParamColConfig = {
|
|
506
692
|
type: "row",
|
|
507
693
|
label: "参数类型",
|
|
@@ -584,7 +770,7 @@
|
|
|
584
770
|
name: "content",
|
|
585
771
|
type: "vs-code",
|
|
586
772
|
options: vue.inject("codeOptions", {}),
|
|
587
|
-
height:
|
|
773
|
+
height: "500px",
|
|
588
774
|
onChange: (formState, code) => {
|
|
589
775
|
try {
|
|
590
776
|
getConfig("parseDSL")(code);
|
|
@@ -597,26 +783,20 @@
|
|
|
597
783
|
}
|
|
598
784
|
]);
|
|
599
785
|
const submitForm = (values) => {
|
|
786
|
+
changedValue.value = void 0;
|
|
600
787
|
emit("submit", values);
|
|
601
788
|
};
|
|
602
789
|
const errorHandler = (error) => {
|
|
603
790
|
design.tMagicMessage.error(error.message);
|
|
604
791
|
};
|
|
605
|
-
const
|
|
606
|
-
const openHandler = () => {
|
|
607
|
-
setTimeout(() => {
|
|
608
|
-
if (fomDrawer.value) {
|
|
609
|
-
const height2 = fomDrawer.value?.bodyHeight - 348 - (props.isDataSource ? 50 : 0);
|
|
610
|
-
codeEditorHeight.value = `${height2 > 100 ? height2 : 600}px`;
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
};
|
|
792
|
+
const formBox = vue.ref();
|
|
614
793
|
const changedValue = vue.ref();
|
|
615
794
|
const changeHandler = (values) => {
|
|
616
795
|
changedValue.value = values;
|
|
617
796
|
};
|
|
618
797
|
const beforeClose = (done) => {
|
|
619
798
|
if (!changedValue.value) {
|
|
799
|
+
editVisible.value = false;
|
|
620
800
|
done();
|
|
621
801
|
return;
|
|
622
802
|
}
|
|
@@ -627,59 +807,106 @@
|
|
|
627
807
|
distinguishCancelAndClose: true
|
|
628
808
|
}).then(() => {
|
|
629
809
|
changedValue.value && submitForm(changedValue.value);
|
|
810
|
+
editVisible.value = false;
|
|
630
811
|
done();
|
|
631
812
|
}).catch((action) => {
|
|
632
|
-
|
|
813
|
+
if (action === "cancel") {
|
|
814
|
+
editVisible.value = false;
|
|
815
|
+
}
|
|
816
|
+
done(action === "cancel");
|
|
633
817
|
});
|
|
634
818
|
};
|
|
635
819
|
const closedHandler = () => {
|
|
636
820
|
changedValue.value = void 0;
|
|
637
821
|
};
|
|
822
|
+
const editVisible = vue.ref(false);
|
|
823
|
+
const floatingBoxBody = vue.ref();
|
|
824
|
+
const boxPosition = vue.computed(() => {
|
|
825
|
+
const columnWidth = services?.uiService?.get("columnWidth");
|
|
826
|
+
const navMenuRect = services?.uiService?.get("navMenuRect");
|
|
827
|
+
return {
|
|
828
|
+
left: columnWidth?.left ?? 0,
|
|
829
|
+
top: (navMenuRect?.top ?? 0) + (navMenuRect?.height ?? 0)
|
|
830
|
+
};
|
|
831
|
+
});
|
|
638
832
|
__expose({
|
|
639
|
-
show() {
|
|
640
|
-
|
|
833
|
+
async show() {
|
|
834
|
+
if (props.slideType !== "box") {
|
|
835
|
+
boxVisible.value = true;
|
|
836
|
+
await vue.nextTick();
|
|
837
|
+
}
|
|
838
|
+
editVisible.value = true;
|
|
641
839
|
},
|
|
642
|
-
hide() {
|
|
643
|
-
|
|
840
|
+
async hide() {
|
|
841
|
+
editVisible.value = false;
|
|
842
|
+
if (props.slideType !== "box") {
|
|
843
|
+
await vue.nextTick();
|
|
844
|
+
boxVisible.value = false;
|
|
845
|
+
}
|
|
644
846
|
}
|
|
645
847
|
});
|
|
646
848
|
return (_ctx, _cache) => {
|
|
647
849
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
"
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
disabled: _ctx.disabled,
|
|
659
|
-
"before-close": beforeClose,
|
|
660
|
-
onChange: changeHandler,
|
|
661
|
-
onSubmit: submitForm,
|
|
662
|
-
onError: errorHandler,
|
|
663
|
-
onOpen: openHandler,
|
|
664
|
-
onClosed: closedHandler
|
|
850
|
+
vue.createVNode(_sfc_main$Q, {
|
|
851
|
+
visible: boxVisible.value,
|
|
852
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
853
|
+
width: width.value,
|
|
854
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
855
|
+
height: vue.unref(codeBlockEditorHeight),
|
|
856
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => vue.isRef(codeBlockEditorHeight) ? codeBlockEditorHeight.value = $event : null),
|
|
857
|
+
title: _ctx.content.name ? `${_ctx.disabled ? "查看" : "编辑"}${_ctx.content.name}` : "新增代码",
|
|
858
|
+
position: boxPosition.value,
|
|
859
|
+
"before-close": beforeClose
|
|
665
860
|
}, {
|
|
666
|
-
|
|
667
|
-
vue.
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
},
|
|
672
|
-
default: vue.withCtx(() => [
|
|
673
|
-
vue.createTextVNode("查看修改")
|
|
674
|
-
]),
|
|
675
|
-
_: 1
|
|
676
|
-
})
|
|
861
|
+
body: vue.withCtx(() => [
|
|
862
|
+
vue.createElementVNode("div", {
|
|
863
|
+
ref_key: "floatingBoxBody",
|
|
864
|
+
ref: floatingBoxBody,
|
|
865
|
+
style: { "height": "100%" }
|
|
866
|
+
}, null, 512)
|
|
677
867
|
]),
|
|
678
868
|
_: 1
|
|
679
|
-
},
|
|
869
|
+
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
870
|
+
editVisible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
871
|
+
key: 0,
|
|
872
|
+
to: floatingBoxBody.value,
|
|
873
|
+
disabled: _ctx.slideType === "box"
|
|
874
|
+
}, [
|
|
875
|
+
vue.createVNode(vue.unref(form.MFormBox), {
|
|
876
|
+
class: "m-editor-code-block-editor",
|
|
877
|
+
ref_key: "formBox",
|
|
878
|
+
ref: formBox,
|
|
879
|
+
"label-width": "80px",
|
|
880
|
+
"close-on-press-escape": false,
|
|
881
|
+
title: _ctx.content.name,
|
|
882
|
+
config: functionConfig.value,
|
|
883
|
+
values: _ctx.content,
|
|
884
|
+
disabled: _ctx.disabled,
|
|
885
|
+
height: floatingBoxBody.value?.clientHeight,
|
|
886
|
+
onChange: changeHandler,
|
|
887
|
+
onSubmit: submitForm,
|
|
888
|
+
onError: errorHandler,
|
|
889
|
+
onClosed: closedHandler
|
|
890
|
+
}, {
|
|
891
|
+
left: vue.withCtx(() => [
|
|
892
|
+
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
893
|
+
key: 0,
|
|
894
|
+
type: "primary",
|
|
895
|
+
link: "",
|
|
896
|
+
onClick: _cache[3] || (_cache[3] = ($event) => difVisible.value = true)
|
|
897
|
+
}, {
|
|
898
|
+
default: vue.withCtx(() => [
|
|
899
|
+
vue.createTextVNode("查看修改")
|
|
900
|
+
]),
|
|
901
|
+
_: 1
|
|
902
|
+
})) : vue.createCommentVNode("", true)
|
|
903
|
+
]),
|
|
904
|
+
_: 1
|
|
905
|
+
}, 8, ["title", "config", "values", "disabled", "height"])
|
|
906
|
+
], 8, ["to", "disabled"])) : vue.createCommentVNode("", true),
|
|
680
907
|
vue.createVNode(vue.unref(design.TMagicDialog), {
|
|
681
908
|
modelValue: difVisible.value,
|
|
682
|
-
"onUpdate:modelValue": _cache[
|
|
909
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => difVisible.value = $event),
|
|
683
910
|
title: "查看修改",
|
|
684
911
|
fullscreen: ""
|
|
685
912
|
}, {
|
|
@@ -687,7 +914,7 @@
|
|
|
687
914
|
vue.createElementVNode("span", _hoisted_4$7, [
|
|
688
915
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
689
916
|
size: "small",
|
|
690
|
-
onClick: _cache[
|
|
917
|
+
onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
|
|
691
918
|
}, {
|
|
692
919
|
default: vue.withCtx(() => [
|
|
693
920
|
vue.createTextVNode("取消")
|
|
@@ -738,8 +965,8 @@
|
|
|
738
965
|
type: "diff",
|
|
739
966
|
language: "json",
|
|
740
967
|
initValues: _ctx.content.content,
|
|
741
|
-
modifiedValues:
|
|
742
|
-
style: vue.normalizeStyle(`height: ${height
|
|
968
|
+
modifiedValues: formBox.value?.form?.values.content,
|
|
969
|
+
style: vue.normalizeStyle(`height: ${vue.unref(windowRect).height - 150}px`)
|
|
743
970
|
}, null, 8, ["initValues", "modifiedValues", "style"])) : vue.createCommentVNode("", true)
|
|
744
971
|
]),
|
|
745
972
|
_: 1
|
|
@@ -1146,6 +1373,9 @@
|
|
|
1146
1373
|
});
|
|
1147
1374
|
});
|
|
1148
1375
|
}
|
|
1376
|
+
/**
|
|
1377
|
+
* @deprecated 请使用usePlugin代替
|
|
1378
|
+
*/
|
|
1149
1379
|
use(options) {
|
|
1150
1380
|
Object.entries(options).forEach(([methodName2, method]) => {
|
|
1151
1381
|
if (typeof method === "function")
|
|
@@ -1177,6 +1407,23 @@
|
|
|
1177
1407
|
}
|
|
1178
1408
|
}
|
|
1179
1409
|
|
|
1410
|
+
const canUsePluginMethods$6 = {
|
|
1411
|
+
async: [],
|
|
1412
|
+
sync: [
|
|
1413
|
+
"getFormConfig",
|
|
1414
|
+
"setFormConfig",
|
|
1415
|
+
"getFormValue",
|
|
1416
|
+
"setFormValue",
|
|
1417
|
+
"getFormEvent",
|
|
1418
|
+
"setFormEvent",
|
|
1419
|
+
"getFormMethod",
|
|
1420
|
+
"setFormMethod",
|
|
1421
|
+
"add",
|
|
1422
|
+
"update",
|
|
1423
|
+
"remove",
|
|
1424
|
+
"createId"
|
|
1425
|
+
]
|
|
1426
|
+
};
|
|
1180
1427
|
class DataSource extends BaseService {
|
|
1181
1428
|
state = vue.reactive({
|
|
1182
1429
|
datasourceTypeList: [],
|
|
@@ -1188,20 +1435,7 @@
|
|
|
1188
1435
|
methods: {}
|
|
1189
1436
|
});
|
|
1190
1437
|
constructor() {
|
|
1191
|
-
super(
|
|
1192
|
-
{ name: "getFormConfig", isAsync: false },
|
|
1193
|
-
{ name: "setFormConfig", isAsync: false },
|
|
1194
|
-
{ name: "getFormValue", isAsync: false },
|
|
1195
|
-
{ name: "setFormValue", isAsync: false },
|
|
1196
|
-
{ name: "getFormEvent", isAsync: false },
|
|
1197
|
-
{ name: "setFormEvent", isAsync: false },
|
|
1198
|
-
{ name: "getFormMethod", isAsync: false },
|
|
1199
|
-
{ name: "setFormMethod", isAsync: false },
|
|
1200
|
-
{ name: "add", isAsync: false },
|
|
1201
|
-
{ name: "update", isAsync: false },
|
|
1202
|
-
{ name: "remove", isAsync: false },
|
|
1203
|
-
{ name: "createId", isAsync: false }
|
|
1204
|
-
]);
|
|
1438
|
+
super(canUsePluginMethods$6.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
1205
1439
|
}
|
|
1206
1440
|
set(name, value) {
|
|
1207
1441
|
this.state[name] = value;
|
|
@@ -1210,28 +1444,28 @@
|
|
|
1210
1444
|
return this.state[name];
|
|
1211
1445
|
}
|
|
1212
1446
|
getFormConfig(type = "base") {
|
|
1213
|
-
return getFormConfig(type, this.get("configs"));
|
|
1447
|
+
return getFormConfig(utils.toLine(type), this.get("configs"));
|
|
1214
1448
|
}
|
|
1215
1449
|
setFormConfig(type, config) {
|
|
1216
|
-
this.get("configs")[type] = config;
|
|
1450
|
+
this.get("configs")[utils.toLine(type)] = config;
|
|
1217
1451
|
}
|
|
1218
1452
|
getFormValue(type = "base") {
|
|
1219
|
-
return getFormValue(type, this.get("values")[type]);
|
|
1453
|
+
return getFormValue(utils.toLine(type), this.get("values")[type]);
|
|
1220
1454
|
}
|
|
1221
1455
|
setFormValue(type, value) {
|
|
1222
|
-
this.get("values")[type] = value;
|
|
1456
|
+
this.get("values")[utils.toLine(type)] = value;
|
|
1223
1457
|
}
|
|
1224
1458
|
getFormEvent(type = "base") {
|
|
1225
|
-
return this.get("events")[type] || [];
|
|
1459
|
+
return this.get("events")[utils.toLine(type)] || [];
|
|
1226
1460
|
}
|
|
1227
1461
|
setFormEvent(type, value = []) {
|
|
1228
|
-
this.get("events")[type] = value;
|
|
1462
|
+
this.get("events")[utils.toLine(type)] = value;
|
|
1229
1463
|
}
|
|
1230
1464
|
getFormMethod(type = "base") {
|
|
1231
|
-
return this.get("methods")[type] || [];
|
|
1465
|
+
return this.get("methods")[utils.toLine(type)] || [];
|
|
1232
1466
|
}
|
|
1233
1467
|
setFormMethod(type, value = []) {
|
|
1234
|
-
this.get("methods")[type] = value;
|
|
1468
|
+
this.get("methods")[utils.toLine(type)] = value;
|
|
1235
1469
|
}
|
|
1236
1470
|
add(config) {
|
|
1237
1471
|
const newConfig = {
|
|
@@ -1255,6 +1489,9 @@
|
|
|
1255
1489
|
dataSources.splice(index, 1);
|
|
1256
1490
|
this.emit("remove", id);
|
|
1257
1491
|
}
|
|
1492
|
+
createId() {
|
|
1493
|
+
return `ds_${utils.guid()}`;
|
|
1494
|
+
}
|
|
1258
1495
|
getDataSourceById(id) {
|
|
1259
1496
|
return this.get("dataSources").find((ds) => ds.id === id);
|
|
1260
1497
|
}
|
|
@@ -1266,8 +1503,8 @@
|
|
|
1266
1503
|
this.resetState();
|
|
1267
1504
|
this.removeAllPlugins();
|
|
1268
1505
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1506
|
+
usePlugin(options) {
|
|
1507
|
+
super.usePlugin(options);
|
|
1271
1508
|
}
|
|
1272
1509
|
}
|
|
1273
1510
|
const dataSourceService = new DataSource();
|
|
@@ -1290,7 +1527,6 @@
|
|
|
1290
1527
|
];
|
|
1291
1528
|
const styleTabConfig = {
|
|
1292
1529
|
title: "样式",
|
|
1293
|
-
labelWidth: "80px",
|
|
1294
1530
|
items: [
|
|
1295
1531
|
{
|
|
1296
1532
|
name: "style",
|
|
@@ -1300,29 +1536,58 @@
|
|
|
1300
1536
|
legend: "位置",
|
|
1301
1537
|
items: [
|
|
1302
1538
|
{
|
|
1539
|
+
type: "data-source-field-select",
|
|
1303
1540
|
name: "position",
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1541
|
+
text: "固定定位",
|
|
1542
|
+
checkStrictly: false,
|
|
1543
|
+
dataSourceFieldType: ["string"],
|
|
1544
|
+
fieldConfig: {
|
|
1545
|
+
type: "checkbox",
|
|
1546
|
+
activeValue: "fixed",
|
|
1547
|
+
inactiveValue: "absolute",
|
|
1548
|
+
defaultValue: "absolute"
|
|
1549
|
+
}
|
|
1309
1550
|
},
|
|
1310
1551
|
{
|
|
1552
|
+
type: "data-source-field-select",
|
|
1311
1553
|
name: "left",
|
|
1312
|
-
text: "left"
|
|
1554
|
+
text: "left",
|
|
1555
|
+
checkStrictly: false,
|
|
1556
|
+
dataSourceFieldType: ["string", "number"],
|
|
1557
|
+
fieldConfig: {
|
|
1558
|
+
type: "text"
|
|
1559
|
+
}
|
|
1313
1560
|
},
|
|
1314
1561
|
{
|
|
1562
|
+
type: "data-source-field-select",
|
|
1315
1563
|
name: "top",
|
|
1316
1564
|
text: "top",
|
|
1565
|
+
checkStrictly: false,
|
|
1566
|
+
dataSourceFieldType: ["string", "number"],
|
|
1567
|
+
fieldConfig: {
|
|
1568
|
+
type: "text"
|
|
1569
|
+
},
|
|
1317
1570
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
|
|
1318
1571
|
},
|
|
1319
1572
|
{
|
|
1573
|
+
type: "data-source-field-select",
|
|
1320
1574
|
name: "right",
|
|
1321
|
-
text: "right"
|
|
1575
|
+
text: "right",
|
|
1576
|
+
checkStrictly: false,
|
|
1577
|
+
dataSourceFieldType: ["string", "number"],
|
|
1578
|
+
fieldConfig: {
|
|
1579
|
+
type: "text"
|
|
1580
|
+
}
|
|
1322
1581
|
},
|
|
1323
1582
|
{
|
|
1583
|
+
type: "data-source-field-select",
|
|
1324
1584
|
name: "bottom",
|
|
1325
1585
|
text: "bottom",
|
|
1586
|
+
checkStrictly: false,
|
|
1587
|
+
dataSourceFieldType: ["string", "number"],
|
|
1588
|
+
fieldConfig: {
|
|
1589
|
+
type: "text"
|
|
1590
|
+
},
|
|
1326
1591
|
disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
|
|
1327
1592
|
}
|
|
1328
1593
|
]
|
|
@@ -1332,12 +1597,42 @@
|
|
|
1332
1597
|
legend: "盒子",
|
|
1333
1598
|
items: [
|
|
1334
1599
|
{
|
|
1600
|
+
type: "data-source-field-select",
|
|
1335
1601
|
name: "width",
|
|
1336
|
-
text: "宽度"
|
|
1602
|
+
text: "宽度",
|
|
1603
|
+
checkStrictly: false,
|
|
1604
|
+
dataSourceFieldType: ["string", "number"],
|
|
1605
|
+
fieldConfig: {
|
|
1606
|
+
type: "text"
|
|
1607
|
+
}
|
|
1337
1608
|
},
|
|
1338
1609
|
{
|
|
1610
|
+
type: "data-source-field-select",
|
|
1339
1611
|
name: "height",
|
|
1340
|
-
text: "高度"
|
|
1612
|
+
text: "高度",
|
|
1613
|
+
checkStrictly: false,
|
|
1614
|
+
dataSourceFieldType: ["string", "number"],
|
|
1615
|
+
fieldConfig: {
|
|
1616
|
+
type: "text"
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
type: "data-source-field-select",
|
|
1621
|
+
text: "overflow",
|
|
1622
|
+
name: "overflow",
|
|
1623
|
+
checkStrictly: false,
|
|
1624
|
+
dataSourceFieldType: ["string"],
|
|
1625
|
+
fieldConfig: {
|
|
1626
|
+
type: "select",
|
|
1627
|
+
options: [
|
|
1628
|
+
{ text: "visible", value: "visible" },
|
|
1629
|
+
{ text: "hidden", value: "hidden" },
|
|
1630
|
+
{ text: "clip", value: "clip" },
|
|
1631
|
+
{ text: "scroll", value: "scroll" },
|
|
1632
|
+
{ text: "auto", value: "auto" },
|
|
1633
|
+
{ text: "overlay", value: "overlay" }
|
|
1634
|
+
]
|
|
1635
|
+
}
|
|
1341
1636
|
}
|
|
1342
1637
|
]
|
|
1343
1638
|
},
|
|
@@ -1346,32 +1641,48 @@
|
|
|
1346
1641
|
legend: "边框",
|
|
1347
1642
|
items: [
|
|
1348
1643
|
{
|
|
1644
|
+
type: "data-source-field-select",
|
|
1349
1645
|
name: "borderWidth",
|
|
1350
1646
|
text: "宽度",
|
|
1351
|
-
defaultValue: "0"
|
|
1647
|
+
defaultValue: "0",
|
|
1648
|
+
checkStrictly: false,
|
|
1649
|
+
dataSourceFieldType: ["string", "number"],
|
|
1650
|
+
fieldConfig: {
|
|
1651
|
+
type: "text"
|
|
1652
|
+
}
|
|
1352
1653
|
},
|
|
1353
1654
|
{
|
|
1655
|
+
type: "data-source-field-select",
|
|
1354
1656
|
name: "borderColor",
|
|
1355
1657
|
text: "颜色",
|
|
1356
|
-
|
|
1658
|
+
checkStrictly: false,
|
|
1659
|
+
dataSourceFieldType: ["string"],
|
|
1660
|
+
fieldConfig: {
|
|
1661
|
+
type: "text"
|
|
1662
|
+
}
|
|
1357
1663
|
},
|
|
1358
1664
|
{
|
|
1665
|
+
type: "data-source-field-select",
|
|
1359
1666
|
name: "borderStyle",
|
|
1360
1667
|
text: "样式",
|
|
1361
|
-
type: "select",
|
|
1362
1668
|
defaultValue: "none",
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1669
|
+
checkStrictly: false,
|
|
1670
|
+
dataSourceFieldType: ["string"],
|
|
1671
|
+
fieldConfig: {
|
|
1672
|
+
type: "select",
|
|
1673
|
+
options: [
|
|
1674
|
+
{ text: "none", value: "none" },
|
|
1675
|
+
{ text: "hidden", value: "hidden" },
|
|
1676
|
+
{ text: "dotted", value: "dotted" },
|
|
1677
|
+
{ text: "dashed", value: "dashed" },
|
|
1678
|
+
{ text: "solid", value: "solid" },
|
|
1679
|
+
{ text: "double", value: "double" },
|
|
1680
|
+
{ text: "groove", value: "groove" },
|
|
1681
|
+
{ text: "ridge", value: "ridge" },
|
|
1682
|
+
{ text: "inset", value: "inset" },
|
|
1683
|
+
{ text: "outset", value: "outset" }
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1375
1686
|
}
|
|
1376
1687
|
]
|
|
1377
1688
|
},
|
|
@@ -1380,31 +1691,53 @@
|
|
|
1380
1691
|
legend: "背景",
|
|
1381
1692
|
items: [
|
|
1382
1693
|
{
|
|
1694
|
+
type: "data-source-field-select",
|
|
1383
1695
|
name: "backgroundImage",
|
|
1384
|
-
text: "背景图"
|
|
1696
|
+
text: "背景图",
|
|
1697
|
+
checkStrictly: false,
|
|
1698
|
+
dataSourceFieldType: ["string"],
|
|
1699
|
+
fieldConfig: {
|
|
1700
|
+
type: "text"
|
|
1701
|
+
}
|
|
1385
1702
|
},
|
|
1386
1703
|
{
|
|
1704
|
+
type: "data-source-field-select",
|
|
1387
1705
|
name: "backgroundColor",
|
|
1388
1706
|
text: "背景颜色",
|
|
1389
|
-
|
|
1707
|
+
checkStrictly: false,
|
|
1708
|
+
dataSourceFieldType: ["string"],
|
|
1709
|
+
fieldConfig: {
|
|
1710
|
+
type: "colorPicker"
|
|
1711
|
+
}
|
|
1390
1712
|
},
|
|
1391
1713
|
{
|
|
1714
|
+
type: "data-source-field-select",
|
|
1392
1715
|
name: "backgroundRepeat",
|
|
1393
1716
|
text: "背景图重复",
|
|
1394
|
-
type: "select",
|
|
1395
1717
|
defaultValue: "no-repeat",
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1718
|
+
checkStrictly: false,
|
|
1719
|
+
dataSourceFieldType: ["string"],
|
|
1720
|
+
fieldConfig: {
|
|
1721
|
+
type: "select",
|
|
1722
|
+
options: [
|
|
1723
|
+
{ text: "repeat", value: "repeat" },
|
|
1724
|
+
{ text: "repeat-x", value: "repeat-x" },
|
|
1725
|
+
{ text: "repeat-y", value: "repeat-y" },
|
|
1726
|
+
{ text: "no-repeat", value: "no-repeat" },
|
|
1727
|
+
{ text: "inherit", value: "inherit" }
|
|
1728
|
+
]
|
|
1729
|
+
}
|
|
1403
1730
|
},
|
|
1404
1731
|
{
|
|
1732
|
+
type: "data-source-field-select",
|
|
1405
1733
|
name: "backgroundSize",
|
|
1406
1734
|
text: "背景图大小",
|
|
1407
|
-
defaultValue: "100% 100%"
|
|
1735
|
+
defaultValue: "100% 100%",
|
|
1736
|
+
checkStrictly: false,
|
|
1737
|
+
dataSourceFieldType: ["string"],
|
|
1738
|
+
fieldConfig: {
|
|
1739
|
+
type: "text"
|
|
1740
|
+
}
|
|
1408
1741
|
}
|
|
1409
1742
|
]
|
|
1410
1743
|
},
|
|
@@ -1413,17 +1746,34 @@
|
|
|
1413
1746
|
legend: "字体",
|
|
1414
1747
|
items: [
|
|
1415
1748
|
{
|
|
1749
|
+
type: "data-source-field-select",
|
|
1416
1750
|
name: "color",
|
|
1417
1751
|
text: "颜色",
|
|
1418
|
-
|
|
1752
|
+
checkStrictly: false,
|
|
1753
|
+
dataSourceFieldType: ["string"],
|
|
1754
|
+
fieldConfig: {
|
|
1755
|
+
type: "colorPicker"
|
|
1756
|
+
}
|
|
1419
1757
|
},
|
|
1420
1758
|
{
|
|
1759
|
+
type: "data-source-field-select",
|
|
1421
1760
|
name: "fontSize",
|
|
1422
|
-
text: "大小"
|
|
1761
|
+
text: "大小",
|
|
1762
|
+
checkStrictly: false,
|
|
1763
|
+
dataSourceFieldType: ["string", "number"],
|
|
1764
|
+
fieldConfig: {
|
|
1765
|
+
type: "text"
|
|
1766
|
+
}
|
|
1423
1767
|
},
|
|
1424
1768
|
{
|
|
1769
|
+
type: "data-source-field-select",
|
|
1425
1770
|
name: "fontWeight",
|
|
1426
|
-
text: "粗细"
|
|
1771
|
+
text: "粗细",
|
|
1772
|
+
checkStrictly: false,
|
|
1773
|
+
dataSourceFieldType: ["string", "number"],
|
|
1774
|
+
fieldConfig: {
|
|
1775
|
+
type: "text"
|
|
1776
|
+
}
|
|
1427
1777
|
}
|
|
1428
1778
|
]
|
|
1429
1779
|
},
|
|
@@ -1433,12 +1783,24 @@
|
|
|
1433
1783
|
name: "transform",
|
|
1434
1784
|
items: [
|
|
1435
1785
|
{
|
|
1786
|
+
type: "data-source-field-select",
|
|
1436
1787
|
name: "rotate",
|
|
1437
|
-
text: "旋转角度"
|
|
1788
|
+
text: "旋转角度",
|
|
1789
|
+
checkStrictly: false,
|
|
1790
|
+
dataSourceFieldType: ["string"],
|
|
1791
|
+
fieldConfig: {
|
|
1792
|
+
type: "text"
|
|
1793
|
+
}
|
|
1438
1794
|
},
|
|
1439
1795
|
{
|
|
1796
|
+
type: "data-source-field-select",
|
|
1440
1797
|
name: "scale",
|
|
1441
|
-
text: "缩放"
|
|
1798
|
+
text: "缩放",
|
|
1799
|
+
checkStrictly: false,
|
|
1800
|
+
dataSourceFieldType: ["number", "string"],
|
|
1801
|
+
fieldConfig: {
|
|
1802
|
+
type: "text"
|
|
1803
|
+
}
|
|
1442
1804
|
}
|
|
1443
1805
|
]
|
|
1444
1806
|
}
|
|
@@ -1464,13 +1826,11 @@
|
|
|
1464
1826
|
{
|
|
1465
1827
|
name: "created",
|
|
1466
1828
|
text: "created",
|
|
1467
|
-
labelWidth: "100px",
|
|
1468
1829
|
type: "code-select"
|
|
1469
1830
|
},
|
|
1470
1831
|
{
|
|
1471
1832
|
name: "mounted",
|
|
1472
1833
|
text: "mounted",
|
|
1473
|
-
labelWidth: "100px",
|
|
1474
1834
|
type: "code-select"
|
|
1475
1835
|
}
|
|
1476
1836
|
]
|
|
@@ -1493,14 +1853,22 @@
|
|
|
1493
1853
|
type: "data-source-field-select",
|
|
1494
1854
|
name: "field",
|
|
1495
1855
|
value: "key",
|
|
1496
|
-
label: "字段"
|
|
1856
|
+
label: "字段",
|
|
1857
|
+
checkStrictly: false,
|
|
1858
|
+
dataSourceFieldType: ["string", "number", "boolean", "any"]
|
|
1497
1859
|
},
|
|
1498
1860
|
{
|
|
1499
1861
|
type: "select",
|
|
1500
1862
|
options: (mForm, { model }) => {
|
|
1501
|
-
const [id,
|
|
1863
|
+
const [id, ...fieldNames] = model.field;
|
|
1502
1864
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1503
|
-
|
|
1865
|
+
let fields = ds?.fields || [];
|
|
1866
|
+
let type = "";
|
|
1867
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1868
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1869
|
+
fields = field?.fields || [];
|
|
1870
|
+
type = field?.type || "";
|
|
1871
|
+
});
|
|
1504
1872
|
if (type === "array") {
|
|
1505
1873
|
return arrayOptions;
|
|
1506
1874
|
}
|
|
@@ -1527,9 +1895,15 @@
|
|
|
1527
1895
|
{
|
|
1528
1896
|
name: "value",
|
|
1529
1897
|
type: (mForm, { model }) => {
|
|
1530
|
-
const [id,
|
|
1898
|
+
const [id, ...fieldNames] = model.field;
|
|
1531
1899
|
const ds = dataSourceService.getDataSourceById(id);
|
|
1532
|
-
|
|
1900
|
+
let fields = ds?.fields || [];
|
|
1901
|
+
let type = "";
|
|
1902
|
+
(fieldNames || []).forEach((fieldName) => {
|
|
1903
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
1904
|
+
fields = field?.fields || [];
|
|
1905
|
+
type = field?.type || "";
|
|
1906
|
+
});
|
|
1533
1907
|
if (type === "number") {
|
|
1534
1908
|
return "number";
|
|
1535
1909
|
}
|
|
@@ -1557,13 +1931,13 @@
|
|
|
1557
1931
|
}
|
|
1558
1932
|
]
|
|
1559
1933
|
};
|
|
1560
|
-
const fillConfig = (config = []) => [
|
|
1934
|
+
const fillConfig = (config = [], labelWidth = "80px") => [
|
|
1561
1935
|
{
|
|
1562
1936
|
type: "tab",
|
|
1937
|
+
labelWidth,
|
|
1563
1938
|
items: [
|
|
1564
1939
|
{
|
|
1565
1940
|
title: "属性",
|
|
1566
|
-
labelWidth: "80px",
|
|
1567
1941
|
items: [
|
|
1568
1942
|
// 组件类型,必须要有
|
|
1569
1943
|
{
|
|
@@ -1900,6 +2274,17 @@
|
|
|
1900
2274
|
}
|
|
1901
2275
|
const depService = new Dep();
|
|
1902
2276
|
|
|
2277
|
+
const canUsePluginMethods$5 = {
|
|
2278
|
+
async: [
|
|
2279
|
+
"setPropsConfig",
|
|
2280
|
+
"getPropsConfig",
|
|
2281
|
+
"setPropsValue",
|
|
2282
|
+
"getPropsValue",
|
|
2283
|
+
"fillConfig",
|
|
2284
|
+
"getDefaultPropsValue"
|
|
2285
|
+
],
|
|
2286
|
+
sync: ["createId", "setNewItemId"]
|
|
2287
|
+
};
|
|
1903
2288
|
class Props extends BaseService {
|
|
1904
2289
|
state = vue.reactive({
|
|
1905
2290
|
propsConfigMap: {},
|
|
@@ -1908,14 +2293,8 @@
|
|
|
1908
2293
|
});
|
|
1909
2294
|
constructor() {
|
|
1910
2295
|
super([
|
|
1911
|
-
{ name:
|
|
1912
|
-
{ name:
|
|
1913
|
-
{ name: "setPropsValue", isAsync: true },
|
|
1914
|
-
{ name: "getPropsValue", isAsync: true },
|
|
1915
|
-
{ name: "createId", isAsync: false },
|
|
1916
|
-
{ name: "setNewItemId", isAsync: true },
|
|
1917
|
-
{ name: "fillConfig", isAsync: true },
|
|
1918
|
-
{ name: "getDefaultPropsValue", isAsync: true }
|
|
2296
|
+
...canUsePluginMethods$5.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2297
|
+
...canUsePluginMethods$5.sync.map((methodName) => ({ name: methodName, isAsync: false }))
|
|
1919
2298
|
]);
|
|
1920
2299
|
}
|
|
1921
2300
|
setPropsConfigs(configs) {
|
|
@@ -1924,16 +2303,11 @@
|
|
|
1924
2303
|
});
|
|
1925
2304
|
this.emit("props-configs-change");
|
|
1926
2305
|
}
|
|
1927
|
-
async fillConfig(config) {
|
|
1928
|
-
return fillConfig(config);
|
|
2306
|
+
async fillConfig(config, labelWidth) {
|
|
2307
|
+
return fillConfig(config, typeof labelWidth !== "function" ? labelWidth : "80px");
|
|
1929
2308
|
}
|
|
1930
|
-
/**
|
|
1931
|
-
* 为指定类型组件设置组件属性表单配置
|
|
1932
|
-
* @param type 组件类型
|
|
1933
|
-
* @param config 组件属性表单配置
|
|
1934
|
-
*/
|
|
1935
2309
|
async setPropsConfig(type, config) {
|
|
1936
|
-
this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
2310
|
+
this.state.propsConfigMap[utils.toLine(type)] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
1937
2311
|
}
|
|
1938
2312
|
/**
|
|
1939
2313
|
* 获取指点类型的组件属性表单配置
|
|
@@ -1944,7 +2318,7 @@
|
|
|
1944
2318
|
if (type === "area") {
|
|
1945
2319
|
return await this.getPropsConfig("button");
|
|
1946
2320
|
}
|
|
1947
|
-
return lodashEs.cloneDeep(this.state.propsConfigMap[type] || await this.fillConfig([]));
|
|
2321
|
+
return lodashEs.cloneDeep(this.state.propsConfigMap[utils.toLine(type)] || await this.fillConfig([]));
|
|
1948
2322
|
}
|
|
1949
2323
|
setPropsValues(values) {
|
|
1950
2324
|
Object.keys(values).forEach((type) => {
|
|
@@ -1957,14 +2331,15 @@
|
|
|
1957
2331
|
* @param value 组件初始值
|
|
1958
2332
|
*/
|
|
1959
2333
|
async setPropsValue(type, value) {
|
|
1960
|
-
this.state.propsValueMap[type] = value;
|
|
2334
|
+
this.state.propsValueMap[utils.toLine(type)] = value;
|
|
1961
2335
|
}
|
|
1962
2336
|
/**
|
|
1963
2337
|
* 获取指定类型的组件初始值
|
|
1964
2338
|
* @param type 组件类型
|
|
1965
2339
|
* @returns 组件初始值
|
|
1966
2340
|
*/
|
|
1967
|
-
async getPropsValue(
|
|
2341
|
+
async getPropsValue(componentType, { inputEvent, ...defaultValue } = {}) {
|
|
2342
|
+
const type = utils.toLine(componentType);
|
|
1968
2343
|
if (type === "area") {
|
|
1969
2344
|
const value = await this.getPropsValue("button");
|
|
1970
2345
|
value.className = "action-area";
|
|
@@ -1974,23 +2349,21 @@
|
|
|
1974
2349
|
}
|
|
1975
2350
|
return value;
|
|
1976
2351
|
}
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
)
|
|
1986
|
-
]);
|
|
2352
|
+
const id = this.createId(type);
|
|
2353
|
+
const defaultPropsValue = this.getDefaultPropsValue(type);
|
|
2354
|
+
const data = this.setNewItemId(
|
|
2355
|
+
lodashEs.cloneDeep({
|
|
2356
|
+
type,
|
|
2357
|
+
...defaultValue
|
|
2358
|
+
})
|
|
2359
|
+
);
|
|
1987
2360
|
return {
|
|
1988
2361
|
id,
|
|
1989
2362
|
...defaultPropsValue,
|
|
1990
2363
|
...lodashEs.mergeWith({}, lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
1991
2364
|
};
|
|
1992
2365
|
}
|
|
1993
|
-
|
|
2366
|
+
createId(type) {
|
|
1994
2367
|
return `${type}_${utils.guid()}`;
|
|
1995
2368
|
}
|
|
1996
2369
|
/**
|
|
@@ -2000,15 +2373,15 @@
|
|
|
2000
2373
|
* @param {Boolean} force 是否强制设置新的ID
|
|
2001
2374
|
*/
|
|
2002
2375
|
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
2003
|
-
|
|
2376
|
+
setNewItemId(config, force = true) {
|
|
2004
2377
|
if (force || editorService.getNodeById(config.id)) {
|
|
2005
|
-
const newId =
|
|
2378
|
+
const newId = this.createId(config.type || "component");
|
|
2006
2379
|
this.setRelateId(config.id, newId);
|
|
2007
2380
|
config.id = newId;
|
|
2008
2381
|
}
|
|
2009
2382
|
if (config.items && Array.isArray(config.items)) {
|
|
2010
2383
|
for (const item of config.items) {
|
|
2011
|
-
|
|
2384
|
+
this.setNewItemId(item);
|
|
2012
2385
|
}
|
|
2013
2386
|
}
|
|
2014
2387
|
return config;
|
|
@@ -2018,7 +2391,7 @@
|
|
|
2018
2391
|
* @param type 组件类型
|
|
2019
2392
|
* @returns Object
|
|
2020
2393
|
*/
|
|
2021
|
-
|
|
2394
|
+
getDefaultPropsValue(type) {
|
|
2022
2395
|
return ["page", "container"].includes(type) ? {
|
|
2023
2396
|
type,
|
|
2024
2397
|
layout: "absolute",
|
|
@@ -2072,6 +2445,9 @@
|
|
|
2072
2445
|
this.removeAllListeners();
|
|
2073
2446
|
this.removeAllPlugins();
|
|
2074
2447
|
}
|
|
2448
|
+
usePlugin(options) {
|
|
2449
|
+
super.usePlugin(options);
|
|
2450
|
+
}
|
|
2075
2451
|
/**
|
|
2076
2452
|
* 获取setNewItemId前后映射关系
|
|
2077
2453
|
* @param oldId 原组件ID
|
|
@@ -2231,18 +2607,15 @@
|
|
|
2231
2607
|
Protocol2["BOOLEAN"] = "boolean";
|
|
2232
2608
|
return Protocol2;
|
|
2233
2609
|
})(Protocol || {});
|
|
2610
|
+
const canUsePluginMethods$4 = {
|
|
2611
|
+
async: [],
|
|
2612
|
+
sync: ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]
|
|
2613
|
+
};
|
|
2234
2614
|
class WebStorage extends BaseService {
|
|
2235
2615
|
storage = globalThis.localStorage;
|
|
2236
2616
|
namespace = "tmagic";
|
|
2237
2617
|
constructor() {
|
|
2238
|
-
super(
|
|
2239
|
-
{ name: "getStorage", isAsync: false },
|
|
2240
|
-
{ name: "getNamespace", isAsync: false },
|
|
2241
|
-
{ name: "clear", isAsync: false },
|
|
2242
|
-
{ name: "getItem", isAsync: false },
|
|
2243
|
-
{ name: "removeItem", isAsync: false },
|
|
2244
|
-
{ name: "setItem", isAsync: false }
|
|
2245
|
-
]);
|
|
2618
|
+
super(canUsePluginMethods$4.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
2246
2619
|
}
|
|
2247
2620
|
/**
|
|
2248
2621
|
* 获取数据存储对象,可以通过
|
|
@@ -2325,6 +2698,9 @@
|
|
|
2325
2698
|
this.removeAllListeners();
|
|
2326
2699
|
this.removeAllPlugins();
|
|
2327
2700
|
}
|
|
2701
|
+
usePlugin(options) {
|
|
2702
|
+
super.usePlugin(options);
|
|
2703
|
+
}
|
|
2328
2704
|
getValueAndProtocol(value) {
|
|
2329
2705
|
let protocol = "";
|
|
2330
2706
|
if (value === null) {
|
|
@@ -2345,6 +2721,33 @@
|
|
|
2345
2721
|
}
|
|
2346
2722
|
const storageService = new WebStorage();
|
|
2347
2723
|
|
|
2724
|
+
const canUsePluginMethods$3 = {
|
|
2725
|
+
async: [
|
|
2726
|
+
"getLayout",
|
|
2727
|
+
"highlight",
|
|
2728
|
+
"select",
|
|
2729
|
+
"multiSelect",
|
|
2730
|
+
"doAdd",
|
|
2731
|
+
"add",
|
|
2732
|
+
"doRemove",
|
|
2733
|
+
"remove",
|
|
2734
|
+
"doUpdate",
|
|
2735
|
+
"update",
|
|
2736
|
+
"sort",
|
|
2737
|
+
"copy",
|
|
2738
|
+
"paste",
|
|
2739
|
+
"doPaste",
|
|
2740
|
+
"doAlignCenter",
|
|
2741
|
+
"alignCenter",
|
|
2742
|
+
"moveLayer",
|
|
2743
|
+
"moveToContainer",
|
|
2744
|
+
"dragTo",
|
|
2745
|
+
"undo",
|
|
2746
|
+
"redo",
|
|
2747
|
+
"move"
|
|
2748
|
+
],
|
|
2749
|
+
sync: []
|
|
2750
|
+
};
|
|
2348
2751
|
class Editor extends BaseService {
|
|
2349
2752
|
state = vue.reactive({
|
|
2350
2753
|
root: null,
|
|
@@ -2363,29 +2766,7 @@
|
|
|
2363
2766
|
isHistoryStateChange = false;
|
|
2364
2767
|
constructor() {
|
|
2365
2768
|
super(
|
|
2366
|
-
|
|
2367
|
-
{ name: "getLayout", isAsync: true },
|
|
2368
|
-
{ name: "select", isAsync: true },
|
|
2369
|
-
{ name: "doAdd", isAsync: true },
|
|
2370
|
-
{ name: "add", isAsync: true },
|
|
2371
|
-
{ name: "doRemove", isAsync: true },
|
|
2372
|
-
{ name: "remove", isAsync: true },
|
|
2373
|
-
{ name: "doUpdate", isAsync: true },
|
|
2374
|
-
{ name: "update", isAsync: true },
|
|
2375
|
-
{ name: "sort", isAsync: true },
|
|
2376
|
-
{ name: "copy", isAsync: true },
|
|
2377
|
-
{ name: "paste", isAsync: true },
|
|
2378
|
-
{ name: "doPaste", isAsync: true },
|
|
2379
|
-
{ name: "doAlignCenter", isAsync: true },
|
|
2380
|
-
{ name: "alignCenter", isAsync: true },
|
|
2381
|
-
{ name: "moveLayer", isAsync: true },
|
|
2382
|
-
{ name: "moveToContainer", isAsync: true },
|
|
2383
|
-
{ name: "move", isAsync: true },
|
|
2384
|
-
{ name: "undo", isAsync: true },
|
|
2385
|
-
{ name: "redo", isAsync: true },
|
|
2386
|
-
{ name: "highlight", isAsync: true },
|
|
2387
|
-
{ name: "dragTo", isAsync: true }
|
|
2388
|
-
],
|
|
2769
|
+
canUsePluginMethods$3.async.map((methodName) => ({ name: methodName, isAsync: true })),
|
|
2389
2770
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2390
2771
|
["select", "update", "moveLayer"]
|
|
2391
2772
|
);
|
|
@@ -2887,7 +3268,7 @@
|
|
|
2887
3268
|
}
|
|
2888
3269
|
async doPaste(config, position = {}) {
|
|
2889
3270
|
propsService.clearRelateId();
|
|
2890
|
-
const pasteConfigs =
|
|
3271
|
+
const pasteConfigs = beforePaste(position, lodashEs.cloneDeep(config));
|
|
2891
3272
|
return pasteConfigs;
|
|
2892
3273
|
}
|
|
2893
3274
|
async doAlignCenter(config) {
|
|
@@ -3125,6 +3506,9 @@
|
|
|
3125
3506
|
resetModifiedNodeId() {
|
|
3126
3507
|
this.get("modifiedNodeIds").clear();
|
|
3127
3508
|
}
|
|
3509
|
+
usePlugin(options) {
|
|
3510
|
+
super.usePlugin(options);
|
|
3511
|
+
}
|
|
3128
3512
|
addModifiedNodeId(id) {
|
|
3129
3513
|
if (!this.isHistoryStateChange) {
|
|
3130
3514
|
this.get("modifiedNodeIds").set(id, id);
|
|
@@ -3192,45 +3576,43 @@
|
|
|
3192
3576
|
}
|
|
3193
3577
|
const editorService = new Editor();
|
|
3194
3578
|
|
|
3195
|
-
const beforePaste =
|
|
3579
|
+
const beforePaste = (position, config) => {
|
|
3196
3580
|
if (!config[0]?.style)
|
|
3197
3581
|
return config;
|
|
3198
3582
|
const curNode = editorService.get("node");
|
|
3199
3583
|
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
3200
|
-
const pasteConfigs =
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
pasteConfig.style
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
})
|
|
3233
|
-
);
|
|
3584
|
+
const pasteConfigs = config.map((configItem) => {
|
|
3585
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
3586
|
+
let pastePosition = positionClone;
|
|
3587
|
+
if (!lodashEs.isEmpty(pastePosition) && curNode?.items) {
|
|
3588
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
3589
|
+
}
|
|
3590
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
3591
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
3592
|
+
}
|
|
3593
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
3594
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
3595
|
+
}
|
|
3596
|
+
const pasteConfig = propsService.setNewItemId(configItem, false);
|
|
3597
|
+
if (pasteConfig.style) {
|
|
3598
|
+
const { left, top } = pasteConfig.style;
|
|
3599
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
3600
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
3601
|
+
}
|
|
3602
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
3603
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
3604
|
+
}
|
|
3605
|
+
pasteConfig.style = {
|
|
3606
|
+
...pasteConfig.style,
|
|
3607
|
+
...pastePosition
|
|
3608
|
+
};
|
|
3609
|
+
}
|
|
3610
|
+
const root = editorService.get("root");
|
|
3611
|
+
if ((utils.isPage(pasteConfig) || utils.isPageFragment(pasteConfig)) && root) {
|
|
3612
|
+
pasteConfig.name = generatePageNameByApp(root, utils.isPage(pasteConfig) ? schema.NodeType.PAGE : schema.NodeType.PAGE_FRAGMENT);
|
|
3613
|
+
}
|
|
3614
|
+
return pasteConfig;
|
|
3615
|
+
});
|
|
3234
3616
|
return pasteConfigs;
|
|
3235
3617
|
};
|
|
3236
3618
|
const getPositionInContainer = (position = {}, id) => {
|
|
@@ -3264,7 +3646,7 @@
|
|
|
3264
3646
|
return newNode;
|
|
3265
3647
|
};
|
|
3266
3648
|
|
|
3267
|
-
const _sfc_main$
|
|
3649
|
+
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
3268
3650
|
...{
|
|
3269
3651
|
name: "MEditorCodeParams"
|
|
3270
3652
|
},
|
|
@@ -3315,7 +3697,7 @@
|
|
|
3315
3697
|
});
|
|
3316
3698
|
|
|
3317
3699
|
const _hoisted_1$r = ["src"];
|
|
3318
|
-
const _sfc_main$
|
|
3700
|
+
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
3319
3701
|
...{
|
|
3320
3702
|
name: "MEditorIcon"
|
|
3321
3703
|
},
|
|
@@ -3368,7 +3750,7 @@
|
|
|
3368
3750
|
return;
|
|
3369
3751
|
}
|
|
3370
3752
|
codeConfig.value = {
|
|
3371
|
-
name: "
|
|
3753
|
+
name: "",
|
|
3372
3754
|
content: `({app, params}) => {
|
|
3373
3755
|
// place your code here
|
|
3374
3756
|
}`,
|
|
@@ -3419,9 +3801,9 @@
|
|
|
3419
3801
|
|
|
3420
3802
|
const _hoisted_1$q = { class: "m-fields-code-select-col" };
|
|
3421
3803
|
const _hoisted_2$j = { class: "code-select-container" };
|
|
3422
|
-
const _sfc_main$
|
|
3804
|
+
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
3423
3805
|
...{
|
|
3424
|
-
name: "
|
|
3806
|
+
name: "MFieldsCodeSelectCol"
|
|
3425
3807
|
},
|
|
3426
3808
|
__name: "CodeSelectCol",
|
|
3427
3809
|
props: {
|
|
@@ -3504,14 +3886,14 @@
|
|
|
3504
3886
|
size: _ctx.size,
|
|
3505
3887
|
onChange: onParamsChangeHandler
|
|
3506
3888
|
}, null, 8, ["model", "size"]),
|
|
3507
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3889
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
3508
3890
|
key: 0,
|
|
3509
3891
|
class: "icon",
|
|
3510
3892
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3511
3893
|
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(editCode)(_ctx.model[_ctx.name]))
|
|
3512
3894
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
3513
3895
|
]),
|
|
3514
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3896
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
3515
3897
|
name: "params",
|
|
3516
3898
|
key: _ctx.model[_ctx.name],
|
|
3517
3899
|
model: _ctx.model,
|
|
@@ -3519,7 +3901,7 @@
|
|
|
3519
3901
|
"params-config": paramsConfig.value,
|
|
3520
3902
|
onChange: onParamsChangeHandler
|
|
3521
3903
|
}, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true),
|
|
3522
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3904
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
3523
3905
|
key: 1,
|
|
3524
3906
|
ref_key: "codeBlockEditor",
|
|
3525
3907
|
ref: codeBlockEditor,
|
|
@@ -3534,9 +3916,9 @@
|
|
|
3534
3916
|
|
|
3535
3917
|
const _hoisted_1$p = { class: "m-editor-data-source-fields" };
|
|
3536
3918
|
const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
|
|
3537
|
-
const _sfc_main$
|
|
3919
|
+
const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
3538
3920
|
...{
|
|
3539
|
-
name: "
|
|
3921
|
+
name: "MFieldsDataSourceFields"
|
|
3540
3922
|
},
|
|
3541
3923
|
__name: "DataSourceFields",
|
|
3542
3924
|
props: {
|
|
@@ -3588,7 +3970,14 @@
|
|
|
3588
3970
|
},
|
|
3589
3971
|
{
|
|
3590
3972
|
label: "默认值",
|
|
3591
|
-
prop: "defaultValue"
|
|
3973
|
+
prop: "defaultValue",
|
|
3974
|
+
formatter(item, row) {
|
|
3975
|
+
try {
|
|
3976
|
+
return JSON.stringify(row.defaultValue);
|
|
3977
|
+
} catch (e) {
|
|
3978
|
+
return row.defaultValue;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3592
3981
|
},
|
|
3593
3982
|
{
|
|
3594
3983
|
label: "操作",
|
|
@@ -3826,7 +4215,11 @@
|
|
|
3826
4215
|
}
|
|
3827
4216
|
});
|
|
3828
4217
|
|
|
3829
|
-
const
|
|
4218
|
+
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4219
|
+
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
4220
|
+
...{
|
|
4221
|
+
name: "MFieldsDataSourceFieldSelect"
|
|
4222
|
+
},
|
|
3830
4223
|
__name: "DataSourceFieldSelect",
|
|
3831
4224
|
props: {
|
|
3832
4225
|
config: {},
|
|
@@ -3845,48 +4238,117 @@
|
|
|
3845
4238
|
const emit = __emit;
|
|
3846
4239
|
const props = __props;
|
|
3847
4240
|
const dataSources = vue.computed(() => services?.dataSourceService.get("dataSources"));
|
|
3848
|
-
const getOptionChildren = (fields = []
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
4241
|
+
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4242
|
+
const child = [];
|
|
4243
|
+
fields.forEach((field) => {
|
|
4244
|
+
if (!dataSourceFieldType.length) {
|
|
4245
|
+
dataSourceFieldType.push("any");
|
|
4246
|
+
}
|
|
4247
|
+
const children = getOptionChildren(field.fields, dataSourceFieldType);
|
|
4248
|
+
const item = {
|
|
4249
|
+
label: field.title || field.name,
|
|
4250
|
+
value: field.name,
|
|
4251
|
+
children
|
|
4252
|
+
};
|
|
4253
|
+
const fieldType = field.type || "any";
|
|
4254
|
+
if (dataSourceFieldType.includes("any") || dataSourceFieldType.includes(fieldType)) {
|
|
4255
|
+
child.push(item);
|
|
4256
|
+
return;
|
|
4257
|
+
}
|
|
4258
|
+
if (!dataSourceFieldType.includes(fieldType) && fieldType !== "object") {
|
|
4259
|
+
return;
|
|
4260
|
+
}
|
|
4261
|
+
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
4262
|
+
return;
|
|
4263
|
+
}
|
|
4264
|
+
child.push(item);
|
|
4265
|
+
});
|
|
4266
|
+
return child;
|
|
4267
|
+
};
|
|
3853
4268
|
const cascaderConfig = vue.computed(() => {
|
|
3854
4269
|
const valueIsKey = props.config.value === "key";
|
|
3855
4270
|
return {
|
|
3856
4271
|
type: "cascader",
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
4272
|
+
checkStrictly: props.config.checkStrictly ?? !valueIsKey,
|
|
4273
|
+
popperClass: "m-editor-data-source-field-select-popper",
|
|
4274
|
+
options: () => {
|
|
4275
|
+
const options = dataSources.value?.map((ds) => ({
|
|
4276
|
+
label: ds.title || ds.id,
|
|
4277
|
+
value: valueIsKey ? ds.id : `${utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
4278
|
+
children: getOptionChildren(ds.fields, props.config.dataSourceFieldType)
|
|
4279
|
+
})) || [];
|
|
4280
|
+
return options.filter((option) => option.children.length);
|
|
4281
|
+
}
|
|
3865
4282
|
};
|
|
3866
4283
|
});
|
|
4284
|
+
const showDataSourceFieldSelect = vue.ref(false);
|
|
4285
|
+
vue.onMounted(() => {
|
|
4286
|
+
const value = props.model[props.name];
|
|
4287
|
+
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4288
|
+
return showDataSourceFieldSelect.value = true;
|
|
4289
|
+
}
|
|
4290
|
+
});
|
|
4291
|
+
const mForm = vue.inject("mForm");
|
|
4292
|
+
const type = vue.computed(() => {
|
|
4293
|
+
let type2 = props.config.fieldConfig?.type;
|
|
4294
|
+
if (typeof type2 === "function") {
|
|
4295
|
+
type2 = type2(mForm, {
|
|
4296
|
+
model: props.model
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
if (type2 === "form")
|
|
4300
|
+
return "";
|
|
4301
|
+
if (type2 === "container")
|
|
4302
|
+
return "";
|
|
4303
|
+
return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (props.config.items ? "" : "text");
|
|
4304
|
+
});
|
|
4305
|
+
const tagName = vue.computed(() => {
|
|
4306
|
+
if (showDataSourceFieldSelect.value || !props.config.fieldConfig) {
|
|
4307
|
+
return form.MCascader;
|
|
4308
|
+
}
|
|
4309
|
+
const component = vue.resolveComponent(`m-${props.config.items ? "form" : "fields"}-${type.value}`);
|
|
4310
|
+
if (typeof component !== "string")
|
|
4311
|
+
return component;
|
|
4312
|
+
return "m-fields-text";
|
|
4313
|
+
});
|
|
3867
4314
|
const onChangeHandler = (value) => {
|
|
3868
4315
|
emit("change", value);
|
|
3869
4316
|
};
|
|
3870
4317
|
return (_ctx, _cache) => {
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
4318
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
|
|
4319
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
|
|
4320
|
+
style: { "width": "100%" },
|
|
4321
|
+
config: showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? cascaderConfig.value : _ctx.config.fieldConfig,
|
|
4322
|
+
model: _ctx.model,
|
|
4323
|
+
name: _ctx.name,
|
|
4324
|
+
disabled: _ctx.disabled,
|
|
4325
|
+
size: _ctx.size,
|
|
4326
|
+
"last-values": _ctx.lastValues,
|
|
4327
|
+
"init-values": _ctx.initValues,
|
|
4328
|
+
values: _ctx.values,
|
|
4329
|
+
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4330
|
+
onChange: onChangeHandler
|
|
4331
|
+
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4332
|
+
_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4333
|
+
key: 0,
|
|
4334
|
+
style: { "margin-left": "5px" },
|
|
4335
|
+
link: "",
|
|
4336
|
+
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4337
|
+
icon: vue.unref(iconsVue.Coin),
|
|
4338
|
+
size: _ctx.size,
|
|
4339
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4340
|
+
}, null, 8, ["type", "icon", "size"])) : vue.createCommentVNode("", true)
|
|
4341
|
+
]);
|
|
3880
4342
|
};
|
|
3881
4343
|
}
|
|
3882
4344
|
});
|
|
3883
4345
|
|
|
3884
|
-
const _hoisted_1$
|
|
4346
|
+
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3885
4347
|
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3886
4348
|
const _hoisted_3$7 = { class: "el-input__inner" };
|
|
3887
|
-
const _sfc_main$
|
|
4349
|
+
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
3888
4350
|
...{
|
|
3889
|
-
name: "
|
|
4351
|
+
name: "MFieldsDataSourceInput"
|
|
3890
4352
|
},
|
|
3891
4353
|
__name: "DataSourceInput",
|
|
3892
4354
|
props: {
|
|
@@ -4074,10 +4536,10 @@
|
|
|
4074
4536
|
}
|
|
4075
4537
|
), {
|
|
4076
4538
|
suffix: vue.withCtx(() => [
|
|
4077
|
-
vue.createVNode(_sfc_main$
|
|
4539
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4078
4540
|
]),
|
|
4079
4541
|
default: vue.withCtx(({ item }) => [
|
|
4080
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4542
|
+
vue.createElementVNode("div", _hoisted_1$n, [
|
|
4081
4543
|
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
4082
4544
|
vue.createElementVNode("span", _hoisted_2$h, vue.toDisplayString(item.value), 1)
|
|
4083
4545
|
])
|
|
@@ -4109,7 +4571,7 @@
|
|
|
4109
4571
|
}, 1032, ["size"])) : vue.createCommentVNode("", true)
|
|
4110
4572
|
], 64);
|
|
4111
4573
|
}), 256)),
|
|
4112
|
-
vue.createVNode(_sfc_main$
|
|
4574
|
+
vue.createVNode(_sfc_main$N, {
|
|
4113
4575
|
class: "tmagic-data-source-input-icon",
|
|
4114
4576
|
icon: vue.unref(iconsVue.Coin)
|
|
4115
4577
|
}, null, 8, ["icon"])
|
|
@@ -4192,11 +4654,11 @@
|
|
|
4192
4654
|
};
|
|
4193
4655
|
};
|
|
4194
4656
|
|
|
4195
|
-
const _hoisted_1$
|
|
4657
|
+
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4196
4658
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
4197
|
-
const _sfc_main$
|
|
4659
|
+
const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
|
|
4198
4660
|
...{
|
|
4199
|
-
name: "
|
|
4661
|
+
name: "MFieldsDataSourceMethods"
|
|
4200
4662
|
},
|
|
4201
4663
|
__name: "DataSourceMethods",
|
|
4202
4664
|
props: {
|
|
@@ -4264,7 +4726,7 @@
|
|
|
4264
4726
|
emit("change", props.model[props.name]);
|
|
4265
4727
|
};
|
|
4266
4728
|
return (_ctx, _cache) => {
|
|
4267
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4729
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
4268
4730
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
4269
4731
|
data: _ctx.model[_ctx.name],
|
|
4270
4732
|
columns: methodColumns
|
|
@@ -4283,7 +4745,7 @@
|
|
|
4283
4745
|
_: 1
|
|
4284
4746
|
}, 8, ["disabled"])
|
|
4285
4747
|
]),
|
|
4286
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4748
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
4287
4749
|
key: 0,
|
|
4288
4750
|
ref_key: "codeBlockEditor",
|
|
4289
4751
|
ref: codeBlockEditor,
|
|
@@ -4298,11 +4760,11 @@
|
|
|
4298
4760
|
}
|
|
4299
4761
|
});
|
|
4300
4762
|
|
|
4301
|
-
const _hoisted_1$
|
|
4763
|
+
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
4302
4764
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
4303
|
-
const _sfc_main$
|
|
4765
|
+
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
4304
4766
|
...{
|
|
4305
|
-
name: "
|
|
4767
|
+
name: "MFieldsDataSourceMethodSelect"
|
|
4306
4768
|
},
|
|
4307
4769
|
__name: "DataSourceMethodSelect",
|
|
4308
4770
|
props: {
|
|
@@ -4391,7 +4853,7 @@
|
|
|
4391
4853
|
};
|
|
4392
4854
|
return (_ctx, _cache) => {
|
|
4393
4855
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
4394
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4856
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
4395
4857
|
vue.createElementVNode("div", _hoisted_2$f, [
|
|
4396
4858
|
vue.createVNode(_component_m_form_container, {
|
|
4397
4859
|
class: "select",
|
|
@@ -4399,14 +4861,14 @@
|
|
|
4399
4861
|
model: _ctx.model,
|
|
4400
4862
|
onChange: onChangeHandler
|
|
4401
4863
|
}, null, 8, ["config", "model"]),
|
|
4402
|
-
_ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4864
|
+
_ctx.model[_ctx.name] && isCustomMethod.value ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
4403
4865
|
key: 0,
|
|
4404
4866
|
class: "icon",
|
|
4405
4867
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
4406
4868
|
onClick: editCodeHandler
|
|
4407
4869
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
4408
4870
|
]),
|
|
4409
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4871
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
4410
4872
|
key: 0,
|
|
4411
4873
|
name: "params",
|
|
4412
4874
|
model: _ctx.model,
|
|
@@ -4415,7 +4877,7 @@
|
|
|
4415
4877
|
"params-config": paramsConfig.value,
|
|
4416
4878
|
onChange: onChangeHandler
|
|
4417
4879
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true),
|
|
4418
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4880
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
4419
4881
|
key: 1,
|
|
4420
4882
|
ref_key: "codeBlockEditor",
|
|
4421
4883
|
ref: codeBlockEditor,
|
|
@@ -4428,11 +4890,11 @@
|
|
|
4428
4890
|
}
|
|
4429
4891
|
});
|
|
4430
4892
|
|
|
4431
|
-
const _hoisted_1$
|
|
4893
|
+
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
4432
4894
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
4433
|
-
const _sfc_main$
|
|
4895
|
+
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
4434
4896
|
...{
|
|
4435
|
-
name: "
|
|
4897
|
+
name: "MFieldsDataSourceMocks"
|
|
4436
4898
|
},
|
|
4437
4899
|
__name: "DataSourceMocks",
|
|
4438
4900
|
props: {
|
|
@@ -4626,7 +5088,7 @@
|
|
|
4626
5088
|
});
|
|
4627
5089
|
};
|
|
4628
5090
|
return (_ctx, _cache) => {
|
|
4629
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5091
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
4630
5092
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
4631
5093
|
data: _ctx.model[_ctx.name],
|
|
4632
5094
|
columns
|
|
@@ -4662,9 +5124,9 @@
|
|
|
4662
5124
|
}
|
|
4663
5125
|
});
|
|
4664
5126
|
|
|
4665
|
-
const _sfc_main$
|
|
5127
|
+
const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
4666
5128
|
...{
|
|
4667
|
-
name: "
|
|
5129
|
+
name: "MFieldsDataSourceSelect"
|
|
4668
5130
|
},
|
|
4669
5131
|
__name: "DataSourceSelect",
|
|
4670
5132
|
props: {
|
|
@@ -4719,14 +5181,14 @@
|
|
|
4719
5181
|
}
|
|
4720
5182
|
});
|
|
4721
5183
|
|
|
4722
|
-
const _hoisted_1$
|
|
5184
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
4723
5185
|
const _hoisted_2$d = {
|
|
4724
5186
|
key: 1,
|
|
4725
5187
|
class: "fullWidth"
|
|
4726
5188
|
};
|
|
4727
|
-
const _sfc_main$
|
|
5189
|
+
const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
|
|
4728
5190
|
...{
|
|
4729
|
-
name: "
|
|
5191
|
+
name: "MFieldsEventSelect"
|
|
4730
5192
|
},
|
|
4731
5193
|
__name: "EventSelect",
|
|
4732
5194
|
props: {
|
|
@@ -4928,7 +5390,7 @@
|
|
|
4928
5390
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
4929
5391
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
4930
5392
|
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
4931
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5393
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
4932
5394
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
4933
5395
|
key: 0,
|
|
4934
5396
|
ref: "eventForm",
|
|
@@ -4988,7 +5450,7 @@
|
|
|
4988
5450
|
}
|
|
4989
5451
|
});
|
|
4990
5452
|
|
|
4991
|
-
const _hoisted_1$
|
|
5453
|
+
const _hoisted_1$i = {
|
|
4992
5454
|
viewBox: "0 0 32 32",
|
|
4993
5455
|
version: "1.1",
|
|
4994
5456
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4998,24 +5460,24 @@
|
|
|
4998
5460
|
const _hoisted_4$6 = [
|
|
4999
5461
|
_hoisted_2$c
|
|
5000
5462
|
];
|
|
5001
|
-
const _sfc_main$
|
|
5463
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
5002
5464
|
...{
|
|
5003
5465
|
name: "MEditorCodeIcon"
|
|
5004
5466
|
},
|
|
5005
5467
|
__name: "CodeIcon",
|
|
5006
5468
|
setup(__props) {
|
|
5007
5469
|
return (_ctx, _cache) => {
|
|
5008
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
5470
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$i, _hoisted_4$6);
|
|
5009
5471
|
};
|
|
5010
5472
|
}
|
|
5011
5473
|
});
|
|
5012
5474
|
|
|
5013
|
-
const _hoisted_1$
|
|
5475
|
+
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5014
5476
|
const _hoisted_2$b = { key: 0 };
|
|
5015
5477
|
const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5016
|
-
const _sfc_main$
|
|
5478
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
5017
5479
|
...{
|
|
5018
|
-
name: "
|
|
5480
|
+
name: "MFieldsKeyValue"
|
|
5019
5481
|
},
|
|
5020
5482
|
__name: "KeyValue",
|
|
5021
5483
|
props: {
|
|
@@ -5071,7 +5533,7 @@
|
|
|
5071
5533
|
emit("change", v);
|
|
5072
5534
|
};
|
|
5073
5535
|
return (_ctx, _cache) => {
|
|
5074
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5536
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
5075
5537
|
!showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
|
|
5076
5538
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
|
|
5077
5539
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -5137,7 +5599,7 @@
|
|
|
5137
5599
|
size: "default",
|
|
5138
5600
|
disabled: _ctx.disabled,
|
|
5139
5601
|
link: "",
|
|
5140
|
-
icon: _sfc_main$
|
|
5602
|
+
icon: _sfc_main$D,
|
|
5141
5603
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5142
5604
|
}, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
5143
5605
|
]);
|
|
@@ -5145,11 +5607,11 @@
|
|
|
5145
5607
|
}
|
|
5146
5608
|
});
|
|
5147
5609
|
|
|
5148
|
-
const _hoisted_1$
|
|
5610
|
+
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
5149
5611
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
5150
|
-
const _sfc_main$
|
|
5612
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
5151
5613
|
...{
|
|
5152
|
-
name: "
|
|
5614
|
+
name: "MFieldsPageFragmentSelect"
|
|
5153
5615
|
},
|
|
5154
5616
|
__name: "PageFragmentSelect",
|
|
5155
5617
|
props: {
|
|
@@ -5193,7 +5655,7 @@
|
|
|
5193
5655
|
};
|
|
5194
5656
|
return (_ctx, _cache) => {
|
|
5195
5657
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
5196
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5658
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
5197
5659
|
vue.createElementVNode("div", _hoisted_2$a, [
|
|
5198
5660
|
vue.createVNode(_component_m_form_container, {
|
|
5199
5661
|
class: "select",
|
|
@@ -5202,7 +5664,7 @@
|
|
|
5202
5664
|
size: _ctx.size,
|
|
5203
5665
|
onChange: changeHandler
|
|
5204
5666
|
}, null, 8, ["model", "size"]),
|
|
5205
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5667
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
5206
5668
|
key: 0,
|
|
5207
5669
|
class: "icon",
|
|
5208
5670
|
icon: vue.unref(iconsVue.Edit),
|
|
@@ -5214,14 +5676,14 @@
|
|
|
5214
5676
|
}
|
|
5215
5677
|
});
|
|
5216
5678
|
|
|
5217
|
-
const _hoisted_1$
|
|
5679
|
+
const _hoisted_1$f = {
|
|
5218
5680
|
key: 1,
|
|
5219
5681
|
class: "m-fields-ui-select",
|
|
5220
5682
|
style: { "display": "flex" }
|
|
5221
5683
|
};
|
|
5222
|
-
const _sfc_main$
|
|
5684
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
5223
5685
|
...{
|
|
5224
|
-
name: "
|
|
5686
|
+
name: "MFieldsUISelect"
|
|
5225
5687
|
},
|
|
5226
5688
|
__name: "UISelect",
|
|
5227
5689
|
props: {
|
|
@@ -5288,7 +5750,7 @@
|
|
|
5288
5750
|
services?.editorService.get("stage")?.highlight(id);
|
|
5289
5751
|
services?.stageOverlayService.get("stage")?.highlight(id);
|
|
5290
5752
|
}, 150);
|
|
5291
|
-
const
|
|
5753
|
+
const unhighlight = () => {
|
|
5292
5754
|
services?.editorService.set("highlightNode", null);
|
|
5293
5755
|
services?.editorService.get("stage")?.clearHighlight();
|
|
5294
5756
|
services?.stageOverlayService.get("stage")?.clearHighlight();
|
|
@@ -5312,7 +5774,7 @@
|
|
|
5312
5774
|
]),
|
|
5313
5775
|
_: 1
|
|
5314
5776
|
}, 8, ["icon", "disabled", "size"])
|
|
5315
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5777
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
5316
5778
|
val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
5317
5779
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
5318
5780
|
content: "清除",
|
|
@@ -5327,7 +5789,7 @@
|
|
|
5327
5789
|
size: _ctx.size,
|
|
5328
5790
|
link: "",
|
|
5329
5791
|
onClick: vue.withModifiers(deleteHandler, ["stop"])
|
|
5330
|
-
}, null, 8, ["icon", "disabled", "size"
|
|
5792
|
+
}, null, 8, ["icon", "disabled", "size"])
|
|
5331
5793
|
]),
|
|
5332
5794
|
_: 1
|
|
5333
5795
|
}),
|
|
@@ -5343,7 +5805,7 @@
|
|
|
5343
5805
|
size: _ctx.size,
|
|
5344
5806
|
onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
|
|
5345
5807
|
onMouseenter: _cache[1] || (_cache[1] = ($event) => vue.unref(highlight)(val.value)),
|
|
5346
|
-
onMouseleave:
|
|
5808
|
+
onMouseleave: unhighlight
|
|
5347
5809
|
}, {
|
|
5348
5810
|
default: vue.withCtx(() => [
|
|
5349
5811
|
vue.createTextVNode(vue.toDisplayString(`${toName.value}_${val.value}`), 1)
|
|
@@ -5407,7 +5869,7 @@
|
|
|
5407
5869
|
};
|
|
5408
5870
|
};
|
|
5409
5871
|
|
|
5410
|
-
const _sfc_main$
|
|
5872
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
5411
5873
|
...{
|
|
5412
5874
|
name: "MEditorResizer"
|
|
5413
5875
|
},
|
|
@@ -5429,12 +5891,13 @@
|
|
|
5429
5891
|
}
|
|
5430
5892
|
});
|
|
5431
5893
|
|
|
5432
|
-
const _sfc_main$
|
|
5894
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
5433
5895
|
...{
|
|
5434
5896
|
name: "MEditorSplitView"
|
|
5435
5897
|
},
|
|
5436
5898
|
__name: "SplitView",
|
|
5437
5899
|
props: {
|
|
5900
|
+
width: {},
|
|
5438
5901
|
left: {},
|
|
5439
5902
|
right: {},
|
|
5440
5903
|
minLeft: { default: 46 },
|
|
@@ -5451,17 +5914,19 @@
|
|
|
5451
5914
|
const el = vue.ref();
|
|
5452
5915
|
const hasLeft = vue.computed(() => typeof props.left !== "undefined");
|
|
5453
5916
|
const hasRight = vue.computed(() => typeof props.right !== "undefined");
|
|
5454
|
-
const
|
|
5917
|
+
const center = vue.ref(0);
|
|
5918
|
+
let clientWidth = 0;
|
|
5919
|
+
const getCenterWidth = (l = 0, r = 0) => {
|
|
5455
5920
|
let right = r > 0 ? r : 0;
|
|
5456
5921
|
let left = l > 0 ? l : 0;
|
|
5457
|
-
let center2 =
|
|
5922
|
+
let center2 = clientWidth - left - right;
|
|
5458
5923
|
if (center2 < props.minCenter) {
|
|
5459
5924
|
center2 = props.minCenter;
|
|
5460
5925
|
if (right > center2 + props.minRight) {
|
|
5461
|
-
right =
|
|
5926
|
+
right = clientWidth - left - center2;
|
|
5462
5927
|
} else {
|
|
5463
5928
|
right = props.minRight;
|
|
5464
|
-
left =
|
|
5929
|
+
left = clientWidth - right - center2;
|
|
5465
5930
|
}
|
|
5466
5931
|
}
|
|
5467
5932
|
return {
|
|
@@ -5470,36 +5935,43 @@
|
|
|
5470
5935
|
right
|
|
5471
5936
|
};
|
|
5472
5937
|
};
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
clientWidth = contentRect.width;
|
|
5477
|
-
let left = props.left || 0;
|
|
5478
|
-
let right = props.right || 0;
|
|
5479
|
-
if (left > clientWidth) {
|
|
5480
|
-
left = clientWidth / 3;
|
|
5481
|
-
}
|
|
5482
|
-
if (right > clientWidth) {
|
|
5483
|
-
right = clientWidth / 3;
|
|
5484
|
-
}
|
|
5485
|
-
const columnWidth = getCenterWidth(clientWidth, left, right);
|
|
5486
|
-
center.value = columnWidth.center;
|
|
5487
|
-
emit("change", {
|
|
5488
|
-
left: columnWidth.left,
|
|
5489
|
-
center: center.value,
|
|
5490
|
-
right: columnWidth.right
|
|
5491
|
-
});
|
|
5938
|
+
const widthChange = (width) => {
|
|
5939
|
+
if (width <= 0) {
|
|
5940
|
+
return;
|
|
5492
5941
|
}
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5942
|
+
clientWidth = width;
|
|
5943
|
+
let left = props.left || 0;
|
|
5944
|
+
let right = props.right || 0;
|
|
5945
|
+
if (left > clientWidth) {
|
|
5946
|
+
left = clientWidth / 3;
|
|
5497
5947
|
}
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5948
|
+
if (right > clientWidth) {
|
|
5949
|
+
right = clientWidth / 3;
|
|
5950
|
+
}
|
|
5951
|
+
const columnWidth = getCenterWidth(left, right);
|
|
5952
|
+
center.value = columnWidth.center;
|
|
5953
|
+
emit("change", columnWidth);
|
|
5954
|
+
};
|
|
5955
|
+
if (typeof props.width !== "number") {
|
|
5956
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
5957
|
+
for (const { contentRect } of entries) {
|
|
5958
|
+
widthChange(contentRect.width);
|
|
5959
|
+
}
|
|
5960
|
+
});
|
|
5961
|
+
vue.onMounted(() => {
|
|
5962
|
+
if (el.value) {
|
|
5963
|
+
resizerObserver.observe(el.value);
|
|
5964
|
+
}
|
|
5965
|
+
});
|
|
5966
|
+
vue.onBeforeUnmount(() => {
|
|
5967
|
+
resizerObserver.disconnect();
|
|
5968
|
+
});
|
|
5969
|
+
} else {
|
|
5970
|
+
vue.watchEffect(() => {
|
|
5971
|
+
if (typeof props.width === "number")
|
|
5972
|
+
widthChange(props.width);
|
|
5973
|
+
});
|
|
5974
|
+
}
|
|
5503
5975
|
const changeLeft = ({ deltaX }) => {
|
|
5504
5976
|
if (typeof props.left === "undefined")
|
|
5505
5977
|
return;
|
|
@@ -5508,7 +5980,7 @@
|
|
|
5508
5980
|
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
5509
5981
|
left = props.left;
|
|
5510
5982
|
}
|
|
5511
|
-
const columnWidth = getCenterWidth(
|
|
5983
|
+
const columnWidth = getCenterWidth(left, props.right || 0);
|
|
5512
5984
|
center.value = columnWidth.center;
|
|
5513
5985
|
emit("change", {
|
|
5514
5986
|
left: columnWidth.left,
|
|
@@ -5524,7 +5996,7 @@
|
|
|
5524
5996
|
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
5525
5997
|
right = props.right;
|
|
5526
5998
|
}
|
|
5527
|
-
const columnWidth = getCenterWidth(
|
|
5999
|
+
const columnWidth = getCenterWidth(props.left, right);
|
|
5528
6000
|
center.value = columnWidth.center;
|
|
5529
6001
|
emit("change", {
|
|
5530
6002
|
left: columnWidth.left,
|
|
@@ -5534,7 +6006,8 @@
|
|
|
5534
6006
|
};
|
|
5535
6007
|
__expose({
|
|
5536
6008
|
updateWidth() {
|
|
5537
|
-
|
|
6009
|
+
clientWidth = props.width ?? el.value?.clientWidth ?? clientWidth;
|
|
6010
|
+
const columnWidth = getCenterWidth(props.left, props.right);
|
|
5538
6011
|
emit("change", {
|
|
5539
6012
|
left: columnWidth.left,
|
|
5540
6013
|
center: center.value,
|
|
@@ -5556,7 +6029,7 @@
|
|
|
5556
6029
|
}, [
|
|
5557
6030
|
vue.renderSlot(_ctx.$slots, "left")
|
|
5558
6031
|
], 6),
|
|
5559
|
-
vue.createVNode(_sfc_main$
|
|
6032
|
+
vue.createVNode(_sfc_main$z, { onChange: changeLeft })
|
|
5560
6033
|
], 64)) : vue.createCommentVNode("", true),
|
|
5561
6034
|
vue.createElementVNode("div", {
|
|
5562
6035
|
class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -5565,7 +6038,7 @@
|
|
|
5565
6038
|
vue.renderSlot(_ctx.$slots, "center")
|
|
5566
6039
|
], 6),
|
|
5567
6040
|
hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
5568
|
-
vue.createVNode(_sfc_main$
|
|
6041
|
+
vue.createVNode(_sfc_main$z, { onChange: changeRight }),
|
|
5569
6042
|
vue.createElementVNode("div", {
|
|
5570
6043
|
class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
5571
6044
|
style: vue.normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -5578,12 +6051,12 @@
|
|
|
5578
6051
|
}
|
|
5579
6052
|
});
|
|
5580
6053
|
|
|
5581
|
-
const _hoisted_1$
|
|
6054
|
+
const _hoisted_1$e = {
|
|
5582
6055
|
key: 1,
|
|
5583
6056
|
class: "menu-item-text"
|
|
5584
6057
|
};
|
|
5585
6058
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
5586
|
-
const _sfc_main$
|
|
6059
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
5587
6060
|
...{
|
|
5588
6061
|
name: "MEditorToolButton"
|
|
5589
6062
|
},
|
|
@@ -5662,7 +6135,7 @@
|
|
|
5662
6135
|
_ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
5663
6136
|
key: 0,
|
|
5664
6137
|
direction: _ctx.data.direction || "vertical"
|
|
5665
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6138
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
5666
6139
|
_ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
5667
6140
|
key: 0,
|
|
5668
6141
|
effect: "dark",
|
|
@@ -5676,7 +6149,7 @@
|
|
|
5676
6149
|
disabled: disabled.value
|
|
5677
6150
|
}, {
|
|
5678
6151
|
default: vue.withCtx(() => [
|
|
5679
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6152
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
5680
6153
|
key: 0,
|
|
5681
6154
|
icon: _ctx.data.icon
|
|
5682
6155
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -5694,7 +6167,7 @@
|
|
|
5694
6167
|
title: _ctx.data.text
|
|
5695
6168
|
}, {
|
|
5696
6169
|
default: vue.withCtx(() => [
|
|
5697
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6170
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
5698
6171
|
key: 0,
|
|
5699
6172
|
icon: _ctx.data.icon
|
|
5700
6173
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -5744,11 +6217,11 @@
|
|
|
5744
6217
|
}
|
|
5745
6218
|
});
|
|
5746
6219
|
|
|
5747
|
-
const _hoisted_1$
|
|
6220
|
+
const _hoisted_1$d = {
|
|
5748
6221
|
key: 1,
|
|
5749
6222
|
style: { "width": "21px" }
|
|
5750
6223
|
};
|
|
5751
|
-
const _sfc_main$
|
|
6224
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
5752
6225
|
...{
|
|
5753
6226
|
name: "MEditorPageBarAddButton"
|
|
5754
6227
|
},
|
|
@@ -5782,13 +6255,13 @@
|
|
|
5782
6255
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5783
6256
|
onClick: addPage
|
|
5784
6257
|
}, [
|
|
5785
|
-
vue.createVNode(_sfc_main$
|
|
5786
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6258
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
6259
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d));
|
|
5787
6260
|
};
|
|
5788
6261
|
}
|
|
5789
6262
|
});
|
|
5790
6263
|
|
|
5791
|
-
const _sfc_main$
|
|
6264
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
5792
6265
|
...{
|
|
5793
6266
|
name: "MEditorPageBarScrollContainer"
|
|
5794
6267
|
},
|
|
@@ -5894,7 +6367,7 @@
|
|
|
5894
6367
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5895
6368
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5896
6369
|
}, [
|
|
5897
|
-
vue.createVNode(_sfc_main$
|
|
6370
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
5898
6371
|
])) : vue.createCommentVNode("", true),
|
|
5899
6372
|
_ctx.type === vue.unref(schema.NodeType).PAGE && pageLength.value || _ctx.type === vue.unref(schema.NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
5900
6373
|
key: 1,
|
|
@@ -5910,14 +6383,14 @@
|
|
|
5910
6383
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5911
6384
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5912
6385
|
}, [
|
|
5913
|
-
vue.createVNode(_sfc_main$
|
|
6386
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
5914
6387
|
])) : vue.createCommentVNode("", true)
|
|
5915
6388
|
], 512);
|
|
5916
6389
|
};
|
|
5917
6390
|
}
|
|
5918
6391
|
});
|
|
5919
6392
|
|
|
5920
|
-
const _sfc_main$
|
|
6393
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
5921
6394
|
...{
|
|
5922
6395
|
name: "MEditorPageBarSwitchTypeButton"
|
|
5923
6396
|
},
|
|
@@ -5961,11 +6434,11 @@
|
|
|
5961
6434
|
}
|
|
5962
6435
|
});
|
|
5963
6436
|
|
|
5964
|
-
const _hoisted_1$
|
|
6437
|
+
const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
5965
6438
|
const _hoisted_2$8 = ["onClick"];
|
|
5966
6439
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
5967
6440
|
const _hoisted_4$5 = ["title"];
|
|
5968
|
-
const _sfc_main$
|
|
6441
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
5969
6442
|
...{
|
|
5970
6443
|
name: "MEditorPageBar"
|
|
5971
6444
|
},
|
|
@@ -6043,15 +6516,15 @@
|
|
|
6043
6516
|
editorService?.remove(node);
|
|
6044
6517
|
};
|
|
6045
6518
|
return (_ctx, _cache) => {
|
|
6046
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6047
|
-
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6519
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
6520
|
+
!_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
6048
6521
|
key: 0,
|
|
6049
6522
|
modelValue: active.value,
|
|
6050
6523
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
6051
6524
|
}, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
|
|
6052
|
-
vue.createVNode(_sfc_main$
|
|
6525
|
+
vue.createVNode(_sfc_main$v, { type: active.value }, {
|
|
6053
6526
|
prepend: vue.withCtx(() => [
|
|
6054
|
-
vue.createVNode(_sfc_main$
|
|
6527
|
+
vue.createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
|
|
6055
6528
|
]),
|
|
6056
6529
|
default: vue.withCtx(() => [
|
|
6057
6530
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
|
|
@@ -6084,7 +6557,7 @@
|
|
|
6084
6557
|
default: vue.withCtx(() => [
|
|
6085
6558
|
vue.createElementVNode("div", null, [
|
|
6086
6559
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
6087
|
-
vue.createVNode(_sfc_main$
|
|
6560
|
+
vue.createVNode(_sfc_main$x, {
|
|
6088
6561
|
data: {
|
|
6089
6562
|
type: "button",
|
|
6090
6563
|
text: "复制",
|
|
@@ -6092,7 +6565,7 @@
|
|
|
6092
6565
|
handler: () => copy(item)
|
|
6093
6566
|
}
|
|
6094
6567
|
}, null, 8, ["data"]),
|
|
6095
|
-
vue.createVNode(_sfc_main$
|
|
6568
|
+
vue.createVNode(_sfc_main$x, {
|
|
6096
6569
|
data: {
|
|
6097
6570
|
type: "button",
|
|
6098
6571
|
text: "删除",
|
|
@@ -6115,11 +6588,11 @@
|
|
|
6115
6588
|
}
|
|
6116
6589
|
});
|
|
6117
6590
|
|
|
6118
|
-
const _hoisted_1$
|
|
6591
|
+
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
6119
6592
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
6120
6593
|
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
6121
6594
|
const _hoisted_4$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面片", -1);
|
|
6122
|
-
const _sfc_main$
|
|
6595
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
6123
6596
|
...{
|
|
6124
6597
|
name: "MEditorAddPageBox"
|
|
6125
6598
|
},
|
|
@@ -6143,14 +6616,14 @@
|
|
|
6143
6616
|
});
|
|
6144
6617
|
};
|
|
6145
6618
|
return (_ctx, _cache) => {
|
|
6146
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6619
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
6147
6620
|
vue.createElementVNode("div", _hoisted_2$7, [
|
|
6148
6621
|
vue.createElementVNode("div", {
|
|
6149
6622
|
class: "m-editor-empty-button",
|
|
6150
6623
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(schema.NodeType).PAGE))
|
|
6151
6624
|
}, [
|
|
6152
6625
|
vue.createElementVNode("div", null, [
|
|
6153
|
-
vue.createVNode(_sfc_main$
|
|
6626
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
6154
6627
|
]),
|
|
6155
6628
|
_hoisted_3$4
|
|
6156
6629
|
]),
|
|
@@ -6160,7 +6633,7 @@
|
|
|
6160
6633
|
onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(vue.unref(schema.NodeType).PAGE_FRAGMENT))
|
|
6161
6634
|
}, [
|
|
6162
6635
|
vue.createElementVNode("div", null, [
|
|
6163
|
-
vue.createVNode(_sfc_main$
|
|
6636
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
6164
6637
|
]),
|
|
6165
6638
|
_hoisted_4$4
|
|
6166
6639
|
])) : vue.createCommentVNode("", true)
|
|
@@ -6174,7 +6647,7 @@
|
|
|
6174
6647
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
6175
6648
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
6176
6649
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
6177
|
-
const _sfc_main$
|
|
6650
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
6178
6651
|
...{
|
|
6179
6652
|
name: "MEditorFramework"
|
|
6180
6653
|
},
|
|
@@ -6193,36 +6666,14 @@
|
|
|
6193
6666
|
const stageLoading = vue.computed(() => editorService?.get("stageLoading") || false);
|
|
6194
6667
|
const showSrc = vue.computed(() => uiService?.get("showSrc"));
|
|
6195
6668
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
6196
|
-
const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
|
|
6197
|
-
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
6198
6669
|
const columnWidth = vue.ref({
|
|
6199
|
-
left:
|
|
6670
|
+
left: getLeftColumnWidthCacheData(),
|
|
6200
6671
|
center: 0,
|
|
6201
|
-
right:
|
|
6672
|
+
right: Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH
|
|
6673
|
+
});
|
|
6674
|
+
vue.watch(pageLength, () => {
|
|
6675
|
+
splitView.value?.updateWidth();
|
|
6202
6676
|
});
|
|
6203
|
-
vue.watch(
|
|
6204
|
-
[pageLength, splitView],
|
|
6205
|
-
() => {
|
|
6206
|
-
splitView.value?.updateWidth();
|
|
6207
|
-
},
|
|
6208
|
-
{
|
|
6209
|
-
immediate: true
|
|
6210
|
-
}
|
|
6211
|
-
);
|
|
6212
|
-
vue.watch(
|
|
6213
|
-
() => columnWidth.value.right,
|
|
6214
|
-
(right) => {
|
|
6215
|
-
if (typeof right === "undefined")
|
|
6216
|
-
return;
|
|
6217
|
-
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
|
|
6218
|
-
}
|
|
6219
|
-
);
|
|
6220
|
-
vue.watch(
|
|
6221
|
-
() => columnWidth.value.left,
|
|
6222
|
-
(left) => {
|
|
6223
|
-
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
6224
|
-
}
|
|
6225
|
-
);
|
|
6226
6677
|
vue.watch(
|
|
6227
6678
|
() => uiService?.get("hideSlideBar"),
|
|
6228
6679
|
(hideSlideBar) => {
|
|
@@ -6230,11 +6681,29 @@
|
|
|
6230
6681
|
}
|
|
6231
6682
|
);
|
|
6232
6683
|
const columnWidthChange = (columnW) => {
|
|
6233
|
-
columnWidth.value
|
|
6234
|
-
|
|
6235
|
-
|
|
6684
|
+
columnWidth.value = columnW;
|
|
6685
|
+
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.left}`);
|
|
6686
|
+
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.right}`);
|
|
6236
6687
|
uiService?.set("columnWidth", columnW);
|
|
6237
6688
|
};
|
|
6689
|
+
const frameworkRect = vue.computed(() => uiService?.get("frameworkRect"));
|
|
6690
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
6691
|
+
const { contentRect } = entries[0];
|
|
6692
|
+
uiService?.set("frameworkRect", {
|
|
6693
|
+
width: contentRect.width,
|
|
6694
|
+
height: contentRect.height,
|
|
6695
|
+
left: contentRect.left,
|
|
6696
|
+
top: contentRect.top
|
|
6697
|
+
});
|
|
6698
|
+
});
|
|
6699
|
+
vue.onMounted(() => {
|
|
6700
|
+
if (content.value) {
|
|
6701
|
+
resizerObserver.observe(content.value);
|
|
6702
|
+
}
|
|
6703
|
+
});
|
|
6704
|
+
vue.onBeforeUnmount(() => {
|
|
6705
|
+
resizerObserver.disconnect();
|
|
6706
|
+
});
|
|
6238
6707
|
const saveCode = (value) => {
|
|
6239
6708
|
try {
|
|
6240
6709
|
const parseDSL = getConfig("parseDSL");
|
|
@@ -6261,7 +6730,7 @@
|
|
|
6261
6730
|
options: vue.unref(codeOptions),
|
|
6262
6731
|
onSave: saveCode
|
|
6263
6732
|
}, null, 8, ["init-values", "options"])
|
|
6264
|
-
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6733
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$y, {
|
|
6265
6734
|
key: 1,
|
|
6266
6735
|
"element-loading-text": "Runtime 加载中...",
|
|
6267
6736
|
ref_key: "splitView",
|
|
@@ -6277,6 +6746,7 @@
|
|
|
6277
6746
|
"min-left": 65,
|
|
6278
6747
|
"min-right": 20,
|
|
6279
6748
|
"min-center": 100,
|
|
6749
|
+
width: frameworkRect.value?.width || 0,
|
|
6280
6750
|
onChange: columnWidthChange
|
|
6281
6751
|
}, vue.createSlots({
|
|
6282
6752
|
left: vue.withCtx(() => [
|
|
@@ -6284,10 +6754,10 @@
|
|
|
6284
6754
|
]),
|
|
6285
6755
|
center: vue.withCtx(() => [
|
|
6286
6756
|
page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
6287
|
-
vue.createVNode(_sfc_main$
|
|
6757
|
+
vue.createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
6288
6758
|
]),
|
|
6289
6759
|
vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
6290
|
-
vue.createVNode(_sfc_main$
|
|
6760
|
+
vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
6291
6761
|
"page-bar-title": vue.withCtx(({ page: page2 }) => [
|
|
6292
6762
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6293
6763
|
]),
|
|
@@ -6312,7 +6782,7 @@
|
|
|
6312
6782
|
]),
|
|
6313
6783
|
key: "0"
|
|
6314
6784
|
} : void 0
|
|
6315
|
-
]), 1032, ["left", "right"])), [
|
|
6785
|
+
]), 1032, ["left", "right", "width"])), [
|
|
6316
6786
|
[_directive_loading, stageLoading.value]
|
|
6317
6787
|
]),
|
|
6318
6788
|
vue.renderSlot(_ctx.$slots, "content-after"),
|
|
@@ -6322,7 +6792,7 @@
|
|
|
6322
6792
|
}
|
|
6323
6793
|
});
|
|
6324
6794
|
|
|
6325
|
-
const _sfc_main$
|
|
6795
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
6326
6796
|
...{
|
|
6327
6797
|
name: "MEditorNavMenu"
|
|
6328
6798
|
},
|
|
@@ -6472,10 +6942,30 @@
|
|
|
6472
6942
|
});
|
|
6473
6943
|
return data;
|
|
6474
6944
|
});
|
|
6945
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
6946
|
+
const rect = navMenu.value?.getBoundingClientRect();
|
|
6947
|
+
if (rect) {
|
|
6948
|
+
uiService?.set("navMenuRect", {
|
|
6949
|
+
left: rect.left,
|
|
6950
|
+
top: rect.top,
|
|
6951
|
+
width: rect.width,
|
|
6952
|
+
height: rect.height
|
|
6953
|
+
});
|
|
6954
|
+
}
|
|
6955
|
+
});
|
|
6956
|
+
const navMenu = vue.ref();
|
|
6957
|
+
vue.onMounted(() => {
|
|
6958
|
+
navMenu.value && resizeObserver.observe(navMenu.value);
|
|
6959
|
+
});
|
|
6960
|
+
vue.onBeforeUnmount(() => {
|
|
6961
|
+
resizeObserver.disconnect();
|
|
6962
|
+
});
|
|
6475
6963
|
return (_ctx, _cache) => {
|
|
6476
6964
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
6477
6965
|
class: "m-editor-nav-menu",
|
|
6478
|
-
style: vue.normalizeStyle({ height: `${_ctx.height}px` })
|
|
6966
|
+
style: vue.normalizeStyle({ height: `${_ctx.height}px` }),
|
|
6967
|
+
ref_key: "navMenu",
|
|
6968
|
+
ref: navMenu
|
|
6479
6969
|
}, [
|
|
6480
6970
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(keys), (key) => {
|
|
6481
6971
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -6484,7 +6974,7 @@
|
|
|
6484
6974
|
style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
6485
6975
|
}, [
|
|
6486
6976
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
|
|
6487
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6977
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
6488
6978
|
data: item,
|
|
6489
6979
|
key: index
|
|
6490
6980
|
}, null, 8, ["data"]);
|
|
@@ -6496,8 +6986,8 @@
|
|
|
6496
6986
|
}
|
|
6497
6987
|
});
|
|
6498
6988
|
|
|
6499
|
-
const _hoisted_1$
|
|
6500
|
-
const _sfc_main$
|
|
6989
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
6990
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
6501
6991
|
...{
|
|
6502
6992
|
name: "MEditorPropsPanel"
|
|
6503
6993
|
},
|
|
@@ -6507,7 +6997,9 @@
|
|
|
6507
6997
|
},
|
|
6508
6998
|
emits: ["mounted", "submit-error", "form-error"],
|
|
6509
6999
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
7000
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
6510
7001
|
const emit = __emit;
|
|
7002
|
+
const showSrc = vue.ref(false);
|
|
6511
7003
|
const internalInstance = vue.getCurrentInstance();
|
|
6512
7004
|
const values = vue.ref({});
|
|
6513
7005
|
const configForm = vue.ref();
|
|
@@ -6517,6 +7009,7 @@
|
|
|
6517
7009
|
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
6518
7010
|
const propsPanelSize = vue.computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
6519
7011
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
7012
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
6520
7013
|
const init = async () => {
|
|
6521
7014
|
if (!node.value) {
|
|
6522
7015
|
curFormConfig.value = [];
|
|
@@ -6550,9 +7043,12 @@
|
|
|
6550
7043
|
const errorHandler = (e) => {
|
|
6551
7044
|
emit("form-error", e);
|
|
6552
7045
|
};
|
|
7046
|
+
const saveCode = (values2) => {
|
|
7047
|
+
services?.editorService.update(values2);
|
|
7048
|
+
};
|
|
6553
7049
|
__expose({ configForm, submit });
|
|
6554
7050
|
return (_ctx, _cache) => {
|
|
6555
|
-
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
7051
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
6556
7052
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
6557
7053
|
vue.createVNode(vue.unref(form.MForm), {
|
|
6558
7054
|
ref_key: "configForm",
|
|
@@ -6565,7 +7061,24 @@
|
|
|
6565
7061
|
"extend-state": _ctx.extendState,
|
|
6566
7062
|
onChange: submit,
|
|
6567
7063
|
onError: errorHandler
|
|
6568
|
-
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
|
|
7064
|
+
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"]),
|
|
7065
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
7066
|
+
class: "m-editor-props-panel-src-icon",
|
|
7067
|
+
circle: "",
|
|
7068
|
+
size: "large",
|
|
7069
|
+
title: "源码",
|
|
7070
|
+
icon: vue.unref(iconsVue.Document),
|
|
7071
|
+
type: showSrc.value ? "primary" : "",
|
|
7072
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
7073
|
+
}, null, 8, ["icon", "type"]),
|
|
7074
|
+
showSrc.value ? (vue.openBlock(), vue.createBlock(_sfc_main$U, {
|
|
7075
|
+
key: 0,
|
|
7076
|
+
height: `${vue.unref(editorContentHeight)}px`,
|
|
7077
|
+
"init-values": values.value,
|
|
7078
|
+
options: vue.unref(codeOptions),
|
|
7079
|
+
parse: true,
|
|
7080
|
+
onSave: saveCode
|
|
7081
|
+
}, null, 8, ["height", "init-values", "options"])) : vue.createCommentVNode("", true)
|
|
6569
7082
|
], 512)), [
|
|
6570
7083
|
[vue.vShow, nodes.value.length === 1]
|
|
6571
7084
|
]);
|
|
@@ -6573,116 +7086,6 @@
|
|
|
6573
7086
|
}
|
|
6574
7087
|
});
|
|
6575
7088
|
|
|
6576
|
-
const _hoisted_1$a = { class: "m-editor-float-box-body" };
|
|
6577
|
-
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
6578
|
-
__name: "FloatingBox",
|
|
6579
|
-
props: {
|
|
6580
|
-
visible: { type: Boolean, default: false },
|
|
6581
|
-
position: { default: () => ({ left: 0, top: 0 }) },
|
|
6582
|
-
rect: { default: () => ({ width: "auto", height: "auto" }) },
|
|
6583
|
-
title: { default: "" }
|
|
6584
|
-
},
|
|
6585
|
-
emits: ["update:visible"],
|
|
6586
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6587
|
-
const props = __props;
|
|
6588
|
-
const emit = __emit;
|
|
6589
|
-
const target = vue.ref();
|
|
6590
|
-
const dragTarget = vue.ref();
|
|
6591
|
-
const style = vue.computed(() => ({
|
|
6592
|
-
left: `${props.position.left}px`,
|
|
6593
|
-
top: `${props.position.top}px`,
|
|
6594
|
-
width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
|
|
6595
|
-
height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
|
|
6596
|
-
}));
|
|
6597
|
-
let moveable = null;
|
|
6598
|
-
const initMoveable = () => {
|
|
6599
|
-
moveable = new VanillaMoveable(globalThis.document.body, {
|
|
6600
|
-
className: "m-editor-floating-box-moveable",
|
|
6601
|
-
target: target.value,
|
|
6602
|
-
draggable: true,
|
|
6603
|
-
resizable: true,
|
|
6604
|
-
edge: true,
|
|
6605
|
-
keepRatio: false,
|
|
6606
|
-
origin: false,
|
|
6607
|
-
snappable: true,
|
|
6608
|
-
dragTarget: dragTarget.value,
|
|
6609
|
-
dragTargetSelf: false,
|
|
6610
|
-
linePadding: 10,
|
|
6611
|
-
controlPadding: 10
|
|
6612
|
-
});
|
|
6613
|
-
moveable.on("drag", (e) => {
|
|
6614
|
-
e.target.style.transform = e.transform;
|
|
6615
|
-
});
|
|
6616
|
-
moveable.on("resize", (e) => {
|
|
6617
|
-
e.target.style.width = `${e.width}px`;
|
|
6618
|
-
e.target.style.height = `${e.height}px`;
|
|
6619
|
-
e.target.style.transform = e.drag.transform;
|
|
6620
|
-
});
|
|
6621
|
-
};
|
|
6622
|
-
const destroyMoveable = () => {
|
|
6623
|
-
moveable?.destroy();
|
|
6624
|
-
moveable = null;
|
|
6625
|
-
};
|
|
6626
|
-
vue.watch(
|
|
6627
|
-
() => props.visible,
|
|
6628
|
-
async (visible) => {
|
|
6629
|
-
if (visible) {
|
|
6630
|
-
await vue.nextTick();
|
|
6631
|
-
initMoveable();
|
|
6632
|
-
} else {
|
|
6633
|
-
destroyMoveable();
|
|
6634
|
-
}
|
|
6635
|
-
},
|
|
6636
|
-
{
|
|
6637
|
-
immediate: true
|
|
6638
|
-
}
|
|
6639
|
-
);
|
|
6640
|
-
vue.onBeforeUnmount(() => {
|
|
6641
|
-
destroyMoveable();
|
|
6642
|
-
});
|
|
6643
|
-
const closeHandler = () => {
|
|
6644
|
-
emit("update:visible", false);
|
|
6645
|
-
};
|
|
6646
|
-
__expose({
|
|
6647
|
-
target
|
|
6648
|
-
});
|
|
6649
|
-
return (_ctx, _cache) => {
|
|
6650
|
-
return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
6651
|
-
key: 0,
|
|
6652
|
-
to: "body"
|
|
6653
|
-
}, [
|
|
6654
|
-
vue.createElementVNode("div", {
|
|
6655
|
-
ref_key: "target",
|
|
6656
|
-
ref: target,
|
|
6657
|
-
class: "m-editor-float-box",
|
|
6658
|
-
style: vue.normalizeStyle(style.value)
|
|
6659
|
-
}, [
|
|
6660
|
-
vue.createElementVNode("div", {
|
|
6661
|
-
ref_key: "dragTarget",
|
|
6662
|
-
ref: dragTarget,
|
|
6663
|
-
class: "m-editor-float-box-title"
|
|
6664
|
-
}, [
|
|
6665
|
-
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
6666
|
-
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
|
|
6667
|
-
]),
|
|
6668
|
-
vue.createElementVNode("div", null, [
|
|
6669
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
6670
|
-
link: "",
|
|
6671
|
-
size: "small",
|
|
6672
|
-
icon: vue.unref(iconsVue.Close),
|
|
6673
|
-
onClick: closeHandler
|
|
6674
|
-
}, null, 8, ["icon"])
|
|
6675
|
-
])
|
|
6676
|
-
], 512),
|
|
6677
|
-
vue.createElementVNode("div", _hoisted_1$a, [
|
|
6678
|
-
vue.renderSlot(_ctx.$slots, "body")
|
|
6679
|
-
])
|
|
6680
|
-
], 4)
|
|
6681
|
-
])) : vue.createCommentVNode("", true);
|
|
6682
|
-
};
|
|
6683
|
-
}
|
|
6684
|
-
});
|
|
6685
|
-
|
|
6686
7089
|
const useFloatBox = (slideKeys) => {
|
|
6687
7090
|
const floatBoxStates = vue.ref(
|
|
6688
7091
|
slideKeys.value.reduce(
|
|
@@ -6700,33 +7103,33 @@
|
|
|
6700
7103
|
const showingBoxKeys = vue.computed(
|
|
6701
7104
|
() => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
|
|
6702
7105
|
);
|
|
6703
|
-
const
|
|
6704
|
-
const dragstartHandler = () =>
|
|
7106
|
+
const isDragging = vue.ref(false);
|
|
7107
|
+
const dragstartHandler = () => isDragging.value = true;
|
|
6705
7108
|
const dragendHandler = (key, e) => {
|
|
6706
7109
|
floatBoxStates.value[key] = {
|
|
6707
7110
|
left: e.clientX,
|
|
6708
7111
|
top: e.clientY,
|
|
6709
7112
|
status: true
|
|
6710
7113
|
};
|
|
6711
|
-
|
|
7114
|
+
isDragging.value = false;
|
|
6712
7115
|
};
|
|
6713
7116
|
document.body.addEventListener("dragover", (e) => {
|
|
6714
|
-
if (!
|
|
7117
|
+
if (!isDragging.value)
|
|
6715
7118
|
return;
|
|
6716
7119
|
e.preventDefault();
|
|
6717
7120
|
});
|
|
6718
7121
|
vue.watch(
|
|
6719
7122
|
() => slideKeys.value,
|
|
6720
|
-
() => {
|
|
6721
|
-
|
|
7123
|
+
(slideKeys2) => {
|
|
7124
|
+
slideKeys2.forEach((key) => {
|
|
6722
7125
|
if (floatBoxStates.value[key])
|
|
6723
|
-
|
|
7126
|
+
return;
|
|
6724
7127
|
floatBoxStates.value[key] = {
|
|
6725
7128
|
status: false,
|
|
6726
7129
|
top: 0,
|
|
6727
7130
|
left: 0
|
|
6728
7131
|
};
|
|
6729
|
-
}
|
|
7132
|
+
});
|
|
6730
7133
|
},
|
|
6731
7134
|
{
|
|
6732
7135
|
deep: true,
|
|
@@ -6866,7 +7269,7 @@
|
|
|
6866
7269
|
onContextmenu: nodeContentmenuHandler,
|
|
6867
7270
|
onMouseenter: mouseenterHandler
|
|
6868
7271
|
}, [
|
|
6869
|
-
vue.createVNode(_sfc_main$
|
|
7272
|
+
vue.createVNode(_sfc_main$N, {
|
|
6870
7273
|
class: "expand-icon",
|
|
6871
7274
|
style: vue.normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
|
|
6872
7275
|
icon: expanded.value ? vue.unref(iconsVue.ArrowDown) : vue.unref(iconsVue.ArrowRight),
|
|
@@ -7145,7 +7548,7 @@
|
|
|
7145
7548
|
placement: "bottom"
|
|
7146
7549
|
}, {
|
|
7147
7550
|
default: vue.withCtx(() => [
|
|
7148
|
-
vue.createVNode(_sfc_main$
|
|
7551
|
+
vue.createVNode(_sfc_main$N, {
|
|
7149
7552
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
7150
7553
|
class: "edit-icon",
|
|
7151
7554
|
onClick: vue.withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
@@ -7160,7 +7563,7 @@
|
|
|
7160
7563
|
placement: "bottom"
|
|
7161
7564
|
}, {
|
|
7162
7565
|
default: vue.withCtx(() => [
|
|
7163
|
-
vue.createVNode(_sfc_main$
|
|
7566
|
+
vue.createVNode(_sfc_main$N, {
|
|
7164
7567
|
icon: vue.unref(iconsVue.Close),
|
|
7165
7568
|
class: "edit-icon",
|
|
7166
7569
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
@@ -7237,7 +7640,7 @@
|
|
|
7237
7640
|
]),
|
|
7238
7641
|
_: 3
|
|
7239
7642
|
}),
|
|
7240
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7643
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
7241
7644
|
key: 0,
|
|
7242
7645
|
ref_key: "codeBlockEditor",
|
|
7243
7646
|
ref: codeBlockEditor,
|
|
@@ -7418,7 +7821,7 @@
|
|
|
7418
7821
|
placement: "bottom"
|
|
7419
7822
|
}, {
|
|
7420
7823
|
default: vue.withCtx(() => [
|
|
7421
|
-
vue.createVNode(_sfc_main$
|
|
7824
|
+
vue.createVNode(_sfc_main$N, {
|
|
7422
7825
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
7423
7826
|
class: "edit-icon",
|
|
7424
7827
|
onClick: vue.withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
@@ -7433,7 +7836,7 @@
|
|
|
7433
7836
|
placement: "bottom"
|
|
7434
7837
|
}, {
|
|
7435
7838
|
default: vue.withCtx(() => [
|
|
7436
|
-
vue.createVNode(_sfc_main$
|
|
7839
|
+
vue.createVNode(_sfc_main$N, {
|
|
7437
7840
|
icon: vue.unref(iconsVue.Close),
|
|
7438
7841
|
class: "edit-icon",
|
|
7439
7842
|
onClick: vue.withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
@@ -7535,7 +7938,7 @@
|
|
|
7535
7938
|
default: vue.withCtx(() => [
|
|
7536
7939
|
vue.createElementVNode("div", _hoisted_2$5, [
|
|
7537
7940
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
7538
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7941
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
7539
7942
|
data: {
|
|
7540
7943
|
type: "button",
|
|
7541
7944
|
text: item.text,
|
|
@@ -7704,7 +8107,7 @@
|
|
|
7704
8107
|
vue.renderSlot(_ctx.$slots, "title"),
|
|
7705
8108
|
vue.createElementVNode("div", null, [
|
|
7706
8109
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
7707
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8110
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
7708
8111
|
"event-type": "mouseup",
|
|
7709
8112
|
ref_for: true,
|
|
7710
8113
|
ref_key: "buttons",
|
|
@@ -7969,12 +8372,12 @@
|
|
|
7969
8372
|
};
|
|
7970
8373
|
return (_ctx, _cache) => {
|
|
7971
8374
|
return _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
7972
|
-
_ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8375
|
+
_ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
7973
8376
|
key: 0,
|
|
7974
8377
|
icon: vue.unref(iconsVue.Hide),
|
|
7975
8378
|
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
7976
8379
|
title: "点击显示"
|
|
7977
|
-
}, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8380
|
+
}, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
7978
8381
|
key: 1,
|
|
7979
8382
|
icon: vue.unref(iconsVue.View),
|
|
7980
8383
|
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -8615,7 +9018,7 @@
|
|
|
8615
9018
|
name: `${index}`
|
|
8616
9019
|
}, {
|
|
8617
9020
|
title: vue.withCtx(() => [
|
|
8618
|
-
vue.createVNode(_sfc_main$
|
|
9021
|
+
vue.createVNode(_sfc_main$N, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
8619
9022
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
8620
9023
|
]),
|
|
8621
9024
|
default: vue.withCtx(() => [
|
|
@@ -8636,7 +9039,7 @@
|
|
|
8636
9039
|
content: item.desc
|
|
8637
9040
|
}, {
|
|
8638
9041
|
default: vue.withCtx(() => [
|
|
8639
|
-
vue.createVNode(_sfc_main$
|
|
9042
|
+
vue.createVNode(_sfc_main$N, {
|
|
8640
9043
|
icon: item.icon
|
|
8641
9044
|
}, null, 8, ["icon"])
|
|
8642
9045
|
]),
|
|
@@ -8687,6 +9090,7 @@
|
|
|
8687
9090
|
setup(__props, { expose: __expose }) {
|
|
8688
9091
|
const props = __props;
|
|
8689
9092
|
const services = vue.inject("services");
|
|
9093
|
+
const columnLeftWitch = vue.computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
|
|
8690
9094
|
const activeTabName = vue.ref(props.data?.status);
|
|
8691
9095
|
const getItemConfig = (data) => {
|
|
8692
9096
|
const map = {
|
|
@@ -8716,7 +9120,12 @@
|
|
|
8716
9120
|
icon: iconsVue.EditPen,
|
|
8717
9121
|
text: "代码编辑",
|
|
8718
9122
|
component: _sfc_main$k,
|
|
8719
|
-
slots: {}
|
|
9123
|
+
slots: {},
|
|
9124
|
+
boxComponentConfig: {
|
|
9125
|
+
props: {
|
|
9126
|
+
slideType: "box"
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
8720
9129
|
},
|
|
8721
9130
|
"data-source": {
|
|
8722
9131
|
$key: "data-source",
|
|
@@ -8773,7 +9182,7 @@
|
|
|
8773
9182
|
(...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
|
|
8774
9183
|
onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
|
|
8775
9184
|
}, [
|
|
8776
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9185
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
8777
9186
|
key: 0,
|
|
8778
9187
|
icon: config.icon
|
|
8779
9188
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -8906,10 +9315,12 @@
|
|
|
8906
9315
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
8907
9316
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
8908
9317
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8909
|
-
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9318
|
+
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
|
|
8910
9319
|
key: config.$key ?? index,
|
|
8911
9320
|
visible: vue.unref(floatBoxStates)[config.$key].status,
|
|
8912
9321
|
"onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
|
|
9322
|
+
width: columnLeftWitch.value,
|
|
9323
|
+
height: 600,
|
|
8913
9324
|
title: config.text,
|
|
8914
9325
|
position: {
|
|
8915
9326
|
left: vue.unref(floatBoxStates)[config.$key].left,
|
|
@@ -8922,7 +9333,7 @@
|
|
|
8922
9333
|
])
|
|
8923
9334
|
]),
|
|
8924
9335
|
_: 2
|
|
8925
|
-
}, 1032, ["visible", "onUpdate:visible", "title", "position"])) : vue.createCommentVNode("", true)
|
|
9336
|
+
}, 1032, ["visible", "onUpdate:visible", "width", "title", "position"])) : vue.createCommentVNode("", true)
|
|
8926
9337
|
], 64);
|
|
8927
9338
|
}), 256))
|
|
8928
9339
|
]))
|
|
@@ -9275,15 +9686,27 @@
|
|
|
9275
9686
|
showRule: true,
|
|
9276
9687
|
propsPanelSize: "small",
|
|
9277
9688
|
showAddPageButton: true,
|
|
9278
|
-
|
|
9279
|
-
|
|
9689
|
+
hideSlideBar: false,
|
|
9690
|
+
navMenuRect: {
|
|
9691
|
+
left: 0,
|
|
9692
|
+
top: 0,
|
|
9693
|
+
width: 0,
|
|
9694
|
+
height: 0
|
|
9695
|
+
},
|
|
9696
|
+
frameworkRect: {
|
|
9697
|
+
width: 0,
|
|
9698
|
+
height: 0,
|
|
9699
|
+
left: 0,
|
|
9700
|
+
top: 0
|
|
9701
|
+
}
|
|
9280
9702
|
});
|
|
9703
|
+
const canUsePluginMethods$2 = {
|
|
9704
|
+
async: ["zoom", "calcZoom"],
|
|
9705
|
+
sync: []
|
|
9706
|
+
};
|
|
9281
9707
|
class Ui extends BaseService {
|
|
9282
9708
|
constructor() {
|
|
9283
|
-
super(
|
|
9284
|
-
{ name: "zoom", isAsync: true },
|
|
9285
|
-
{ name: "calcZoom", isAsync: true }
|
|
9286
|
-
]);
|
|
9709
|
+
super(canUsePluginMethods$2.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
9287
9710
|
}
|
|
9288
9711
|
set(name, value) {
|
|
9289
9712
|
const mask = editorService.get("stage")?.mask;
|
|
@@ -9321,19 +9744,6 @@
|
|
|
9321
9744
|
}
|
|
9322
9745
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
9323
9746
|
}
|
|
9324
|
-
async setFloatBox(keys) {
|
|
9325
|
-
const map = state.floatBox;
|
|
9326
|
-
for (const key of keys) {
|
|
9327
|
-
if (map.get(key))
|
|
9328
|
-
continue;
|
|
9329
|
-
map.set(key, {
|
|
9330
|
-
status: false,
|
|
9331
|
-
zIndex: 99,
|
|
9332
|
-
top: 0,
|
|
9333
|
-
left: 0
|
|
9334
|
-
});
|
|
9335
|
-
}
|
|
9336
|
-
}
|
|
9337
9747
|
resetState() {
|
|
9338
9748
|
this.set("showSrc", false);
|
|
9339
9749
|
this.set("uiSelectMode", false);
|
|
@@ -9348,6 +9758,9 @@
|
|
|
9348
9758
|
this.removeAllListeners();
|
|
9349
9759
|
this.removeAllPlugins();
|
|
9350
9760
|
}
|
|
9761
|
+
usePlugin(options) {
|
|
9762
|
+
super.usePlugin(options);
|
|
9763
|
+
}
|
|
9351
9764
|
async setStageRect(value) {
|
|
9352
9765
|
state.stageRect = {
|
|
9353
9766
|
...state.stageRect,
|
|
@@ -9539,7 +9952,7 @@
|
|
|
9539
9952
|
]),
|
|
9540
9953
|
_: 1
|
|
9541
9954
|
})) : vue.createCommentVNode("", true),
|
|
9542
|
-
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9955
|
+
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$Q, {
|
|
9543
9956
|
key: 1,
|
|
9544
9957
|
ref_key: "box",
|
|
9545
9958
|
ref: box,
|
|
@@ -10081,6 +10494,10 @@
|
|
|
10081
10494
|
}
|
|
10082
10495
|
});
|
|
10083
10496
|
|
|
10497
|
+
const canUsePluginMethods$1 = {
|
|
10498
|
+
async: ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"],
|
|
10499
|
+
sync: []
|
|
10500
|
+
};
|
|
10084
10501
|
class CodeBlock extends BaseService {
|
|
10085
10502
|
state = vue.reactive({
|
|
10086
10503
|
codeDsl: null,
|
|
@@ -10090,13 +10507,7 @@
|
|
|
10090
10507
|
paramsColConfig: void 0
|
|
10091
10508
|
});
|
|
10092
10509
|
constructor() {
|
|
10093
|
-
super(
|
|
10094
|
-
{ name: "setCodeDslById", isAsync: true },
|
|
10095
|
-
{ name: "setEditStatus", isAsync: true },
|
|
10096
|
-
{ name: "setCombineIds", isAsync: true },
|
|
10097
|
-
{ name: "setUndeleteableList", isAsync: true },
|
|
10098
|
-
{ name: "deleteCodeDslByIds", isAsync: true }
|
|
10099
|
-
]);
|
|
10510
|
+
super(canUsePluginMethods$1.async.map((methodName) => ({ name: methodName, isAsync: true })));
|
|
10100
10511
|
}
|
|
10101
10512
|
/**
|
|
10102
10513
|
* 设置活动的代码块dsl数据源
|
|
@@ -10269,6 +10680,9 @@
|
|
|
10269
10680
|
this.removeAllListeners();
|
|
10270
10681
|
this.removeAllPlugins();
|
|
10271
10682
|
}
|
|
10683
|
+
usePlugin(options) {
|
|
10684
|
+
super.usePlugin(options);
|
|
10685
|
+
}
|
|
10272
10686
|
}
|
|
10273
10687
|
const codeBlockService = new CodeBlock();
|
|
10274
10688
|
|
|
@@ -10324,10 +10738,10 @@
|
|
|
10324
10738
|
});
|
|
10325
10739
|
}
|
|
10326
10740
|
setEvent(type, events) {
|
|
10327
|
-
eventMap[type] = [...core.DEFAULT_EVENTS, ...events];
|
|
10741
|
+
eventMap[utils.toLine(type)] = [...core.DEFAULT_EVENTS, ...events];
|
|
10328
10742
|
}
|
|
10329
10743
|
getEvent(type) {
|
|
10330
|
-
return lodashEs.cloneDeep(eventMap[type] || core.DEFAULT_EVENTS);
|
|
10744
|
+
return lodashEs.cloneDeep(eventMap[utils.toLine(type)] || core.DEFAULT_EVENTS);
|
|
10331
10745
|
}
|
|
10332
10746
|
setMethods(methods) {
|
|
10333
10747
|
Object.keys(methods).forEach((type) => {
|
|
@@ -10335,10 +10749,10 @@
|
|
|
10335
10749
|
});
|
|
10336
10750
|
}
|
|
10337
10751
|
setMethod(type, method) {
|
|
10338
|
-
methodMap[type] = [...core.DEFAULT_METHODS, ...method];
|
|
10752
|
+
methodMap[utils.toLine(type)] = [...core.DEFAULT_METHODS, ...method];
|
|
10339
10753
|
}
|
|
10340
10754
|
getMethod(type) {
|
|
10341
|
-
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
10755
|
+
return lodashEs.cloneDeep(methodMap[utils.toLine(type)] || core.DEFAULT_METHODS);
|
|
10342
10756
|
}
|
|
10343
10757
|
resetState() {
|
|
10344
10758
|
eventMap = vue.reactive({});
|
|
@@ -10532,6 +10946,10 @@
|
|
|
10532
10946
|
}
|
|
10533
10947
|
const keybindingService = new Keybinding();
|
|
10534
10948
|
|
|
10949
|
+
const canUsePluginMethods = {
|
|
10950
|
+
async: [],
|
|
10951
|
+
sync: ["openOverlay", "closeOverlay", "updateOverlay", "createStage"]
|
|
10952
|
+
};
|
|
10535
10953
|
class StageOverlay extends BaseService {
|
|
10536
10954
|
state = vue.reactive({
|
|
10537
10955
|
wrapDiv: document.createElement("div"),
|
|
@@ -10544,12 +10962,7 @@
|
|
|
10544
10962
|
stageOverlayVisible: false
|
|
10545
10963
|
});
|
|
10546
10964
|
constructor() {
|
|
10547
|
-
super(
|
|
10548
|
-
{ name: "openOverlay", isAsync: false },
|
|
10549
|
-
{ name: "closeOverlay", isAsync: false },
|
|
10550
|
-
{ name: "updateOverlay", isAsync: false },
|
|
10551
|
-
{ name: "createStage", isAsync: false }
|
|
10552
|
-
]);
|
|
10965
|
+
super(canUsePluginMethods.sync.map((methodName) => ({ name: methodName, isAsync: false })));
|
|
10553
10966
|
this.get("wrapDiv").classList.add("tmagic-editor-sub-stage-wrap");
|
|
10554
10967
|
}
|
|
10555
10968
|
get(name) {
|
|
@@ -10616,6 +11029,9 @@
|
|
|
10616
11029
|
}
|
|
10617
11030
|
});
|
|
10618
11031
|
}
|
|
11032
|
+
usePlugin(options) {
|
|
11033
|
+
super.usePlugin(options);
|
|
11034
|
+
}
|
|
10619
11035
|
createContentEl() {
|
|
10620
11036
|
const sourceEl = this.get("sourceEl");
|
|
10621
11037
|
if (!sourceEl)
|
|
@@ -10656,7 +11072,7 @@
|
|
|
10656
11072
|
subStage?.renderer.contentWindow?.magic.onPageElUpdate(wrapDiv);
|
|
10657
11073
|
});
|
|
10658
11074
|
if (await stageOptions?.canSelect?.(contentEl)) {
|
|
10659
|
-
subStage?.select(contentEl);
|
|
11075
|
+
subStage?.select(contentEl.id);
|
|
10660
11076
|
}
|
|
10661
11077
|
}
|
|
10662
11078
|
updateHandler = () => {
|
|
@@ -11047,7 +11463,7 @@
|
|
|
11047
11463
|
name: "MEditor"
|
|
11048
11464
|
},
|
|
11049
11465
|
__name: "Editor",
|
|
11050
|
-
props: vue.mergeDefaults({
|
|
11466
|
+
props: /* @__PURE__ */ vue.mergeDefaults({
|
|
11051
11467
|
modelValue: {},
|
|
11052
11468
|
componentGroupList: {},
|
|
11053
11469
|
datasourceList: {},
|
|
@@ -11064,7 +11480,7 @@
|
|
|
11064
11480
|
datasourceValues: {},
|
|
11065
11481
|
datasourceConfigs: {},
|
|
11066
11482
|
datasourceEventMethodList: {},
|
|
11067
|
-
moveableOptions: { type: Function },
|
|
11483
|
+
moveableOptions: { type: [Object, Function] },
|
|
11068
11484
|
defaultSelected: {},
|
|
11069
11485
|
containerHighlightClassName: {},
|
|
11070
11486
|
containerHighlightDuration: {},
|
|
@@ -11128,13 +11544,13 @@
|
|
|
11128
11544
|
vue.provide("stageOptions", stageOptions);
|
|
11129
11545
|
__expose(services);
|
|
11130
11546
|
return (_ctx, _cache) => {
|
|
11131
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
11547
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11132
11548
|
header: vue.withCtx(() => [
|
|
11133
11549
|
vue.renderSlot(_ctx.$slots, "header")
|
|
11134
11550
|
]),
|
|
11135
11551
|
nav: vue.withCtx(() => [
|
|
11136
11552
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
|
|
11137
|
-
vue.createVNode(_sfc_main$
|
|
11553
|
+
vue.createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
|
|
11138
11554
|
])
|
|
11139
11555
|
]),
|
|
11140
11556
|
"content-before": vue.withCtx(() => [
|
|
@@ -11209,7 +11625,7 @@
|
|
|
11209
11625
|
]),
|
|
11210
11626
|
"props-panel": vue.withCtx(() => [
|
|
11211
11627
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11212
|
-
vue.createVNode(_sfc_main$
|
|
11628
|
+
vue.createVNode(_sfc_main$p, {
|
|
11213
11629
|
"extend-state": _ctx.extendFormState,
|
|
11214
11630
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11215
11631
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
@@ -11255,23 +11671,23 @@
|
|
|
11255
11671
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
11256
11672
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
11257
11673
|
setConfig(option);
|
|
11258
|
-
app.component(_sfc_main.name
|
|
11259
|
-
app.component("
|
|
11674
|
+
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11675
|
+
app.component("magic-code-editor", _sfc_main$U);
|
|
11676
|
+
app.component("m-fields-ui-select", _sfc_main$A);
|
|
11260
11677
|
app.component("m-fields-code-link", _sfc_main$S);
|
|
11261
11678
|
app.component("m-fields-vs-code", _sfc_main$T);
|
|
11262
|
-
app.component("magic-code-editor", _sfc_main$U);
|
|
11263
11679
|
app.component("m-fields-code-select", _sfc_main$R);
|
|
11264
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
11265
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11266
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
11267
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11268
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11269
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11270
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11271
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11272
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11273
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11274
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11680
|
+
app.component("m-fields-code-select-col", _sfc_main$M);
|
|
11681
|
+
app.component("m-fields-event-select", _sfc_main$E);
|
|
11682
|
+
app.component("m-fields-data-source-fields", _sfc_main$L);
|
|
11683
|
+
app.component("m-fields-data-source-mocks", _sfc_main$G);
|
|
11684
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
11685
|
+
app.component("m-fields-data-source-input", _sfc_main$J);
|
|
11686
|
+
app.component("m-fields-data-source-select", _sfc_main$F);
|
|
11687
|
+
app.component("m-fields-data-source-methods", _sfc_main$I);
|
|
11688
|
+
app.component("m-fields-data-source-method-select", _sfc_main$H);
|
|
11689
|
+
app.component("m-fields-data-source-field-select", _sfc_main$K);
|
|
11690
|
+
app.component("m-fields-page-fragment-select", _sfc_main$B);
|
|
11275
11691
|
}
|
|
11276
11692
|
};
|
|
11277
11693
|
|
|
@@ -11281,42 +11697,42 @@
|
|
|
11281
11697
|
});
|
|
11282
11698
|
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
11283
11699
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
11284
|
-
exports.CodeBlockEditor = _sfc_main$
|
|
11700
|
+
exports.CodeBlockEditor = _sfc_main$P;
|
|
11285
11701
|
exports.CodeBlockList = _sfc_main$l;
|
|
11286
11702
|
exports.CodeBlockListPanel = _sfc_main$k;
|
|
11287
11703
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
11288
11704
|
exports.CodeSelect = _sfc_main$R;
|
|
11289
|
-
exports.CodeSelectCol = _sfc_main$
|
|
11705
|
+
exports.CodeSelectCol = _sfc_main$M;
|
|
11290
11706
|
exports.ColumnLayout = ColumnLayout;
|
|
11291
11707
|
exports.ComponentListPanel = _sfc_main$b;
|
|
11292
11708
|
exports.ContentMenu = _sfc_main$g;
|
|
11293
11709
|
exports.DataSourceConfigPanel = _sfc_main$j;
|
|
11294
|
-
exports.DataSourceFieldSelect = _sfc_main$
|
|
11295
|
-
exports.DataSourceFields = _sfc_main$
|
|
11296
|
-
exports.DataSourceInput = _sfc_main$
|
|
11297
|
-
exports.DataSourceMethodSelect = _sfc_main$
|
|
11298
|
-
exports.DataSourceMethods = _sfc_main$
|
|
11299
|
-
exports.DataSourceMocks = _sfc_main$
|
|
11300
|
-
exports.DataSourceSelect = _sfc_main$
|
|
11710
|
+
exports.DataSourceFieldSelect = _sfc_main$K;
|
|
11711
|
+
exports.DataSourceFields = _sfc_main$L;
|
|
11712
|
+
exports.DataSourceInput = _sfc_main$J;
|
|
11713
|
+
exports.DataSourceMethodSelect = _sfc_main$H;
|
|
11714
|
+
exports.DataSourceMethods = _sfc_main$I;
|
|
11715
|
+
exports.DataSourceMocks = _sfc_main$G;
|
|
11716
|
+
exports.DataSourceSelect = _sfc_main$F;
|
|
11301
11717
|
exports.DragType = DragType;
|
|
11302
|
-
exports.EventSelect = _sfc_main$
|
|
11718
|
+
exports.EventSelect = _sfc_main$E;
|
|
11303
11719
|
exports.Fixed2Other = Fixed2Other;
|
|
11304
11720
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
11305
|
-
exports.Icon = _sfc_main$
|
|
11721
|
+
exports.Icon = _sfc_main$N;
|
|
11306
11722
|
exports.KeyBindingCommand = KeyBindingCommand;
|
|
11307
|
-
exports.KeyValue = _sfc_main$
|
|
11723
|
+
exports.KeyValue = _sfc_main$C;
|
|
11308
11724
|
exports.Keys = Keys;
|
|
11309
11725
|
exports.LayerOffset = LayerOffset;
|
|
11310
11726
|
exports.LayerPanel = _sfc_main$c;
|
|
11311
11727
|
exports.Layout = Layout;
|
|
11312
|
-
exports.LayoutContainer = _sfc_main$
|
|
11313
|
-
exports.PageFragmentSelect = _sfc_main$
|
|
11314
|
-
exports.PropsPanel = _sfc_main$
|
|
11315
|
-
exports.Resizer = _sfc_main$
|
|
11316
|
-
exports.SplitView = _sfc_main$
|
|
11728
|
+
exports.LayoutContainer = _sfc_main$y;
|
|
11729
|
+
exports.PageFragmentSelect = _sfc_main$B;
|
|
11730
|
+
exports.PropsPanel = _sfc_main$p;
|
|
11731
|
+
exports.Resizer = _sfc_main$z;
|
|
11732
|
+
exports.SplitView = _sfc_main$y;
|
|
11317
11733
|
exports.TMagicCodeEditor = _sfc_main$U;
|
|
11318
11734
|
exports.TMagicEditor = _sfc_main;
|
|
11319
|
-
exports.ToolButton = _sfc_main$
|
|
11735
|
+
exports.ToolButton = _sfc_main$x;
|
|
11320
11736
|
exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
|
|
11321
11737
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
11322
11738
|
exports.advancedTabConfig = advancedTabConfig;
|
|
@@ -11367,8 +11783,10 @@
|
|
|
11367
11783
|
exports.uiService = uiService;
|
|
11368
11784
|
exports.useCodeBlockEdit = useCodeBlockEdit;
|
|
11369
11785
|
exports.useDataSourceMethod = useDataSourceMethod;
|
|
11786
|
+
exports.useEditorContentHeight = useEditorContentHeight;
|
|
11370
11787
|
exports.useFloatBox = useFloatBox;
|
|
11371
11788
|
exports.useStage = useStage;
|
|
11789
|
+
exports.useWindowRect = useWindowRect;
|
|
11372
11790
|
exports.warn = warn;
|
|
11373
11791
|
|
|
11374
11792
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|