@tmagic/editor 1.4.16 → 1.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +11 -7
- package/dist/tmagic-editor.js +434 -411
- package/dist/tmagic-editor.umd.cjs +441 -408
- package/package.json +11 -15
- package/src/components/CodeParams.vue +1 -1
- package/src/editorProps.ts +2 -1
- package/src/fields/DataSourceInput.vue +2 -2
- package/src/fields/UISelect.vue +20 -15
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-stage.ts +13 -7
- package/src/index.ts +2 -0
- package/src/initService.ts +50 -53
- package/src/layouts/sidebar/Sidebar.vue +18 -2
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +12 -14
- package/src/layouts/workspace/viewer/NodeListMenu.vue +2 -1
- package/src/layouts/workspace/viewer/Stage.vue +4 -3
- package/src/services/editor.ts +2 -2
- package/src/services/stageOverlay.ts +3 -1
- package/src/theme/data-source.scss +8 -5
- package/src/theme/page-bar.scss +2 -2
- package/src/utils/data-source/index.ts +25 -23
- package/src/utils/editor.ts +4 -3
- package/src/utils/index.ts +4 -0
- package/src/utils/operator.ts +3 -2
- package/src/utils/props.ts +2 -1
- package/types/index.d.ts +6685 -49
- package/src/shims-vue.d.ts +0 -6
- package/types/Editor.vue.d.ts +0 -2313
- package/types/components/CodeBlockEditor.vue.d.ts +0 -33
- package/types/components/CodeParams.vue.d.ts +0 -28
- package/types/components/ContentMenu.vue.d.ts +0 -81
- package/types/components/FloatingBox.vue.d.ts +0 -70
- package/types/components/Icon.vue.d.ts +0 -15
- package/types/components/Resizer.vue.d.ts +0 -16
- package/types/components/ScrollBar.vue.d.ts +0 -25
- package/types/components/ScrollViewer.vue.d.ts +0 -81
- package/types/components/SearchInput.vue.d.ts +0 -6
- package/types/components/SplitView.vue.d.ts +0 -72
- package/types/components/ToolButton.vue.d.ts +0 -41
- package/types/components/Tree.vue.d.ts +0 -83
- package/types/components/TreeNode.vue.d.ts +0 -83
- package/types/editorProps.d.ts +0 -111
- package/types/fields/Code.vue.d.ts +0 -44
- package/types/fields/CodeLink.vue.d.ts +0 -24
- package/types/fields/CodeSelect.vue.d.ts +0 -28
- package/types/fields/CodeSelectCol.vue.d.ts +0 -31
- package/types/fields/CondOpSelect.vue.d.ts +0 -17
- package/types/fields/DataSourceFieldSelect/FieldSelect.vue.d.ts +0 -36
- package/types/fields/DataSourceFieldSelect/Index.vue.d.ts +0 -31
- package/types/fields/DataSourceFields.vue.d.ts +0 -44
- package/types/fields/DataSourceInput.vue.d.ts +0 -34
- package/types/fields/DataSourceMethodSelect.vue.d.ts +0 -31
- package/types/fields/DataSourceMethods.vue.d.ts +0 -34
- package/types/fields/DataSourceMocks.vue.d.ts +0 -41
- package/types/fields/DataSourceSelect.vue.d.ts +0 -31
- package/types/fields/DisplayConds.vue.d.ts +0 -37
- package/types/fields/EventSelect.vue.d.ts +0 -17
- package/types/fields/KeyValue.vue.d.ts +0 -36
- package/types/fields/PageFragmentSelect.vue.d.ts +0 -31
- package/types/fields/UISelect.vue.d.ts +0 -20
- package/types/hooks/index.d.ts +0 -6
- package/types/hooks/use-code-block-edit.d.ts +0 -189
- package/types/hooks/use-data-source-edit.d.ts +0 -176
- package/types/hooks/use-data-source-method.d.ts +0 -187
- package/types/hooks/use-editor-content-height.d.ts +0 -3
- package/types/hooks/use-filter.d.ts +0 -7
- package/types/hooks/use-float-box.d.ts +0 -17
- package/types/hooks/use-getso.d.ts +0 -5
- package/types/hooks/use-next-float-box-position.d.ts +0 -15
- package/types/hooks/use-node-status.d.ts +0 -16
- package/types/hooks/use-stage.d.ts +0 -3
- package/types/hooks/use-window-rect.d.ts +0 -6
- package/types/icons/AppManageIcon.vue.d.ts +0 -2
- package/types/icons/CenterIcon.vue.d.ts +0 -2
- package/types/icons/CodeIcon.vue.d.ts +0 -2
- package/types/icons/FolderMinusIcon.vue.d.ts +0 -2
- package/types/icons/PinIcon.vue.d.ts +0 -2
- package/types/icons/PinnedIcon.vue.d.ts +0 -2
- package/types/initService.d.ts +0 -9
- package/types/layouts/AddPageBox.vue.d.ts +0 -15
- package/types/layouts/CodeEditor.vue.d.ts +0 -80
- package/types/layouts/Framework.vue.d.ts +0 -25
- package/types/layouts/NavMenu.vue.d.ts +0 -35
- package/types/layouts/PropsPanel.vue.d.ts +0 -535
- package/types/layouts/page-bar/AddButton.vue.d.ts +0 -16
- package/types/layouts/page-bar/PageBar.vue.d.ts +0 -36
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +0 -29
- package/types/layouts/page-bar/PageList.vue.d.ts +0 -27
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +0 -20
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -10
- package/types/layouts/sidebar/Sidebar.vue.d.ts +0 -51
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +0 -32
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +0 -24
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +0 -31
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +0 -18
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +0 -10
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +0 -41
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +0 -16
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +0 -25
- package/types/layouts/sidebar/layer/use-click.d.ts +0 -119
- package/types/layouts/sidebar/layer/use-drag.d.ts +0 -14
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +0 -6
- package/types/layouts/sidebar/layer/use-node-status.d.ts +0 -16
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +0 -2
- package/types/layouts/workspace/Workspace.vue.d.ts +0 -41
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +0 -2
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +0 -34
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +0 -2
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +0 -42
- package/types/services/BaseService.d.ts +0 -65
- package/types/services/codeBlock.d.ts +0 -130
- package/types/services/componentList.d.ts +0 -16
- package/types/services/dataSource.d.ts +0 -68
- package/types/services/dep.d.ts +0 -33
- package/types/services/editor.d.ts +0 -180
- package/types/services/events.d.ts +0 -18
- package/types/services/history.d.ts +0 -26
- package/types/services/keybinding.d.ts +0 -40
- package/types/services/props.d.ts +0 -92
- package/types/services/stageOverlay.d.ts +0 -30
- package/types/services/storage.d.ts +0 -65
- package/types/services/ui.d.ts +0 -77
- package/types/type.d.ts +0 -657
- package/types/utils/compose.d.ts +0 -5
- package/types/utils/config.d.ts +0 -4
- package/types/utils/content-menu.d.ts +0 -7
- package/types/utils/data-source/formConfigs/base.d.ts +0 -2
- package/types/utils/data-source/formConfigs/http.d.ts +0 -3
- package/types/utils/data-source/index.d.ts +0 -10
- package/types/utils/editor.d.ts +0 -59
- package/types/utils/idle-task.d.ts +0 -13
- package/types/utils/index.d.ts +0 -6
- package/types/utils/keybinding-config.d.ts +0 -7
- package/types/utils/logger.d.ts +0 -5
- package/types/utils/monaco-editor.d.ts +0 -2
- package/types/utils/operator.d.ts +0 -21
- package/types/utils/props.d.ts +0 -23
- package/types/utils/scroll-viewer.d.ts +0 -37
- package/types/utils/tree.d.ts +0 -3
- package/types/utils/undo-redo.d.ts +0 -12
package/dist/tmagic-editor.js
CHANGED
|
@@ -6,9 +6,9 @@ import { TMagicIcon, TMagicButton, TMagicCard, getConfig as getConfig$1, TMagicS
|
|
|
6
6
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
7
7
|
import * as monaco from 'monaco-editor';
|
|
8
8
|
import { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel } from '@tmagic/form';
|
|
9
|
-
import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
9
|
+
import { HookCodeType, HookType, NODE_CONDS_KEY, NodeType, ActionType } from '@tmagic/schema';
|
|
10
10
|
import { MagicTable } from '@tmagic/table';
|
|
11
|
-
import { isPage, isPageFragment, isPop, getNodePath, isNumber, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, convertToNumber, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX,
|
|
11
|
+
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';
|
|
12
12
|
import VanillaMoveable from 'moveable';
|
|
13
13
|
import { Target, Watcher, DepTargetType, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
14
14
|
export { DepTargetType } from '@tmagic/dep';
|
|
@@ -836,7 +836,7 @@ const displayTabConfig = {
|
|
|
836
836
|
items: [
|
|
837
837
|
{
|
|
838
838
|
type: "display-conds",
|
|
839
|
-
name:
|
|
839
|
+
name: NODE_CONDS_KEY,
|
|
840
840
|
titlePrefix: "条件组",
|
|
841
841
|
defaultValue: []
|
|
842
842
|
}
|
|
@@ -1112,8 +1112,8 @@ const getGuideLineFromCache = (key) => {
|
|
|
1112
1112
|
};
|
|
1113
1113
|
const fixNodeLeft = (config, parent, doc) => {
|
|
1114
1114
|
if (!doc || !config.style || !isNumber(config.style.left)) return config.style?.left;
|
|
1115
|
-
const el = doc
|
|
1116
|
-
const parentEl = doc
|
|
1115
|
+
const el = getElById()(doc, `${config.id}`);
|
|
1116
|
+
const parentEl = getElById()(doc, `${parent.id}`);
|
|
1117
1117
|
const left = Number(config.style?.left) || 0;
|
|
1118
1118
|
if (el && parentEl) {
|
|
1119
1119
|
const calcParentOffsetWidth = calcValueByFontsize(doc, parentEl.offsetWidth);
|
|
@@ -2310,7 +2310,7 @@ class Editor extends BaseService {
|
|
|
2310
2310
|
const stage = this.get("stage");
|
|
2311
2311
|
const doc = stage?.renderer.contentWindow?.document;
|
|
2312
2312
|
if (doc) {
|
|
2313
|
-
const el = doc
|
|
2313
|
+
const el = getElById()(doc, node.id);
|
|
2314
2314
|
const parentEl = layout === Layout.FIXED ? doc.body : el?.offsetParent;
|
|
2315
2315
|
if (parentEl && el) {
|
|
2316
2316
|
node.style.left = calcValueByFontsize(doc, (parentEl.clientWidth - el.clientWidth) / 2);
|
|
@@ -2655,7 +2655,8 @@ const beforePaste = (position, config, doc) => {
|
|
|
2655
2655
|
};
|
|
2656
2656
|
const getPositionInContainer = (position = {}, id, doc) => {
|
|
2657
2657
|
let { left = 0, top = 0 } = position;
|
|
2658
|
-
const
|
|
2658
|
+
const stageDoc = editorService.get("stage")?.renderer?.contentWindow?.document;
|
|
2659
|
+
const parentEl = stageDoc && getElById()(stageDoc, `${id}`);
|
|
2659
2660
|
const parentElRect = parentEl?.getBoundingClientRect();
|
|
2660
2661
|
left = left - calcValueByFontsize(doc, parentElRect?.left || 0);
|
|
2661
2662
|
top = top - calcValueByFontsize(doc, parentElRect?.top || 0);
|
|
@@ -2882,7 +2883,7 @@ const getFormValue = (type, values) => {
|
|
|
2882
2883
|
* context:上下文对象
|
|
2883
2884
|
*
|
|
2884
2885
|
* interface Content {
|
|
2885
|
-
* app:
|
|
2886
|
+
* app: TMagicApp;
|
|
2886
2887
|
* dataSource: HttpDataSource;
|
|
2887
2888
|
* }
|
|
2888
2889
|
*
|
|
@@ -2899,7 +2900,7 @@ const getFormValue = (type, values) => {
|
|
|
2899
2900
|
* context:上下文对象
|
|
2900
2901
|
*
|
|
2901
2902
|
* interface Content {
|
|
2902
|
-
* app:
|
|
2903
|
+
* app: TMagicApp;
|
|
2903
2904
|
* dataSource: HttpDataSource;
|
|
2904
2905
|
* }
|
|
2905
2906
|
*
|
|
@@ -2913,7 +2914,7 @@ const getFormValue = (type, values) => {
|
|
|
2913
2914
|
};
|
|
2914
2915
|
const getDisplayField = (dataSources, key) => {
|
|
2915
2916
|
const displayState = [];
|
|
2916
|
-
const matches = key.matchAll(
|
|
2917
|
+
const matches = key.matchAll(dataSourceTemplateRegExp);
|
|
2917
2918
|
let index = 0;
|
|
2918
2919
|
for (const match of matches) {
|
|
2919
2920
|
if (typeof match.index === "undefined") break;
|
|
@@ -2924,7 +2925,7 @@ const getDisplayField = (dataSources, key) => {
|
|
|
2924
2925
|
let dsText = "";
|
|
2925
2926
|
let ds;
|
|
2926
2927
|
let fields;
|
|
2927
|
-
match[1]
|
|
2928
|
+
getKeysArray(match[1]).forEach((item, index2) => {
|
|
2928
2929
|
if (index2 === 0) {
|
|
2929
2930
|
ds = dataSources.find((ds2) => ds2.id === item);
|
|
2930
2931
|
dsText += ds?.title || item;
|
|
@@ -2985,6 +2986,189 @@ const getCascaderOptionsFromFields = (fields = [], dataSourceFieldType = ["any"]
|
|
|
2985
2986
|
};
|
|
2986
2987
|
const removeDataSourceFieldPrefix = (id) => id?.replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, "") || "";
|
|
2987
2988
|
|
|
2989
|
+
globalThis.requestIdleCallback = globalThis.requestIdleCallback || function(cb) {
|
|
2990
|
+
const start = Date.now();
|
|
2991
|
+
return setTimeout(() => {
|
|
2992
|
+
cb({
|
|
2993
|
+
didTimeout: false,
|
|
2994
|
+
timeRemaining() {
|
|
2995
|
+
return Math.max(0, 50 - (Date.now() - start));
|
|
2996
|
+
}
|
|
2997
|
+
});
|
|
2998
|
+
}, 1);
|
|
2999
|
+
};
|
|
3000
|
+
class IdleTask extends EventEmitter {
|
|
3001
|
+
taskList = [];
|
|
3002
|
+
taskHandle = null;
|
|
3003
|
+
enqueueTask(taskHandler, taskData) {
|
|
3004
|
+
this.taskList.push({
|
|
3005
|
+
handler: taskHandler,
|
|
3006
|
+
data: taskData
|
|
3007
|
+
});
|
|
3008
|
+
if (!this.taskHandle) {
|
|
3009
|
+
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
on(eventName, listener) {
|
|
3013
|
+
return super.on(eventName, listener);
|
|
3014
|
+
}
|
|
3015
|
+
once(eventName, listener) {
|
|
3016
|
+
return super.once(eventName, listener);
|
|
3017
|
+
}
|
|
3018
|
+
emit(eventName, ...args) {
|
|
3019
|
+
return super.emit(eventName, ...args);
|
|
3020
|
+
}
|
|
3021
|
+
runTaskQueue(deadline) {
|
|
3022
|
+
while ((deadline.timeRemaining() > 15 || deadline.didTimeout) && this.taskList.length) {
|
|
3023
|
+
const task = this.taskList.shift();
|
|
3024
|
+
task.handler(task.data);
|
|
3025
|
+
}
|
|
3026
|
+
if (this.taskList.length) {
|
|
3027
|
+
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
3028
|
+
} else {
|
|
3029
|
+
this.taskHandle = 0;
|
|
3030
|
+
this.emit("finish");
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
class ScrollViewer extends EventEmitter {
|
|
3036
|
+
container;
|
|
3037
|
+
target;
|
|
3038
|
+
zoom = 1;
|
|
3039
|
+
scrollLeft = 0;
|
|
3040
|
+
scrollTop = 0;
|
|
3041
|
+
scrollHeight = 0;
|
|
3042
|
+
scrollWidth = 0;
|
|
3043
|
+
width = 0;
|
|
3044
|
+
height = 0;
|
|
3045
|
+
translateXCorrectionValue = 0;
|
|
3046
|
+
translateYCorrectionValue = 0;
|
|
3047
|
+
correctionScrollSize = {
|
|
3048
|
+
width: 0,
|
|
3049
|
+
height: 0
|
|
3050
|
+
};
|
|
3051
|
+
resizeObserver = new ResizeObserver(() => {
|
|
3052
|
+
this.setSize();
|
|
3053
|
+
this.setScrollSize();
|
|
3054
|
+
});
|
|
3055
|
+
constructor(options) {
|
|
3056
|
+
super();
|
|
3057
|
+
this.container = options.container;
|
|
3058
|
+
this.target = options.target;
|
|
3059
|
+
this.zoom = options.zoom;
|
|
3060
|
+
if (this.correctionScrollSize) {
|
|
3061
|
+
this.correctionScrollSize = {
|
|
3062
|
+
...this.correctionScrollSize,
|
|
3063
|
+
...options.correctionScrollSize
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
3067
|
+
this.setSize();
|
|
3068
|
+
this.setScrollSize();
|
|
3069
|
+
this.resizeObserver.observe(this.container);
|
|
3070
|
+
this.resizeObserver.observe(this.target);
|
|
3071
|
+
}
|
|
3072
|
+
destroy() {
|
|
3073
|
+
this.resizeObserver.disconnect();
|
|
3074
|
+
this.container.removeEventListener("wheel", this.wheelHandler, false);
|
|
3075
|
+
this.removeAllListeners();
|
|
3076
|
+
}
|
|
3077
|
+
setZoom(zoom) {
|
|
3078
|
+
this.zoom = zoom;
|
|
3079
|
+
this.setScrollSize();
|
|
3080
|
+
}
|
|
3081
|
+
scrollTo({ left, top }) {
|
|
3082
|
+
if (typeof left !== "undefined") {
|
|
3083
|
+
this.scrollLeft = left;
|
|
3084
|
+
}
|
|
3085
|
+
if (typeof top !== "undefined") {
|
|
3086
|
+
this.scrollTop = top;
|
|
3087
|
+
}
|
|
3088
|
+
const translateX = -this.scrollLeft + this.translateXCorrectionValue;
|
|
3089
|
+
const translateY = -this.scrollTop + this.translateYCorrectionValue;
|
|
3090
|
+
this.target.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
3091
|
+
}
|
|
3092
|
+
wheelHandler = (event) => {
|
|
3093
|
+
const { deltaX, deltaY, currentTarget } = event;
|
|
3094
|
+
if (currentTarget !== this.container) return;
|
|
3095
|
+
let top;
|
|
3096
|
+
if (this.scrollHeight > this.height) {
|
|
3097
|
+
top = this.scrollTop + this.getPos(deltaY, this.scrollTop, this.scrollHeight, this.height);
|
|
3098
|
+
}
|
|
3099
|
+
let left;
|
|
3100
|
+
if (this.scrollWidth > this.width) {
|
|
3101
|
+
left = this.scrollLeft + this.getPos(deltaX, this.scrollLeft, this.scrollWidth, this.width);
|
|
3102
|
+
}
|
|
3103
|
+
this.scrollTo({ left, top });
|
|
3104
|
+
this.emit("scroll", {
|
|
3105
|
+
scrollLeft: this.scrollLeft,
|
|
3106
|
+
scrollTop: this.scrollTop,
|
|
3107
|
+
scrollHeight: this.scrollHeight,
|
|
3108
|
+
scrollWidth: this.scrollWidth
|
|
3109
|
+
});
|
|
3110
|
+
};
|
|
3111
|
+
getPos(delta, scrollPos, scrollSize, size) {
|
|
3112
|
+
let pos = 0;
|
|
3113
|
+
if (delta < 0) {
|
|
3114
|
+
if (scrollPos > 0) {
|
|
3115
|
+
pos = Math.max(delta, -scrollPos);
|
|
3116
|
+
}
|
|
3117
|
+
} else {
|
|
3118
|
+
const leftPos = scrollSize - size - scrollPos;
|
|
3119
|
+
if (leftPos > 0) {
|
|
3120
|
+
pos = Math.min(delta, leftPos);
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
return pos;
|
|
3124
|
+
}
|
|
3125
|
+
setScrollSize = () => {
|
|
3126
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
3127
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
3128
|
+
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
3129
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
3130
|
+
let left;
|
|
3131
|
+
let top;
|
|
3132
|
+
if (this.scrollWidth < this.width) {
|
|
3133
|
+
left = 0;
|
|
3134
|
+
this.translateXCorrectionValue = 0;
|
|
3135
|
+
} else {
|
|
3136
|
+
this.translateXCorrectionValue = (this.scrollWidth - this.width) / 2;
|
|
3137
|
+
}
|
|
3138
|
+
if (this.scrollHeight < this.height) {
|
|
3139
|
+
top = 0;
|
|
3140
|
+
this.translateYCorrectionValue = 0;
|
|
3141
|
+
} else {
|
|
3142
|
+
this.translateYCorrectionValue = (this.scrollHeight - this.height) / 2;
|
|
3143
|
+
}
|
|
3144
|
+
this.scrollTo({
|
|
3145
|
+
left,
|
|
3146
|
+
top
|
|
3147
|
+
});
|
|
3148
|
+
this.emit("scroll", {
|
|
3149
|
+
scrollLeft: this.scrollLeft,
|
|
3150
|
+
scrollTop: this.scrollTop,
|
|
3151
|
+
scrollHeight: this.scrollHeight,
|
|
3152
|
+
scrollWidth: this.scrollWidth
|
|
3153
|
+
});
|
|
3154
|
+
};
|
|
3155
|
+
setSize = () => {
|
|
3156
|
+
const { width, height } = this.container.getBoundingClientRect();
|
|
3157
|
+
this.width = width;
|
|
3158
|
+
this.height = height;
|
|
3159
|
+
};
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
const updateStatus = (nodeStatusMap, id, status) => {
|
|
3163
|
+
const nodeStatus = nodeStatusMap.get(id);
|
|
3164
|
+
if (!nodeStatus) return;
|
|
3165
|
+
getKeys(status).forEach((key) => {
|
|
3166
|
+
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
3167
|
+
nodeStatus[key] = Boolean(status[key]);
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
};
|
|
3171
|
+
|
|
2988
3172
|
const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
2989
3173
|
...{
|
|
2990
3174
|
name: "MEditorCodeParams"
|
|
@@ -3007,7 +3191,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3007
3191
|
type: "fieldset",
|
|
3008
3192
|
items,
|
|
3009
3193
|
legend: "参数",
|
|
3010
|
-
labelWidth: "
|
|
3194
|
+
labelWidth: "120px",
|
|
3011
3195
|
name: props.name
|
|
3012
3196
|
}
|
|
3013
3197
|
];
|
|
@@ -3046,7 +3230,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3046
3230
|
});
|
|
3047
3231
|
|
|
3048
3232
|
const _hoisted_1$u = { class: "m-fields-code-select-col" };
|
|
3049
|
-
const _hoisted_2$
|
|
3233
|
+
const _hoisted_2$j = { class: "code-select-container" };
|
|
3050
3234
|
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
3051
3235
|
...{
|
|
3052
3236
|
name: "MFieldsCodeSelectCol"
|
|
@@ -3127,7 +3311,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3127
3311
|
};
|
|
3128
3312
|
return (_ctx, _cache) => {
|
|
3129
3313
|
return openBlock(), createElementBlock("div", _hoisted_1$u, [
|
|
3130
|
-
createElementVNode("div", _hoisted_2$
|
|
3314
|
+
createElementVNode("div", _hoisted_2$j, [
|
|
3131
3315
|
createVNode(unref(MContainer), {
|
|
3132
3316
|
class: "select",
|
|
3133
3317
|
config: selectConfig,
|
|
@@ -3705,29 +3889,34 @@ const useStage = (stageOptions) => {
|
|
|
3705
3889
|
editorService.set("stageLoading", false);
|
|
3706
3890
|
});
|
|
3707
3891
|
stage.on("select", (el) => {
|
|
3708
|
-
|
|
3709
|
-
editorService.
|
|
3892
|
+
const id = getIdFromEl()(el);
|
|
3893
|
+
if (`${editorService.get("node")?.id}` === id && editorService.get("nodes").length === 1) return;
|
|
3894
|
+
id && editorService.select(id);
|
|
3710
3895
|
});
|
|
3711
3896
|
stage.on("highlight", (el) => {
|
|
3712
|
-
|
|
3897
|
+
const id = getIdFromEl()(el);
|
|
3898
|
+
id && editorService.highlight(id);
|
|
3713
3899
|
});
|
|
3714
3900
|
stage.on("multi-select", (els) => {
|
|
3715
|
-
|
|
3901
|
+
const ids = els.map((el) => getIdFromEl()(el)).filter((id) => Boolean(id));
|
|
3902
|
+
editorService.multiSelect(ids);
|
|
3716
3903
|
});
|
|
3717
3904
|
stage.on("update", (ev) => {
|
|
3718
3905
|
if (ev.parentEl) {
|
|
3719
3906
|
for (const data of ev.data) {
|
|
3720
|
-
|
|
3907
|
+
const id = getIdFromEl()(data.el);
|
|
3908
|
+
const pId = getIdFromEl()(ev.parentEl);
|
|
3909
|
+
id && pId && editorService.moveToContainer({ id, style: data.style }, pId);
|
|
3721
3910
|
}
|
|
3722
3911
|
return;
|
|
3723
3912
|
}
|
|
3724
|
-
editorService.update(ev.data.map((data) => ({ id: data.el
|
|
3913
|
+
editorService.update(ev.data.map((data) => ({ id: getIdFromEl()(data.el) || "", style: data.style })));
|
|
3725
3914
|
});
|
|
3726
3915
|
stage.on("sort", (ev) => {
|
|
3727
3916
|
editorService.sort(ev.src, ev.dist);
|
|
3728
3917
|
});
|
|
3729
3918
|
stage.on("remove", (ev) => {
|
|
3730
|
-
const nodes = ev.data.map(({ el }) => editorService.getNodeById(el
|
|
3919
|
+
const nodes = ev.data.map(({ el }) => editorService.getNodeById(getIdFromEl()(el) || ""));
|
|
3731
3920
|
editorService.remove(nodes.filter((node) => Boolean(node)));
|
|
3732
3921
|
});
|
|
3733
3922
|
stage.on("select-parent", () => {
|
|
@@ -3872,6 +4061,68 @@ const useEditorContentHeight = () => {
|
|
|
3872
4061
|
};
|
|
3873
4062
|
};
|
|
3874
4063
|
|
|
4064
|
+
const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
|
|
4065
|
+
const filterIsMatch = (value, data) => {
|
|
4066
|
+
const string = !Array.isArray(value) ? [value] : value;
|
|
4067
|
+
if (!string.length) {
|
|
4068
|
+
return true;
|
|
4069
|
+
}
|
|
4070
|
+
return string.some((v) => filterNodeMethod(v, data));
|
|
4071
|
+
};
|
|
4072
|
+
const filter = (text) => {
|
|
4073
|
+
if (!nodeData.value.length) return;
|
|
4074
|
+
nodeData.value.forEach((node) => {
|
|
4075
|
+
traverseNode(node, (node2, parents) => {
|
|
4076
|
+
if (!nodeStatusMap.value) return;
|
|
4077
|
+
const visible = filterIsMatch(text, node2);
|
|
4078
|
+
if (visible && parents.length) {
|
|
4079
|
+
parents.forEach((parent) => {
|
|
4080
|
+
updateStatus(nodeStatusMap.value, parent.id, {
|
|
4081
|
+
visible,
|
|
4082
|
+
expand: true
|
|
4083
|
+
});
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4086
|
+
updateStatus(nodeStatusMap.value, node2.id, {
|
|
4087
|
+
visible
|
|
4088
|
+
});
|
|
4089
|
+
});
|
|
4090
|
+
});
|
|
4091
|
+
};
|
|
4092
|
+
return {
|
|
4093
|
+
filterText: ref(""),
|
|
4094
|
+
filterTextChangeHandler(text) {
|
|
4095
|
+
filter(text);
|
|
4096
|
+
}
|
|
4097
|
+
};
|
|
4098
|
+
};
|
|
4099
|
+
|
|
4100
|
+
const useGetSo = (target, emit) => {
|
|
4101
|
+
let getso;
|
|
4102
|
+
const isDraging = ref(false);
|
|
4103
|
+
onMounted(() => {
|
|
4104
|
+
if (!target.value) return;
|
|
4105
|
+
getso = new Gesto(target.value, {
|
|
4106
|
+
container: window,
|
|
4107
|
+
pinchOutside: true
|
|
4108
|
+
}).on("drag", (e) => {
|
|
4109
|
+
if (!target.value) return;
|
|
4110
|
+
emit("change", e);
|
|
4111
|
+
}).on("dragStart", () => {
|
|
4112
|
+
isDraging.value = true;
|
|
4113
|
+
}).on("dragEnd", () => {
|
|
4114
|
+
isDraging.value = false;
|
|
4115
|
+
});
|
|
4116
|
+
});
|
|
4117
|
+
onBeforeUnmount(() => {
|
|
4118
|
+
getso?.unset();
|
|
4119
|
+
isDraging.value = false;
|
|
4120
|
+
});
|
|
4121
|
+
return {
|
|
4122
|
+
isDraging
|
|
4123
|
+
};
|
|
4124
|
+
};
|
|
4125
|
+
|
|
3875
4126
|
const useNextFloatBoxPosition = (uiService, parent) => {
|
|
3876
4127
|
const boxPosition = ref({
|
|
3877
4128
|
left: 0,
|
|
@@ -3896,8 +4147,42 @@ const useNextFloatBoxPosition = (uiService, parent) => {
|
|
|
3896
4147
|
};
|
|
3897
4148
|
};
|
|
3898
4149
|
|
|
4150
|
+
const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
|
|
4151
|
+
const map = /* @__PURE__ */ new Map();
|
|
4152
|
+
nodeData.forEach(
|
|
4153
|
+
(node) => traverseNode(node, (node2) => {
|
|
4154
|
+
map.set(
|
|
4155
|
+
node2.id,
|
|
4156
|
+
initialLayerNodeStatus?.get(node2.id) || {
|
|
4157
|
+
visible: true,
|
|
4158
|
+
expand: false,
|
|
4159
|
+
selected: false,
|
|
4160
|
+
draggable: false
|
|
4161
|
+
}
|
|
4162
|
+
);
|
|
4163
|
+
})
|
|
4164
|
+
);
|
|
4165
|
+
return map;
|
|
4166
|
+
};
|
|
4167
|
+
const useNodeStatus$1 = (nodeData) => {
|
|
4168
|
+
const nodeStatusMap = ref(/* @__PURE__ */ new Map());
|
|
4169
|
+
watch(
|
|
4170
|
+
nodeData,
|
|
4171
|
+
(nodeData2) => {
|
|
4172
|
+
nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
|
|
4173
|
+
},
|
|
4174
|
+
{
|
|
4175
|
+
immediate: true,
|
|
4176
|
+
deep: true
|
|
4177
|
+
}
|
|
4178
|
+
);
|
|
4179
|
+
return {
|
|
4180
|
+
nodeStatusMap
|
|
4181
|
+
};
|
|
4182
|
+
};
|
|
4183
|
+
|
|
3899
4184
|
const _hoisted_1$t = { class: "m-editor-data-source-fields" };
|
|
3900
|
-
const _hoisted_2$
|
|
4185
|
+
const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
|
|
3901
4186
|
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
3902
4187
|
...{
|
|
3903
4188
|
name: "MFieldsDataSourceFields"
|
|
@@ -4154,7 +4439,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4154
4439
|
data: _ctx.model[_ctx.name],
|
|
4155
4440
|
columns: fieldColumns
|
|
4156
4441
|
}, null, 8, ["data"]),
|
|
4157
|
-
createElementVNode("div", _hoisted_2$
|
|
4442
|
+
createElementVNode("div", _hoisted_2$i, [
|
|
4158
4443
|
createVNode(unref(TMagicButton), {
|
|
4159
4444
|
size: "small",
|
|
4160
4445
|
disabled: _ctx.disabled,
|
|
@@ -4542,7 +4827,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4542
4827
|
});
|
|
4543
4828
|
|
|
4544
4829
|
const _hoisted_1$q = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4545
|
-
const _hoisted_2$
|
|
4830
|
+
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4546
4831
|
const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
|
|
4547
4832
|
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
4548
4833
|
...{
|
|
@@ -4639,7 +4924,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4639
4924
|
const fieldQuerySearch = (queryString, leftAngleIndex, dotIndex, cb) => {
|
|
4640
4925
|
let result = [];
|
|
4641
4926
|
const dsKey = queryString.substring(leftAngleIndex + 1, dotIndex);
|
|
4642
|
-
const keys = dsKey
|
|
4927
|
+
const keys = getKeysArray(dsKey);
|
|
4643
4928
|
const dsId = keys.shift();
|
|
4644
4929
|
const ds = dataSources.value.find((ds2) => ds2.id === dsId);
|
|
4645
4930
|
if (!ds) {
|
|
@@ -4749,7 +5034,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4749
5034
|
default: withCtx(({ item }) => [
|
|
4750
5035
|
createElementVNode("div", _hoisted_1$q, [
|
|
4751
5036
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
4752
|
-
createElementVNode("span", _hoisted_2$
|
|
5037
|
+
createElementVNode("span", _hoisted_2$h, toDisplayString(item.value), 1)
|
|
4753
5038
|
])
|
|
4754
5039
|
]),
|
|
4755
5040
|
_: 1
|
|
@@ -4791,7 +5076,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4791
5076
|
});
|
|
4792
5077
|
|
|
4793
5078
|
const _hoisted_1$p = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
4794
|
-
const _hoisted_2$
|
|
5079
|
+
const _hoisted_2$g = { style: { "flex": "1" } };
|
|
4795
5080
|
const _hoisted_3$7 = { style: { "flex": "1" } };
|
|
4796
5081
|
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
4797
5082
|
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
@@ -5045,7 +5330,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5045
5330
|
]),
|
|
5046
5331
|
default: withCtx(() => [
|
|
5047
5332
|
createElementVNode("div", _hoisted_1$p, [
|
|
5048
|
-
createElementVNode("div", _hoisted_2$
|
|
5333
|
+
createElementVNode("div", _hoisted_2$g, [
|
|
5049
5334
|
createVNode(unref(TMagicTag), {
|
|
5050
5335
|
size: "small",
|
|
5051
5336
|
type: "info"
|
|
@@ -5088,7 +5373,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5088
5373
|
});
|
|
5089
5374
|
|
|
5090
5375
|
const _hoisted_1$o = { class: "m-editor-data-source-methods" };
|
|
5091
|
-
const _hoisted_2$
|
|
5376
|
+
const _hoisted_2$f = { class: "m-editor-data-source-methods-footer" };
|
|
5092
5377
|
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
5093
5378
|
...{
|
|
5094
5379
|
name: "MFieldsDataSourceMethods"
|
|
@@ -5164,7 +5449,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5164
5449
|
data: _ctx.model[_ctx.name],
|
|
5165
5450
|
columns: methodColumns
|
|
5166
5451
|
}, null, 8, ["data"]),
|
|
5167
|
-
createElementVNode("div", _hoisted_2$
|
|
5452
|
+
createElementVNode("div", _hoisted_2$f, [
|
|
5168
5453
|
createVNode(unref(TMagicButton), {
|
|
5169
5454
|
size: "small",
|
|
5170
5455
|
type: "primary",
|
|
@@ -5194,7 +5479,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5194
5479
|
});
|
|
5195
5480
|
|
|
5196
5481
|
const _hoisted_1$n = { class: "m-fields-data-source-method-select" };
|
|
5197
|
-
const _hoisted_2$
|
|
5482
|
+
const _hoisted_2$e = { class: "data-source-method-select-container" };
|
|
5198
5483
|
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
5199
5484
|
...{
|
|
5200
5485
|
name: "MFieldsDataSourceMethodSelect"
|
|
@@ -5282,7 +5567,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5282
5567
|
};
|
|
5283
5568
|
return (_ctx, _cache) => {
|
|
5284
5569
|
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
5285
|
-
createElementVNode("div", _hoisted_2$
|
|
5570
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
5286
5571
|
createVNode(unref(MContainer), {
|
|
5287
5572
|
class: "select",
|
|
5288
5573
|
config: cascaderConfig.value,
|
|
@@ -5326,7 +5611,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5326
5611
|
});
|
|
5327
5612
|
|
|
5328
5613
|
const _hoisted_1$m = { class: "m-editor-data-source-fields" };
|
|
5329
|
-
const _hoisted_2$
|
|
5614
|
+
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
5330
5615
|
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
5331
5616
|
...{
|
|
5332
5617
|
name: "MFieldsDataSourceMocks"
|
|
@@ -5536,7 +5821,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5536
5821
|
data: _ctx.model[_ctx.name],
|
|
5537
5822
|
columns
|
|
5538
5823
|
}, null, 8, ["data"]),
|
|
5539
|
-
createElementVNode("div", _hoisted_2$
|
|
5824
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
5540
5825
|
createVNode(unref(TMagicButton), {
|
|
5541
5826
|
size: "small",
|
|
5542
5827
|
type: "primary",
|
|
@@ -5801,7 +6086,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5801
6086
|
});
|
|
5802
6087
|
|
|
5803
6088
|
const _hoisted_1$k = { class: "m-fields-event-select" };
|
|
5804
|
-
const _hoisted_2$
|
|
6089
|
+
const _hoisted_2$c = {
|
|
5805
6090
|
key: 1,
|
|
5806
6091
|
class: "fullWidth"
|
|
5807
6092
|
};
|
|
@@ -6089,7 +6374,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6089
6374
|
model: _ctx.model,
|
|
6090
6375
|
config: tableConfig.value,
|
|
6091
6376
|
onChange: onChangeHandler
|
|
6092
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6377
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
|
|
6093
6378
|
createVNode(unref(TMagicButton), {
|
|
6094
6379
|
class: "create-button",
|
|
6095
6380
|
type: "primary",
|
|
@@ -6145,9 +6430,9 @@ const _hoisted_1$j = {
|
|
|
6145
6430
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6146
6431
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
6147
6432
|
};
|
|
6148
|
-
const _hoisted_2$
|
|
6433
|
+
const _hoisted_2$b = /* @__PURE__ */ 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);
|
|
6149
6434
|
const _hoisted_4$6 = [
|
|
6150
|
-
_hoisted_2$
|
|
6435
|
+
_hoisted_2$b
|
|
6151
6436
|
];
|
|
6152
6437
|
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
6153
6438
|
...{
|
|
@@ -6162,7 +6447,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
6162
6447
|
});
|
|
6163
6448
|
|
|
6164
6449
|
const _hoisted_1$i = { class: "m-fields-key-value" };
|
|
6165
|
-
const _hoisted_2$
|
|
6450
|
+
const _hoisted_2$a = { key: 0 };
|
|
6166
6451
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
6167
6452
|
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
6168
6453
|
...{
|
|
@@ -6223,7 +6508,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6223
6508
|
};
|
|
6224
6509
|
return (_ctx, _cache) => {
|
|
6225
6510
|
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
6226
|
-
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6511
|
+
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
|
|
6227
6512
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
6228
6513
|
return openBlock(), createElementBlock("div", {
|
|
6229
6514
|
class: "m-fields-key-value-item",
|
|
@@ -6297,7 +6582,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6297
6582
|
});
|
|
6298
6583
|
|
|
6299
6584
|
const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
|
|
6300
|
-
const _hoisted_2$
|
|
6585
|
+
const _hoisted_2$9 = { class: "page-fragment-select-container" };
|
|
6301
6586
|
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
6302
6587
|
...{
|
|
6303
6588
|
name: "MFieldsPageFragmentSelect"
|
|
@@ -6345,7 +6630,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6345
6630
|
return (_ctx, _cache) => {
|
|
6346
6631
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
6347
6632
|
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
6348
|
-
createElementVNode("div", _hoisted_2$
|
|
6633
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
6349
6634
|
createVNode(_component_m_form_container, {
|
|
6350
6635
|
class: "select",
|
|
6351
6636
|
config: selectConfig,
|
|
@@ -6401,10 +6686,11 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6401
6686
|
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
6402
6687
|
};
|
|
6403
6688
|
const clickHandler = ({ detail }) => {
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6689
|
+
const id = getIdFromEl()(detail);
|
|
6690
|
+
if (id) {
|
|
6691
|
+
props.model[props.name] = id;
|
|
6692
|
+
emit("change", id);
|
|
6693
|
+
mForm?.$emit("field-change", props.prop, id);
|
|
6408
6694
|
}
|
|
6409
6695
|
if (cancelHandler) {
|
|
6410
6696
|
cancelHandler();
|
|
@@ -6428,19 +6714,22 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6428
6714
|
}
|
|
6429
6715
|
};
|
|
6430
6716
|
const selectNode = async (id) => {
|
|
6431
|
-
|
|
6432
|
-
services
|
|
6433
|
-
services
|
|
6717
|
+
if (!services) return;
|
|
6718
|
+
await services.editorService.select(id);
|
|
6719
|
+
services.editorService.get("stage")?.select(id);
|
|
6720
|
+
services.stageOverlayService.get("stage")?.select(id);
|
|
6434
6721
|
};
|
|
6435
6722
|
const highlight = throttle((id) => {
|
|
6436
|
-
services
|
|
6437
|
-
services
|
|
6438
|
-
services
|
|
6723
|
+
if (!services) return;
|
|
6724
|
+
services.editorService.highlight(id);
|
|
6725
|
+
services.editorService.get("stage")?.highlight(id);
|
|
6726
|
+
services.stageOverlayService.get("stage")?.highlight(id);
|
|
6439
6727
|
}, 150);
|
|
6440
6728
|
const unhighlight = () => {
|
|
6441
|
-
services
|
|
6442
|
-
services
|
|
6443
|
-
services
|
|
6729
|
+
if (!services) return;
|
|
6730
|
+
services.editorService.set("highlightNode", null);
|
|
6731
|
+
services.editorService.get("stage")?.clearHighlight();
|
|
6732
|
+
services.stageOverlayService.get("stage")?.clearHighlight();
|
|
6444
6733
|
};
|
|
6445
6734
|
return (_ctx, _cache) => {
|
|
6446
6735
|
return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
|
|
@@ -6528,32 +6817,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6528
6817
|
}
|
|
6529
6818
|
});
|
|
6530
6819
|
|
|
6531
|
-
const useGetSo = (target, emit) => {
|
|
6532
|
-
let getso;
|
|
6533
|
-
const isDraging = ref(false);
|
|
6534
|
-
onMounted(() => {
|
|
6535
|
-
if (!target.value) return;
|
|
6536
|
-
getso = new Gesto(target.value, {
|
|
6537
|
-
container: window,
|
|
6538
|
-
pinchOutside: true
|
|
6539
|
-
}).on("drag", (e) => {
|
|
6540
|
-
if (!target.value) return;
|
|
6541
|
-
emit("change", e);
|
|
6542
|
-
}).on("dragStart", () => {
|
|
6543
|
-
isDraging.value = true;
|
|
6544
|
-
}).on("dragEnd", () => {
|
|
6545
|
-
isDraging.value = false;
|
|
6546
|
-
});
|
|
6547
|
-
});
|
|
6548
|
-
onBeforeUnmount(() => {
|
|
6549
|
-
getso?.unset();
|
|
6550
|
-
isDraging.value = false;
|
|
6551
|
-
});
|
|
6552
|
-
return {
|
|
6553
|
-
isDraging
|
|
6554
|
-
};
|
|
6555
|
-
};
|
|
6556
|
-
|
|
6557
6820
|
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
6558
6821
|
...{
|
|
6559
6822
|
name: "MEditorResizer"
|
|
@@ -6740,7 +7003,7 @@ const _hoisted_1$f = {
|
|
|
6740
7003
|
key: 1,
|
|
6741
7004
|
class: "menu-item-text"
|
|
6742
7005
|
};
|
|
6743
|
-
const _hoisted_2$
|
|
7006
|
+
const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6744
7007
|
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6745
7008
|
...{
|
|
6746
7009
|
name: "MEditorToolButton"
|
|
@@ -6877,7 +7140,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6877
7140
|
})) : createCommentVNode("", true)
|
|
6878
7141
|
]),
|
|
6879
7142
|
default: withCtx(() => [
|
|
6880
|
-
createElementVNode("span", _hoisted_2$
|
|
7143
|
+
createElementVNode("span", _hoisted_2$8, [
|
|
6881
7144
|
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
6882
7145
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
6883
7146
|
default: withCtx(() => [
|
|
@@ -7201,7 +7464,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
7201
7464
|
});
|
|
7202
7465
|
|
|
7203
7466
|
const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
7204
|
-
const _hoisted_2$
|
|
7467
|
+
const _hoisted_2$7 = ["page-id", "onClick"];
|
|
7205
7468
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
7206
7469
|
const _hoisted_4$5 = ["title"];
|
|
7207
7470
|
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
@@ -7355,7 +7618,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7355
7618
|
]),
|
|
7356
7619
|
_: 2
|
|
7357
7620
|
}, 1024)
|
|
7358
|
-
], 10, _hoisted_2$
|
|
7621
|
+
], 10, _hoisted_2$7);
|
|
7359
7622
|
}), 128))
|
|
7360
7623
|
]),
|
|
7361
7624
|
_: 3
|
|
@@ -7366,7 +7629,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7366
7629
|
});
|
|
7367
7630
|
|
|
7368
7631
|
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
7369
|
-
const _hoisted_2$
|
|
7632
|
+
const _hoisted_2$6 = { class: "m-editor-empty-content" };
|
|
7370
7633
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
7371
7634
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
7372
7635
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
@@ -7392,7 +7655,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
7392
7655
|
};
|
|
7393
7656
|
return (_ctx, _cache) => {
|
|
7394
7657
|
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
7395
|
-
createElementVNode("div", _hoisted_2$
|
|
7658
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
7396
7659
|
createElementVNode("div", {
|
|
7397
7660
|
class: "m-editor-empty-button",
|
|
7398
7661
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
|
|
@@ -7916,18 +8179,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7916
8179
|
}
|
|
7917
8180
|
});
|
|
7918
8181
|
|
|
7919
|
-
const updateStatus = (nodeStatusMap, id, status) => {
|
|
7920
|
-
const nodeStatus = nodeStatusMap.get(id);
|
|
7921
|
-
if (!nodeStatus) return;
|
|
7922
|
-
getKeys(status).forEach((key) => {
|
|
7923
|
-
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
7924
|
-
nodeStatus[key] = Boolean(status[key]);
|
|
7925
|
-
}
|
|
7926
|
-
});
|
|
7927
|
-
};
|
|
7928
|
-
|
|
7929
8182
|
const _hoisted_1$9 = ["draggable", "data-node-id", "data-parent-id", "data-parents-id", "data-is-container"];
|
|
7930
|
-
const _hoisted_2$
|
|
8183
|
+
const _hoisted_2$5 = { class: "tree-node-label" };
|
|
7931
8184
|
const _hoisted_3$3 = { class: "tree-node-tool" };
|
|
7932
8185
|
const _hoisted_4$3 = {
|
|
7933
8186
|
key: 0,
|
|
@@ -8017,7 +8270,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
8017
8270
|
onClick: nodeClickHandler
|
|
8018
8271
|
}, [
|
|
8019
8272
|
renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
|
|
8020
|
-
createElementVNode("div", _hoisted_2$
|
|
8273
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
8021
8274
|
renderSlot(_ctx.$slots, "tree-node-label", { data: _ctx.data }, () => [
|
|
8022
8275
|
createTextVNode(toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1)
|
|
8023
8276
|
])
|
|
@@ -8111,76 +8364,6 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
8111
8364
|
}
|
|
8112
8365
|
});
|
|
8113
8366
|
|
|
8114
|
-
const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
|
|
8115
|
-
const filterIsMatch = (value, data) => {
|
|
8116
|
-
const string = !Array.isArray(value) ? [value] : value;
|
|
8117
|
-
if (!string.length) {
|
|
8118
|
-
return true;
|
|
8119
|
-
}
|
|
8120
|
-
return string.some((v) => filterNodeMethod(v, data));
|
|
8121
|
-
};
|
|
8122
|
-
const filter = (text) => {
|
|
8123
|
-
if (!nodeData.value.length) return;
|
|
8124
|
-
nodeData.value.forEach((node) => {
|
|
8125
|
-
traverseNode(node, (node2, parents) => {
|
|
8126
|
-
if (!nodeStatusMap.value) return;
|
|
8127
|
-
const visible = filterIsMatch(text, node2);
|
|
8128
|
-
if (visible && parents.length) {
|
|
8129
|
-
parents.forEach((parent) => {
|
|
8130
|
-
updateStatus(nodeStatusMap.value, parent.id, {
|
|
8131
|
-
visible,
|
|
8132
|
-
expand: true
|
|
8133
|
-
});
|
|
8134
|
-
});
|
|
8135
|
-
}
|
|
8136
|
-
updateStatus(nodeStatusMap.value, node2.id, {
|
|
8137
|
-
visible
|
|
8138
|
-
});
|
|
8139
|
-
});
|
|
8140
|
-
});
|
|
8141
|
-
};
|
|
8142
|
-
return {
|
|
8143
|
-
filterText: ref(""),
|
|
8144
|
-
filterTextChangeHandler(text) {
|
|
8145
|
-
filter(text);
|
|
8146
|
-
}
|
|
8147
|
-
};
|
|
8148
|
-
};
|
|
8149
|
-
|
|
8150
|
-
const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
|
|
8151
|
-
const map = /* @__PURE__ */ new Map();
|
|
8152
|
-
nodeData.forEach(
|
|
8153
|
-
(node) => traverseNode(node, (node2) => {
|
|
8154
|
-
map.set(
|
|
8155
|
-
node2.id,
|
|
8156
|
-
initialLayerNodeStatus?.get(node2.id) || {
|
|
8157
|
-
visible: true,
|
|
8158
|
-
expand: false,
|
|
8159
|
-
selected: false,
|
|
8160
|
-
draggable: false
|
|
8161
|
-
}
|
|
8162
|
-
);
|
|
8163
|
-
})
|
|
8164
|
-
);
|
|
8165
|
-
return map;
|
|
8166
|
-
};
|
|
8167
|
-
const useNodeStatus$1 = (nodeData) => {
|
|
8168
|
-
const nodeStatusMap = ref(/* @__PURE__ */ new Map());
|
|
8169
|
-
watch(
|
|
8170
|
-
nodeData,
|
|
8171
|
-
(nodeData2) => {
|
|
8172
|
-
nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
|
|
8173
|
-
},
|
|
8174
|
-
{
|
|
8175
|
-
immediate: true,
|
|
8176
|
-
deep: true
|
|
8177
|
-
}
|
|
8178
|
-
);
|
|
8179
|
-
return {
|
|
8180
|
-
nodeStatusMap
|
|
8181
|
-
};
|
|
8182
|
-
};
|
|
8183
|
-
|
|
8184
8367
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
8185
8368
|
...{
|
|
8186
8369
|
name: "MEditorCodeBlockList"
|
|
@@ -8664,7 +8847,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8664
8847
|
});
|
|
8665
8848
|
|
|
8666
8849
|
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
8667
|
-
const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
|
|
8668
8850
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
8669
8851
|
...{
|
|
8670
8852
|
name: "MEditorDataSourceListPanel"
|
|
@@ -8713,7 +8895,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8713
8895
|
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
8714
8896
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
8715
8897
|
key: 0,
|
|
8716
|
-
placement: "right"
|
|
8898
|
+
placement: "right",
|
|
8899
|
+
trigger: "hover",
|
|
8900
|
+
"popper-class": "data-source-list-panel-add-menu"
|
|
8717
8901
|
}, {
|
|
8718
8902
|
reference: withCtx(() => [
|
|
8719
8903
|
createVNode(unref(TMagicButton), {
|
|
@@ -8726,21 +8910,19 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8726
8910
|
_: 1
|
|
8727
8911
|
})
|
|
8728
8912
|
]),
|
|
8729
|
-
default: withCtx(() => [
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
}), 128))
|
|
8743
|
-
])
|
|
8913
|
+
default: withCtx(() => [
|
|
8914
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
8915
|
+
return openBlock(), createBlock(_sfc_main$y, {
|
|
8916
|
+
data: {
|
|
8917
|
+
type: "button",
|
|
8918
|
+
text: item.text,
|
|
8919
|
+
handler: () => {
|
|
8920
|
+
addHandler(item.type);
|
|
8921
|
+
}
|
|
8922
|
+
},
|
|
8923
|
+
key: index
|
|
8924
|
+
}, null, 8, ["data"]);
|
|
8925
|
+
}), 128))
|
|
8744
8926
|
]),
|
|
8745
8927
|
_: 1
|
|
8746
8928
|
})) : createCommentVNode("", true),
|
|
@@ -9899,7 +10081,22 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9899
10081
|
const props = __props;
|
|
9900
10082
|
const services = inject("services");
|
|
9901
10083
|
const columnLeftWidth = computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
|
|
9902
|
-
const { height:
|
|
10084
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
10085
|
+
const columnLeftHeight = ref(0);
|
|
10086
|
+
const unWatchEditorContentHeight = watch(
|
|
10087
|
+
editorContentHeight,
|
|
10088
|
+
(height) => {
|
|
10089
|
+
if (height) {
|
|
10090
|
+
columnLeftHeight.value = height * 0.5;
|
|
10091
|
+
nextTick().then(() => {
|
|
10092
|
+
unWatchEditorContentHeight();
|
|
10093
|
+
});
|
|
10094
|
+
}
|
|
10095
|
+
},
|
|
10096
|
+
{
|
|
10097
|
+
immediate: true
|
|
10098
|
+
}
|
|
10099
|
+
);
|
|
9903
10100
|
const activeTabName = ref(props.data?.status);
|
|
9904
10101
|
const getItemConfig = (data) => {
|
|
9905
10102
|
const map = {
|
|
@@ -10153,8 +10350,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10153
10350
|
key: config.$key ?? index,
|
|
10154
10351
|
visible: unref(floatBoxStates)[config.$key].status,
|
|
10155
10352
|
"onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
|
|
10156
|
-
height:
|
|
10157
|
-
"onUpdate:height": _cache[1] || (_cache[1] = ($event) =>
|
|
10353
|
+
height: columnLeftHeight.value,
|
|
10354
|
+
"onUpdate:height": _cache[1] || (_cache[1] = ($event) => columnLeftHeight.value = $event),
|
|
10158
10355
|
width: columnLeftWidth.value,
|
|
10159
10356
|
title: config.text,
|
|
10160
10357
|
position: {
|
|
@@ -10180,133 +10377,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10180
10377
|
}
|
|
10181
10378
|
});
|
|
10182
10379
|
|
|
10183
|
-
class ScrollViewer extends EventEmitter {
|
|
10184
|
-
container;
|
|
10185
|
-
target;
|
|
10186
|
-
zoom = 1;
|
|
10187
|
-
scrollLeft = 0;
|
|
10188
|
-
scrollTop = 0;
|
|
10189
|
-
scrollHeight = 0;
|
|
10190
|
-
scrollWidth = 0;
|
|
10191
|
-
width = 0;
|
|
10192
|
-
height = 0;
|
|
10193
|
-
translateXCorrectionValue = 0;
|
|
10194
|
-
translateYCorrectionValue = 0;
|
|
10195
|
-
correctionScrollSize = {
|
|
10196
|
-
width: 0,
|
|
10197
|
-
height: 0
|
|
10198
|
-
};
|
|
10199
|
-
resizeObserver = new ResizeObserver(() => {
|
|
10200
|
-
this.setSize();
|
|
10201
|
-
this.setScrollSize();
|
|
10202
|
-
});
|
|
10203
|
-
constructor(options) {
|
|
10204
|
-
super();
|
|
10205
|
-
this.container = options.container;
|
|
10206
|
-
this.target = options.target;
|
|
10207
|
-
this.zoom = options.zoom;
|
|
10208
|
-
if (this.correctionScrollSize) {
|
|
10209
|
-
this.correctionScrollSize = {
|
|
10210
|
-
...this.correctionScrollSize,
|
|
10211
|
-
...options.correctionScrollSize
|
|
10212
|
-
};
|
|
10213
|
-
}
|
|
10214
|
-
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
10215
|
-
this.setSize();
|
|
10216
|
-
this.setScrollSize();
|
|
10217
|
-
this.resizeObserver.observe(this.container);
|
|
10218
|
-
this.resizeObserver.observe(this.target);
|
|
10219
|
-
}
|
|
10220
|
-
destroy() {
|
|
10221
|
-
this.resizeObserver.disconnect();
|
|
10222
|
-
this.container.removeEventListener("wheel", this.wheelHandler, false);
|
|
10223
|
-
this.removeAllListeners();
|
|
10224
|
-
}
|
|
10225
|
-
setZoom(zoom) {
|
|
10226
|
-
this.zoom = zoom;
|
|
10227
|
-
this.setScrollSize();
|
|
10228
|
-
}
|
|
10229
|
-
scrollTo({ left, top }) {
|
|
10230
|
-
if (typeof left !== "undefined") {
|
|
10231
|
-
this.scrollLeft = left;
|
|
10232
|
-
}
|
|
10233
|
-
if (typeof top !== "undefined") {
|
|
10234
|
-
this.scrollTop = top;
|
|
10235
|
-
}
|
|
10236
|
-
const translateX = -this.scrollLeft + this.translateXCorrectionValue;
|
|
10237
|
-
const translateY = -this.scrollTop + this.translateYCorrectionValue;
|
|
10238
|
-
this.target.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
10239
|
-
}
|
|
10240
|
-
wheelHandler = (event) => {
|
|
10241
|
-
const { deltaX, deltaY, currentTarget } = event;
|
|
10242
|
-
if (currentTarget !== this.container) return;
|
|
10243
|
-
let top;
|
|
10244
|
-
if (this.scrollHeight > this.height) {
|
|
10245
|
-
top = this.scrollTop + this.getPos(deltaY, this.scrollTop, this.scrollHeight, this.height);
|
|
10246
|
-
}
|
|
10247
|
-
let left;
|
|
10248
|
-
if (this.scrollWidth > this.width) {
|
|
10249
|
-
left = this.scrollLeft + this.getPos(deltaX, this.scrollLeft, this.scrollWidth, this.width);
|
|
10250
|
-
}
|
|
10251
|
-
this.scrollTo({ left, top });
|
|
10252
|
-
this.emit("scroll", {
|
|
10253
|
-
scrollLeft: this.scrollLeft,
|
|
10254
|
-
scrollTop: this.scrollTop,
|
|
10255
|
-
scrollHeight: this.scrollHeight,
|
|
10256
|
-
scrollWidth: this.scrollWidth
|
|
10257
|
-
});
|
|
10258
|
-
};
|
|
10259
|
-
getPos(delta, scrollPos, scrollSize, size) {
|
|
10260
|
-
let pos = 0;
|
|
10261
|
-
if (delta < 0) {
|
|
10262
|
-
if (scrollPos > 0) {
|
|
10263
|
-
pos = Math.max(delta, -scrollPos);
|
|
10264
|
-
}
|
|
10265
|
-
} else {
|
|
10266
|
-
const leftPos = scrollSize - size - scrollPos;
|
|
10267
|
-
if (leftPos > 0) {
|
|
10268
|
-
pos = Math.min(delta, leftPos);
|
|
10269
|
-
}
|
|
10270
|
-
}
|
|
10271
|
-
return pos;
|
|
10272
|
-
}
|
|
10273
|
-
setScrollSize = () => {
|
|
10274
|
-
const targetRect = this.target.getBoundingClientRect();
|
|
10275
|
-
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
10276
|
-
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
10277
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
10278
|
-
let left;
|
|
10279
|
-
let top;
|
|
10280
|
-
if (this.scrollWidth < this.width) {
|
|
10281
|
-
left = 0;
|
|
10282
|
-
this.translateXCorrectionValue = 0;
|
|
10283
|
-
} else {
|
|
10284
|
-
this.translateXCorrectionValue = (this.scrollWidth - this.width) / 2;
|
|
10285
|
-
}
|
|
10286
|
-
if (this.scrollHeight < this.height) {
|
|
10287
|
-
top = 0;
|
|
10288
|
-
this.translateYCorrectionValue = 0;
|
|
10289
|
-
} else {
|
|
10290
|
-
this.translateYCorrectionValue = (this.scrollHeight - this.height) / 2;
|
|
10291
|
-
}
|
|
10292
|
-
this.scrollTo({
|
|
10293
|
-
left,
|
|
10294
|
-
top
|
|
10295
|
-
});
|
|
10296
|
-
this.emit("scroll", {
|
|
10297
|
-
scrollLeft: this.scrollLeft,
|
|
10298
|
-
scrollTop: this.scrollTop,
|
|
10299
|
-
scrollHeight: this.scrollHeight,
|
|
10300
|
-
scrollWidth: this.scrollWidth
|
|
10301
|
-
});
|
|
10302
|
-
};
|
|
10303
|
-
setSize = () => {
|
|
10304
|
-
const { width, height } = this.container.getBoundingClientRect();
|
|
10305
|
-
this.width = width;
|
|
10306
|
-
this.height = height;
|
|
10307
|
-
};
|
|
10308
|
-
}
|
|
10309
|
-
|
|
10310
10380
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
10311
10381
|
...{
|
|
10312
10382
|
name: "MEditorScrollBar"
|
|
@@ -10522,7 +10592,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10522
10592
|
nextTick(() => unWatch());
|
|
10523
10593
|
stage2.on("select", (el, event) => {
|
|
10524
10594
|
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
10525
|
-
const ids = els.map((el2) => el2
|
|
10595
|
+
const ids = els.map((el2) => getIdFromEl()(el2)).filter((id) => Boolean(id));
|
|
10526
10596
|
buttonVisible.value = ids.length > 3;
|
|
10527
10597
|
filterTextChangeHandler(ids);
|
|
10528
10598
|
});
|
|
@@ -10951,8 +11021,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10951
11021
|
const doc = stage?.renderer.contentWindow?.document;
|
|
10952
11022
|
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
10953
11023
|
let parent = page.value;
|
|
10954
|
-
|
|
10955
|
-
|
|
11024
|
+
const parentId = getIdFromEl()(parentEl);
|
|
11025
|
+
if (parentId) {
|
|
11026
|
+
parent = services?.editorService.getNodeById(parentId, false);
|
|
10956
11027
|
}
|
|
10957
11028
|
if (parent && stageContainer.value && stage) {
|
|
10958
11029
|
const layout = await services?.editorService.getLayout(parent);
|
|
@@ -11530,52 +11601,6 @@ class DataSource extends BaseService {
|
|
|
11530
11601
|
}
|
|
11531
11602
|
const dataSourceService = new DataSource();
|
|
11532
11603
|
|
|
11533
|
-
globalThis.requestIdleCallback = globalThis.requestIdleCallback || function(cb) {
|
|
11534
|
-
const start = Date.now();
|
|
11535
|
-
return setTimeout(() => {
|
|
11536
|
-
cb({
|
|
11537
|
-
didTimeout: false,
|
|
11538
|
-
timeRemaining() {
|
|
11539
|
-
return Math.max(0, 50 - (Date.now() - start));
|
|
11540
|
-
}
|
|
11541
|
-
});
|
|
11542
|
-
}, 1);
|
|
11543
|
-
};
|
|
11544
|
-
class IdleTask extends EventEmitter {
|
|
11545
|
-
taskList = [];
|
|
11546
|
-
taskHandle = null;
|
|
11547
|
-
enqueueTask(taskHandler, taskData) {
|
|
11548
|
-
this.taskList.push({
|
|
11549
|
-
handler: taskHandler,
|
|
11550
|
-
data: taskData
|
|
11551
|
-
});
|
|
11552
|
-
if (!this.taskHandle) {
|
|
11553
|
-
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
11554
|
-
}
|
|
11555
|
-
}
|
|
11556
|
-
on(eventName, listener) {
|
|
11557
|
-
return super.on(eventName, listener);
|
|
11558
|
-
}
|
|
11559
|
-
once(eventName, listener) {
|
|
11560
|
-
return super.once(eventName, listener);
|
|
11561
|
-
}
|
|
11562
|
-
emit(eventName, ...args) {
|
|
11563
|
-
return super.emit(eventName, ...args);
|
|
11564
|
-
}
|
|
11565
|
-
runTaskQueue(deadline) {
|
|
11566
|
-
while ((deadline.timeRemaining() > 15 || deadline.didTimeout) && this.taskList.length) {
|
|
11567
|
-
const task = this.taskList.shift();
|
|
11568
|
-
task.handler(task.data);
|
|
11569
|
-
}
|
|
11570
|
-
if (this.taskList.length) {
|
|
11571
|
-
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
|
|
11572
|
-
} else {
|
|
11573
|
-
this.taskHandle = 0;
|
|
11574
|
-
this.emit("finish");
|
|
11575
|
-
}
|
|
11576
|
-
}
|
|
11577
|
-
}
|
|
11578
|
-
|
|
11579
11604
|
const idleTask = new IdleTask();
|
|
11580
11605
|
class Dep extends BaseService {
|
|
11581
11606
|
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
@@ -12017,7 +12042,8 @@ class StageOverlay extends BaseService {
|
|
|
12017
12042
|
subStage?.renderer.contentWindow?.magic.onPageElUpdate(wrapDiv);
|
|
12018
12043
|
});
|
|
12019
12044
|
if (await stageOptions?.canSelect?.(contentEl)) {
|
|
12020
|
-
|
|
12045
|
+
const id = getIdFromEl()(contentEl);
|
|
12046
|
+
id && subStage?.select(id);
|
|
12021
12047
|
}
|
|
12022
12048
|
}
|
|
12023
12049
|
updateHandler = () => {
|
|
@@ -12068,7 +12094,7 @@ const defaultEditorProps = {
|
|
|
12068
12094
|
eventMethodList: () => ({}),
|
|
12069
12095
|
datasourceValues: () => ({}),
|
|
12070
12096
|
datasourceConfigs: () => ({}),
|
|
12071
|
-
canSelect: (el) => Boolean(el
|
|
12097
|
+
canSelect: (el) => Boolean(getIdFromEl()(el)),
|
|
12072
12098
|
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
12073
12099
|
codeOptions: () => ({})
|
|
12074
12100
|
};
|
|
@@ -12213,6 +12239,44 @@ const initServiceState = (props, {
|
|
|
12213
12239
|
});
|
|
12214
12240
|
};
|
|
12215
12241
|
const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
|
|
12242
|
+
const rootChangeHandler = async (value, preValue) => {
|
|
12243
|
+
if (!value) return;
|
|
12244
|
+
value.codeBlocks = value.codeBlocks || {};
|
|
12245
|
+
value.dataSources = value.dataSources || [];
|
|
12246
|
+
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
12247
|
+
dataSourceService.set("dataSources", value.dataSources);
|
|
12248
|
+
depService.removeTargets(DepTargetType.CODE_BLOCK);
|
|
12249
|
+
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
12250
|
+
depService.addTarget(createCodeBlockTarget(id, code));
|
|
12251
|
+
});
|
|
12252
|
+
dataSourceService.get("dataSources").forEach((ds) => {
|
|
12253
|
+
initDataSourceDepTarget(ds);
|
|
12254
|
+
});
|
|
12255
|
+
if (Array.isArray(value.items)) {
|
|
12256
|
+
collectIdle(value.items, true);
|
|
12257
|
+
} else {
|
|
12258
|
+
depService.clear();
|
|
12259
|
+
delete value.dataSourceDeps;
|
|
12260
|
+
delete value.dataSourceCondDeps;
|
|
12261
|
+
}
|
|
12262
|
+
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
12263
|
+
let node;
|
|
12264
|
+
if (nodeId) {
|
|
12265
|
+
node = editorService.getNodeById(nodeId);
|
|
12266
|
+
}
|
|
12267
|
+
if (node && node !== value) {
|
|
12268
|
+
await editorService.select(node.id);
|
|
12269
|
+
} else if (value.items?.length) {
|
|
12270
|
+
await editorService.select(value.items[0]);
|
|
12271
|
+
} else if (value.id) {
|
|
12272
|
+
editorService.set("nodes", [value]);
|
|
12273
|
+
editorService.set("parent", null);
|
|
12274
|
+
editorService.set("page", null);
|
|
12275
|
+
}
|
|
12276
|
+
if (toRaw(value) !== toRaw(preValue)) {
|
|
12277
|
+
emit("update:modelValue", value);
|
|
12278
|
+
}
|
|
12279
|
+
};
|
|
12216
12280
|
const getApp = () => {
|
|
12217
12281
|
const stage = editorService.get("stage");
|
|
12218
12282
|
return stage?.renderer.runtime?.getApp?.();
|
|
@@ -12292,45 +12356,6 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12292
12356
|
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
12293
12357
|
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
12294
12358
|
};
|
|
12295
|
-
const rootChangeHandler = async (value, preValue) => {
|
|
12296
|
-
if (!value) return;
|
|
12297
|
-
value.codeBlocks = value.codeBlocks || {};
|
|
12298
|
-
value.dataSources = value.dataSources || [];
|
|
12299
|
-
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
12300
|
-
dataSourceService.set("dataSources", value.dataSources);
|
|
12301
|
-
depService.removeTargets(DepTargetType.CODE_BLOCK);
|
|
12302
|
-
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
12303
|
-
depService.addTarget(createCodeBlockTarget(id, code));
|
|
12304
|
-
});
|
|
12305
|
-
dataSourceService.get("dataSources").forEach((ds) => {
|
|
12306
|
-
initDataSourceDepTarget(ds);
|
|
12307
|
-
});
|
|
12308
|
-
if (Array.isArray(value.items)) {
|
|
12309
|
-
value.items.forEach((page) => {
|
|
12310
|
-
depService.collectIdle([page], { pageId: page.id }, true);
|
|
12311
|
-
});
|
|
12312
|
-
} else {
|
|
12313
|
-
depService.clear();
|
|
12314
|
-
delete value.dataSourceDeps;
|
|
12315
|
-
}
|
|
12316
|
-
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
12317
|
-
let node;
|
|
12318
|
-
if (nodeId) {
|
|
12319
|
-
node = editorService.getNodeById(nodeId);
|
|
12320
|
-
}
|
|
12321
|
-
if (node && node !== value) {
|
|
12322
|
-
await editorService.select(node.id);
|
|
12323
|
-
} else if (value.items?.length) {
|
|
12324
|
-
await editorService.select(value.items[0]);
|
|
12325
|
-
} else if (value.id) {
|
|
12326
|
-
editorService.set("nodes", [value]);
|
|
12327
|
-
editorService.set("parent", null);
|
|
12328
|
-
editorService.set("page", null);
|
|
12329
|
-
}
|
|
12330
|
-
if (toRaw(value) !== toRaw(preValue)) {
|
|
12331
|
-
emit("update:modelValue", value);
|
|
12332
|
-
}
|
|
12333
|
-
};
|
|
12334
12359
|
const collectIdle = (nodes, deep) => {
|
|
12335
12360
|
nodes.forEach((node) => {
|
|
12336
12361
|
let pageId;
|
|
@@ -12353,7 +12378,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12353
12378
|
depService.clear(nodes);
|
|
12354
12379
|
};
|
|
12355
12380
|
const historyChangeHandler = (page) => {
|
|
12356
|
-
|
|
12381
|
+
collectIdle([page], true);
|
|
12357
12382
|
};
|
|
12358
12383
|
editorService.on("history-change", historyChangeHandler);
|
|
12359
12384
|
editorService.on("root-change", rootChangeHandler);
|
|
@@ -12380,9 +12405,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12380
12405
|
const root = editorService.get("root");
|
|
12381
12406
|
removeDataSourceTarget(config.id);
|
|
12382
12407
|
initDataSourceDepTarget(config);
|
|
12383
|
-
(root?.items || [])
|
|
12384
|
-
depService.collectIdle([page], { pageId: page.id }, true);
|
|
12385
|
-
});
|
|
12408
|
+
collectIdle(root?.items || [], true);
|
|
12386
12409
|
};
|
|
12387
12410
|
const removeDataSourceTarget = (id) => {
|
|
12388
12411
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
@@ -12660,4 +12683,4 @@ const index = {
|
|
|
12660
12683
|
}
|
|
12661
12684
|
};
|
|
12662
12685
|
|
|
12663
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$L as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$U as CodeSelect, _sfc_main$S as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$R as CondOpSelect, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$N as DataSourceFieldSelect, _sfc_main$P as DataSourceFields, _sfc_main$M as DataSourceInput, _sfc_main$J as DataSourceMethodSelect, _sfc_main$K as DataSourceMethods, _sfc_main$I as DataSourceMocks, _sfc_main$H as DataSourceSelect, _sfc_main$G as DisplayConds, DragType, _sfc_main$F as EventSelect, Fixed2Other, _sfc_main$Q as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$Y as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$A as Resizer, SideItemKey, _sfc_main$z as SplitView, _sfc_main$X as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, 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, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, moveItemsInContainer, numberOptions, propsService, removeDataSourceFieldPrefix, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFloatBox, useStage, useWindowRect, warn };
|
|
12686
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$L as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$U as CodeSelect, _sfc_main$S as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$R as CondOpSelect, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$N as DataSourceFieldSelect, _sfc_main$P as DataSourceFields, _sfc_main$M as DataSourceInput, _sfc_main$J as DataSourceMethodSelect, _sfc_main$K as DataSourceMethods, _sfc_main$I as DataSourceMocks, _sfc_main$H as DataSourceSelect, _sfc_main$G as DisplayConds, DragType, _sfc_main$F as EventSelect, Fixed2Other, _sfc_main$Q as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$Y as Icon, IdleTask, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$A as Resizer, ScrollViewer, SideItemKey, _sfc_main$z as SplitView, _sfc_main$X as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, _sfc_main$m as Tree, _sfc_main$n 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, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, moveItemsInContainer, numberOptions, propsService, removeDataSourceFieldPrefix, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, updateStatus, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus$1 as useNodeStatus, useStage, useWindowRect, warn };
|