@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
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import designPlugin__default, { TMagicIcon, TMagicButton, TMagicCard, getDesignConfig, TMagicSelect, useZIndex,
|
|
1
|
+
import designPlugin__default, { TMagicIcon, TMagicButton, TMagicCard, tMagicMessage, getDesignConfig, TMagicSelect, useZIndex, tMagicMessageBox, TMagicCascader, TMagicTooltip, TMagicTag, TMagicDialog, TMagicSwitch, TMagicInput, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
2
2
|
export * from '@tmagic/design';
|
|
3
3
|
export { default as designPlugin } from '@tmagic/design';
|
|
4
|
-
import formPlugin__default, { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel } from '@tmagic/form';
|
|
4
|
+
import formPlugin__default, { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel, createForm } from '@tmagic/form';
|
|
5
5
|
export * from '@tmagic/form';
|
|
6
6
|
export { default as formPlugin } from '@tmagic/form';
|
|
7
7
|
import tablePlugin__default, { MagicTable } from '@tmagic/table';
|
|
8
8
|
export * from '@tmagic/table';
|
|
9
9
|
export { default as tablePlugin } from '@tmagic/table';
|
|
10
|
-
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, createCommentVNode, Fragment, renderList, mergeProps, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString, createTextVNode, isRef, createStaticVNode, watchEffect, withModifiers, toHandlers,
|
|
11
|
-
import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, Files, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document,
|
|
12
|
-
import { throttle, isEmpty, cloneDeep, mergeWith,
|
|
10
|
+
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, useTemplateRef, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, createCommentVNode, Fragment, renderList, mergeProps, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString, createTextVNode, isRef, createStaticVNode, watchEffect, withModifiers, toHandlers, createSlots, markRaw, getCurrentInstance, withDirectives, vShow, Transition, resolveDirective, mergeDefaults } from 'vue';
|
|
11
|
+
import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, Files, Search, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document, Sugar, ArrowRight, CopyDocument, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
|
|
12
|
+
import { throttle, isEmpty, isObject, cloneDeep, mergeWith, uniq, get, map, has, pick, keys } from 'lodash-es';
|
|
13
13
|
import serialize from 'serialize-javascript';
|
|
14
14
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
15
15
|
import * as monaco from 'monaco-editor';
|
|
16
16
|
import { HookCodeType, HookType, NODE_CONDS_KEY, Target, Watcher, NodeType, ActionType, DepTargetType, DEFAULT_EVENTS, DEFAULT_METHODS, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/core';
|
|
17
17
|
export { DepTargetType } from '@tmagic/core';
|
|
18
|
-
import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName } from '@tmagic/utils';
|
|
18
|
+
import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, isValueIncludeDataSource, toLine, guid, getValueByKeyPath, setValueByKeyPath, getNodeInfo, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, traverseNode, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
19
19
|
export * from '@tmagic/utils';
|
|
20
20
|
import VanillaMoveable from 'moveable';
|
|
21
21
|
import StageCore__default, { isFixed, GuidesType, getOffset, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
@@ -23,11 +23,12 @@ export * from '@tmagic/stage';
|
|
|
23
23
|
export { default as StageCore } from '@tmagic/stage';
|
|
24
24
|
import { EventEmitter } from 'events';
|
|
25
25
|
import Gesto from 'gesto';
|
|
26
|
+
import { detailedDiff } from 'deep-object-diff';
|
|
26
27
|
import Sortable from 'sortablejs';
|
|
27
28
|
import KeyController from 'keycon';
|
|
28
29
|
|
|
29
|
-
const _hoisted_1$
|
|
30
|
-
const _sfc_main$
|
|
30
|
+
const _hoisted_1$y = ["src"];
|
|
31
|
+
const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
31
32
|
...{
|
|
32
33
|
name: "MEditorIcon"
|
|
33
34
|
},
|
|
@@ -51,7 +52,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
51
52
|
class: "magic-editor-icon"
|
|
52
53
|
}, {
|
|
53
54
|
default: withCtx(() => [
|
|
54
|
-
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
55
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$y)
|
|
55
56
|
]),
|
|
56
57
|
_: 1
|
|
57
58
|
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -79,10 +80,10 @@ const getEditorConfig = (key) => $TMAGIC_EDITOR[key];
|
|
|
79
80
|
emmetHTML(monaco);
|
|
80
81
|
emmetCSS(monaco, ["css", "scss"]);
|
|
81
82
|
|
|
82
|
-
const _hoisted_1$
|
|
83
|
+
const _hoisted_1$x = {
|
|
83
84
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
84
85
|
};
|
|
85
|
-
const _sfc_main$
|
|
86
|
+
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
86
87
|
...{
|
|
87
88
|
name: "MEditorCodeEditor"
|
|
88
89
|
},
|
|
@@ -135,7 +136,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
135
136
|
let vsDiffEditor = null;
|
|
136
137
|
const values = ref("");
|
|
137
138
|
const loading = ref(false);
|
|
138
|
-
const codeEditor =
|
|
139
|
+
const codeEditor = useTemplateRef("codeEditor");
|
|
139
140
|
const resizeObserver = new globalThis.ResizeObserver(
|
|
140
141
|
throttle(() => {
|
|
141
142
|
vsEditor?.layout();
|
|
@@ -239,7 +240,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
239
240
|
}
|
|
240
241
|
});
|
|
241
242
|
return (_ctx, _cache) => {
|
|
242
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
243
|
+
return openBlock(), createElementBlock("div", _hoisted_1$x, [
|
|
243
244
|
(openBlock(), createBlock(Teleport, {
|
|
244
245
|
to: "body",
|
|
245
246
|
disabled: !fullScreen.value
|
|
@@ -255,7 +256,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
255
256
|
onClick: fullScreenHandler
|
|
256
257
|
}, {
|
|
257
258
|
default: withCtx(() => [
|
|
258
|
-
createVNode(_sfc_main$
|
|
259
|
+
createVNode(_sfc_main$Z, { icon: unref(FullScreen) }, null, 8, ["icon"])
|
|
259
260
|
]),
|
|
260
261
|
_: 1
|
|
261
262
|
}),
|
|
@@ -271,7 +272,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
271
272
|
}
|
|
272
273
|
});
|
|
273
274
|
|
|
274
|
-
const _sfc_main$
|
|
275
|
+
const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
275
276
|
...{
|
|
276
277
|
name: "MFieldsVsCode"
|
|
277
278
|
},
|
|
@@ -290,13 +291,11 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
|
290
291
|
emits: ["change"],
|
|
291
292
|
setup(__props, { emit: __emit }) {
|
|
292
293
|
const emit = __emit;
|
|
293
|
-
const props = __props;
|
|
294
294
|
const save = (v) => {
|
|
295
|
-
props.model[props.name] = v;
|
|
296
295
|
emit("change", v);
|
|
297
296
|
};
|
|
298
297
|
return (_ctx, _cache) => {
|
|
299
|
-
return openBlock(), createBlock(_sfc_main$
|
|
298
|
+
return openBlock(), createBlock(_sfc_main$Y, {
|
|
300
299
|
height: _ctx.config.height,
|
|
301
300
|
"init-values": _ctx.model[_ctx.name],
|
|
302
301
|
language: _ctx.config.language,
|
|
@@ -311,7 +310,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
|
311
310
|
}
|
|
312
311
|
});
|
|
313
312
|
|
|
314
|
-
const _sfc_main$
|
|
313
|
+
const _sfc_main$W = /* @__PURE__ */ defineComponent({
|
|
315
314
|
...{
|
|
316
315
|
name: "MFieldsCodeLink"
|
|
317
316
|
},
|
|
@@ -390,7 +389,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
390
389
|
}
|
|
391
390
|
});
|
|
392
391
|
|
|
393
|
-
const _sfc_main$
|
|
392
|
+
const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
394
393
|
...{
|
|
395
394
|
name: "MFieldsCodeSelect"
|
|
396
395
|
},
|
|
@@ -442,11 +441,13 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
442
441
|
{ value: HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
|
|
443
442
|
],
|
|
444
443
|
defaultValue: "code",
|
|
445
|
-
onChange: (mForm, v, { model }) => {
|
|
444
|
+
onChange: (mForm, v, { model, prop, changeRecords }) => {
|
|
446
445
|
if (v === HookCodeType.DATA_SOURCE_METHOD) {
|
|
447
446
|
model.codeId = [];
|
|
447
|
+
changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: [] });
|
|
448
448
|
} else {
|
|
449
449
|
model.codeId = "";
|
|
450
|
+
changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: "" });
|
|
450
451
|
}
|
|
451
452
|
return v;
|
|
452
453
|
}
|
|
@@ -485,9 +486,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
485
486
|
immediate: true
|
|
486
487
|
}
|
|
487
488
|
);
|
|
488
|
-
const changeHandler =
|
|
489
|
-
emit("change", props.model[props.name]);
|
|
490
|
-
};
|
|
489
|
+
const changeHandler = (v, eventData) => emit("change", v, eventData);
|
|
491
490
|
return (_ctx, _cache) => {
|
|
492
491
|
return openBlock(), createElementBlock("div", {
|
|
493
492
|
class: normalizeClass(["m-fields-code-select", _ctx.config.className])
|
|
@@ -529,6 +528,7 @@ const numberOptions = [
|
|
|
529
528
|
];
|
|
530
529
|
const styleTabConfig = {
|
|
531
530
|
title: "样式",
|
|
531
|
+
display: ({ services }) => !(services.uiService.get("showStylePanel") ?? true),
|
|
532
532
|
items: [
|
|
533
533
|
{
|
|
534
534
|
name: "style",
|
|
@@ -541,6 +541,7 @@ const styleTabConfig = {
|
|
|
541
541
|
type: "data-source-field-select",
|
|
542
542
|
name: "position",
|
|
543
543
|
text: "固定定位",
|
|
544
|
+
labelPosition: "left",
|
|
544
545
|
checkStrictly: false,
|
|
545
546
|
dataSourceFieldType: ["string"],
|
|
546
547
|
fieldConfig: {
|
|
@@ -569,7 +570,7 @@ const styleTabConfig = {
|
|
|
569
570
|
fieldConfig: {
|
|
570
571
|
type: "text"
|
|
571
572
|
},
|
|
572
|
-
disabled: (
|
|
573
|
+
disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
|
|
573
574
|
},
|
|
574
575
|
{
|
|
575
576
|
type: "data-source-field-select",
|
|
@@ -590,7 +591,7 @@ const styleTabConfig = {
|
|
|
590
591
|
fieldConfig: {
|
|
591
592
|
type: "text"
|
|
592
593
|
},
|
|
593
|
-
disabled: (
|
|
594
|
+
disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
|
|
594
595
|
}
|
|
595
596
|
]
|
|
596
597
|
},
|
|
@@ -598,6 +599,27 @@ const styleTabConfig = {
|
|
|
598
599
|
type: "fieldset",
|
|
599
600
|
legend: "盒子",
|
|
600
601
|
items: [
|
|
602
|
+
{
|
|
603
|
+
type: "data-source-field-select",
|
|
604
|
+
name: "display",
|
|
605
|
+
text: "display",
|
|
606
|
+
checkStrictly: false,
|
|
607
|
+
dataSourceFieldType: ["string"],
|
|
608
|
+
fieldConfig: {
|
|
609
|
+
type: "select",
|
|
610
|
+
clearable: true,
|
|
611
|
+
allowCreate: true,
|
|
612
|
+
options: [
|
|
613
|
+
{ text: "block", value: "block" },
|
|
614
|
+
{ text: "flex", value: "flex" },
|
|
615
|
+
{ text: "none", value: "none" },
|
|
616
|
+
{ text: "inline-block", value: "inline-block" },
|
|
617
|
+
{ text: "grid", value: "grid" },
|
|
618
|
+
{ text: "inline", value: "inline" },
|
|
619
|
+
{ text: "initial", value: "initial" }
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
},
|
|
601
623
|
{
|
|
602
624
|
type: "data-source-field-select",
|
|
603
625
|
name: "width",
|
|
@@ -626,13 +648,16 @@ const styleTabConfig = {
|
|
|
626
648
|
dataSourceFieldType: ["string"],
|
|
627
649
|
fieldConfig: {
|
|
628
650
|
type: "select",
|
|
651
|
+
clearable: true,
|
|
652
|
+
allowCreate: true,
|
|
629
653
|
options: [
|
|
630
654
|
{ text: "visible", value: "visible" },
|
|
631
655
|
{ text: "hidden", value: "hidden" },
|
|
632
656
|
{ text: "clip", value: "clip" },
|
|
633
657
|
{ text: "scroll", value: "scroll" },
|
|
634
658
|
{ text: "auto", value: "auto" },
|
|
635
|
-
{ text: "overlay", value: "overlay" }
|
|
659
|
+
{ text: "overlay", value: "overlay" },
|
|
660
|
+
{ text: "initial", value: "initial" }
|
|
636
661
|
]
|
|
637
662
|
}
|
|
638
663
|
}
|
|
@@ -699,7 +724,7 @@ const styleTabConfig = {
|
|
|
699
724
|
checkStrictly: false,
|
|
700
725
|
dataSourceFieldType: ["string"],
|
|
701
726
|
fieldConfig: {
|
|
702
|
-
type: "
|
|
727
|
+
type: "img-upload"
|
|
703
728
|
}
|
|
704
729
|
},
|
|
705
730
|
{
|
|
@@ -828,18 +853,20 @@ const advancedTabConfig = {
|
|
|
828
853
|
{
|
|
829
854
|
name: "created",
|
|
830
855
|
text: "created",
|
|
856
|
+
labelPosition: "top",
|
|
831
857
|
type: "code-select"
|
|
832
858
|
},
|
|
833
859
|
{
|
|
834
860
|
name: "mounted",
|
|
835
861
|
text: "mounted",
|
|
862
|
+
labelPosition: "top",
|
|
836
863
|
type: "code-select"
|
|
837
864
|
}
|
|
838
865
|
]
|
|
839
866
|
};
|
|
840
867
|
const displayTabConfig = {
|
|
841
868
|
title: "显示条件",
|
|
842
|
-
display: (
|
|
869
|
+
display: (_vm, { model }) => model.type !== "page",
|
|
843
870
|
items: [
|
|
844
871
|
{
|
|
845
872
|
type: "display-conds",
|
|
@@ -866,8 +893,21 @@ const fillConfig$1 = (config = [], labelWidth = "80px") => [
|
|
|
866
893
|
// 组件id,必须要有
|
|
867
894
|
{
|
|
868
895
|
name: "id",
|
|
869
|
-
|
|
870
|
-
|
|
896
|
+
text: "ID",
|
|
897
|
+
type: "text",
|
|
898
|
+
disabled: true,
|
|
899
|
+
append: {
|
|
900
|
+
type: "button",
|
|
901
|
+
text: "复制",
|
|
902
|
+
handler: async (vm, { model }) => {
|
|
903
|
+
try {
|
|
904
|
+
await navigator.clipboard.writeText(`${model.id}`);
|
|
905
|
+
tMagicMessage.success("已复制");
|
|
906
|
+
} catch (err) {
|
|
907
|
+
tMagicMessage.error("复制失败");
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
871
911
|
},
|
|
872
912
|
{
|
|
873
913
|
name: "name",
|
|
@@ -1147,15 +1187,6 @@ const serializeConfig = (config) => serialize(config, {
|
|
|
1147
1187
|
space: 2,
|
|
1148
1188
|
unsafe: true
|
|
1149
1189
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1150
|
-
const traverseNode = (node, cb, parents = []) => {
|
|
1151
|
-
cb(node, parents);
|
|
1152
|
-
if (Array.isArray(node.items) && node.items.length) {
|
|
1153
|
-
parents.push(node);
|
|
1154
|
-
node.items.forEach((item) => {
|
|
1155
|
-
traverseNode(item, cb, [...parents]);
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
1190
|
const moveItemsInContainer = (sourceIndices, parent, targetIndex) => {
|
|
1160
1191
|
sourceIndices.sort((a, b) => a - b);
|
|
1161
1192
|
for (let i = sourceIndices.length - 1; i >= 0; i--) {
|
|
@@ -1172,6 +1203,55 @@ const moveItemsInContainer = (sourceIndices, parent, targetIndex) => {
|
|
|
1172
1203
|
}
|
|
1173
1204
|
}
|
|
1174
1205
|
};
|
|
1206
|
+
const isIncludeDataSourceByDiffAddResult = (diffResult) => {
|
|
1207
|
+
for (const value of Object.values(diffResult)) {
|
|
1208
|
+
const result = isValueIncludeDataSource(value);
|
|
1209
|
+
if (result) {
|
|
1210
|
+
return true;
|
|
1211
|
+
}
|
|
1212
|
+
if (isObject(value)) {
|
|
1213
|
+
return isIncludeDataSourceByDiffAddResult(value);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
return false;
|
|
1217
|
+
};
|
|
1218
|
+
const isIncludeDataSourceByDiffUpdatedResult = (diffResult, oldNode) => {
|
|
1219
|
+
for (const [key, value] of Object.entries(diffResult)) {
|
|
1220
|
+
if (isValueIncludeDataSource(value)) {
|
|
1221
|
+
return true;
|
|
1222
|
+
}
|
|
1223
|
+
if (isValueIncludeDataSource(oldNode[key])) {
|
|
1224
|
+
return true;
|
|
1225
|
+
}
|
|
1226
|
+
if (isObject(value)) {
|
|
1227
|
+
return isIncludeDataSourceByDiffUpdatedResult(value, oldNode[key]);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
return false;
|
|
1231
|
+
};
|
|
1232
|
+
const isIncludeDataSource = (node, oldNode) => {
|
|
1233
|
+
const diffResult = detailedDiff(oldNode, node);
|
|
1234
|
+
let isIncludeDataSource2 = false;
|
|
1235
|
+
if (diffResult.updated) {
|
|
1236
|
+
if (diffResult.updated[NODE_CONDS_KEY]) {
|
|
1237
|
+
return true;
|
|
1238
|
+
}
|
|
1239
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffUpdatedResult(diffResult.updated, oldNode);
|
|
1240
|
+
if (isIncludeDataSource2) return true;
|
|
1241
|
+
}
|
|
1242
|
+
if (diffResult.added) {
|
|
1243
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.added);
|
|
1244
|
+
if (isIncludeDataSource2) return true;
|
|
1245
|
+
}
|
|
1246
|
+
if (diffResult.deleted) {
|
|
1247
|
+
if (diffResult.deleted[NODE_CONDS_KEY]) {
|
|
1248
|
+
return true;
|
|
1249
|
+
}
|
|
1250
|
+
isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.deleted);
|
|
1251
|
+
if (isIncludeDataSource2) return true;
|
|
1252
|
+
}
|
|
1253
|
+
return isIncludeDataSource2;
|
|
1254
|
+
};
|
|
1175
1255
|
|
|
1176
1256
|
const compose = (middleware, isAsync) => {
|
|
1177
1257
|
if (!Array.isArray(middleware)) throw new TypeError("Middleware 必须是一个数组!");
|
|
@@ -1718,7 +1798,8 @@ class WebStorage extends BaseService {
|
|
|
1718
1798
|
case "number" /* NUMBER */:
|
|
1719
1799
|
return Number(item);
|
|
1720
1800
|
case "boolean" /* BOOLEAN */:
|
|
1721
|
-
|
|
1801
|
+
if (item === "true") return true;
|
|
1802
|
+
if (item === "false") return false;
|
|
1722
1803
|
default:
|
|
1723
1804
|
return item;
|
|
1724
1805
|
}
|
|
@@ -1877,28 +1958,7 @@ class Editor extends BaseService {
|
|
|
1877
1958
|
if (raw) {
|
|
1878
1959
|
root = toRaw(root);
|
|
1879
1960
|
}
|
|
1880
|
-
|
|
1881
|
-
node: null,
|
|
1882
|
-
parent: null,
|
|
1883
|
-
page: null
|
|
1884
|
-
};
|
|
1885
|
-
if (!root) return info;
|
|
1886
|
-
if (id === root.id) {
|
|
1887
|
-
info.node = root;
|
|
1888
|
-
return info;
|
|
1889
|
-
}
|
|
1890
|
-
const path = getNodePath(id, root.items);
|
|
1891
|
-
if (!path.length) return info;
|
|
1892
|
-
path.unshift(root);
|
|
1893
|
-
info.node = path[path.length - 1];
|
|
1894
|
-
info.parent = path[path.length - 2];
|
|
1895
|
-
path.forEach((item) => {
|
|
1896
|
-
if (isPage(item) || isPageFragment(item)) {
|
|
1897
|
-
info.page = item;
|
|
1898
|
-
return;
|
|
1899
|
-
}
|
|
1900
|
-
});
|
|
1901
|
-
return info;
|
|
1961
|
+
return getNodeInfo(id, root);
|
|
1902
1962
|
}
|
|
1903
1963
|
/**
|
|
1904
1964
|
* 根据ID获取指点节点配置
|
|
@@ -2119,10 +2179,10 @@ class Editor extends BaseService {
|
|
|
2119
2179
|
const rootItems = root.items || [];
|
|
2120
2180
|
if (isPage(node)) {
|
|
2121
2181
|
this.state.pageLength -= 1;
|
|
2122
|
-
await selectDefault(
|
|
2182
|
+
await selectDefault(rootItems);
|
|
2123
2183
|
} else if (isPageFragment(node)) {
|
|
2124
2184
|
this.state.pageFragmentLength -= 1;
|
|
2125
|
-
await selectDefault(
|
|
2185
|
+
await selectDefault(rootItems);
|
|
2126
2186
|
} else {
|
|
2127
2187
|
await this.select(parent);
|
|
2128
2188
|
stage?.select(parent.id);
|
|
@@ -2145,13 +2205,13 @@ class Editor extends BaseService {
|
|
|
2145
2205
|
}
|
|
2146
2206
|
this.emit("remove", nodes);
|
|
2147
2207
|
}
|
|
2148
|
-
async doUpdate(config) {
|
|
2208
|
+
async doUpdate(config, { changeRecords = [] } = {}) {
|
|
2149
2209
|
const root = this.get("root");
|
|
2150
2210
|
if (!root) throw new Error("root为空");
|
|
2151
2211
|
if (!config?.id) throw new Error("没有配置或者配置缺少id值");
|
|
2152
2212
|
const info = this.getNodeInfo(config.id, false);
|
|
2153
2213
|
if (!info.node) throw new Error(`获取不到id为${config.id}的节点`);
|
|
2154
|
-
const node =
|
|
2214
|
+
const node = toRaw(info.node);
|
|
2155
2215
|
let newConfig = await this.toggleFixedPosition(toRaw(config), node, root);
|
|
2156
2216
|
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue, key) => {
|
|
2157
2217
|
if (typeof srcValue === "undefined" && Object.hasOwn(newConfig, key)) {
|
|
@@ -2167,7 +2227,11 @@ class Editor extends BaseService {
|
|
|
2167
2227
|
if (!newConfig.type) throw new Error("配置缺少type值");
|
|
2168
2228
|
if (newConfig.type === NodeType.ROOT) {
|
|
2169
2229
|
this.set("root", newConfig);
|
|
2170
|
-
return
|
|
2230
|
+
return {
|
|
2231
|
+
oldNode: node,
|
|
2232
|
+
newNode: newConfig,
|
|
2233
|
+
changeRecords
|
|
2234
|
+
};
|
|
2171
2235
|
}
|
|
2172
2236
|
const { parent } = info;
|
|
2173
2237
|
if (!parent) throw new Error("获取不到父级节点");
|
|
@@ -2184,30 +2248,29 @@ class Editor extends BaseService {
|
|
|
2184
2248
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
2185
2249
|
nodes.splice(targetIndex, 1, newConfig);
|
|
2186
2250
|
this.set("nodes", [...nodes]);
|
|
2187
|
-
this.get("stage")?.update({
|
|
2188
|
-
config: cloneDeep(newConfig),
|
|
2189
|
-
parentId: parent.id,
|
|
2190
|
-
root: cloneDeep(root)
|
|
2191
|
-
});
|
|
2192
2251
|
if (isPage(newConfig) || isPageFragment(newConfig)) {
|
|
2193
2252
|
this.set("page", newConfig);
|
|
2194
2253
|
}
|
|
2195
2254
|
this.addModifiedNodeId(newConfig.id);
|
|
2196
|
-
return
|
|
2255
|
+
return {
|
|
2256
|
+
oldNode: node,
|
|
2257
|
+
newNode: newConfig,
|
|
2258
|
+
changeRecords
|
|
2259
|
+
};
|
|
2197
2260
|
}
|
|
2198
2261
|
/**
|
|
2199
2262
|
* 更新节点
|
|
2200
2263
|
* @param config 新的节点配置,配置中需要有id信息
|
|
2201
2264
|
* @returns 更新后的节点配置
|
|
2202
2265
|
*/
|
|
2203
|
-
async update(config) {
|
|
2266
|
+
async update(config, data = {}) {
|
|
2204
2267
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2205
|
-
const
|
|
2206
|
-
if (
|
|
2268
|
+
const updateData = await Promise.all(nodes.map((node) => this.doUpdate(node, data)));
|
|
2269
|
+
if (updateData[0].oldNode?.type !== NodeType.ROOT) {
|
|
2207
2270
|
this.pushHistoryState();
|
|
2208
2271
|
}
|
|
2209
|
-
this.emit("update",
|
|
2210
|
-
return Array.isArray(config) ?
|
|
2272
|
+
this.emit("update", updateData);
|
|
2273
|
+
return Array.isArray(config) ? updateData.map((item) => item.newNode) : updateData[0].newNode;
|
|
2211
2274
|
}
|
|
2212
2275
|
/**
|
|
2213
2276
|
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
@@ -2401,7 +2464,7 @@ class Editor extends BaseService {
|
|
|
2401
2464
|
parent.items?.splice(index, 1);
|
|
2402
2465
|
await stage.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
|
|
2403
2466
|
const layout = await this.getLayout(target);
|
|
2404
|
-
const newConfig = mergeWith(cloneDeep(node), config, (
|
|
2467
|
+
const newConfig = mergeWith(cloneDeep(node), config, (_objValue, srcValue) => {
|
|
2405
2468
|
if (Array.isArray(srcValue)) {
|
|
2406
2469
|
return srcValue;
|
|
2407
2470
|
}
|
|
@@ -2410,7 +2473,11 @@ class Editor extends BaseService {
|
|
|
2410
2473
|
target.items.push(newConfig);
|
|
2411
2474
|
await stage.select(targetId);
|
|
2412
2475
|
const targetParent = this.getParentById(target.id);
|
|
2413
|
-
await stage.update({
|
|
2476
|
+
await stage.update({
|
|
2477
|
+
config: cloneDeep(target),
|
|
2478
|
+
parentId: targetParent?.id,
|
|
2479
|
+
root: cloneDeep(root)
|
|
2480
|
+
});
|
|
2414
2481
|
await this.select(newConfig);
|
|
2415
2482
|
stage.select(newConfig.id);
|
|
2416
2483
|
this.addModifiedNodeId(target.id);
|
|
@@ -2763,6 +2830,7 @@ const HttpFormConfig = [
|
|
|
2763
2830
|
name: "params",
|
|
2764
2831
|
type: "key-value",
|
|
2765
2832
|
defaultValue: {},
|
|
2833
|
+
advanced: true,
|
|
2766
2834
|
text: "参数"
|
|
2767
2835
|
},
|
|
2768
2836
|
{
|
|
@@ -2776,6 +2844,7 @@ const HttpFormConfig = [
|
|
|
2776
2844
|
name: "headers",
|
|
2777
2845
|
type: "key-value",
|
|
2778
2846
|
defaultValue: {},
|
|
2847
|
+
advanced: true,
|
|
2779
2848
|
text: "请求头"
|
|
2780
2849
|
}
|
|
2781
2850
|
]
|
|
@@ -2830,7 +2899,7 @@ const fillConfig = (config) => [
|
|
|
2830
2899
|
},
|
|
2831
2900
|
{
|
|
2832
2901
|
title: "请求参数裁剪",
|
|
2833
|
-
display: (
|
|
2902
|
+
display: (_formState, { model }) => model.type === "http",
|
|
2834
2903
|
items: [
|
|
2835
2904
|
{
|
|
2836
2905
|
name: "beforeRequest",
|
|
@@ -2842,7 +2911,7 @@ const fillConfig = (config) => [
|
|
|
2842
2911
|
},
|
|
2843
2912
|
{
|
|
2844
2913
|
title: "响应数据裁剪",
|
|
2845
|
-
display: (
|
|
2914
|
+
display: (_formState, { model }) => model.type === "http",
|
|
2846
2915
|
items: [
|
|
2847
2916
|
{
|
|
2848
2917
|
name: "afterResponse",
|
|
@@ -3009,6 +3078,10 @@ globalThis.requestIdleCallback = globalThis.requestIdleCallback || function(cb)
|
|
|
3009
3078
|
class IdleTask extends EventEmitter {
|
|
3010
3079
|
taskList = [];
|
|
3011
3080
|
taskHandle = null;
|
|
3081
|
+
constructor() {
|
|
3082
|
+
super();
|
|
3083
|
+
this.setMaxListeners(1e3);
|
|
3084
|
+
}
|
|
3012
3085
|
enqueueTask(taskHandler, taskData) {
|
|
3013
3086
|
this.taskList.push({
|
|
3014
3087
|
handler: taskHandler,
|
|
@@ -3018,6 +3091,9 @@ class IdleTask extends EventEmitter {
|
|
|
3018
3091
|
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
3019
3092
|
}
|
|
3020
3093
|
}
|
|
3094
|
+
clearTasks() {
|
|
3095
|
+
this.taskList = [];
|
|
3096
|
+
}
|
|
3021
3097
|
on(eventName, listener) {
|
|
3022
3098
|
return super.on(eventName, listener);
|
|
3023
3099
|
}
|
|
@@ -3028,12 +3104,30 @@ class IdleTask extends EventEmitter {
|
|
|
3028
3104
|
return super.emit(eventName, ...args);
|
|
3029
3105
|
}
|
|
3030
3106
|
runTaskQueue(deadline) {
|
|
3031
|
-
while (
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3107
|
+
while (deadline.timeRemaining() > 0 && this.taskList.length) {
|
|
3108
|
+
const timeRemaining = deadline.timeRemaining();
|
|
3109
|
+
let times = 0;
|
|
3110
|
+
if (timeRemaining <= 5) {
|
|
3111
|
+
times = 10;
|
|
3112
|
+
} else if (timeRemaining <= 10) {
|
|
3113
|
+
times = 100;
|
|
3114
|
+
} else if (timeRemaining <= 15) {
|
|
3115
|
+
times = 300;
|
|
3116
|
+
} else {
|
|
3117
|
+
times = 600;
|
|
3118
|
+
}
|
|
3119
|
+
for (let i = 0; i < times; i++) {
|
|
3120
|
+
const task = this.taskList.shift();
|
|
3121
|
+
if (task) {
|
|
3122
|
+
task.handler(task.data);
|
|
3123
|
+
}
|
|
3124
|
+
if (this.taskList.length === 0) {
|
|
3125
|
+
break;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3034
3128
|
}
|
|
3035
3129
|
if (this.taskList.length) {
|
|
3036
|
-
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout:
|
|
3130
|
+
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 300 });
|
|
3037
3131
|
} else {
|
|
3038
3132
|
this.taskHandle = 0;
|
|
3039
3133
|
this.emit("finish");
|
|
@@ -3178,7 +3272,7 @@ const updateStatus = (nodeStatusMap, id, status) => {
|
|
|
3178
3272
|
});
|
|
3179
3273
|
};
|
|
3180
3274
|
|
|
3181
|
-
const _sfc_main$
|
|
3275
|
+
const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
3182
3276
|
...{
|
|
3183
3277
|
name: "MEditorCodeParams"
|
|
3184
3278
|
},
|
|
@@ -3194,7 +3288,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3194
3288
|
setup(__props, { emit: __emit }) {
|
|
3195
3289
|
const props = __props;
|
|
3196
3290
|
const emit = __emit;
|
|
3197
|
-
const form =
|
|
3291
|
+
const form = useTemplateRef("form");
|
|
3198
3292
|
const getFormConfig = (items = []) => [
|
|
3199
3293
|
{
|
|
3200
3294
|
type: "fieldset",
|
|
@@ -3215,10 +3309,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3215
3309
|
}))
|
|
3216
3310
|
)
|
|
3217
3311
|
);
|
|
3218
|
-
const onParamsChangeHandler = async () => {
|
|
3312
|
+
const onParamsChangeHandler = async (v, eventData) => {
|
|
3219
3313
|
try {
|
|
3220
3314
|
const value = await form.value?.submitForm(true);
|
|
3221
|
-
emit("change", value);
|
|
3315
|
+
emit("change", value, eventData);
|
|
3222
3316
|
} catch (e) {
|
|
3223
3317
|
error(e);
|
|
3224
3318
|
}
|
|
@@ -3238,9 +3332,9 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3238
3332
|
}
|
|
3239
3333
|
});
|
|
3240
3334
|
|
|
3241
|
-
const _hoisted_1$
|
|
3242
|
-
const _hoisted_2$
|
|
3243
|
-
const _sfc_main$
|
|
3335
|
+
const _hoisted_1$w = { class: "m-fields-code-select-col" };
|
|
3336
|
+
const _hoisted_2$i = { class: "code-select-container" };
|
|
3337
|
+
const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
3244
3338
|
...{
|
|
3245
3339
|
name: "MFieldsCodeSelectCol"
|
|
3246
3340
|
},
|
|
@@ -3311,22 +3405,39 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3311
3405
|
return codeId;
|
|
3312
3406
|
}
|
|
3313
3407
|
};
|
|
3314
|
-
const
|
|
3408
|
+
const onCodeIdChangeHandler = (value) => {
|
|
3315
3409
|
props.model.params = value.params;
|
|
3316
|
-
emit("change", props.model
|
|
3410
|
+
emit("change", props.model, {
|
|
3411
|
+
changeRecords: [
|
|
3412
|
+
{
|
|
3413
|
+
propPath: props.prop,
|
|
3414
|
+
value: value[props.name]
|
|
3415
|
+
}
|
|
3416
|
+
]
|
|
3417
|
+
});
|
|
3418
|
+
};
|
|
3419
|
+
const onParamsChangeHandler = (value, eventData) => {
|
|
3420
|
+
props.model.params = value.params;
|
|
3421
|
+
emit("change", props.model, {
|
|
3422
|
+
...eventData,
|
|
3423
|
+
changeRecords: (eventData.changeRecords || []).map((item) => ({
|
|
3424
|
+
prop: `${props.prop.replace(props.name, "")}${item.propPath}`,
|
|
3425
|
+
value: item.value
|
|
3426
|
+
}))
|
|
3427
|
+
});
|
|
3317
3428
|
};
|
|
3318
3429
|
const editCode = (id) => {
|
|
3319
3430
|
eventBus?.emit("edit-code", id);
|
|
3320
3431
|
};
|
|
3321
3432
|
return (_ctx, _cache) => {
|
|
3322
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3323
|
-
createElementVNode("div", _hoisted_2$
|
|
3433
|
+
return openBlock(), createElementBlock("div", _hoisted_1$w, [
|
|
3434
|
+
createElementVNode("div", _hoisted_2$i, [
|
|
3324
3435
|
createVNode(unref(MContainer), {
|
|
3325
3436
|
class: "select",
|
|
3326
3437
|
config: selectConfig,
|
|
3327
3438
|
model: _ctx.model,
|
|
3328
3439
|
size: _ctx.size,
|
|
3329
|
-
onChange:
|
|
3440
|
+
onChange: onCodeIdChangeHandler
|
|
3330
3441
|
}, null, 8, ["model", "size"]),
|
|
3331
3442
|
_ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3332
3443
|
key: 0,
|
|
@@ -3335,14 +3446,14 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3335
3446
|
onClick: _cache[0] || (_cache[0] = ($event) => editCode(_ctx.model[_ctx.name]))
|
|
3336
3447
|
}, {
|
|
3337
3448
|
default: withCtx(() => [
|
|
3338
|
-
createVNode(_sfc_main$
|
|
3449
|
+
createVNode(_sfc_main$Z, {
|
|
3339
3450
|
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
3340
3451
|
}, null, 8, ["icon"])
|
|
3341
3452
|
]),
|
|
3342
3453
|
_: 1
|
|
3343
3454
|
}, 8, ["size"])) : createCommentVNode("", true)
|
|
3344
3455
|
]),
|
|
3345
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3456
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$U, {
|
|
3346
3457
|
name: "params",
|
|
3347
3458
|
key: _ctx.model[_ctx.name],
|
|
3348
3459
|
model: _ctx.model,
|
|
@@ -3355,7 +3466,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3355
3466
|
}
|
|
3356
3467
|
});
|
|
3357
3468
|
|
|
3358
|
-
const _sfc_main$
|
|
3469
|
+
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
3359
3470
|
...{
|
|
3360
3471
|
name: "MFieldsCondOpSelect"
|
|
3361
3472
|
},
|
|
@@ -3441,7 +3552,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
3441
3552
|
}
|
|
3442
3553
|
});
|
|
3443
3554
|
|
|
3444
|
-
const _sfc_main$
|
|
3555
|
+
const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
3445
3556
|
__name: "FloatingBox",
|
|
3446
3557
|
props: /* @__PURE__ */ mergeModels({
|
|
3447
3558
|
position: { default: () => ({ left: 0, top: 0 }) },
|
|
@@ -3461,8 +3572,8 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
3461
3572
|
const height = useModel(__props, "height");
|
|
3462
3573
|
const visible = useModel(__props, "visible");
|
|
3463
3574
|
const props = __props;
|
|
3464
|
-
const target =
|
|
3465
|
-
const titleEl =
|
|
3575
|
+
const target = useTemplateRef("target");
|
|
3576
|
+
const titleEl = useTemplateRef("titleEl");
|
|
3466
3577
|
const zIndex = useZIndex();
|
|
3467
3578
|
const curZIndex = ref(0);
|
|
3468
3579
|
const titleHeight = ref(0);
|
|
@@ -3596,7 +3707,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
3596
3707
|
onClick: closeHandler
|
|
3597
3708
|
}, {
|
|
3598
3709
|
default: withCtx(() => [
|
|
3599
|
-
createVNode(_sfc_main$
|
|
3710
|
+
createVNode(_sfc_main$Z, { icon: unref(Close) }, null, 8, ["icon"])
|
|
3600
3711
|
]),
|
|
3601
3712
|
_: 1
|
|
3602
3713
|
})
|
|
@@ -3617,7 +3728,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
3617
3728
|
const useCodeBlockEdit = (codeBlockService) => {
|
|
3618
3729
|
const codeConfig = ref();
|
|
3619
3730
|
const codeId = ref();
|
|
3620
|
-
const codeBlockEditor =
|
|
3731
|
+
const codeBlockEditor = useTemplateRef("codeBlockEditor");
|
|
3621
3732
|
const createCodeBlock = async () => {
|
|
3622
3733
|
if (!codeBlockService) {
|
|
3623
3734
|
tMagicMessage.error("新增代码块失败");
|
|
@@ -3625,7 +3736,7 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3625
3736
|
}
|
|
3626
3737
|
codeConfig.value = {
|
|
3627
3738
|
name: "",
|
|
3628
|
-
content: `({app, params}) => {
|
|
3739
|
+
content: `({app, params, flowState}) => {
|
|
3629
3740
|
// place your code here
|
|
3630
3741
|
}`,
|
|
3631
3742
|
params: []
|
|
@@ -3671,81 +3782,10 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3671
3782
|
};
|
|
3672
3783
|
};
|
|
3673
3784
|
|
|
3674
|
-
const useDataSourceMethod = () => {
|
|
3675
|
-
const codeConfig = ref();
|
|
3676
|
-
const codeBlockEditor = ref();
|
|
3677
|
-
const dataSource = ref();
|
|
3678
|
-
const dataSourceMethod = ref("");
|
|
3679
|
-
return {
|
|
3680
|
-
codeConfig,
|
|
3681
|
-
codeBlockEditor,
|
|
3682
|
-
createCode: async (model) => {
|
|
3683
|
-
codeConfig.value = {
|
|
3684
|
-
name: "",
|
|
3685
|
-
content: `({ params, dataSource, app }) => {
|
|
3686
|
-
// place your code here
|
|
3687
|
-
}`,
|
|
3688
|
-
params: []
|
|
3689
|
-
};
|
|
3690
|
-
await nextTick();
|
|
3691
|
-
dataSource.value = model;
|
|
3692
|
-
dataSourceMethod.value = "";
|
|
3693
|
-
codeBlockEditor.value?.show();
|
|
3694
|
-
},
|
|
3695
|
-
editCode: async (model, methodName) => {
|
|
3696
|
-
const method = model.methods?.find((method2) => method2.name === methodName);
|
|
3697
|
-
if (!method) {
|
|
3698
|
-
tMagicMessage.error("获取数据源方法失败");
|
|
3699
|
-
return;
|
|
3700
|
-
}
|
|
3701
|
-
let codeContent = method.content || `({ params, dataSource, app }) => {
|
|
3702
|
-
// place your code here
|
|
3703
|
-
}`;
|
|
3704
|
-
if (typeof codeContent !== "string") {
|
|
3705
|
-
codeContent = codeContent.toString();
|
|
3706
|
-
}
|
|
3707
|
-
codeConfig.value = {
|
|
3708
|
-
...cloneDeep(method),
|
|
3709
|
-
content: codeContent
|
|
3710
|
-
};
|
|
3711
|
-
await nextTick();
|
|
3712
|
-
dataSource.value = model;
|
|
3713
|
-
dataSourceMethod.value = methodName;
|
|
3714
|
-
codeBlockEditor.value?.show();
|
|
3715
|
-
},
|
|
3716
|
-
deleteCode: async (model, methodName) => {
|
|
3717
|
-
if (!model.methods) return;
|
|
3718
|
-
const index = model.methods.findIndex((method) => method.name === methodName);
|
|
3719
|
-
if (index === -1) {
|
|
3720
|
-
return;
|
|
3721
|
-
}
|
|
3722
|
-
model.methods.splice(index, 1);
|
|
3723
|
-
},
|
|
3724
|
-
submitCode: (values) => {
|
|
3725
|
-
if (!dataSource.value) return;
|
|
3726
|
-
if (!dataSource.value.methods) {
|
|
3727
|
-
dataSource.value.methods = [];
|
|
3728
|
-
}
|
|
3729
|
-
if (values.content) {
|
|
3730
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
3731
|
-
if (typeof values.content === "string") {
|
|
3732
|
-
values.content = parseDSL(values.content);
|
|
3733
|
-
}
|
|
3734
|
-
}
|
|
3735
|
-
if (dataSourceMethod.value) {
|
|
3736
|
-
const index = dataSource.value.methods.findIndex((method) => method.name === dataSourceMethod.value);
|
|
3737
|
-
dataSource.value.methods.splice(index, 1, values);
|
|
3738
|
-
} else {
|
|
3739
|
-
dataSource.value.methods.push(values);
|
|
3740
|
-
}
|
|
3741
|
-
codeBlockEditor.value?.hide();
|
|
3742
|
-
}
|
|
3743
|
-
};
|
|
3744
|
-
};
|
|
3745
|
-
|
|
3746
3785
|
const state = reactive({
|
|
3747
3786
|
uiSelectMode: false,
|
|
3748
3787
|
showSrc: false,
|
|
3788
|
+
showStylePanel: true,
|
|
3749
3789
|
zoom: 1,
|
|
3750
3790
|
stageContainerRect: {
|
|
3751
3791
|
width: 0,
|
|
@@ -4108,7 +4148,7 @@ const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
|
|
|
4108
4148
|
|
|
4109
4149
|
const useGetSo = (target, emit) => {
|
|
4110
4150
|
let getso;
|
|
4111
|
-
const
|
|
4151
|
+
const isDragging = ref(false);
|
|
4112
4152
|
onMounted(() => {
|
|
4113
4153
|
if (!target.value) return;
|
|
4114
4154
|
getso = new Gesto(target.value, {
|
|
@@ -4118,17 +4158,17 @@ const useGetSo = (target, emit) => {
|
|
|
4118
4158
|
if (!target.value) return;
|
|
4119
4159
|
emit("change", e);
|
|
4120
4160
|
}).on("dragStart", () => {
|
|
4121
|
-
|
|
4161
|
+
isDragging.value = true;
|
|
4122
4162
|
}).on("dragEnd", () => {
|
|
4123
|
-
|
|
4163
|
+
isDragging.value = false;
|
|
4124
4164
|
});
|
|
4125
4165
|
});
|
|
4126
4166
|
onBeforeUnmount(() => {
|
|
4127
4167
|
getso?.unset();
|
|
4128
|
-
|
|
4168
|
+
isDragging.value = false;
|
|
4129
4169
|
});
|
|
4130
4170
|
return {
|
|
4131
|
-
|
|
4171
|
+
isDragging
|
|
4132
4172
|
};
|
|
4133
4173
|
};
|
|
4134
4174
|
|
|
@@ -4190,9 +4230,9 @@ const useNodeStatus$1 = (nodeData) => {
|
|
|
4190
4230
|
};
|
|
4191
4231
|
};
|
|
4192
4232
|
|
|
4193
|
-
const _hoisted_1$
|
|
4194
|
-
const _hoisted_2$
|
|
4195
|
-
const _sfc_main$
|
|
4233
|
+
const _hoisted_1$v = { class: "m-editor-data-source-fields" };
|
|
4234
|
+
const _hoisted_2$h = { class: "m-editor-data-source-fields-footer" };
|
|
4235
|
+
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
4196
4236
|
...{
|
|
4197
4237
|
name: "MFieldsDataSourceFields"
|
|
4198
4238
|
},
|
|
@@ -4229,14 +4269,28 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4229
4269
|
calcBoxPosition();
|
|
4230
4270
|
addDialogVisible.value = true;
|
|
4231
4271
|
};
|
|
4232
|
-
const fieldChange = ({ index, ...value }) => {
|
|
4272
|
+
const fieldChange = ({ index, ...value }, data) => {
|
|
4273
|
+
addDialogVisible.value = false;
|
|
4233
4274
|
if (index > -1) {
|
|
4234
|
-
|
|
4275
|
+
emit("change", value, {
|
|
4276
|
+
modifyKey: index,
|
|
4277
|
+
changeRecords: (data.changeRecords || []).map((item) => ({
|
|
4278
|
+
propPath: `${props.prop}.${index}.${item.propPath}`,
|
|
4279
|
+
value: item.value
|
|
4280
|
+
}))
|
|
4281
|
+
});
|
|
4235
4282
|
} else {
|
|
4236
|
-
props.model[props.name].
|
|
4283
|
+
const modifyKey = props.model[props.name].length;
|
|
4284
|
+
emit("change", value, {
|
|
4285
|
+
modifyKey,
|
|
4286
|
+
changeRecords: [
|
|
4287
|
+
{
|
|
4288
|
+
propPath: `${props.prop}.${modifyKey}`,
|
|
4289
|
+
value
|
|
4290
|
+
}
|
|
4291
|
+
]
|
|
4292
|
+
});
|
|
4237
4293
|
}
|
|
4238
|
-
addDialogVisible.value = false;
|
|
4239
|
-
emit("change", props.model[props.name]);
|
|
4240
4294
|
};
|
|
4241
4295
|
const fieldColumns = [
|
|
4242
4296
|
{
|
|
@@ -4430,9 +4484,8 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4430
4484
|
const addFromJsonFromChange = ({ data }) => {
|
|
4431
4485
|
try {
|
|
4432
4486
|
const value = JSON.parse(data);
|
|
4433
|
-
props.model[props.name] = getFieldsConfig(value, props.model[props.name]);
|
|
4434
4487
|
addFromJsonDialogVisible.value = false;
|
|
4435
|
-
emit("change", props.model[props.name]);
|
|
4488
|
+
emit("change", getFieldsConfig(value, props.model[props.name]));
|
|
4436
4489
|
} catch (e) {
|
|
4437
4490
|
tMagicMessage.error(e.message);
|
|
4438
4491
|
}
|
|
@@ -4443,12 +4496,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4443
4496
|
const parentFloating = inject("parentFloating", ref(null));
|
|
4444
4497
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4445
4498
|
return (_ctx, _cache) => {
|
|
4446
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4499
|
+
return openBlock(), createElementBlock("div", _hoisted_1$v, [
|
|
4447
4500
|
createVNode(unref(MagicTable), {
|
|
4448
4501
|
data: _ctx.model[_ctx.name],
|
|
4449
4502
|
columns: fieldColumns
|
|
4450
4503
|
}, null, 8, ["data"]),
|
|
4451
|
-
createElementVNode("div", _hoisted_2$
|
|
4504
|
+
createElementVNode("div", _hoisted_2$h, [
|
|
4452
4505
|
createVNode(unref(TMagicButton), {
|
|
4453
4506
|
size: "small",
|
|
4454
4507
|
disabled: _ctx.disabled,
|
|
@@ -4473,7 +4526,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4473
4526
|
_: 1
|
|
4474
4527
|
}, 8, ["disabled"])
|
|
4475
4528
|
]),
|
|
4476
|
-
createVNode(_sfc_main$
|
|
4529
|
+
createVNode(_sfc_main$R, {
|
|
4477
4530
|
visible: addDialogVisible.value,
|
|
4478
4531
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
|
4479
4532
|
width: width.value,
|
|
@@ -4496,7 +4549,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4496
4549
|
]),
|
|
4497
4550
|
_: 1
|
|
4498
4551
|
}, 8, ["visible", "width", "height", "title", "position"]),
|
|
4499
|
-
createVNode(_sfc_main$
|
|
4552
|
+
createVNode(_sfc_main$R, {
|
|
4500
4553
|
visible: addFromJsonDialogVisible.value,
|
|
4501
4554
|
"onUpdate:visible": _cache[5] || (_cache[5] = ($event) => addFromJsonDialogVisible.value = $event),
|
|
4502
4555
|
width: width.value,
|
|
@@ -4521,8 +4574,8 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4521
4574
|
}
|
|
4522
4575
|
});
|
|
4523
4576
|
|
|
4524
|
-
const _hoisted_1$
|
|
4525
|
-
const _sfc_main$
|
|
4577
|
+
const _hoisted_1$u = { class: "m-editor-data-source-field-select" };
|
|
4578
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
4526
4579
|
__name: "FieldSelect",
|
|
4527
4580
|
props: /* @__PURE__ */ mergeModels({
|
|
4528
4581
|
value: {},
|
|
@@ -4603,7 +4656,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4603
4656
|
eventBus?.emit("edit-data-source", removeDataSourceFieldPrefix(id));
|
|
4604
4657
|
};
|
|
4605
4658
|
return (_ctx, _cache) => {
|
|
4606
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4659
|
+
return openBlock(), createElementBlock("div", _hoisted_1$u, [
|
|
4607
4660
|
_ctx.checkStrictly ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4608
4661
|
createVNode(unref(TMagicSelect), {
|
|
4609
4662
|
"model-value": selectDataSourceId.value,
|
|
@@ -4671,7 +4724,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4671
4724
|
onClick: _cache[0] || (_cache[0] = ($event) => editHandler(selectDataSourceId.value))
|
|
4672
4725
|
}, {
|
|
4673
4726
|
default: withCtx(() => [
|
|
4674
|
-
createVNode(_sfc_main$
|
|
4727
|
+
createVNode(_sfc_main$Z, {
|
|
4675
4728
|
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
4676
4729
|
}, null, 8, ["icon"])
|
|
4677
4730
|
]),
|
|
@@ -4685,8 +4738,8 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4685
4738
|
}
|
|
4686
4739
|
});
|
|
4687
4740
|
|
|
4688
|
-
const _hoisted_1$
|
|
4689
|
-
const _sfc_main$
|
|
4741
|
+
const _hoisted_1$t = { class: "m-fields-data-source-field-select" };
|
|
4742
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
4690
4743
|
...{
|
|
4691
4744
|
name: "MFieldsDataSourceFieldSelect"
|
|
4692
4745
|
},
|
|
@@ -4787,8 +4840,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4787
4840
|
}
|
|
4788
4841
|
};
|
|
4789
4842
|
return (_ctx, _cache) => {
|
|
4790
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4791
|
-
showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (openBlock(), createBlock(_sfc_main$
|
|
4843
|
+
return openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
4844
|
+
showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (openBlock(), createBlock(_sfc_main$P, {
|
|
4792
4845
|
key: 0,
|
|
4793
4846
|
"model-value": _ctx.model[_ctx.name],
|
|
4794
4847
|
disabled: _ctx.disabled,
|
|
@@ -4823,7 +4876,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4823
4876
|
onClick: _cache[0] || (_cache[0] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4824
4877
|
}, {
|
|
4825
4878
|
default: withCtx(() => [
|
|
4826
|
-
createVNode(_sfc_main$
|
|
4879
|
+
createVNode(_sfc_main$Z, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4827
4880
|
]),
|
|
4828
4881
|
_: 1
|
|
4829
4882
|
}, 8, ["type", "size"])
|
|
@@ -4835,10 +4888,10 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4835
4888
|
}
|
|
4836
4889
|
});
|
|
4837
4890
|
|
|
4838
|
-
const _hoisted_1$
|
|
4839
|
-
const _hoisted_2$
|
|
4891
|
+
const _hoisted_1$s = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4892
|
+
const _hoisted_2$g = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4840
4893
|
const _hoisted_3$4 = { class: "el-input__inner t-input__inner" };
|
|
4841
|
-
const _sfc_main$
|
|
4894
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
4842
4895
|
...{
|
|
4843
4896
|
name: "MFieldsDataSourceInput"
|
|
4844
4897
|
},
|
|
@@ -4859,7 +4912,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4859
4912
|
const props = __props;
|
|
4860
4913
|
const emit = __emit;
|
|
4861
4914
|
const { dataSourceService } = inject("services") || {};
|
|
4862
|
-
const autocomplete =
|
|
4915
|
+
const autocomplete = useTemplateRef("autocomplete");
|
|
4863
4916
|
const isFocused = ref(false);
|
|
4864
4917
|
const state = ref("");
|
|
4865
4918
|
const displayState = ref([]);
|
|
@@ -5038,12 +5091,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
5038
5091
|
}
|
|
5039
5092
|
), {
|
|
5040
5093
|
suffix: withCtx(() => [
|
|
5041
|
-
createVNode(_sfc_main$
|
|
5094
|
+
createVNode(_sfc_main$Z, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
5042
5095
|
]),
|
|
5043
5096
|
default: withCtx(({ item }) => [
|
|
5044
|
-
createElementVNode("div", _hoisted_1$
|
|
5097
|
+
createElementVNode("div", _hoisted_1$s, [
|
|
5045
5098
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
5046
|
-
createElementVNode("span", _hoisted_2$
|
|
5099
|
+
createElementVNode("span", _hoisted_2$g, toDisplayString(item.value), 1)
|
|
5047
5100
|
])
|
|
5048
5101
|
]),
|
|
5049
5102
|
_: 1
|
|
@@ -5073,7 +5126,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
5073
5126
|
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
5074
5127
|
], 64);
|
|
5075
5128
|
}), 256)),
|
|
5076
|
-
createVNode(_sfc_main$
|
|
5129
|
+
createVNode(_sfc_main$Z, {
|
|
5077
5130
|
class: "tmagic-data-source-input-icon",
|
|
5078
5131
|
icon: unref(Coin)
|
|
5079
5132
|
}, null, 8, ["icon"])
|
|
@@ -5084,11 +5137,11 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
5084
5137
|
}
|
|
5085
5138
|
});
|
|
5086
5139
|
|
|
5087
|
-
const _hoisted_1$
|
|
5088
|
-
const _hoisted_2$
|
|
5140
|
+
const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
5141
|
+
const _hoisted_2$f = { style: { "flex": "1" } };
|
|
5089
5142
|
const _hoisted_3$3 = { style: { "flex": "1" } };
|
|
5090
5143
|
const _hoisted_4$3 = { class: "dialog-footer" };
|
|
5091
|
-
const _sfc_main$
|
|
5144
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
5092
5145
|
...{
|
|
5093
5146
|
name: "MEditorCodeBlockEditor"
|
|
5094
5147
|
},
|
|
@@ -5114,7 +5167,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5114
5167
|
const { height: codeBlockEditorHeight } = useEditorContentHeight();
|
|
5115
5168
|
const difVisible = ref(false);
|
|
5116
5169
|
const { rect: windowRect } = useWindowRect();
|
|
5117
|
-
const magicVsEditor =
|
|
5170
|
+
const magicVsEditor = useTemplateRef("magicVsEditor");
|
|
5118
5171
|
const diffChange = () => {
|
|
5119
5172
|
if (!magicVsEditor.value || !formBox.value?.form) {
|
|
5120
5173
|
return;
|
|
@@ -5216,14 +5269,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5216
5269
|
}
|
|
5217
5270
|
}
|
|
5218
5271
|
]);
|
|
5219
|
-
const submitForm = (values) => {
|
|
5272
|
+
const submitForm = (values, data) => {
|
|
5220
5273
|
changedValue.value = void 0;
|
|
5221
|
-
emit("submit", values);
|
|
5274
|
+
emit("submit", values, data);
|
|
5222
5275
|
};
|
|
5223
5276
|
const errorHandler = (error) => {
|
|
5224
5277
|
tMagicMessage.error(error.message);
|
|
5225
5278
|
};
|
|
5226
|
-
const formBox =
|
|
5279
|
+
const formBox = useTemplateRef("formBox");
|
|
5227
5280
|
const changedValue = ref();
|
|
5228
5281
|
const changeHandler = (values) => {
|
|
5229
5282
|
changedValue.value = values;
|
|
@@ -5239,7 +5292,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5239
5292
|
type: "warning",
|
|
5240
5293
|
distinguishCancelAndClose: true
|
|
5241
5294
|
}).then(() => {
|
|
5242
|
-
changedValue.value && submitForm(changedValue.value);
|
|
5295
|
+
changedValue.value && submitForm(changedValue.value, { changeRecords: formBox.value?.form?.changeRecords });
|
|
5243
5296
|
done();
|
|
5244
5297
|
}).catch((action) => {
|
|
5245
5298
|
done(action === "cancel");
|
|
@@ -5261,7 +5314,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5261
5314
|
});
|
|
5262
5315
|
return (_ctx, _cache) => {
|
|
5263
5316
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
5264
|
-
createVNode(_sfc_main$
|
|
5317
|
+
createVNode(_sfc_main$R, {
|
|
5265
5318
|
visible: boxVisible.value,
|
|
5266
5319
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => boxVisible.value = $event),
|
|
5267
5320
|
width: width.value,
|
|
@@ -5338,8 +5391,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5338
5391
|
])
|
|
5339
5392
|
]),
|
|
5340
5393
|
default: withCtx(() => [
|
|
5341
|
-
createElementVNode("div", _hoisted_1$
|
|
5342
|
-
createElementVNode("div", _hoisted_2$
|
|
5394
|
+
createElementVNode("div", _hoisted_1$r, [
|
|
5395
|
+
createElementVNode("div", _hoisted_2$f, [
|
|
5343
5396
|
createVNode(unref(TMagicTag), {
|
|
5344
5397
|
size: "small",
|
|
5345
5398
|
type: "info"
|
|
@@ -5362,14 +5415,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5362
5415
|
})
|
|
5363
5416
|
])
|
|
5364
5417
|
]),
|
|
5365
|
-
difVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
5418
|
+
difVisible.value ? (openBlock(), createBlock(_sfc_main$Y, {
|
|
5366
5419
|
key: 0,
|
|
5367
5420
|
ref_key: "magicVsEditor",
|
|
5368
5421
|
ref: magicVsEditor,
|
|
5369
5422
|
type: "diff",
|
|
5370
5423
|
language: "json",
|
|
5371
5424
|
initValues: _ctx.content.content,
|
|
5372
|
-
modifiedValues: formBox
|
|
5425
|
+
modifiedValues: unref(formBox)?.form?.values.content,
|
|
5373
5426
|
style: normalizeStyle(`height: ${unref(windowRect).height - 150}px`)
|
|
5374
5427
|
}, null, 8, ["initValues", "modifiedValues", "style"])) : createCommentVNode("", true)
|
|
5375
5428
|
]),
|
|
@@ -5381,9 +5434,9 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5381
5434
|
}
|
|
5382
5435
|
});
|
|
5383
5436
|
|
|
5384
|
-
const _hoisted_1$
|
|
5385
|
-
const _hoisted_2$
|
|
5386
|
-
const _sfc_main$
|
|
5437
|
+
const _hoisted_1$q = { class: "m-editor-data-source-methods" };
|
|
5438
|
+
const _hoisted_2$e = { class: "m-editor-data-source-methods-footer" };
|
|
5439
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
5387
5440
|
...{
|
|
5388
5441
|
name: "MFieldsDataSourceMethods"
|
|
5389
5442
|
},
|
|
@@ -5403,7 +5456,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5403
5456
|
setup(__props, { emit: __emit }) {
|
|
5404
5457
|
const props = __props;
|
|
5405
5458
|
const emit = __emit;
|
|
5406
|
-
const
|
|
5459
|
+
const codeConfig = ref();
|
|
5460
|
+
const codeBlockEditor = useTemplateRef("codeBlockEditor");
|
|
5461
|
+
let editIndex = -1;
|
|
5407
5462
|
const methodColumns = [
|
|
5408
5463
|
{
|
|
5409
5464
|
label: "名称",
|
|
@@ -5428,16 +5483,29 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5428
5483
|
actions: [
|
|
5429
5484
|
{
|
|
5430
5485
|
text: "编辑",
|
|
5431
|
-
handler: (
|
|
5432
|
-
|
|
5433
|
-
|
|
5486
|
+
handler: (method, index) => {
|
|
5487
|
+
let codeContent = method.content || `({ params, dataSource, app }) => {
|
|
5488
|
+
// place your code here
|
|
5489
|
+
}`;
|
|
5490
|
+
if (typeof codeContent !== "string") {
|
|
5491
|
+
codeContent = codeContent.toString();
|
|
5492
|
+
}
|
|
5493
|
+
codeConfig.value = {
|
|
5494
|
+
...cloneDeep(method),
|
|
5495
|
+
content: codeContent
|
|
5496
|
+
};
|
|
5497
|
+
editIndex = index;
|
|
5498
|
+
nextTick(() => {
|
|
5499
|
+
codeBlockEditor.value?.show();
|
|
5500
|
+
});
|
|
5434
5501
|
}
|
|
5435
5502
|
},
|
|
5436
5503
|
{
|
|
5437
5504
|
text: "删除",
|
|
5438
5505
|
buttonType: "danger",
|
|
5439
|
-
handler: (row) => {
|
|
5440
|
-
|
|
5506
|
+
handler: async (row, index) => {
|
|
5507
|
+
await tMagicMessageBox.confirm(`确定删除${row.name}?`, "提示");
|
|
5508
|
+
props.model[props.name].splice(index, 1);
|
|
5441
5509
|
emit("change", props.model[props.name]);
|
|
5442
5510
|
}
|
|
5443
5511
|
}
|
|
@@ -5445,20 +5513,56 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5445
5513
|
}
|
|
5446
5514
|
];
|
|
5447
5515
|
const createCodeHandler = () => {
|
|
5448
|
-
|
|
5449
|
-
|
|
5516
|
+
codeConfig.value = {
|
|
5517
|
+
name: "",
|
|
5518
|
+
content: `({ params, dataSource, app, flowState }) => {
|
|
5519
|
+
// place your code here
|
|
5520
|
+
}`,
|
|
5521
|
+
params: []
|
|
5522
|
+
};
|
|
5523
|
+
editIndex = -1;
|
|
5524
|
+
nextTick(() => {
|
|
5525
|
+
codeBlockEditor.value?.show();
|
|
5526
|
+
});
|
|
5450
5527
|
};
|
|
5451
|
-
const submitCodeHandler = (
|
|
5452
|
-
|
|
5453
|
-
|
|
5528
|
+
const submitCodeHandler = (value, data) => {
|
|
5529
|
+
if (value.content) {
|
|
5530
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
5531
|
+
if (typeof value.content === "string") {
|
|
5532
|
+
value.content = parseDSL(value.content);
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
if (editIndex > -1) {
|
|
5536
|
+
emit("change", value, {
|
|
5537
|
+
modifyKey: editIndex,
|
|
5538
|
+
changeRecords: (data.changeRecords || []).map((item) => ({
|
|
5539
|
+
propPath: `${props.prop}.${editIndex}.${item.propPath}`,
|
|
5540
|
+
value: item.value
|
|
5541
|
+
}))
|
|
5542
|
+
});
|
|
5543
|
+
} else {
|
|
5544
|
+
const modifyKey = props.model[props.name].length;
|
|
5545
|
+
emit("change", value, {
|
|
5546
|
+
modifyKey,
|
|
5547
|
+
changeRecords: [
|
|
5548
|
+
{
|
|
5549
|
+
propPath: `${props.prop}.${modifyKey}`,
|
|
5550
|
+
value
|
|
5551
|
+
}
|
|
5552
|
+
]
|
|
5553
|
+
});
|
|
5554
|
+
}
|
|
5555
|
+
editIndex = -1;
|
|
5556
|
+
codeConfig.value = void 0;
|
|
5557
|
+
codeBlockEditor.value?.hide();
|
|
5454
5558
|
};
|
|
5455
5559
|
return (_ctx, _cache) => {
|
|
5456
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5560
|
+
return openBlock(), createElementBlock("div", _hoisted_1$q, [
|
|
5457
5561
|
createVNode(unref(MagicTable), {
|
|
5458
5562
|
data: _ctx.model[_ctx.name],
|
|
5459
5563
|
columns: methodColumns
|
|
5460
5564
|
}, null, 8, ["data"]),
|
|
5461
|
-
createElementVNode("div", _hoisted_2$
|
|
5565
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
5462
5566
|
createVNode(unref(TMagicButton), {
|
|
5463
5567
|
size: "small",
|
|
5464
5568
|
type: "primary",
|
|
@@ -5472,12 +5576,12 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5472
5576
|
_: 1
|
|
5473
5577
|
}, 8, ["disabled"])
|
|
5474
5578
|
]),
|
|
5475
|
-
|
|
5579
|
+
codeConfig.value ? (openBlock(), createBlock(_sfc_main$M, {
|
|
5476
5580
|
key: 0,
|
|
5477
5581
|
ref_key: "codeBlockEditor",
|
|
5478
5582
|
ref: codeBlockEditor,
|
|
5479
5583
|
disabled: _ctx.disabled,
|
|
5480
|
-
content:
|
|
5584
|
+
content: codeConfig.value,
|
|
5481
5585
|
"is-data-source": true,
|
|
5482
5586
|
"data-source-type": _ctx.model.type,
|
|
5483
5587
|
onSubmit: submitCodeHandler
|
|
@@ -5487,9 +5591,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5487
5591
|
}
|
|
5488
5592
|
});
|
|
5489
5593
|
|
|
5490
|
-
const _hoisted_1$
|
|
5491
|
-
const _hoisted_2$
|
|
5492
|
-
const _sfc_main$
|
|
5594
|
+
const _hoisted_1$p = { class: "m-fields-data-source-method-select" };
|
|
5595
|
+
const _hoisted_2$d = { class: "data-source-method-select-container" };
|
|
5596
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
5493
5597
|
...{
|
|
5494
5598
|
name: "MFieldsDataSourceMethodSelect"
|
|
5495
5599
|
},
|
|
@@ -5575,8 +5679,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5575
5679
|
eventBus?.emit("edit-data-source", id);
|
|
5576
5680
|
};
|
|
5577
5681
|
return (_ctx, _cache) => {
|
|
5578
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5579
|
-
createElementVNode("div", _hoisted_2$
|
|
5682
|
+
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
5683
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
5580
5684
|
createVNode(unref(MContainer), {
|
|
5581
5685
|
class: "select",
|
|
5582
5686
|
config: cascaderConfig.value,
|
|
@@ -5595,7 +5699,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5595
5699
|
onClick: editCodeHandler
|
|
5596
5700
|
}, {
|
|
5597
5701
|
default: withCtx(() => [
|
|
5598
|
-
createVNode(_sfc_main$
|
|
5702
|
+
createVNode(_sfc_main$Z, {
|
|
5599
5703
|
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
5600
5704
|
}, null, 8, ["icon"])
|
|
5601
5705
|
]),
|
|
@@ -5605,7 +5709,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5605
5709
|
_: 1
|
|
5606
5710
|
}, 8, ["content"])) : createCommentVNode("", true)
|
|
5607
5711
|
]),
|
|
5608
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
5712
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$U, {
|
|
5609
5713
|
key: 0,
|
|
5610
5714
|
name: "params",
|
|
5611
5715
|
model: _ctx.model,
|
|
@@ -5619,9 +5723,9 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5619
5723
|
}
|
|
5620
5724
|
});
|
|
5621
5725
|
|
|
5622
|
-
const _hoisted_1$
|
|
5623
|
-
const _hoisted_2$
|
|
5624
|
-
const _sfc_main$
|
|
5726
|
+
const _hoisted_1$o = { class: "m-editor-data-source-fields" };
|
|
5727
|
+
const _hoisted_2$c = { class: "m-editor-data-source-fields-footer" };
|
|
5728
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
5625
5729
|
...{
|
|
5626
5730
|
name: "MFieldsDataSourceMocks"
|
|
5627
5731
|
},
|
|
@@ -5710,7 +5814,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5710
5814
|
const columns = [
|
|
5711
5815
|
{
|
|
5712
5816
|
type: "expand",
|
|
5713
|
-
component: _sfc_main$
|
|
5817
|
+
component: _sfc_main$Y,
|
|
5714
5818
|
props: (row) => ({
|
|
5715
5819
|
initValues: row.data,
|
|
5716
5820
|
language: "json",
|
|
@@ -5825,12 +5929,12 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5825
5929
|
const parentFloating = inject("parentFloating", ref(null));
|
|
5826
5930
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5827
5931
|
return (_ctx, _cache) => {
|
|
5828
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5932
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
5829
5933
|
createVNode(unref(MagicTable), {
|
|
5830
5934
|
data: _ctx.model[_ctx.name],
|
|
5831
5935
|
columns
|
|
5832
5936
|
}, null, 8, ["data"]),
|
|
5833
|
-
createElementVNode("div", _hoisted_2$
|
|
5937
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
5834
5938
|
createVNode(unref(TMagicButton), {
|
|
5835
5939
|
size: "small",
|
|
5836
5940
|
type: "primary",
|
|
@@ -5844,7 +5948,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5844
5948
|
_: 1
|
|
5845
5949
|
}, 8, ["disabled"])
|
|
5846
5950
|
]),
|
|
5847
|
-
createVNode(_sfc_main$
|
|
5951
|
+
createVNode(_sfc_main$R, {
|
|
5848
5952
|
visible: addDialogVisible.value,
|
|
5849
5953
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
5850
5954
|
width: width.value,
|
|
@@ -5856,7 +5960,6 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5856
5960
|
}, {
|
|
5857
5961
|
body: withCtx(() => [
|
|
5858
5962
|
createVNode(unref(MFormBox), {
|
|
5859
|
-
ref: "addDialog",
|
|
5860
5963
|
"label-width": "120px",
|
|
5861
5964
|
config: formConfig,
|
|
5862
5965
|
values: formValues.value,
|
|
@@ -5872,8 +5975,8 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5872
5975
|
}
|
|
5873
5976
|
});
|
|
5874
5977
|
|
|
5875
|
-
const _hoisted_1$
|
|
5876
|
-
const _sfc_main$
|
|
5978
|
+
const _hoisted_1$n = { class: "m-fields-data-source-select" };
|
|
5979
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
5877
5980
|
...{
|
|
5878
5981
|
name: "MFieldsDataSourceSelect"
|
|
5879
5982
|
},
|
|
@@ -5930,7 +6033,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5930
6033
|
eventBus?.emit("edit-data-source", id);
|
|
5931
6034
|
};
|
|
5932
6035
|
return (_ctx, _cache) => {
|
|
5933
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6036
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
5934
6037
|
createVNode(unref(MSelect), {
|
|
5935
6038
|
model: _ctx.model,
|
|
5936
6039
|
name: _ctx.name,
|
|
@@ -5952,7 +6055,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5952
6055
|
onClick: editHandler
|
|
5953
6056
|
}, {
|
|
5954
6057
|
default: withCtx(() => [
|
|
5955
|
-
createVNode(_sfc_main$
|
|
6058
|
+
createVNode(_sfc_main$Z, {
|
|
5956
6059
|
icon: !notEditable.value ? unref(Edit) : unref(View)
|
|
5957
6060
|
}, null, 8, ["icon"])
|
|
5958
6061
|
]),
|
|
@@ -5966,7 +6069,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5966
6069
|
}
|
|
5967
6070
|
});
|
|
5968
6071
|
|
|
5969
|
-
const _sfc_main$
|
|
6072
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
5970
6073
|
...{
|
|
5971
6074
|
name: "m-fields-display-conds"
|
|
5972
6075
|
},
|
|
@@ -6075,8 +6178,11 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
6075
6178
|
}
|
|
6076
6179
|
]
|
|
6077
6180
|
}));
|
|
6078
|
-
const changeHandler = (v) => {
|
|
6079
|
-
|
|
6181
|
+
const changeHandler = (v, eventData) => {
|
|
6182
|
+
if (!Array.isArray(props.model[props.name])) {
|
|
6183
|
+
props.model[props.name] = [];
|
|
6184
|
+
}
|
|
6185
|
+
emit("change", v, eventData);
|
|
6080
6186
|
};
|
|
6081
6187
|
return (_ctx, _cache) => {
|
|
6082
6188
|
return openBlock(), createBlock(unref(MGroupList), {
|
|
@@ -6094,12 +6200,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
6094
6200
|
}
|
|
6095
6201
|
});
|
|
6096
6202
|
|
|
6097
|
-
const _hoisted_1$
|
|
6098
|
-
const _hoisted_2$
|
|
6203
|
+
const _hoisted_1$m = { class: "m-fields-event-select" };
|
|
6204
|
+
const _hoisted_2$b = {
|
|
6099
6205
|
key: 1,
|
|
6100
6206
|
class: "fullWidth"
|
|
6101
6207
|
};
|
|
6102
|
-
const _sfc_main$
|
|
6208
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
6103
6209
|
...{
|
|
6104
6210
|
name: "MFieldsEventSelect"
|
|
6105
6211
|
},
|
|
@@ -6147,7 +6253,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6147
6253
|
if (pageFragment) {
|
|
6148
6254
|
events = [
|
|
6149
6255
|
{
|
|
6150
|
-
label: pageFragment.name || "
|
|
6256
|
+
label: pageFragment.name || "页面片容器",
|
|
6151
6257
|
value: pageFragment.id,
|
|
6152
6258
|
children: events
|
|
6153
6259
|
}
|
|
@@ -6360,30 +6466,31 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6360
6466
|
if (!props.model[props.name]) {
|
|
6361
6467
|
props.model[props.name] = [];
|
|
6362
6468
|
}
|
|
6363
|
-
|
|
6364
|
-
|
|
6469
|
+
emit("change", defaultEvent, {
|
|
6470
|
+
modifyKey: props.model[props.name].length
|
|
6471
|
+
});
|
|
6365
6472
|
};
|
|
6366
6473
|
const removeEvent = (index) => {
|
|
6367
6474
|
if (!props.name) return;
|
|
6368
6475
|
props.model[props.name].splice(index, 1);
|
|
6369
|
-
|
|
6476
|
+
emit("change", props.model[props.name]);
|
|
6370
6477
|
};
|
|
6371
|
-
const
|
|
6372
|
-
emit("change", props.model);
|
|
6478
|
+
const eventNameChangeHandler = (v, eventData) => {
|
|
6479
|
+
emit("change", props.model[props.name], eventData);
|
|
6373
6480
|
};
|
|
6481
|
+
const onChangeHandler = (v, eventData) => emit("change", props.model[props.name], eventData);
|
|
6374
6482
|
return (_ctx, _cache) => {
|
|
6375
6483
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
6376
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6484
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
6377
6485
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
6378
6486
|
key: 0,
|
|
6379
|
-
ref: "eventForm",
|
|
6380
6487
|
name: "events",
|
|
6381
6488
|
size: _ctx.size,
|
|
6382
6489
|
disabled: _ctx.disabled,
|
|
6383
6490
|
model: _ctx.model,
|
|
6384
6491
|
config: tableConfig.value,
|
|
6385
6492
|
onChange: onChangeHandler
|
|
6386
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6493
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$b, [
|
|
6387
6494
|
createVNode(unref(TMagicButton), {
|
|
6388
6495
|
class: "create-button",
|
|
6389
6496
|
type: "primary",
|
|
@@ -6401,6 +6508,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6401
6508
|
key: index,
|
|
6402
6509
|
disabled: _ctx.disabled,
|
|
6403
6510
|
size: _ctx.size,
|
|
6511
|
+
prop: `${_ctx.prop}.${index}`,
|
|
6404
6512
|
config: actionsConfig.value,
|
|
6405
6513
|
model: cardItem,
|
|
6406
6514
|
"label-width": _ctx.config.labelWidth || "100px",
|
|
@@ -6413,8 +6521,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6413
6521
|
model: cardItem,
|
|
6414
6522
|
disabled: _ctx.disabled,
|
|
6415
6523
|
size: _ctx.size,
|
|
6416
|
-
|
|
6417
|
-
|
|
6524
|
+
prop: `${_ctx.prop}.${index}`,
|
|
6525
|
+
onChange: eventNameChangeHandler
|
|
6526
|
+
}, null, 8, ["config", "model", "disabled", "size", "prop"]),
|
|
6418
6527
|
createVNode(unref(TMagicButton), {
|
|
6419
6528
|
style: { "color": "#f56c6c" },
|
|
6420
6529
|
link: "",
|
|
@@ -6425,7 +6534,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6425
6534
|
}, null, 8, ["icon", "disabled", "size", "onClick"])
|
|
6426
6535
|
]),
|
|
6427
6536
|
_: 2
|
|
6428
|
-
}, 1032, ["disabled", "size", "config", "model", "label-width"]);
|
|
6537
|
+
}, 1032, ["disabled", "size", "prop", "config", "model", "label-width"]);
|
|
6429
6538
|
}), 128))
|
|
6430
6539
|
]))
|
|
6431
6540
|
]);
|
|
@@ -6433,29 +6542,29 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6433
6542
|
}
|
|
6434
6543
|
});
|
|
6435
6544
|
|
|
6436
|
-
const _hoisted_1$
|
|
6545
|
+
const _hoisted_1$l = {
|
|
6437
6546
|
viewBox: "0 0 32 32",
|
|
6438
6547
|
version: "1.1",
|
|
6439
6548
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6440
6549
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
6441
6550
|
};
|
|
6442
|
-
const _sfc_main$
|
|
6551
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
6443
6552
|
...{
|
|
6444
6553
|
name: "MEditorCodeIcon"
|
|
6445
6554
|
},
|
|
6446
6555
|
__name: "CodeIcon",
|
|
6447
6556
|
setup(__props) {
|
|
6448
6557
|
return (_ctx, _cache) => {
|
|
6449
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
6558
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$l, _cache[0] || (_cache[0] = [
|
|
6450
6559
|
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)
|
|
6451
6560
|
]));
|
|
6452
6561
|
};
|
|
6453
6562
|
}
|
|
6454
6563
|
});
|
|
6455
6564
|
|
|
6456
|
-
const _hoisted_1$
|
|
6457
|
-
const _hoisted_2$
|
|
6458
|
-
const _sfc_main$
|
|
6565
|
+
const _hoisted_1$k = { class: "m-fields-key-value" };
|
|
6566
|
+
const _hoisted_2$a = { key: 0 };
|
|
6567
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
6459
6568
|
...{
|
|
6460
6569
|
name: "MFieldsKeyValue"
|
|
6461
6570
|
},
|
|
@@ -6478,14 +6587,18 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6478
6587
|
const records = ref([]);
|
|
6479
6588
|
const showCode = ref(false);
|
|
6480
6589
|
watchEffect(() => {
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6590
|
+
if (typeof props.model[props.name] === "function") {
|
|
6591
|
+
showCode.value = true;
|
|
6592
|
+
} else {
|
|
6593
|
+
const initValues = Object.entries(props.model[props.name] || {});
|
|
6594
|
+
for (const [, value] of initValues) {
|
|
6595
|
+
if (typeof value !== "string") {
|
|
6596
|
+
showCode.value = true;
|
|
6597
|
+
break;
|
|
6598
|
+
}
|
|
6486
6599
|
}
|
|
6600
|
+
records.value = initValues;
|
|
6487
6601
|
}
|
|
6488
|
-
records.value = initValues;
|
|
6489
6602
|
});
|
|
6490
6603
|
const getValue = () => {
|
|
6491
6604
|
const record = {};
|
|
@@ -6513,8 +6626,8 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6513
6626
|
emit("change", v);
|
|
6514
6627
|
};
|
|
6515
6628
|
return (_ctx, _cache) => {
|
|
6516
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6517
|
-
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6629
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
6630
|
+
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
|
|
6518
6631
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
6519
6632
|
return openBlock(), createElementBlock("div", {
|
|
6520
6633
|
class: "m-fields-key-value-item",
|
|
@@ -6528,7 +6641,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6528
6641
|
size: _ctx.size,
|
|
6529
6642
|
onChange: keyChangeHandler
|
|
6530
6643
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
6531
|
-
_cache[1] || (_cache[1] = createElementVNode("span", { class: "m-
|
|
6644
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "m-fields-key-value-delimiter" }, ":", -1)),
|
|
6532
6645
|
createVNode(unref(TMagicInput), {
|
|
6533
6646
|
placeholder: "value",
|
|
6534
6647
|
modelValue: records.value[index][1],
|
|
@@ -6538,7 +6651,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6538
6651
|
onChange: valueChangeHandler
|
|
6539
6652
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
6540
6653
|
createVNode(unref(TMagicButton), {
|
|
6541
|
-
class: "m-
|
|
6654
|
+
class: "m-fields-key-value-delete",
|
|
6542
6655
|
type: "danger",
|
|
6543
6656
|
size: _ctx.size,
|
|
6544
6657
|
disabled: _ctx.disabled,
|
|
@@ -6563,11 +6676,11 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6563
6676
|
_: 1
|
|
6564
6677
|
}, 8, ["size", "disabled", "icon"])
|
|
6565
6678
|
])) : createCommentVNode("", true),
|
|
6566
|
-
_ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$
|
|
6679
|
+
_ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$Y, {
|
|
6567
6680
|
key: 1,
|
|
6568
6681
|
height: "200px",
|
|
6569
6682
|
"init-values": _ctx.model[_ctx.name],
|
|
6570
|
-
language: "
|
|
6683
|
+
language: "javascript",
|
|
6571
6684
|
options: {
|
|
6572
6685
|
readOnly: _ctx.disabled
|
|
6573
6686
|
},
|
|
@@ -6579,7 +6692,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6579
6692
|
size: "default",
|
|
6580
6693
|
disabled: _ctx.disabled,
|
|
6581
6694
|
link: "",
|
|
6582
|
-
icon: _sfc_main$
|
|
6695
|
+
icon: _sfc_main$F,
|
|
6583
6696
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
6584
6697
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
6585
6698
|
]);
|
|
@@ -6587,9 +6700,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6587
6700
|
}
|
|
6588
6701
|
});
|
|
6589
6702
|
|
|
6590
|
-
const _hoisted_1$
|
|
6591
|
-
const _hoisted_2$
|
|
6592
|
-
const _sfc_main$
|
|
6703
|
+
const _hoisted_1$j = { class: "m-fields-page-fragment-select" };
|
|
6704
|
+
const _hoisted_2$9 = { class: "page-fragment-select-container" };
|
|
6705
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
6593
6706
|
...{
|
|
6594
6707
|
name: "MFieldsPageFragmentSelect"
|
|
6595
6708
|
},
|
|
@@ -6635,8 +6748,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6635
6748
|
};
|
|
6636
6749
|
return (_ctx, _cache) => {
|
|
6637
6750
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
6638
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6639
|
-
createElementVNode("div", _hoisted_2$
|
|
6751
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
6752
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
6640
6753
|
createVNode(_component_m_form_container, {
|
|
6641
6754
|
class: "select",
|
|
6642
6755
|
config: selectConfig,
|
|
@@ -6644,7 +6757,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6644
6757
|
size: _ctx.size,
|
|
6645
6758
|
onChange: changeHandler
|
|
6646
6759
|
}, null, 8, ["model", "size"]),
|
|
6647
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
6760
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$Z, {
|
|
6648
6761
|
key: 0,
|
|
6649
6762
|
class: "icon",
|
|
6650
6763
|
icon: unref(Edit),
|
|
@@ -6656,12 +6769,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6656
6769
|
}
|
|
6657
6770
|
});
|
|
6658
6771
|
|
|
6659
|
-
const _hoisted_1$
|
|
6772
|
+
const _hoisted_1$i = {
|
|
6660
6773
|
key: 1,
|
|
6661
6774
|
class: "m-fields-ui-select",
|
|
6662
6775
|
style: { "display": "flex" }
|
|
6663
6776
|
};
|
|
6664
|
-
const _sfc_main$
|
|
6777
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
6665
6778
|
...{
|
|
6666
6779
|
name: "MFieldsUISelect"
|
|
6667
6780
|
},
|
|
@@ -6692,7 +6805,10 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6692
6805
|
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
6693
6806
|
};
|
|
6694
6807
|
const clickHandler = ({ detail }) => {
|
|
6695
|
-
|
|
6808
|
+
let { id } = detail;
|
|
6809
|
+
if (detail.nodeType) {
|
|
6810
|
+
id = getIdFromEl()(detail) || id;
|
|
6811
|
+
}
|
|
6696
6812
|
if (id) {
|
|
6697
6813
|
props.model[props.name] = id;
|
|
6698
6814
|
emit("change", id);
|
|
@@ -6756,7 +6872,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6756
6872
|
])),
|
|
6757
6873
|
_: 1
|
|
6758
6874
|
}, 8, ["icon", "disabled", "size"])
|
|
6759
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6875
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
6760
6876
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6761
6877
|
createVNode(unref(TMagicTooltip), {
|
|
6762
6878
|
content: "清除",
|
|
@@ -6823,7 +6939,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6823
6939
|
}
|
|
6824
6940
|
});
|
|
6825
6941
|
|
|
6826
|
-
const _sfc_main$
|
|
6942
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
6827
6943
|
...{
|
|
6828
6944
|
name: "MEditorResizer"
|
|
6829
6945
|
},
|
|
@@ -6831,13 +6947,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
6831
6947
|
emits: ["change"],
|
|
6832
6948
|
setup(__props, { emit: __emit }) {
|
|
6833
6949
|
const emit = __emit;
|
|
6834
|
-
const target =
|
|
6835
|
-
const {
|
|
6950
|
+
const target = useTemplateRef("target");
|
|
6951
|
+
const { isDragging } = useGetSo(target, emit);
|
|
6836
6952
|
return (_ctx, _cache) => {
|
|
6837
6953
|
return openBlock(), createElementBlock("span", {
|
|
6838
6954
|
ref_key: "target",
|
|
6839
6955
|
ref: target,
|
|
6840
|
-
class: normalizeClass(["m-editor-resizer", { "m-editor-resizer-
|
|
6956
|
+
class: normalizeClass(["m-editor-resizer", { "m-editor-resizer-dragging": unref(isDragging) }])
|
|
6841
6957
|
}, [
|
|
6842
6958
|
renderSlot(_ctx.$slots, "default")
|
|
6843
6959
|
], 2);
|
|
@@ -6845,7 +6961,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
6845
6961
|
}
|
|
6846
6962
|
});
|
|
6847
6963
|
|
|
6848
|
-
const _sfc_main$
|
|
6964
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
6849
6965
|
...{
|
|
6850
6966
|
name: "MEditorSplitView"
|
|
6851
6967
|
},
|
|
@@ -6865,7 +6981,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6865
6981
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6866
6982
|
const emit = __emit;
|
|
6867
6983
|
const props = __props;
|
|
6868
|
-
const el =
|
|
6984
|
+
const el = useTemplateRef("el");
|
|
6869
6985
|
const hasLeft = computed(() => typeof props.left !== "undefined");
|
|
6870
6986
|
const hasRight = computed(() => typeof props.right !== "undefined");
|
|
6871
6987
|
const center = ref(0);
|
|
@@ -6983,7 +7099,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6983
7099
|
}, [
|
|
6984
7100
|
renderSlot(_ctx.$slots, "left")
|
|
6985
7101
|
], 6),
|
|
6986
|
-
createVNode(_sfc_main$
|
|
7102
|
+
createVNode(_sfc_main$B, { onChange: changeLeft })
|
|
6987
7103
|
], 64)) : createCommentVNode("", true),
|
|
6988
7104
|
createElementVNode("div", {
|
|
6989
7105
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6992,7 +7108,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6992
7108
|
renderSlot(_ctx.$slots, "center")
|
|
6993
7109
|
], 6),
|
|
6994
7110
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6995
|
-
createVNode(_sfc_main$
|
|
7111
|
+
createVNode(_sfc_main$B, { onChange: changeRight }),
|
|
6996
7112
|
createElementVNode("div", {
|
|
6997
7113
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6998
7114
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -7005,12 +7121,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
7005
7121
|
}
|
|
7006
7122
|
});
|
|
7007
7123
|
|
|
7008
|
-
const _hoisted_1$
|
|
7124
|
+
const _hoisted_1$h = {
|
|
7009
7125
|
key: 1,
|
|
7010
7126
|
class: "menu-item-text"
|
|
7011
7127
|
};
|
|
7012
|
-
const _hoisted_2$
|
|
7013
|
-
const _sfc_main$
|
|
7128
|
+
const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
|
|
7129
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
7014
7130
|
...{
|
|
7015
7131
|
name: "MEditorToolButton"
|
|
7016
7132
|
},
|
|
@@ -7066,7 +7182,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7066
7182
|
};
|
|
7067
7183
|
const mouseupHandler = (item, event) => {
|
|
7068
7184
|
if (props.eventType !== "mouseup") return;
|
|
7069
|
-
if (item.type === "button") {
|
|
7185
|
+
if (item.type === "button" && event.button === 0) {
|
|
7070
7186
|
buttonHandler(item, event);
|
|
7071
7187
|
}
|
|
7072
7188
|
};
|
|
@@ -7081,7 +7197,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7081
7197
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
7082
7198
|
key: 0,
|
|
7083
7199
|
direction: _ctx.data.direction || "vertical"
|
|
7084
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7200
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$h, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
7085
7201
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
7086
7202
|
key: 0,
|
|
7087
7203
|
effect: "dark",
|
|
@@ -7095,7 +7211,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7095
7211
|
disabled: disabled.value
|
|
7096
7212
|
}, {
|
|
7097
7213
|
default: withCtx(() => [
|
|
7098
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
7214
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$Z, {
|
|
7099
7215
|
key: 0,
|
|
7100
7216
|
icon: _ctx.data.icon
|
|
7101
7217
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -7113,7 +7229,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7113
7229
|
title: _ctx.data.text
|
|
7114
7230
|
}, {
|
|
7115
7231
|
default: withCtx(() => [
|
|
7116
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
7232
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$Z, {
|
|
7117
7233
|
key: 0,
|
|
7118
7234
|
icon: _ctx.data.icon
|
|
7119
7235
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -7146,7 +7262,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7146
7262
|
})) : createCommentVNode("", true)
|
|
7147
7263
|
]),
|
|
7148
7264
|
default: withCtx(() => [
|
|
7149
|
-
createElementVNode("span", _hoisted_2$
|
|
7265
|
+
createElementVNode("span", _hoisted_2$8, [
|
|
7150
7266
|
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
7151
7267
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
7152
7268
|
default: withCtx(() => [
|
|
@@ -7163,69 +7279,90 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7163
7279
|
}
|
|
7164
7280
|
});
|
|
7165
7281
|
|
|
7166
|
-
const _hoisted_1$
|
|
7282
|
+
const _hoisted_1$g = {
|
|
7283
|
+
key: 0,
|
|
7284
|
+
id: "m-editor-page-bar-add-icon",
|
|
7285
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
7286
|
+
};
|
|
7287
|
+
const _hoisted_2$7 = {
|
|
7167
7288
|
key: 1,
|
|
7168
7289
|
style: { "width": "21px" }
|
|
7169
7290
|
};
|
|
7170
|
-
const _sfc_main$
|
|
7291
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
7171
7292
|
...{
|
|
7172
7293
|
name: "MEditorPageBarAddButton"
|
|
7173
7294
|
},
|
|
7174
7295
|
__name: "AddButton",
|
|
7175
|
-
props: {
|
|
7176
|
-
type: {}
|
|
7177
|
-
},
|
|
7178
7296
|
setup(__props) {
|
|
7179
|
-
const props = __props;
|
|
7180
7297
|
const services = inject("services");
|
|
7181
7298
|
const uiService = services?.uiService;
|
|
7182
7299
|
const editorService = services?.editorService;
|
|
7183
7300
|
const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
|
|
7184
|
-
const addPage = () => {
|
|
7301
|
+
const addPage = (type) => {
|
|
7185
7302
|
if (!editorService) return;
|
|
7186
7303
|
const root = toRaw(editorService.get("root"));
|
|
7187
7304
|
if (!root) throw new Error("root 不能为空");
|
|
7188
7305
|
const pageConfig = {
|
|
7189
|
-
type
|
|
7190
|
-
name: generatePageNameByApp(root,
|
|
7306
|
+
type,
|
|
7307
|
+
name: generatePageNameByApp(root, type),
|
|
7191
7308
|
items: []
|
|
7192
7309
|
};
|
|
7193
7310
|
editorService.add(pageConfig);
|
|
7194
7311
|
};
|
|
7195
7312
|
return (_ctx, _cache) => {
|
|
7196
|
-
return showAddPageButton.value ? (openBlock(), createElementBlock("div",
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7313
|
+
return showAddPageButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
7314
|
+
createVNode(unref(TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
|
|
7315
|
+
reference: withCtx(() => [
|
|
7316
|
+
createVNode(_sfc_main$Z, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
7317
|
+
]),
|
|
7318
|
+
default: withCtx(() => [
|
|
7319
|
+
createVNode(_sfc_main$z, {
|
|
7320
|
+
data: {
|
|
7321
|
+
type: "button",
|
|
7322
|
+
text: "页面",
|
|
7323
|
+
handler: () => {
|
|
7324
|
+
addPage(unref(NodeType).PAGE);
|
|
7325
|
+
}
|
|
7326
|
+
}
|
|
7327
|
+
}, null, 8, ["data"]),
|
|
7328
|
+
createVNode(_sfc_main$z, {
|
|
7329
|
+
data: {
|
|
7330
|
+
type: "button",
|
|
7331
|
+
text: "页面片",
|
|
7332
|
+
handler: () => {
|
|
7333
|
+
addPage(unref(NodeType).PAGE_FRAGMENT);
|
|
7334
|
+
}
|
|
7335
|
+
}
|
|
7336
|
+
}, null, 8, ["data"])
|
|
7337
|
+
]),
|
|
7338
|
+
_: 1
|
|
7339
|
+
})
|
|
7340
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2$7));
|
|
7204
7341
|
};
|
|
7205
7342
|
}
|
|
7206
7343
|
});
|
|
7207
7344
|
|
|
7208
|
-
const _sfc_main$
|
|
7345
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
7209
7346
|
...{
|
|
7210
7347
|
name: "MEditorPageBarScrollContainer"
|
|
7211
7348
|
},
|
|
7212
7349
|
__name: "PageBarScrollContainer",
|
|
7213
7350
|
props: {
|
|
7214
|
-
|
|
7215
|
-
|
|
7351
|
+
pageBarSortOptions: {},
|
|
7352
|
+
length: {}
|
|
7216
7353
|
},
|
|
7217
|
-
setup(__props) {
|
|
7354
|
+
setup(__props, { expose: __expose }) {
|
|
7218
7355
|
const props = __props;
|
|
7219
7356
|
const services = inject("services");
|
|
7220
7357
|
const editorService = services?.editorService;
|
|
7221
7358
|
const uiService = services?.uiService;
|
|
7222
|
-
const itemsContainer =
|
|
7359
|
+
const itemsContainer = useTemplateRef("itemsContainer");
|
|
7223
7360
|
const canScroll = ref(false);
|
|
7224
7361
|
const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
|
|
7225
7362
|
const showPageListButton = computed(() => uiService?.get("showPageListButton"));
|
|
7226
7363
|
const itemsContainerWidth = ref(0);
|
|
7227
7364
|
const setCanScroll = () => {
|
|
7228
|
-
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7365
|
+
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - 37 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7229
7366
|
nextTick(() => {
|
|
7230
7367
|
if (itemsContainer.value) {
|
|
7231
7368
|
canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
|
|
@@ -7235,7 +7372,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7235
7372
|
const resizeObserver = new ResizeObserver(() => {
|
|
7236
7373
|
setCanScroll();
|
|
7237
7374
|
});
|
|
7238
|
-
const pageBar =
|
|
7375
|
+
const pageBar = useTemplateRef("pageBar");
|
|
7239
7376
|
onMounted(() => {
|
|
7240
7377
|
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
7241
7378
|
});
|
|
@@ -7244,38 +7381,43 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7244
7381
|
});
|
|
7245
7382
|
let translateLeft = 0;
|
|
7246
7383
|
const scroll = (type) => {
|
|
7247
|
-
if (!itemsContainer.value) return;
|
|
7384
|
+
if (!itemsContainer.value || !canScroll.value) return;
|
|
7248
7385
|
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
7249
7386
|
if (type === "left") {
|
|
7250
|
-
translateLeft
|
|
7251
|
-
if (translateLeft > 0) {
|
|
7252
|
-
translateLeft = 0;
|
|
7253
|
-
}
|
|
7387
|
+
scrollTo(translateLeft + 200);
|
|
7254
7388
|
} else if (type === "right") {
|
|
7255
|
-
translateLeft
|
|
7256
|
-
if (-translateLeft > maxScrollLeft) {
|
|
7257
|
-
translateLeft = -maxScrollLeft;
|
|
7258
|
-
}
|
|
7389
|
+
scrollTo(translateLeft - 200);
|
|
7259
7390
|
} else if (type === "start") {
|
|
7260
|
-
|
|
7391
|
+
scrollTo(0);
|
|
7261
7392
|
} else if (type === "end") {
|
|
7262
|
-
|
|
7393
|
+
scrollTo(-maxScrollLeft);
|
|
7394
|
+
}
|
|
7395
|
+
};
|
|
7396
|
+
const scrollTo = (value) => {
|
|
7397
|
+
if (!itemsContainer.value || !canScroll.value) return;
|
|
7398
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
7399
|
+
if (value >= 0) {
|
|
7400
|
+
value = 0;
|
|
7401
|
+
}
|
|
7402
|
+
if (-value > maxScrollLeft) {
|
|
7403
|
+
value = -maxScrollLeft;
|
|
7263
7404
|
}
|
|
7405
|
+
translateLeft = value;
|
|
7264
7406
|
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
7265
7407
|
};
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
length,
|
|
7270
|
-
(length2 = 0, preLength = 0) => {
|
|
7408
|
+
watch(
|
|
7409
|
+
() => props.length,
|
|
7410
|
+
(length = 0, preLength = 0) => {
|
|
7271
7411
|
setTimeout(() => {
|
|
7272
7412
|
setCanScroll();
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7413
|
+
nextTick(() => {
|
|
7414
|
+
if (length < preLength || preLength === 0) {
|
|
7415
|
+
scroll("start");
|
|
7416
|
+
} else {
|
|
7417
|
+
scroll("end");
|
|
7418
|
+
}
|
|
7419
|
+
});
|
|
7420
|
+
if (length > 1) {
|
|
7279
7421
|
const el = document.querySelector(".m-editor-page-bar-items");
|
|
7280
7422
|
let beforeDragList = [];
|
|
7281
7423
|
const options = {
|
|
@@ -7311,25 +7453,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7311
7453
|
immediate: true
|
|
7312
7454
|
}
|
|
7313
7455
|
);
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
(
|
|
7319
|
-
|
|
7320
|
-
unWatchPageFragmentLength?.();
|
|
7321
|
-
unWatchPageFragmentLength = null;
|
|
7322
|
-
unWatchPageLength = crateWatchLength(pageLength);
|
|
7323
|
-
} else {
|
|
7324
|
-
unWatchPageLength?.();
|
|
7325
|
-
unWatchPageLength = null;
|
|
7326
|
-
unWatchPageFragmentLength = crateWatchLength(pageFragmentLength);
|
|
7327
|
-
}
|
|
7328
|
-
},
|
|
7329
|
-
{
|
|
7330
|
-
immediate: true
|
|
7456
|
+
__expose({
|
|
7457
|
+
itemsContainerWidth,
|
|
7458
|
+
scroll,
|
|
7459
|
+
scrollTo,
|
|
7460
|
+
getTranslateLeft() {
|
|
7461
|
+
return translateLeft;
|
|
7331
7462
|
}
|
|
7332
|
-
);
|
|
7463
|
+
});
|
|
7333
7464
|
return (_ctx, _cache) => {
|
|
7334
7465
|
return openBlock(), createElementBlock("div", {
|
|
7335
7466
|
class: "m-editor-page-bar",
|
|
@@ -7337,40 +7468,39 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7337
7468
|
ref: pageBar
|
|
7338
7469
|
}, [
|
|
7339
7470
|
renderSlot(_ctx.$slots, "prepend"),
|
|
7340
|
-
|
|
7471
|
+
_ctx.length ? (openBlock(), createElementBlock("div", {
|
|
7341
7472
|
key: 0,
|
|
7342
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
7343
|
-
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
7344
|
-
}, [
|
|
7345
|
-
createVNode(_sfc_main$Y, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
7346
|
-
])) : createCommentVNode("", true),
|
|
7347
|
-
_ctx.type === unref(NodeType).PAGE && pageLength.value || _ctx.type === unref(NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (openBlock(), createElementBlock("div", {
|
|
7348
|
-
key: 1,
|
|
7349
7473
|
class: "m-editor-page-bar-items",
|
|
7350
7474
|
ref_key: "itemsContainer",
|
|
7351
|
-
ref: itemsContainer
|
|
7352
|
-
style: normalizeStyle(`width: ${itemsContainerWidth.value}px`)
|
|
7475
|
+
ref: itemsContainer
|
|
7353
7476
|
}, [
|
|
7354
7477
|
renderSlot(_ctx.$slots, "default")
|
|
7355
|
-
],
|
|
7478
|
+
], 512)) : createCommentVNode("", true),
|
|
7479
|
+
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
7480
|
+
key: 1,
|
|
7481
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-left-icon",
|
|
7482
|
+
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
7483
|
+
}, [
|
|
7484
|
+
createVNode(_sfc_main$Z, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
7485
|
+
])) : createCommentVNode("", true),
|
|
7356
7486
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
7357
7487
|
key: 2,
|
|
7358
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
7488
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-right-icon",
|
|
7359
7489
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
7360
7490
|
}, [
|
|
7361
|
-
createVNode(_sfc_main$
|
|
7491
|
+
createVNode(_sfc_main$Z, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
7362
7492
|
])) : createCommentVNode("", true)
|
|
7363
7493
|
], 512);
|
|
7364
7494
|
};
|
|
7365
7495
|
}
|
|
7366
7496
|
});
|
|
7367
7497
|
|
|
7368
|
-
const _hoisted_1$
|
|
7498
|
+
const _hoisted_1$f = {
|
|
7369
7499
|
key: 0,
|
|
7370
7500
|
id: "m-editor-page-bar-list-icon",
|
|
7371
7501
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
7372
7502
|
};
|
|
7373
|
-
const _sfc_main$
|
|
7503
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
7374
7504
|
...{
|
|
7375
7505
|
name: "MEditorPageList"
|
|
7376
7506
|
},
|
|
@@ -7383,11 +7513,12 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
7383
7513
|
const uiService = services?.uiService;
|
|
7384
7514
|
const editorService = services?.editorService;
|
|
7385
7515
|
const showPageListButton = computed(() => uiService?.get("showPageListButton"));
|
|
7386
|
-
const
|
|
7387
|
-
|
|
7516
|
+
const page = computed(() => editorService?.get("page"));
|
|
7517
|
+
const switchPage = async (id) => {
|
|
7518
|
+
await editorService?.select(id);
|
|
7388
7519
|
};
|
|
7389
7520
|
return (_ctx, _cache) => {
|
|
7390
|
-
return showPageListButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7521
|
+
return showPageListButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
7391
7522
|
createVNode(unref(TMagicPopover), {
|
|
7392
7523
|
"popper-class": "page-bar-popover",
|
|
7393
7524
|
placement: "top",
|
|
@@ -7407,10 +7538,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
7407
7538
|
createElementVNode("div", null, [
|
|
7408
7539
|
renderSlot(_ctx.$slots, "page-list-popover", { list: _ctx.list }, () => [
|
|
7409
7540
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
|
|
7410
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7541
|
+
return openBlock(), createBlock(_sfc_main$z, {
|
|
7411
7542
|
data: {
|
|
7412
7543
|
type: "button",
|
|
7413
7544
|
text: item.devconfig?.tabName || item.name || item.id,
|
|
7545
|
+
className: item.id === page.value?.id ? "active" : "",
|
|
7414
7546
|
handler: () => switchPage(item.id)
|
|
7415
7547
|
},
|
|
7416
7548
|
key: index
|
|
@@ -7426,118 +7558,108 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
7426
7558
|
}
|
|
7427
7559
|
});
|
|
7428
7560
|
|
|
7429
|
-
const
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
},
|
|
7433
|
-
__name: "SwitchTypeButton",
|
|
7561
|
+
const _hoisted_1$e = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
|
|
7562
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
7563
|
+
__name: "Search",
|
|
7434
7564
|
props: {
|
|
7435
|
-
|
|
7565
|
+
"query": {},
|
|
7566
|
+
"queryModifiers": {}
|
|
7436
7567
|
},
|
|
7437
|
-
emits: ["update:
|
|
7568
|
+
emits: /* @__PURE__ */ mergeModels(["search"], ["update:query"]),
|
|
7438
7569
|
setup(__props, { emit: __emit }) {
|
|
7439
|
-
const
|
|
7570
|
+
const emit = __emit;
|
|
7571
|
+
const query = useModel(__props, "query");
|
|
7572
|
+
const formConfig = createForm([
|
|
7440
7573
|
{
|
|
7441
|
-
type:
|
|
7442
|
-
|
|
7574
|
+
type: "checkbox-group",
|
|
7575
|
+
name: "pageType",
|
|
7576
|
+
options: [
|
|
7577
|
+
{
|
|
7578
|
+
value: NodeType.PAGE,
|
|
7579
|
+
text: "页面"
|
|
7580
|
+
},
|
|
7581
|
+
{
|
|
7582
|
+
value: NodeType.PAGE_FRAGMENT,
|
|
7583
|
+
text: "页面片段"
|
|
7584
|
+
}
|
|
7585
|
+
]
|
|
7443
7586
|
},
|
|
7444
7587
|
{
|
|
7445
|
-
|
|
7446
|
-
|
|
7588
|
+
name: "keyword",
|
|
7589
|
+
type: "text",
|
|
7590
|
+
placeholder: "请输入关键字",
|
|
7591
|
+
clearable: true
|
|
7447
7592
|
}
|
|
7448
|
-
];
|
|
7449
|
-
const
|
|
7450
|
-
const
|
|
7451
|
-
|
|
7593
|
+
]);
|
|
7594
|
+
const visible = ref(false);
|
|
7595
|
+
const onFormChange = (values) => {
|
|
7596
|
+
query.value = values;
|
|
7597
|
+
emit("search", values);
|
|
7452
7598
|
};
|
|
7453
7599
|
return (_ctx, _cache) => {
|
|
7454
|
-
return openBlock(), createElementBlock(
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7600
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
7601
|
+
createVNode(_sfc_main$Z, {
|
|
7602
|
+
icon: unref(Search),
|
|
7603
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
|
|
7604
|
+
class: normalizeClass({ "icon-active": visible.value })
|
|
7605
|
+
}, null, 8, ["icon", "class"]),
|
|
7606
|
+
visible.value ? (openBlock(), createBlock(Teleport, {
|
|
7607
|
+
key: 0,
|
|
7608
|
+
to: ".m-editor-page-bar-tabs"
|
|
7609
|
+
}, [
|
|
7610
|
+
query.value ? (openBlock(), createBlock(unref(MForm), {
|
|
7611
|
+
key: 0,
|
|
7612
|
+
class: "m-editor-page-bar-search-panel",
|
|
7613
|
+
inline: true,
|
|
7614
|
+
config: unref(formConfig),
|
|
7615
|
+
"init-values": query.value,
|
|
7616
|
+
"prevent-submit-default": true,
|
|
7617
|
+
onChange: onFormChange
|
|
7618
|
+
}, null, 8, ["config", "init-values"])) : createCommentVNode("", true)
|
|
7619
|
+
])) : createCommentVNode("", true)
|
|
7620
|
+
]);
|
|
7469
7621
|
};
|
|
7470
7622
|
}
|
|
7471
7623
|
});
|
|
7472
7624
|
|
|
7473
|
-
const _hoisted_1$
|
|
7474
|
-
const _hoisted_2$
|
|
7625
|
+
const _hoisted_1$d = { class: "m-editor-page-bar-tabs" };
|
|
7626
|
+
const _hoisted_2$6 = ["data-page-id", "onClick"];
|
|
7475
7627
|
const _hoisted_3$2 = { class: "m-editor-page-bar-title" };
|
|
7476
7628
|
const _hoisted_4$2 = ["title"];
|
|
7477
|
-
const _sfc_main$
|
|
7629
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
7478
7630
|
...{
|
|
7479
7631
|
name: "MEditorPageBar"
|
|
7480
7632
|
},
|
|
7481
7633
|
__name: "PageBar",
|
|
7482
7634
|
props: {
|
|
7483
7635
|
disabledPageFragment: { type: Boolean },
|
|
7484
|
-
pageBarSortOptions: {}
|
|
7636
|
+
pageBarSortOptions: {},
|
|
7637
|
+
filterFunction: { type: Function, default: (page, keyword) => page.name?.includes(keyword) || `${page.id}`.includes(keyword) }
|
|
7485
7638
|
},
|
|
7486
7639
|
setup(__props) {
|
|
7487
|
-
const
|
|
7640
|
+
const props = __props;
|
|
7488
7641
|
const services = inject("services");
|
|
7489
7642
|
const editorService = services?.editorService;
|
|
7490
7643
|
const root = computed(() => editorService?.get("root"));
|
|
7491
7644
|
const page = computed(() => editorService?.get("page"));
|
|
7492
|
-
const
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
const
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
if (!page2) {
|
|
7501
|
-
if (active.value === NodeType.PAGE) {
|
|
7502
|
-
activePage.value = "";
|
|
7503
|
-
}
|
|
7504
|
-
if (active.value === NodeType.PAGE_FRAGMENT) {
|
|
7505
|
-
activePageFragment.value = "";
|
|
7506
|
-
}
|
|
7507
|
-
return;
|
|
7508
|
-
}
|
|
7509
|
-
if (isPage(page2)) {
|
|
7510
|
-
activePage.value = page2?.id;
|
|
7511
|
-
if (active.value !== NodeType.PAGE) {
|
|
7512
|
-
active.value = NodeType.PAGE;
|
|
7513
|
-
}
|
|
7514
|
-
} else if (isPageFragment(page2)) {
|
|
7515
|
-
activePageFragment.value = page2?.id;
|
|
7516
|
-
if (active.value !== NodeType.PAGE_FRAGMENT) {
|
|
7517
|
-
active.value = NodeType.PAGE_FRAGMENT;
|
|
7518
|
-
}
|
|
7519
|
-
}
|
|
7520
|
-
},
|
|
7521
|
-
{
|
|
7522
|
-
immediate: true
|
|
7523
|
-
}
|
|
7524
|
-
);
|
|
7525
|
-
watch(active, (active2) => {
|
|
7526
|
-
if (active2 === NodeType.PAGE) {
|
|
7527
|
-
if (!activePage.value && !pageList.value.length) {
|
|
7528
|
-
editorService?.selectRoot();
|
|
7529
|
-
return;
|
|
7530
|
-
}
|
|
7531
|
-
switchPage(activePage.value);
|
|
7532
|
-
return;
|
|
7645
|
+
const query = ref({
|
|
7646
|
+
pageType: [NodeType.PAGE, NodeType.PAGE_FRAGMENT],
|
|
7647
|
+
keyword: ""
|
|
7648
|
+
});
|
|
7649
|
+
const list = computed(() => {
|
|
7650
|
+
const { pageType, keyword } = query.value;
|
|
7651
|
+
if (pageType.length === 0) {
|
|
7652
|
+
return [];
|
|
7533
7653
|
}
|
|
7534
|
-
|
|
7535
|
-
if (
|
|
7536
|
-
|
|
7537
|
-
|
|
7654
|
+
return (root.value?.items || []).filter((item) => {
|
|
7655
|
+
if (pageType.includes(item.type)) {
|
|
7656
|
+
if (keyword) {
|
|
7657
|
+
return props.filterFunction(item, keyword);
|
|
7658
|
+
}
|
|
7659
|
+
return true;
|
|
7538
7660
|
}
|
|
7539
|
-
|
|
7540
|
-
}
|
|
7661
|
+
return false;
|
|
7662
|
+
});
|
|
7541
7663
|
});
|
|
7542
7664
|
const switchPage = (id) => {
|
|
7543
7665
|
editorService?.select(id);
|
|
@@ -7552,20 +7674,50 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7552
7674
|
const remove = (node) => {
|
|
7553
7675
|
editorService?.remove(node);
|
|
7554
7676
|
};
|
|
7677
|
+
const pageBarScrollContainer = useTemplateRef("pageBarScrollContainer");
|
|
7678
|
+
const pageBarItems = useTemplateRef("pageBarItems");
|
|
7679
|
+
watch(page, (page2) => {
|
|
7680
|
+
if (!page2 || !pageBarScrollContainer.value?.itemsContainerWidth || !pageBarItems.value || pageBarItems.value.length < 2) {
|
|
7681
|
+
return;
|
|
7682
|
+
}
|
|
7683
|
+
const firstItem = pageBarItems.value[0];
|
|
7684
|
+
const lastItem = pageBarItems.value[pageBarItems.value.length - 1];
|
|
7685
|
+
if (page2.id === firstItem.dataset.pageId) {
|
|
7686
|
+
pageBarScrollContainer.value.scroll("start");
|
|
7687
|
+
} else if (page2.id === lastItem.dataset.pageId) {
|
|
7688
|
+
pageBarScrollContainer.value.scroll("end");
|
|
7689
|
+
} else {
|
|
7690
|
+
const pageItem = pageBarItems.value.find((item) => item.dataset.pageId === page2.id);
|
|
7691
|
+
if (!pageItem) {
|
|
7692
|
+
return;
|
|
7693
|
+
}
|
|
7694
|
+
const pageItemRect = pageItem.getBoundingClientRect();
|
|
7695
|
+
const offsetLeft = pageItemRect.left - firstItem.getBoundingClientRect().left;
|
|
7696
|
+
const { itemsContainerWidth } = pageBarScrollContainer.value;
|
|
7697
|
+
const left = itemsContainerWidth - offsetLeft - pageItemRect.width;
|
|
7698
|
+
const translateLeft = pageBarScrollContainer.value.getTranslateLeft();
|
|
7699
|
+
if (offsetLeft + translateLeft < 0 || offsetLeft + pageItemRect.width > itemsContainerWidth - translateLeft) {
|
|
7700
|
+
pageBarScrollContainer.value.scrollTo(left);
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
});
|
|
7555
7704
|
return (_ctx, _cache) => {
|
|
7556
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
"
|
|
7561
|
-
|
|
7562
|
-
createVNode(_sfc_main$w, {
|
|
7563
|
-
type: active.value,
|
|
7564
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
7705
|
+
return openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
7706
|
+
createVNode(_sfc_main$x, {
|
|
7707
|
+
ref_key: "pageBarScrollContainer",
|
|
7708
|
+
ref: pageBarScrollContainer,
|
|
7709
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7710
|
+
length: list.value.length
|
|
7565
7711
|
}, {
|
|
7566
7712
|
prepend: withCtx(() => [
|
|
7567
|
-
|
|
7568
|
-
|
|
7713
|
+
renderSlot(_ctx.$slots, "page-bar-add-button", {}, () => [
|
|
7714
|
+
createVNode(_sfc_main$y)
|
|
7715
|
+
]),
|
|
7716
|
+
createVNode(_sfc_main$v, {
|
|
7717
|
+
query: query.value,
|
|
7718
|
+
"onUpdate:query": _cache[0] || (_cache[0] = ($event) => query.value = $event)
|
|
7719
|
+
}, null, 8, ["query"]),
|
|
7720
|
+
createVNode(_sfc_main$w, { list: list.value }, {
|
|
7569
7721
|
"page-list-popover": withCtx(({ list: list2 }) => [
|
|
7570
7722
|
renderSlot(_ctx.$slots, "page-list-popover", { list: list2 })
|
|
7571
7723
|
]),
|
|
@@ -7576,8 +7728,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7576
7728
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
7577
7729
|
return openBlock(), createElementBlock("div", {
|
|
7578
7730
|
class: normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
|
|
7731
|
+
ref_for: true,
|
|
7732
|
+
ref_key: "pageBarItems",
|
|
7733
|
+
ref: pageBarItems,
|
|
7579
7734
|
key: item.id,
|
|
7580
|
-
"page-id": item.id,
|
|
7735
|
+
"data-page-id": item.id,
|
|
7581
7736
|
onClick: ($event) => switchPage(item.id)
|
|
7582
7737
|
}, [
|
|
7583
7738
|
createElementVNode("div", _hoisted_3$2, [
|
|
@@ -7605,7 +7760,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7605
7760
|
default: withCtx(() => [
|
|
7606
7761
|
createElementVNode("div", null, [
|
|
7607
7762
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
7608
|
-
createVNode(_sfc_main$
|
|
7763
|
+
createVNode(_sfc_main$z, {
|
|
7609
7764
|
data: {
|
|
7610
7765
|
type: "button",
|
|
7611
7766
|
text: "复制",
|
|
@@ -7613,7 +7768,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7613
7768
|
handler: () => copy(item)
|
|
7614
7769
|
}
|
|
7615
7770
|
}, null, 8, ["data"]),
|
|
7616
|
-
createVNode(_sfc_main$
|
|
7771
|
+
createVNode(_sfc_main$z, {
|
|
7617
7772
|
data: {
|
|
7618
7773
|
type: "button",
|
|
7619
7774
|
text: "删除",
|
|
@@ -7626,19 +7781,19 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7626
7781
|
]),
|
|
7627
7782
|
_: 2
|
|
7628
7783
|
}, 1024)
|
|
7629
|
-
], 10, _hoisted_2$
|
|
7784
|
+
], 10, _hoisted_2$6);
|
|
7630
7785
|
}), 128))
|
|
7631
7786
|
]),
|
|
7632
7787
|
_: 3
|
|
7633
|
-
}, 8, ["
|
|
7788
|
+
}, 8, ["page-bar-sort-options", "length"])
|
|
7634
7789
|
]);
|
|
7635
7790
|
};
|
|
7636
7791
|
}
|
|
7637
7792
|
});
|
|
7638
7793
|
|
|
7639
|
-
const _hoisted_1$
|
|
7640
|
-
const _hoisted_2$
|
|
7641
|
-
const _sfc_main$
|
|
7794
|
+
const _hoisted_1$c = { class: "m-editor-empty-panel" };
|
|
7795
|
+
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
7796
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
7642
7797
|
...{
|
|
7643
7798
|
name: "MEditorAddPageBox"
|
|
7644
7799
|
},
|
|
@@ -7660,14 +7815,14 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7660
7815
|
});
|
|
7661
7816
|
};
|
|
7662
7817
|
return (_ctx, _cache) => {
|
|
7663
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
7664
|
-
createElementVNode("div", _hoisted_2$
|
|
7818
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
7819
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
7665
7820
|
createElementVNode("div", {
|
|
7666
7821
|
class: "m-editor-empty-button",
|
|
7667
7822
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
|
|
7668
7823
|
}, [
|
|
7669
7824
|
createElementVNode("div", null, [
|
|
7670
|
-
createVNode(_sfc_main$
|
|
7825
|
+
createVNode(_sfc_main$Z, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
7671
7826
|
]),
|
|
7672
7827
|
_cache[2] || (_cache[2] = createElementVNode("p", null, "新增页面", -1))
|
|
7673
7828
|
]),
|
|
@@ -7677,7 +7832,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7677
7832
|
onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(unref(NodeType).PAGE_FRAGMENT))
|
|
7678
7833
|
}, [
|
|
7679
7834
|
createElementVNode("div", null, [
|
|
7680
|
-
createVNode(_sfc_main$
|
|
7835
|
+
createVNode(_sfc_main$Z, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
7681
7836
|
]),
|
|
7682
7837
|
_cache[3] || (_cache[3] = createElementVNode("p", null, "新增页面片", -1))
|
|
7683
7838
|
])) : createCommentVNode("", true)
|
|
@@ -7691,24 +7846,24 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
7691
7846
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
7692
7847
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
7693
7848
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
7694
|
-
const _sfc_main$
|
|
7849
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
7695
7850
|
...{
|
|
7696
7851
|
name: "MEditorFramework"
|
|
7697
7852
|
},
|
|
7698
7853
|
__name: "Framework",
|
|
7699
7854
|
props: {
|
|
7700
7855
|
disabledPageFragment: { type: Boolean },
|
|
7701
|
-
pageBarSortOptions: {}
|
|
7856
|
+
pageBarSortOptions: {},
|
|
7857
|
+
pageFilterFunction: { type: Function }
|
|
7702
7858
|
},
|
|
7703
7859
|
setup(__props) {
|
|
7704
7860
|
const codeOptions = inject("codeOptions", {});
|
|
7705
7861
|
const { editorService, uiService } = inject("services") || {};
|
|
7706
|
-
const content =
|
|
7707
|
-
const splitView =
|
|
7862
|
+
const content = useTemplateRef("content");
|
|
7863
|
+
const splitView = useTemplateRef("splitView");
|
|
7708
7864
|
const root = computed(() => editorService?.get("root"));
|
|
7709
7865
|
const page = computed(() => editorService?.get("page"));
|
|
7710
7866
|
const pageLength = computed(() => editorService?.get("pageLength") || 0);
|
|
7711
|
-
const stageLoading = computed(() => editorService?.get("stageLoading") || false);
|
|
7712
7867
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
7713
7868
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
7714
7869
|
const getRightColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
@@ -7759,7 +7914,6 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7759
7914
|
}
|
|
7760
7915
|
};
|
|
7761
7916
|
return (_ctx, _cache) => {
|
|
7762
|
-
const _directive_loading = resolveDirective("loading");
|
|
7763
7917
|
return openBlock(), createElementBlock("div", {
|
|
7764
7918
|
class: "m-editor",
|
|
7765
7919
|
ref_key: "content",
|
|
@@ -7770,15 +7924,14 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7770
7924
|
renderSlot(_ctx.$slots, "nav"),
|
|
7771
7925
|
renderSlot(_ctx.$slots, "content-before"),
|
|
7772
7926
|
showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
7773
|
-
createVNode(_sfc_main$
|
|
7927
|
+
createVNode(_sfc_main$Y, {
|
|
7774
7928
|
class: "m-editor-content",
|
|
7775
7929
|
"init-values": root.value,
|
|
7776
7930
|
options: unref(codeOptions),
|
|
7777
7931
|
onSave: saveCode
|
|
7778
7932
|
}, null, 8, ["init-values", "options"])
|
|
7779
|
-
]) :
|
|
7933
|
+
]) : (openBlock(), createBlock(_sfc_main$A, {
|
|
7780
7934
|
key: 1,
|
|
7781
|
-
"element-loading-text": "Runtime 加载中...",
|
|
7782
7935
|
ref_key: "splitView",
|
|
7783
7936
|
ref: splitView,
|
|
7784
7937
|
class: "m-editor-content",
|
|
@@ -7790,7 +7943,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7790
7943
|
right: columnWidth.value.right,
|
|
7791
7944
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
7792
7945
|
"min-left": 65,
|
|
7793
|
-
"min-right":
|
|
7946
|
+
"min-right": 420,
|
|
7794
7947
|
"min-center": 100,
|
|
7795
7948
|
width: frameworkRect.value?.width || 0,
|
|
7796
7949
|
onChange: columnWidthChange
|
|
@@ -7800,13 +7953,17 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7800
7953
|
]),
|
|
7801
7954
|
center: withCtx(() => [
|
|
7802
7955
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7803
|
-
createVNode(_sfc_main$
|
|
7956
|
+
createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7804
7957
|
]),
|
|
7805
7958
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7806
|
-
createVNode(_sfc_main$
|
|
7959
|
+
createVNode(_sfc_main$u, {
|
|
7807
7960
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
7808
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
7961
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7962
|
+
"filter-function": _ctx.pageFilterFunction
|
|
7809
7963
|
}, {
|
|
7964
|
+
"page-bar-add-button": withCtx(() => [
|
|
7965
|
+
renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
7966
|
+
]),
|
|
7810
7967
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
7811
7968
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7812
7969
|
]),
|
|
@@ -7817,7 +7974,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7817
7974
|
renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
7818
7975
|
]),
|
|
7819
7976
|
_: 3
|
|
7820
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"])
|
|
7977
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "filter-function"])
|
|
7821
7978
|
])
|
|
7822
7979
|
]),
|
|
7823
7980
|
_: 2
|
|
@@ -7825,18 +7982,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7825
7982
|
page.value ? {
|
|
7826
7983
|
name: "right",
|
|
7827
7984
|
fn: withCtx(() => [
|
|
7828
|
-
|
|
7829
|
-
default: withCtx(() => [
|
|
7830
|
-
renderSlot(_ctx.$slots, "props-panel")
|
|
7831
|
-
]),
|
|
7832
|
-
_: 3
|
|
7833
|
-
})
|
|
7985
|
+
renderSlot(_ctx.$slots, "props-panel")
|
|
7834
7986
|
]),
|
|
7835
7987
|
key: "0"
|
|
7836
7988
|
} : void 0
|
|
7837
|
-
]), 1032, ["left", "right", "width"])),
|
|
7838
|
-
[_directive_loading, stageLoading.value]
|
|
7839
|
-
]),
|
|
7989
|
+
]), 1032, ["left", "right", "width"])),
|
|
7840
7990
|
renderSlot(_ctx.$slots, "content-after"),
|
|
7841
7991
|
renderSlot(_ctx.$slots, "footer")
|
|
7842
7992
|
], 512);
|
|
@@ -7844,7 +7994,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7844
7994
|
}
|
|
7845
7995
|
});
|
|
7846
7996
|
|
|
7847
|
-
const _sfc_main$
|
|
7997
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
7848
7998
|
...{
|
|
7849
7999
|
name: "MEditorNavMenu"
|
|
7850
8000
|
},
|
|
@@ -8005,7 +8155,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
8005
8155
|
});
|
|
8006
8156
|
}
|
|
8007
8157
|
});
|
|
8008
|
-
const navMenu =
|
|
8158
|
+
const navMenu = useTemplateRef("navMenu");
|
|
8009
8159
|
onMounted(() => {
|
|
8010
8160
|
navMenu.value && resizeObserver.observe(navMenu.value);
|
|
8011
8161
|
});
|
|
@@ -8026,7 +8176,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
8026
8176
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
8027
8177
|
}, [
|
|
8028
8178
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
8029
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8179
|
+
return openBlock(), createBlock(_sfc_main$z, {
|
|
8030
8180
|
data: item,
|
|
8031
8181
|
key: index
|
|
8032
8182
|
}, null, 8, ["data"]);
|
|
@@ -8038,7 +8188,132 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
8038
8188
|
}
|
|
8039
8189
|
});
|
|
8040
8190
|
|
|
8191
|
+
const _hoisted_1$b = { class: "m-editor-props-form-panel" };
|
|
8192
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
8193
|
+
...{
|
|
8194
|
+
name: "MEditorFormPanel"
|
|
8195
|
+
},
|
|
8196
|
+
__name: "FormPanel",
|
|
8197
|
+
props: {
|
|
8198
|
+
config: {},
|
|
8199
|
+
values: {},
|
|
8200
|
+
disabledShowSrc: { type: Boolean },
|
|
8201
|
+
labelWidth: {},
|
|
8202
|
+
codeValueKey: {},
|
|
8203
|
+
labelPosition: {},
|
|
8204
|
+
extendState: { type: Function }
|
|
8205
|
+
},
|
|
8206
|
+
emits: ["submit", "submit-error", "form-error", "mounted"],
|
|
8207
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8208
|
+
const props = __props;
|
|
8209
|
+
const emit = __emit;
|
|
8210
|
+
const services = inject("services");
|
|
8211
|
+
const codeOptions = inject("codeOptions", {});
|
|
8212
|
+
const showSrc = ref(false);
|
|
8213
|
+
const propsPanelSize = computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
8214
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
8215
|
+
const stage = computed(() => services?.editorService.get("stage"));
|
|
8216
|
+
const configForm = useTemplateRef("configForm");
|
|
8217
|
+
watchEffect(() => {
|
|
8218
|
+
if (configForm.value) {
|
|
8219
|
+
configForm.value.formState.stage = stage.value;
|
|
8220
|
+
configForm.value.formState.services = services;
|
|
8221
|
+
}
|
|
8222
|
+
});
|
|
8223
|
+
const internalInstance = getCurrentInstance();
|
|
8224
|
+
onMounted(() => {
|
|
8225
|
+
emit("mounted", internalInstance);
|
|
8226
|
+
});
|
|
8227
|
+
const submit = async (v, eventData) => {
|
|
8228
|
+
try {
|
|
8229
|
+
const values = await configForm.value?.submitForm();
|
|
8230
|
+
emit("submit", values, eventData);
|
|
8231
|
+
} catch (e) {
|
|
8232
|
+
emit("submit-error", e);
|
|
8233
|
+
}
|
|
8234
|
+
};
|
|
8235
|
+
const errorHandler = (e) => {
|
|
8236
|
+
emit("form-error", e);
|
|
8237
|
+
};
|
|
8238
|
+
const saveCode = (values) => {
|
|
8239
|
+
emit("submit", props.codeValueKey ? { [props.codeValueKey]: values } : values);
|
|
8240
|
+
};
|
|
8241
|
+
__expose({ configForm, submit });
|
|
8242
|
+
return (_ctx, _cache) => {
|
|
8243
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
8244
|
+
renderSlot(_ctx.$slots, "props-form-panel-header"),
|
|
8245
|
+
createVNode(unref(TMagicScrollbar), null, {
|
|
8246
|
+
default: withCtx(() => [
|
|
8247
|
+
createVNode(unref(MForm), {
|
|
8248
|
+
ref_key: "configForm",
|
|
8249
|
+
ref: configForm,
|
|
8250
|
+
class: normalizeClass(propsPanelSize.value),
|
|
8251
|
+
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
8252
|
+
"label-width": _ctx.labelWidth,
|
|
8253
|
+
"label-position": _ctx.labelPosition,
|
|
8254
|
+
size: propsPanelSize.value,
|
|
8255
|
+
"init-values": _ctx.values,
|
|
8256
|
+
config: _ctx.config,
|
|
8257
|
+
"extend-state": _ctx.extendState,
|
|
8258
|
+
onChange: submit,
|
|
8259
|
+
onError: errorHandler
|
|
8260
|
+
}, null, 8, ["class", "popper-class", "label-width", "label-position", "size", "init-values", "config", "extend-state"])
|
|
8261
|
+
]),
|
|
8262
|
+
_: 1
|
|
8263
|
+
}),
|
|
8264
|
+
!_ctx.disabledShowSrc ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
8265
|
+
key: 0,
|
|
8266
|
+
class: "m-editor-props-panel-src-icon",
|
|
8267
|
+
circle: "",
|
|
8268
|
+
title: "源码",
|
|
8269
|
+
type: showSrc.value ? "primary" : "",
|
|
8270
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
8271
|
+
}, {
|
|
8272
|
+
default: withCtx(() => [
|
|
8273
|
+
createVNode(_sfc_main$Z, { icon: unref(Document) }, null, 8, ["icon"])
|
|
8274
|
+
]),
|
|
8275
|
+
_: 1
|
|
8276
|
+
}, 8, ["type"])) : createCommentVNode("", true),
|
|
8277
|
+
showSrc.value ? (openBlock(), createBlock(_sfc_main$Y, {
|
|
8278
|
+
key: 1,
|
|
8279
|
+
class: "m-editor-props-panel-src-code",
|
|
8280
|
+
height: `${unref(editorContentHeight)}px`,
|
|
8281
|
+
"init-values": _ctx.codeValueKey ? _ctx.values[_ctx.codeValueKey] : _ctx.values,
|
|
8282
|
+
options: unref(codeOptions),
|
|
8283
|
+
parse: true,
|
|
8284
|
+
onSave: saveCode
|
|
8285
|
+
}, null, 8, ["height", "init-values", "options"])) : createCommentVNode("", true)
|
|
8286
|
+
]);
|
|
8287
|
+
};
|
|
8288
|
+
}
|
|
8289
|
+
});
|
|
8290
|
+
|
|
8291
|
+
const useStylePanel = (services) => {
|
|
8292
|
+
const showStylePanelStorageKey = "props-panel-show-style-panel";
|
|
8293
|
+
const showStylePanelStorageValue = services?.storageService.getItem(showStylePanelStorageKey, {
|
|
8294
|
+
protocol: Protocol.BOOLEAN
|
|
8295
|
+
});
|
|
8296
|
+
if (typeof showStylePanelStorageValue === "boolean") {
|
|
8297
|
+
services?.uiService.set("showStylePanel", showStylePanelStorageValue);
|
|
8298
|
+
}
|
|
8299
|
+
const showStylePanel = computed(() => services?.uiService.get("showStylePanel") ?? true);
|
|
8300
|
+
const showStylePanelHandler = () => {
|
|
8301
|
+
services?.uiService.set("showStylePanel", true);
|
|
8302
|
+
services?.storageService.setItem(showStylePanelStorageKey, true, { protocol: Protocol.BOOLEAN });
|
|
8303
|
+
};
|
|
8304
|
+
const closeStylePanelHandler = () => {
|
|
8305
|
+
services?.uiService.set("showStylePanel", false);
|
|
8306
|
+
services?.storageService.setItem(showStylePanelStorageKey, false, { protocol: Protocol.BOOLEAN });
|
|
8307
|
+
};
|
|
8308
|
+
return {
|
|
8309
|
+
showStylePanel,
|
|
8310
|
+
showStylePanelHandler,
|
|
8311
|
+
closeStylePanelHandler
|
|
8312
|
+
};
|
|
8313
|
+
};
|
|
8314
|
+
|
|
8041
8315
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
8316
|
+
const _hoisted_2$4 = { class: "m-editor-props-style-panel-title" };
|
|
8042
8317
|
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
8043
8318
|
...{
|
|
8044
8319
|
name: "MEditorPropsPanel"
|
|
@@ -8048,21 +8323,20 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
8048
8323
|
disabledShowSrc: { type: Boolean },
|
|
8049
8324
|
extendState: { type: Function }
|
|
8050
8325
|
},
|
|
8051
|
-
emits: ["
|
|
8326
|
+
emits: ["submit-error", "form-error", "mounted"],
|
|
8052
8327
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8053
|
-
const codeOptions = inject("codeOptions", {});
|
|
8054
8328
|
const emit = __emit;
|
|
8055
|
-
const
|
|
8056
|
-
const internalInstance = getCurrentInstance();
|
|
8329
|
+
const services = inject("services");
|
|
8057
8330
|
const values = ref({});
|
|
8058
|
-
const configForm = ref();
|
|
8059
8331
|
const curFormConfig = ref([]);
|
|
8060
|
-
const services = inject("services");
|
|
8061
8332
|
const node = computed(() => services?.editorService.get("node"));
|
|
8062
8333
|
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
8063
|
-
const
|
|
8064
|
-
|
|
8065
|
-
|
|
8334
|
+
const styleFormConfig = [
|
|
8335
|
+
{
|
|
8336
|
+
tabPosition: "right",
|
|
8337
|
+
items: styleTabConfig.items
|
|
8338
|
+
}
|
|
8339
|
+
];
|
|
8066
8340
|
const init = async () => {
|
|
8067
8341
|
if (!node.value) {
|
|
8068
8342
|
curFormConfig.value = [];
|
|
@@ -8074,21 +8348,15 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
8074
8348
|
};
|
|
8075
8349
|
watchEffect(init);
|
|
8076
8350
|
services?.propsService.on("props-configs-change", init);
|
|
8077
|
-
onMounted(() => {
|
|
8078
|
-
emit("mounted", internalInstance);
|
|
8079
|
-
});
|
|
8080
8351
|
onBeforeUnmount(() => {
|
|
8081
8352
|
services?.propsService.off("props-configs-change", init);
|
|
8082
8353
|
});
|
|
8083
|
-
|
|
8084
|
-
if (configForm.value && stage.value) {
|
|
8085
|
-
configForm.value.formState.stage = stage.value;
|
|
8086
|
-
}
|
|
8087
|
-
});
|
|
8088
|
-
const submit = async () => {
|
|
8354
|
+
const submit = async (v, eventData) => {
|
|
8089
8355
|
try {
|
|
8090
|
-
|
|
8091
|
-
|
|
8356
|
+
if (!v.id) {
|
|
8357
|
+
v.id = values.value.id;
|
|
8358
|
+
}
|
|
8359
|
+
services?.editorService.update(v, { changeRecords: eventData?.changeRecords });
|
|
8092
8360
|
} catch (e) {
|
|
8093
8361
|
emit("submit-error", e);
|
|
8094
8362
|
}
|
|
@@ -8096,48 +8364,76 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
8096
8364
|
const errorHandler = (e) => {
|
|
8097
8365
|
emit("form-error", e);
|
|
8098
8366
|
};
|
|
8099
|
-
const
|
|
8100
|
-
|
|
8367
|
+
const mountedHandler = (e) => {
|
|
8368
|
+
emit("mounted", e);
|
|
8101
8369
|
};
|
|
8102
|
-
|
|
8370
|
+
const { showStylePanel, showStylePanelHandler, closeStylePanelHandler } = useStylePanel(services);
|
|
8371
|
+
const propertyFormPanelRef = useTemplateRef("propertyFormPanel");
|
|
8372
|
+
__expose({
|
|
8373
|
+
getFormState() {
|
|
8374
|
+
return propertyFormPanelRef.value?.configForm?.formState;
|
|
8375
|
+
},
|
|
8376
|
+
submit
|
|
8377
|
+
});
|
|
8103
8378
|
return (_ctx, _cache) => {
|
|
8104
8379
|
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
8105
8380
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
8106
|
-
createVNode(
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
class: normalizeClass(propsPanelSize.value),
|
|
8110
|
-
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
8111
|
-
size: propsPanelSize.value,
|
|
8112
|
-
"init-values": values.value,
|
|
8381
|
+
createVNode(_sfc_main$q, {
|
|
8382
|
+
ref: "propertyFormPanel",
|
|
8383
|
+
class: normalizeClass(["m-editor-props-property-panel", { "show-style-panel": unref(showStylePanel) }]),
|
|
8113
8384
|
config: curFormConfig.value,
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8385
|
+
values: values.value,
|
|
8386
|
+
disabledShowSrc: _ctx.disabledShowSrc,
|
|
8387
|
+
extendState: _ctx.extendState,
|
|
8388
|
+
onSubmit: submit,
|
|
8389
|
+
onSubmitError: errorHandler,
|
|
8390
|
+
onFormError: errorHandler,
|
|
8391
|
+
onMounted: mountedHandler
|
|
8392
|
+
}, null, 8, ["class", "config", "values", "disabledShowSrc", "extendState"]),
|
|
8393
|
+
unref(showStylePanel) ? (openBlock(), createBlock(_sfc_main$q, {
|
|
8119
8394
|
key: 0,
|
|
8120
|
-
class: "m-editor-props-panel
|
|
8395
|
+
class: "m-editor-props-style-panel",
|
|
8396
|
+
"label-position": "top",
|
|
8397
|
+
"code-value-key": "style",
|
|
8398
|
+
config: styleFormConfig,
|
|
8399
|
+
values: values.value,
|
|
8400
|
+
disabledShowSrc: _ctx.disabledShowSrc,
|
|
8401
|
+
extendState: _ctx.extendState,
|
|
8402
|
+
onSubmit: submit,
|
|
8403
|
+
onSubmitError: errorHandler,
|
|
8404
|
+
onFormError: errorHandler
|
|
8405
|
+
}, {
|
|
8406
|
+
"props-form-panel-header": withCtx(() => [
|
|
8407
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
8408
|
+
_cache[0] || (_cache[0] = createElementVNode("span", null, "样式", -1)),
|
|
8409
|
+
createElementVNode("div", null, [
|
|
8410
|
+
createVNode(unref(TMagicButton), {
|
|
8411
|
+
link: "",
|
|
8412
|
+
size: "small",
|
|
8413
|
+
onClick: unref(closeStylePanelHandler)
|
|
8414
|
+
}, {
|
|
8415
|
+
default: withCtx(() => [
|
|
8416
|
+
createVNode(_sfc_main$Z, { icon: unref(Close) }, null, 8, ["icon"])
|
|
8417
|
+
]),
|
|
8418
|
+
_: 1
|
|
8419
|
+
}, 8, ["onClick"])
|
|
8420
|
+
])
|
|
8421
|
+
])
|
|
8422
|
+
]),
|
|
8423
|
+
_: 1
|
|
8424
|
+
}, 8, ["values", "disabledShowSrc", "extendState"])) : createCommentVNode("", true),
|
|
8425
|
+
!unref(showStylePanel) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
8426
|
+
key: 1,
|
|
8427
|
+
class: "m-editor-props-panel-style-icon",
|
|
8121
8428
|
circle: "",
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
type: showSrc.value ? "primary" : "",
|
|
8125
|
-
onClick: _cache[0] || (_cache[0] = ($event) => showSrc.value = !showSrc.value)
|
|
8429
|
+
type: unref(showStylePanel) ? "primary" : "",
|
|
8430
|
+
onClick: unref(showStylePanelHandler)
|
|
8126
8431
|
}, {
|
|
8127
8432
|
default: withCtx(() => [
|
|
8128
|
-
createVNode(_sfc_main$
|
|
8433
|
+
createVNode(_sfc_main$Z, { icon: unref(Sugar) }, null, 8, ["icon"])
|
|
8129
8434
|
]),
|
|
8130
8435
|
_: 1
|
|
8131
|
-
}, 8, ["type"])) : createCommentVNode("", true)
|
|
8132
|
-
showSrc.value ? (openBlock(), createBlock(_sfc_main$X, {
|
|
8133
|
-
key: 1,
|
|
8134
|
-
class: "m-editor-props-panel-src-code",
|
|
8135
|
-
height: `${unref(editorContentHeight)}px`,
|
|
8136
|
-
"init-values": values.value,
|
|
8137
|
-
options: unref(codeOptions),
|
|
8138
|
-
parse: true,
|
|
8139
|
-
onSave: saveCode
|
|
8140
|
-
}, null, 8, ["height", "init-values", "options"])) : createCommentVNode("", true)
|
|
8436
|
+
}, 8, ["type", "onClick"])) : createCommentVNode("", true)
|
|
8141
8437
|
], 512)), [
|
|
8142
8438
|
[vShow, nodes.value.length === 1]
|
|
8143
8439
|
]);
|
|
@@ -8147,7 +8443,174 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
8147
8443
|
|
|
8148
8444
|
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
8149
8445
|
...{
|
|
8150
|
-
name: "
|
|
8446
|
+
name: "MEditorContentMenu"
|
|
8447
|
+
},
|
|
8448
|
+
__name: "ContentMenu",
|
|
8449
|
+
props: {
|
|
8450
|
+
menuData: { default: () => [] },
|
|
8451
|
+
isSubMenu: { type: Boolean, default: false },
|
|
8452
|
+
active: {},
|
|
8453
|
+
autoHide: { type: Boolean, default: true }
|
|
8454
|
+
},
|
|
8455
|
+
emits: ["hide", "show", "mouseenter"],
|
|
8456
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8457
|
+
const props = __props;
|
|
8458
|
+
const emit = __emit;
|
|
8459
|
+
const menu = useTemplateRef("menu");
|
|
8460
|
+
const buttons = useTemplateRef("buttons");
|
|
8461
|
+
const subMenu = useTemplateRef("subMenu");
|
|
8462
|
+
const visible = ref(false);
|
|
8463
|
+
const subMenuData = ref([]);
|
|
8464
|
+
const zIndex = useZIndex();
|
|
8465
|
+
const curZIndex = ref(0);
|
|
8466
|
+
const menuPosition = ref({
|
|
8467
|
+
left: 0,
|
|
8468
|
+
top: 0
|
|
8469
|
+
});
|
|
8470
|
+
const menuStyle = computed(() => ({
|
|
8471
|
+
top: `${menuPosition.value.top + 2}px`,
|
|
8472
|
+
left: `${menuPosition.value.left + 2}px`,
|
|
8473
|
+
zIndex: curZIndex.value
|
|
8474
|
+
}));
|
|
8475
|
+
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
8476
|
+
const hide = () => {
|
|
8477
|
+
if (!visible.value) return;
|
|
8478
|
+
visible.value = false;
|
|
8479
|
+
subMenu.value?.hide();
|
|
8480
|
+
emit("hide");
|
|
8481
|
+
};
|
|
8482
|
+
const clickHandler = (event) => {
|
|
8483
|
+
if (!props.autoHide) return;
|
|
8484
|
+
if (event.button === 0) {
|
|
8485
|
+
hide();
|
|
8486
|
+
}
|
|
8487
|
+
};
|
|
8488
|
+
const outsideClickHideHandler = (e) => {
|
|
8489
|
+
if (!props.autoHide) return;
|
|
8490
|
+
const target = e.target;
|
|
8491
|
+
if (!visible.value || !target) {
|
|
8492
|
+
return;
|
|
8493
|
+
}
|
|
8494
|
+
if (contains(target)) {
|
|
8495
|
+
return;
|
|
8496
|
+
}
|
|
8497
|
+
hide();
|
|
8498
|
+
};
|
|
8499
|
+
const setPosition = (e) => {
|
|
8500
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
8501
|
+
let top = e.clientY;
|
|
8502
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
8503
|
+
top = document.body.clientHeight - menuHeight;
|
|
8504
|
+
}
|
|
8505
|
+
menuPosition.value = {
|
|
8506
|
+
top,
|
|
8507
|
+
left: e.clientX
|
|
8508
|
+
};
|
|
8509
|
+
};
|
|
8510
|
+
const show = (e) => {
|
|
8511
|
+
visible.value = true;
|
|
8512
|
+
nextTick(() => {
|
|
8513
|
+
e && setPosition(e);
|
|
8514
|
+
curZIndex.value = zIndex.nextZIndex();
|
|
8515
|
+
emit("show");
|
|
8516
|
+
});
|
|
8517
|
+
};
|
|
8518
|
+
const showSubMenu = (item, index) => {
|
|
8519
|
+
const menuItem = item;
|
|
8520
|
+
if (typeof item !== "object") {
|
|
8521
|
+
return;
|
|
8522
|
+
}
|
|
8523
|
+
subMenuData.value = menuItem.items || [];
|
|
8524
|
+
setTimeout(() => {
|
|
8525
|
+
if (!visible.value) {
|
|
8526
|
+
return;
|
|
8527
|
+
}
|
|
8528
|
+
if (menu.value) {
|
|
8529
|
+
let y = menu.value.offsetTop;
|
|
8530
|
+
if (buttons.value?.[index].$el) {
|
|
8531
|
+
const rect = buttons.value?.[index].$el.getBoundingClientRect();
|
|
8532
|
+
y = rect.top;
|
|
8533
|
+
}
|
|
8534
|
+
subMenu.value?.show({
|
|
8535
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth - 2,
|
|
8536
|
+
clientY: y
|
|
8537
|
+
});
|
|
8538
|
+
}
|
|
8539
|
+
}, 0);
|
|
8540
|
+
};
|
|
8541
|
+
const mouseenterHandler = () => {
|
|
8542
|
+
emit("mouseenter");
|
|
8543
|
+
};
|
|
8544
|
+
onMounted(() => {
|
|
8545
|
+
if (props.isSubMenu) return;
|
|
8546
|
+
globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
|
|
8547
|
+
});
|
|
8548
|
+
onBeforeUnmount(() => {
|
|
8549
|
+
if (props.isSubMenu) return;
|
|
8550
|
+
globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
|
|
8551
|
+
});
|
|
8552
|
+
__expose({
|
|
8553
|
+
menu,
|
|
8554
|
+
menuPosition,
|
|
8555
|
+
hide,
|
|
8556
|
+
show,
|
|
8557
|
+
contains,
|
|
8558
|
+
setPosition
|
|
8559
|
+
});
|
|
8560
|
+
return (_ctx, _cache) => {
|
|
8561
|
+
const _component_content_menu = resolveComponent("content-menu", true);
|
|
8562
|
+
return openBlock(), createBlock(Transition, { name: "fade" }, {
|
|
8563
|
+
default: withCtx(() => [
|
|
8564
|
+
withDirectives(createElementVNode("div", {
|
|
8565
|
+
class: "magic-editor-content-menu",
|
|
8566
|
+
ref_key: "menu",
|
|
8567
|
+
ref: menu,
|
|
8568
|
+
style: normalizeStyle(menuStyle.value),
|
|
8569
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => mouseenterHandler()),
|
|
8570
|
+
onContextmenu: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
8571
|
+
}, ["prevent"]))
|
|
8572
|
+
}, [
|
|
8573
|
+
renderSlot(_ctx.$slots, "title"),
|
|
8574
|
+
createElementVNode("div", null, [
|
|
8575
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
8576
|
+
return openBlock(), createBlock(_sfc_main$z, {
|
|
8577
|
+
"event-type": "mouseup",
|
|
8578
|
+
ref_for: true,
|
|
8579
|
+
ref_key: "buttons",
|
|
8580
|
+
ref: buttons,
|
|
8581
|
+
class: normalizeClass({ active: _ctx.active && item.id === _ctx.active }),
|
|
8582
|
+
data: item,
|
|
8583
|
+
key: index,
|
|
8584
|
+
onMouseup: clickHandler,
|
|
8585
|
+
onMouseenter: ($event) => showSubMenu(item, index)
|
|
8586
|
+
}, null, 8, ["class", "data", "onMouseenter"]);
|
|
8587
|
+
}), 128))
|
|
8588
|
+
]),
|
|
8589
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
8590
|
+
subMenuData.value.length ? (openBlock(), createBlock(_component_content_menu, {
|
|
8591
|
+
key: 0,
|
|
8592
|
+
class: "sub-menu",
|
|
8593
|
+
ref_key: "subMenu",
|
|
8594
|
+
ref: subMenu,
|
|
8595
|
+
active: _ctx.active,
|
|
8596
|
+
"menu-data": subMenuData.value,
|
|
8597
|
+
"is-sub-menu": true,
|
|
8598
|
+
onHide: hide
|
|
8599
|
+
}, null, 8, ["active", "menu-data"])) : createCommentVNode("", true)
|
|
8600
|
+
]))
|
|
8601
|
+
], 36), [
|
|
8602
|
+
[vShow, visible.value]
|
|
8603
|
+
])
|
|
8604
|
+
]),
|
|
8605
|
+
_: 3
|
|
8606
|
+
});
|
|
8607
|
+
};
|
|
8608
|
+
}
|
|
8609
|
+
});
|
|
8610
|
+
|
|
8611
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
8612
|
+
...{
|
|
8613
|
+
name: "MEditorSearchInput"
|
|
8151
8614
|
},
|
|
8152
8615
|
__name: "SearchInput",
|
|
8153
8616
|
emits: ["search"],
|
|
@@ -8193,7 +8656,7 @@ const _hoisted_4$1 = {
|
|
|
8193
8656
|
key: 0,
|
|
8194
8657
|
class: "m-editor-tree-node-children"
|
|
8195
8658
|
};
|
|
8196
|
-
const _sfc_main$
|
|
8659
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
8197
8660
|
...{
|
|
8198
8661
|
name: "MEditorTreeNode"
|
|
8199
8662
|
},
|
|
@@ -8267,7 +8730,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
8267
8730
|
onContextmenu: nodeContentmenuHandler,
|
|
8268
8731
|
onMouseenter: mouseenterHandler
|
|
8269
8732
|
}, [
|
|
8270
|
-
createVNode(_sfc_main$
|
|
8733
|
+
createVNode(_sfc_main$Z, {
|
|
8271
8734
|
class: "expand-icon",
|
|
8272
8735
|
style: normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
|
|
8273
8736
|
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
@@ -8323,7 +8786,7 @@ const _hoisted_1$8 = {
|
|
|
8323
8786
|
key: 1,
|
|
8324
8787
|
class: "m-editor-tree-empty"
|
|
8325
8788
|
};
|
|
8326
|
-
const _sfc_main$
|
|
8789
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
8327
8790
|
...{
|
|
8328
8791
|
name: "MEditorTree"
|
|
8329
8792
|
},
|
|
@@ -8348,7 +8811,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8348
8811
|
onDragover: handleDragOver
|
|
8349
8812
|
}, [
|
|
8350
8813
|
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
8351
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8814
|
+
return openBlock(), createBlock(_sfc_main$m, {
|
|
8352
8815
|
key: item.id,
|
|
8353
8816
|
data: item,
|
|
8354
8817
|
indent: _ctx.indent,
|
|
@@ -8374,7 +8837,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8374
8837
|
}
|
|
8375
8838
|
});
|
|
8376
8839
|
|
|
8377
|
-
const _sfc_main$
|
|
8840
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
8378
8841
|
...{
|
|
8379
8842
|
name: "MEditorCodeBlockList"
|
|
8380
8843
|
},
|
|
@@ -8384,12 +8847,13 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8384
8847
|
nextLevelIndentIncrement: {},
|
|
8385
8848
|
customError: { type: Function }
|
|
8386
8849
|
},
|
|
8387
|
-
emits: ["edit", "remove"],
|
|
8850
|
+
emits: ["edit", "remove", "node-contextmenu"],
|
|
8388
8851
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8389
8852
|
const props = __props;
|
|
8390
8853
|
const emit = __emit;
|
|
8391
8854
|
const services = inject("services");
|
|
8392
8855
|
const { codeBlockService, depService, editorService } = services || {};
|
|
8856
|
+
const collecting = computed(() => depService?.get("collecting"));
|
|
8393
8857
|
const codeList = computed(
|
|
8394
8858
|
() => Object.entries(codeBlockService?.getCodeDsl() || {}).map(([codeId, code]) => {
|
|
8395
8859
|
const target = depService?.getTarget(codeId, DepTargetType.CODE_BLOCK);
|
|
@@ -8464,20 +8928,29 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8464
8928
|
if (typeof props.customError === "function") {
|
|
8465
8929
|
props.customError(id, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
8466
8930
|
} else {
|
|
8467
|
-
|
|
8931
|
+
if (existBinds) {
|
|
8932
|
+
tMagicMessage.error("代码块存在绑定关系,不可删除");
|
|
8933
|
+
} else {
|
|
8934
|
+
tMagicMessage.error("代码块不可删除");
|
|
8935
|
+
}
|
|
8468
8936
|
}
|
|
8469
8937
|
}
|
|
8470
8938
|
};
|
|
8939
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
8940
|
+
emit("node-contextmenu", event, data);
|
|
8941
|
+
};
|
|
8471
8942
|
__expose({
|
|
8472
|
-
filter: filterTextChangeHandler
|
|
8943
|
+
filter: filterTextChangeHandler,
|
|
8944
|
+
deleteCode
|
|
8473
8945
|
});
|
|
8474
8946
|
return (_ctx, _cache) => {
|
|
8475
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8947
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
8476
8948
|
data: codeList.value,
|
|
8477
8949
|
"node-status-map": unref(nodeStatusMap),
|
|
8478
8950
|
indent: _ctx.indent,
|
|
8479
8951
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8480
|
-
onNodeClick: clickHandler
|
|
8952
|
+
onNodeClick: clickHandler,
|
|
8953
|
+
onNodeContextmenu: nodeContentMenuHandler
|
|
8481
8954
|
}, {
|
|
8482
8955
|
"tree-node-label": withCtx(({ data }) => [
|
|
8483
8956
|
createElementVNode("div", {
|
|
@@ -8489,14 +8962,25 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8489
8962
|
}, toDisplayString(data.name) + " " + toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
8490
8963
|
]),
|
|
8491
8964
|
"tree-node-tool": withCtx(({ data }) => [
|
|
8492
|
-
data.type === "code" ? (openBlock(), createBlock(unref(
|
|
8965
|
+
collecting.value && data.type === "code" ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
8493
8966
|
key: 0,
|
|
8967
|
+
type: "info",
|
|
8968
|
+
size: "small",
|
|
8969
|
+
style: { "margin-right": "5px" }
|
|
8970
|
+
}, {
|
|
8971
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
8972
|
+
createTextVNode("依赖收集中")
|
|
8973
|
+
])),
|
|
8974
|
+
_: 1
|
|
8975
|
+
})) : createCommentVNode("", true),
|
|
8976
|
+
data.type === "code" ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
8977
|
+
key: 1,
|
|
8494
8978
|
effect: "dark",
|
|
8495
8979
|
content: editable.value ? "编辑" : "查看",
|
|
8496
8980
|
placement: "bottom"
|
|
8497
8981
|
}, {
|
|
8498
8982
|
default: withCtx(() => [
|
|
8499
|
-
createVNode(_sfc_main$
|
|
8983
|
+
createVNode(_sfc_main$Z, {
|
|
8500
8984
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
8501
8985
|
class: "edit-icon",
|
|
8502
8986
|
onClick: withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
@@ -8505,13 +8989,13 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8505
8989
|
_: 2
|
|
8506
8990
|
}, 1032, ["content"])) : createCommentVNode("", true),
|
|
8507
8991
|
data.type === "code" && editable.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
8508
|
-
key:
|
|
8992
|
+
key: 2,
|
|
8509
8993
|
effect: "dark",
|
|
8510
8994
|
content: "删除",
|
|
8511
8995
|
placement: "bottom"
|
|
8512
8996
|
}, {
|
|
8513
8997
|
default: withCtx(() => [
|
|
8514
|
-
createVNode(_sfc_main$
|
|
8998
|
+
createVNode(_sfc_main$Z, {
|
|
8515
8999
|
icon: unref(Close),
|
|
8516
9000
|
class: "edit-icon",
|
|
8517
9001
|
onClick: withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
@@ -8530,8 +9014,74 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8530
9014
|
}
|
|
8531
9015
|
});
|
|
8532
9016
|
|
|
9017
|
+
const useContentMenu$1 = (deleteCode) => {
|
|
9018
|
+
const eventBus = inject("eventBus");
|
|
9019
|
+
const menuRef = useTemplateRef("menu");
|
|
9020
|
+
let selectId = "";
|
|
9021
|
+
const menuData = [
|
|
9022
|
+
{
|
|
9023
|
+
type: "button",
|
|
9024
|
+
text: "编辑",
|
|
9025
|
+
icon: Edit,
|
|
9026
|
+
display: (services) => services?.codeBlockService?.getEditStatus() ?? true,
|
|
9027
|
+
handler: () => {
|
|
9028
|
+
if (!selectId) {
|
|
9029
|
+
return;
|
|
9030
|
+
}
|
|
9031
|
+
eventBus?.emit("edit-code", selectId);
|
|
9032
|
+
}
|
|
9033
|
+
},
|
|
9034
|
+
{
|
|
9035
|
+
type: "button",
|
|
9036
|
+
text: "复制并粘贴至当前",
|
|
9037
|
+
icon: markRaw(CopyDocument),
|
|
9038
|
+
handler: async ({ codeBlockService }) => {
|
|
9039
|
+
if (!selectId) {
|
|
9040
|
+
return;
|
|
9041
|
+
}
|
|
9042
|
+
const codeBlock = codeBlockService.getCodeContentById(selectId);
|
|
9043
|
+
if (!codeBlock) {
|
|
9044
|
+
return;
|
|
9045
|
+
}
|
|
9046
|
+
const newCodeId = await codeBlockService.getUniqueId();
|
|
9047
|
+
codeBlockService.setCodeDslById(newCodeId, cloneDeep(codeBlock));
|
|
9048
|
+
}
|
|
9049
|
+
},
|
|
9050
|
+
{
|
|
9051
|
+
type: "button",
|
|
9052
|
+
text: "删除",
|
|
9053
|
+
icon: Delete,
|
|
9054
|
+
handler: () => {
|
|
9055
|
+
if (!selectId) {
|
|
9056
|
+
return;
|
|
9057
|
+
}
|
|
9058
|
+
deleteCode(selectId);
|
|
9059
|
+
}
|
|
9060
|
+
}
|
|
9061
|
+
];
|
|
9062
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9063
|
+
event.preventDefault();
|
|
9064
|
+
if (data.type === "code") {
|
|
9065
|
+
menuRef.value?.show(event);
|
|
9066
|
+
if (data.id) {
|
|
9067
|
+
selectId = `${data.id}`;
|
|
9068
|
+
} else {
|
|
9069
|
+
selectId = "";
|
|
9070
|
+
}
|
|
9071
|
+
}
|
|
9072
|
+
};
|
|
9073
|
+
const contentMenuHideHandler = () => {
|
|
9074
|
+
selectId = "";
|
|
9075
|
+
};
|
|
9076
|
+
return {
|
|
9077
|
+
menuData,
|
|
9078
|
+
nodeContentMenuHandler,
|
|
9079
|
+
contentMenuHideHandler
|
|
9080
|
+
};
|
|
9081
|
+
};
|
|
9082
|
+
|
|
8533
9083
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
8534
|
-
const _sfc_main$
|
|
9084
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
8535
9085
|
...{
|
|
8536
9086
|
name: "MEditorCodeBlockListPanel"
|
|
8537
9087
|
},
|
|
@@ -8539,27 +9089,37 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
8539
9089
|
props: {
|
|
8540
9090
|
indent: {},
|
|
8541
9091
|
nextLevelIndentIncrement: {},
|
|
8542
|
-
customError: { type: Function }
|
|
9092
|
+
customError: { type: Function },
|
|
9093
|
+
customContentMenu: { type: Function }
|
|
8543
9094
|
},
|
|
8544
9095
|
setup(__props) {
|
|
9096
|
+
const props = __props;
|
|
8545
9097
|
const eventBus = inject("eventBus");
|
|
8546
9098
|
const { codeBlockService } = inject("services") || {};
|
|
8547
9099
|
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
8548
9100
|
const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
8549
|
-
const codeBlockList =
|
|
9101
|
+
const codeBlockList = useTemplateRef("codeBlockList");
|
|
8550
9102
|
const filterTextChangeHandler = (val) => {
|
|
8551
9103
|
codeBlockList.value?.filter(val);
|
|
8552
9104
|
};
|
|
8553
9105
|
eventBus?.on("edit-code", (id) => {
|
|
8554
9106
|
editCode(id);
|
|
8555
9107
|
});
|
|
9108
|
+
const {
|
|
9109
|
+
nodeContentMenuHandler,
|
|
9110
|
+
menuData: contentMenuData,
|
|
9111
|
+
contentMenuHideHandler
|
|
9112
|
+
} = useContentMenu$1((id) => {
|
|
9113
|
+
codeBlockList.value?.deleteCode(id);
|
|
9114
|
+
});
|
|
9115
|
+
const menuData = computed(() => props.customContentMenu(contentMenuData, "code-block"));
|
|
8556
9116
|
return (_ctx, _cache) => {
|
|
8557
9117
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
8558
9118
|
createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
8559
9119
|
default: withCtx(() => [
|
|
8560
9120
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
8561
9121
|
createElementVNode("div", _hoisted_1$7, [
|
|
8562
|
-
createVNode(_sfc_main$
|
|
9122
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
8563
9123
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
8564
9124
|
key: 0,
|
|
8565
9125
|
class: "create-code-button",
|
|
@@ -8575,14 +9135,15 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
8575
9135
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
8576
9136
|
])
|
|
8577
9137
|
]),
|
|
8578
|
-
createVNode(_sfc_main$
|
|
9138
|
+
createVNode(_sfc_main$k, {
|
|
8579
9139
|
ref_key: "codeBlockList",
|
|
8580
9140
|
ref: codeBlockList,
|
|
8581
9141
|
"custom-error": _ctx.customError,
|
|
8582
9142
|
indent: _ctx.indent,
|
|
8583
9143
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8584
9144
|
onEdit: unref(editCode),
|
|
8585
|
-
onRemove: unref(deleteCode)
|
|
9145
|
+
onRemove: unref(deleteCode),
|
|
9146
|
+
onNodeContextmenu: unref(nodeContentMenuHandler)
|
|
8586
9147
|
}, {
|
|
8587
9148
|
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
8588
9149
|
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
@@ -8591,18 +9152,27 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
8591
9152
|
})
|
|
8592
9153
|
]),
|
|
8593
9154
|
_: 3
|
|
8594
|
-
}, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove"])
|
|
9155
|
+
}, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove", "onNodeContextmenu"])
|
|
8595
9156
|
]),
|
|
8596
9157
|
_: 3
|
|
8597
9158
|
}),
|
|
8598
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
9159
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
|
|
8599
9160
|
key: 0,
|
|
8600
9161
|
ref_key: "codeBlockEditor",
|
|
8601
9162
|
ref: codeBlockEditor,
|
|
8602
9163
|
disabled: !editable.value,
|
|
8603
9164
|
content: unref(codeConfig),
|
|
8604
9165
|
onSubmit: unref(submitCodeBlockHandler)
|
|
8605
|
-
}, null, 8, ["disabled", "content", "onSubmit"])) : createCommentVNode("", true)
|
|
9166
|
+
}, null, 8, ["disabled", "content", "onSubmit"])) : createCommentVNode("", true),
|
|
9167
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
9168
|
+
menuData.value.length ? (openBlock(), createBlock(_sfc_main$o, {
|
|
9169
|
+
key: 0,
|
|
9170
|
+
"menu-data": menuData.value,
|
|
9171
|
+
ref: "menu",
|
|
9172
|
+
style: { "overflow": "initial" },
|
|
9173
|
+
onHide: unref(contentMenuHideHandler)
|
|
9174
|
+
}, null, 8, ["menu-data", "onHide"])) : createCommentVNode("", true)
|
|
9175
|
+
]))
|
|
8606
9176
|
], 64);
|
|
8607
9177
|
};
|
|
8608
9178
|
}
|
|
@@ -8621,9 +9191,9 @@ const useDataSourceEdit = (dataSourceService) => {
|
|
|
8621
9191
|
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8622
9192
|
editDialog.value.show();
|
|
8623
9193
|
};
|
|
8624
|
-
const submitDataSourceHandler = (value) => {
|
|
9194
|
+
const submitDataSourceHandler = (value, eventData) => {
|
|
8625
9195
|
if (value.id) {
|
|
8626
|
-
dataSourceService?.update(value);
|
|
9196
|
+
dataSourceService?.update(value, { changeRecords: eventData.changeRecords });
|
|
8627
9197
|
} else {
|
|
8628
9198
|
dataSourceService?.add(value);
|
|
8629
9199
|
}
|
|
@@ -8639,7 +9209,7 @@ const useDataSourceEdit = (dataSourceService) => {
|
|
|
8639
9209
|
};
|
|
8640
9210
|
};
|
|
8641
9211
|
|
|
8642
|
-
const _sfc_main$
|
|
9212
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
8643
9213
|
...{
|
|
8644
9214
|
name: "MEditorDataSourceConfigPanel"
|
|
8645
9215
|
},
|
|
@@ -8670,8 +9240,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8670
9240
|
initValues.value = props.values;
|
|
8671
9241
|
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
8672
9242
|
});
|
|
8673
|
-
const submitHandler = (values) => {
|
|
8674
|
-
emit("submit", values);
|
|
9243
|
+
const submitHandler = (values, data) => {
|
|
9244
|
+
emit("submit", values, data);
|
|
8675
9245
|
};
|
|
8676
9246
|
const errorHandler = (error) => {
|
|
8677
9247
|
tMagicMessage.error(error.message);
|
|
@@ -8686,7 +9256,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8686
9256
|
}
|
|
8687
9257
|
});
|
|
8688
9258
|
return (_ctx, _cache) => {
|
|
8689
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9259
|
+
return openBlock(), createBlock(_sfc_main$R, {
|
|
8690
9260
|
visible: boxVisible.value,
|
|
8691
9261
|
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
8692
9262
|
width: width.value,
|
|
@@ -8714,7 +9284,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
8714
9284
|
}
|
|
8715
9285
|
});
|
|
8716
9286
|
|
|
8717
|
-
const _sfc_main$
|
|
9287
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
8718
9288
|
...{
|
|
8719
9289
|
name: "MEditorDataSourceList"
|
|
8720
9290
|
},
|
|
@@ -8723,10 +9293,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8723
9293
|
indent: {},
|
|
8724
9294
|
nextLevelIndentIncrement: {}
|
|
8725
9295
|
},
|
|
8726
|
-
emits: ["edit", "remove"],
|
|
9296
|
+
emits: ["edit", "remove", "node-contextmenu"],
|
|
8727
9297
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8728
9298
|
const emit = __emit;
|
|
8729
9299
|
const { depService, editorService, dataSourceService } = inject("services") || {};
|
|
9300
|
+
const collecting = computed(() => depService?.get("collecting"));
|
|
8730
9301
|
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
8731
9302
|
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
8732
9303
|
const dsDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE) || {});
|
|
@@ -8794,11 +9365,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8794
9365
|
emit("edit", id);
|
|
8795
9366
|
};
|
|
8796
9367
|
const removeHandler = async (id) => {
|
|
8797
|
-
await tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
8798
|
-
confirmButtonText: "确定",
|
|
8799
|
-
cancelButtonText: "取消",
|
|
8800
|
-
type: "warning"
|
|
8801
|
-
});
|
|
8802
9368
|
emit("remove", id);
|
|
8803
9369
|
};
|
|
8804
9370
|
const selectComp = (compId) => {
|
|
@@ -8811,16 +9377,20 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8811
9377
|
selectComp(data.key);
|
|
8812
9378
|
}
|
|
8813
9379
|
};
|
|
9380
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9381
|
+
emit("node-contextmenu", event, data);
|
|
9382
|
+
};
|
|
8814
9383
|
__expose({
|
|
8815
9384
|
filter: filterTextChangeHandler
|
|
8816
9385
|
});
|
|
8817
9386
|
return (_ctx, _cache) => {
|
|
8818
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9387
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
8819
9388
|
data: list.value,
|
|
8820
9389
|
"node-status-map": unref(nodeStatusMap),
|
|
8821
9390
|
indent: _ctx.indent,
|
|
8822
9391
|
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8823
|
-
onNodeClick: clickHandler
|
|
9392
|
+
onNodeClick: clickHandler,
|
|
9393
|
+
onNodeContextmenu: nodeContentMenuHandler
|
|
8824
9394
|
}, {
|
|
8825
9395
|
"tree-node-label": withCtx(({ data }) => [
|
|
8826
9396
|
createElementVNode("div", {
|
|
@@ -8832,14 +9402,25 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8832
9402
|
}, toDisplayString(data.name) + " " + toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
8833
9403
|
]),
|
|
8834
9404
|
"tree-node-tool": withCtx(({ data }) => [
|
|
8835
|
-
data.type === "ds" ? (openBlock(), createBlock(unref(
|
|
9405
|
+
collecting.value && data.type === "ds" ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
8836
9406
|
key: 0,
|
|
9407
|
+
type: "info",
|
|
9408
|
+
size: "small",
|
|
9409
|
+
style: { "margin-right": "5px" }
|
|
9410
|
+
}, {
|
|
9411
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
9412
|
+
createTextVNode("依赖收集中")
|
|
9413
|
+
])),
|
|
9414
|
+
_: 1
|
|
9415
|
+
})) : createCommentVNode("", true),
|
|
9416
|
+
data.type === "ds" ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
9417
|
+
key: 1,
|
|
8837
9418
|
effect: "dark",
|
|
8838
9419
|
content: editable.value ? "编辑" : "查看",
|
|
8839
9420
|
placement: "bottom"
|
|
8840
9421
|
}, {
|
|
8841
9422
|
default: withCtx(() => [
|
|
8842
|
-
createVNode(_sfc_main$
|
|
9423
|
+
createVNode(_sfc_main$Z, {
|
|
8843
9424
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
8844
9425
|
class: "edit-icon",
|
|
8845
9426
|
onClick: withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
@@ -8848,13 +9429,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8848
9429
|
_: 2
|
|
8849
9430
|
}, 1032, ["content"])) : createCommentVNode("", true),
|
|
8850
9431
|
data.type === "ds" && editable.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
8851
|
-
key:
|
|
9432
|
+
key: 2,
|
|
8852
9433
|
effect: "dark",
|
|
8853
9434
|
content: "删除",
|
|
8854
9435
|
placement: "bottom"
|
|
8855
9436
|
}, {
|
|
8856
9437
|
default: withCtx(() => [
|
|
8857
|
-
createVNode(_sfc_main$
|
|
9438
|
+
createVNode(_sfc_main$Z, {
|
|
8858
9439
|
icon: unref(Close),
|
|
8859
9440
|
class: "edit-icon",
|
|
8860
9441
|
onClick: withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
@@ -8870,17 +9451,84 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8870
9451
|
}
|
|
8871
9452
|
});
|
|
8872
9453
|
|
|
9454
|
+
const useContentMenu = () => {
|
|
9455
|
+
const eventBus = inject("eventBus");
|
|
9456
|
+
const menuRef = useTemplateRef("menu");
|
|
9457
|
+
let selectId = "";
|
|
9458
|
+
const menuData = [
|
|
9459
|
+
{
|
|
9460
|
+
type: "button",
|
|
9461
|
+
text: "编辑",
|
|
9462
|
+
icon: Edit,
|
|
9463
|
+
display: (services) => services?.dataSourceService?.get("editable") ?? true,
|
|
9464
|
+
handler: () => {
|
|
9465
|
+
if (!selectId) {
|
|
9466
|
+
return;
|
|
9467
|
+
}
|
|
9468
|
+
eventBus?.emit("edit-data-source", selectId);
|
|
9469
|
+
}
|
|
9470
|
+
},
|
|
9471
|
+
{
|
|
9472
|
+
type: "button",
|
|
9473
|
+
text: "复制并粘贴至当前",
|
|
9474
|
+
icon: markRaw(CopyDocument),
|
|
9475
|
+
handler: ({ dataSourceService }) => {
|
|
9476
|
+
if (!selectId) {
|
|
9477
|
+
return;
|
|
9478
|
+
}
|
|
9479
|
+
const ds = dataSourceService.getDataSourceById(selectId);
|
|
9480
|
+
if (!ds) {
|
|
9481
|
+
return;
|
|
9482
|
+
}
|
|
9483
|
+
dataSourceService.add(cloneDeep(ds));
|
|
9484
|
+
}
|
|
9485
|
+
},
|
|
9486
|
+
{
|
|
9487
|
+
type: "button",
|
|
9488
|
+
text: "删除",
|
|
9489
|
+
icon: Delete,
|
|
9490
|
+
handler: () => {
|
|
9491
|
+
if (!selectId) {
|
|
9492
|
+
return;
|
|
9493
|
+
}
|
|
9494
|
+
eventBus?.emit("remove-data-source", selectId);
|
|
9495
|
+
}
|
|
9496
|
+
}
|
|
9497
|
+
];
|
|
9498
|
+
const nodeContentMenuHandler = (event, data) => {
|
|
9499
|
+
event.preventDefault();
|
|
9500
|
+
if (data.type === "ds") {
|
|
9501
|
+
menuRef.value?.show(event);
|
|
9502
|
+
if (data.id) {
|
|
9503
|
+
selectId = `${data.id}`;
|
|
9504
|
+
} else {
|
|
9505
|
+
selectId = "";
|
|
9506
|
+
}
|
|
9507
|
+
}
|
|
9508
|
+
};
|
|
9509
|
+
const contentMenuHideHandler = () => {
|
|
9510
|
+
selectId = "";
|
|
9511
|
+
};
|
|
9512
|
+
return {
|
|
9513
|
+
menuData,
|
|
9514
|
+
nodeContentMenuHandler,
|
|
9515
|
+
contentMenuHideHandler
|
|
9516
|
+
};
|
|
9517
|
+
};
|
|
9518
|
+
|
|
8873
9519
|
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
8874
|
-
const _sfc_main$
|
|
9520
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
8875
9521
|
...{
|
|
8876
9522
|
name: "MEditorDataSourceListPanel"
|
|
8877
9523
|
},
|
|
8878
9524
|
__name: "DataSourceListPanel",
|
|
8879
9525
|
props: {
|
|
8880
9526
|
indent: {},
|
|
8881
|
-
nextLevelIndentIncrement: {}
|
|
9527
|
+
nextLevelIndentIncrement: {},
|
|
9528
|
+
customContentMenu: { type: Function }
|
|
8882
9529
|
},
|
|
8883
9530
|
setup(__props) {
|
|
9531
|
+
const props = __props;
|
|
8884
9532
|
const eventBus = inject("eventBus");
|
|
8885
9533
|
const { dataSourceService } = inject("services") || {};
|
|
8886
9534
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
@@ -8905,243 +9553,100 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8905
9553
|
dialogTitle.value = `新增${datasourceType?.text || ""}`;
|
|
8906
9554
|
editDialog.value.show();
|
|
8907
9555
|
};
|
|
8908
|
-
const removeHandler = (id) => {
|
|
9556
|
+
const removeHandler = async (id) => {
|
|
9557
|
+
await tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
9558
|
+
confirmButtonText: "确定",
|
|
9559
|
+
cancelButtonText: "取消",
|
|
9560
|
+
type: "warning"
|
|
9561
|
+
});
|
|
8909
9562
|
dataSourceService?.remove(id);
|
|
8910
9563
|
};
|
|
8911
9564
|
const dataSourceList = ref();
|
|
8912
9565
|
const filterTextChangeHandler = (val) => {
|
|
8913
9566
|
dataSourceList.value?.filter(val);
|
|
8914
9567
|
};
|
|
8915
|
-
eventBus?.on("edit-data-source", (id) => {
|
|
8916
|
-
editHandler(id);
|
|
8917
|
-
});
|
|
8918
|
-
return (_ctx, _cache) => {
|
|
8919
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
8920
|
-
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8921
|
-
default: withCtx(() => [
|
|
8922
|
-
createElementVNode("div", _hoisted_1$6, [
|
|
8923
|
-
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8924
|
-
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
8925
|
-
key: 0,
|
|
8926
|
-
placement: "right",
|
|
8927
|
-
trigger: "hover",
|
|
8928
|
-
"popper-class": "data-source-list-panel-add-menu",
|
|
8929
|
-
"destroy-on-close": true
|
|
8930
|
-
}, {
|
|
8931
|
-
reference: withCtx(() => [
|
|
8932
|
-
createVNode(unref(TMagicButton), {
|
|
8933
|
-
type: "primary",
|
|
8934
|
-
size: "small"
|
|
8935
|
-
}, {
|
|
8936
|
-
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
8937
|
-
createTextVNode("新增")
|
|
8938
|
-
])),
|
|
8939
|
-
_: 1
|
|
8940
|
-
})
|
|
8941
|
-
]),
|
|
8942
|
-
default: withCtx(() => [
|
|
8943
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
8944
|
-
return openBlock(), createBlock(_sfc_main$y, {
|
|
8945
|
-
data: {
|
|
8946
|
-
type: "button",
|
|
8947
|
-
text: item.text,
|
|
8948
|
-
handler: () => {
|
|
8949
|
-
addHandler(item.type);
|
|
8950
|
-
}
|
|
8951
|
-
},
|
|
8952
|
-
key: index
|
|
8953
|
-
}, null, 8, ["data"]);
|
|
8954
|
-
}), 128))
|
|
8955
|
-
]),
|
|
8956
|
-
_: 1
|
|
8957
|
-
})) : createCommentVNode("", true),
|
|
8958
|
-
renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
8959
|
-
]),
|
|
8960
|
-
createVNode(_sfc_main$i, {
|
|
8961
|
-
ref_key: "dataSourceList",
|
|
8962
|
-
ref: dataSourceList,
|
|
8963
|
-
indent: _ctx.indent,
|
|
8964
|
-
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
8965
|
-
onEdit: unref(editHandler),
|
|
8966
|
-
onRemove: removeHandler
|
|
8967
|
-
}, null, 8, ["indent", "next-level-indent-increment", "onEdit"])
|
|
8968
|
-
]),
|
|
8969
|
-
_: 3
|
|
8970
|
-
}),
|
|
8971
|
-
createVNode(_sfc_main$j, {
|
|
8972
|
-
ref_key: "editDialog",
|
|
8973
|
-
ref: editDialog,
|
|
8974
|
-
disabled: !unref(editable),
|
|
8975
|
-
values: unref(dataSourceValues),
|
|
8976
|
-
title: unref(dialogTitle),
|
|
8977
|
-
onSubmit: unref(submitDataSourceHandler)
|
|
8978
|
-
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
8979
|
-
], 64);
|
|
8980
|
-
};
|
|
8981
|
-
}
|
|
8982
|
-
});
|
|
8983
|
-
|
|
8984
|
-
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
8985
|
-
...{
|
|
8986
|
-
name: "MEditorContentMenu"
|
|
8987
|
-
},
|
|
8988
|
-
__name: "ContentMenu",
|
|
8989
|
-
props: {
|
|
8990
|
-
menuData: { default: () => [] },
|
|
8991
|
-
isSubMenu: { type: Boolean, default: false },
|
|
8992
|
-
active: {},
|
|
8993
|
-
autoHide: { type: Boolean, default: true }
|
|
8994
|
-
},
|
|
8995
|
-
emits: ["hide", "show", "mouseenter"],
|
|
8996
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8997
|
-
const props = __props;
|
|
8998
|
-
const emit = __emit;
|
|
8999
|
-
const menu = ref();
|
|
9000
|
-
const buttons = ref();
|
|
9001
|
-
const subMenu = ref();
|
|
9002
|
-
const visible = ref(false);
|
|
9003
|
-
const subMenuData = ref([]);
|
|
9004
|
-
const zIndex = useZIndex();
|
|
9005
|
-
const curZIndex = ref(0);
|
|
9006
|
-
const menuPosition = ref({
|
|
9007
|
-
left: 0,
|
|
9008
|
-
top: 0
|
|
9009
|
-
});
|
|
9010
|
-
const menuStyle = computed(() => ({
|
|
9011
|
-
top: `${menuPosition.value.top}px`,
|
|
9012
|
-
left: `${menuPosition.value.left}px`,
|
|
9013
|
-
zIndex: curZIndex.value
|
|
9014
|
-
}));
|
|
9015
|
-
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
9016
|
-
const hide = () => {
|
|
9017
|
-
if (!visible.value) return;
|
|
9018
|
-
visible.value = false;
|
|
9019
|
-
subMenu.value?.hide();
|
|
9020
|
-
emit("hide");
|
|
9021
|
-
};
|
|
9022
|
-
const clickHandler = () => {
|
|
9023
|
-
if (!props.autoHide) return;
|
|
9024
|
-
hide();
|
|
9025
|
-
};
|
|
9026
|
-
const outsideClickHideHandler = (e) => {
|
|
9027
|
-
if (!props.autoHide) return;
|
|
9028
|
-
const target = e.target;
|
|
9029
|
-
if (!visible.value || !target) {
|
|
9030
|
-
return;
|
|
9031
|
-
}
|
|
9032
|
-
if (contains(target)) {
|
|
9033
|
-
return;
|
|
9034
|
-
}
|
|
9035
|
-
hide();
|
|
9036
|
-
};
|
|
9037
|
-
const setPosition = (e) => {
|
|
9038
|
-
const menuHeight = menu.value?.clientHeight || 0;
|
|
9039
|
-
let top = e.clientY;
|
|
9040
|
-
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
9041
|
-
top = document.body.clientHeight - menuHeight;
|
|
9042
|
-
}
|
|
9043
|
-
menuPosition.value = {
|
|
9044
|
-
top,
|
|
9045
|
-
left: e.clientX
|
|
9046
|
-
};
|
|
9047
|
-
};
|
|
9048
|
-
const show = (e) => {
|
|
9049
|
-
setTimeout(() => {
|
|
9050
|
-
visible.value = true;
|
|
9051
|
-
nextTick(() => {
|
|
9052
|
-
e && setPosition(e);
|
|
9053
|
-
curZIndex.value = zIndex.nextZIndex();
|
|
9054
|
-
emit("show");
|
|
9055
|
-
});
|
|
9056
|
-
}, 300);
|
|
9057
|
-
};
|
|
9058
|
-
const showSubMenu = (item, index) => {
|
|
9059
|
-
const menuItem = item;
|
|
9060
|
-
if (typeof item !== "object") {
|
|
9061
|
-
return;
|
|
9062
|
-
}
|
|
9063
|
-
subMenuData.value = menuItem.items || [];
|
|
9064
|
-
setTimeout(() => {
|
|
9065
|
-
if (!visible.value) {
|
|
9066
|
-
return;
|
|
9067
|
-
}
|
|
9068
|
-
if (menu.value) {
|
|
9069
|
-
let y = menu.value.offsetTop;
|
|
9070
|
-
if (buttons.value?.[index].$el) {
|
|
9071
|
-
const rect = buttons.value?.[index].$el.getBoundingClientRect();
|
|
9072
|
-
y = rect.top;
|
|
9073
|
-
}
|
|
9074
|
-
subMenu.value?.show({
|
|
9075
|
-
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
9076
|
-
clientY: y
|
|
9077
|
-
});
|
|
9078
|
-
}
|
|
9079
|
-
}, 0);
|
|
9080
|
-
};
|
|
9081
|
-
const mouseenterHandler = () => {
|
|
9082
|
-
emit("mouseenter");
|
|
9083
|
-
};
|
|
9084
|
-
onMounted(() => {
|
|
9085
|
-
if (props.isSubMenu) return;
|
|
9086
|
-
globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
|
|
9087
|
-
});
|
|
9088
|
-
onBeforeUnmount(() => {
|
|
9089
|
-
if (props.isSubMenu) return;
|
|
9090
|
-
globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
|
|
9568
|
+
eventBus?.on("edit-data-source", (id) => {
|
|
9569
|
+
editHandler(id);
|
|
9091
9570
|
});
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
menuPosition,
|
|
9095
|
-
hide,
|
|
9096
|
-
show,
|
|
9097
|
-
contains,
|
|
9098
|
-
setPosition
|
|
9571
|
+
eventBus?.on("remove-data-source", (id) => {
|
|
9572
|
+
removeHandler(id);
|
|
9099
9573
|
});
|
|
9574
|
+
const { nodeContentMenuHandler, menuData: contentMenuData, contentMenuHideHandler } = useContentMenu();
|
|
9575
|
+
const menuData = computed(
|
|
9576
|
+
() => props.customContentMenu(contentMenuData, "data-source")
|
|
9577
|
+
);
|
|
9100
9578
|
return (_ctx, _cache) => {
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
ref: menu,
|
|
9108
|
-
style: normalizeStyle(menuStyle.value),
|
|
9109
|
-
onMouseenter: _cache[0] || (_cache[0] = ($event) => mouseenterHandler())
|
|
9110
|
-
}, [
|
|
9111
|
-
renderSlot(_ctx.$slots, "title"),
|
|
9112
|
-
createElementVNode("div", null, [
|
|
9113
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
9114
|
-
return openBlock(), createBlock(_sfc_main$y, {
|
|
9115
|
-
"event-type": "mouseup",
|
|
9116
|
-
ref_for: true,
|
|
9117
|
-
ref_key: "buttons",
|
|
9118
|
-
ref: buttons,
|
|
9119
|
-
class: normalizeClass({ active: _ctx.active && item.id === _ctx.active }),
|
|
9120
|
-
data: item,
|
|
9121
|
-
key: index,
|
|
9122
|
-
onMouseup: clickHandler,
|
|
9123
|
-
onMouseenter: ($event) => showSubMenu(item, index)
|
|
9124
|
-
}, null, 8, ["class", "data", "onMouseenter"]);
|
|
9125
|
-
}), 128))
|
|
9126
|
-
]),
|
|
9127
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
9128
|
-
subMenuData.value.length ? (openBlock(), createBlock(_component_content_menu, {
|
|
9579
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
9580
|
+
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
9581
|
+
default: withCtx(() => [
|
|
9582
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
9583
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
9584
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
9129
9585
|
key: 0,
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9586
|
+
placement: "right",
|
|
9587
|
+
trigger: "hover",
|
|
9588
|
+
"popper-class": "data-source-list-panel-add-menu",
|
|
9589
|
+
"destroy-on-close": true
|
|
9590
|
+
}, {
|
|
9591
|
+
reference: withCtx(() => [
|
|
9592
|
+
createVNode(unref(TMagicButton), {
|
|
9593
|
+
type: "primary",
|
|
9594
|
+
size: "small"
|
|
9595
|
+
}, {
|
|
9596
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
9597
|
+
createTextVNode("新增")
|
|
9598
|
+
])),
|
|
9599
|
+
_: 1
|
|
9600
|
+
})
|
|
9601
|
+
]),
|
|
9602
|
+
default: withCtx(() => [
|
|
9603
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
9604
|
+
return openBlock(), createBlock(_sfc_main$z, {
|
|
9605
|
+
data: {
|
|
9606
|
+
type: "button",
|
|
9607
|
+
text: item.text,
|
|
9608
|
+
handler: () => {
|
|
9609
|
+
addHandler(item.type);
|
|
9610
|
+
}
|
|
9611
|
+
},
|
|
9612
|
+
key: index
|
|
9613
|
+
}, null, 8, ["data"]);
|
|
9614
|
+
}), 128))
|
|
9615
|
+
]),
|
|
9616
|
+
_: 1
|
|
9617
|
+
})) : createCommentVNode("", true),
|
|
9618
|
+
renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
9619
|
+
]),
|
|
9620
|
+
createVNode(_sfc_main$h, {
|
|
9621
|
+
ref_key: "dataSourceList",
|
|
9622
|
+
ref: dataSourceList,
|
|
9623
|
+
indent: _ctx.indent,
|
|
9624
|
+
"next-level-indent-increment": _ctx.nextLevelIndentIncrement,
|
|
9625
|
+
onEdit: unref(editHandler),
|
|
9626
|
+
onRemove: removeHandler,
|
|
9627
|
+
onNodeContextmenu: unref(nodeContentMenuHandler)
|
|
9628
|
+
}, null, 8, ["indent", "next-level-indent-increment", "onEdit", "onNodeContextmenu"])
|
|
9629
|
+
]),
|
|
9630
|
+
_: 3
|
|
9631
|
+
}),
|
|
9632
|
+
createVNode(_sfc_main$i, {
|
|
9633
|
+
ref_key: "editDialog",
|
|
9634
|
+
ref: editDialog,
|
|
9635
|
+
disabled: !unref(editable),
|
|
9636
|
+
values: unref(dataSourceValues),
|
|
9637
|
+
title: unref(dialogTitle),
|
|
9638
|
+
onSubmit: unref(submitDataSourceHandler)
|
|
9639
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"]),
|
|
9640
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
9641
|
+
menuData.value.length ? (openBlock(), createBlock(_sfc_main$o, {
|
|
9642
|
+
key: 0,
|
|
9643
|
+
"menu-data": menuData.value,
|
|
9644
|
+
ref: "menu",
|
|
9645
|
+
style: { "overflow": "initial" },
|
|
9646
|
+
onHide: unref(contentMenuHideHandler)
|
|
9647
|
+
}, null, 8, ["menu-data", "onHide"])) : createCommentVNode("", true)
|
|
9648
|
+
]))
|
|
9649
|
+
], 64);
|
|
9145
9650
|
};
|
|
9146
9651
|
}
|
|
9147
9652
|
});
|
|
@@ -9251,15 +9756,15 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
9251
9756
|
},
|
|
9252
9757
|
__name: "LayerMenu",
|
|
9253
9758
|
props: {
|
|
9254
|
-
layerContentMenu: {
|
|
9255
|
-
customContentMenu: { type: Function
|
|
9759
|
+
layerContentMenu: {},
|
|
9760
|
+
customContentMenu: { type: Function }
|
|
9256
9761
|
},
|
|
9257
9762
|
emits: ["collapse-all"],
|
|
9258
9763
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
9259
9764
|
const props = __props;
|
|
9260
9765
|
const emit = __emit;
|
|
9261
9766
|
const services = inject("services");
|
|
9262
|
-
const menu =
|
|
9767
|
+
const menu = useTemplateRef("menu");
|
|
9263
9768
|
const node = computed(() => services?.editorService.get("node"));
|
|
9264
9769
|
const nodes = computed(() => services?.editorService.get("nodes"));
|
|
9265
9770
|
const componentList = computed(() => services?.componentListService.getList() || []);
|
|
@@ -9341,7 +9846,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
9341
9846
|
show
|
|
9342
9847
|
});
|
|
9343
9848
|
return (_ctx, _cache) => {
|
|
9344
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9849
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
9345
9850
|
"menu-data": menuData.value,
|
|
9346
9851
|
ref_key: "menu",
|
|
9347
9852
|
ref: menu,
|
|
@@ -9369,12 +9874,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
9369
9874
|
};
|
|
9370
9875
|
return (_ctx, _cache) => {
|
|
9371
9876
|
return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
9372
|
-
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$
|
|
9877
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$Z, {
|
|
9373
9878
|
key: 0,
|
|
9374
9879
|
icon: unref(Hide),
|
|
9375
9880
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
9376
9881
|
title: "点击显示"
|
|
9377
|
-
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$
|
|
9882
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$Z, {
|
|
9378
9883
|
key: 1,
|
|
9379
9884
|
icon: unref(View),
|
|
9380
9885
|
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -9451,7 +9956,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
|
|
|
9451
9956
|
select(data);
|
|
9452
9957
|
});
|
|
9453
9958
|
};
|
|
9454
|
-
const menu =
|
|
9959
|
+
const menu = useTemplateRef("menu");
|
|
9455
9960
|
return {
|
|
9456
9961
|
menu,
|
|
9457
9962
|
nodeClickHandler,
|
|
@@ -9862,7 +10367,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
9862
10367
|
setup(__props) {
|
|
9863
10368
|
const services = inject("services");
|
|
9864
10369
|
const editorService = services?.editorService;
|
|
9865
|
-
const tree =
|
|
10370
|
+
const tree = useTemplateRef("tree");
|
|
9866
10371
|
const page = computed(() => editorService?.get("page"));
|
|
9867
10372
|
const nodeData = computed(() => !page.value ? [] : [page.value]);
|
|
9868
10373
|
const { nodeStatusMap } = useNodeStatus(services);
|
|
@@ -9898,8 +10403,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
9898
10403
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9899
10404
|
default: withCtx(() => [
|
|
9900
10405
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9901
|
-
createVNode(_sfc_main$
|
|
9902
|
-
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$
|
|
10406
|
+
createVNode(_sfc_main$n, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
10407
|
+
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$l, {
|
|
9903
10408
|
key: 0,
|
|
9904
10409
|
tabindex: "-1",
|
|
9905
10410
|
ref_key: "tree",
|
|
@@ -10021,7 +10526,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
10021
10526
|
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
10022
10527
|
default: withCtx(() => [
|
|
10023
10528
|
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
10024
|
-
createVNode(_sfc_main$
|
|
10529
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
10025
10530
|
renderSlot(_ctx.$slots, "component-list", { componentGroupList: list.value }, () => [
|
|
10026
10531
|
createVNode(unref(TMagicCollapse), {
|
|
10027
10532
|
class: "ui-component-panel",
|
|
@@ -10035,7 +10540,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
10035
10540
|
name: `${index}`
|
|
10036
10541
|
}, {
|
|
10037
10542
|
title: withCtx(() => [
|
|
10038
|
-
createVNode(_sfc_main$
|
|
10543
|
+
createVNode(_sfc_main$Z, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
10039
10544
|
createTextVNode(toDisplayString(group.title), 1)
|
|
10040
10545
|
]),
|
|
10041
10546
|
default: withCtx(() => [
|
|
@@ -10056,7 +10561,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
10056
10561
|
content: item.desc
|
|
10057
10562
|
}, {
|
|
10058
10563
|
default: withCtx(() => [
|
|
10059
|
-
createVNode(_sfc_main$
|
|
10564
|
+
createVNode(_sfc_main$Z, {
|
|
10060
10565
|
icon: item.icon
|
|
10061
10566
|
}, null, 8, ["icon"])
|
|
10062
10567
|
]),
|
|
@@ -10114,6 +10619,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10114
10619
|
setup(__props, { expose: __expose }) {
|
|
10115
10620
|
const props = __props;
|
|
10116
10621
|
const services = inject("services");
|
|
10622
|
+
const collecting = computed(() => services?.depService.get("collecting"));
|
|
10117
10623
|
const columnLeftWidth = computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
|
|
10118
10624
|
const { height: editorContentHeight } = useEditorContentHeight();
|
|
10119
10625
|
const columnLeftHeight = ref(0);
|
|
@@ -10161,10 +10667,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10161
10667
|
type: "component",
|
|
10162
10668
|
icon: EditPen,
|
|
10163
10669
|
text: "代码编辑",
|
|
10164
|
-
component: _sfc_main$
|
|
10670
|
+
component: _sfc_main$j,
|
|
10165
10671
|
props: {
|
|
10166
10672
|
indent: props.indent,
|
|
10167
|
-
nextLevelIndentIncrement: props.nextLevelIndentIncrement
|
|
10673
|
+
nextLevelIndentIncrement: props.nextLevelIndentIncrement,
|
|
10674
|
+
customContentMenu: props.customContentMenu
|
|
10168
10675
|
},
|
|
10169
10676
|
slots: {}
|
|
10170
10677
|
},
|
|
@@ -10173,10 +10680,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10173
10680
|
type: "component",
|
|
10174
10681
|
icon: Coin,
|
|
10175
10682
|
text: "数据源",
|
|
10176
|
-
component: _sfc_main$
|
|
10683
|
+
component: _sfc_main$g,
|
|
10177
10684
|
props: {
|
|
10178
10685
|
indent: props.indent,
|
|
10179
|
-
nextLevelIndentIncrement: props.nextLevelIndentIncrement
|
|
10686
|
+
nextLevelIndentIncrement: props.nextLevelIndentIncrement,
|
|
10687
|
+
customContentMenu: props.customContentMenu
|
|
10180
10688
|
},
|
|
10181
10689
|
slots: {}
|
|
10182
10690
|
}
|
|
@@ -10244,7 +10752,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10244
10752
|
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
10245
10753
|
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
10246
10754
|
}, [
|
|
10247
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
10755
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$Z, {
|
|
10248
10756
|
key: 0,
|
|
10249
10757
|
icon: config.icon
|
|
10250
10758
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -10256,7 +10764,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10256
10764
|
]),
|
|
10257
10765
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
10258
10766
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
10259
|
-
class: "m-editor-sidebar-content",
|
|
10767
|
+
class: normalizeClass(["m-editor-sidebar-content", { "m-editor-dep-collecting": collecting.value }]),
|
|
10260
10768
|
key: config.$key ?? index
|
|
10261
10769
|
}, [
|
|
10262
10770
|
config?.component && !unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
|
|
@@ -10382,7 +10890,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10382
10890
|
key: "11"
|
|
10383
10891
|
} : void 0
|
|
10384
10892
|
]), 1040)) : createCommentVNode("", true)
|
|
10385
|
-
])), [
|
|
10893
|
+
], 2)), [
|
|
10386
10894
|
[vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
|
|
10387
10895
|
]);
|
|
10388
10896
|
}), 128))
|
|
@@ -10390,7 +10898,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10390
10898
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
10391
10899
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
10392
10900
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
10393
|
-
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$
|
|
10901
|
+
unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$R, {
|
|
10394
10902
|
key: config.$key ?? index,
|
|
10395
10903
|
visible: unref(floatBoxStates)[config.$key].status,
|
|
10396
10904
|
"onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
|
|
@@ -10436,8 +10944,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
10436
10944
|
setup(__props, { emit: __emit }) {
|
|
10437
10945
|
const props = __props;
|
|
10438
10946
|
const emit = __emit;
|
|
10439
|
-
const bar =
|
|
10440
|
-
const thumb =
|
|
10947
|
+
const bar = useTemplateRef("bar");
|
|
10948
|
+
const thumb = useTemplateRef("thumb");
|
|
10441
10949
|
const thumbSize = computed(() => props.size * (props.size / props.scrollSize));
|
|
10442
10950
|
const thumbPos = computed(() => props.pos / props.scrollSize * props.size);
|
|
10443
10951
|
const thumbStyle = computed(() => ({
|
|
@@ -10525,8 +11033,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10525
11033
|
},
|
|
10526
11034
|
setup(__props, { expose: __expose }) {
|
|
10527
11035
|
const props = __props;
|
|
10528
|
-
const container =
|
|
10529
|
-
const el =
|
|
11036
|
+
const container = useTemplateRef("container");
|
|
11037
|
+
const el = useTemplateRef("el");
|
|
10530
11038
|
const style = computed(
|
|
10531
11039
|
() => `
|
|
10532
11040
|
width: ${isNumber(`${props.width}`) ? `${props.width}px` : props.width};
|
|
@@ -10620,8 +11128,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10620
11128
|
const editorService = services?.editorService;
|
|
10621
11129
|
const visible = ref(false);
|
|
10622
11130
|
const buttonVisible = ref(false);
|
|
10623
|
-
const button =
|
|
10624
|
-
const box =
|
|
11131
|
+
const button = useTemplateRef("button");
|
|
11132
|
+
const box = useTemplateRef("box");
|
|
10625
11133
|
const stage = computed(() => editorService?.get("stage"));
|
|
10626
11134
|
const page = computed(() => editorService?.get("page"));
|
|
10627
11135
|
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
@@ -10693,7 +11201,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10693
11201
|
]),
|
|
10694
11202
|
_: 1
|
|
10695
11203
|
})) : createCommentVNode("", true),
|
|
10696
|
-
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
11204
|
+
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$R, {
|
|
10697
11205
|
key: 1,
|
|
10698
11206
|
ref_key: "box",
|
|
10699
11207
|
ref: box,
|
|
@@ -10703,7 +11211,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10703
11211
|
position: menuPosition.value
|
|
10704
11212
|
}, {
|
|
10705
11213
|
body: withCtx(() => [
|
|
10706
|
-
createVNode(_sfc_main$
|
|
11214
|
+
createVNode(_sfc_main$l, {
|
|
10707
11215
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10708
11216
|
data: nodeData.value,
|
|
10709
11217
|
"node-status-map": unref(nodeStatusMap),
|
|
@@ -10722,7 +11230,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
10722
11230
|
setup(__props) {
|
|
10723
11231
|
const services = inject("services");
|
|
10724
11232
|
const stageOptions = inject("stageOptions");
|
|
10725
|
-
const stageOverlay =
|
|
11233
|
+
const stageOverlay = useTemplateRef("stageOverlay");
|
|
10726
11234
|
const stageOverlayVisible = computed(() => services?.stageOverlayService.get("stageOverlayVisible"));
|
|
10727
11235
|
const wrapWidth = computed(() => services?.stageOverlayService.get("wrapWidth") || 0);
|
|
10728
11236
|
const wrapHeight = computed(() => services?.stageOverlayService.get("wrapHeight") || 0);
|
|
@@ -10836,14 +11344,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
10836
11344
|
__name: "ViewerMenu",
|
|
10837
11345
|
props: {
|
|
10838
11346
|
isMultiSelect: { type: Boolean, default: false },
|
|
10839
|
-
stageContentMenu: {
|
|
10840
|
-
customContentMenu: {
|
|
11347
|
+
stageContentMenu: {},
|
|
11348
|
+
customContentMenu: {}
|
|
10841
11349
|
},
|
|
10842
11350
|
setup(__props, { expose: __expose }) {
|
|
10843
11351
|
const props = __props;
|
|
10844
11352
|
const services = inject("services");
|
|
10845
11353
|
const editorService = services?.editorService;
|
|
10846
|
-
const menu =
|
|
11354
|
+
const menu = useTemplateRef("menu");
|
|
10847
11355
|
const canCenter = ref(false);
|
|
10848
11356
|
const node = computed(() => editorService?.get("node"));
|
|
10849
11357
|
const nodes = computed(() => editorService?.get("nodes"));
|
|
@@ -10948,7 +11456,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
10948
11456
|
};
|
|
10949
11457
|
__expose({ show });
|
|
10950
11458
|
return (_ctx, _cache) => {
|
|
10951
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11459
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
10952
11460
|
"menu-data": menuData.value,
|
|
10953
11461
|
ref_key: "menu",
|
|
10954
11462
|
ref: menu
|
|
@@ -10963,18 +11471,20 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10963
11471
|
},
|
|
10964
11472
|
__name: "Stage",
|
|
10965
11473
|
props: {
|
|
11474
|
+
stageOptions: {},
|
|
10966
11475
|
stageContentMenu: {},
|
|
10967
11476
|
disabledStageOverlay: { type: Boolean, default: false },
|
|
10968
11477
|
customContentMenu: {}
|
|
10969
11478
|
},
|
|
10970
11479
|
setup(__props) {
|
|
11480
|
+
const props = __props;
|
|
10971
11481
|
let stage = null;
|
|
10972
11482
|
let runtime = null;
|
|
10973
11483
|
const services = inject("services");
|
|
10974
|
-
const
|
|
10975
|
-
const stageWrap =
|
|
10976
|
-
const stageContainer =
|
|
10977
|
-
const menu =
|
|
11484
|
+
const stageLoading = computed(() => services?.editorService.get("stageLoading") || false);
|
|
11485
|
+
const stageWrap = useTemplateRef("stageWrap");
|
|
11486
|
+
const stageContainer = useTemplateRef("stageContainer");
|
|
11487
|
+
const menu = useTemplateRef("menu");
|
|
10978
11488
|
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
10979
11489
|
const isMultiSelect = computed(() => nodes.value.length > 1);
|
|
10980
11490
|
const stageRect = computed(() => services?.uiService.get("stageRect"));
|
|
@@ -10986,8 +11496,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10986
11496
|
watchEffect(() => {
|
|
10987
11497
|
if (stage || !page.value) return;
|
|
10988
11498
|
if (!stageContainer.value) return;
|
|
10989
|
-
if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value) return;
|
|
10990
|
-
stage = useStage(stageOptions);
|
|
11499
|
+
if (!(props.stageOptions?.runtimeUrl || props.stageOptions?.render) || !root.value) return;
|
|
11500
|
+
stage = useStage(props.stageOptions);
|
|
10991
11501
|
stage.on("select", () => {
|
|
10992
11502
|
stageWrap.value?.container?.focus();
|
|
10993
11503
|
});
|
|
@@ -11007,14 +11517,23 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11007
11517
|
});
|
|
11008
11518
|
onBeforeUnmount(() => {
|
|
11009
11519
|
stage?.destroy();
|
|
11520
|
+
services?.editorService.set("stage", null);
|
|
11010
11521
|
});
|
|
11011
11522
|
watch(zoom, (zoom2) => {
|
|
11012
11523
|
if (!stage || !zoom2) return;
|
|
11013
11524
|
stage.setZoom(zoom2);
|
|
11014
11525
|
});
|
|
11526
|
+
let timeoutId = null;
|
|
11015
11527
|
watch(page, (page2) => {
|
|
11016
11528
|
if (runtime && page2) {
|
|
11017
11529
|
services?.editorService.set("stageLoading", true);
|
|
11530
|
+
if (timeoutId) {
|
|
11531
|
+
globalThis.clearTimeout(timeoutId);
|
|
11532
|
+
}
|
|
11533
|
+
timeoutId = globalThis.setTimeout(() => {
|
|
11534
|
+
services?.editorService.set("stageLoading", false);
|
|
11535
|
+
timeoutId = null;
|
|
11536
|
+
}, 3e3);
|
|
11018
11537
|
runtime.updatePageId?.(page2.id);
|
|
11019
11538
|
nextTick(() => {
|
|
11020
11539
|
stage?.select(page2.id);
|
|
@@ -11066,7 +11585,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11066
11585
|
if (!config || config.dragType !== DragType.COMPONENT_LIST) return;
|
|
11067
11586
|
e.preventDefault();
|
|
11068
11587
|
const doc = stage?.renderer?.contentWindow?.document;
|
|
11069
|
-
const parentEl = doc?.querySelector(
|
|
11588
|
+
const parentEl = doc?.querySelector(
|
|
11589
|
+
`.${props.stageOptions?.containerHighlightClassName}`
|
|
11590
|
+
);
|
|
11070
11591
|
let parent = page.value;
|
|
11071
11592
|
const parentId = getIdFromEl()(parentEl);
|
|
11072
11593
|
if (parentId) {
|
|
@@ -11105,11 +11626,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11105
11626
|
}
|
|
11106
11627
|
};
|
|
11107
11628
|
return (_ctx, _cache) => {
|
|
11108
|
-
|
|
11629
|
+
const _directive_loading = resolveDirective("loading");
|
|
11630
|
+
return withDirectives((openBlock(), createBlock(_sfc_main$8, {
|
|
11109
11631
|
class: "m-editor-stage",
|
|
11110
11632
|
ref_key: "stageWrap",
|
|
11111
11633
|
ref: stageWrap,
|
|
11112
11634
|
tabindex: "-1",
|
|
11635
|
+
"element-loading-text": "Runtime 加载中...",
|
|
11113
11636
|
width: stageRect.value?.width,
|
|
11114
11637
|
height: stageRect.value?.height,
|
|
11115
11638
|
"wrap-width": stageContainerRect.value?.width,
|
|
@@ -11119,7 +11642,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11119
11642
|
width: 60,
|
|
11120
11643
|
height: 50
|
|
11121
11644
|
},
|
|
11122
|
-
onClick: _cache[0] || (_cache[0] = ($event) => stageWrap
|
|
11645
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(stageWrap)?.container?.focus())
|
|
11123
11646
|
}, {
|
|
11124
11647
|
content: withCtx(() => [
|
|
11125
11648
|
!_ctx.disabledStageOverlay ? (openBlock(), createBlock(_sfc_main$6, { key: 0 })) : createCommentVNode("", true),
|
|
@@ -11146,7 +11669,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11146
11669
|
createVNode(_sfc_main$7)
|
|
11147
11670
|
]),
|
|
11148
11671
|
_: 1
|
|
11149
|
-
}, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"])
|
|
11672
|
+
}, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"])), [
|
|
11673
|
+
[_directive_loading, stageLoading.value]
|
|
11674
|
+
]);
|
|
11150
11675
|
};
|
|
11151
11676
|
}
|
|
11152
11677
|
});
|
|
@@ -11208,18 +11733,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
11208
11733
|
customContentMenu: {}
|
|
11209
11734
|
},
|
|
11210
11735
|
setup(__props) {
|
|
11736
|
+
const stageOptions = inject("stageOptions");
|
|
11211
11737
|
const services = inject("services");
|
|
11212
11738
|
const page = computed(() => services?.editorService.get("page"));
|
|
11213
11739
|
return (_ctx, _cache) => {
|
|
11214
11740
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
11215
11741
|
createVNode(_sfc_main$2),
|
|
11216
11742
|
renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
11217
|
-
page.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
11743
|
+
page.value && (unref(stageOptions)?.render || unref(stageOptions)?.runtimeUrl) ? (openBlock(), createBlock(_sfc_main$3, {
|
|
11218
11744
|
key: 0,
|
|
11745
|
+
"stage-options": unref(stageOptions),
|
|
11219
11746
|
"disabled-stage-overlay": _ctx.disabledStageOverlay,
|
|
11220
11747
|
"stage-content-menu": _ctx.stageContentMenu,
|
|
11221
11748
|
"custom-content-menu": _ctx.customContentMenu
|
|
11222
|
-
}, null, 8, ["disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : createCommentVNode("", true)
|
|
11749
|
+
}, null, 8, ["stage-options", "disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : createCommentVNode("", true)
|
|
11223
11750
|
]),
|
|
11224
11751
|
renderSlot(_ctx.$slots, "workspace-content")
|
|
11225
11752
|
]);
|
|
@@ -11569,12 +12096,17 @@ class DataSource extends BaseService {
|
|
|
11569
12096
|
this.emit("add", newConfig);
|
|
11570
12097
|
return newConfig;
|
|
11571
12098
|
}
|
|
11572
|
-
update(config) {
|
|
12099
|
+
update(config, { changeRecords = [] } = {}) {
|
|
11573
12100
|
const dataSources = this.get("dataSources");
|
|
11574
12101
|
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
11575
|
-
dataSources[index]
|
|
11576
|
-
|
|
11577
|
-
|
|
12102
|
+
const oldConfig = dataSources[index];
|
|
12103
|
+
const newConfig = cloneDeep(config);
|
|
12104
|
+
dataSources[index] = newConfig;
|
|
12105
|
+
this.emit("update", newConfig, {
|
|
12106
|
+
oldConfig,
|
|
12107
|
+
changeRecords
|
|
12108
|
+
});
|
|
12109
|
+
return newConfig;
|
|
11578
12110
|
}
|
|
11579
12111
|
remove(id) {
|
|
11580
12112
|
const dataSources = this.get("dataSources");
|
|
@@ -11650,7 +12182,16 @@ const dataSourceService = new DataSource();
|
|
|
11650
12182
|
|
|
11651
12183
|
const idleTask = new IdleTask();
|
|
11652
12184
|
class Dep extends BaseService {
|
|
12185
|
+
state = reactive({
|
|
12186
|
+
collecting: false
|
|
12187
|
+
});
|
|
11653
12188
|
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
12189
|
+
set(name, value) {
|
|
12190
|
+
this.state[name] = value;
|
|
12191
|
+
}
|
|
12192
|
+
get(name) {
|
|
12193
|
+
return this.state[name];
|
|
12194
|
+
}
|
|
11654
12195
|
removeTargets(type = DepTargetType.DEFAULT) {
|
|
11655
12196
|
this.watcher.removeTargets(type);
|
|
11656
12197
|
const targets = this.watcher.getTargets(type);
|
|
@@ -11677,26 +12218,32 @@ class Dep extends BaseService {
|
|
|
11677
12218
|
this.watcher.clearTargets();
|
|
11678
12219
|
}
|
|
11679
12220
|
collect(nodes, depExtendedData = {}, deep = false, type) {
|
|
12221
|
+
this.set("collecting", true);
|
|
11680
12222
|
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
|
|
11681
12223
|
this.collectNode(node, target, depExtendedData, deep);
|
|
11682
12224
|
});
|
|
12225
|
+
this.set("collecting", false);
|
|
11683
12226
|
this.emit("collected", nodes, deep);
|
|
11684
12227
|
}
|
|
11685
12228
|
collectIdle(nodes, depExtendedData = {}, deep = false, type) {
|
|
12229
|
+
this.set("collecting", true);
|
|
12230
|
+
let startTask = false;
|
|
11686
12231
|
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
12232
|
+
startTask = true;
|
|
12233
|
+
this.enqueueTask(node, target, depExtendedData, deep);
|
|
12234
|
+
});
|
|
12235
|
+
return new Promise((resolve) => {
|
|
12236
|
+
if (!startTask) {
|
|
12237
|
+
this.emit("collected", nodes, deep);
|
|
12238
|
+
this.set("collecting", false);
|
|
12239
|
+
resolve();
|
|
12240
|
+
return;
|
|
12241
|
+
}
|
|
12242
|
+
idleTask.once("finish", () => {
|
|
12243
|
+
this.emit("collected", nodes, deep);
|
|
12244
|
+
this.set("collecting", false);
|
|
12245
|
+
resolve();
|
|
12246
|
+
});
|
|
11700
12247
|
});
|
|
11701
12248
|
}
|
|
11702
12249
|
collectNode(node, target, depExtendedData = {}, deep = false) {
|
|
@@ -11723,6 +12270,9 @@ class Dep extends BaseService {
|
|
|
11723
12270
|
hasSpecifiedTypeTarget(type = DepTargetType.DEFAULT) {
|
|
11724
12271
|
return this.watcher.hasSpecifiedTypeTarget(type);
|
|
11725
12272
|
}
|
|
12273
|
+
clearIdleTasks() {
|
|
12274
|
+
idleTask.clearTasks();
|
|
12275
|
+
}
|
|
11726
12276
|
on(eventName, listener) {
|
|
11727
12277
|
return super.on(eventName, listener);
|
|
11728
12278
|
}
|
|
@@ -11732,6 +12282,23 @@ class Dep extends BaseService {
|
|
|
11732
12282
|
emit(eventName, ...args) {
|
|
11733
12283
|
return super.emit(eventName, ...args);
|
|
11734
12284
|
}
|
|
12285
|
+
enqueueTask(node, target, depExtendedData, deep) {
|
|
12286
|
+
idleTask.enqueueTask(
|
|
12287
|
+
({ node: node2, deep: deep2, target: target2 }) => {
|
|
12288
|
+
this.collectNode(node2, target2, depExtendedData, deep2);
|
|
12289
|
+
},
|
|
12290
|
+
{
|
|
12291
|
+
node,
|
|
12292
|
+
deep: false,
|
|
12293
|
+
target
|
|
12294
|
+
}
|
|
12295
|
+
);
|
|
12296
|
+
if (deep && Array.isArray(node.items) && node.items.length) {
|
|
12297
|
+
node.items.forEach((item) => {
|
|
12298
|
+
this.enqueueTask(item, target, depExtendedData, deep);
|
|
12299
|
+
});
|
|
12300
|
+
}
|
|
12301
|
+
}
|
|
11735
12302
|
}
|
|
11736
12303
|
const depService = new Dep();
|
|
11737
12304
|
|
|
@@ -12148,7 +12715,8 @@ const defaultEditorProps = {
|
|
|
12148
12715
|
datasourceConfigs: () => ({}),
|
|
12149
12716
|
canSelect: (el) => Boolean(getIdFromEl()(el)),
|
|
12150
12717
|
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
12151
|
-
codeOptions: () => ({})
|
|
12718
|
+
codeOptions: () => ({}),
|
|
12719
|
+
customContentMenu: (menus) => menus
|
|
12152
12720
|
};
|
|
12153
12721
|
|
|
12154
12722
|
const initServiceState = (props, {
|
|
@@ -12305,6 +12873,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12305
12873
|
initDataSourceDepTarget(ds);
|
|
12306
12874
|
});
|
|
12307
12875
|
if (Array.isArray(value.items)) {
|
|
12876
|
+
depService.clearIdleTasks();
|
|
12308
12877
|
collectIdle(value.items, true);
|
|
12309
12878
|
} else {
|
|
12310
12879
|
depService.clear();
|
|
@@ -12329,15 +12898,66 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12329
12898
|
emit("update:modelValue", value);
|
|
12330
12899
|
}
|
|
12331
12900
|
};
|
|
12332
|
-
const
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12901
|
+
const stage = computed(() => editorService.get("stage"));
|
|
12902
|
+
watch(stage, (stage2) => {
|
|
12903
|
+
if (!stage2) {
|
|
12904
|
+
return;
|
|
12905
|
+
}
|
|
12906
|
+
stage2.on("rerender", () => {
|
|
12907
|
+
const node = editorService.get("node");
|
|
12908
|
+
if (!node) return;
|
|
12909
|
+
collectIdle([node], true).then(() => {
|
|
12910
|
+
afterUpdateNodes([node]);
|
|
12911
|
+
});
|
|
12912
|
+
});
|
|
12913
|
+
});
|
|
12914
|
+
const getApp = () => stage.value?.renderer?.runtime?.getApp?.();
|
|
12915
|
+
const updateDataSourceSchema = (nodes, deep) => {
|
|
12337
12916
|
const root = editorService.get("root");
|
|
12917
|
+
const app = getApp();
|
|
12918
|
+
if (root && app?.dsl) {
|
|
12919
|
+
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12920
|
+
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
12921
|
+
app.dsl.dataSources = root.dataSources;
|
|
12922
|
+
}
|
|
12338
12923
|
if (root?.dataSources) {
|
|
12339
12924
|
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
12340
12925
|
}
|
|
12926
|
+
if (!root || !stage.value) return;
|
|
12927
|
+
const allNodes = [];
|
|
12928
|
+
if (deep) {
|
|
12929
|
+
nodes.forEach((node) => {
|
|
12930
|
+
traverseNode(node, (node2) => {
|
|
12931
|
+
if (!allNodes.includes(node2)) {
|
|
12932
|
+
allNodes.push(node2);
|
|
12933
|
+
}
|
|
12934
|
+
});
|
|
12935
|
+
});
|
|
12936
|
+
} else {
|
|
12937
|
+
allNodes.push(...nodes);
|
|
12938
|
+
}
|
|
12939
|
+
const deps = Object.values(root.dataSourceDeps || {});
|
|
12940
|
+
deps.forEach((dep) => {
|
|
12941
|
+
Object.keys(dep).forEach((id) => {
|
|
12942
|
+
const node = allNodes.find((node2) => node2.id === id);
|
|
12943
|
+
node && stage.value?.update({
|
|
12944
|
+
config: cloneDeep(node),
|
|
12945
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
12946
|
+
root: cloneDeep(root)
|
|
12947
|
+
});
|
|
12948
|
+
});
|
|
12949
|
+
});
|
|
12950
|
+
};
|
|
12951
|
+
const afterUpdateNodes = (nodes) => {
|
|
12952
|
+
const root = editorService.get("root");
|
|
12953
|
+
if (!root) return;
|
|
12954
|
+
for (const node of nodes) {
|
|
12955
|
+
stage.value?.update({
|
|
12956
|
+
config: cloneDeep(node),
|
|
12957
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
12958
|
+
root: cloneDeep(root)
|
|
12959
|
+
});
|
|
12960
|
+
}
|
|
12341
12961
|
};
|
|
12342
12962
|
const targetAddHandler = (target) => {
|
|
12343
12963
|
const root = editorService.get("root");
|
|
@@ -12357,59 +12977,32 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12357
12977
|
};
|
|
12358
12978
|
const targetRemoveHandler = (id) => {
|
|
12359
12979
|
const root = editorService.get("root");
|
|
12360
|
-
if (root
|
|
12980
|
+
if (!root) return;
|
|
12981
|
+
if (root.dataSourceDeps) {
|
|
12361
12982
|
delete root.dataSourceDeps[id];
|
|
12362
12983
|
}
|
|
12363
|
-
if (root
|
|
12984
|
+
if (root.dataSourceCondDeps) {
|
|
12364
12985
|
delete root.dataSourceCondDeps[id];
|
|
12365
12986
|
}
|
|
12366
12987
|
};
|
|
12367
|
-
const
|
|
12988
|
+
const depCollectedHandler = () => {
|
|
12368
12989
|
const root = editorService.get("root");
|
|
12369
|
-
|
|
12370
|
-
if (!root || !stage) return;
|
|
12990
|
+
if (!root) return;
|
|
12371
12991
|
const app = getApp();
|
|
12372
|
-
if (
|
|
12373
|
-
if (app.dsl) {
|
|
12992
|
+
if (app?.dsl) {
|
|
12374
12993
|
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12375
|
-
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
12376
|
-
app.dsl.dataSources = root.dataSources;
|
|
12377
|
-
}
|
|
12378
|
-
updateDataSourceSchema();
|
|
12379
|
-
const allNodes = [];
|
|
12380
|
-
if (deep) {
|
|
12381
|
-
nodes.forEach((node) => {
|
|
12382
|
-
traverseNode(node, (node2) => {
|
|
12383
|
-
if (!allNodes.includes(node2)) {
|
|
12384
|
-
allNodes.push(node2);
|
|
12385
|
-
}
|
|
12386
|
-
});
|
|
12387
|
-
});
|
|
12388
|
-
} else {
|
|
12389
|
-
allNodes.push(...nodes);
|
|
12390
12994
|
}
|
|
12391
|
-
const deps = Object.values(root.dataSourceDeps || {});
|
|
12392
|
-
deps.forEach((dep) => {
|
|
12393
|
-
Object.keys(dep).forEach((id) => {
|
|
12394
|
-
const node = allNodes.find((node2) => node2.id === id);
|
|
12395
|
-
node && stage.update({
|
|
12396
|
-
config: cloneDeep(node),
|
|
12397
|
-
parentId: editorService.getParentById(node.id)?.id,
|
|
12398
|
-
root: cloneDeep(root)
|
|
12399
|
-
});
|
|
12400
|
-
});
|
|
12401
|
-
});
|
|
12402
12995
|
};
|
|
12403
12996
|
depService.on("add-target", targetAddHandler);
|
|
12404
12997
|
depService.on("remove-target", targetRemoveHandler);
|
|
12405
|
-
depService.on("collected",
|
|
12998
|
+
depService.on("collected", depCollectedHandler);
|
|
12406
12999
|
const initDataSourceDepTarget = (ds) => {
|
|
12407
13000
|
depService.addTarget(createDataSourceTarget(ds, reactive({})));
|
|
12408
13001
|
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
12409
13002
|
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
12410
13003
|
};
|
|
12411
|
-
const collectIdle = (nodes, deep) =>
|
|
12412
|
-
nodes.
|
|
13004
|
+
const collectIdle = (nodes, deep) => Promise.all(
|
|
13005
|
+
nodes.map((node) => {
|
|
12413
13006
|
let pageId;
|
|
12414
13007
|
if (isPage(node)) {
|
|
12415
13008
|
pageId = node.id;
|
|
@@ -12417,20 +13010,47 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12417
13010
|
const info = editorService.getNodeInfo(node.id);
|
|
12418
13011
|
pageId = info.page?.id;
|
|
12419
13012
|
}
|
|
12420
|
-
depService.collectIdle([node], { pageId }, deep);
|
|
12421
|
-
})
|
|
12422
|
-
|
|
13013
|
+
return depService.collectIdle([node], { pageId }, deep);
|
|
13014
|
+
})
|
|
13015
|
+
);
|
|
12423
13016
|
const nodeAddHandler = (nodes) => {
|
|
12424
|
-
collectIdle(nodes, true)
|
|
13017
|
+
collectIdle(nodes, true).then(() => {
|
|
13018
|
+
afterUpdateNodes(nodes);
|
|
13019
|
+
});
|
|
12425
13020
|
};
|
|
12426
|
-
const nodeUpdateHandler = (
|
|
12427
|
-
|
|
13021
|
+
const nodeUpdateHandler = (data) => {
|
|
13022
|
+
const needRecollectNodes = [];
|
|
13023
|
+
const normalNodes = [];
|
|
13024
|
+
data.forEach(({ newNode, oldNode, changeRecords }) => {
|
|
13025
|
+
if (changeRecords?.length) {
|
|
13026
|
+
for (const record of changeRecords) {
|
|
13027
|
+
if (!record.propPath || new RegExp(`${NODE_CONDS_KEY}.(\\d)+.cond`).test(record.propPath) || new RegExp(`${NODE_CONDS_KEY}.(\\d)+.cond.(\\d)+.value`).test(record.propPath) || record.propPath === NODE_CONDS_KEY || isValueIncludeDataSource(record.value)) {
|
|
13028
|
+
needRecollectNodes.push(newNode);
|
|
13029
|
+
} else {
|
|
13030
|
+
normalNodes.push(newNode);
|
|
13031
|
+
}
|
|
13032
|
+
}
|
|
13033
|
+
} else if (isIncludeDataSource(newNode, oldNode)) {
|
|
13034
|
+
needRecollectNodes.push(newNode);
|
|
13035
|
+
} else {
|
|
13036
|
+
normalNodes.push(newNode);
|
|
13037
|
+
}
|
|
13038
|
+
});
|
|
13039
|
+
if (needRecollectNodes.length) {
|
|
13040
|
+
collectIdle(needRecollectNodes, true).then(() => {
|
|
13041
|
+
afterUpdateNodes(needRecollectNodes);
|
|
13042
|
+
});
|
|
13043
|
+
} else if (normalNodes.length) {
|
|
13044
|
+
afterUpdateNodes(normalNodes);
|
|
13045
|
+
}
|
|
12428
13046
|
};
|
|
12429
13047
|
const nodeRemoveHandler = (nodes) => {
|
|
12430
13048
|
depService.clear(nodes);
|
|
12431
13049
|
};
|
|
12432
13050
|
const historyChangeHandler = (page) => {
|
|
12433
|
-
collectIdle([page], true)
|
|
13051
|
+
collectIdle([page], true).then(() => {
|
|
13052
|
+
updateDataSourceSchema([page], true);
|
|
13053
|
+
});
|
|
12434
13054
|
};
|
|
12435
13055
|
editorService.on("history-change", historyChangeHandler);
|
|
12436
13056
|
editorService.on("root-change", rootChangeHandler);
|
|
@@ -12453,11 +13073,30 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12453
13073
|
initDataSourceDepTarget(config);
|
|
12454
13074
|
getApp()?.dataSourceManager?.addDataSource(config);
|
|
12455
13075
|
};
|
|
12456
|
-
const dataSourceUpdateHandler = (config) => {
|
|
13076
|
+
const dataSourceUpdateHandler = (config, { changeRecords }) => {
|
|
13077
|
+
let needRecollectDep = false;
|
|
13078
|
+
for (const changeRecord of changeRecords) {
|
|
13079
|
+
if (!changeRecord.propPath) {
|
|
13080
|
+
continue;
|
|
13081
|
+
}
|
|
13082
|
+
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);
|
|
13083
|
+
if (needRecollectDep) {
|
|
13084
|
+
break;
|
|
13085
|
+
}
|
|
13086
|
+
}
|
|
12457
13087
|
const root = editorService.get("root");
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
13088
|
+
if (needRecollectDep) {
|
|
13089
|
+
if (Array.isArray(root?.items)) {
|
|
13090
|
+
depService.clearIdleTasks();
|
|
13091
|
+
removeDataSourceTarget(config.id);
|
|
13092
|
+
initDataSourceDepTarget(config);
|
|
13093
|
+
collectIdle(root.items, true).then(() => {
|
|
13094
|
+
updateDataSourceSchema(root?.items || [], true);
|
|
13095
|
+
});
|
|
13096
|
+
}
|
|
13097
|
+
} else if (root?.dataSources) {
|
|
13098
|
+
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
13099
|
+
}
|
|
12461
13100
|
};
|
|
12462
13101
|
const removeDataSourceTarget = (id) => {
|
|
12463
13102
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
@@ -12465,8 +13104,13 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12465
13104
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE_METHOD);
|
|
12466
13105
|
};
|
|
12467
13106
|
const dataSourceRemoveHandler = (id) => {
|
|
13107
|
+
const root = editorService.get("root");
|
|
13108
|
+
const nodeIds = Object.keys(root?.dataSourceDeps?.[id] || {});
|
|
13109
|
+
const nodes = getNodes(nodeIds, root?.items);
|
|
13110
|
+
collectIdle(nodes, false).then(() => {
|
|
13111
|
+
updateDataSourceSchema(nodes, false);
|
|
13112
|
+
});
|
|
12468
13113
|
removeDataSourceTarget(id);
|
|
12469
|
-
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
12470
13114
|
};
|
|
12471
13115
|
dataSourceService.on("add", dataSourceAddHandler);
|
|
12472
13116
|
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
@@ -12474,7 +13118,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12474
13118
|
onBeforeUnmount(() => {
|
|
12475
13119
|
depService.off("add-target", targetAddHandler);
|
|
12476
13120
|
depService.off("remove-target", targetRemoveHandler);
|
|
12477
|
-
depService.off("collected",
|
|
13121
|
+
depService.off("collected", depCollectedHandler);
|
|
12478
13122
|
editorService.off("history-change", historyChangeHandler);
|
|
12479
13123
|
editorService.off("root-change", rootChangeHandler);
|
|
12480
13124
|
editorService.off("add", nodeAddHandler);
|
|
@@ -12531,7 +13175,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12531
13175
|
isContainer: { type: Function },
|
|
12532
13176
|
customContentMenu: { type: Function },
|
|
12533
13177
|
extendFormState: { type: Function },
|
|
12534
|
-
pageBarSortOptions: {}
|
|
13178
|
+
pageBarSortOptions: {},
|
|
13179
|
+
pageFilterFunction: { type: Function }
|
|
12535
13180
|
}, defaultEditorProps),
|
|
12536
13181
|
emits: ["props-panel-mounted", "update:modelValue", "props-form-error", "props-submit-error"],
|
|
12537
13182
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -12576,18 +13221,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12576
13221
|
provide("codeOptions", props.codeOptions);
|
|
12577
13222
|
provide("stageOptions", stageOptions);
|
|
12578
13223
|
provide("eventBus", new EventEmitter());
|
|
13224
|
+
const propsPanelMountedHandler = (e) => {
|
|
13225
|
+
emit("props-panel-mounted", e);
|
|
13226
|
+
};
|
|
13227
|
+
const propsPanelSubmitErrorHandler = (e) => {
|
|
13228
|
+
emit("props-submit-error", e);
|
|
13229
|
+
};
|
|
13230
|
+
const propsPanelFormErrorHandler = (e) => {
|
|
13231
|
+
emit("props-form-error", e);
|
|
13232
|
+
};
|
|
12579
13233
|
__expose(services);
|
|
12580
13234
|
return (_ctx, _cache) => {
|
|
12581
|
-
return openBlock(), createBlock(_sfc_main$
|
|
13235
|
+
return openBlock(), createBlock(_sfc_main$s, {
|
|
12582
13236
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
12583
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
13237
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
13238
|
+
"page-filter-function": _ctx.pageFilterFunction
|
|
12584
13239
|
}, {
|
|
12585
13240
|
header: withCtx(() => [
|
|
12586
13241
|
renderSlot(_ctx.$slots, "header")
|
|
12587
13242
|
]),
|
|
12588
13243
|
nav: withCtx(() => [
|
|
12589
13244
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
12590
|
-
createVNode(_sfc_main$
|
|
13245
|
+
createVNode(_sfc_main$r, { data: _ctx.menu }, null, 8, ["data"])
|
|
12591
13246
|
])
|
|
12592
13247
|
]),
|
|
12593
13248
|
"content-before": withCtx(() => [
|
|
@@ -12670,9 +13325,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12670
13325
|
createVNode(_sfc_main$p, {
|
|
12671
13326
|
"extend-state": _ctx.extendFormState,
|
|
12672
13327
|
"disabled-show-src": _ctx.disabledShowSrc,
|
|
12673
|
-
onMounted:
|
|
12674
|
-
onFormError:
|
|
12675
|
-
onSubmitError:
|
|
13328
|
+
onMounted: propsPanelMountedHandler,
|
|
13329
|
+
onFormError: propsPanelFormErrorHandler,
|
|
13330
|
+
onSubmitError: propsPanelSubmitErrorHandler
|
|
12676
13331
|
}, {
|
|
12677
13332
|
"props-panel-header": withCtx(() => [
|
|
12678
13333
|
renderSlot(_ctx.$slots, "props-panel-header")
|
|
@@ -12693,6 +13348,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12693
13348
|
"page-bar": withCtx(() => [
|
|
12694
13349
|
renderSlot(_ctx.$slots, "page-bar")
|
|
12695
13350
|
]),
|
|
13351
|
+
"page-bar-add-button": withCtx(() => [
|
|
13352
|
+
renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
13353
|
+
]),
|
|
12696
13354
|
"page-bar-title": withCtx(({ page }) => [
|
|
12697
13355
|
renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
12698
13356
|
]),
|
|
@@ -12703,7 +13361,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12703
13361
|
renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
12704
13362
|
]),
|
|
12705
13363
|
_: 3
|
|
12706
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"]);
|
|
13364
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "page-filter-function"]);
|
|
12707
13365
|
};
|
|
12708
13366
|
}
|
|
12709
13367
|
});
|
|
@@ -12721,25 +13379,25 @@ const index = {
|
|
|
12721
13379
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
12722
13380
|
setEditorConfig(option);
|
|
12723
13381
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
12724
|
-
app.component("magic-code-editor", _sfc_main$
|
|
12725
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
12726
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
12727
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
12728
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
12729
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
12730
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
12731
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
12732
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
12733
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
12734
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
12735
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
12736
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
12737
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
12738
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
12739
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
12740
|
-
app.component("m-fields-display-conds", _sfc_main$
|
|
12741
|
-
app.component("m-fields-cond-op-select", _sfc_main$
|
|
13382
|
+
app.component("magic-code-editor", _sfc_main$Y);
|
|
13383
|
+
app.component("m-fields-ui-select", _sfc_main$C);
|
|
13384
|
+
app.component("m-fields-code-link", _sfc_main$W);
|
|
13385
|
+
app.component("m-fields-vs-code", _sfc_main$X);
|
|
13386
|
+
app.component("m-fields-code-select", _sfc_main$V);
|
|
13387
|
+
app.component("m-fields-code-select-col", _sfc_main$T);
|
|
13388
|
+
app.component("m-fields-event-select", _sfc_main$G);
|
|
13389
|
+
app.component("m-fields-data-source-fields", _sfc_main$Q);
|
|
13390
|
+
app.component("m-fields-data-source-mocks", _sfc_main$J);
|
|
13391
|
+
app.component("m-fields-key-value", _sfc_main$E);
|
|
13392
|
+
app.component("m-fields-data-source-input", _sfc_main$N);
|
|
13393
|
+
app.component("m-fields-data-source-select", _sfc_main$I);
|
|
13394
|
+
app.component("m-fields-data-source-methods", _sfc_main$L);
|
|
13395
|
+
app.component("m-fields-data-source-method-select", _sfc_main$K);
|
|
13396
|
+
app.component("m-fields-data-source-field-select", _sfc_main$O);
|
|
13397
|
+
app.component("m-fields-page-fragment-select", _sfc_main$D);
|
|
13398
|
+
app.component("m-fields-display-conds", _sfc_main$H);
|
|
13399
|
+
app.component("m-fields-cond-op-select", _sfc_main$S);
|
|
12742
13400
|
}
|
|
12743
13401
|
};
|
|
12744
13402
|
|
|
12745
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
13403
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$M as CodeBlockEditor, _sfc_main$k as CodeBlockList, _sfc_main$j as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$V as CodeSelect, _sfc_main$T as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$S as CondOpSelect, _sfc_main$o as ContentMenu, _sfc_main$i as DataSourceConfigPanel, _sfc_main$O as DataSourceFieldSelect, _sfc_main$Q as DataSourceFields, _sfc_main$N as DataSourceInput, _sfc_main$K as DataSourceMethodSelect, _sfc_main$L as DataSourceMethods, _sfc_main$J as DataSourceMocks, _sfc_main$I as DataSourceSelect, _sfc_main$H as DisplayConds, DragType, _sfc_main$G as EventSelect, Fixed2Other, _sfc_main$R as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$Z as Icon, IdleTask, KeyBindingCommand, _sfc_main$E as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$A as LayoutContainer, _sfc_main$D as PageFragmentSelect, _sfc_main$q as PropsFormPanel, _sfc_main$p as PropsPanel, _sfc_main$B as Resizer, ScrollViewer, SideItemKey, _sfc_main$A as SplitView, _sfc_main$Y as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$z as ToolButton, _sfc_main$l as Tree, _sfc_main$m as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, eqOptions, error, eventTabConfig, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isIncludeDataSource, log, moveItemsInContainer, numberOptions, propsService, removeDataSourceFieldPrefix, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, stageOverlayService, storageService, styleTabConfig, uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus$1 as useNodeStatus, useStage, useWindowRect, warn };
|