@tmagic/editor 1.5.0-beta.9 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{style.css → tmagic-editor.css} +228 -22
- package/dist/tmagic-editor.js +1670 -1012
- package/dist/tmagic-editor.umd.cjs +1705 -1048
- package/package.json +14 -12
- package/src/Editor.vue +24 -6
- package/src/components/CodeBlockEditor.vue +14 -8
- package/src/components/CodeParams.vue +5 -5
- package/src/components/ContentMenu.vue +18 -18
- package/src/components/FloatingBox.vue +3 -3
- package/src/components/Resizer.vue +4 -4
- package/src/components/ScrollBar.vue +3 -3
- package/src/components/ScrollViewer.vue +3 -3
- package/src/components/SplitView.vue +2 -2
- package/src/components/ToolButton.vue +2 -1
- package/src/editorProps.ts +6 -2
- package/src/fields/Code.vue +1 -2
- package/src/fields/CodeSelect.vue +13 -11
- package/src/fields/CodeSelectCol.vue +32 -5
- package/src/fields/CondOpSelect.vue +5 -2
- package/src/fields/DataSourceFields.vue +31 -12
- package/src/fields/DataSourceInput.vue +2 -2
- package/src/fields/DataSourceMethods.vue +72 -14
- package/src/fields/DataSourceMocks.vue +0 -1
- package/src/fields/DisplayConds.vue +8 -3
- package/src/fields/EventSelect.vue +28 -12
- package/src/fields/KeyValue.vue +17 -12
- package/src/fields/UISelect.vue +6 -3
- package/src/hooks/index.ts +0 -1
- package/src/hooks/use-code-block-edit.ts +3 -3
- package/src/hooks/use-data-source-edit.ts +3 -2
- package/src/hooks/use-filter.ts +1 -1
- package/src/hooks/use-getso.ts +7 -7
- package/src/hooks/use-node-status.ts +2 -2
- package/src/index.ts +2 -1
- package/src/initService.ts +177 -74
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +13 -12
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/page-bar/AddButton.vue +29 -9
- package/src/layouts/page-bar/PageBar.vue +79 -66
- package/src/layouts/page-bar/PageBarScrollContainer.vue +84 -98
- package/src/layouts/page-bar/PageList.vue +5 -3
- package/src/layouts/page-bar/Search.vue +67 -0
- package/src/layouts/props-panel/FormPanel.vue +123 -0
- package/src/layouts/props-panel/PropsPanel.vue +146 -0
- package/src/layouts/props-panel/use-style-panel.ts +29 -0
- package/src/layouts/sidebar/Sidebar.vue +7 -1
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +18 -2
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +35 -4
- package/src/layouts/sidebar/code-block/useContentMenu.ts +83 -0
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +7 -5
- package/src/layouts/sidebar/data-source/DataSourceList.vue +13 -8
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +40 -4
- package/src/layouts/sidebar/data-source/useContentMenu.ts +81 -0
- package/src/layouts/sidebar/layer/LayerMenu.vue +7 -13
- package/src/layouts/sidebar/layer/LayerPanel.vue +11 -4
- package/src/layouts/sidebar/layer/use-click.ts +2 -2
- package/src/layouts/sidebar/layer/use-keybinding.ts +2 -2
- package/src/layouts/sidebar/layer/use-node-status.ts +2 -3
- package/src/layouts/workspace/Workspace.vue +13 -3
- package/src/layouts/workspace/viewer/NodeListMenu.vue +3 -3
- package/src/layouts/workspace/viewer/Stage.vue +41 -11
- package/src/layouts/workspace/viewer/StageOverlay.vue +2 -2
- package/src/layouts/workspace/viewer/ViewerMenu.vue +4 -6
- package/src/services/dataSource.ts +12 -5
- package/src/services/dep.ts +61 -13
- package/src/services/editor.ts +46 -51
- package/src/services/storage.ts +2 -1
- package/src/services/ui.ts +1 -0
- package/src/theme/common/var.scss +12 -10
- package/src/theme/component-list-panel.scss +9 -7
- package/src/theme/content-menu.scss +7 -5
- package/src/theme/data-source.scss +3 -1
- package/src/theme/floating-box.scss +4 -2
- package/src/theme/framework.scss +7 -5
- package/src/theme/index.scss +4 -5
- package/src/theme/key-value.scss +2 -2
- package/src/theme/layer-panel.scss +3 -1
- package/src/theme/layout.scss +1 -1
- package/src/theme/nav-menu.scss +7 -5
- package/src/theme/page-bar.scss +51 -27
- package/src/theme/props-panel.scss +81 -1
- package/src/theme/resizer.scss +1 -1
- package/src/theme/search-input.scss +1 -0
- package/src/theme/sidebar.scss +4 -2
- package/src/theme/stage.scss +3 -1
- package/src/theme/theme.scss +28 -28
- package/src/theme/tree.scss +14 -12
- package/src/type.ts +10 -1
- package/src/utils/content-menu.ts +2 -2
- package/src/utils/data-source/formConfigs/http.ts +2 -0
- package/src/utils/data-source/index.ts +2 -2
- package/src/utils/editor.ts +78 -22
- package/src/utils/idle-task.ts +36 -4
- package/src/utils/props.ts +48 -6
- package/types/index.d.ts +2312 -2080
- package/src/hooks/use-data-source-method.ts +0 -100
- package/src/layouts/PropsPanel.vue +0 -131
- package/src/layouts/page-bar/SwitchTypeButton.vue +0 -45
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tmagic/design'), require('@tmagic/form'), require('@tmagic/table'), require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable'), require('@tmagic/stage'), require('events'), require('gesto'), require('sortablejs'), require('keycon')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tmagic/design', '@tmagic/form', '@tmagic/table', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', 'emmet-monaco-es', 'monaco-editor', '@tmagic/core', '@tmagic/utils', 'moveable', '@tmagic/stage', 'events', 'gesto', 'sortablejs', 'keycon'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.designPlugin, global.formPlugin, global.tablePlugin, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.emmetMonacoEs, global.monaco, global.core, global.utils, global.VanillaMoveable, global.StageCore, global.events, global.Gesto, global.Sortable, global.KeyController));
|
|
5
|
-
})(this, (function (exports, designPlugin, formPlugin, tablePlugin, vue, iconsVue, lodashEs, serialize, emmetMonacoEs, monaco, core, utils, VanillaMoveable, StageCore, events, Gesto, Sortable, KeyController) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tmagic/design'), require('@tmagic/form'), require('@tmagic/table'), require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable'), require('@tmagic/stage'), require('events'), require('gesto'), require('deep-object-diff'), require('sortablejs'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tmagic/design', '@tmagic/form', '@tmagic/table', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', 'emmet-monaco-es', 'monaco-editor', '@tmagic/core', '@tmagic/utils', 'moveable', '@tmagic/stage', 'events', 'gesto', 'deep-object-diff', 'sortablejs', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.designPlugin, global.formPlugin, global.tablePlugin, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.emmetMonacoEs, global.monaco, global.core, global.utils, global.VanillaMoveable, global.StageCore, global.events, global.Gesto, global.deepObjectDiff, global.Sortable, global.KeyController));
|
|
5
|
+
})(this, (function (exports, designPlugin, formPlugin, tablePlugin, vue, iconsVue, lodashEs, serialize, emmetMonacoEs, monaco, core, utils, VanillaMoveable, StageCore, events, Gesto, deepObjectDiff, Sortable, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
25
25
|
|
|
26
|
-
const _hoisted_1$
|
|
27
|
-
const _sfc_main$
|
|
26
|
+
const _hoisted_1$y = ["src"];
|
|
27
|
+
const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
28
28
|
...{
|
|
29
29
|
name: "MEditorIcon"
|
|
30
30
|
},
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
class: "magic-editor-icon"
|
|
49
49
|
}, {
|
|
50
50
|
default: vue.withCtx(() => [
|
|
51
|
-
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
51
|
+
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$y)
|
|
52
52
|
]),
|
|
53
53
|
_: 1
|
|
54
54
|
})) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
emmetMonacoEs.emmetHTML(monaco__namespace);
|
|
77
77
|
emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
|
|
78
78
|
|
|
79
|
-
const _hoisted_1$
|
|
79
|
+
const _hoisted_1$x = {
|
|
80
80
|
class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
|
|
81
81
|
};
|
|
82
|
-
const _sfc_main$
|
|
82
|
+
const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
|
|
83
83
|
...{
|
|
84
84
|
name: "MEditorCodeEditor"
|
|
85
85
|
},
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
let vsDiffEditor = null;
|
|
133
133
|
const values = vue.ref("");
|
|
134
134
|
const loading = vue.ref(false);
|
|
135
|
-
const codeEditor = vue.
|
|
135
|
+
const codeEditor = vue.useTemplateRef("codeEditor");
|
|
136
136
|
const resizeObserver = new globalThis.ResizeObserver(
|
|
137
137
|
lodashEs.throttle(() => {
|
|
138
138
|
vsEditor?.layout();
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
return (_ctx, _cache) => {
|
|
239
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
239
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$x, [
|
|
240
240
|
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
241
241
|
to: "body",
|
|
242
242
|
disabled: !fullScreen.value
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
onClick: fullScreenHandler
|
|
253
253
|
}, {
|
|
254
254
|
default: vue.withCtx(() => [
|
|
255
|
-
vue.createVNode(_sfc_main$
|
|
255
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.FullScreen) }, null, 8, ["icon"])
|
|
256
256
|
]),
|
|
257
257
|
_: 1
|
|
258
258
|
}),
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
|
|
271
|
-
const _sfc_main$
|
|
271
|
+
const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
272
272
|
...{
|
|
273
273
|
name: "MFieldsVsCode"
|
|
274
274
|
},
|
|
@@ -287,13 +287,11 @@
|
|
|
287
287
|
emits: ["change"],
|
|
288
288
|
setup(__props, { emit: __emit }) {
|
|
289
289
|
const emit = __emit;
|
|
290
|
-
const props = __props;
|
|
291
290
|
const save = (v) => {
|
|
292
|
-
props.model[props.name] = v;
|
|
293
291
|
emit("change", v);
|
|
294
292
|
};
|
|
295
293
|
return (_ctx, _cache) => {
|
|
296
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
294
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$Y, {
|
|
297
295
|
height: _ctx.config.height,
|
|
298
296
|
"init-values": _ctx.model[_ctx.name],
|
|
299
297
|
language: _ctx.config.language,
|
|
@@ -308,7 +306,7 @@
|
|
|
308
306
|
}
|
|
309
307
|
});
|
|
310
308
|
|
|
311
|
-
const _sfc_main$
|
|
309
|
+
const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
|
|
312
310
|
...{
|
|
313
311
|
name: "MFieldsCodeLink"
|
|
314
312
|
},
|
|
@@ -387,7 +385,7 @@
|
|
|
387
385
|
}
|
|
388
386
|
});
|
|
389
387
|
|
|
390
|
-
const _sfc_main$
|
|
388
|
+
const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
|
|
391
389
|
...{
|
|
392
390
|
name: "MFieldsCodeSelect"
|
|
393
391
|
},
|
|
@@ -439,11 +437,13 @@
|
|
|
439
437
|
{ value: core.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
|
|
440
438
|
],
|
|
441
439
|
defaultValue: "code",
|
|
442
|
-
onChange: (mForm, v, { model }) => {
|
|
440
|
+
onChange: (mForm, v, { model, prop, changeRecords }) => {
|
|
443
441
|
if (v === core.HookCodeType.DATA_SOURCE_METHOD) {
|
|
444
442
|
model.codeId = [];
|
|
443
|
+
changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: [] });
|
|
445
444
|
} else {
|
|
446
445
|
model.codeId = "";
|
|
446
|
+
changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: "" });
|
|
447
447
|
}
|
|
448
448
|
return v;
|
|
449
449
|
}
|
|
@@ -482,9 +482,7 @@
|
|
|
482
482
|
immediate: true
|
|
483
483
|
}
|
|
484
484
|
);
|
|
485
|
-
const changeHandler =
|
|
486
|
-
emit("change", props.model[props.name]);
|
|
487
|
-
};
|
|
485
|
+
const changeHandler = (v, eventData) => emit("change", v, eventData);
|
|
488
486
|
return (_ctx, _cache) => {
|
|
489
487
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
490
488
|
class: vue.normalizeClass(["m-fields-code-select", _ctx.config.className])
|
|
@@ -526,6 +524,7 @@
|
|
|
526
524
|
];
|
|
527
525
|
const styleTabConfig = {
|
|
528
526
|
title: "样式",
|
|
527
|
+
display: ({ services }) => !(services.uiService.get("showStylePanel") ?? true),
|
|
529
528
|
items: [
|
|
530
529
|
{
|
|
531
530
|
name: "style",
|
|
@@ -538,6 +537,7 @@
|
|
|
538
537
|
type: "data-source-field-select",
|
|
539
538
|
name: "position",
|
|
540
539
|
text: "固定定位",
|
|
540
|
+
labelPosition: "left",
|
|
541
541
|
checkStrictly: false,
|
|
542
542
|
dataSourceFieldType: ["string"],
|
|
543
543
|
fieldConfig: {
|
|
@@ -566,7 +566,7 @@
|
|
|
566
566
|
fieldConfig: {
|
|
567
567
|
type: "text"
|
|
568
568
|
},
|
|
569
|
-
disabled: (
|
|
569
|
+
disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
|
|
570
570
|
},
|
|
571
571
|
{
|
|
572
572
|
type: "data-source-field-select",
|
|
@@ -587,7 +587,7 @@
|
|
|
587
587
|
fieldConfig: {
|
|
588
588
|
type: "text"
|
|
589
589
|
},
|
|
590
|
-
disabled: (
|
|
590
|
+
disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
|
|
591
591
|
}
|
|
592
592
|
]
|
|
593
593
|
},
|
|
@@ -595,6 +595,27 @@
|
|
|
595
595
|
type: "fieldset",
|
|
596
596
|
legend: "盒子",
|
|
597
597
|
items: [
|
|
598
|
+
{
|
|
599
|
+
type: "data-source-field-select",
|
|
600
|
+
name: "display",
|
|
601
|
+
text: "display",
|
|
602
|
+
checkStrictly: false,
|
|
603
|
+
dataSourceFieldType: ["string"],
|
|
604
|
+
fieldConfig: {
|
|
605
|
+
type: "select",
|
|
606
|
+
clearable: true,
|
|
607
|
+
allowCreate: true,
|
|
608
|
+
options: [
|
|
609
|
+
{ text: "block", value: "block" },
|
|
610
|
+
{ text: "flex", value: "flex" },
|
|
611
|
+
{ text: "none", value: "none" },
|
|
612
|
+
{ text: "inline-block", value: "inline-block" },
|
|
613
|
+
{ text: "grid", value: "grid" },
|
|
614
|
+
{ text: "inline", value: "inline" },
|
|
615
|
+
{ text: "initial", value: "initial" }
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
},
|
|
598
619
|
{
|
|
599
620
|
type: "data-source-field-select",
|
|
600
621
|
name: "width",
|
|
@@ -623,13 +644,16 @@
|
|
|
623
644
|
dataSourceFieldType: ["string"],
|
|
624
645
|
fieldConfig: {
|
|
625
646
|
type: "select",
|
|
647
|
+
clearable: true,
|
|
648
|
+
allowCreate: true,
|
|
626
649
|
options: [
|
|
627
650
|
{ text: "visible", value: "visible" },
|
|
628
651
|
{ text: "hidden", value: "hidden" },
|
|
629
652
|
{ text: "clip", value: "clip" },
|
|
630
653
|
{ text: "scroll", value: "scroll" },
|
|
631
654
|
{ text: "auto", value: "auto" },
|
|
632
|
-
{ text: "overlay", value: "overlay" }
|
|
655
|
+
{ text: "overlay", value: "overlay" },
|
|
656
|
+
{ text: "initial", value: "initial" }
|
|
633
657
|
]
|
|
634
658
|
}
|
|
635
659
|
}
|
|
@@ -696,7 +720,7 @@
|
|
|
696
720
|
checkStrictly: false,
|
|
697
721
|
dataSourceFieldType: ["string"],
|
|
698
722
|
fieldConfig: {
|
|
699
|
-
type: "
|
|
723
|
+
type: "img-upload"
|
|
700
724
|
}
|
|
701
725
|
},
|
|
702
726
|
{
|
|
@@ -825,18 +849,20 @@
|
|
|
825
849
|
{
|
|
826
850
|
name: "created",
|
|
827
851
|
text: "created",
|
|
852
|
+
labelPosition: "top",
|
|
828
853
|
type: "code-select"
|
|
829
854
|
},
|
|
830
855
|
{
|
|
831
856
|
name: "mounted",
|
|
832
857
|
text: "mounted",
|
|
858
|
+
labelPosition: "top",
|
|
833
859
|
type: "code-select"
|
|
834
860
|
}
|
|
835
861
|
]
|
|
836
862
|
};
|
|
837
863
|
const displayTabConfig = {
|
|
838
864
|
title: "显示条件",
|
|
839
|
-
display: (
|
|
865
|
+
display: (_vm, { model }) => model.type !== "page",
|
|
840
866
|
items: [
|
|
841
867
|
{
|
|
842
868
|
type: "display-conds",
|
|
@@ -863,8 +889,21 @@
|
|
|
863
889
|
// 组件id,必须要有
|
|
864
890
|
{
|
|
865
891
|
name: "id",
|
|
866
|
-
|
|
867
|
-
|
|
892
|
+
text: "ID",
|
|
893
|
+
type: "text",
|
|
894
|
+
disabled: true,
|
|
895
|
+
append: {
|
|
896
|
+
type: "button",
|
|
897
|
+
text: "复制",
|
|
898
|
+
handler: async (vm, { model }) => {
|
|
899
|
+
try {
|
|
900
|
+
await navigator.clipboard.writeText(`${model.id}`);
|
|
901
|
+
designPlugin.tMagicMessage.success("已复制");
|
|
902
|
+
} catch (err) {
|
|
903
|
+
designPlugin.tMagicMessage.error("复制失败");
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
868
907
|
},
|
|
869
908
|
{
|
|
870
909
|
name: "name",
|
|
@@ -1144,15 +1183,6 @@
|
|
|
1144
1183
|
space: 2,
|
|
1145
1184
|
unsafe: true
|
|
1146
1185
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1147
|
-
const traverseNode = (node, cb, parents = []) => {
|
|
1148
|
-
cb(node, parents);
|
|
1149
|
-
if (Array.isArray(node.items) && node.items.length) {
|
|
1150
|
-
parents.push(node);
|
|
1151
|
-
node.items.forEach((item) => {
|
|
1152
|
-
traverseNode(item, cb, [...parents]);
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
1186
|
const moveItemsInContainer = (sourceIndices, parent, targetIndex) => {
|
|
1157
1187
|
sourceIndices.sort((a, b) => a - b);
|
|
1158
1188
|
for (let i = sourceIndices.length - 1; i >= 0; i--) {
|
|
@@ -1169,6 +1199,55 @@
|
|
|
1169
1199
|
}
|
|
1170
1200
|
}
|
|
1171
1201
|
};
|
|
1202
|
+
const isIncludeDataSourceByDiffAddResult = (diffResult) => {
|
|
1203
|
+
for (const value of Object.values(diffResult)) {
|
|
1204
|
+
const result = utils.isValueIncludeDataSource(value);
|
|
1205
|
+
if (result) {
|
|
1206
|
+
return true;
|
|
1207
|
+
}
|
|
1208
|
+
if (lodashEs.isObject(value)) {
|
|
1209
|
+
return isIncludeDataSourceByDiffAddResult(value);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return false;
|
|
1213
|
+
};
|
|
1214
|
+
const isIncludeDataSourceByDiffUpdatedResult = (diffResult, oldNode) => {
|
|
1215
|
+
for (const [key, value] of Object.entries(diffResult)) {
|
|
1216
|
+
if (utils.isValueIncludeDataSource(value)) {
|
|
1217
|
+
return true;
|
|
1218
|
+
}
|
|
1219
|
+
if (utils.isValueIncludeDataSource(oldNode[key])) {
|
|
1220
|
+
return true;
|
|
1221
|
+
}
|
|
1222
|
+
if (lodashEs.isObject(value)) {
|
|
1223
|
+
return isIncludeDataSourceByDiffUpdatedResult(value, oldNode[key]);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return false;
|
|
1227
|
+
};
|
|
1228
|
+
const isIncludeDataSource = (node, oldNode) => {
|
|
1229
|
+
const diffResult = deepObjectDiff.detailedDiff(oldNode, node);
|
|
1230
|
+
let isIncludeDataSource2 = false;
|
|
1231
|
+
if (diffResult.updated) {
|
|
1232
|
+
if (diffResult.updated[core.NODE_CONDS_KEY]) {
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffUpdatedResult(diffResult.updated, oldNode);
|
|
1236
|
+
if (isIncludeDataSource2) return true;
|
|
1237
|
+
}
|
|
1238
|
+
if (diffResult.added) {
|
|
1239
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.added);
|
|
1240
|
+
if (isIncludeDataSource2) return true;
|
|
1241
|
+
}
|
|
1242
|
+
if (diffResult.deleted) {
|
|
1243
|
+
if (diffResult.deleted[core.NODE_CONDS_KEY]) {
|
|
1244
|
+
return true;
|
|
1245
|
+
}
|
|
1246
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.deleted);
|
|
1247
|
+
if (isIncludeDataSource2) return true;
|
|
1248
|
+
}
|
|
1249
|
+
return isIncludeDataSource2;
|
|
1250
|
+
};
|
|
1172
1251
|
|
|
1173
1252
|
const compose = (middleware, isAsync) => {
|
|
1174
1253
|
if (!Array.isArray(middleware)) throw new TypeError("Middleware 必须是一个数组!");
|
|
@@ -1715,7 +1794,8 @@
|
|
|
1715
1794
|
case "number" /* NUMBER */:
|
|
1716
1795
|
return Number(item);
|
|
1717
1796
|
case "boolean" /* BOOLEAN */:
|
|
1718
|
-
|
|
1797
|
+
if (item === "true") return true;
|
|
1798
|
+
if (item === "false") return false;
|
|
1719
1799
|
default:
|
|
1720
1800
|
return item;
|
|
1721
1801
|
}
|
|
@@ -1874,28 +1954,7 @@
|
|
|
1874
1954
|
if (raw) {
|
|
1875
1955
|
root = vue.toRaw(root);
|
|
1876
1956
|
}
|
|
1877
|
-
|
|
1878
|
-
node: null,
|
|
1879
|
-
parent: null,
|
|
1880
|
-
page: null
|
|
1881
|
-
};
|
|
1882
|
-
if (!root) return info;
|
|
1883
|
-
if (id === root.id) {
|
|
1884
|
-
info.node = root;
|
|
1885
|
-
return info;
|
|
1886
|
-
}
|
|
1887
|
-
const path = utils.getNodePath(id, root.items);
|
|
1888
|
-
if (!path.length) return info;
|
|
1889
|
-
path.unshift(root);
|
|
1890
|
-
info.node = path[path.length - 1];
|
|
1891
|
-
info.parent = path[path.length - 2];
|
|
1892
|
-
path.forEach((item) => {
|
|
1893
|
-
if (utils.isPage(item) || utils.isPageFragment(item)) {
|
|
1894
|
-
info.page = item;
|
|
1895
|
-
return;
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1898
|
-
return info;
|
|
1957
|
+
return utils.getNodeInfo(id, root);
|
|
1899
1958
|
}
|
|
1900
1959
|
/**
|
|
1901
1960
|
* 根据ID获取指点节点配置
|
|
@@ -2116,10 +2175,10 @@
|
|
|
2116
2175
|
const rootItems = root.items || [];
|
|
2117
2176
|
if (utils.isPage(node)) {
|
|
2118
2177
|
this.state.pageLength -= 1;
|
|
2119
|
-
await selectDefault(
|
|
2178
|
+
await selectDefault(rootItems);
|
|
2120
2179
|
} else if (utils.isPageFragment(node)) {
|
|
2121
2180
|
this.state.pageFragmentLength -= 1;
|
|
2122
|
-
await selectDefault(
|
|
2181
|
+
await selectDefault(rootItems);
|
|
2123
2182
|
} else {
|
|
2124
2183
|
await this.select(parent);
|
|
2125
2184
|
stage?.select(parent.id);
|
|
@@ -2142,13 +2201,13 @@
|
|
|
2142
2201
|
}
|
|
2143
2202
|
this.emit("remove", nodes);
|
|
2144
2203
|
}
|
|
2145
|
-
async doUpdate(config) {
|
|
2204
|
+
async doUpdate(config, { changeRecords = [] } = {}) {
|
|
2146
2205
|
const root = this.get("root");
|
|
2147
2206
|
if (!root) throw new Error("root为空");
|
|
2148
2207
|
if (!config?.id) throw new Error("没有配置或者配置缺少id值");
|
|
2149
2208
|
const info = this.getNodeInfo(config.id, false);
|
|
2150
2209
|
if (!info.node) throw new Error(`获取不到id为${config.id}的节点`);
|
|
2151
|
-
const node =
|
|
2210
|
+
const node = vue.toRaw(info.node);
|
|
2152
2211
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
|
|
2153
2212
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue, key) => {
|
|
2154
2213
|
if (typeof srcValue === "undefined" && Object.hasOwn(newConfig, key)) {
|
|
@@ -2164,7 +2223,11 @@
|
|
|
2164
2223
|
if (!newConfig.type) throw new Error("配置缺少type值");
|
|
2165
2224
|
if (newConfig.type === core.NodeType.ROOT) {
|
|
2166
2225
|
this.set("root", newConfig);
|
|
2167
|
-
return
|
|
2226
|
+
return {
|
|
2227
|
+
oldNode: node,
|
|
2228
|
+
newNode: newConfig,
|
|
2229
|
+
changeRecords
|
|
2230
|
+
};
|
|
2168
2231
|
}
|
|
2169
2232
|
const { parent } = info;
|
|
2170
2233
|
if (!parent) throw new Error("获取不到父级节点");
|
|
@@ -2181,30 +2244,29 @@
|
|
|
2181
2244
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
2182
2245
|
nodes.splice(targetIndex, 1, newConfig);
|
|
2183
2246
|
this.set("nodes", [...nodes]);
|
|
2184
|
-
this.get("stage")?.update({
|
|
2185
|
-
config: lodashEs.cloneDeep(newConfig),
|
|
2186
|
-
parentId: parent.id,
|
|
2187
|
-
root: lodashEs.cloneDeep(root)
|
|
2188
|
-
});
|
|
2189
2247
|
if (utils.isPage(newConfig) || utils.isPageFragment(newConfig)) {
|
|
2190
2248
|
this.set("page", newConfig);
|
|
2191
2249
|
}
|
|
2192
2250
|
this.addModifiedNodeId(newConfig.id);
|
|
2193
|
-
return
|
|
2251
|
+
return {
|
|
2252
|
+
oldNode: node,
|
|
2253
|
+
newNode: newConfig,
|
|
2254
|
+
changeRecords
|
|
2255
|
+
};
|
|
2194
2256
|
}
|
|
2195
2257
|
/**
|
|
2196
2258
|
* 更新节点
|
|
2197
2259
|
* @param config 新的节点配置,配置中需要有id信息
|
|
2198
2260
|
* @returns 更新后的节点配置
|
|
2199
2261
|
*/
|
|
2200
|
-
async update(config) {
|
|
2262
|
+
async update(config, data = {}) {
|
|
2201
2263
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2202
|
-
const
|
|
2203
|
-
if (
|
|
2264
|
+
const updateData = await Promise.all(nodes.map((node) => this.doUpdate(node, data)));
|
|
2265
|
+
if (updateData[0].oldNode?.type !== core.NodeType.ROOT) {
|
|
2204
2266
|
this.pushHistoryState();
|
|
2205
2267
|
}
|
|
2206
|
-
this.emit("update",
|
|
2207
|
-
return Array.isArray(config) ?
|
|
2268
|
+
this.emit("update", updateData);
|
|
2269
|
+
return Array.isArray(config) ? updateData.map((item) => item.newNode) : updateData[0].newNode;
|
|
2208
2270
|
}
|
|
2209
2271
|
/**
|
|
2210
2272
|
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
@@ -2398,7 +2460,7 @@
|
|
|
2398
2460
|
parent.items?.splice(index, 1);
|
|
2399
2461
|
await stage.remove({ id: node.id, parentId: parent.id, root: lodashEs.cloneDeep(root) });
|
|
2400
2462
|
const layout = await this.getLayout(target);
|
|
2401
|
-
const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (
|
|
2463
|
+
const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (_objValue, srcValue) => {
|
|
2402
2464
|
if (Array.isArray(srcValue)) {
|
|
2403
2465
|
return srcValue;
|
|
2404
2466
|
}
|
|
@@ -2407,7 +2469,11 @@
|
|
|
2407
2469
|
target.items.push(newConfig);
|
|
2408
2470
|
await stage.select(targetId);
|
|
2409
2471
|
const targetParent = this.getParentById(target.id);
|
|
2410
|
-
await stage.update({
|
|
2472
|
+
await stage.update({
|
|
2473
|
+
config: lodashEs.cloneDeep(target),
|
|
2474
|
+
parentId: targetParent?.id,
|
|
2475
|
+
root: lodashEs.cloneDeep(root)
|
|
2476
|
+
});
|
|
2411
2477
|
await this.select(newConfig);
|
|
2412
2478
|
stage.select(newConfig.id);
|
|
2413
2479
|
this.addModifiedNodeId(target.id);
|
|
@@ -2760,6 +2826,7 @@
|
|
|
2760
2826
|
name: "params",
|
|
2761
2827
|
type: "key-value",
|
|
2762
2828
|
defaultValue: {},
|
|
2829
|
+
advanced: true,
|
|
2763
2830
|
text: "参数"
|
|
2764
2831
|
},
|
|
2765
2832
|
{
|
|
@@ -2773,6 +2840,7 @@
|
|
|
2773
2840
|
name: "headers",
|
|
2774
2841
|
type: "key-value",
|
|
2775
2842
|
defaultValue: {},
|
|
2843
|
+
advanced: true,
|
|
2776
2844
|
text: "请求头"
|
|
2777
2845
|
}
|
|
2778
2846
|
]
|
|
@@ -2827,7 +2895,7 @@
|
|
|
2827
2895
|
},
|
|
2828
2896
|
{
|
|
2829
2897
|
title: "请求参数裁剪",
|
|
2830
|
-
display: (
|
|
2898
|
+
display: (_formState, { model }) => model.type === "http",
|
|
2831
2899
|
items: [
|
|
2832
2900
|
{
|
|
2833
2901
|
name: "beforeRequest",
|
|
@@ -2839,7 +2907,7 @@
|
|
|
2839
2907
|
},
|
|
2840
2908
|
{
|
|
2841
2909
|
title: "响应数据裁剪",
|
|
2842
|
-
display: (
|
|
2910
|
+
display: (_formState, { model }) => model.type === "http",
|
|
2843
2911
|
items: [
|
|
2844
2912
|
{
|
|
2845
2913
|
name: "afterResponse",
|
|
@@ -3006,6 +3074,10 @@
|
|
|
3006
3074
|
class IdleTask extends events.EventEmitter {
|
|
3007
3075
|
taskList = [];
|
|
3008
3076
|
taskHandle = null;
|
|
3077
|
+
constructor() {
|
|
3078
|
+
super();
|
|
3079
|
+
this.setMaxListeners(1e3);
|
|
3080
|
+
}
|
|
3009
3081
|
enqueueTask(taskHandler, taskData) {
|
|
3010
3082
|
this.taskList.push({
|
|
3011
3083
|
handler: taskHandler,
|
|
@@ -3015,6 +3087,9 @@
|
|
|
3015
3087
|
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
3016
3088
|
}
|
|
3017
3089
|
}
|
|
3090
|
+
clearTasks() {
|
|
3091
|
+
this.taskList = [];
|
|
3092
|
+
}
|
|
3018
3093
|
on(eventName, listener) {
|
|
3019
3094
|
return super.on(eventName, listener);
|
|
3020
3095
|
}
|
|
@@ -3025,12 +3100,30 @@
|
|
|
3025
3100
|
return super.emit(eventName, ...args);
|
|
3026
3101
|
}
|
|
3027
3102
|
runTaskQueue(deadline) {
|
|
3028
|
-
while (
|
|
3029
|
-
const
|
|
3030
|
-
|
|
3103
|
+
while (deadline.timeRemaining() > 0 && this.taskList.length) {
|
|
3104
|
+
const timeRemaining = deadline.timeRemaining();
|
|
3105
|
+
let times = 0;
|
|
3106
|
+
if (timeRemaining <= 5) {
|
|
3107
|
+
times = 10;
|
|
3108
|
+
} else if (timeRemaining <= 10) {
|
|
3109
|
+
times = 100;
|
|
3110
|
+
} else if (timeRemaining <= 15) {
|
|
3111
|
+
times = 300;
|
|
3112
|
+
} else {
|
|
3113
|
+
times = 600;
|
|
3114
|
+
}
|
|
3115
|
+
for (let i = 0; i < times; i++) {
|
|
3116
|
+
const task = this.taskList.shift();
|
|
3117
|
+
if (task) {
|
|
3118
|
+
task.handler(task.data);
|
|
3119
|
+
}
|
|
3120
|
+
if (this.taskList.length === 0) {
|
|
3121
|
+
break;
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3031
3124
|
}
|
|
3032
3125
|
if (this.taskList.length) {
|
|
3033
|
-
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout:
|
|
3126
|
+
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 300 });
|
|
3034
3127
|
} else {
|
|
3035
3128
|
this.taskHandle = 0;
|
|
3036
3129
|
this.emit("finish");
|
|
@@ -3175,7 +3268,7 @@
|
|
|
3175
3268
|
});
|
|
3176
3269
|
};
|
|
3177
3270
|
|
|
3178
|
-
const _sfc_main$
|
|
3271
|
+
const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
|
|
3179
3272
|
...{
|
|
3180
3273
|
name: "MEditorCodeParams"
|
|
3181
3274
|
},
|
|
@@ -3191,7 +3284,7 @@
|
|
|
3191
3284
|
setup(__props, { emit: __emit }) {
|
|
3192
3285
|
const props = __props;
|
|
3193
3286
|
const emit = __emit;
|
|
3194
|
-
const form = vue.
|
|
3287
|
+
const form = vue.useTemplateRef("form");
|
|
3195
3288
|
const getFormConfig = (items = []) => [
|
|
3196
3289
|
{
|
|
3197
3290
|
type: "fieldset",
|
|
@@ -3212,10 +3305,10 @@
|
|
|
3212
3305
|
}))
|
|
3213
3306
|
)
|
|
3214
3307
|
);
|
|
3215
|
-
const onParamsChangeHandler = async () => {
|
|
3308
|
+
const onParamsChangeHandler = async (v, eventData) => {
|
|
3216
3309
|
try {
|
|
3217
3310
|
const value = await form.value?.submitForm(true);
|
|
3218
|
-
emit("change", value);
|
|
3311
|
+
emit("change", value, eventData);
|
|
3219
3312
|
} catch (e) {
|
|
3220
3313
|
error(e);
|
|
3221
3314
|
}
|
|
@@ -3235,9 +3328,9 @@
|
|
|
3235
3328
|
}
|
|
3236
3329
|
});
|
|
3237
3330
|
|
|
3238
|
-
const _hoisted_1$
|
|
3239
|
-
const _hoisted_2$
|
|
3240
|
-
const _sfc_main$
|
|
3331
|
+
const _hoisted_1$w = { class: "m-fields-code-select-col" };
|
|
3332
|
+
const _hoisted_2$i = { class: "code-select-container" };
|
|
3333
|
+
const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
3241
3334
|
...{
|
|
3242
3335
|
name: "MFieldsCodeSelectCol"
|
|
3243
3336
|
},
|
|
@@ -3308,22 +3401,39 @@
|
|
|
3308
3401
|
return codeId;
|
|
3309
3402
|
}
|
|
3310
3403
|
};
|
|
3311
|
-
const
|
|
3404
|
+
const onCodeIdChangeHandler = (value) => {
|
|
3312
3405
|
props.model.params = value.params;
|
|
3313
|
-
emit("change", props.model
|
|
3406
|
+
emit("change", props.model, {
|
|
3407
|
+
changeRecords: [
|
|
3408
|
+
{
|
|
3409
|
+
propPath: props.prop,
|
|
3410
|
+
value: value[props.name]
|
|
3411
|
+
}
|
|
3412
|
+
]
|
|
3413
|
+
});
|
|
3414
|
+
};
|
|
3415
|
+
const onParamsChangeHandler = (value, eventData) => {
|
|
3416
|
+
props.model.params = value.params;
|
|
3417
|
+
emit("change", props.model, {
|
|
3418
|
+
...eventData,
|
|
3419
|
+
changeRecords: (eventData.changeRecords || []).map((item) => ({
|
|
3420
|
+
prop: `${props.prop.replace(props.name, "")}${item.propPath}`,
|
|
3421
|
+
value: item.value
|
|
3422
|
+
}))
|
|
3423
|
+
});
|
|
3314
3424
|
};
|
|
3315
3425
|
const editCode = (id) => {
|
|
3316
3426
|
eventBus?.emit("edit-code", id);
|
|
3317
3427
|
};
|
|
3318
3428
|
return (_ctx, _cache) => {
|
|
3319
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3320
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3429
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$w, [
|
|
3430
|
+
vue.createElementVNode("div", _hoisted_2$i, [
|
|
3321
3431
|
vue.createVNode(vue.unref(formPlugin.MContainer), {
|
|
3322
3432
|
class: "select",
|
|
3323
3433
|
config: selectConfig,
|
|
3324
3434
|
model: _ctx.model,
|
|
3325
3435
|
size: _ctx.size,
|
|
3326
|
-
onChange:
|
|
3436
|
+
onChange: onCodeIdChangeHandler
|
|
3327
3437
|
}, null, 8, ["model", "size"]),
|
|
3328
3438
|
_ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicButton), {
|
|
3329
3439
|
key: 0,
|
|
@@ -3332,14 +3442,14 @@
|
|
|
3332
3442
|
onClick: _cache[0] || (_cache[0] = ($event) => editCode(_ctx.model[_ctx.name]))
|
|
3333
3443
|
}, {
|
|
3334
3444
|
default: vue.withCtx(() => [
|
|
3335
|
-
vue.createVNode(_sfc_main$
|
|
3445
|
+
vue.createVNode(_sfc_main$Z, {
|
|
3336
3446
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
3337
3447
|
}, null, 8, ["icon"])
|
|
3338
3448
|
]),
|
|
3339
3449
|
_: 1
|
|
3340
3450
|
}, 8, ["size"])) : vue.createCommentVNode("", true)
|
|
3341
3451
|
]),
|
|
3342
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3452
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$U, {
|
|
3343
3453
|
name: "params",
|
|
3344
3454
|
key: _ctx.model[_ctx.name],
|
|
3345
3455
|
model: _ctx.model,
|
|
@@ -3352,7 +3462,7 @@
|
|
|
3352
3462
|
}
|
|
3353
3463
|
});
|
|
3354
3464
|
|
|
3355
|
-
const _sfc_main$
|
|
3465
|
+
const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
3356
3466
|
...{
|
|
3357
3467
|
name: "MFieldsCondOpSelect"
|
|
3358
3468
|
},
|
|
@@ -3438,7 +3548,7 @@
|
|
|
3438
3548
|
}
|
|
3439
3549
|
});
|
|
3440
3550
|
|
|
3441
|
-
const _sfc_main$
|
|
3551
|
+
const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
3442
3552
|
__name: "FloatingBox",
|
|
3443
3553
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
3444
3554
|
position: { default: () => ({ left: 0, top: 0 }) },
|
|
@@ -3458,8 +3568,8 @@
|
|
|
3458
3568
|
const height = vue.useModel(__props, "height");
|
|
3459
3569
|
const visible = vue.useModel(__props, "visible");
|
|
3460
3570
|
const props = __props;
|
|
3461
|
-
const target = vue.
|
|
3462
|
-
const titleEl = vue.
|
|
3571
|
+
const target = vue.useTemplateRef("target");
|
|
3572
|
+
const titleEl = vue.useTemplateRef("titleEl");
|
|
3463
3573
|
const zIndex = designPlugin.useZIndex();
|
|
3464
3574
|
const curZIndex = vue.ref(0);
|
|
3465
3575
|
const titleHeight = vue.ref(0);
|
|
@@ -3593,7 +3703,7 @@
|
|
|
3593
3703
|
onClick: closeHandler
|
|
3594
3704
|
}, {
|
|
3595
3705
|
default: vue.withCtx(() => [
|
|
3596
|
-
vue.createVNode(_sfc_main$
|
|
3706
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
3597
3707
|
]),
|
|
3598
3708
|
_: 1
|
|
3599
3709
|
})
|
|
@@ -3614,7 +3724,7 @@
|
|
|
3614
3724
|
const useCodeBlockEdit = (codeBlockService) => {
|
|
3615
3725
|
const codeConfig = vue.ref();
|
|
3616
3726
|
const codeId = vue.ref();
|
|
3617
|
-
const codeBlockEditor = vue.
|
|
3727
|
+
const codeBlockEditor = vue.useTemplateRef("codeBlockEditor");
|
|
3618
3728
|
const createCodeBlock = async () => {
|
|
3619
3729
|
if (!codeBlockService) {
|
|
3620
3730
|
designPlugin.tMagicMessage.error("新增代码块失败");
|
|
@@ -3622,7 +3732,7 @@
|
|
|
3622
3732
|
}
|
|
3623
3733
|
codeConfig.value = {
|
|
3624
3734
|
name: "",
|
|
3625
|
-
content: `({app, params}) => {
|
|
3735
|
+
content: `({app, params, flowState}) => {
|
|
3626
3736
|
// place your code here
|
|
3627
3737
|
}`,
|
|
3628
3738
|
params: []
|
|
@@ -3668,81 +3778,10 @@
|
|
|
3668
3778
|
};
|
|
3669
3779
|
};
|
|
3670
3780
|
|
|
3671
|
-
const useDataSourceMethod = () => {
|
|
3672
|
-
const codeConfig = vue.ref();
|
|
3673
|
-
const codeBlockEditor = vue.ref();
|
|
3674
|
-
const dataSource = vue.ref();
|
|
3675
|
-
const dataSourceMethod = vue.ref("");
|
|
3676
|
-
return {
|
|
3677
|
-
codeConfig,
|
|
3678
|
-
codeBlockEditor,
|
|
3679
|
-
createCode: async (model) => {
|
|
3680
|
-
codeConfig.value = {
|
|
3681
|
-
name: "",
|
|
3682
|
-
content: `({ params, dataSource, app }) => {
|
|
3683
|
-
// place your code here
|
|
3684
|
-
}`,
|
|
3685
|
-
params: []
|
|
3686
|
-
};
|
|
3687
|
-
await vue.nextTick();
|
|
3688
|
-
dataSource.value = model;
|
|
3689
|
-
dataSourceMethod.value = "";
|
|
3690
|
-
codeBlockEditor.value?.show();
|
|
3691
|
-
},
|
|
3692
|
-
editCode: async (model, methodName) => {
|
|
3693
|
-
const method = model.methods?.find((method2) => method2.name === methodName);
|
|
3694
|
-
if (!method) {
|
|
3695
|
-
designPlugin.tMagicMessage.error("获取数据源方法失败");
|
|
3696
|
-
return;
|
|
3697
|
-
}
|
|
3698
|
-
let codeContent = method.content || `({ params, dataSource, app }) => {
|
|
3699
|
-
// place your code here
|
|
3700
|
-
}`;
|
|
3701
|
-
if (typeof codeContent !== "string") {
|
|
3702
|
-
codeContent = codeContent.toString();
|
|
3703
|
-
}
|
|
3704
|
-
codeConfig.value = {
|
|
3705
|
-
...lodashEs.cloneDeep(method),
|
|
3706
|
-
content: codeContent
|
|
3707
|
-
};
|
|
3708
|
-
await vue.nextTick();
|
|
3709
|
-
dataSource.value = model;
|
|
3710
|
-
dataSourceMethod.value = methodName;
|
|
3711
|
-
codeBlockEditor.value?.show();
|
|
3712
|
-
},
|
|
3713
|
-
deleteCode: async (model, methodName) => {
|
|
3714
|
-
if (!model.methods) return;
|
|
3715
|
-
const index = model.methods.findIndex((method) => method.name === methodName);
|
|
3716
|
-
if (index === -1) {
|
|
3717
|
-
return;
|
|
3718
|
-
}
|
|
3719
|
-
model.methods.splice(index, 1);
|
|
3720
|
-
},
|
|
3721
|
-
submitCode: (values) => {
|
|
3722
|
-
if (!dataSource.value) return;
|
|
3723
|
-
if (!dataSource.value.methods) {
|
|
3724
|
-
dataSource.value.methods = [];
|
|
3725
|
-
}
|
|
3726
|
-
if (values.content) {
|
|
3727
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
3728
|
-
if (typeof values.content === "string") {
|
|
3729
|
-
values.content = parseDSL(values.content);
|
|
3730
|
-
}
|
|
3731
|
-
}
|
|
3732
|
-
if (dataSourceMethod.value) {
|
|
3733
|
-
const index = dataSource.value.methods.findIndex((method) => method.name === dataSourceMethod.value);
|
|
3734
|
-
dataSource.value.methods.splice(index, 1, values);
|
|
3735
|
-
} else {
|
|
3736
|
-
dataSource.value.methods.push(values);
|
|
3737
|
-
}
|
|
3738
|
-
codeBlockEditor.value?.hide();
|
|
3739
|
-
}
|
|
3740
|
-
};
|
|
3741
|
-
};
|
|
3742
|
-
|
|
3743
3781
|
const state = vue.reactive({
|
|
3744
3782
|
uiSelectMode: false,
|
|
3745
3783
|
showSrc: false,
|
|
3784
|
+
showStylePanel: true,
|
|
3746
3785
|
zoom: 1,
|
|
3747
3786
|
stageContainerRect: {
|
|
3748
3787
|
width: 0,
|
|
@@ -4078,7 +4117,7 @@
|
|
|
4078
4117
|
const filter = (text) => {
|
|
4079
4118
|
if (!nodeData.value.length) return;
|
|
4080
4119
|
nodeData.value.forEach((node) => {
|
|
4081
|
-
traverseNode(node, (node2, parents) => {
|
|
4120
|
+
utils.traverseNode(node, (node2, parents) => {
|
|
4082
4121
|
if (!nodeStatusMap.value) return;
|
|
4083
4122
|
const visible = filterIsMatch(text, node2);
|
|
4084
4123
|
if (visible && parents.length) {
|
|
@@ -4105,7 +4144,7 @@
|
|
|
4105
4144
|
|
|
4106
4145
|
const useGetSo = (target, emit) => {
|
|
4107
4146
|
let getso;
|
|
4108
|
-
const
|
|
4147
|
+
const isDragging = vue.ref(false);
|
|
4109
4148
|
vue.onMounted(() => {
|
|
4110
4149
|
if (!target.value) return;
|
|
4111
4150
|
getso = new Gesto(target.value, {
|
|
@@ -4115,17 +4154,17 @@
|
|
|
4115
4154
|
if (!target.value) return;
|
|
4116
4155
|
emit("change", e);
|
|
4117
4156
|
}).on("dragStart", () => {
|
|
4118
|
-
|
|
4157
|
+
isDragging.value = true;
|
|
4119
4158
|
}).on("dragEnd", () => {
|
|
4120
|
-
|
|
4159
|
+
isDragging.value = false;
|
|
4121
4160
|
});
|
|
4122
4161
|
});
|
|
4123
4162
|
vue.onBeforeUnmount(() => {
|
|
4124
4163
|
getso?.unset();
|
|
4125
|
-
|
|
4164
|
+
isDragging.value = false;
|
|
4126
4165
|
});
|
|
4127
4166
|
return {
|
|
4128
|
-
|
|
4167
|
+
isDragging
|
|
4129
4168
|
};
|
|
4130
4169
|
};
|
|
4131
4170
|
|
|
@@ -4156,7 +4195,7 @@
|
|
|
4156
4195
|
const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
|
|
4157
4196
|
const map = /* @__PURE__ */ new Map();
|
|
4158
4197
|
nodeData.forEach(
|
|
4159
|
-
(node) => traverseNode(node, (node2) => {
|
|
4198
|
+
(node) => utils.traverseNode(node, (node2) => {
|
|
4160
4199
|
map.set(
|
|
4161
4200
|
node2.id,
|
|
4162
4201
|
initialLayerNodeStatus?.get(node2.id) || {
|
|
@@ -4187,9 +4226,9 @@
|
|
|
4187
4226
|
};
|
|
4188
4227
|
};
|
|
4189
4228
|
|
|
4190
|
-
const _hoisted_1$
|
|
4191
|
-
const _hoisted_2$
|
|
4192
|
-
const _sfc_main$
|
|
4229
|
+
const _hoisted_1$v = { class: "m-editor-data-source-fields" };
|
|
4230
|
+
const _hoisted_2$h = { class: "m-editor-data-source-fields-footer" };
|
|
4231
|
+
const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
4193
4232
|
...{
|
|
4194
4233
|
name: "MFieldsDataSourceFields"
|
|
4195
4234
|
},
|
|
@@ -4226,14 +4265,28 @@
|
|
|
4226
4265
|
calcBoxPosition();
|
|
4227
4266
|
addDialogVisible.value = true;
|
|
4228
4267
|
};
|
|
4229
|
-
const fieldChange = ({ index, ...value }) => {
|
|
4268
|
+
const fieldChange = ({ index, ...value }, data) => {
|
|
4269
|
+
addDialogVisible.value = false;
|
|
4230
4270
|
if (index > -1) {
|
|
4231
|
-
|
|
4271
|
+
emit("change", value, {
|
|
4272
|
+
modifyKey: index,
|
|
4273
|
+
changeRecords: (data.changeRecords || []).map((item) => ({
|
|
4274
|
+
propPath: `${props.prop}.${index}.${item.propPath}`,
|
|
4275
|
+
value: item.value
|
|
4276
|
+
}))
|
|
4277
|
+
});
|
|
4232
4278
|
} else {
|
|
4233
|
-
props.model[props.name].
|
|
4279
|
+
const modifyKey = props.model[props.name].length;
|
|
4280
|
+
emit("change", value, {
|
|
4281
|
+
modifyKey,
|
|
4282
|
+
changeRecords: [
|
|
4283
|
+
{
|
|
4284
|
+
propPath: `${props.prop}.${modifyKey}`,
|
|
4285
|
+
value
|
|
4286
|
+
}
|
|
4287
|
+
]
|
|
4288
|
+
});
|
|
4234
4289
|
}
|
|
4235
|
-
addDialogVisible.value = false;
|
|
4236
|
-
emit("change", props.model[props.name]);
|
|
4237
4290
|
};
|
|
4238
4291
|
const fieldColumns = [
|
|
4239
4292
|
{
|
|
@@ -4427,9 +4480,8 @@
|
|
|
4427
4480
|
const addFromJsonFromChange = ({ data }) => {
|
|
4428
4481
|
try {
|
|
4429
4482
|
const value = JSON.parse(data);
|
|
4430
|
-
props.model[props.name] = getFieldsConfig(value, props.model[props.name]);
|
|
4431
4483
|
addFromJsonDialogVisible.value = false;
|
|
4432
|
-
emit("change", props.model[props.name]);
|
|
4484
|
+
emit("change", getFieldsConfig(value, props.model[props.name]));
|
|
4433
4485
|
} catch (e) {
|
|
4434
4486
|
designPlugin.tMagicMessage.error(e.message);
|
|
4435
4487
|
}
|
|
@@ -4440,12 +4492,12 @@
|
|
|
4440
4492
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
4441
4493
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4442
4494
|
return (_ctx, _cache) => {
|
|
4443
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4495
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$v, [
|
|
4444
4496
|
vue.createVNode(vue.unref(tablePlugin.MagicTable), {
|
|
4445
4497
|
data: _ctx.model[_ctx.name],
|
|
4446
4498
|
columns: fieldColumns
|
|
4447
4499
|
}, null, 8, ["data"]),
|
|
4448
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
4500
|
+
vue.createElementVNode("div", _hoisted_2$h, [
|
|
4449
4501
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
4450
4502
|
size: "small",
|
|
4451
4503
|
disabled: _ctx.disabled,
|
|
@@ -4470,7 +4522,7 @@
|
|
|
4470
4522
|
_: 1
|
|
4471
4523
|
}, 8, ["disabled"])
|
|
4472
4524
|
]),
|
|
4473
|
-
vue.createVNode(_sfc_main$
|
|
4525
|
+
vue.createVNode(_sfc_main$R, {
|
|
4474
4526
|
visible: addDialogVisible.value,
|
|
4475
4527
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
|
4476
4528
|
width: width.value,
|
|
@@ -4493,7 +4545,7 @@
|
|
|
4493
4545
|
]),
|
|
4494
4546
|
_: 1
|
|
4495
4547
|
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4496
|
-
vue.createVNode(_sfc_main$
|
|
4548
|
+
vue.createVNode(_sfc_main$R, {
|
|
4497
4549
|
visible: addFromJsonDialogVisible.value,
|
|
4498
4550
|
"onUpdate:visible": _cache[5] || (_cache[5] = ($event) => addFromJsonDialogVisible.value = $event),
|
|
4499
4551
|
width: width.value,
|
|
@@ -4518,8 +4570,8 @@
|
|
|
4518
4570
|
}
|
|
4519
4571
|
});
|
|
4520
4572
|
|
|
4521
|
-
const _hoisted_1$
|
|
4522
|
-
const _sfc_main$
|
|
4573
|
+
const _hoisted_1$u = { class: "m-editor-data-source-field-select" };
|
|
4574
|
+
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
4523
4575
|
__name: "FieldSelect",
|
|
4524
4576
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
4525
4577
|
value: {},
|
|
@@ -4600,7 +4652,7 @@
|
|
|
4600
4652
|
eventBus?.emit("edit-data-source", removeDataSourceFieldPrefix(id));
|
|
4601
4653
|
};
|
|
4602
4654
|
return (_ctx, _cache) => {
|
|
4603
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4655
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$u, [
|
|
4604
4656
|
_ctx.checkStrictly ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
4605
4657
|
vue.createVNode(vue.unref(designPlugin.TMagicSelect), {
|
|
4606
4658
|
"model-value": selectDataSourceId.value,
|
|
@@ -4668,7 +4720,7 @@
|
|
|
4668
4720
|
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectDataSourceId.value))
|
|
4669
4721
|
}, {
|
|
4670
4722
|
default: vue.withCtx(() => [
|
|
4671
|
-
vue.createVNode(_sfc_main$
|
|
4723
|
+
vue.createVNode(_sfc_main$Z, {
|
|
4672
4724
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
4673
4725
|
}, null, 8, ["icon"])
|
|
4674
4726
|
]),
|
|
@@ -4682,8 +4734,8 @@
|
|
|
4682
4734
|
}
|
|
4683
4735
|
});
|
|
4684
4736
|
|
|
4685
|
-
const _hoisted_1$
|
|
4686
|
-
const _sfc_main$
|
|
4737
|
+
const _hoisted_1$t = { class: "m-fields-data-source-field-select" };
|
|
4738
|
+
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
4687
4739
|
...{
|
|
4688
4740
|
name: "MFieldsDataSourceFieldSelect"
|
|
4689
4741
|
},
|
|
@@ -4784,8 +4836,8 @@
|
|
|
4784
4836
|
}
|
|
4785
4837
|
};
|
|
4786
4838
|
return (_ctx, _cache) => {
|
|
4787
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4788
|
-
showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4839
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
|
|
4840
|
+
showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
4789
4841
|
key: 0,
|
|
4790
4842
|
"model-value": _ctx.model[_ctx.name],
|
|
4791
4843
|
disabled: _ctx.disabled,
|
|
@@ -4820,7 +4872,7 @@
|
|
|
4820
4872
|
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4821
4873
|
}, {
|
|
4822
4874
|
default: vue.withCtx(() => [
|
|
4823
|
-
vue.createVNode(_sfc_main$
|
|
4875
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
4824
4876
|
]),
|
|
4825
4877
|
_: 1
|
|
4826
4878
|
}, 8, ["type", "size"])
|
|
@@ -4832,10 +4884,10 @@
|
|
|
4832
4884
|
}
|
|
4833
4885
|
});
|
|
4834
4886
|
|
|
4835
|
-
const _hoisted_1$
|
|
4836
|
-
const _hoisted_2$
|
|
4887
|
+
const _hoisted_1$s = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4888
|
+
const _hoisted_2$g = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4837
4889
|
const _hoisted_3$4 = { class: "el-input__inner t-input__inner" };
|
|
4838
|
-
const _sfc_main$
|
|
4890
|
+
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
4839
4891
|
...{
|
|
4840
4892
|
name: "MFieldsDataSourceInput"
|
|
4841
4893
|
},
|
|
@@ -4856,7 +4908,7 @@
|
|
|
4856
4908
|
const props = __props;
|
|
4857
4909
|
const emit = __emit;
|
|
4858
4910
|
const { dataSourceService } = vue.inject("services") || {};
|
|
4859
|
-
const autocomplete = vue.
|
|
4911
|
+
const autocomplete = vue.useTemplateRef("autocomplete");
|
|
4860
4912
|
const isFocused = vue.ref(false);
|
|
4861
4913
|
const state = vue.ref("");
|
|
4862
4914
|
const displayState = vue.ref([]);
|
|
@@ -5035,12 +5087,12 @@
|
|
|
5035
5087
|
}
|
|
5036
5088
|
), {
|
|
5037
5089
|
suffix: vue.withCtx(() => [
|
|
5038
|
-
vue.createVNode(_sfc_main$
|
|
5090
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
5039
5091
|
]),
|
|
5040
5092
|
default: vue.withCtx(({ item }) => [
|
|
5041
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
5093
|
+
vue.createElementVNode("div", _hoisted_1$s, [
|
|
5042
5094
|
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
5043
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
5095
|
+
vue.createElementVNode("span", _hoisted_2$g, vue.toDisplayString(item.value), 1)
|
|
5044
5096
|
])
|
|
5045
5097
|
]),
|
|
5046
5098
|
_: 1
|
|
@@ -5070,7 +5122,7 @@
|
|
|
5070
5122
|
}, 1032, ["size"])) : vue.createCommentVNode("", true)
|
|
5071
5123
|
], 64);
|
|
5072
5124
|
}), 256)),
|
|
5073
|
-
vue.createVNode(_sfc_main$
|
|
5125
|
+
vue.createVNode(_sfc_main$Z, {
|
|
5074
5126
|
class: "tmagic-data-source-input-icon",
|
|
5075
5127
|
icon: vue.unref(iconsVue.Coin)
|
|
5076
5128
|
}, null, 8, ["icon"])
|
|
@@ -5081,11 +5133,11 @@
|
|
|
5081
5133
|
}
|
|
5082
5134
|
});
|
|
5083
5135
|
|
|
5084
|
-
const _hoisted_1$
|
|
5085
|
-
const _hoisted_2$
|
|
5136
|
+
const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
5137
|
+
const _hoisted_2$f = { style: { "flex": "1" } };
|
|
5086
5138
|
const _hoisted_3$3 = { style: { "flex": "1" } };
|
|
5087
5139
|
const _hoisted_4$3 = { class: "dialog-footer" };
|
|
5088
|
-
const _sfc_main$
|
|
5140
|
+
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
5089
5141
|
...{
|
|
5090
5142
|
name: "MEditorCodeBlockEditor"
|
|
5091
5143
|
},
|
|
@@ -5111,7 +5163,7 @@
|
|
|
5111
5163
|
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
5112
5164
|
const difVisible = vue.ref(false);
|
|
5113
5165
|
const { rect: windowRect } = useWindowRect();
|
|
5114
|
-
const magicVsEditor = vue.
|
|
5166
|
+
const magicVsEditor = vue.useTemplateRef("magicVsEditor");
|
|
5115
5167
|
const diffChange = () => {
|
|
5116
5168
|
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
5117
5169
|
return;
|
|
@@ -5213,14 +5265,14 @@
|
|
|
5213
5265
|
}
|
|
5214
5266
|
}
|
|
5215
5267
|
]);
|
|
5216
|
-
const submitForm = (values) => {
|
|
5268
|
+
const submitForm = (values, data) => {
|
|
5217
5269
|
changedValue.value = void 0;
|
|
5218
|
-
emit("submit", values);
|
|
5270
|
+
emit("submit", values, data);
|
|
5219
5271
|
};
|
|
5220
5272
|
const errorHandler = (error) => {
|
|
5221
5273
|
designPlugin.tMagicMessage.error(error.message);
|
|
5222
5274
|
};
|
|
5223
|
-
const formBox = vue.
|
|
5275
|
+
const formBox = vue.useTemplateRef("formBox");
|
|
5224
5276
|
const changedValue = vue.ref();
|
|
5225
5277
|
const changeHandler = (values) => {
|
|
5226
5278
|
changedValue.value = values;
|
|
@@ -5236,7 +5288,7 @@
|
|
|
5236
5288
|
type: "warning",
|
|
5237
5289
|
distinguishCancelAndClose: true
|
|
5238
5290
|
}).then(() => {
|
|
5239
|
-
changedValue.value && submitForm(changedValue.value);
|
|
5291
|
+
changedValue.value && submitForm(changedValue.value, { changeRecords: formBox.value?.form?.changeRecords });
|
|
5240
5292
|
done();
|
|
5241
5293
|
}).catch((action) => {
|
|
5242
5294
|
done(action === "cancel");
|
|
@@ -5258,7 +5310,7 @@
|
|
|
5258
5310
|
});
|
|
5259
5311
|
return (_ctx, _cache) => {
|
|
5260
5312
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
5261
|
-
vue.createVNode(_sfc_main$
|
|
5313
|
+
vue.createVNode(_sfc_main$R, {
|
|
5262
5314
|
visible: boxVisible.value,
|
|
5263
5315
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
5264
5316
|
width: width.value,
|
|
@@ -5335,8 +5387,8 @@
|
|
|
5335
5387
|
])
|
|
5336
5388
|
]),
|
|
5337
5389
|
default: vue.withCtx(() => [
|
|
5338
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
5339
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5390
|
+
vue.createElementVNode("div", _hoisted_1$r, [
|
|
5391
|
+
vue.createElementVNode("div", _hoisted_2$f, [
|
|
5340
5392
|
vue.createVNode(vue.unref(designPlugin.TMagicTag), {
|
|
5341
5393
|
size: "small",
|
|
5342
5394
|
type: "info"
|
|
@@ -5359,14 +5411,14 @@
|
|
|
5359
5411
|
})
|
|
5360
5412
|
])
|
|
5361
5413
|
]),
|
|
5362
|
-
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5414
|
+
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$Y, {
|
|
5363
5415
|
key: 0,
|
|
5364
5416
|
ref_key: "magicVsEditor",
|
|
5365
5417
|
ref: magicVsEditor,
|
|
5366
5418
|
type: "diff",
|
|
5367
5419
|
language: "json",
|
|
5368
5420
|
initValues: _ctx.content.content,
|
|
5369
|
-
modifiedValues: formBox
|
|
5421
|
+
modifiedValues: vue.unref(formBox)?.form?.values.content,
|
|
5370
5422
|
style: vue.normalizeStyle(`height: ${vue.unref(windowRect).height - 150}px`)
|
|
5371
5423
|
}, null, 8, ["initValues", "modifiedValues", "style"])) : vue.createCommentVNode("", true)
|
|
5372
5424
|
]),
|
|
@@ -5378,9 +5430,9 @@
|
|
|
5378
5430
|
}
|
|
5379
5431
|
});
|
|
5380
5432
|
|
|
5381
|
-
const _hoisted_1$
|
|
5382
|
-
const _hoisted_2$
|
|
5383
|
-
const _sfc_main$
|
|
5433
|
+
const _hoisted_1$q = { class: "m-editor-data-source-methods" };
|
|
5434
|
+
const _hoisted_2$e = { class: "m-editor-data-source-methods-footer" };
|
|
5435
|
+
const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
5384
5436
|
...{
|
|
5385
5437
|
name: "MFieldsDataSourceMethods"
|
|
5386
5438
|
},
|
|
@@ -5400,7 +5452,9 @@
|
|
|
5400
5452
|
setup(__props, { emit: __emit }) {
|
|
5401
5453
|
const props = __props;
|
|
5402
5454
|
const emit = __emit;
|
|
5403
|
-
const
|
|
5455
|
+
const codeConfig = vue.ref();
|
|
5456
|
+
const codeBlockEditor = vue.useTemplateRef("codeBlockEditor");
|
|
5457
|
+
let editIndex = -1;
|
|
5404
5458
|
const methodColumns = [
|
|
5405
5459
|
{
|
|
5406
5460
|
label: "名称",
|
|
@@ -5425,16 +5479,29 @@
|
|
|
5425
5479
|
actions: [
|
|
5426
5480
|
{
|
|
5427
5481
|
text: "编辑",
|
|
5428
|
-
handler: (
|
|
5429
|
-
|
|
5430
|
-
|
|
5482
|
+
handler: (method, index) => {
|
|
5483
|
+
let codeContent = method.content || `({ params, dataSource, app }) => {
|
|
5484
|
+
// place your code here
|
|
5485
|
+
}`;
|
|
5486
|
+
if (typeof codeContent !== "string") {
|
|
5487
|
+
codeContent = codeContent.toString();
|
|
5488
|
+
}
|
|
5489
|
+
codeConfig.value = {
|
|
5490
|
+
...lodashEs.cloneDeep(method),
|
|
5491
|
+
content: codeContent
|
|
5492
|
+
};
|
|
5493
|
+
editIndex = index;
|
|
5494
|
+
vue.nextTick(() => {
|
|
5495
|
+
codeBlockEditor.value?.show();
|
|
5496
|
+
});
|
|
5431
5497
|
}
|
|
5432
5498
|
},
|
|
5433
5499
|
{
|
|
5434
5500
|
text: "删除",
|
|
5435
5501
|
buttonType: "danger",
|
|
5436
|
-
handler: (row) => {
|
|
5437
|
-
|
|
5502
|
+
handler: async (row, index) => {
|
|
5503
|
+
await designPlugin.tMagicMessageBox.confirm(`确定删除${row.name}?`, "提示");
|
|
5504
|
+
props.model[props.name].splice(index, 1);
|
|
5438
5505
|
emit("change", props.model[props.name]);
|
|
5439
5506
|
}
|
|
5440
5507
|
}
|
|
@@ -5442,20 +5509,56 @@
|
|
|
5442
5509
|
}
|
|
5443
5510
|
];
|
|
5444
5511
|
const createCodeHandler = () => {
|
|
5445
|
-
|
|
5446
|
-
|
|
5512
|
+
codeConfig.value = {
|
|
5513
|
+
name: "",
|
|
5514
|
+
content: `({ params, dataSource, app, flowState }) => {
|
|
5515
|
+
// place your code here
|
|
5516
|
+
}`,
|
|
5517
|
+
params: []
|
|
5518
|
+
};
|
|
5519
|
+
editIndex = -1;
|
|
5520
|
+
vue.nextTick(() => {
|
|
5521
|
+
codeBlockEditor.value?.show();
|
|
5522
|
+
});
|
|
5447
5523
|
};
|
|
5448
|
-
const submitCodeHandler = (
|
|
5449
|
-
|
|
5450
|
-
|
|
5524
|
+
const submitCodeHandler = (value, data) => {
|
|
5525
|
+
if (value.content) {
|
|
5526
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
5527
|
+
if (typeof value.content === "string") {
|
|
5528
|
+
value.content = parseDSL(value.content);
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
if (editIndex > -1) {
|
|
5532
|
+
emit("change", value, {
|
|
5533
|
+
modifyKey: editIndex,
|
|
5534
|
+
changeRecords: (data.changeRecords || []).map((item) => ({
|
|
5535
|
+
propPath: `${props.prop}.${editIndex}.${item.propPath}`,
|
|
5536
|
+
value: item.value
|
|
5537
|
+
}))
|
|
5538
|
+
});
|
|
5539
|
+
} else {
|
|
5540
|
+
const modifyKey = props.model[props.name].length;
|
|
5541
|
+
emit("change", value, {
|
|
5542
|
+
modifyKey,
|
|
5543
|
+
changeRecords: [
|
|
5544
|
+
{
|
|
5545
|
+
propPath: `${props.prop}.${modifyKey}`,
|
|
5546
|
+
value
|
|
5547
|
+
}
|
|
5548
|
+
]
|
|
5549
|
+
});
|
|
5550
|
+
}
|
|
5551
|
+
editIndex = -1;
|
|
5552
|
+
codeConfig.value = void 0;
|
|
5553
|
+
codeBlockEditor.value?.hide();
|
|
5451
5554
|
};
|
|
5452
5555
|
return (_ctx, _cache) => {
|
|
5453
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5556
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$q, [
|
|
5454
5557
|
vue.createVNode(vue.unref(tablePlugin.MagicTable), {
|
|
5455
5558
|
data: _ctx.model[_ctx.name],
|
|
5456
5559
|
columns: methodColumns
|
|
5457
5560
|
}, null, 8, ["data"]),
|
|
5458
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5561
|
+
vue.createElementVNode("div", _hoisted_2$e, [
|
|
5459
5562
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
5460
5563
|
size: "small",
|
|
5461
5564
|
type: "primary",
|
|
@@ -5469,12 +5572,12 @@
|
|
|
5469
5572
|
_: 1
|
|
5470
5573
|
}, 8, ["disabled"])
|
|
5471
5574
|
]),
|
|
5472
|
-
|
|
5575
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
5473
5576
|
key: 0,
|
|
5474
5577
|
ref_key: "codeBlockEditor",
|
|
5475
5578
|
ref: codeBlockEditor,
|
|
5476
5579
|
disabled: _ctx.disabled,
|
|
5477
|
-
content:
|
|
5580
|
+
content: codeConfig.value,
|
|
5478
5581
|
"is-data-source": true,
|
|
5479
5582
|
"data-source-type": _ctx.model.type,
|
|
5480
5583
|
onSubmit: submitCodeHandler
|
|
@@ -5484,9 +5587,9 @@
|
|
|
5484
5587
|
}
|
|
5485
5588
|
});
|
|
5486
5589
|
|
|
5487
|
-
const _hoisted_1$
|
|
5488
|
-
const _hoisted_2$
|
|
5489
|
-
const _sfc_main$
|
|
5590
|
+
const _hoisted_1$p = { class: "m-fields-data-source-method-select" };
|
|
5591
|
+
const _hoisted_2$d = { class: "data-source-method-select-container" };
|
|
5592
|
+
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
5490
5593
|
...{
|
|
5491
5594
|
name: "MFieldsDataSourceMethodSelect"
|
|
5492
5595
|
},
|
|
@@ -5572,8 +5675,8 @@
|
|
|
5572
5675
|
eventBus?.emit("edit-data-source", id);
|
|
5573
5676
|
};
|
|
5574
5677
|
return (_ctx, _cache) => {
|
|
5575
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5576
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5678
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
|
|
5679
|
+
vue.createElementVNode("div", _hoisted_2$d, [
|
|
5577
5680
|
vue.createVNode(vue.unref(formPlugin.MContainer), {
|
|
5578
5681
|
class: "select",
|
|
5579
5682
|
config: cascaderConfig.value,
|
|
@@ -5592,7 +5695,7 @@
|
|
|
5592
5695
|
onClick: editCodeHandler
|
|
5593
5696
|
}, {
|
|
5594
5697
|
default: vue.withCtx(() => [
|
|
5595
|
-
vue.createVNode(_sfc_main$
|
|
5698
|
+
vue.createVNode(_sfc_main$Z, {
|
|
5596
5699
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5597
5700
|
}, null, 8, ["icon"])
|
|
5598
5701
|
]),
|
|
@@ -5602,7 +5705,7 @@
|
|
|
5602
5705
|
_: 1
|
|
5603
5706
|
}, 8, ["content"])) : vue.createCommentVNode("", true)
|
|
5604
5707
|
]),
|
|
5605
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5708
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$U, {
|
|
5606
5709
|
key: 0,
|
|
5607
5710
|
name: "params",
|
|
5608
5711
|
model: _ctx.model,
|
|
@@ -5616,9 +5719,9 @@
|
|
|
5616
5719
|
}
|
|
5617
5720
|
});
|
|
5618
5721
|
|
|
5619
|
-
const _hoisted_1$
|
|
5620
|
-
const _hoisted_2$
|
|
5621
|
-
const _sfc_main$
|
|
5722
|
+
const _hoisted_1$o = { class: "m-editor-data-source-fields" };
|
|
5723
|
+
const _hoisted_2$c = { class: "m-editor-data-source-fields-footer" };
|
|
5724
|
+
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
5622
5725
|
...{
|
|
5623
5726
|
name: "MFieldsDataSourceMocks"
|
|
5624
5727
|
},
|
|
@@ -5707,7 +5810,7 @@
|
|
|
5707
5810
|
const columns = [
|
|
5708
5811
|
{
|
|
5709
5812
|
type: "expand",
|
|
5710
|
-
component: _sfc_main$
|
|
5813
|
+
component: _sfc_main$Y,
|
|
5711
5814
|
props: (row) => ({
|
|
5712
5815
|
initValues: row.data,
|
|
5713
5816
|
language: "json",
|
|
@@ -5822,12 +5925,12 @@
|
|
|
5822
5925
|
const parentFloating = vue.inject("parentFloating", vue.ref(null));
|
|
5823
5926
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5824
5927
|
return (_ctx, _cache) => {
|
|
5825
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5928
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
|
|
5826
5929
|
vue.createVNode(vue.unref(tablePlugin.MagicTable), {
|
|
5827
5930
|
data: _ctx.model[_ctx.name],
|
|
5828
5931
|
columns
|
|
5829
5932
|
}, null, 8, ["data"]),
|
|
5830
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5933
|
+
vue.createElementVNode("div", _hoisted_2$c, [
|
|
5831
5934
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
5832
5935
|
size: "small",
|
|
5833
5936
|
type: "primary",
|
|
@@ -5841,7 +5944,7 @@
|
|
|
5841
5944
|
_: 1
|
|
5842
5945
|
}, 8, ["disabled"])
|
|
5843
5946
|
]),
|
|
5844
|
-
vue.createVNode(_sfc_main$
|
|
5947
|
+
vue.createVNode(_sfc_main$R, {
|
|
5845
5948
|
visible: addDialogVisible.value,
|
|
5846
5949
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
5847
5950
|
width: width.value,
|
|
@@ -5853,7 +5956,6 @@
|
|
|
5853
5956
|
}, {
|
|
5854
5957
|
body: vue.withCtx(() => [
|
|
5855
5958
|
vue.createVNode(vue.unref(formPlugin.MFormBox), {
|
|
5856
|
-
ref: "addDialog",
|
|
5857
5959
|
"label-width": "120px",
|
|
5858
5960
|
config: formConfig,
|
|
5859
5961
|
values: formValues.value,
|
|
@@ -5869,8 +5971,8 @@
|
|
|
5869
5971
|
}
|
|
5870
5972
|
});
|
|
5871
5973
|
|
|
5872
|
-
const _hoisted_1$
|
|
5873
|
-
const _sfc_main$
|
|
5974
|
+
const _hoisted_1$n = { class: "m-fields-data-source-select" };
|
|
5975
|
+
const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
|
|
5874
5976
|
...{
|
|
5875
5977
|
name: "MFieldsDataSourceSelect"
|
|
5876
5978
|
},
|
|
@@ -5927,7 +6029,7 @@
|
|
|
5927
6029
|
eventBus?.emit("edit-data-source", id);
|
|
5928
6030
|
};
|
|
5929
6031
|
return (_ctx, _cache) => {
|
|
5930
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6032
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
|
|
5931
6033
|
vue.createVNode(vue.unref(formPlugin.MSelect), {
|
|
5932
6034
|
model: _ctx.model,
|
|
5933
6035
|
name: _ctx.name,
|
|
@@ -5949,7 +6051,7 @@
|
|
|
5949
6051
|
onClick: editHandler
|
|
5950
6052
|
}, {
|
|
5951
6053
|
default: vue.withCtx(() => [
|
|
5952
|
-
vue.createVNode(_sfc_main$
|
|
6054
|
+
vue.createVNode(_sfc_main$Z, {
|
|
5953
6055
|
icon: !notEditable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View)
|
|
5954
6056
|
}, null, 8, ["icon"])
|
|
5955
6057
|
]),
|
|
@@ -5963,7 +6065,7 @@
|
|
|
5963
6065
|
}
|
|
5964
6066
|
});
|
|
5965
6067
|
|
|
5966
|
-
const _sfc_main$
|
|
6068
|
+
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
5967
6069
|
...{
|
|
5968
6070
|
name: "m-fields-display-conds"
|
|
5969
6071
|
},
|
|
@@ -6072,8 +6174,11 @@
|
|
|
6072
6174
|
}
|
|
6073
6175
|
]
|
|
6074
6176
|
}));
|
|
6075
|
-
const changeHandler = (v) => {
|
|
6076
|
-
|
|
6177
|
+
const changeHandler = (v, eventData) => {
|
|
6178
|
+
if (!Array.isArray(props.model[props.name])) {
|
|
6179
|
+
props.model[props.name] = [];
|
|
6180
|
+
}
|
|
6181
|
+
emit("change", v, eventData);
|
|
6077
6182
|
};
|
|
6078
6183
|
return (_ctx, _cache) => {
|
|
6079
6184
|
return vue.openBlock(), vue.createBlock(vue.unref(formPlugin.MGroupList), {
|
|
@@ -6091,12 +6196,12 @@
|
|
|
6091
6196
|
}
|
|
6092
6197
|
});
|
|
6093
6198
|
|
|
6094
|
-
const _hoisted_1$
|
|
6095
|
-
const _hoisted_2$
|
|
6199
|
+
const _hoisted_1$m = { class: "m-fields-event-select" };
|
|
6200
|
+
const _hoisted_2$b = {
|
|
6096
6201
|
key: 1,
|
|
6097
6202
|
class: "fullWidth"
|
|
6098
6203
|
};
|
|
6099
|
-
const _sfc_main$
|
|
6204
|
+
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
6100
6205
|
...{
|
|
6101
6206
|
name: "MFieldsEventSelect"
|
|
6102
6207
|
},
|
|
@@ -6144,13 +6249,13 @@
|
|
|
6144
6249
|
if (pageFragment) {
|
|
6145
6250
|
events = [
|
|
6146
6251
|
{
|
|
6147
|
-
label: pageFragment.name || "
|
|
6252
|
+
label: pageFragment.name || "页面片容器",
|
|
6148
6253
|
value: pageFragment.id,
|
|
6149
6254
|
children: events
|
|
6150
6255
|
}
|
|
6151
6256
|
];
|
|
6152
6257
|
pageFragment.items.forEach((node) => {
|
|
6153
|
-
traverseNode(node, (node2) => {
|
|
6258
|
+
utils.traverseNode(node, (node2) => {
|
|
6154
6259
|
const nodeEvents = node2.type && eventsService.getEvent(node2.type) || [];
|
|
6155
6260
|
events.push({
|
|
6156
6261
|
label: `${node2.name}_${node2.id}`,
|
|
@@ -6251,7 +6356,7 @@
|
|
|
6251
6356
|
if (pageFragment) {
|
|
6252
6357
|
methods = [];
|
|
6253
6358
|
pageFragment.items.forEach((node2) => {
|
|
6254
|
-
traverseNode(node2, (node3) => {
|
|
6359
|
+
utils.traverseNode(node2, (node3) => {
|
|
6255
6360
|
const nodeMethods = node3.type && eventsService?.getMethod(node3.type) || [];
|
|
6256
6361
|
if (nodeMethods.length) {
|
|
6257
6362
|
methods.push({
|
|
@@ -6357,30 +6462,31 @@
|
|
|
6357
6462
|
if (!props.model[props.name]) {
|
|
6358
6463
|
props.model[props.name] = [];
|
|
6359
6464
|
}
|
|
6360
|
-
|
|
6361
|
-
|
|
6465
|
+
emit("change", defaultEvent, {
|
|
6466
|
+
modifyKey: props.model[props.name].length
|
|
6467
|
+
});
|
|
6362
6468
|
};
|
|
6363
6469
|
const removeEvent = (index) => {
|
|
6364
6470
|
if (!props.name) return;
|
|
6365
6471
|
props.model[props.name].splice(index, 1);
|
|
6366
|
-
|
|
6472
|
+
emit("change", props.model[props.name]);
|
|
6367
6473
|
};
|
|
6368
|
-
const
|
|
6369
|
-
emit("change", props.model);
|
|
6474
|
+
const eventNameChangeHandler = (v, eventData) => {
|
|
6475
|
+
emit("change", props.model[props.name], eventData);
|
|
6370
6476
|
};
|
|
6477
|
+
const onChangeHandler = (v, eventData) => emit("change", props.model[props.name], eventData);
|
|
6371
6478
|
return (_ctx, _cache) => {
|
|
6372
6479
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
6373
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6480
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
6374
6481
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
6375
6482
|
key: 0,
|
|
6376
|
-
ref: "eventForm",
|
|
6377
6483
|
name: "events",
|
|
6378
6484
|
size: _ctx.size,
|
|
6379
6485
|
disabled: _ctx.disabled,
|
|
6380
6486
|
model: _ctx.model,
|
|
6381
6487
|
config: tableConfig.value,
|
|
6382
6488
|
onChange: onChangeHandler
|
|
6383
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
6489
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
|
|
6384
6490
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
6385
6491
|
class: "create-button",
|
|
6386
6492
|
type: "primary",
|
|
@@ -6398,6 +6504,7 @@
|
|
|
6398
6504
|
key: index,
|
|
6399
6505
|
disabled: _ctx.disabled,
|
|
6400
6506
|
size: _ctx.size,
|
|
6507
|
+
prop: `${_ctx.prop}.${index}`,
|
|
6401
6508
|
config: actionsConfig.value,
|
|
6402
6509
|
model: cardItem,
|
|
6403
6510
|
"label-width": _ctx.config.labelWidth || "100px",
|
|
@@ -6410,8 +6517,9 @@
|
|
|
6410
6517
|
model: cardItem,
|
|
6411
6518
|
disabled: _ctx.disabled,
|
|
6412
6519
|
size: _ctx.size,
|
|
6413
|
-
|
|
6414
|
-
|
|
6520
|
+
prop: `${_ctx.prop}.${index}`,
|
|
6521
|
+
onChange: eventNameChangeHandler
|
|
6522
|
+
}, null, 8, ["config", "model", "disabled", "size", "prop"]),
|
|
6415
6523
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
6416
6524
|
style: { "color": "#f56c6c" },
|
|
6417
6525
|
link: "",
|
|
@@ -6422,7 +6530,7 @@
|
|
|
6422
6530
|
}, null, 8, ["icon", "disabled", "size", "onClick"])
|
|
6423
6531
|
]),
|
|
6424
6532
|
_: 2
|
|
6425
|
-
}, 1032, ["disabled", "size", "config", "model", "label-width"]);
|
|
6533
|
+
}, 1032, ["disabled", "size", "prop", "config", "model", "label-width"]);
|
|
6426
6534
|
}), 128))
|
|
6427
6535
|
]))
|
|
6428
6536
|
]);
|
|
@@ -6430,29 +6538,29 @@
|
|
|
6430
6538
|
}
|
|
6431
6539
|
});
|
|
6432
6540
|
|
|
6433
|
-
const _hoisted_1$
|
|
6541
|
+
const _hoisted_1$l = {
|
|
6434
6542
|
viewBox: "0 0 32 32",
|
|
6435
6543
|
version: "1.1",
|
|
6436
6544
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6437
6545
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
6438
6546
|
};
|
|
6439
|
-
const _sfc_main$
|
|
6547
|
+
const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
6440
6548
|
...{
|
|
6441
6549
|
name: "MEditorCodeIcon"
|
|
6442
6550
|
},
|
|
6443
6551
|
__name: "CodeIcon",
|
|
6444
6552
|
setup(__props) {
|
|
6445
6553
|
return (_ctx, _cache) => {
|
|
6446
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
6554
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$l, _cache[0] || (_cache[0] = [
|
|
6447
6555
|
vue.createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2)
|
|
6448
6556
|
]));
|
|
6449
6557
|
};
|
|
6450
6558
|
}
|
|
6451
6559
|
});
|
|
6452
6560
|
|
|
6453
|
-
const _hoisted_1$
|
|
6454
|
-
const _hoisted_2$
|
|
6455
|
-
const _sfc_main$
|
|
6561
|
+
const _hoisted_1$k = { class: "m-fields-key-value" };
|
|
6562
|
+
const _hoisted_2$a = { key: 0 };
|
|
6563
|
+
const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
|
|
6456
6564
|
...{
|
|
6457
6565
|
name: "MFieldsKeyValue"
|
|
6458
6566
|
},
|
|
@@ -6475,14 +6583,18 @@
|
|
|
6475
6583
|
const records = vue.ref([]);
|
|
6476
6584
|
const showCode = vue.ref(false);
|
|
6477
6585
|
vue.watchEffect(() => {
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6586
|
+
if (typeof props.model[props.name] === "function") {
|
|
6587
|
+
showCode.value = true;
|
|
6588
|
+
} else {
|
|
6589
|
+
const initValues = Object.entries(props.model[props.name] || {});
|
|
6590
|
+
for (const [, value] of initValues) {
|
|
6591
|
+
if (typeof value !== "string") {
|
|
6592
|
+
showCode.value = true;
|
|
6593
|
+
break;
|
|
6594
|
+
}
|
|
6483
6595
|
}
|
|
6596
|
+
records.value = initValues;
|
|
6484
6597
|
}
|
|
6485
|
-
records.value = initValues;
|
|
6486
6598
|
});
|
|
6487
6599
|
const getValue = () => {
|
|
6488
6600
|
const record = {};
|
|
@@ -6510,8 +6622,8 @@
|
|
|
6510
6622
|
emit("change", v);
|
|
6511
6623
|
};
|
|
6512
6624
|
return (_ctx, _cache) => {
|
|
6513
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6514
|
-
!showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
6625
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
6626
|
+
!showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
|
|
6515
6627
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
|
|
6516
6628
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
6517
6629
|
class: "m-fields-key-value-item",
|
|
@@ -6525,7 +6637,7 @@
|
|
|
6525
6637
|
size: _ctx.size,
|
|
6526
6638
|
onChange: keyChangeHandler
|
|
6527
6639
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
6528
|
-
_cache[1] || (_cache[1] = vue.createElementVNode("span", { class: "m-
|
|
6640
|
+
_cache[1] || (_cache[1] = vue.createElementVNode("span", { class: "m-fields-key-value-delimiter" }, ":", -1)),
|
|
6529
6641
|
vue.createVNode(vue.unref(designPlugin.TMagicInput), {
|
|
6530
6642
|
placeholder: "value",
|
|
6531
6643
|
modelValue: records.value[index][1],
|
|
@@ -6535,7 +6647,7 @@
|
|
|
6535
6647
|
onChange: valueChangeHandler
|
|
6536
6648
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
6537
6649
|
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
6538
|
-
class: "m-
|
|
6650
|
+
class: "m-fields-key-value-delete",
|
|
6539
6651
|
type: "danger",
|
|
6540
6652
|
size: _ctx.size,
|
|
6541
6653
|
disabled: _ctx.disabled,
|
|
@@ -6560,11 +6672,11 @@
|
|
|
6560
6672
|
_: 1
|
|
6561
6673
|
}, 8, ["size", "disabled", "icon"])
|
|
6562
6674
|
])) : vue.createCommentVNode("", true),
|
|
6563
|
-
_ctx.config.advanced && showCode.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6675
|
+
_ctx.config.advanced && showCode.value ? (vue.openBlock(), vue.createBlock(_sfc_main$Y, {
|
|
6564
6676
|
key: 1,
|
|
6565
6677
|
height: "200px",
|
|
6566
6678
|
"init-values": _ctx.model[_ctx.name],
|
|
6567
|
-
language: "
|
|
6679
|
+
language: "javascript",
|
|
6568
6680
|
options: {
|
|
6569
6681
|
readOnly: _ctx.disabled
|
|
6570
6682
|
},
|
|
@@ -6576,7 +6688,7 @@
|
|
|
6576
6688
|
size: "default",
|
|
6577
6689
|
disabled: _ctx.disabled,
|
|
6578
6690
|
link: "",
|
|
6579
|
-
icon: _sfc_main$
|
|
6691
|
+
icon: _sfc_main$F,
|
|
6580
6692
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
6581
6693
|
}, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
6582
6694
|
]);
|
|
@@ -6584,9 +6696,9 @@
|
|
|
6584
6696
|
}
|
|
6585
6697
|
});
|
|
6586
6698
|
|
|
6587
|
-
const _hoisted_1$
|
|
6588
|
-
const _hoisted_2$
|
|
6589
|
-
const _sfc_main$
|
|
6699
|
+
const _hoisted_1$j = { class: "m-fields-page-fragment-select" };
|
|
6700
|
+
const _hoisted_2$9 = { class: "page-fragment-select-container" };
|
|
6701
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
6590
6702
|
...{
|
|
6591
6703
|
name: "MFieldsPageFragmentSelect"
|
|
6592
6704
|
},
|
|
@@ -6632,8 +6744,8 @@
|
|
|
6632
6744
|
};
|
|
6633
6745
|
return (_ctx, _cache) => {
|
|
6634
6746
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
6635
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6636
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
6747
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
6748
|
+
vue.createElementVNode("div", _hoisted_2$9, [
|
|
6637
6749
|
vue.createVNode(_component_m_form_container, {
|
|
6638
6750
|
class: "select",
|
|
6639
6751
|
config: selectConfig,
|
|
@@ -6641,7 +6753,7 @@
|
|
|
6641
6753
|
size: _ctx.size,
|
|
6642
6754
|
onChange: changeHandler
|
|
6643
6755
|
}, null, 8, ["model", "size"]),
|
|
6644
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6756
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
6645
6757
|
key: 0,
|
|
6646
6758
|
class: "icon",
|
|
6647
6759
|
icon: vue.unref(iconsVue.Edit),
|
|
@@ -6653,12 +6765,12 @@
|
|
|
6653
6765
|
}
|
|
6654
6766
|
});
|
|
6655
6767
|
|
|
6656
|
-
const _hoisted_1$
|
|
6768
|
+
const _hoisted_1$i = {
|
|
6657
6769
|
key: 1,
|
|
6658
6770
|
class: "m-fields-ui-select",
|
|
6659
6771
|
style: { "display": "flex" }
|
|
6660
6772
|
};
|
|
6661
|
-
const _sfc_main$
|
|
6773
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
6662
6774
|
...{
|
|
6663
6775
|
name: "MFieldsUISelect"
|
|
6664
6776
|
},
|
|
@@ -6689,7 +6801,10 @@
|
|
|
6689
6801
|
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
6690
6802
|
};
|
|
6691
6803
|
const clickHandler = ({ detail }) => {
|
|
6692
|
-
|
|
6804
|
+
let { id } = detail;
|
|
6805
|
+
if (detail.nodeType) {
|
|
6806
|
+
id = utils.getIdFromEl()(detail) || id;
|
|
6807
|
+
}
|
|
6693
6808
|
if (id) {
|
|
6694
6809
|
props.model[props.name] = id;
|
|
6695
6810
|
emit("change", id);
|
|
@@ -6753,7 +6868,7 @@
|
|
|
6753
6868
|
])),
|
|
6754
6869
|
_: 1
|
|
6755
6870
|
}, 8, ["icon", "disabled", "size"])
|
|
6756
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
6871
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
6757
6872
|
val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
6758
6873
|
vue.createVNode(vue.unref(designPlugin.TMagicTooltip), {
|
|
6759
6874
|
content: "清除",
|
|
@@ -6820,7 +6935,7 @@
|
|
|
6820
6935
|
}
|
|
6821
6936
|
});
|
|
6822
6937
|
|
|
6823
|
-
const _sfc_main$
|
|
6938
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
6824
6939
|
...{
|
|
6825
6940
|
name: "MEditorResizer"
|
|
6826
6941
|
},
|
|
@@ -6828,13 +6943,13 @@
|
|
|
6828
6943
|
emits: ["change"],
|
|
6829
6944
|
setup(__props, { emit: __emit }) {
|
|
6830
6945
|
const emit = __emit;
|
|
6831
|
-
const target = vue.
|
|
6832
|
-
const {
|
|
6946
|
+
const target = vue.useTemplateRef("target");
|
|
6947
|
+
const { isDragging } = useGetSo(target, emit);
|
|
6833
6948
|
return (_ctx, _cache) => {
|
|
6834
6949
|
return vue.openBlock(), vue.createElementBlock("span", {
|
|
6835
6950
|
ref_key: "target",
|
|
6836
6951
|
ref: target,
|
|
6837
|
-
class: vue.normalizeClass(["m-editor-resizer", { "m-editor-resizer-
|
|
6952
|
+
class: vue.normalizeClass(["m-editor-resizer", { "m-editor-resizer-dragging": vue.unref(isDragging) }])
|
|
6838
6953
|
}, [
|
|
6839
6954
|
vue.renderSlot(_ctx.$slots, "default")
|
|
6840
6955
|
], 2);
|
|
@@ -6842,7 +6957,7 @@
|
|
|
6842
6957
|
}
|
|
6843
6958
|
});
|
|
6844
6959
|
|
|
6845
|
-
const _sfc_main$
|
|
6960
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
6846
6961
|
...{
|
|
6847
6962
|
name: "MEditorSplitView"
|
|
6848
6963
|
},
|
|
@@ -6862,7 +6977,7 @@
|
|
|
6862
6977
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6863
6978
|
const emit = __emit;
|
|
6864
6979
|
const props = __props;
|
|
6865
|
-
const el = vue.
|
|
6980
|
+
const el = vue.useTemplateRef("el");
|
|
6866
6981
|
const hasLeft = vue.computed(() => typeof props.left !== "undefined");
|
|
6867
6982
|
const hasRight = vue.computed(() => typeof props.right !== "undefined");
|
|
6868
6983
|
const center = vue.ref(0);
|
|
@@ -6980,7 +7095,7 @@
|
|
|
6980
7095
|
}, [
|
|
6981
7096
|
vue.renderSlot(_ctx.$slots, "left")
|
|
6982
7097
|
], 6),
|
|
6983
|
-
vue.createVNode(_sfc_main$
|
|
7098
|
+
vue.createVNode(_sfc_main$B, { onChange: changeLeft })
|
|
6984
7099
|
], 64)) : vue.createCommentVNode("", true),
|
|
6985
7100
|
vue.createElementVNode("div", {
|
|
6986
7101
|
class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6989,7 +7104,7 @@
|
|
|
6989
7104
|
vue.renderSlot(_ctx.$slots, "center")
|
|
6990
7105
|
], 6),
|
|
6991
7106
|
hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
6992
|
-
vue.createVNode(_sfc_main$
|
|
7107
|
+
vue.createVNode(_sfc_main$B, { onChange: changeRight }),
|
|
6993
7108
|
vue.createElementVNode("div", {
|
|
6994
7109
|
class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6995
7110
|
style: vue.normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -7002,12 +7117,12 @@
|
|
|
7002
7117
|
}
|
|
7003
7118
|
});
|
|
7004
7119
|
|
|
7005
|
-
const _hoisted_1$
|
|
7120
|
+
const _hoisted_1$h = {
|
|
7006
7121
|
key: 1,
|
|
7007
7122
|
class: "menu-item-text"
|
|
7008
7123
|
};
|
|
7009
|
-
const _hoisted_2$
|
|
7010
|
-
const _sfc_main$
|
|
7124
|
+
const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
|
|
7125
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
7011
7126
|
...{
|
|
7012
7127
|
name: "MEditorToolButton"
|
|
7013
7128
|
},
|
|
@@ -7063,7 +7178,7 @@
|
|
|
7063
7178
|
};
|
|
7064
7179
|
const mouseupHandler = (item, event) => {
|
|
7065
7180
|
if (props.eventType !== "mouseup") return;
|
|
7066
|
-
if (item.type === "button") {
|
|
7181
|
+
if (item.type === "button" && event.button === 0) {
|
|
7067
7182
|
buttonHandler(item, event);
|
|
7068
7183
|
}
|
|
7069
7184
|
};
|
|
@@ -7078,7 +7193,7 @@
|
|
|
7078
7193
|
_ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicDivider), {
|
|
7079
7194
|
key: 0,
|
|
7080
7195
|
direction: _ctx.data.direction || "vertical"
|
|
7081
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
7196
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
7082
7197
|
_ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
|
|
7083
7198
|
key: 0,
|
|
7084
7199
|
effect: "dark",
|
|
@@ -7092,7 +7207,7 @@
|
|
|
7092
7207
|
disabled: disabled.value
|
|
7093
7208
|
}, {
|
|
7094
7209
|
default: vue.withCtx(() => [
|
|
7095
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7210
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
7096
7211
|
key: 0,
|
|
7097
7212
|
icon: _ctx.data.icon
|
|
7098
7213
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -7110,7 +7225,7 @@
|
|
|
7110
7225
|
title: _ctx.data.text
|
|
7111
7226
|
}, {
|
|
7112
7227
|
default: vue.withCtx(() => [
|
|
7113
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7228
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
7114
7229
|
key: 0,
|
|
7115
7230
|
icon: _ctx.data.icon
|
|
7116
7231
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -7143,7 +7258,7 @@
|
|
|
7143
7258
|
})) : vue.createCommentVNode("", true)
|
|
7144
7259
|
]),
|
|
7145
7260
|
default: vue.withCtx(() => [
|
|
7146
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
7261
|
+
vue.createElementVNode("span", _hoisted_2$8, [
|
|
7147
7262
|
vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
|
|
7148
7263
|
vue.createVNode(vue.unref(designPlugin.TMagicIcon), { class: "el-icon--right" }, {
|
|
7149
7264
|
default: vue.withCtx(() => [
|
|
@@ -7160,69 +7275,90 @@
|
|
|
7160
7275
|
}
|
|
7161
7276
|
});
|
|
7162
7277
|
|
|
7163
|
-
const _hoisted_1$
|
|
7278
|
+
const _hoisted_1$g = {
|
|
7279
|
+
key: 0,
|
|
7280
|
+
id: "m-editor-page-bar-add-icon",
|
|
7281
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
7282
|
+
};
|
|
7283
|
+
const _hoisted_2$7 = {
|
|
7164
7284
|
key: 1,
|
|
7165
7285
|
style: { "width": "21px" }
|
|
7166
7286
|
};
|
|
7167
|
-
const _sfc_main$
|
|
7287
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
7168
7288
|
...{
|
|
7169
7289
|
name: "MEditorPageBarAddButton"
|
|
7170
7290
|
},
|
|
7171
7291
|
__name: "AddButton",
|
|
7172
|
-
props: {
|
|
7173
|
-
type: {}
|
|
7174
|
-
},
|
|
7175
7292
|
setup(__props) {
|
|
7176
|
-
const props = __props;
|
|
7177
7293
|
const services = vue.inject("services");
|
|
7178
7294
|
const uiService = services?.uiService;
|
|
7179
7295
|
const editorService = services?.editorService;
|
|
7180
7296
|
const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
|
|
7181
|
-
const addPage = () => {
|
|
7297
|
+
const addPage = (type) => {
|
|
7182
7298
|
if (!editorService) return;
|
|
7183
7299
|
const root = vue.toRaw(editorService.get("root"));
|
|
7184
7300
|
if (!root) throw new Error("root 不能为空");
|
|
7185
7301
|
const pageConfig = {
|
|
7186
|
-
type
|
|
7187
|
-
name: generatePageNameByApp(root,
|
|
7302
|
+
type,
|
|
7303
|
+
name: generatePageNameByApp(root, type),
|
|
7188
7304
|
items: []
|
|
7189
7305
|
};
|
|
7190
7306
|
editorService.add(pageConfig);
|
|
7191
7307
|
};
|
|
7192
7308
|
return (_ctx, _cache) => {
|
|
7193
|
-
return showAddPageButton.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7309
|
+
return showAddPageButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
7310
|
+
vue.createVNode(vue.unref(designPlugin.TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
|
|
7311
|
+
reference: vue.withCtx(() => [
|
|
7312
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
7313
|
+
]),
|
|
7314
|
+
default: vue.withCtx(() => [
|
|
7315
|
+
vue.createVNode(_sfc_main$z, {
|
|
7316
|
+
data: {
|
|
7317
|
+
type: "button",
|
|
7318
|
+
text: "页面",
|
|
7319
|
+
handler: () => {
|
|
7320
|
+
addPage(vue.unref(core.NodeType).PAGE);
|
|
7321
|
+
}
|
|
7322
|
+
}
|
|
7323
|
+
}, null, 8, ["data"]),
|
|
7324
|
+
vue.createVNode(_sfc_main$z, {
|
|
7325
|
+
data: {
|
|
7326
|
+
type: "button",
|
|
7327
|
+
text: "页面片",
|
|
7328
|
+
handler: () => {
|
|
7329
|
+
addPage(vue.unref(core.NodeType).PAGE_FRAGMENT);
|
|
7330
|
+
}
|
|
7331
|
+
}
|
|
7332
|
+
}, null, 8, ["data"])
|
|
7333
|
+
]),
|
|
7334
|
+
_: 1
|
|
7335
|
+
})
|
|
7336
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$7));
|
|
7201
7337
|
};
|
|
7202
7338
|
}
|
|
7203
7339
|
});
|
|
7204
7340
|
|
|
7205
|
-
const _sfc_main$
|
|
7341
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
7206
7342
|
...{
|
|
7207
7343
|
name: "MEditorPageBarScrollContainer"
|
|
7208
7344
|
},
|
|
7209
7345
|
__name: "PageBarScrollContainer",
|
|
7210
7346
|
props: {
|
|
7211
|
-
|
|
7212
|
-
|
|
7347
|
+
pageBarSortOptions: {},
|
|
7348
|
+
length: {}
|
|
7213
7349
|
},
|
|
7214
|
-
setup(__props) {
|
|
7350
|
+
setup(__props, { expose: __expose }) {
|
|
7215
7351
|
const props = __props;
|
|
7216
7352
|
const services = vue.inject("services");
|
|
7217
7353
|
const editorService = services?.editorService;
|
|
7218
7354
|
const uiService = services?.uiService;
|
|
7219
|
-
const itemsContainer = vue.
|
|
7355
|
+
const itemsContainer = vue.useTemplateRef("itemsContainer");
|
|
7220
7356
|
const canScroll = vue.ref(false);
|
|
7221
7357
|
const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
|
|
7222
7358
|
const showPageListButton = vue.computed(() => uiService?.get("showPageListButton"));
|
|
7223
7359
|
const itemsContainerWidth = vue.ref(0);
|
|
7224
7360
|
const setCanScroll = () => {
|
|
7225
|
-
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7361
|
+
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - 37 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7226
7362
|
vue.nextTick(() => {
|
|
7227
7363
|
if (itemsContainer.value) {
|
|
7228
7364
|
canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
|
|
@@ -7232,7 +7368,7 @@
|
|
|
7232
7368
|
const resizeObserver = new ResizeObserver(() => {
|
|
7233
7369
|
setCanScroll();
|
|
7234
7370
|
});
|
|
7235
|
-
const pageBar = vue.
|
|
7371
|
+
const pageBar = vue.useTemplateRef("pageBar");
|
|
7236
7372
|
vue.onMounted(() => {
|
|
7237
7373
|
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
7238
7374
|
});
|
|
@@ -7241,38 +7377,43 @@
|
|
|
7241
7377
|
});
|
|
7242
7378
|
let translateLeft = 0;
|
|
7243
7379
|
const scroll = (type) => {
|
|
7244
|
-
if (!itemsContainer.value) return;
|
|
7380
|
+
if (!itemsContainer.value || !canScroll.value) return;
|
|
7245
7381
|
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
7246
7382
|
if (type === "left") {
|
|
7247
|
-
translateLeft
|
|
7248
|
-
if (translateLeft > 0) {
|
|
7249
|
-
translateLeft = 0;
|
|
7250
|
-
}
|
|
7383
|
+
scrollTo(translateLeft + 200);
|
|
7251
7384
|
} else if (type === "right") {
|
|
7252
|
-
translateLeft
|
|
7253
|
-
if (-translateLeft > maxScrollLeft) {
|
|
7254
|
-
translateLeft = -maxScrollLeft;
|
|
7255
|
-
}
|
|
7385
|
+
scrollTo(translateLeft - 200);
|
|
7256
7386
|
} else if (type === "start") {
|
|
7257
|
-
|
|
7387
|
+
scrollTo(0);
|
|
7258
7388
|
} else if (type === "end") {
|
|
7259
|
-
|
|
7389
|
+
scrollTo(-maxScrollLeft);
|
|
7390
|
+
}
|
|
7391
|
+
};
|
|
7392
|
+
const scrollTo = (value) => {
|
|
7393
|
+
if (!itemsContainer.value || !canScroll.value) return;
|
|
7394
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
7395
|
+
if (value >= 0) {
|
|
7396
|
+
value = 0;
|
|
7397
|
+
}
|
|
7398
|
+
if (-value > maxScrollLeft) {
|
|
7399
|
+
value = -maxScrollLeft;
|
|
7260
7400
|
}
|
|
7401
|
+
translateLeft = value;
|
|
7261
7402
|
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
7262
7403
|
};
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
length,
|
|
7267
|
-
(length2 = 0, preLength = 0) => {
|
|
7404
|
+
vue.watch(
|
|
7405
|
+
() => props.length,
|
|
7406
|
+
(length = 0, preLength = 0) => {
|
|
7268
7407
|
setTimeout(() => {
|
|
7269
7408
|
setCanScroll();
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7409
|
+
vue.nextTick(() => {
|
|
7410
|
+
if (length < preLength || preLength === 0) {
|
|
7411
|
+
scroll("start");
|
|
7412
|
+
} else {
|
|
7413
|
+
scroll("end");
|
|
7414
|
+
}
|
|
7415
|
+
});
|
|
7416
|
+
if (length > 1) {
|
|
7276
7417
|
const el = document.querySelector(".m-editor-page-bar-items");
|
|
7277
7418
|
let beforeDragList = [];
|
|
7278
7419
|
const options = {
|
|
@@ -7308,25 +7449,14 @@
|
|
|
7308
7449
|
immediate: true
|
|
7309
7450
|
}
|
|
7310
7451
|
);
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
(
|
|
7316
|
-
|
|
7317
|
-
unWatchPageFragmentLength?.();
|
|
7318
|
-
unWatchPageFragmentLength = null;
|
|
7319
|
-
unWatchPageLength = crateWatchLength(pageLength);
|
|
7320
|
-
} else {
|
|
7321
|
-
unWatchPageLength?.();
|
|
7322
|
-
unWatchPageLength = null;
|
|
7323
|
-
unWatchPageFragmentLength = crateWatchLength(pageFragmentLength);
|
|
7324
|
-
}
|
|
7325
|
-
},
|
|
7326
|
-
{
|
|
7327
|
-
immediate: true
|
|
7452
|
+
__expose({
|
|
7453
|
+
itemsContainerWidth,
|
|
7454
|
+
scroll,
|
|
7455
|
+
scrollTo,
|
|
7456
|
+
getTranslateLeft() {
|
|
7457
|
+
return translateLeft;
|
|
7328
7458
|
}
|
|
7329
|
-
);
|
|
7459
|
+
});
|
|
7330
7460
|
return (_ctx, _cache) => {
|
|
7331
7461
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7332
7462
|
class: "m-editor-page-bar",
|
|
@@ -7334,40 +7464,39 @@
|
|
|
7334
7464
|
ref: pageBar
|
|
7335
7465
|
}, [
|
|
7336
7466
|
vue.renderSlot(_ctx.$slots, "prepend"),
|
|
7337
|
-
|
|
7467
|
+
_ctx.length ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
7338
7468
|
key: 0,
|
|
7339
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
7340
|
-
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
7341
|
-
}, [
|
|
7342
|
-
vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
7343
|
-
])) : vue.createCommentVNode("", true),
|
|
7344
|
-
_ctx.type === vue.unref(core.NodeType).PAGE && pageLength.value || _ctx.type === vue.unref(core.NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
7345
|
-
key: 1,
|
|
7346
7469
|
class: "m-editor-page-bar-items",
|
|
7347
7470
|
ref_key: "itemsContainer",
|
|
7348
|
-
ref: itemsContainer
|
|
7349
|
-
style: vue.normalizeStyle(`width: ${itemsContainerWidth.value}px`)
|
|
7471
|
+
ref: itemsContainer
|
|
7350
7472
|
}, [
|
|
7351
7473
|
vue.renderSlot(_ctx.$slots, "default")
|
|
7352
|
-
],
|
|
7474
|
+
], 512)) : vue.createCommentVNode("", true),
|
|
7475
|
+
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
7476
|
+
key: 1,
|
|
7477
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-left-icon",
|
|
7478
|
+
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
7479
|
+
}, [
|
|
7480
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
7481
|
+
])) : vue.createCommentVNode("", true),
|
|
7353
7482
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
7354
7483
|
key: 2,
|
|
7355
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
7484
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-right-icon",
|
|
7356
7485
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
7357
7486
|
}, [
|
|
7358
|
-
vue.createVNode(_sfc_main$
|
|
7487
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
7359
7488
|
])) : vue.createCommentVNode("", true)
|
|
7360
7489
|
], 512);
|
|
7361
7490
|
};
|
|
7362
7491
|
}
|
|
7363
7492
|
});
|
|
7364
7493
|
|
|
7365
|
-
const _hoisted_1$
|
|
7494
|
+
const _hoisted_1$f = {
|
|
7366
7495
|
key: 0,
|
|
7367
7496
|
id: "m-editor-page-bar-list-icon",
|
|
7368
7497
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
7369
7498
|
};
|
|
7370
|
-
const _sfc_main$
|
|
7499
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
7371
7500
|
...{
|
|
7372
7501
|
name: "MEditorPageList"
|
|
7373
7502
|
},
|
|
@@ -7380,11 +7509,12 @@
|
|
|
7380
7509
|
const uiService = services?.uiService;
|
|
7381
7510
|
const editorService = services?.editorService;
|
|
7382
7511
|
const showPageListButton = vue.computed(() => uiService?.get("showPageListButton"));
|
|
7383
|
-
const
|
|
7384
|
-
|
|
7512
|
+
const page = vue.computed(() => editorService?.get("page"));
|
|
7513
|
+
const switchPage = async (id) => {
|
|
7514
|
+
await editorService?.select(id);
|
|
7385
7515
|
};
|
|
7386
7516
|
return (_ctx, _cache) => {
|
|
7387
|
-
return showPageListButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
7517
|
+
return showPageListButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
7388
7518
|
vue.createVNode(vue.unref(designPlugin.TMagicPopover), {
|
|
7389
7519
|
"popper-class": "page-bar-popover",
|
|
7390
7520
|
placement: "top",
|
|
@@ -7404,10 +7534,11 @@
|
|
|
7404
7534
|
vue.createElementVNode("div", null, [
|
|
7405
7535
|
vue.renderSlot(_ctx.$slots, "page-list-popover", { list: _ctx.list }, () => [
|
|
7406
7536
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.list, (item, index) => {
|
|
7407
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7537
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
7408
7538
|
data: {
|
|
7409
7539
|
type: "button",
|
|
7410
7540
|
text: item.devconfig?.tabName || item.name || item.id,
|
|
7541
|
+
className: item.id === page.value?.id ? "active" : "",
|
|
7411
7542
|
handler: () => switchPage(item.id)
|
|
7412
7543
|
},
|
|
7413
7544
|
key: index
|
|
@@ -7423,118 +7554,108 @@
|
|
|
7423
7554
|
}
|
|
7424
7555
|
});
|
|
7425
7556
|
|
|
7426
|
-
const
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
},
|
|
7430
|
-
__name: "SwitchTypeButton",
|
|
7557
|
+
const _hoisted_1$e = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
|
|
7558
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
7559
|
+
__name: "Search",
|
|
7431
7560
|
props: {
|
|
7432
|
-
|
|
7561
|
+
"query": {},
|
|
7562
|
+
"queryModifiers": {}
|
|
7433
7563
|
},
|
|
7434
|
-
emits: ["update:
|
|
7564
|
+
emits: /* @__PURE__ */ vue.mergeModels(["search"], ["update:query"]),
|
|
7435
7565
|
setup(__props, { emit: __emit }) {
|
|
7436
|
-
const
|
|
7566
|
+
const emit = __emit;
|
|
7567
|
+
const query = vue.useModel(__props, "query");
|
|
7568
|
+
const formConfig = formPlugin.createForm([
|
|
7437
7569
|
{
|
|
7438
|
-
type:
|
|
7439
|
-
|
|
7570
|
+
type: "checkbox-group",
|
|
7571
|
+
name: "pageType",
|
|
7572
|
+
options: [
|
|
7573
|
+
{
|
|
7574
|
+
value: core.NodeType.PAGE,
|
|
7575
|
+
text: "页面"
|
|
7576
|
+
},
|
|
7577
|
+
{
|
|
7578
|
+
value: core.NodeType.PAGE_FRAGMENT,
|
|
7579
|
+
text: "页面片段"
|
|
7580
|
+
}
|
|
7581
|
+
]
|
|
7440
7582
|
},
|
|
7441
7583
|
{
|
|
7442
|
-
|
|
7443
|
-
|
|
7584
|
+
name: "keyword",
|
|
7585
|
+
type: "text",
|
|
7586
|
+
placeholder: "请输入关键字",
|
|
7587
|
+
clearable: true
|
|
7444
7588
|
}
|
|
7445
|
-
];
|
|
7446
|
-
const
|
|
7447
|
-
const
|
|
7448
|
-
|
|
7589
|
+
]);
|
|
7590
|
+
const visible = vue.ref(false);
|
|
7591
|
+
const onFormChange = (values) => {
|
|
7592
|
+
query.value = values;
|
|
7593
|
+
emit("search", values);
|
|
7449
7594
|
};
|
|
7450
7595
|
return (_ctx, _cache) => {
|
|
7451
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7596
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
7597
|
+
vue.createVNode(_sfc_main$Z, {
|
|
7598
|
+
icon: vue.unref(iconsVue.Search),
|
|
7599
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
|
|
7600
|
+
class: vue.normalizeClass({ "icon-active": visible.value })
|
|
7601
|
+
}, null, 8, ["icon", "class"]),
|
|
7602
|
+
visible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
7603
|
+
key: 0,
|
|
7604
|
+
to: ".m-editor-page-bar-tabs"
|
|
7605
|
+
}, [
|
|
7606
|
+
query.value ? (vue.openBlock(), vue.createBlock(vue.unref(formPlugin.MForm), {
|
|
7607
|
+
key: 0,
|
|
7608
|
+
class: "m-editor-page-bar-search-panel",
|
|
7609
|
+
inline: true,
|
|
7610
|
+
config: vue.unref(formConfig),
|
|
7611
|
+
"init-values": query.value,
|
|
7612
|
+
"prevent-submit-default": true,
|
|
7613
|
+
onChange: onFormChange
|
|
7614
|
+
}, null, 8, ["config", "init-values"])) : vue.createCommentVNode("", true)
|
|
7615
|
+
])) : vue.createCommentVNode("", true)
|
|
7616
|
+
]);
|
|
7466
7617
|
};
|
|
7467
7618
|
}
|
|
7468
7619
|
});
|
|
7469
7620
|
|
|
7470
|
-
const _hoisted_1$
|
|
7471
|
-
const _hoisted_2$
|
|
7621
|
+
const _hoisted_1$d = { class: "m-editor-page-bar-tabs" };
|
|
7622
|
+
const _hoisted_2$6 = ["data-page-id", "onClick"];
|
|
7472
7623
|
const _hoisted_3$2 = { class: "m-editor-page-bar-title" };
|
|
7473
7624
|
const _hoisted_4$2 = ["title"];
|
|
7474
|
-
const _sfc_main$
|
|
7625
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
7475
7626
|
...{
|
|
7476
7627
|
name: "MEditorPageBar"
|
|
7477
7628
|
},
|
|
7478
7629
|
__name: "PageBar",
|
|
7479
7630
|
props: {
|
|
7480
7631
|
disabledPageFragment: { type: Boolean },
|
|
7481
|
-
pageBarSortOptions: {}
|
|
7632
|
+
pageBarSortOptions: {},
|
|
7633
|
+
filterFunction: { type: Function, default: (page, keyword) => page.name?.includes(keyword) || `${page.id}`.includes(keyword) }
|
|
7482
7634
|
},
|
|
7483
7635
|
setup(__props) {
|
|
7484
|
-
const
|
|
7636
|
+
const props = __props;
|
|
7485
7637
|
const services = vue.inject("services");
|
|
7486
7638
|
const editorService = services?.editorService;
|
|
7487
7639
|
const root = vue.computed(() => editorService?.get("root"));
|
|
7488
7640
|
const page = vue.computed(() => editorService?.get("page"));
|
|
7489
|
-
const
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
const
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
if (!page2) {
|
|
7498
|
-
if (active.value === core.NodeType.PAGE) {
|
|
7499
|
-
activePage.value = "";
|
|
7500
|
-
}
|
|
7501
|
-
if (active.value === core.NodeType.PAGE_FRAGMENT) {
|
|
7502
|
-
activePageFragment.value = "";
|
|
7503
|
-
}
|
|
7504
|
-
return;
|
|
7505
|
-
}
|
|
7506
|
-
if (utils.isPage(page2)) {
|
|
7507
|
-
activePage.value = page2?.id;
|
|
7508
|
-
if (active.value !== core.NodeType.PAGE) {
|
|
7509
|
-
active.value = core.NodeType.PAGE;
|
|
7510
|
-
}
|
|
7511
|
-
} else if (utils.isPageFragment(page2)) {
|
|
7512
|
-
activePageFragment.value = page2?.id;
|
|
7513
|
-
if (active.value !== core.NodeType.PAGE_FRAGMENT) {
|
|
7514
|
-
active.value = core.NodeType.PAGE_FRAGMENT;
|
|
7515
|
-
}
|
|
7516
|
-
}
|
|
7517
|
-
},
|
|
7518
|
-
{
|
|
7519
|
-
immediate: true
|
|
7520
|
-
}
|
|
7521
|
-
);
|
|
7522
|
-
vue.watch(active, (active2) => {
|
|
7523
|
-
if (active2 === core.NodeType.PAGE) {
|
|
7524
|
-
if (!activePage.value && !pageList.value.length) {
|
|
7525
|
-
editorService?.selectRoot();
|
|
7526
|
-
return;
|
|
7527
|
-
}
|
|
7528
|
-
switchPage(activePage.value);
|
|
7529
|
-
return;
|
|
7641
|
+
const query = vue.ref({
|
|
7642
|
+
pageType: [core.NodeType.PAGE, core.NodeType.PAGE_FRAGMENT],
|
|
7643
|
+
keyword: ""
|
|
7644
|
+
});
|
|
7645
|
+
const list = vue.computed(() => {
|
|
7646
|
+
const { pageType, keyword } = query.value;
|
|
7647
|
+
if (pageType.length === 0) {
|
|
7648
|
+
return [];
|
|
7530
7649
|
}
|
|
7531
|
-
|
|
7532
|
-
if (
|
|
7533
|
-
|
|
7534
|
-
|
|
7650
|
+
return (root.value?.items || []).filter((item) => {
|
|
7651
|
+
if (pageType.includes(item.type)) {
|
|
7652
|
+
if (keyword) {
|
|
7653
|
+
return props.filterFunction(item, keyword);
|
|
7654
|
+
}
|
|
7655
|
+
return true;
|
|
7535
7656
|
}
|
|
7536
|
-
|
|
7537
|
-
}
|
|
7657
|
+
return false;
|
|
7658
|
+
});
|
|
7538
7659
|
});
|
|
7539
7660
|
const switchPage = (id) => {
|
|
7540
7661
|
editorService?.select(id);
|
|
@@ -7549,20 +7670,50 @@
|
|
|
7549
7670
|
const remove = (node) => {
|
|
7550
7671
|
editorService?.remove(node);
|
|
7551
7672
|
};
|
|
7673
|
+
const pageBarScrollContainer = vue.useTemplateRef("pageBarScrollContainer");
|
|
7674
|
+
const pageBarItems = vue.useTemplateRef("pageBarItems");
|
|
7675
|
+
vue.watch(page, (page2) => {
|
|
7676
|
+
if (!page2 || !pageBarScrollContainer.value?.itemsContainerWidth || !pageBarItems.value || pageBarItems.value.length < 2) {
|
|
7677
|
+
return;
|
|
7678
|
+
}
|
|
7679
|
+
const firstItem = pageBarItems.value[0];
|
|
7680
|
+
const lastItem = pageBarItems.value[pageBarItems.value.length - 1];
|
|
7681
|
+
if (page2.id === firstItem.dataset.pageId) {
|
|
7682
|
+
pageBarScrollContainer.value.scroll("start");
|
|
7683
|
+
} else if (page2.id === lastItem.dataset.pageId) {
|
|
7684
|
+
pageBarScrollContainer.value.scroll("end");
|
|
7685
|
+
} else {
|
|
7686
|
+
const pageItem = pageBarItems.value.find((item) => item.dataset.pageId === page2.id);
|
|
7687
|
+
if (!pageItem) {
|
|
7688
|
+
return;
|
|
7689
|
+
}
|
|
7690
|
+
const pageItemRect = pageItem.getBoundingClientRect();
|
|
7691
|
+
const offsetLeft = pageItemRect.left - firstItem.getBoundingClientRect().left;
|
|
7692
|
+
const { itemsContainerWidth } = pageBarScrollContainer.value;
|
|
7693
|
+
const left = itemsContainerWidth - offsetLeft - pageItemRect.width;
|
|
7694
|
+
const translateLeft = pageBarScrollContainer.value.getTranslateLeft();
|
|
7695
|
+
if (offsetLeft + translateLeft < 0 || offsetLeft + pageItemRect.width > itemsContainerWidth - translateLeft) {
|
|
7696
|
+
pageBarScrollContainer.value.scrollTo(left);
|
|
7697
|
+
}
|
|
7698
|
+
}
|
|
7699
|
+
});
|
|
7552
7700
|
return (_ctx, _cache) => {
|
|
7553
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
"
|
|
7558
|
-
|
|
7559
|
-
vue.createVNode(_sfc_main$w, {
|
|
7560
|
-
type: active.value,
|
|
7561
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
7701
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
7702
|
+
vue.createVNode(_sfc_main$x, {
|
|
7703
|
+
ref_key: "pageBarScrollContainer",
|
|
7704
|
+
ref: pageBarScrollContainer,
|
|
7705
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7706
|
+
length: list.value.length
|
|
7562
7707
|
}, {
|
|
7563
7708
|
prepend: vue.withCtx(() => [
|
|
7564
|
-
vue.
|
|
7565
|
-
|
|
7709
|
+
vue.renderSlot(_ctx.$slots, "page-bar-add-button", {}, () => [
|
|
7710
|
+
vue.createVNode(_sfc_main$y)
|
|
7711
|
+
]),
|
|
7712
|
+
vue.createVNode(_sfc_main$v, {
|
|
7713
|
+
query: query.value,
|
|
7714
|
+
"onUpdate:query": _cache[0] || (_cache[0] = ($event) => query.value = $event)
|
|
7715
|
+
}, null, 8, ["query"]),
|
|
7716
|
+
vue.createVNode(_sfc_main$w, { list: list.value }, {
|
|
7566
7717
|
"page-list-popover": vue.withCtx(({ list: list2 }) => [
|
|
7567
7718
|
vue.renderSlot(_ctx.$slots, "page-list-popover", { list: list2 })
|
|
7568
7719
|
]),
|
|
@@ -7573,8 +7724,11 @@
|
|
|
7573
7724
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
|
|
7574
7725
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7575
7726
|
class: vue.normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
|
|
7727
|
+
ref_for: true,
|
|
7728
|
+
ref_key: "pageBarItems",
|
|
7729
|
+
ref: pageBarItems,
|
|
7576
7730
|
key: item.id,
|
|
7577
|
-
"page-id": item.id,
|
|
7731
|
+
"data-page-id": item.id,
|
|
7578
7732
|
onClick: ($event) => switchPage(item.id)
|
|
7579
7733
|
}, [
|
|
7580
7734
|
vue.createElementVNode("div", _hoisted_3$2, [
|
|
@@ -7602,7 +7756,7 @@
|
|
|
7602
7756
|
default: vue.withCtx(() => [
|
|
7603
7757
|
vue.createElementVNode("div", null, [
|
|
7604
7758
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
7605
|
-
vue.createVNode(_sfc_main$
|
|
7759
|
+
vue.createVNode(_sfc_main$z, {
|
|
7606
7760
|
data: {
|
|
7607
7761
|
type: "button",
|
|
7608
7762
|
text: "复制",
|
|
@@ -7610,7 +7764,7 @@
|
|
|
7610
7764
|
handler: () => copy(item)
|
|
7611
7765
|
}
|
|
7612
7766
|
}, null, 8, ["data"]),
|
|
7613
|
-
vue.createVNode(_sfc_main$
|
|
7767
|
+
vue.createVNode(_sfc_main$z, {
|
|
7614
7768
|
data: {
|
|
7615
7769
|
type: "button",
|
|
7616
7770
|
text: "删除",
|
|
@@ -7623,19 +7777,19 @@
|
|
|
7623
7777
|
]),
|
|
7624
7778
|
_: 2
|
|
7625
7779
|
}, 1024)
|
|
7626
|
-
], 10, _hoisted_2$
|
|
7780
|
+
], 10, _hoisted_2$6);
|
|
7627
7781
|
}), 128))
|
|
7628
7782
|
]),
|
|
7629
7783
|
_: 3
|
|
7630
|
-
}, 8, ["
|
|
7784
|
+
}, 8, ["page-bar-sort-options", "length"])
|
|
7631
7785
|
]);
|
|
7632
7786
|
};
|
|
7633
7787
|
}
|
|
7634
7788
|
});
|
|
7635
7789
|
|
|
7636
|
-
const _hoisted_1$
|
|
7637
|
-
const _hoisted_2$
|
|
7638
|
-
const _sfc_main$
|
|
7790
|
+
const _hoisted_1$c = { class: "m-editor-empty-panel" };
|
|
7791
|
+
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
7792
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
7639
7793
|
...{
|
|
7640
7794
|
name: "MEditorAddPageBox"
|
|
7641
7795
|
},
|
|
@@ -7657,14 +7811,14 @@
|
|
|
7657
7811
|
});
|
|
7658
7812
|
};
|
|
7659
7813
|
return (_ctx, _cache) => {
|
|
7660
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
7661
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
7814
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
7815
|
+
vue.createElementVNode("div", _hoisted_2$5, [
|
|
7662
7816
|
vue.createElementVNode("div", {
|
|
7663
7817
|
class: "m-editor-empty-button",
|
|
7664
7818
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(core.NodeType).PAGE))
|
|
7665
7819
|
}, [
|
|
7666
7820
|
vue.createElementVNode("div", null, [
|
|
7667
|
-
vue.createVNode(_sfc_main$
|
|
7821
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
7668
7822
|
]),
|
|
7669
7823
|
_cache[2] || (_cache[2] = vue.createElementVNode("p", null, "新增页面", -1))
|
|
7670
7824
|
]),
|
|
@@ -7674,7 +7828,7 @@
|
|
|
7674
7828
|
onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(vue.unref(core.NodeType).PAGE_FRAGMENT))
|
|
7675
7829
|
}, [
|
|
7676
7830
|
vue.createElementVNode("div", null, [
|
|
7677
|
-
vue.createVNode(_sfc_main$
|
|
7831
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
7678
7832
|
]),
|
|
7679
7833
|
_cache[3] || (_cache[3] = vue.createElementVNode("p", null, "新增页面片", -1))
|
|
7680
7834
|
])) : vue.createCommentVNode("", true)
|
|
@@ -7688,24 +7842,24 @@
|
|
|
7688
7842
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
7689
7843
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
7690
7844
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
7691
|
-
const _sfc_main$
|
|
7845
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
7692
7846
|
...{
|
|
7693
7847
|
name: "MEditorFramework"
|
|
7694
7848
|
},
|
|
7695
7849
|
__name: "Framework",
|
|
7696
7850
|
props: {
|
|
7697
7851
|
disabledPageFragment: { type: Boolean },
|
|
7698
|
-
pageBarSortOptions: {}
|
|
7852
|
+
pageBarSortOptions: {},
|
|
7853
|
+
pageFilterFunction: { type: Function }
|
|
7699
7854
|
},
|
|
7700
7855
|
setup(__props) {
|
|
7701
7856
|
const codeOptions = vue.inject("codeOptions", {});
|
|
7702
7857
|
const { editorService, uiService } = vue.inject("services") || {};
|
|
7703
|
-
const content = vue.
|
|
7704
|
-
const splitView = vue.
|
|
7858
|
+
const content = vue.useTemplateRef("content");
|
|
7859
|
+
const splitView = vue.useTemplateRef("splitView");
|
|
7705
7860
|
const root = vue.computed(() => editorService?.get("root"));
|
|
7706
7861
|
const page = vue.computed(() => editorService?.get("page"));
|
|
7707
7862
|
const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
|
|
7708
|
-
const stageLoading = vue.computed(() => editorService?.get("stageLoading") || false);
|
|
7709
7863
|
const showSrc = vue.computed(() => uiService?.get("showSrc"));
|
|
7710
7864
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
7711
7865
|
const getRightColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
@@ -7756,7 +7910,6 @@
|
|
|
7756
7910
|
}
|
|
7757
7911
|
};
|
|
7758
7912
|
return (_ctx, _cache) => {
|
|
7759
|
-
const _directive_loading = vue.resolveDirective("loading");
|
|
7760
7913
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7761
7914
|
class: "m-editor",
|
|
7762
7915
|
ref_key: "content",
|
|
@@ -7767,15 +7920,14 @@
|
|
|
7767
7920
|
vue.renderSlot(_ctx.$slots, "nav"),
|
|
7768
7921
|
vue.renderSlot(_ctx.$slots, "content-before"),
|
|
7769
7922
|
showSrc.value ? vue.renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
7770
|
-
vue.createVNode(_sfc_main$
|
|
7923
|
+
vue.createVNode(_sfc_main$Y, {
|
|
7771
7924
|
class: "m-editor-content",
|
|
7772
7925
|
"init-values": root.value,
|
|
7773
7926
|
options: vue.unref(codeOptions),
|
|
7774
7927
|
onSave: saveCode
|
|
7775
7928
|
}, null, 8, ["init-values", "options"])
|
|
7776
|
-
]) :
|
|
7929
|
+
]) : (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
7777
7930
|
key: 1,
|
|
7778
|
-
"element-loading-text": "Runtime 加载中...",
|
|
7779
7931
|
ref_key: "splitView",
|
|
7780
7932
|
ref: splitView,
|
|
7781
7933
|
class: "m-editor-content",
|
|
@@ -7787,7 +7939,7 @@
|
|
|
7787
7939
|
right: columnWidth.value.right,
|
|
7788
7940
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
7789
7941
|
"min-left": 65,
|
|
7790
|
-
"min-right":
|
|
7942
|
+
"min-right": 420,
|
|
7791
7943
|
"min-center": 100,
|
|
7792
7944
|
width: frameworkRect.value?.width || 0,
|
|
7793
7945
|
onChange: columnWidthChange
|
|
@@ -7797,13 +7949,17 @@
|
|
|
7797
7949
|
]),
|
|
7798
7950
|
center: vue.withCtx(() => [
|
|
7799
7951
|
page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7800
|
-
vue.createVNode(_sfc_main$
|
|
7952
|
+
vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7801
7953
|
]),
|
|
7802
7954
|
vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7803
|
-
vue.createVNode(_sfc_main$
|
|
7955
|
+
vue.createVNode(_sfc_main$u, {
|
|
7804
7956
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
7805
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
7957
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7958
|
+
"filter-function": _ctx.pageFilterFunction
|
|
7806
7959
|
}, {
|
|
7960
|
+
"page-bar-add-button": vue.withCtx(() => [
|
|
7961
|
+
vue.renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
7962
|
+
]),
|
|
7807
7963
|
"page-bar-title": vue.withCtx(({ page: page2 }) => [
|
|
7808
7964
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7809
7965
|
]),
|
|
@@ -7814,7 +7970,7 @@
|
|
|
7814
7970
|
vue.renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
7815
7971
|
]),
|
|
7816
7972
|
_: 3
|
|
7817
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"])
|
|
7973
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "filter-function"])
|
|
7818
7974
|
])
|
|
7819
7975
|
]),
|
|
7820
7976
|
_: 2
|
|
@@ -7822,18 +7978,11 @@
|
|
|
7822
7978
|
page.value ? {
|
|
7823
7979
|
name: "right",
|
|
7824
7980
|
fn: vue.withCtx(() => [
|
|
7825
|
-
vue.
|
|
7826
|
-
default: vue.withCtx(() => [
|
|
7827
|
-
vue.renderSlot(_ctx.$slots, "props-panel")
|
|
7828
|
-
]),
|
|
7829
|
-
_: 3
|
|
7830
|
-
})
|
|
7981
|
+
vue.renderSlot(_ctx.$slots, "props-panel")
|
|
7831
7982
|
]),
|
|
7832
7983
|
key: "0"
|
|
7833
7984
|
} : void 0
|
|
7834
|
-
]), 1032, ["left", "right", "width"])),
|
|
7835
|
-
[_directive_loading, stageLoading.value]
|
|
7836
|
-
]),
|
|
7985
|
+
]), 1032, ["left", "right", "width"])),
|
|
7837
7986
|
vue.renderSlot(_ctx.$slots, "content-after"),
|
|
7838
7987
|
vue.renderSlot(_ctx.$slots, "footer")
|
|
7839
7988
|
], 512);
|
|
@@ -7841,7 +7990,7 @@
|
|
|
7841
7990
|
}
|
|
7842
7991
|
});
|
|
7843
7992
|
|
|
7844
|
-
const _sfc_main$
|
|
7993
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
7845
7994
|
...{
|
|
7846
7995
|
name: "MEditorNavMenu"
|
|
7847
7996
|
},
|
|
@@ -8002,7 +8151,7 @@
|
|
|
8002
8151
|
});
|
|
8003
8152
|
}
|
|
8004
8153
|
});
|
|
8005
|
-
const navMenu = vue.
|
|
8154
|
+
const navMenu = vue.useTemplateRef("navMenu");
|
|
8006
8155
|
vue.onMounted(() => {
|
|
8007
8156
|
navMenu.value && resizeObserver.observe(navMenu.value);
|
|
8008
8157
|
});
|
|
@@ -8023,7 +8172,7 @@
|
|
|
8023
8172
|
style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
8024
8173
|
}, [
|
|
8025
8174
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
|
|
8026
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8175
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
8027
8176
|
data: item,
|
|
8028
8177
|
key: index
|
|
8029
8178
|
}, null, 8, ["data"]);
|
|
@@ -8035,7 +8184,132 @@
|
|
|
8035
8184
|
}
|
|
8036
8185
|
});
|
|
8037
8186
|
|
|
8187
|
+
const _hoisted_1$b = { class: "m-editor-props-form-panel" };
|
|
8188
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
8189
|
+
...{
|
|
8190
|
+
name: "MEditorFormPanel"
|
|
8191
|
+
},
|
|
8192
|
+
__name: "FormPanel",
|
|
8193
|
+
props: {
|
|
8194
|
+
config: {},
|
|
8195
|
+
values: {},
|
|
8196
|
+
disabledShowSrc: { type: Boolean },
|
|
8197
|
+
labelWidth: {},
|
|
8198
|
+
codeValueKey: {},
|
|
8199
|
+
labelPosition: {},
|
|
8200
|
+
extendState: { type: Function }
|
|
8201
|
+
},
|
|
8202
|
+
emits: ["submit", "submit-error", "form-error", "mounted"],
|
|
8203
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8204
|
+
const props = __props;
|
|
8205
|
+
const emit = __emit;
|
|
8206
|
+
const services = vue.inject("services");
|
|
8207
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
8208
|
+
const showSrc = vue.ref(false);
|
|
8209
|
+
const propsPanelSize = vue.computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
8210
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
8211
|
+
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
8212
|
+
const configForm = vue.useTemplateRef("configForm");
|
|
8213
|
+
vue.watchEffect(() => {
|
|
8214
|
+
if (configForm.value) {
|
|
8215
|
+
configForm.value.formState.stage = stage.value;
|
|
8216
|
+
configForm.value.formState.services = services;
|
|
8217
|
+
}
|
|
8218
|
+
});
|
|
8219
|
+
const internalInstance = vue.getCurrentInstance();
|
|
8220
|
+
vue.onMounted(() => {
|
|
8221
|
+
emit("mounted", internalInstance);
|
|
8222
|
+
});
|
|
8223
|
+
const submit = async (v, eventData) => {
|
|
8224
|
+
try {
|
|
8225
|
+
const values = await configForm.value?.submitForm();
|
|
8226
|
+
emit("submit", values, eventData);
|
|
8227
|
+
} catch (e) {
|
|
8228
|
+
emit("submit-error", e);
|
|
8229
|
+
}
|
|
8230
|
+
};
|
|
8231
|
+
const errorHandler = (e) => {
|
|
8232
|
+
emit("form-error", e);
|
|
8233
|
+
};
|
|
8234
|
+
const saveCode = (values) => {
|
|
8235
|
+
emit("submit", props.codeValueKey ? { [props.codeValueKey]: values } : values);
|
|
8236
|
+
};
|
|
8237
|
+
__expose({ configForm, submit });
|
|
8238
|
+
return (_ctx, _cache) => {
|
|
8239
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
8240
|
+
vue.renderSlot(_ctx.$slots, "props-form-panel-header"),
|
|
8241
|
+
vue.createVNode(vue.unref(designPlugin.TMagicScrollbar), null, {
|
|
8242
|
+
default: vue.withCtx(() => [
|
|
8243
|
+
vue.createVNode(vue.unref(formPlugin.MForm), {
|
|
8244
|
+
ref_key: "configForm",
|
|
8245
|
+
ref: configForm,
|
|
8246
|
+
class: vue.normalizeClass(propsPanelSize.value),
|
|
8247
|
+
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
8248
|
+
"label-width": _ctx.labelWidth,
|
|
8249
|
+
"label-position": _ctx.labelPosition,
|
|
8250
|
+
size: propsPanelSize.value,
|
|
8251
|
+
"init-values": _ctx.values,
|
|
8252
|
+
config: _ctx.config,
|
|
8253
|
+
"extend-state": _ctx.extendState,
|
|
8254
|
+
onChange: submit,
|
|
8255
|
+
onError: errorHandler
|
|
8256
|
+
}, null, 8, ["class", "popper-class", "label-width", "label-position", "size", "init-values", "config", "extend-state"])
|
|
8257
|
+
]),
|
|
8258
|
+
_: 1
|
|
8259
|
+
}),
|
|
8260
|
+
!_ctx.disabledShowSrc ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicButton), {
|
|
8261
|
+
key: 0,
|
|
8262
|
+
class: "m-editor-props-panel-src-icon",
|
|
8263
|
+
circle: "",
|
|
8264
|
+
title: "源码",
|
|
8265
|
+
type: showSrc.value ? "primary" : "",
|
|
8266
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
8267
|
+
}, {
|
|
8268
|
+
default: vue.withCtx(() => [
|
|
8269
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Document) }, null, 8, ["icon"])
|
|
8270
|
+
]),
|
|
8271
|
+
_: 1
|
|
8272
|
+
}, 8, ["type"])) : vue.createCommentVNode("", true),
|
|
8273
|
+
showSrc.value ? (vue.openBlock(), vue.createBlock(_sfc_main$Y, {
|
|
8274
|
+
key: 1,
|
|
8275
|
+
class: "m-editor-props-panel-src-code",
|
|
8276
|
+
height: `${vue.unref(editorContentHeight)}px`,
|
|
8277
|
+
"init-values": _ctx.codeValueKey ? _ctx.values[_ctx.codeValueKey] : _ctx.values,
|
|
8278
|
+
options: vue.unref(codeOptions),
|
|
8279
|
+
parse: true,
|
|
8280
|
+
onSave: saveCode
|
|
8281
|
+
}, null, 8, ["height", "init-values", "options"])) : vue.createCommentVNode("", true)
|
|
8282
|
+
]);
|
|
8283
|
+
};
|
|
8284
|
+
}
|
|
8285
|
+
});
|
|
8286
|
+
|
|
8287
|
+
const useStylePanel = (services) => {
|
|
8288
|
+
const showStylePanelStorageKey = "props-panel-show-style-panel";
|
|
8289
|
+
const showStylePanelStorageValue = services?.storageService.getItem(showStylePanelStorageKey, {
|
|
8290
|
+
protocol: Protocol.BOOLEAN
|
|
8291
|
+
});
|
|
8292
|
+
if (typeof showStylePanelStorageValue === "boolean") {
|
|
8293
|
+
services?.uiService.set("showStylePanel", showStylePanelStorageValue);
|
|
8294
|
+
}
|
|
8295
|
+
const showStylePanel = vue.computed(() => services?.uiService.get("showStylePanel") ?? true);
|
|
8296
|
+
const showStylePanelHandler = () => {
|
|
8297
|
+
services?.uiService.set("showStylePanel", true);
|
|
8298
|
+
services?.storageService.setItem(showStylePanelStorageKey, true, { protocol: Protocol.BOOLEAN });
|
|
8299
|
+
};
|
|
8300
|
+
const closeStylePanelHandler = () => {
|
|
8301
|
+
services?.uiService.set("showStylePanel", false);
|
|
8302
|
+
services?.storageService.setItem(showStylePanelStorageKey, false, { protocol: Protocol.BOOLEAN });
|
|
8303
|
+
};
|
|
8304
|
+
return {
|
|
8305
|
+
showStylePanel,
|
|
8306
|
+
showStylePanelHandler,
|
|
8307
|
+
closeStylePanelHandler
|
|
8308
|
+
};
|
|
8309
|
+
};
|
|
8310
|
+
|
|
8038
8311
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
8312
|
+
const _hoisted_2$4 = { class: "m-editor-props-style-panel-title" };
|
|
8039
8313
|
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
8040
8314
|
...{
|
|
8041
8315
|
name: "MEditorPropsPanel"
|
|
@@ -8045,21 +8319,20 @@
|
|
|
8045
8319
|
disabledShowSrc: { type: Boolean },
|
|
8046
8320
|
extendState: { type: Function }
|
|
8047
8321
|
},
|
|
8048
|
-
emits: ["
|
|
8322
|
+
emits: ["submit-error", "form-error", "mounted"],
|
|
8049
8323
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8050
|
-
const codeOptions = vue.inject("codeOptions", {});
|
|
8051
8324
|
const emit = __emit;
|
|
8052
|
-
const
|
|
8053
|
-
const internalInstance = vue.getCurrentInstance();
|
|
8325
|
+
const services = vue.inject("services");
|
|
8054
8326
|
const values = vue.ref({});
|
|
8055
|
-
const configForm = vue.ref();
|
|
8056
8327
|
const curFormConfig = vue.ref([]);
|
|
8057
|
-
const services = vue.inject("services");
|
|
8058
8328
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
8059
8329
|
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
8060
|
-
const
|
|
8061
|
-
|
|
8062
|
-
|
|
8330
|
+
const styleFormConfig = [
|
|
8331
|
+
{
|
|
8332
|
+
tabPosition: "right",
|
|
8333
|
+
items: styleTabConfig.items
|
|
8334
|
+
}
|
|
8335
|
+
];
|
|
8063
8336
|
const init = async () => {
|
|
8064
8337
|
if (!node.value) {
|
|
8065
8338
|
curFormConfig.value = [];
|
|
@@ -8071,21 +8344,15 @@
|
|
|
8071
8344
|
};
|
|
8072
8345
|
vue.watchEffect(init);
|
|
8073
8346
|
services?.propsService.on("props-configs-change", init);
|
|
8074
|
-
vue.onMounted(() => {
|
|
8075
|
-
emit("mounted", internalInstance);
|
|
8076
|
-
});
|
|
8077
8347
|
vue.onBeforeUnmount(() => {
|
|
8078
8348
|
services?.propsService.off("props-configs-change", init);
|
|
8079
8349
|
});
|
|
8080
|
-
|
|
8081
|
-
if (configForm.value && stage.value) {
|
|
8082
|
-
configForm.value.formState.stage = stage.value;
|
|
8083
|
-
}
|
|
8084
|
-
});
|
|
8085
|
-
const submit = async () => {
|
|
8350
|
+
const submit = async (v, eventData) => {
|
|
8086
8351
|
try {
|
|
8087
|
-
|
|
8088
|
-
|
|
8352
|
+
if (!v.id) {
|
|
8353
|
+
v.id = values.value.id;
|
|
8354
|
+
}
|
|
8355
|
+
services?.editorService.update(v, { changeRecords: eventData?.changeRecords });
|
|
8089
8356
|
} catch (e) {
|
|
8090
8357
|
emit("submit-error", e);
|
|
8091
8358
|
}
|
|
@@ -8093,48 +8360,76 @@
|
|
|
8093
8360
|
const errorHandler = (e) => {
|
|
8094
8361
|
emit("form-error", e);
|
|
8095
8362
|
};
|
|
8096
|
-
const
|
|
8097
|
-
|
|
8363
|
+
const mountedHandler = (e) => {
|
|
8364
|
+
emit("mounted", e);
|
|
8098
8365
|
};
|
|
8099
|
-
|
|
8366
|
+
const { showStylePanel, showStylePanelHandler, closeStylePanelHandler } = useStylePanel(services);
|
|
8367
|
+
const propertyFormPanelRef = vue.useTemplateRef("propertyFormPanel");
|
|
8368
|
+
__expose({
|
|
8369
|
+
getFormState() {
|
|
8370
|
+
return propertyFormPanelRef.value?.configForm?.formState;
|
|
8371
|
+
},
|
|
8372
|
+
submit
|
|
8373
|
+
});
|
|
8100
8374
|
return (_ctx, _cache) => {
|
|
8101
8375
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
8102
8376
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
8103
|
-
vue.createVNode(
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
class: vue.normalizeClass(propsPanelSize.value),
|
|
8107
|
-
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
8108
|
-
size: propsPanelSize.value,
|
|
8109
|
-
"init-values": values.value,
|
|
8377
|
+
vue.createVNode(_sfc_main$q, {
|
|
8378
|
+
ref: "propertyFormPanel",
|
|
8379
|
+
class: vue.normalizeClass(["m-editor-props-property-panel", { "show-style-panel": vue.unref(showStylePanel) }]),
|
|
8110
8380
|
config: curFormConfig.value,
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8381
|
+
values: values.value,
|
|
8382
|
+
disabledShowSrc: _ctx.disabledShowSrc,
|
|
8383
|
+
extendState: _ctx.extendState,
|
|
8384
|
+
onSubmit: submit,
|
|
8385
|
+
onSubmitError: errorHandler,
|
|
8386
|
+
onFormError: errorHandler,
|
|
8387
|
+
onMounted: mountedHandler
|
|
8388
|
+
}, null, 8, ["class", "config", "values", "disabledShowSrc", "extendState"]),
|
|
8389
|
+
vue.unref(showStylePanel) ? (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
8116
8390
|
key: 0,
|
|
8117
|
-
class: "m-editor-props-panel
|
|
8391
|
+
class: "m-editor-props-style-panel",
|
|
8392
|
+
"label-position": "top",
|
|
8393
|
+
"code-value-key": "style",
|
|
8394
|
+
config: styleFormConfig,
|
|
8395
|
+
values: values.value,
|
|
8396
|
+
disabledShowSrc: _ctx.disabledShowSrc,
|
|
8397
|
+
extendState: _ctx.extendState,
|
|
8398
|
+
onSubmit: submit,
|
|
8399
|
+
onSubmitError: errorHandler,
|
|
8400
|
+
onFormError: errorHandler
|
|
8401
|
+
}, {
|
|
8402
|
+
"props-form-panel-header": vue.withCtx(() => [
|
|
8403
|
+
vue.createElementVNode("div", _hoisted_2$4, [
|
|
8404
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("span", null, "样式", -1)),
|
|
8405
|
+
vue.createElementVNode("div", null, [
|
|
8406
|
+
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
8407
|
+
link: "",
|
|
8408
|
+
size: "small",
|
|
8409
|
+
onClick: vue.unref(closeStylePanelHandler)
|
|
8410
|
+
}, {
|
|
8411
|
+
default: vue.withCtx(() => [
|
|
8412
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
8413
|
+
]),
|
|
8414
|
+
_: 1
|
|
8415
|
+
}, 8, ["onClick"])
|
|
8416
|
+
])
|
|
8417
|
+
])
|
|
8418
|
+
]),
|
|
8419
|
+
_: 1
|
|
8420
|
+
}, 8, ["values", "disabledShowSrc", "extendState"])) : vue.createCommentVNode("", true),
|
|
8421
|
+
!vue.unref(showStylePanel) ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicButton), {
|
|
8422
|
+
key: 1,
|
|
8423
|
+
class: "m-editor-props-panel-style-icon",
|
|
8118
8424
|
circle: "",
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
type: showSrc.value ? "primary" : "",
|
|
8122
|
-
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
8425
|
+
type: vue.unref(showStylePanel) ? "primary" : "",
|
|
8426
|
+
onClick: vue.unref(showStylePanelHandler)
|
|
8123
8427
|
}, {
|
|
8124
8428
|
default: vue.withCtx(() => [
|
|
8125
|
-
vue.createVNode(_sfc_main$
|
|
8429
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Sugar) }, null, 8, ["icon"])
|
|
8126
8430
|
]),
|
|
8127
8431
|
_: 1
|
|
8128
|
-
}, 8, ["type"])) : vue.createCommentVNode("", true)
|
|
8129
|
-
showSrc.value ? (vue.openBlock(), vue.createBlock(_sfc_main$X, {
|
|
8130
|
-
key: 1,
|
|
8131
|
-
class: "m-editor-props-panel-src-code",
|
|
8132
|
-
height: `${vue.unref(editorContentHeight)}px`,
|
|
8133
|
-
"init-values": values.value,
|
|
8134
|
-
options: vue.unref(codeOptions),
|
|
8135
|
-
parse: true,
|
|
8136
|
-
onSave: saveCode
|
|
8137
|
-
}, null, 8, ["height", "init-values", "options"])) : vue.createCommentVNode("", true)
|
|
8432
|
+
}, 8, ["type", "onClick"])) : vue.createCommentVNode("", true)
|
|
8138
8433
|
], 512)), [
|
|
8139
8434
|
[vue.vShow, nodes.value.length === 1]
|
|
8140
8435
|
]);
|
|
@@ -8144,7 +8439,174 @@
|
|
|
8144
8439
|
|
|
8145
8440
|
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
8146
8441
|
...{
|
|
8147
|
-
name: "
|
|
8442
|
+
name: "MEditorContentMenu"
|
|
8443
|
+
},
|
|
8444
|
+
__name: "ContentMenu",
|
|
8445
|
+
props: {
|
|
8446
|
+
menuData: { default: () => [] },
|
|
8447
|
+
isSubMenu: { type: Boolean, default: false },
|
|
8448
|
+
active: {},
|
|
8449
|
+
autoHide: { type: Boolean, default: true }
|
|
8450
|
+
},
|
|
8451
|
+
emits: ["hide", "show", "mouseenter"],
|
|
8452
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8453
|
+
const props = __props;
|
|
8454
|
+
const emit = __emit;
|
|
8455
|
+
const menu = vue.useTemplateRef("menu");
|
|
8456
|
+
const buttons = vue.useTemplateRef("buttons");
|
|
8457
|
+
const subMenu = vue.useTemplateRef("subMenu");
|
|
8458
|
+
const visible = vue.ref(false);
|
|
8459
|
+
const subMenuData = vue.ref([]);
|
|
8460
|
+
const zIndex = designPlugin.useZIndex();
|
|
8461
|
+
const curZIndex = vue.ref(0);
|
|
8462
|
+
const menuPosition = vue.ref({
|
|
8463
|
+
left: 0,
|
|
8464
|
+
top: 0
|
|
8465
|
+
});
|
|
8466
|
+
const menuStyle = vue.computed(() => ({
|
|
8467
|
+
top: `${menuPosition.value.top + 2}px`,
|
|
8468
|
+
left: `${menuPosition.value.left + 2}px`,
|
|
8469
|
+
zIndex: curZIndex.value
|
|
8470
|
+
}));
|
|
8471
|
+
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
8472
|
+
const hide = () => {
|
|
8473
|
+
if (!visible.value) return;
|
|
8474
|
+
visible.value = false;
|
|
8475
|
+
subMenu.value?.hide();
|
|
8476
|
+
emit("hide");
|
|
8477
|
+
};
|
|
8478
|
+
const clickHandler = (event) => {
|
|
8479
|
+
if (!props.autoHide) return;
|
|
8480
|
+
if (event.button === 0) {
|
|
8481
|
+
hide();
|
|
8482
|
+
}
|
|
8483
|
+
};
|
|
8484
|
+
const outsideClickHideHandler = (e) => {
|
|
8485
|
+
if (!props.autoHide) return;
|
|
8486
|
+
const target = e.target;
|
|
8487
|
+
if (!visible.value || !target) {
|
|
8488
|
+
return;
|
|
8489
|
+
}
|
|
8490
|
+
if (contains(target)) {
|
|
8491
|
+
return;
|
|
8492
|
+
}
|
|
8493
|
+
hide();
|
|
8494
|
+
};
|
|
8495
|
+
const setPosition = (e) => {
|
|
8496
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
8497
|
+
let top = e.clientY;
|
|
8498
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
8499
|
+
top = document.body.clientHeight - menuHeight;
|
|
8500
|
+
}
|
|
8501
|
+
menuPosition.value = {
|
|
8502
|
+
top,
|
|
8503
|
+
left: e.clientX
|
|
8504
|
+
};
|
|
8505
|
+
};
|
|
8506
|
+
const show = (e) => {
|
|
8507
|
+
visible.value = true;
|
|
8508
|
+
vue.nextTick(() => {
|
|
8509
|
+
e && setPosition(e);
|
|
8510
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
8511
|
+
emit("show");
|
|
8512
|
+
});
|
|
8513
|
+
};
|
|
8514
|
+
const showSubMenu = (item, index) => {
|
|
8515
|
+
const menuItem = item;
|
|
8516
|
+
if (typeof item !== "object") {
|
|
8517
|
+
return;
|
|
8518
|
+
}
|
|
8519
|
+
subMenuData.value = menuItem.items || [];
|
|
8520
|
+
setTimeout(() => {
|
|
8521
|
+
if (!visible.value) {
|
|
8522
|
+
return;
|
|
8523
|
+
}
|
|
8524
|
+
if (menu.value) {
|
|
8525
|
+
let y = menu.value.offsetTop;
|
|
8526
|
+
if (buttons.value?.[index].$el) {
|
|
8527
|
+
const rect = buttons.value?.[index].$el.getBoundingClientRect();
|
|
8528
|
+
y = rect.top;
|
|
8529
|
+
}
|
|
8530
|
+
subMenu.value?.show({
|
|
8531
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth - 2,
|
|
8532
|
+
clientY: y
|
|
8533
|
+
});
|
|
8534
|
+
}
|
|
8535
|
+
}, 0);
|
|
8536
|
+
};
|
|
8537
|
+
const mouseenterHandler = () => {
|
|
8538
|
+
emit("mouseenter");
|
|
8539
|
+
};
|
|
8540
|
+
vue.onMounted(() => {
|
|
8541
|
+
if (props.isSubMenu) return;
|
|
8542
|
+
globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
|
|
8543
|
+
});
|
|
8544
|
+
vue.onBeforeUnmount(() => {
|
|
8545
|
+
if (props.isSubMenu) return;
|
|
8546
|
+
globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
|
|
8547
|
+
});
|
|
8548
|
+
__expose({
|
|
8549
|
+
menu,
|
|
8550
|
+
menuPosition,
|
|
8551
|
+
hide,
|
|
8552
|
+
show,
|
|
8553
|
+
contains,
|
|
8554
|
+
setPosition
|
|
8555
|
+
});
|
|
8556
|
+
return (_ctx, _cache) => {
|
|
8557
|
+
const _component_content_menu = vue.resolveComponent("content-menu", true);
|
|
8558
|
+
return vue.openBlock(), vue.createBlock(vue.Transition, { name: "fade" }, {
|
|
8559
|
+
default: vue.withCtx(() => [
|
|
8560
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
8561
|
+
class: "magic-editor-content-menu",
|
|
8562
|
+
ref_key: "menu",
|
|
8563
|
+
ref: menu,
|
|
8564
|
+
style: vue.normalizeStyle(menuStyle.value),
|
|
8565
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => mouseenterHandler()),
|
|
8566
|
+
onContextmenu: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
8567
|
+
}, ["prevent"]))
|
|
8568
|
+
}, [
|
|
8569
|
+
vue.renderSlot(_ctx.$slots, "title"),
|
|
8570
|
+
vue.createElementVNode("div", null, [
|
|
8571
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
8572
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
8573
|
+
"event-type": "mouseup",
|
|
8574
|
+
ref_for: true,
|
|
8575
|
+
ref_key: "buttons",
|
|
8576
|
+
ref: buttons,
|
|
8577
|
+
class: vue.normalizeClass({ active: _ctx.active && item.id === _ctx.active }),
|
|
8578
|
+
data: item,
|
|
8579
|
+
key: index,
|
|
8580
|
+
onMouseup: clickHandler,
|
|
8581
|
+
onMouseenter: ($event) => showSubMenu(item, index)
|
|
8582
|
+
}, null, 8, ["class", "data", "onMouseenter"]);
|
|
8583
|
+
}), 128))
|
|
8584
|
+
]),
|
|
8585
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
8586
|
+
subMenuData.value.length ? (vue.openBlock(), vue.createBlock(_component_content_menu, {
|
|
8587
|
+
key: 0,
|
|
8588
|
+
class: "sub-menu",
|
|
8589
|
+
ref_key: "subMenu",
|
|
8590
|
+
ref: subMenu,
|
|
8591
|
+
active: _ctx.active,
|
|
8592
|
+
"menu-data": subMenuData.value,
|
|
8593
|
+
"is-sub-menu": true,
|
|
8594
|
+
onHide: hide
|
|
8595
|
+
}, null, 8, ["active", "menu-data"])) : vue.createCommentVNode("", true)
|
|
8596
|
+
]))
|
|
8597
|
+
], 36), [
|
|
8598
|
+
[vue.vShow, visible.value]
|
|
8599
|
+
])
|
|
8600
|
+
]),
|
|
8601
|
+
_: 3
|
|
8602
|
+
});
|
|
8603
|
+
};
|
|
8604
|
+
}
|
|
8605
|
+
});
|
|
8606
|
+
|
|
8607
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
8608
|
+
...{
|
|
8609
|
+
name: "MEditorSearchInput"
|
|
8148
8610
|
},
|
|
8149
8611
|
__name: "SearchInput",
|
|
8150
8612
|
emits: ["search"],
|
|
@@ -8190,7 +8652,7 @@
|
|
|
8190
8652
|
key: 0,
|
|
8191
8653
|
class: "m-editor-tree-node-children"
|
|
8192
8654
|
};
|
|
8193
|
-
const _sfc_main$
|
|
8655
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
8194
8656
|
...{
|
|
8195
8657
|
name: "MEditorTreeNode"
|
|
8196
8658
|
},
|
|
@@ -8264,7 +8726,7 @@
|
|
|
8264
8726
|
onContextmenu: nodeContentmenuHandler,
|
|
8265
8727
|
onMouseenter: mouseenterHandler
|
|
8266
8728
|
}, [
|
|
8267
|
-
vue.createVNode(_sfc_main$
|
|
8729
|
+
vue.createVNode(_sfc_main$Z, {
|
|
8268
8730
|
class: "expand-icon",
|
|
8269
8731
|
style: vue.normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
|
|
8270
8732
|
icon: expanded.value ? vue.unref(iconsVue.ArrowDown) : vue.unref(iconsVue.ArrowRight),
|
|
@@ -8320,7 +8782,7 @@
|
|
|
8320
8782
|
key: 1,
|
|
8321
8783
|
class: "m-editor-tree-empty"
|
|
8322
8784
|
};
|
|
8323
|
-
const _sfc_main$
|
|
8785
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
8324
8786
|
...{
|
|
8325
8787
|
name: "MEditorTree"
|
|
8326
8788
|
},
|
|
@@ -8345,7 +8807,7 @@
|
|
|
8345
8807
|
onDragover: handleDragOver
|
|
8346
8808
|
}, [
|
|
8347
8809
|
_ctx.data?.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.data, (item) => {
|
|
8348
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8810
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
8349
8811
|
key: item.id,
|
|
8350
8812
|
data: item,
|
|
8351
8813
|
indent: _ctx.indent,
|
|
@@ -8371,7 +8833,7 @@
|
|
|
8371
8833
|
}
|
|
8372
8834
|
});
|
|
8373
8835
|
|
|
8374
|
-
const _sfc_main$
|
|
8836
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
8375
8837
|
...{
|
|
8376
8838
|
name: "MEditorCodeBlockList"
|
|
8377
8839
|
},
|
|
@@ -8381,12 +8843,13 @@
|
|
|
8381
8843
|
nextLevelIndentIncrement: {},
|
|
8382
8844
|
customError: { type: Function }
|
|
8383
8845
|
},
|
|
8384
|
-
emits: ["edit", "remove"],
|
|
8846
|
+
emits: ["edit", "remove", "node-contextmenu"],
|
|
8385
8847
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8386
8848
|
const props = __props;
|
|
8387
8849
|
const emit = __emit;
|
|
8388
8850
|
const services = vue.inject("services");
|
|
8389
8851
|
const { codeBlockService, depService, editorService } = services || {};
|
|
8852
|
+
const collecting = vue.computed(() => depService?.get("collecting"));
|
|
8390
8853
|
const codeList = vue.computed(
|
|
8391
8854
|
() => Object.entries(codeBlockService?.getCodeDsl() || {}).map(([codeId, code]) => {
|
|
8392
8855
|
const target = depService?.getTarget(codeId, core.DepTargetType.CODE_BLOCK);
|
|
@@ -8461,20 +8924,29 @@
|
|
|
8461
8924
|
if (typeof props.customError === "function") {
|
|
8462
8925
|
props.customError(id, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
8463
8926
|
} else {
|
|
8464
|
-
|
|
8927
|
+
if (existBinds) {
|
|
8928
|
+
designPlugin.tMagicMessage.error("代码块存在绑定关系,不可删除");
|
|
8929
|
+
} else {
|
|
8930
|
+
designPlugin.tMagicMessage.error("代码块不可删除");
|
|
8931
|
+
}
|
|
8465
8932
|
}
|
|
8466
8933
|
}
|
|
8467
8934
|
};
|
|
8935
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
8936
|
+
emit("node-contextmenu", event, data);
|
|
8937
|
+
};
|
|
8468
8938
|
__expose({
|
|
8469
|
-
filter: filterTextChangeHandler
|
|
8939
|
+
filter: filterTextChangeHandler,
|
|
8940
|
+
deleteCode
|
|
8470
8941
|
});
|
|
8471
8942
|
return (_ctx, _cache) => {
|
|
8472
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8943
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
8473
8944
|
data: codeList.value,
|
|
8474
8945
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
8475
8946
|
indent: _ctx.indent,
|
|
8476
8947
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8477
|
-
onNodeClick: clickHandler
|
|
8948
|
+
onNodeClick: clickHandler,
|
|
8949
|
+
onNodeContextmenu: nodeContentMenuHandler
|
|
8478
8950
|
}, {
|
|
8479
8951
|
"tree-node-label": vue.withCtx(({ data }) => [
|
|
8480
8952
|
vue.createElementVNode("div", {
|
|
@@ -8486,14 +8958,25 @@
|
|
|
8486
8958
|
}, vue.toDisplayString(data.name) + " " + vue.toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
8487
8959
|
]),
|
|
8488
8960
|
"tree-node-tool": vue.withCtx(({ data }) => [
|
|
8489
|
-
data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.
|
|
8961
|
+
collecting.value && data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTag), {
|
|
8490
8962
|
key: 0,
|
|
8963
|
+
type: "info",
|
|
8964
|
+
size: "small",
|
|
8965
|
+
style: { "margin-right": "5px" }
|
|
8966
|
+
}, {
|
|
8967
|
+
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
8968
|
+
vue.createTextVNode("依赖收集中")
|
|
8969
|
+
])),
|
|
8970
|
+
_: 1
|
|
8971
|
+
})) : vue.createCommentVNode("", true),
|
|
8972
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
|
|
8973
|
+
key: 1,
|
|
8491
8974
|
effect: "dark",
|
|
8492
8975
|
content: editable.value ? "编辑" : "查看",
|
|
8493
8976
|
placement: "bottom"
|
|
8494
8977
|
}, {
|
|
8495
8978
|
default: vue.withCtx(() => [
|
|
8496
|
-
vue.createVNode(_sfc_main$
|
|
8979
|
+
vue.createVNode(_sfc_main$Z, {
|
|
8497
8980
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
8498
8981
|
class: "edit-icon",
|
|
8499
8982
|
onClick: vue.withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
@@ -8502,13 +8985,13 @@
|
|
|
8502
8985
|
_: 2
|
|
8503
8986
|
}, 1032, ["content"])) : vue.createCommentVNode("", true),
|
|
8504
8987
|
data.type === "code" && editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
|
|
8505
|
-
key:
|
|
8988
|
+
key: 2,
|
|
8506
8989
|
effect: "dark",
|
|
8507
8990
|
content: "删除",
|
|
8508
8991
|
placement: "bottom"
|
|
8509
8992
|
}, {
|
|
8510
8993
|
default: vue.withCtx(() => [
|
|
8511
|
-
vue.createVNode(_sfc_main$
|
|
8994
|
+
vue.createVNode(_sfc_main$Z, {
|
|
8512
8995
|
icon: vue.unref(iconsVue.Close),
|
|
8513
8996
|
class: "edit-icon",
|
|
8514
8997
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
@@ -8527,8 +9010,74 @@
|
|
|
8527
9010
|
}
|
|
8528
9011
|
});
|
|
8529
9012
|
|
|
9013
|
+
const useContentMenu$1 = (deleteCode) => {
|
|
9014
|
+
const eventBus = vue.inject("eventBus");
|
|
9015
|
+
const menuRef = vue.useTemplateRef("menu");
|
|
9016
|
+
let selectId = "";
|
|
9017
|
+
const menuData = [
|
|
9018
|
+
{
|
|
9019
|
+
type: "button",
|
|
9020
|
+
text: "编辑",
|
|
9021
|
+
icon: iconsVue.Edit,
|
|
9022
|
+
display: (services) => services?.codeBlockService?.getEditStatus() ?? true,
|
|
9023
|
+
handler: () => {
|
|
9024
|
+
if (!selectId) {
|
|
9025
|
+
return;
|
|
9026
|
+
}
|
|
9027
|
+
eventBus?.emit("edit-code", selectId);
|
|
9028
|
+
}
|
|
9029
|
+
},
|
|
9030
|
+
{
|
|
9031
|
+
type: "button",
|
|
9032
|
+
text: "复制并粘贴至当前",
|
|
9033
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
9034
|
+
handler: async ({ codeBlockService }) => {
|
|
9035
|
+
if (!selectId) {
|
|
9036
|
+
return;
|
|
9037
|
+
}
|
|
9038
|
+
const codeBlock = codeBlockService.getCodeContentById(selectId);
|
|
9039
|
+
if (!codeBlock) {
|
|
9040
|
+
return;
|
|
9041
|
+
}
|
|
9042
|
+
const newCodeId = await codeBlockService.getUniqueId();
|
|
9043
|
+
codeBlockService.setCodeDslById(newCodeId, lodashEs.cloneDeep(codeBlock));
|
|
9044
|
+
}
|
|
9045
|
+
},
|
|
9046
|
+
{
|
|
9047
|
+
type: "button",
|
|
9048
|
+
text: "删除",
|
|
9049
|
+
icon: iconsVue.Delete,
|
|
9050
|
+
handler: () => {
|
|
9051
|
+
if (!selectId) {
|
|
9052
|
+
return;
|
|
9053
|
+
}
|
|
9054
|
+
deleteCode(selectId);
|
|
9055
|
+
}
|
|
9056
|
+
}
|
|
9057
|
+
];
|
|
9058
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9059
|
+
event.preventDefault();
|
|
9060
|
+
if (data.type === "code") {
|
|
9061
|
+
menuRef.value?.show(event);
|
|
9062
|
+
if (data.id) {
|
|
9063
|
+
selectId = `${data.id}`;
|
|
9064
|
+
} else {
|
|
9065
|
+
selectId = "";
|
|
9066
|
+
}
|
|
9067
|
+
}
|
|
9068
|
+
};
|
|
9069
|
+
const contentMenuHideHandler = () => {
|
|
9070
|
+
selectId = "";
|
|
9071
|
+
};
|
|
9072
|
+
return {
|
|
9073
|
+
menuData,
|
|
9074
|
+
nodeContentMenuHandler,
|
|
9075
|
+
contentMenuHideHandler
|
|
9076
|
+
};
|
|
9077
|
+
};
|
|
9078
|
+
|
|
8530
9079
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
8531
|
-
const _sfc_main$
|
|
9080
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
8532
9081
|
...{
|
|
8533
9082
|
name: "MEditorCodeBlockListPanel"
|
|
8534
9083
|
},
|
|
@@ -8536,27 +9085,37 @@
|
|
|
8536
9085
|
props: {
|
|
8537
9086
|
indent: {},
|
|
8538
9087
|
nextLevelIndentIncrement: {},
|
|
8539
|
-
customError: { type: Function }
|
|
9088
|
+
customError: { type: Function },
|
|
9089
|
+
customContentMenu: { type: Function }
|
|
8540
9090
|
},
|
|
8541
9091
|
setup(__props) {
|
|
9092
|
+
const props = __props;
|
|
8542
9093
|
const eventBus = vue.inject("eventBus");
|
|
8543
9094
|
const { codeBlockService } = vue.inject("services") || {};
|
|
8544
9095
|
const editable = vue.computed(() => codeBlockService?.getEditStatus());
|
|
8545
9096
|
const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
8546
|
-
const codeBlockList = vue.
|
|
9097
|
+
const codeBlockList = vue.useTemplateRef("codeBlockList");
|
|
8547
9098
|
const filterTextChangeHandler = (val) => {
|
|
8548
9099
|
codeBlockList.value?.filter(val);
|
|
8549
9100
|
};
|
|
8550
9101
|
eventBus?.on("edit-code", (id) => {
|
|
8551
9102
|
editCode(id);
|
|
8552
9103
|
});
|
|
9104
|
+
const {
|
|
9105
|
+
nodeContentMenuHandler,
|
|
9106
|
+
menuData: contentMenuData,
|
|
9107
|
+
contentMenuHideHandler
|
|
9108
|
+
} = useContentMenu$1((id) => {
|
|
9109
|
+
codeBlockList.value?.deleteCode(id);
|
|
9110
|
+
});
|
|
9111
|
+
const menuData = vue.computed(() => props.customContentMenu(contentMenuData, "code-block"));
|
|
8553
9112
|
return (_ctx, _cache) => {
|
|
8554
9113
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8555
9114
|
vue.createVNode(vue.unref(designPlugin.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
8556
9115
|
default: vue.withCtx(() => [
|
|
8557
9116
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
8558
9117
|
vue.createElementVNode("div", _hoisted_1$7, [
|
|
8559
|
-
vue.createVNode(_sfc_main$
|
|
9118
|
+
vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
8560
9119
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicButton), {
|
|
8561
9120
|
key: 0,
|
|
8562
9121
|
class: "create-code-button",
|
|
@@ -8572,14 +9131,15 @@
|
|
|
8572
9131
|
vue.renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
8573
9132
|
])
|
|
8574
9133
|
]),
|
|
8575
|
-
vue.createVNode(_sfc_main$
|
|
9134
|
+
vue.createVNode(_sfc_main$k, {
|
|
8576
9135
|
ref_key: "codeBlockList",
|
|
8577
9136
|
ref: codeBlockList,
|
|
8578
9137
|
"custom-error": _ctx.customError,
|
|
8579
9138
|
indent: _ctx.indent,
|
|
8580
9139
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8581
9140
|
onEdit: vue.unref(editCode),
|
|
8582
|
-
onRemove: vue.unref(deleteCode)
|
|
9141
|
+
onRemove: vue.unref(deleteCode),
|
|
9142
|
+
onNodeContextmenu: vue.unref(nodeContentMenuHandler)
|
|
8583
9143
|
}, {
|
|
8584
9144
|
"code-block-panel-tool": vue.withCtx(({ id, data }) => [
|
|
8585
9145
|
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
@@ -8588,18 +9148,27 @@
|
|
|
8588
9148
|
})
|
|
8589
9149
|
]),
|
|
8590
9150
|
_: 3
|
|
8591
|
-
}, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove"])
|
|
9151
|
+
}, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove", "onNodeContextmenu"])
|
|
8592
9152
|
]),
|
|
8593
9153
|
_: 3
|
|
8594
9154
|
}),
|
|
8595
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9155
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
8596
9156
|
key: 0,
|
|
8597
9157
|
ref_key: "codeBlockEditor",
|
|
8598
9158
|
ref: codeBlockEditor,
|
|
8599
9159
|
disabled: !editable.value,
|
|
8600
9160
|
content: vue.unref(codeConfig),
|
|
8601
9161
|
onSubmit: vue.unref(submitCodeBlockHandler)
|
|
8602
|
-
}, null, 8, ["disabled", "content", "onSubmit"])) : vue.createCommentVNode("", true)
|
|
9162
|
+
}, null, 8, ["disabled", "content", "onSubmit"])) : vue.createCommentVNode("", true),
|
|
9163
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
9164
|
+
menuData.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
9165
|
+
key: 0,
|
|
9166
|
+
"menu-data": menuData.value,
|
|
9167
|
+
ref: "menu",
|
|
9168
|
+
style: { "overflow": "initial" },
|
|
9169
|
+
onHide: vue.unref(contentMenuHideHandler)
|
|
9170
|
+
}, null, 8, ["menu-data", "onHide"])) : vue.createCommentVNode("", true)
|
|
9171
|
+
]))
|
|
8603
9172
|
], 64);
|
|
8604
9173
|
};
|
|
8605
9174
|
}
|
|
@@ -8618,9 +9187,9 @@
|
|
|
8618
9187
|
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8619
9188
|
editDialog.value.show();
|
|
8620
9189
|
};
|
|
8621
|
-
const submitDataSourceHandler = (value) => {
|
|
9190
|
+
const submitDataSourceHandler = (value, eventData) => {
|
|
8622
9191
|
if (value.id) {
|
|
8623
|
-
dataSourceService?.update(value);
|
|
9192
|
+
dataSourceService?.update(value, { changeRecords: eventData.changeRecords });
|
|
8624
9193
|
} else {
|
|
8625
9194
|
dataSourceService?.add(value);
|
|
8626
9195
|
}
|
|
@@ -8636,7 +9205,7 @@
|
|
|
8636
9205
|
};
|
|
8637
9206
|
};
|
|
8638
9207
|
|
|
8639
|
-
const _sfc_main$
|
|
9208
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
8640
9209
|
...{
|
|
8641
9210
|
name: "MEditorDataSourceConfigPanel"
|
|
8642
9211
|
},
|
|
@@ -8667,8 +9236,8 @@
|
|
|
8667
9236
|
initValues.value = props.values;
|
|
8668
9237
|
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
8669
9238
|
});
|
|
8670
|
-
const submitHandler = (values) => {
|
|
8671
|
-
emit("submit", values);
|
|
9239
|
+
const submitHandler = (values, data) => {
|
|
9240
|
+
emit("submit", values, data);
|
|
8672
9241
|
};
|
|
8673
9242
|
const errorHandler = (error) => {
|
|
8674
9243
|
designPlugin.tMagicMessage.error(error.message);
|
|
@@ -8683,7 +9252,7 @@
|
|
|
8683
9252
|
}
|
|
8684
9253
|
});
|
|
8685
9254
|
return (_ctx, _cache) => {
|
|
8686
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9255
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$R, {
|
|
8687
9256
|
visible: boxVisible.value,
|
|
8688
9257
|
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
8689
9258
|
width: width.value,
|
|
@@ -8711,7 +9280,7 @@
|
|
|
8711
9280
|
}
|
|
8712
9281
|
});
|
|
8713
9282
|
|
|
8714
|
-
const _sfc_main$
|
|
9283
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
8715
9284
|
...{
|
|
8716
9285
|
name: "MEditorDataSourceList"
|
|
8717
9286
|
},
|
|
@@ -8720,10 +9289,11 @@
|
|
|
8720
9289
|
indent: {},
|
|
8721
9290
|
nextLevelIndentIncrement: {}
|
|
8722
9291
|
},
|
|
8723
|
-
emits: ["edit", "remove"],
|
|
9292
|
+
emits: ["edit", "remove", "node-contextmenu"],
|
|
8724
9293
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8725
9294
|
const emit = __emit;
|
|
8726
9295
|
const { depService, editorService, dataSourceService } = vue.inject("services") || {};
|
|
9296
|
+
const collecting = vue.computed(() => depService?.get("collecting"));
|
|
8727
9297
|
const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
|
|
8728
9298
|
const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
|
|
8729
9299
|
const dsDep = vue.computed(() => depService?.getTargets(core.DepTargetType.DATA_SOURCE) || {});
|
|
@@ -8791,11 +9361,6 @@
|
|
|
8791
9361
|
emit("edit", id);
|
|
8792
9362
|
};
|
|
8793
9363
|
const removeHandler = async (id) => {
|
|
8794
|
-
await designPlugin.tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
8795
|
-
confirmButtonText: "确定",
|
|
8796
|
-
cancelButtonText: "取消",
|
|
8797
|
-
type: "warning"
|
|
8798
|
-
});
|
|
8799
9364
|
emit("remove", id);
|
|
8800
9365
|
};
|
|
8801
9366
|
const selectComp = (compId) => {
|
|
@@ -8808,16 +9373,20 @@
|
|
|
8808
9373
|
selectComp(data.key);
|
|
8809
9374
|
}
|
|
8810
9375
|
};
|
|
9376
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9377
|
+
emit("node-contextmenu", event, data);
|
|
9378
|
+
};
|
|
8811
9379
|
__expose({
|
|
8812
9380
|
filter: filterTextChangeHandler
|
|
8813
9381
|
});
|
|
8814
9382
|
return (_ctx, _cache) => {
|
|
8815
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9383
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
8816
9384
|
data: list.value,
|
|
8817
9385
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
8818
9386
|
indent: _ctx.indent,
|
|
8819
9387
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8820
|
-
onNodeClick: clickHandler
|
|
9388
|
+
onNodeClick: clickHandler,
|
|
9389
|
+
onNodeContextmenu: nodeContentMenuHandler
|
|
8821
9390
|
}, {
|
|
8822
9391
|
"tree-node-label": vue.withCtx(({ data }) => [
|
|
8823
9392
|
vue.createElementVNode("div", {
|
|
@@ -8829,14 +9398,25 @@
|
|
|
8829
9398
|
}, vue.toDisplayString(data.name) + " " + vue.toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
8830
9399
|
]),
|
|
8831
9400
|
"tree-node-tool": vue.withCtx(({ data }) => [
|
|
8832
|
-
data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.
|
|
9401
|
+
collecting.value && data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTag), {
|
|
8833
9402
|
key: 0,
|
|
9403
|
+
type: "info",
|
|
9404
|
+
size: "small",
|
|
9405
|
+
style: { "margin-right": "5px" }
|
|
9406
|
+
}, {
|
|
9407
|
+
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
9408
|
+
vue.createTextVNode("依赖收集中")
|
|
9409
|
+
])),
|
|
9410
|
+
_: 1
|
|
9411
|
+
})) : vue.createCommentVNode("", true),
|
|
9412
|
+
data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
|
|
9413
|
+
key: 1,
|
|
8834
9414
|
effect: "dark",
|
|
8835
9415
|
content: editable.value ? "编辑" : "查看",
|
|
8836
9416
|
placement: "bottom"
|
|
8837
9417
|
}, {
|
|
8838
9418
|
default: vue.withCtx(() => [
|
|
8839
|
-
vue.createVNode(_sfc_main$
|
|
9419
|
+
vue.createVNode(_sfc_main$Z, {
|
|
8840
9420
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
8841
9421
|
class: "edit-icon",
|
|
8842
9422
|
onClick: vue.withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
@@ -8845,13 +9425,13 @@
|
|
|
8845
9425
|
_: 2
|
|
8846
9426
|
}, 1032, ["content"])) : vue.createCommentVNode("", true),
|
|
8847
9427
|
data.type === "ds" && editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
|
|
8848
|
-
key:
|
|
9428
|
+
key: 2,
|
|
8849
9429
|
effect: "dark",
|
|
8850
9430
|
content: "删除",
|
|
8851
9431
|
placement: "bottom"
|
|
8852
9432
|
}, {
|
|
8853
9433
|
default: vue.withCtx(() => [
|
|
8854
|
-
vue.createVNode(_sfc_main$
|
|
9434
|
+
vue.createVNode(_sfc_main$Z, {
|
|
8855
9435
|
icon: vue.unref(iconsVue.Close),
|
|
8856
9436
|
class: "edit-icon",
|
|
8857
9437
|
onClick: vue.withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
@@ -8867,17 +9447,84 @@
|
|
|
8867
9447
|
}
|
|
8868
9448
|
});
|
|
8869
9449
|
|
|
9450
|
+
const useContentMenu = () => {
|
|
9451
|
+
const eventBus = vue.inject("eventBus");
|
|
9452
|
+
const menuRef = vue.useTemplateRef("menu");
|
|
9453
|
+
let selectId = "";
|
|
9454
|
+
const menuData = [
|
|
9455
|
+
{
|
|
9456
|
+
type: "button",
|
|
9457
|
+
text: "编辑",
|
|
9458
|
+
icon: iconsVue.Edit,
|
|
9459
|
+
display: (services) => services?.dataSourceService?.get("editable") ?? true,
|
|
9460
|
+
handler: () => {
|
|
9461
|
+
if (!selectId) {
|
|
9462
|
+
return;
|
|
9463
|
+
}
|
|
9464
|
+
eventBus?.emit("edit-data-source", selectId);
|
|
9465
|
+
}
|
|
9466
|
+
},
|
|
9467
|
+
{
|
|
9468
|
+
type: "button",
|
|
9469
|
+
text: "复制并粘贴至当前",
|
|
9470
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
9471
|
+
handler: ({ dataSourceService }) => {
|
|
9472
|
+
if (!selectId) {
|
|
9473
|
+
return;
|
|
9474
|
+
}
|
|
9475
|
+
const ds = dataSourceService.getDataSourceById(selectId);
|
|
9476
|
+
if (!ds) {
|
|
9477
|
+
return;
|
|
9478
|
+
}
|
|
9479
|
+
dataSourceService.add(lodashEs.cloneDeep(ds));
|
|
9480
|
+
}
|
|
9481
|
+
},
|
|
9482
|
+
{
|
|
9483
|
+
type: "button",
|
|
9484
|
+
text: "删除",
|
|
9485
|
+
icon: iconsVue.Delete,
|
|
9486
|
+
handler: () => {
|
|
9487
|
+
if (!selectId) {
|
|
9488
|
+
return;
|
|
9489
|
+
}
|
|
9490
|
+
eventBus?.emit("remove-data-source", selectId);
|
|
9491
|
+
}
|
|
9492
|
+
}
|
|
9493
|
+
];
|
|
9494
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9495
|
+
event.preventDefault();
|
|
9496
|
+
if (data.type === "ds") {
|
|
9497
|
+
menuRef.value?.show(event);
|
|
9498
|
+
if (data.id) {
|
|
9499
|
+
selectId = `${data.id}`;
|
|
9500
|
+
} else {
|
|
9501
|
+
selectId = "";
|
|
9502
|
+
}
|
|
9503
|
+
}
|
|
9504
|
+
};
|
|
9505
|
+
const contentMenuHideHandler = () => {
|
|
9506
|
+
selectId = "";
|
|
9507
|
+
};
|
|
9508
|
+
return {
|
|
9509
|
+
menuData,
|
|
9510
|
+
nodeContentMenuHandler,
|
|
9511
|
+
contentMenuHideHandler
|
|
9512
|
+
};
|
|
9513
|
+
};
|
|
9514
|
+
|
|
8870
9515
|
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
8871
|
-
const _sfc_main$
|
|
9516
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
8872
9517
|
...{
|
|
8873
9518
|
name: "MEditorDataSourceListPanel"
|
|
8874
9519
|
},
|
|
8875
9520
|
__name: "DataSourceListPanel",
|
|
8876
9521
|
props: {
|
|
8877
9522
|
indent: {},
|
|
8878
|
-
nextLevelIndentIncrement: {}
|
|
9523
|
+
nextLevelIndentIncrement: {},
|
|
9524
|
+
customContentMenu: { type: Function }
|
|
8879
9525
|
},
|
|
8880
9526
|
setup(__props) {
|
|
9527
|
+
const props = __props;
|
|
8881
9528
|
const eventBus = vue.inject("eventBus");
|
|
8882
9529
|
const { dataSourceService } = vue.inject("services") || {};
|
|
8883
9530
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
@@ -8902,243 +9549,100 @@
|
|
|
8902
9549
|
dialogTitle.value = `新增${datasourceType?.text || ""}`;
|
|
8903
9550
|
editDialog.value.show();
|
|
8904
9551
|
};
|
|
8905
|
-
const removeHandler = (id) => {
|
|
9552
|
+
const removeHandler = async (id) => {
|
|
9553
|
+
await designPlugin.tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
9554
|
+
confirmButtonText: "确定",
|
|
9555
|
+
cancelButtonText: "取消",
|
|
9556
|
+
type: "warning"
|
|
9557
|
+
});
|
|
8906
9558
|
dataSourceService?.remove(id);
|
|
8907
9559
|
};
|
|
8908
9560
|
const dataSourceList = vue.ref();
|
|
8909
|
-
const filterTextChangeHandler = (val) => {
|
|
8910
|
-
dataSourceList.value?.filter(val);
|
|
8911
|
-
};
|
|
8912
|
-
eventBus?.on("edit-data-source", (id) => {
|
|
8913
|
-
editHandler(id);
|
|
8914
|
-
});
|
|
8915
|
-
return (_ctx, _cache) => {
|
|
8916
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
8917
|
-
vue.createVNode(vue.unref(designPlugin.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8918
|
-
default: vue.withCtx(() => [
|
|
8919
|
-
vue.createElementVNode("div", _hoisted_1$6, [
|
|
8920
|
-
vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8921
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicPopover), {
|
|
8922
|
-
key: 0,
|
|
8923
|
-
placement: "right",
|
|
8924
|
-
trigger: "hover",
|
|
8925
|
-
"popper-class": "data-source-list-panel-add-menu",
|
|
8926
|
-
"destroy-on-close": true
|
|
8927
|
-
}, {
|
|
8928
|
-
reference: vue.withCtx(() => [
|
|
8929
|
-
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
8930
|
-
type: "primary",
|
|
8931
|
-
size: "small"
|
|
8932
|
-
}, {
|
|
8933
|
-
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
8934
|
-
vue.createTextVNode("新增")
|
|
8935
|
-
])),
|
|
8936
|
-
_: 1
|
|
8937
|
-
})
|
|
8938
|
-
]),
|
|
8939
|
-
default: vue.withCtx(() => [
|
|
8940
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
8941
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$y, {
|
|
8942
|
-
data: {
|
|
8943
|
-
type: "button",
|
|
8944
|
-
text: item.text,
|
|
8945
|
-
handler: () => {
|
|
8946
|
-
addHandler(item.type);
|
|
8947
|
-
}
|
|
8948
|
-
},
|
|
8949
|
-
key: index
|
|
8950
|
-
}, null, 8, ["data"]);
|
|
8951
|
-
}), 128))
|
|
8952
|
-
]),
|
|
8953
|
-
_: 1
|
|
8954
|
-
})) : vue.createCommentVNode("", true),
|
|
8955
|
-
vue.renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
8956
|
-
]),
|
|
8957
|
-
vue.createVNode(_sfc_main$i, {
|
|
8958
|
-
ref_key: "dataSourceList",
|
|
8959
|
-
ref: dataSourceList,
|
|
8960
|
-
indent: _ctx.indent,
|
|
8961
|
-
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8962
|
-
onEdit: vue.unref(editHandler),
|
|
8963
|
-
onRemove: removeHandler
|
|
8964
|
-
}, null, 8, ["indent", "next-level-indent-increment", "onEdit"])
|
|
8965
|
-
]),
|
|
8966
|
-
_: 3
|
|
8967
|
-
}),
|
|
8968
|
-
vue.createVNode(_sfc_main$j, {
|
|
8969
|
-
ref_key: "editDialog",
|
|
8970
|
-
ref: editDialog,
|
|
8971
|
-
disabled: !vue.unref(editable),
|
|
8972
|
-
values: vue.unref(dataSourceValues),
|
|
8973
|
-
title: vue.unref(dialogTitle),
|
|
8974
|
-
onSubmit: vue.unref(submitDataSourceHandler)
|
|
8975
|
-
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
8976
|
-
], 64);
|
|
8977
|
-
};
|
|
8978
|
-
}
|
|
8979
|
-
});
|
|
8980
|
-
|
|
8981
|
-
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
8982
|
-
...{
|
|
8983
|
-
name: "MEditorContentMenu"
|
|
8984
|
-
},
|
|
8985
|
-
__name: "ContentMenu",
|
|
8986
|
-
props: {
|
|
8987
|
-
menuData: { default: () => [] },
|
|
8988
|
-
isSubMenu: { type: Boolean, default: false },
|
|
8989
|
-
active: {},
|
|
8990
|
-
autoHide: { type: Boolean, default: true }
|
|
8991
|
-
},
|
|
8992
|
-
emits: ["hide", "show", "mouseenter"],
|
|
8993
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8994
|
-
const props = __props;
|
|
8995
|
-
const emit = __emit;
|
|
8996
|
-
const menu = vue.ref();
|
|
8997
|
-
const buttons = vue.ref();
|
|
8998
|
-
const subMenu = vue.ref();
|
|
8999
|
-
const visible = vue.ref(false);
|
|
9000
|
-
const subMenuData = vue.ref([]);
|
|
9001
|
-
const zIndex = designPlugin.useZIndex();
|
|
9002
|
-
const curZIndex = vue.ref(0);
|
|
9003
|
-
const menuPosition = vue.ref({
|
|
9004
|
-
left: 0,
|
|
9005
|
-
top: 0
|
|
9006
|
-
});
|
|
9007
|
-
const menuStyle = vue.computed(() => ({
|
|
9008
|
-
top: `${menuPosition.value.top}px`,
|
|
9009
|
-
left: `${menuPosition.value.left}px`,
|
|
9010
|
-
zIndex: curZIndex.value
|
|
9011
|
-
}));
|
|
9012
|
-
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
9013
|
-
const hide = () => {
|
|
9014
|
-
if (!visible.value) return;
|
|
9015
|
-
visible.value = false;
|
|
9016
|
-
subMenu.value?.hide();
|
|
9017
|
-
emit("hide");
|
|
9018
|
-
};
|
|
9019
|
-
const clickHandler = () => {
|
|
9020
|
-
if (!props.autoHide) return;
|
|
9021
|
-
hide();
|
|
9022
|
-
};
|
|
9023
|
-
const outsideClickHideHandler = (e) => {
|
|
9024
|
-
if (!props.autoHide) return;
|
|
9025
|
-
const target = e.target;
|
|
9026
|
-
if (!visible.value || !target) {
|
|
9027
|
-
return;
|
|
9028
|
-
}
|
|
9029
|
-
if (contains(target)) {
|
|
9030
|
-
return;
|
|
9031
|
-
}
|
|
9032
|
-
hide();
|
|
9033
|
-
};
|
|
9034
|
-
const setPosition = (e) => {
|
|
9035
|
-
const menuHeight = menu.value?.clientHeight || 0;
|
|
9036
|
-
let top = e.clientY;
|
|
9037
|
-
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
9038
|
-
top = document.body.clientHeight - menuHeight;
|
|
9039
|
-
}
|
|
9040
|
-
menuPosition.value = {
|
|
9041
|
-
top,
|
|
9042
|
-
left: e.clientX
|
|
9043
|
-
};
|
|
9044
|
-
};
|
|
9045
|
-
const show = (e) => {
|
|
9046
|
-
setTimeout(() => {
|
|
9047
|
-
visible.value = true;
|
|
9048
|
-
vue.nextTick(() => {
|
|
9049
|
-
e && setPosition(e);
|
|
9050
|
-
curZIndex.value = zIndex.nextZIndex();
|
|
9051
|
-
emit("show");
|
|
9052
|
-
});
|
|
9053
|
-
}, 300);
|
|
9054
|
-
};
|
|
9055
|
-
const showSubMenu = (item, index) => {
|
|
9056
|
-
const menuItem = item;
|
|
9057
|
-
if (typeof item !== "object") {
|
|
9058
|
-
return;
|
|
9059
|
-
}
|
|
9060
|
-
subMenuData.value = menuItem.items || [];
|
|
9061
|
-
setTimeout(() => {
|
|
9062
|
-
if (!visible.value) {
|
|
9063
|
-
return;
|
|
9064
|
-
}
|
|
9065
|
-
if (menu.value) {
|
|
9066
|
-
let y = menu.value.offsetTop;
|
|
9067
|
-
if (buttons.value?.[index].$el) {
|
|
9068
|
-
const rect = buttons.value?.[index].$el.getBoundingClientRect();
|
|
9069
|
-
y = rect.top;
|
|
9070
|
-
}
|
|
9071
|
-
subMenu.value?.show({
|
|
9072
|
-
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
9073
|
-
clientY: y
|
|
9074
|
-
});
|
|
9075
|
-
}
|
|
9076
|
-
}, 0);
|
|
9077
|
-
};
|
|
9078
|
-
const mouseenterHandler = () => {
|
|
9079
|
-
emit("mouseenter");
|
|
9561
|
+
const filterTextChangeHandler = (val) => {
|
|
9562
|
+
dataSourceList.value?.filter(val);
|
|
9080
9563
|
};
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
|
|
9084
|
-
});
|
|
9085
|
-
vue.onBeforeUnmount(() => {
|
|
9086
|
-
if (props.isSubMenu) return;
|
|
9087
|
-
globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
|
|
9564
|
+
eventBus?.on("edit-data-source", (id) => {
|
|
9565
|
+
editHandler(id);
|
|
9088
9566
|
});
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
menuPosition,
|
|
9092
|
-
hide,
|
|
9093
|
-
show,
|
|
9094
|
-
contains,
|
|
9095
|
-
setPosition
|
|
9567
|
+
eventBus?.on("remove-data-source", (id) => {
|
|
9568
|
+
removeHandler(id);
|
|
9096
9569
|
});
|
|
9570
|
+
const { nodeContentMenuHandler, menuData: contentMenuData, contentMenuHideHandler } = useContentMenu();
|
|
9571
|
+
const menuData = vue.computed(
|
|
9572
|
+
() => props.customContentMenu(contentMenuData, "data-source")
|
|
9573
|
+
);
|
|
9097
9574
|
return (_ctx, _cache) => {
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
ref: menu,
|
|
9105
|
-
style: vue.normalizeStyle(menuStyle.value),
|
|
9106
|
-
onMouseenter: _cache[0] || (_cache[0] = ($event) => mouseenterHandler())
|
|
9107
|
-
}, [
|
|
9108
|
-
vue.renderSlot(_ctx.$slots, "title"),
|
|
9109
|
-
vue.createElementVNode("div", null, [
|
|
9110
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
9111
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$y, {
|
|
9112
|
-
"event-type": "mouseup",
|
|
9113
|
-
ref_for: true,
|
|
9114
|
-
ref_key: "buttons",
|
|
9115
|
-
ref: buttons,
|
|
9116
|
-
class: vue.normalizeClass({ active: _ctx.active && item.id === _ctx.active }),
|
|
9117
|
-
data: item,
|
|
9118
|
-
key: index,
|
|
9119
|
-
onMouseup: clickHandler,
|
|
9120
|
-
onMouseenter: ($event) => showSubMenu(item, index)
|
|
9121
|
-
}, null, 8, ["class", "data", "onMouseenter"]);
|
|
9122
|
-
}), 128))
|
|
9123
|
-
]),
|
|
9124
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
9125
|
-
subMenuData.value.length ? (vue.openBlock(), vue.createBlock(_component_content_menu, {
|
|
9575
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
9576
|
+
vue.createVNode(vue.unref(designPlugin.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
9577
|
+
default: vue.withCtx(() => [
|
|
9578
|
+
vue.createElementVNode("div", _hoisted_1$6, [
|
|
9579
|
+
vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
9580
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicPopover), {
|
|
9126
9581
|
key: 0,
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9582
|
+
placement: "right",
|
|
9583
|
+
trigger: "hover",
|
|
9584
|
+
"popper-class": "data-source-list-panel-add-menu",
|
|
9585
|
+
"destroy-on-close": true
|
|
9586
|
+
}, {
|
|
9587
|
+
reference: vue.withCtx(() => [
|
|
9588
|
+
vue.createVNode(vue.unref(designPlugin.TMagicButton), {
|
|
9589
|
+
type: "primary",
|
|
9590
|
+
size: "small"
|
|
9591
|
+
}, {
|
|
9592
|
+
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
9593
|
+
vue.createTextVNode("新增")
|
|
9594
|
+
])),
|
|
9595
|
+
_: 1
|
|
9596
|
+
})
|
|
9597
|
+
]),
|
|
9598
|
+
default: vue.withCtx(() => [
|
|
9599
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
9600
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
9601
|
+
data: {
|
|
9602
|
+
type: "button",
|
|
9603
|
+
text: item.text,
|
|
9604
|
+
handler: () => {
|
|
9605
|
+
addHandler(item.type);
|
|
9606
|
+
}
|
|
9607
|
+
},
|
|
9608
|
+
key: index
|
|
9609
|
+
}, null, 8, ["data"]);
|
|
9610
|
+
}), 128))
|
|
9611
|
+
]),
|
|
9612
|
+
_: 1
|
|
9613
|
+
})) : vue.createCommentVNode("", true),
|
|
9614
|
+
vue.renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
9615
|
+
]),
|
|
9616
|
+
vue.createVNode(_sfc_main$h, {
|
|
9617
|
+
ref_key: "dataSourceList",
|
|
9618
|
+
ref: dataSourceList,
|
|
9619
|
+
indent: _ctx.indent,
|
|
9620
|
+
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
9621
|
+
onEdit: vue.unref(editHandler),
|
|
9622
|
+
onRemove: removeHandler,
|
|
9623
|
+
onNodeContextmenu: vue.unref(nodeContentMenuHandler)
|
|
9624
|
+
}, null, 8, ["indent", "next-level-indent-increment", "onEdit", "onNodeContextmenu"])
|
|
9625
|
+
]),
|
|
9626
|
+
_: 3
|
|
9627
|
+
}),
|
|
9628
|
+
vue.createVNode(_sfc_main$i, {
|
|
9629
|
+
ref_key: "editDialog",
|
|
9630
|
+
ref: editDialog,
|
|
9631
|
+
disabled: !vue.unref(editable),
|
|
9632
|
+
values: vue.unref(dataSourceValues),
|
|
9633
|
+
title: vue.unref(dialogTitle),
|
|
9634
|
+
onSubmit: vue.unref(submitDataSourceHandler)
|
|
9635
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"]),
|
|
9636
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
9637
|
+
menuData.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
9638
|
+
key: 0,
|
|
9639
|
+
"menu-data": menuData.value,
|
|
9640
|
+
ref: "menu",
|
|
9641
|
+
style: { "overflow": "initial" },
|
|
9642
|
+
onHide: vue.unref(contentMenuHideHandler)
|
|
9643
|
+
}, null, 8, ["menu-data", "onHide"])) : vue.createCommentVNode("", true)
|
|
9644
|
+
]))
|
|
9645
|
+
], 64);
|
|
9142
9646
|
};
|
|
9143
9647
|
}
|
|
9144
9648
|
});
|
|
@@ -9248,15 +9752,15 @@
|
|
|
9248
9752
|
},
|
|
9249
9753
|
__name: "LayerMenu",
|
|
9250
9754
|
props: {
|
|
9251
|
-
layerContentMenu: {
|
|
9252
|
-
customContentMenu: { type: Function
|
|
9755
|
+
layerContentMenu: {},
|
|
9756
|
+
customContentMenu: { type: Function }
|
|
9253
9757
|
},
|
|
9254
9758
|
emits: ["collapse-all"],
|
|
9255
9759
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
9256
9760
|
const props = __props;
|
|
9257
9761
|
const emit = __emit;
|
|
9258
9762
|
const services = vue.inject("services");
|
|
9259
|
-
const menu = vue.
|
|
9763
|
+
const menu = vue.useTemplateRef("menu");
|
|
9260
9764
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
9261
9765
|
const nodes = vue.computed(() => services?.editorService.get("nodes"));
|
|
9262
9766
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
@@ -9338,7 +9842,7 @@
|
|
|
9338
9842
|
show
|
|
9339
9843
|
});
|
|
9340
9844
|
return (_ctx, _cache) => {
|
|
9341
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9845
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
9342
9846
|
"menu-data": menuData.value,
|
|
9343
9847
|
ref_key: "menu",
|
|
9344
9848
|
ref: menu,
|
|
@@ -9366,12 +9870,12 @@
|
|
|
9366
9870
|
};
|
|
9367
9871
|
return (_ctx, _cache) => {
|
|
9368
9872
|
return _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
9369
|
-
_ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9873
|
+
_ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
9370
9874
|
key: 0,
|
|
9371
9875
|
icon: vue.unref(iconsVue.Hide),
|
|
9372
9876
|
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
9373
9877
|
title: "点击显示"
|
|
9374
|
-
}, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
9878
|
+
}, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
9375
9879
|
key: 1,
|
|
9376
9880
|
icon: vue.unref(iconsVue.View),
|
|
9377
9881
|
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -9448,7 +9952,7 @@
|
|
|
9448
9952
|
select(data);
|
|
9449
9953
|
});
|
|
9450
9954
|
};
|
|
9451
|
-
const menu = vue.
|
|
9955
|
+
const menu = vue.useTemplateRef("menu");
|
|
9452
9956
|
return {
|
|
9453
9957
|
menu,
|
|
9454
9958
|
nodeClickHandler,
|
|
@@ -9767,7 +10271,7 @@
|
|
|
9767
10271
|
draggable: false
|
|
9768
10272
|
});
|
|
9769
10273
|
page.items.forEach(
|
|
9770
|
-
(node) => traverseNode(node, (node2) => {
|
|
10274
|
+
(node) => utils.traverseNode(node, (node2) => {
|
|
9771
10275
|
map.set(
|
|
9772
10276
|
node2.id,
|
|
9773
10277
|
initialLayerNodeStatus?.get(node2.id) || {
|
|
@@ -9822,7 +10326,7 @@
|
|
|
9822
10326
|
services?.editorService.on("add", (newNodes) => {
|
|
9823
10327
|
newNodes.forEach((node) => {
|
|
9824
10328
|
if (utils.isPage(node) || utils.isPageFragment(node)) return;
|
|
9825
|
-
traverseNode(node, (node2) => {
|
|
10329
|
+
utils.traverseNode(node, (node2) => {
|
|
9826
10330
|
nodeStatusMap.value?.set(node2.id, {
|
|
9827
10331
|
visible: true,
|
|
9828
10332
|
expand: Array.isArray(node2.items),
|
|
@@ -9834,7 +10338,7 @@
|
|
|
9834
10338
|
});
|
|
9835
10339
|
services?.editorService.on("remove", (nodes2) => {
|
|
9836
10340
|
nodes2.forEach((node) => {
|
|
9837
|
-
traverseNode(node, (node2) => {
|
|
10341
|
+
utils.traverseNode(node, (node2) => {
|
|
9838
10342
|
nodeStatusMap.value?.delete(node2.id);
|
|
9839
10343
|
});
|
|
9840
10344
|
});
|
|
@@ -9859,7 +10363,7 @@
|
|
|
9859
10363
|
setup(__props) {
|
|
9860
10364
|
const services = vue.inject("services");
|
|
9861
10365
|
const editorService = services?.editorService;
|
|
9862
|
-
const tree = vue.
|
|
10366
|
+
const tree = vue.useTemplateRef("tree");
|
|
9863
10367
|
const page = vue.computed(() => editorService?.get("page"));
|
|
9864
10368
|
const nodeData = vue.computed(() => !page.value ? [] : [page.value]);
|
|
9865
10369
|
const { nodeStatusMap } = useNodeStatus(services);
|
|
@@ -9895,8 +10399,8 @@
|
|
|
9895
10399
|
return vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9896
10400
|
default: vue.withCtx(() => [
|
|
9897
10401
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9898
|
-
vue.createVNode(_sfc_main$
|
|
9899
|
-
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
10402
|
+
vue.createVNode(_sfc_main$n, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
10403
|
+
page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
9900
10404
|
key: 0,
|
|
9901
10405
|
tabindex: "-1",
|
|
9902
10406
|
ref_key: "tree",
|
|
@@ -10018,7 +10522,7 @@
|
|
|
10018
10522
|
return vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicScrollbar), null, {
|
|
10019
10523
|
default: vue.withCtx(() => [
|
|
10020
10524
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
10021
|
-
vue.createVNode(_sfc_main$
|
|
10525
|
+
vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
10022
10526
|
vue.renderSlot(_ctx.$slots, "component-list", { componentGroupList: list.value }, () => [
|
|
10023
10527
|
vue.createVNode(vue.unref(designPlugin.TMagicCollapse), {
|
|
10024
10528
|
class: "ui-component-panel",
|
|
@@ -10032,7 +10536,7 @@
|
|
|
10032
10536
|
name: `${index}`
|
|
10033
10537
|
}, {
|
|
10034
10538
|
title: vue.withCtx(() => [
|
|
10035
|
-
vue.createVNode(_sfc_main$
|
|
10539
|
+
vue.createVNode(_sfc_main$Z, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
10036
10540
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
10037
10541
|
]),
|
|
10038
10542
|
default: vue.withCtx(() => [
|
|
@@ -10053,7 +10557,7 @@
|
|
|
10053
10557
|
content: item.desc
|
|
10054
10558
|
}, {
|
|
10055
10559
|
default: vue.withCtx(() => [
|
|
10056
|
-
vue.createVNode(_sfc_main$
|
|
10560
|
+
vue.createVNode(_sfc_main$Z, {
|
|
10057
10561
|
icon: item.icon
|
|
10058
10562
|
}, null, 8, ["icon"])
|
|
10059
10563
|
]),
|
|
@@ -10111,6 +10615,7 @@
|
|
|
10111
10615
|
setup(__props, { expose: __expose }) {
|
|
10112
10616
|
const props = __props;
|
|
10113
10617
|
const services = vue.inject("services");
|
|
10618
|
+
const collecting = vue.computed(() => services?.depService.get("collecting"));
|
|
10114
10619
|
const columnLeftWidth = vue.computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
|
|
10115
10620
|
const { height: editorContentHeight } = useEditorContentHeight();
|
|
10116
10621
|
const columnLeftHeight = vue.ref(0);
|
|
@@ -10158,10 +10663,11 @@
|
|
|
10158
10663
|
type: "component",
|
|
10159
10664
|
icon: iconsVue.EditPen,
|
|
10160
10665
|
text: "代码编辑",
|
|
10161
|
-
component: _sfc_main$
|
|
10666
|
+
component: _sfc_main$j,
|
|
10162
10667
|
props: {
|
|
10163
10668
|
indent: props.indent,
|
|
10164
|
-
nextLevelIndentIncrement: props.nextLevelIndentIncrement
|
|
10669
|
+
nextLevelIndentIncrement: props.nextLevelIndentIncrement,
|
|
10670
|
+
customContentMenu: props.customContentMenu
|
|
10165
10671
|
},
|
|
10166
10672
|
slots: {}
|
|
10167
10673
|
},
|
|
@@ -10170,10 +10676,11 @@
|
|
|
10170
10676
|
type: "component",
|
|
10171
10677
|
icon: iconsVue.Coin,
|
|
10172
10678
|
text: "数据源",
|
|
10173
|
-
component: _sfc_main$
|
|
10679
|
+
component: _sfc_main$g,
|
|
10174
10680
|
props: {
|
|
10175
10681
|
indent: props.indent,
|
|
10176
|
-
nextLevelIndentIncrement: props.nextLevelIndentIncrement
|
|
10682
|
+
nextLevelIndentIncrement: props.nextLevelIndentIncrement,
|
|
10683
|
+
customContentMenu: props.customContentMenu
|
|
10177
10684
|
},
|
|
10178
10685
|
slots: {}
|
|
10179
10686
|
}
|
|
@@ -10241,7 +10748,7 @@
|
|
|
10241
10748
|
(...args) => vue.unref(dragstartHandler) && vue.unref(dragstartHandler)(...args)),
|
|
10242
10749
|
onDragend: ($event) => vue.unref(dragendHandler)(config.$key, $event)
|
|
10243
10750
|
}, [
|
|
10244
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
10751
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$Z, {
|
|
10245
10752
|
key: 0,
|
|
10246
10753
|
icon: config.icon
|
|
10247
10754
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -10253,7 +10760,7 @@
|
|
|
10253
10760
|
]),
|
|
10254
10761
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
10255
10762
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
10256
|
-
class: "m-editor-sidebar-content",
|
|
10763
|
+
class: vue.normalizeClass(["m-editor-sidebar-content", { "m-editor-dep-collecting": collecting.value }]),
|
|
10257
10764
|
key: config.$key ?? index
|
|
10258
10765
|
}, [
|
|
10259
10766
|
config?.component && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
|
|
@@ -10379,7 +10886,7 @@
|
|
|
10379
10886
|
key: "11"
|
|
10380
10887
|
} : void 0
|
|
10381
10888
|
]), 1040)) : vue.createCommentVNode("", true)
|
|
10382
|
-
])), [
|
|
10889
|
+
], 2)), [
|
|
10383
10890
|
[vue.vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
|
|
10384
10891
|
]);
|
|
10385
10892
|
}), 128))
|
|
@@ -10387,7 +10894,7 @@
|
|
|
10387
10894
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
10388
10895
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
|
|
10389
10896
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
10390
|
-
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
10897
|
+
vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$R, {
|
|
10391
10898
|
key: config.$key ?? index,
|
|
10392
10899
|
visible: vue.unref(floatBoxStates)[config.$key].status,
|
|
10393
10900
|
"onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -10433,8 +10940,8 @@
|
|
|
10433
10940
|
setup(__props, { emit: __emit }) {
|
|
10434
10941
|
const props = __props;
|
|
10435
10942
|
const emit = __emit;
|
|
10436
|
-
const bar = vue.
|
|
10437
|
-
const thumb = vue.
|
|
10943
|
+
const bar = vue.useTemplateRef("bar");
|
|
10944
|
+
const thumb = vue.useTemplateRef("thumb");
|
|
10438
10945
|
const thumbSize = vue.computed(() => props.size * (props.size / props.scrollSize));
|
|
10439
10946
|
const thumbPos = vue.computed(() => props.pos / props.scrollSize * props.size);
|
|
10440
10947
|
const thumbStyle = vue.computed(() => ({
|
|
@@ -10522,8 +11029,8 @@
|
|
|
10522
11029
|
},
|
|
10523
11030
|
setup(__props, { expose: __expose }) {
|
|
10524
11031
|
const props = __props;
|
|
10525
|
-
const container = vue.
|
|
10526
|
-
const el = vue.
|
|
11032
|
+
const container = vue.useTemplateRef("container");
|
|
11033
|
+
const el = vue.useTemplateRef("el");
|
|
10527
11034
|
const style = vue.computed(
|
|
10528
11035
|
() => `
|
|
10529
11036
|
width: ${utils.isNumber(`${props.width}`) ? `${props.width}px` : props.width};
|
|
@@ -10617,8 +11124,8 @@
|
|
|
10617
11124
|
const editorService = services?.editorService;
|
|
10618
11125
|
const visible = vue.ref(false);
|
|
10619
11126
|
const buttonVisible = vue.ref(false);
|
|
10620
|
-
const button = vue.
|
|
10621
|
-
const box = vue.
|
|
11127
|
+
const button = vue.useTemplateRef("button");
|
|
11128
|
+
const box = vue.useTemplateRef("box");
|
|
10622
11129
|
const stage = vue.computed(() => editorService?.get("stage"));
|
|
10623
11130
|
const page = vue.computed(() => editorService?.get("page"));
|
|
10624
11131
|
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
@@ -10690,7 +11197,7 @@
|
|
|
10690
11197
|
]),
|
|
10691
11198
|
_: 1
|
|
10692
11199
|
})) : vue.createCommentVNode("", true),
|
|
10693
|
-
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
11200
|
+
page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$R, {
|
|
10694
11201
|
key: 1,
|
|
10695
11202
|
ref_key: "box",
|
|
10696
11203
|
ref: box,
|
|
@@ -10700,7 +11207,7 @@
|
|
|
10700
11207
|
position: menuPosition.value
|
|
10701
11208
|
}, {
|
|
10702
11209
|
body: vue.withCtx(() => [
|
|
10703
|
-
vue.createVNode(_sfc_main$
|
|
11210
|
+
vue.createVNode(_sfc_main$l, {
|
|
10704
11211
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10705
11212
|
data: nodeData.value,
|
|
10706
11213
|
"node-status-map": vue.unref(nodeStatusMap),
|
|
@@ -10719,7 +11226,7 @@
|
|
|
10719
11226
|
setup(__props) {
|
|
10720
11227
|
const services = vue.inject("services");
|
|
10721
11228
|
const stageOptions = vue.inject("stageOptions");
|
|
10722
|
-
const stageOverlay = vue.
|
|
11229
|
+
const stageOverlay = vue.useTemplateRef("stageOverlay");
|
|
10723
11230
|
const stageOverlayVisible = vue.computed(() => services?.stageOverlayService.get("stageOverlayVisible"));
|
|
10724
11231
|
const wrapWidth = vue.computed(() => services?.stageOverlayService.get("wrapWidth") || 0);
|
|
10725
11232
|
const wrapHeight = vue.computed(() => services?.stageOverlayService.get("wrapHeight") || 0);
|
|
@@ -10833,14 +11340,14 @@
|
|
|
10833
11340
|
__name: "ViewerMenu",
|
|
10834
11341
|
props: {
|
|
10835
11342
|
isMultiSelect: { type: Boolean, default: false },
|
|
10836
|
-
stageContentMenu: {
|
|
10837
|
-
customContentMenu: {
|
|
11343
|
+
stageContentMenu: {},
|
|
11344
|
+
customContentMenu: {}
|
|
10838
11345
|
},
|
|
10839
11346
|
setup(__props, { expose: __expose }) {
|
|
10840
11347
|
const props = __props;
|
|
10841
11348
|
const services = vue.inject("services");
|
|
10842
11349
|
const editorService = services?.editorService;
|
|
10843
|
-
const menu = vue.
|
|
11350
|
+
const menu = vue.useTemplateRef("menu");
|
|
10844
11351
|
const canCenter = vue.ref(false);
|
|
10845
11352
|
const node = vue.computed(() => editorService?.get("node"));
|
|
10846
11353
|
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
@@ -10945,7 +11452,7 @@
|
|
|
10945
11452
|
};
|
|
10946
11453
|
__expose({ show });
|
|
10947
11454
|
return (_ctx, _cache) => {
|
|
10948
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
11455
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
10949
11456
|
"menu-data": menuData.value,
|
|
10950
11457
|
ref_key: "menu",
|
|
10951
11458
|
ref: menu
|
|
@@ -10960,18 +11467,20 @@
|
|
|
10960
11467
|
},
|
|
10961
11468
|
__name: "Stage",
|
|
10962
11469
|
props: {
|
|
11470
|
+
stageOptions: {},
|
|
10963
11471
|
stageContentMenu: {},
|
|
10964
11472
|
disabledStageOverlay: { type: Boolean, default: false },
|
|
10965
11473
|
customContentMenu: {}
|
|
10966
11474
|
},
|
|
10967
11475
|
setup(__props) {
|
|
11476
|
+
const props = __props;
|
|
10968
11477
|
let stage = null;
|
|
10969
11478
|
let runtime = null;
|
|
10970
11479
|
const services = vue.inject("services");
|
|
10971
|
-
const
|
|
10972
|
-
const stageWrap = vue.
|
|
10973
|
-
const stageContainer = vue.
|
|
10974
|
-
const menu = vue.
|
|
11480
|
+
const stageLoading = vue.computed(() => services?.editorService.get("stageLoading") || false);
|
|
11481
|
+
const stageWrap = vue.useTemplateRef("stageWrap");
|
|
11482
|
+
const stageContainer = vue.useTemplateRef("stageContainer");
|
|
11483
|
+
const menu = vue.useTemplateRef("menu");
|
|
10975
11484
|
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
10976
11485
|
const isMultiSelect = vue.computed(() => nodes.value.length > 1);
|
|
10977
11486
|
const stageRect = vue.computed(() => services?.uiService.get("stageRect"));
|
|
@@ -10983,8 +11492,8 @@
|
|
|
10983
11492
|
vue.watchEffect(() => {
|
|
10984
11493
|
if (stage || !page.value) return;
|
|
10985
11494
|
if (!stageContainer.value) return;
|
|
10986
|
-
if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value) return;
|
|
10987
|
-
stage = useStage(stageOptions);
|
|
11495
|
+
if (!(props.stageOptions?.runtimeUrl || props.stageOptions?.render) || !root.value) return;
|
|
11496
|
+
stage = useStage(props.stageOptions);
|
|
10988
11497
|
stage.on("select", () => {
|
|
10989
11498
|
stageWrap.value?.container?.focus();
|
|
10990
11499
|
});
|
|
@@ -11004,14 +11513,23 @@
|
|
|
11004
11513
|
});
|
|
11005
11514
|
vue.onBeforeUnmount(() => {
|
|
11006
11515
|
stage?.destroy();
|
|
11516
|
+
services?.editorService.set("stage", null);
|
|
11007
11517
|
});
|
|
11008
11518
|
vue.watch(zoom, (zoom2) => {
|
|
11009
11519
|
if (!stage || !zoom2) return;
|
|
11010
11520
|
stage.setZoom(zoom2);
|
|
11011
11521
|
});
|
|
11522
|
+
let timeoutId = null;
|
|
11012
11523
|
vue.watch(page, (page2) => {
|
|
11013
11524
|
if (runtime && page2) {
|
|
11014
11525
|
services?.editorService.set("stageLoading", true);
|
|
11526
|
+
if (timeoutId) {
|
|
11527
|
+
globalThis.clearTimeout(timeoutId);
|
|
11528
|
+
}
|
|
11529
|
+
timeoutId = globalThis.setTimeout(() => {
|
|
11530
|
+
services?.editorService.set("stageLoading", false);
|
|
11531
|
+
timeoutId = null;
|
|
11532
|
+
}, 3e3);
|
|
11015
11533
|
runtime.updatePageId?.(page2.id);
|
|
11016
11534
|
vue.nextTick(() => {
|
|
11017
11535
|
stage?.select(page2.id);
|
|
@@ -11063,7 +11581,9 @@
|
|
|
11063
11581
|
if (!config || config.dragType !== DragType.COMPONENT_LIST) return;
|
|
11064
11582
|
e.preventDefault();
|
|
11065
11583
|
const doc = stage?.renderer?.contentWindow?.document;
|
|
11066
|
-
const parentEl = doc?.querySelector(
|
|
11584
|
+
const parentEl = doc?.querySelector(
|
|
11585
|
+
`.${props.stageOptions?.containerHighlightClassName}`
|
|
11586
|
+
);
|
|
11067
11587
|
let parent = page.value;
|
|
11068
11588
|
const parentId = utils.getIdFromEl()(parentEl);
|
|
11069
11589
|
if (parentId) {
|
|
@@ -11102,11 +11622,13 @@
|
|
|
11102
11622
|
}
|
|
11103
11623
|
};
|
|
11104
11624
|
return (_ctx, _cache) => {
|
|
11105
|
-
|
|
11625
|
+
const _directive_loading = vue.resolveDirective("loading");
|
|
11626
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$8, {
|
|
11106
11627
|
class: "m-editor-stage",
|
|
11107
11628
|
ref_key: "stageWrap",
|
|
11108
11629
|
ref: stageWrap,
|
|
11109
11630
|
tabindex: "-1",
|
|
11631
|
+
"element-loading-text": "Runtime 加载中...",
|
|
11110
11632
|
width: stageRect.value?.width,
|
|
11111
11633
|
height: stageRect.value?.height,
|
|
11112
11634
|
"wrap-width": stageContainerRect.value?.width,
|
|
@@ -11116,7 +11638,7 @@
|
|
|
11116
11638
|
width: 60,
|
|
11117
11639
|
height: 50
|
|
11118
11640
|
},
|
|
11119
|
-
onClick: _cache[0] || (_cache[0] = ($event) => stageWrap
|
|
11641
|
+
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(stageWrap)?.container?.focus())
|
|
11120
11642
|
}, {
|
|
11121
11643
|
content: vue.withCtx(() => [
|
|
11122
11644
|
!_ctx.disabledStageOverlay ? (vue.openBlock(), vue.createBlock(_sfc_main$6, { key: 0 })) : vue.createCommentVNode("", true),
|
|
@@ -11143,7 +11665,9 @@
|
|
|
11143
11665
|
vue.createVNode(_sfc_main$7)
|
|
11144
11666
|
]),
|
|
11145
11667
|
_: 1
|
|
11146
|
-
}, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"])
|
|
11668
|
+
}, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"])), [
|
|
11669
|
+
[_directive_loading, stageLoading.value]
|
|
11670
|
+
]);
|
|
11147
11671
|
};
|
|
11148
11672
|
}
|
|
11149
11673
|
});
|
|
@@ -11205,18 +11729,20 @@
|
|
|
11205
11729
|
customContentMenu: {}
|
|
11206
11730
|
},
|
|
11207
11731
|
setup(__props) {
|
|
11732
|
+
const stageOptions = vue.inject("stageOptions");
|
|
11208
11733
|
const services = vue.inject("services");
|
|
11209
11734
|
const page = vue.computed(() => services?.editorService.get("page"));
|
|
11210
11735
|
return (_ctx, _cache) => {
|
|
11211
11736
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
11212
11737
|
vue.createVNode(_sfc_main$2),
|
|
11213
11738
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
11214
|
-
page.value ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
|
|
11739
|
+
page.value && (vue.unref(stageOptions)?.render || vue.unref(stageOptions)?.runtimeUrl) ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
|
|
11215
11740
|
key: 0,
|
|
11741
|
+
"stage-options": vue.unref(stageOptions),
|
|
11216
11742
|
"disabled-stage-overlay": _ctx.disabledStageOverlay,
|
|
11217
11743
|
"stage-content-menu": _ctx.stageContentMenu,
|
|
11218
11744
|
"custom-content-menu": _ctx.customContentMenu
|
|
11219
|
-
}, null, 8, ["disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : vue.createCommentVNode("", true)
|
|
11745
|
+
}, null, 8, ["stage-options", "disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : vue.createCommentVNode("", true)
|
|
11220
11746
|
]),
|
|
11221
11747
|
vue.renderSlot(_ctx.$slots, "workspace-content")
|
|
11222
11748
|
]);
|
|
@@ -11566,12 +12092,17 @@
|
|
|
11566
12092
|
this.emit("add", newConfig);
|
|
11567
12093
|
return newConfig;
|
|
11568
12094
|
}
|
|
11569
|
-
update(config) {
|
|
12095
|
+
update(config, { changeRecords = [] } = {}) {
|
|
11570
12096
|
const dataSources = this.get("dataSources");
|
|
11571
12097
|
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
11572
|
-
dataSources[index]
|
|
11573
|
-
|
|
11574
|
-
|
|
12098
|
+
const oldConfig = dataSources[index];
|
|
12099
|
+
const newConfig = lodashEs.cloneDeep(config);
|
|
12100
|
+
dataSources[index] = newConfig;
|
|
12101
|
+
this.emit("update", newConfig, {
|
|
12102
|
+
oldConfig,
|
|
12103
|
+
changeRecords
|
|
12104
|
+
});
|
|
12105
|
+
return newConfig;
|
|
11575
12106
|
}
|
|
11576
12107
|
remove(id) {
|
|
11577
12108
|
const dataSources = this.get("dataSources");
|
|
@@ -11647,7 +12178,16 @@
|
|
|
11647
12178
|
|
|
11648
12179
|
const idleTask = new IdleTask();
|
|
11649
12180
|
class Dep extends BaseService {
|
|
12181
|
+
state = vue.reactive({
|
|
12182
|
+
collecting: false
|
|
12183
|
+
});
|
|
11650
12184
|
watcher = new core.Watcher({ initialTargets: vue.reactive({}) });
|
|
12185
|
+
set(name, value) {
|
|
12186
|
+
this.state[name] = value;
|
|
12187
|
+
}
|
|
12188
|
+
get(name) {
|
|
12189
|
+
return this.state[name];
|
|
12190
|
+
}
|
|
11651
12191
|
removeTargets(type = core.DepTargetType.DEFAULT) {
|
|
11652
12192
|
this.watcher.removeTargets(type);
|
|
11653
12193
|
const targets = this.watcher.getTargets(type);
|
|
@@ -11674,26 +12214,32 @@
|
|
|
11674
12214
|
this.watcher.clearTargets();
|
|
11675
12215
|
}
|
|
11676
12216
|
collect(nodes, depExtendedData = {}, deep = false, type) {
|
|
12217
|
+
this.set("collecting", true);
|
|
11677
12218
|
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
|
|
11678
12219
|
this.collectNode(node, target, depExtendedData, deep);
|
|
11679
12220
|
});
|
|
12221
|
+
this.set("collecting", false);
|
|
11680
12222
|
this.emit("collected", nodes, deep);
|
|
11681
12223
|
}
|
|
11682
12224
|
collectIdle(nodes, depExtendedData = {}, deep = false, type) {
|
|
12225
|
+
this.set("collecting", true);
|
|
12226
|
+
let startTask = false;
|
|
11683
12227
|
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
12228
|
+
startTask = true;
|
|
12229
|
+
this.enqueueTask(node, target, depExtendedData, deep);
|
|
12230
|
+
});
|
|
12231
|
+
return new Promise((resolve) => {
|
|
12232
|
+
if (!startTask) {
|
|
12233
|
+
this.emit("collected", nodes, deep);
|
|
12234
|
+
this.set("collecting", false);
|
|
12235
|
+
resolve();
|
|
12236
|
+
return;
|
|
12237
|
+
}
|
|
12238
|
+
idleTask.once("finish", () => {
|
|
12239
|
+
this.emit("collected", nodes, deep);
|
|
12240
|
+
this.set("collecting", false);
|
|
12241
|
+
resolve();
|
|
12242
|
+
});
|
|
11697
12243
|
});
|
|
11698
12244
|
}
|
|
11699
12245
|
collectNode(node, target, depExtendedData = {}, deep = false) {
|
|
@@ -11720,6 +12266,9 @@
|
|
|
11720
12266
|
hasSpecifiedTypeTarget(type = core.DepTargetType.DEFAULT) {
|
|
11721
12267
|
return this.watcher.hasSpecifiedTypeTarget(type);
|
|
11722
12268
|
}
|
|
12269
|
+
clearIdleTasks() {
|
|
12270
|
+
idleTask.clearTasks();
|
|
12271
|
+
}
|
|
11723
12272
|
on(eventName, listener) {
|
|
11724
12273
|
return super.on(eventName, listener);
|
|
11725
12274
|
}
|
|
@@ -11729,6 +12278,23 @@
|
|
|
11729
12278
|
emit(eventName, ...args) {
|
|
11730
12279
|
return super.emit(eventName, ...args);
|
|
11731
12280
|
}
|
|
12281
|
+
enqueueTask(node, target, depExtendedData, deep) {
|
|
12282
|
+
idleTask.enqueueTask(
|
|
12283
|
+
({ node: node2, deep: deep2, target: target2 }) => {
|
|
12284
|
+
this.collectNode(node2, target2, depExtendedData, deep2);
|
|
12285
|
+
},
|
|
12286
|
+
{
|
|
12287
|
+
node,
|
|
12288
|
+
deep: false,
|
|
12289
|
+
target
|
|
12290
|
+
}
|
|
12291
|
+
);
|
|
12292
|
+
if (deep && Array.isArray(node.items) && node.items.length) {
|
|
12293
|
+
node.items.forEach((item) => {
|
|
12294
|
+
this.enqueueTask(item, target, depExtendedData, deep);
|
|
12295
|
+
});
|
|
12296
|
+
}
|
|
12297
|
+
}
|
|
11732
12298
|
}
|
|
11733
12299
|
const depService = new Dep();
|
|
11734
12300
|
|
|
@@ -12145,7 +12711,8 @@
|
|
|
12145
12711
|
datasourceConfigs: () => ({}),
|
|
12146
12712
|
canSelect: (el) => Boolean(utils.getIdFromEl()(el)),
|
|
12147
12713
|
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
12148
|
-
codeOptions: () => ({})
|
|
12714
|
+
codeOptions: () => ({}),
|
|
12715
|
+
customContentMenu: (menus) => menus
|
|
12149
12716
|
};
|
|
12150
12717
|
|
|
12151
12718
|
const initServiceState = (props, {
|
|
@@ -12302,6 +12869,7 @@
|
|
|
12302
12869
|
initDataSourceDepTarget(ds);
|
|
12303
12870
|
});
|
|
12304
12871
|
if (Array.isArray(value.items)) {
|
|
12872
|
+
depService.clearIdleTasks();
|
|
12305
12873
|
collectIdle(value.items, true);
|
|
12306
12874
|
} else {
|
|
12307
12875
|
depService.clear();
|
|
@@ -12326,15 +12894,66 @@
|
|
|
12326
12894
|
emit("update:modelValue", value);
|
|
12327
12895
|
}
|
|
12328
12896
|
};
|
|
12329
|
-
const
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12897
|
+
const stage = vue.computed(() => editorService.get("stage"));
|
|
12898
|
+
vue.watch(stage, (stage2) => {
|
|
12899
|
+
if (!stage2) {
|
|
12900
|
+
return;
|
|
12901
|
+
}
|
|
12902
|
+
stage2.on("rerender", () => {
|
|
12903
|
+
const node = editorService.get("node");
|
|
12904
|
+
if (!node) return;
|
|
12905
|
+
collectIdle([node], true).then(() => {
|
|
12906
|
+
afterUpdateNodes([node]);
|
|
12907
|
+
});
|
|
12908
|
+
});
|
|
12909
|
+
});
|
|
12910
|
+
const getApp = () => stage.value?.renderer?.runtime?.getApp?.();
|
|
12911
|
+
const updateDataSourceSchema = (nodes, deep) => {
|
|
12334
12912
|
const root = editorService.get("root");
|
|
12913
|
+
const app = getApp();
|
|
12914
|
+
if (root && app?.dsl) {
|
|
12915
|
+
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12916
|
+
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
12917
|
+
app.dsl.dataSources = root.dataSources;
|
|
12918
|
+
}
|
|
12335
12919
|
if (root?.dataSources) {
|
|
12336
12920
|
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
12337
12921
|
}
|
|
12922
|
+
if (!root || !stage.value) return;
|
|
12923
|
+
const allNodes = [];
|
|
12924
|
+
if (deep) {
|
|
12925
|
+
nodes.forEach((node) => {
|
|
12926
|
+
utils.traverseNode(node, (node2) => {
|
|
12927
|
+
if (!allNodes.includes(node2)) {
|
|
12928
|
+
allNodes.push(node2);
|
|
12929
|
+
}
|
|
12930
|
+
});
|
|
12931
|
+
});
|
|
12932
|
+
} else {
|
|
12933
|
+
allNodes.push(...nodes);
|
|
12934
|
+
}
|
|
12935
|
+
const deps = Object.values(root.dataSourceDeps || {});
|
|
12936
|
+
deps.forEach((dep) => {
|
|
12937
|
+
Object.keys(dep).forEach((id) => {
|
|
12938
|
+
const node = allNodes.find((node2) => node2.id === id);
|
|
12939
|
+
node && stage.value?.update({
|
|
12940
|
+
config: lodashEs.cloneDeep(node),
|
|
12941
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
12942
|
+
root: lodashEs.cloneDeep(root)
|
|
12943
|
+
});
|
|
12944
|
+
});
|
|
12945
|
+
});
|
|
12946
|
+
};
|
|
12947
|
+
const afterUpdateNodes = (nodes) => {
|
|
12948
|
+
const root = editorService.get("root");
|
|
12949
|
+
if (!root) return;
|
|
12950
|
+
for (const node of nodes) {
|
|
12951
|
+
stage.value?.update({
|
|
12952
|
+
config: lodashEs.cloneDeep(node),
|
|
12953
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
12954
|
+
root: lodashEs.cloneDeep(root)
|
|
12955
|
+
});
|
|
12956
|
+
}
|
|
12338
12957
|
};
|
|
12339
12958
|
const targetAddHandler = (target) => {
|
|
12340
12959
|
const root = editorService.get("root");
|
|
@@ -12354,59 +12973,32 @@
|
|
|
12354
12973
|
};
|
|
12355
12974
|
const targetRemoveHandler = (id) => {
|
|
12356
12975
|
const root = editorService.get("root");
|
|
12357
|
-
if (root
|
|
12976
|
+
if (!root) return;
|
|
12977
|
+
if (root.dataSourceDeps) {
|
|
12358
12978
|
delete root.dataSourceDeps[id];
|
|
12359
12979
|
}
|
|
12360
|
-
if (root
|
|
12980
|
+
if (root.dataSourceCondDeps) {
|
|
12361
12981
|
delete root.dataSourceCondDeps[id];
|
|
12362
12982
|
}
|
|
12363
12983
|
};
|
|
12364
|
-
const
|
|
12984
|
+
const depCollectedHandler = () => {
|
|
12365
12985
|
const root = editorService.get("root");
|
|
12366
|
-
|
|
12367
|
-
if (!root || !stage) return;
|
|
12986
|
+
if (!root) return;
|
|
12368
12987
|
const app = getApp();
|
|
12369
|
-
if (
|
|
12370
|
-
if (app.dsl) {
|
|
12988
|
+
if (app?.dsl) {
|
|
12371
12989
|
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12372
|
-
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
12373
|
-
app.dsl.dataSources = root.dataSources;
|
|
12374
|
-
}
|
|
12375
|
-
updateDataSourceSchema();
|
|
12376
|
-
const allNodes = [];
|
|
12377
|
-
if (deep) {
|
|
12378
|
-
nodes.forEach((node) => {
|
|
12379
|
-
traverseNode(node, (node2) => {
|
|
12380
|
-
if (!allNodes.includes(node2)) {
|
|
12381
|
-
allNodes.push(node2);
|
|
12382
|
-
}
|
|
12383
|
-
});
|
|
12384
|
-
});
|
|
12385
|
-
} else {
|
|
12386
|
-
allNodes.push(...nodes);
|
|
12387
12990
|
}
|
|
12388
|
-
const deps = Object.values(root.dataSourceDeps || {});
|
|
12389
|
-
deps.forEach((dep) => {
|
|
12390
|
-
Object.keys(dep).forEach((id) => {
|
|
12391
|
-
const node = allNodes.find((node2) => node2.id === id);
|
|
12392
|
-
node && stage.update({
|
|
12393
|
-
config: lodashEs.cloneDeep(node),
|
|
12394
|
-
parentId: editorService.getParentById(node.id)?.id,
|
|
12395
|
-
root: lodashEs.cloneDeep(root)
|
|
12396
|
-
});
|
|
12397
|
-
});
|
|
12398
|
-
});
|
|
12399
12991
|
};
|
|
12400
12992
|
depService.on("add-target", targetAddHandler);
|
|
12401
12993
|
depService.on("remove-target", targetRemoveHandler);
|
|
12402
|
-
depService.on("collected",
|
|
12994
|
+
depService.on("collected", depCollectedHandler);
|
|
12403
12995
|
const initDataSourceDepTarget = (ds) => {
|
|
12404
12996
|
depService.addTarget(core.createDataSourceTarget(ds, vue.reactive({})));
|
|
12405
12997
|
depService.addTarget(core.createDataSourceMethodTarget(ds, vue.reactive({})));
|
|
12406
12998
|
depService.addTarget(core.createDataSourceCondTarget(ds, vue.reactive({})));
|
|
12407
12999
|
};
|
|
12408
|
-
const collectIdle = (nodes, deep) =>
|
|
12409
|
-
nodes.
|
|
13000
|
+
const collectIdle = (nodes, deep) => Promise.all(
|
|
13001
|
+
nodes.map((node) => {
|
|
12410
13002
|
let pageId;
|
|
12411
13003
|
if (utils.isPage(node)) {
|
|
12412
13004
|
pageId = node.id;
|
|
@@ -12414,20 +13006,47 @@
|
|
|
12414
13006
|
const info = editorService.getNodeInfo(node.id);
|
|
12415
13007
|
pageId = info.page?.id;
|
|
12416
13008
|
}
|
|
12417
|
-
depService.collectIdle([node], { pageId }, deep);
|
|
12418
|
-
})
|
|
12419
|
-
|
|
13009
|
+
return depService.collectIdle([node], { pageId }, deep);
|
|
13010
|
+
})
|
|
13011
|
+
);
|
|
12420
13012
|
const nodeAddHandler = (nodes) => {
|
|
12421
|
-
collectIdle(nodes, true)
|
|
13013
|
+
collectIdle(nodes, true).then(() => {
|
|
13014
|
+
afterUpdateNodes(nodes);
|
|
13015
|
+
});
|
|
12422
13016
|
};
|
|
12423
|
-
const nodeUpdateHandler = (
|
|
12424
|
-
|
|
13017
|
+
const nodeUpdateHandler = (data) => {
|
|
13018
|
+
const needRecollectNodes = [];
|
|
13019
|
+
const normalNodes = [];
|
|
13020
|
+
data.forEach(({ newNode, oldNode, changeRecords }) => {
|
|
13021
|
+
if (changeRecords?.length) {
|
|
13022
|
+
for (const record of changeRecords) {
|
|
13023
|
+
if (!record.propPath || new RegExp(`${core.NODE_CONDS_KEY}.(\\d)+.cond`).test(record.propPath) || new RegExp(`${core.NODE_CONDS_KEY}.(\\d)+.cond.(\\d)+.value`).test(record.propPath) || record.propPath === core.NODE_CONDS_KEY || utils.isValueIncludeDataSource(record.value)) {
|
|
13024
|
+
needRecollectNodes.push(newNode);
|
|
13025
|
+
} else {
|
|
13026
|
+
normalNodes.push(newNode);
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13029
|
+
} else if (isIncludeDataSource(newNode, oldNode)) {
|
|
13030
|
+
needRecollectNodes.push(newNode);
|
|
13031
|
+
} else {
|
|
13032
|
+
normalNodes.push(newNode);
|
|
13033
|
+
}
|
|
13034
|
+
});
|
|
13035
|
+
if (needRecollectNodes.length) {
|
|
13036
|
+
collectIdle(needRecollectNodes, true).then(() => {
|
|
13037
|
+
afterUpdateNodes(needRecollectNodes);
|
|
13038
|
+
});
|
|
13039
|
+
} else if (normalNodes.length) {
|
|
13040
|
+
afterUpdateNodes(normalNodes);
|
|
13041
|
+
}
|
|
12425
13042
|
};
|
|
12426
13043
|
const nodeRemoveHandler = (nodes) => {
|
|
12427
13044
|
depService.clear(nodes);
|
|
12428
13045
|
};
|
|
12429
13046
|
const historyChangeHandler = (page) => {
|
|
12430
|
-
collectIdle([page], true)
|
|
13047
|
+
collectIdle([page], true).then(() => {
|
|
13048
|
+
updateDataSourceSchema([page], true);
|
|
13049
|
+
});
|
|
12431
13050
|
};
|
|
12432
13051
|
editorService.on("history-change", historyChangeHandler);
|
|
12433
13052
|
editorService.on("root-change", rootChangeHandler);
|
|
@@ -12450,11 +13069,30 @@
|
|
|
12450
13069
|
initDataSourceDepTarget(config);
|
|
12451
13070
|
getApp()?.dataSourceManager?.addDataSource(config);
|
|
12452
13071
|
};
|
|
12453
|
-
const dataSourceUpdateHandler = (config) => {
|
|
13072
|
+
const dataSourceUpdateHandler = (config, { changeRecords }) => {
|
|
13073
|
+
let needRecollectDep = false;
|
|
13074
|
+
for (const changeRecord of changeRecords) {
|
|
13075
|
+
if (!changeRecord.propPath) {
|
|
13076
|
+
continue;
|
|
13077
|
+
}
|
|
13078
|
+
needRecollectDep = changeRecord.propPath === "fields" || changeRecord.propPath === "methods" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath) || /methods.(\d)+.name/.test(changeRecord.propPath) || /methods.(\d)+$/.test(changeRecord.propPath);
|
|
13079
|
+
if (needRecollectDep) {
|
|
13080
|
+
break;
|
|
13081
|
+
}
|
|
13082
|
+
}
|
|
12454
13083
|
const root = editorService.get("root");
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
13084
|
+
if (needRecollectDep) {
|
|
13085
|
+
if (Array.isArray(root?.items)) {
|
|
13086
|
+
depService.clearIdleTasks();
|
|
13087
|
+
removeDataSourceTarget(config.id);
|
|
13088
|
+
initDataSourceDepTarget(config);
|
|
13089
|
+
collectIdle(root.items, true).then(() => {
|
|
13090
|
+
updateDataSourceSchema(root?.items || [], true);
|
|
13091
|
+
});
|
|
13092
|
+
}
|
|
13093
|
+
} else if (root?.dataSources) {
|
|
13094
|
+
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
13095
|
+
}
|
|
12458
13096
|
};
|
|
12459
13097
|
const removeDataSourceTarget = (id) => {
|
|
12460
13098
|
depService.removeTarget(id, core.DepTargetType.DATA_SOURCE);
|
|
@@ -12462,8 +13100,13 @@
|
|
|
12462
13100
|
depService.removeTarget(id, core.DepTargetType.DATA_SOURCE_METHOD);
|
|
12463
13101
|
};
|
|
12464
13102
|
const dataSourceRemoveHandler = (id) => {
|
|
13103
|
+
const root = editorService.get("root");
|
|
13104
|
+
const nodeIds = Object.keys(root?.dataSourceDeps?.[id] || {});
|
|
13105
|
+
const nodes = utils.getNodes(nodeIds, root?.items);
|
|
13106
|
+
collectIdle(nodes, false).then(() => {
|
|
13107
|
+
updateDataSourceSchema(nodes, false);
|
|
13108
|
+
});
|
|
12465
13109
|
removeDataSourceTarget(id);
|
|
12466
|
-
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
12467
13110
|
};
|
|
12468
13111
|
dataSourceService.on("add", dataSourceAddHandler);
|
|
12469
13112
|
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
@@ -12471,7 +13114,7 @@
|
|
|
12471
13114
|
vue.onBeforeUnmount(() => {
|
|
12472
13115
|
depService.off("add-target", targetAddHandler);
|
|
12473
13116
|
depService.off("remove-target", targetRemoveHandler);
|
|
12474
|
-
depService.off("collected",
|
|
13117
|
+
depService.off("collected", depCollectedHandler);
|
|
12475
13118
|
editorService.off("history-change", historyChangeHandler);
|
|
12476
13119
|
editorService.off("root-change", rootChangeHandler);
|
|
12477
13120
|
editorService.off("add", nodeAddHandler);
|
|
@@ -12528,7 +13171,8 @@
|
|
|
12528
13171
|
isContainer: { type: Function },
|
|
12529
13172
|
customContentMenu: { type: Function },
|
|
12530
13173
|
extendFormState: { type: Function },
|
|
12531
|
-
pageBarSortOptions: {}
|
|
13174
|
+
pageBarSortOptions: {},
|
|
13175
|
+
pageFilterFunction: { type: Function }
|
|
12532
13176
|
}, defaultEditorProps),
|
|
12533
13177
|
emits: ["props-panel-mounted", "update:modelValue", "props-form-error", "props-submit-error"],
|
|
12534
13178
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -12573,18 +13217,28 @@
|
|
|
12573
13217
|
vue.provide("codeOptions", props.codeOptions);
|
|
12574
13218
|
vue.provide("stageOptions", stageOptions);
|
|
12575
13219
|
vue.provide("eventBus", new events.EventEmitter());
|
|
13220
|
+
const propsPanelMountedHandler = (e) => {
|
|
13221
|
+
emit("props-panel-mounted", e);
|
|
13222
|
+
};
|
|
13223
|
+
const propsPanelSubmitErrorHandler = (e) => {
|
|
13224
|
+
emit("props-submit-error", e);
|
|
13225
|
+
};
|
|
13226
|
+
const propsPanelFormErrorHandler = (e) => {
|
|
13227
|
+
emit("props-form-error", e);
|
|
13228
|
+
};
|
|
12576
13229
|
__expose(services);
|
|
12577
13230
|
return (_ctx, _cache) => {
|
|
12578
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
13231
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
12579
13232
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
12580
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
13233
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
13234
|
+
"page-filter-function": _ctx.pageFilterFunction
|
|
12581
13235
|
}, {
|
|
12582
13236
|
header: vue.withCtx(() => [
|
|
12583
13237
|
vue.renderSlot(_ctx.$slots, "header")
|
|
12584
13238
|
]),
|
|
12585
13239
|
nav: vue.withCtx(() => [
|
|
12586
13240
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
|
|
12587
|
-
vue.createVNode(_sfc_main$
|
|
13241
|
+
vue.createVNode(_sfc_main$r, { data: _ctx.menu }, null, 8, ["data"])
|
|
12588
13242
|
])
|
|
12589
13243
|
]),
|
|
12590
13244
|
"content-before": vue.withCtx(() => [
|
|
@@ -12667,9 +13321,9 @@
|
|
|
12667
13321
|
vue.createVNode(_sfc_main$p, {
|
|
12668
13322
|
"extend-state": _ctx.extendFormState,
|
|
12669
13323
|
"disabled-show-src": _ctx.disabledShowSrc,
|
|
12670
|
-
onMounted:
|
|
12671
|
-
onFormError:
|
|
12672
|
-
onSubmitError:
|
|
13324
|
+
onMounted: propsPanelMountedHandler,
|
|
13325
|
+
onFormError: propsPanelFormErrorHandler,
|
|
13326
|
+
onSubmitError: propsPanelSubmitErrorHandler
|
|
12673
13327
|
}, {
|
|
12674
13328
|
"props-panel-header": vue.withCtx(() => [
|
|
12675
13329
|
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
@@ -12690,6 +13344,9 @@
|
|
|
12690
13344
|
"page-bar": vue.withCtx(() => [
|
|
12691
13345
|
vue.renderSlot(_ctx.$slots, "page-bar")
|
|
12692
13346
|
]),
|
|
13347
|
+
"page-bar-add-button": vue.withCtx(() => [
|
|
13348
|
+
vue.renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
13349
|
+
]),
|
|
12693
13350
|
"page-bar-title": vue.withCtx(({ page }) => [
|
|
12694
13351
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
12695
13352
|
]),
|
|
@@ -12700,7 +13357,7 @@
|
|
|
12700
13357
|
vue.renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
12701
13358
|
]),
|
|
12702
13359
|
_: 3
|
|
12703
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"]);
|
|
13360
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "page-filter-function"]);
|
|
12704
13361
|
};
|
|
12705
13362
|
}
|
|
12706
13363
|
});
|
|
@@ -12718,24 +13375,24 @@
|
|
|
12718
13375
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
12719
13376
|
setEditorConfig(option);
|
|
12720
13377
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
12721
|
-
app.component("magic-code-editor", _sfc_main$
|
|
12722
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
12723
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
12724
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
12725
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
12726
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
12727
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
12728
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
12729
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
12730
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
12731
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
12732
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
12733
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
12734
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
12735
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
12736
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
12737
|
-
app.component("m-fields-display-conds", _sfc_main$
|
|
12738
|
-
app.component("m-fields-cond-op-select", _sfc_main$
|
|
13378
|
+
app.component("magic-code-editor", _sfc_main$Y);
|
|
13379
|
+
app.component("m-fields-ui-select", _sfc_main$C);
|
|
13380
|
+
app.component("m-fields-code-link", _sfc_main$W);
|
|
13381
|
+
app.component("m-fields-vs-code", _sfc_main$X);
|
|
13382
|
+
app.component("m-fields-code-select", _sfc_main$V);
|
|
13383
|
+
app.component("m-fields-code-select-col", _sfc_main$T);
|
|
13384
|
+
app.component("m-fields-event-select", _sfc_main$G);
|
|
13385
|
+
app.component("m-fields-data-source-fields", _sfc_main$Q);
|
|
13386
|
+
app.component("m-fields-data-source-mocks", _sfc_main$J);
|
|
13387
|
+
app.component("m-fields-key-value", _sfc_main$E);
|
|
13388
|
+
app.component("m-fields-data-source-input", _sfc_main$N);
|
|
13389
|
+
app.component("m-fields-data-source-select", _sfc_main$I);
|
|
13390
|
+
app.component("m-fields-data-source-methods", _sfc_main$L);
|
|
13391
|
+
app.component("m-fields-data-source-method-select", _sfc_main$K);
|
|
13392
|
+
app.component("m-fields-data-source-field-select", _sfc_main$O);
|
|
13393
|
+
app.component("m-fields-page-fragment-select", _sfc_main$D);
|
|
13394
|
+
app.component("m-fields-display-conds", _sfc_main$H);
|
|
13395
|
+
app.component("m-fields-cond-op-select", _sfc_main$S);
|
|
12739
13396
|
}
|
|
12740
13397
|
};
|
|
12741
13398
|
|
|
@@ -12751,50 +13408,51 @@
|
|
|
12751
13408
|
exports.COPY_CODE_STORAGE_KEY = COPY_CODE_STORAGE_KEY;
|
|
12752
13409
|
exports.COPY_DS_STORAGE_KEY = COPY_DS_STORAGE_KEY;
|
|
12753
13410
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
12754
|
-
exports.CodeBlockEditor = _sfc_main$
|
|
12755
|
-
exports.CodeBlockList = _sfc_main$
|
|
12756
|
-
exports.CodeBlockListPanel = _sfc_main$
|
|
13411
|
+
exports.CodeBlockEditor = _sfc_main$M;
|
|
13412
|
+
exports.CodeBlockList = _sfc_main$k;
|
|
13413
|
+
exports.CodeBlockListPanel = _sfc_main$j;
|
|
12757
13414
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
12758
|
-
exports.CodeSelect = _sfc_main$
|
|
12759
|
-
exports.CodeSelectCol = _sfc_main$
|
|
13415
|
+
exports.CodeSelect = _sfc_main$V;
|
|
13416
|
+
exports.CodeSelectCol = _sfc_main$T;
|
|
12760
13417
|
exports.ColumnLayout = ColumnLayout;
|
|
12761
13418
|
exports.ComponentListPanel = _sfc_main$b;
|
|
12762
|
-
exports.CondOpSelect = _sfc_main$
|
|
12763
|
-
exports.ContentMenu = _sfc_main$
|
|
12764
|
-
exports.DataSourceConfigPanel = _sfc_main$
|
|
12765
|
-
exports.DataSourceFieldSelect = _sfc_main$
|
|
12766
|
-
exports.DataSourceFields = _sfc_main$
|
|
12767
|
-
exports.DataSourceInput = _sfc_main$
|
|
12768
|
-
exports.DataSourceMethodSelect = _sfc_main$
|
|
12769
|
-
exports.DataSourceMethods = _sfc_main$
|
|
12770
|
-
exports.DataSourceMocks = _sfc_main$
|
|
12771
|
-
exports.DataSourceSelect = _sfc_main$
|
|
12772
|
-
exports.DisplayConds = _sfc_main$
|
|
13419
|
+
exports.CondOpSelect = _sfc_main$S;
|
|
13420
|
+
exports.ContentMenu = _sfc_main$o;
|
|
13421
|
+
exports.DataSourceConfigPanel = _sfc_main$i;
|
|
13422
|
+
exports.DataSourceFieldSelect = _sfc_main$O;
|
|
13423
|
+
exports.DataSourceFields = _sfc_main$Q;
|
|
13424
|
+
exports.DataSourceInput = _sfc_main$N;
|
|
13425
|
+
exports.DataSourceMethodSelect = _sfc_main$K;
|
|
13426
|
+
exports.DataSourceMethods = _sfc_main$L;
|
|
13427
|
+
exports.DataSourceMocks = _sfc_main$J;
|
|
13428
|
+
exports.DataSourceSelect = _sfc_main$I;
|
|
13429
|
+
exports.DisplayConds = _sfc_main$H;
|
|
12773
13430
|
exports.DragType = DragType;
|
|
12774
|
-
exports.EventSelect = _sfc_main$
|
|
13431
|
+
exports.EventSelect = _sfc_main$G;
|
|
12775
13432
|
exports.Fixed2Other = Fixed2Other;
|
|
12776
|
-
exports.FloatingBox = _sfc_main$
|
|
13433
|
+
exports.FloatingBox = _sfc_main$R;
|
|
12777
13434
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
12778
|
-
exports.Icon = _sfc_main$
|
|
13435
|
+
exports.Icon = _sfc_main$Z;
|
|
12779
13436
|
exports.IdleTask = IdleTask;
|
|
12780
13437
|
exports.KeyBindingCommand = KeyBindingCommand;
|
|
12781
|
-
exports.KeyValue = _sfc_main$
|
|
13438
|
+
exports.KeyValue = _sfc_main$E;
|
|
12782
13439
|
exports.Keys = Keys;
|
|
12783
13440
|
exports.LayerOffset = LayerOffset;
|
|
12784
13441
|
exports.LayerPanel = _sfc_main$c;
|
|
12785
13442
|
exports.Layout = Layout;
|
|
12786
|
-
exports.LayoutContainer = _sfc_main$
|
|
12787
|
-
exports.PageFragmentSelect = _sfc_main$
|
|
13443
|
+
exports.LayoutContainer = _sfc_main$A;
|
|
13444
|
+
exports.PageFragmentSelect = _sfc_main$D;
|
|
13445
|
+
exports.PropsFormPanel = _sfc_main$q;
|
|
12788
13446
|
exports.PropsPanel = _sfc_main$p;
|
|
12789
|
-
exports.Resizer = _sfc_main$
|
|
13447
|
+
exports.Resizer = _sfc_main$B;
|
|
12790
13448
|
exports.ScrollViewer = ScrollViewer;
|
|
12791
13449
|
exports.SideItemKey = SideItemKey;
|
|
12792
|
-
exports.SplitView = _sfc_main$
|
|
12793
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
13450
|
+
exports.SplitView = _sfc_main$A;
|
|
13451
|
+
exports.TMagicCodeEditor = _sfc_main$Y;
|
|
12794
13452
|
exports.TMagicEditor = _sfc_main;
|
|
12795
|
-
exports.ToolButton = _sfc_main$
|
|
12796
|
-
exports.Tree = _sfc_main$
|
|
12797
|
-
exports.TreeNode = _sfc_main$
|
|
13453
|
+
exports.ToolButton = _sfc_main$z;
|
|
13454
|
+
exports.Tree = _sfc_main$l;
|
|
13455
|
+
exports.TreeNode = _sfc_main$m;
|
|
12798
13456
|
exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
|
|
12799
13457
|
exports.UndoRedo = UndoRedo;
|
|
12800
13458
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
@@ -12835,6 +13493,7 @@
|
|
|
12835
13493
|
exports.getRelativeStyle = getRelativeStyle;
|
|
12836
13494
|
exports.historyService = historyService;
|
|
12837
13495
|
exports.info = info;
|
|
13496
|
+
exports.isIncludeDataSource = isIncludeDataSource;
|
|
12838
13497
|
exports.log = log;
|
|
12839
13498
|
exports.moveItemsInContainer = moveItemsInContainer;
|
|
12840
13499
|
exports.numberOptions = numberOptions;
|
|
@@ -12847,11 +13506,9 @@
|
|
|
12847
13506
|
exports.stageOverlayService = stageOverlayService;
|
|
12848
13507
|
exports.storageService = storageService;
|
|
12849
13508
|
exports.styleTabConfig = styleTabConfig;
|
|
12850
|
-
exports.traverseNode = traverseNode;
|
|
12851
13509
|
exports.uiService = uiService;
|
|
12852
13510
|
exports.updateStatus = updateStatus;
|
|
12853
13511
|
exports.useCodeBlockEdit = useCodeBlockEdit;
|
|
12854
|
-
exports.useDataSourceMethod = useDataSourceMethod;
|
|
12855
13512
|
exports.useEditorContentHeight = useEditorContentHeight;
|
|
12856
13513
|
exports.useFilter = useFilter;
|
|
12857
13514
|
exports.useFloatBox = useFloatBox;
|