@tmagic/editor 1.4.15 → 1.5.0-beta.0
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 +2 -2
- package/dist/tmagic-editor.js +274 -265
- package/dist/tmagic-editor.umd.cjs +275 -262
- package/package.json +13 -17
- 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/use-stage.ts +13 -7
- package/src/initService.ts +50 -53
- 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/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 +6484 -49
- package/src/shims-vue.d.ts +0 -6
- 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 -73
- package/types/components/FloatingBox.vue.d.ts +0 -68
- package/types/components/Icon.vue.d.ts +0 -15
- package/types/components/Resizer.vue.d.ts +0 -14
- package/types/components/ScrollBar.vue.d.ts +0 -25
- package/types/components/ScrollViewer.vue.d.ts +0 -79
- package/types/components/SearchInput.vue.d.ts +0 -6
- package/types/components/SplitView.vue.d.ts +0 -70
- package/types/components/ToolButton.vue.d.ts +0 -41
- package/types/components/Tree.vue.d.ts +0 -81
- package/types/components/TreeNode.vue.d.ts +0 -81
- 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 -100
- package/types/hooks/use-data-source-edit.d.ts +0 -93
- package/types/hooks/use-data-source-method.d.ts +0 -98
- 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 -15
- package/types/hooks/use-getso.d.ts +0 -5
- package/types/hooks/use-next-float-box-position.d.ts +0 -9
- package/types/hooks/use-node-status.d.ts +0 -11
- 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 -23
- package/types/layouts/NavMenu.vue.d.ts +0 -35
- package/types/layouts/PropsPanel.vue.d.ts +0 -284
- package/types/layouts/page-bar/AddButton.vue.d.ts +0 -16
- package/types/layouts/page-bar/PageBar.vue.d.ts +0 -34
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +0 -27
- package/types/layouts/page-bar/PageList.vue.d.ts +0 -25
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +0 -20
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -8
- package/types/layouts/sidebar/Sidebar.vue.d.ts +0 -49
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +0 -30
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +0 -22
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +0 -31
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +0 -16
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +0 -8
- 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 -23
- package/types/layouts/sidebar/layer/use-click.d.ts +0 -64
- 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 -11
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +0 -2
- package/types/layouts/workspace/Workspace.vue.d.ts +0 -39
- 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 -66
- 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 -658
- 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 -14
- 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 -38
- 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
|
];
|
|
@@ -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", () => {
|
|
@@ -4639,7 +4828,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4639
4828
|
const fieldQuerySearch = (queryString, leftAngleIndex, dotIndex, cb) => {
|
|
4640
4829
|
let result = [];
|
|
4641
4830
|
const dsKey = queryString.substring(leftAngleIndex + 1, dotIndex);
|
|
4642
|
-
const keys = dsKey
|
|
4831
|
+
const keys = getKeysArray(dsKey);
|
|
4643
4832
|
const dsId = keys.shift();
|
|
4644
4833
|
const ds = dataSources.value.find((ds2) => ds2.id === dsId);
|
|
4645
4834
|
if (!ds) {
|
|
@@ -6401,10 +6590,11 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6401
6590
|
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler);
|
|
6402
6591
|
};
|
|
6403
6592
|
const clickHandler = ({ detail }) => {
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6593
|
+
const id = getIdFromEl()(detail);
|
|
6594
|
+
if (id) {
|
|
6595
|
+
props.model[props.name] = id;
|
|
6596
|
+
emit("change", id);
|
|
6597
|
+
mForm?.$emit("field-change", props.prop, id);
|
|
6408
6598
|
}
|
|
6409
6599
|
if (cancelHandler) {
|
|
6410
6600
|
cancelHandler();
|
|
@@ -6428,19 +6618,22 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6428
6618
|
}
|
|
6429
6619
|
};
|
|
6430
6620
|
const selectNode = async (id) => {
|
|
6431
|
-
|
|
6432
|
-
services
|
|
6433
|
-
services
|
|
6621
|
+
if (!services) return;
|
|
6622
|
+
await services.editorService.select(id);
|
|
6623
|
+
services.editorService.get("stage")?.select(id);
|
|
6624
|
+
services.stageOverlayService.get("stage")?.select(id);
|
|
6434
6625
|
};
|
|
6435
6626
|
const highlight = throttle((id) => {
|
|
6436
|
-
services
|
|
6437
|
-
services
|
|
6438
|
-
services
|
|
6627
|
+
if (!services) return;
|
|
6628
|
+
services.editorService.highlight(id);
|
|
6629
|
+
services.editorService.get("stage")?.highlight(id);
|
|
6630
|
+
services.stageOverlayService.get("stage")?.highlight(id);
|
|
6439
6631
|
}, 150);
|
|
6440
6632
|
const unhighlight = () => {
|
|
6441
|
-
services
|
|
6442
|
-
services
|
|
6443
|
-
services
|
|
6633
|
+
if (!services) return;
|
|
6634
|
+
services.editorService.set("highlightNode", null);
|
|
6635
|
+
services.editorService.get("stage")?.clearHighlight();
|
|
6636
|
+
services.stageOverlayService.get("stage")?.clearHighlight();
|
|
6444
6637
|
};
|
|
6445
6638
|
return (_ctx, _cache) => {
|
|
6446
6639
|
return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
|
|
@@ -7916,16 +8109,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
7916
8109
|
}
|
|
7917
8110
|
});
|
|
7918
8111
|
|
|
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
8112
|
const _hoisted_1$9 = ["draggable", "data-node-id", "data-parent-id", "data-parents-id", "data-is-container"];
|
|
7930
8113
|
const _hoisted_2$6 = { class: "tree-node-label" };
|
|
7931
8114
|
const _hoisted_3$3 = { class: "tree-node-tool" };
|
|
@@ -10180,133 +10363,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
10180
10363
|
}
|
|
10181
10364
|
});
|
|
10182
10365
|
|
|
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
10366
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
10311
10367
|
...{
|
|
10312
10368
|
name: "MEditorScrollBar"
|
|
@@ -10522,7 +10578,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10522
10578
|
nextTick(() => unWatch());
|
|
10523
10579
|
stage2.on("select", (el, event) => {
|
|
10524
10580
|
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
10525
|
-
const ids = els.map((el2) => el2
|
|
10581
|
+
const ids = els.map((el2) => getIdFromEl()(el2)).filter((id) => Boolean(id));
|
|
10526
10582
|
buttonVisible.value = ids.length > 3;
|
|
10527
10583
|
filterTextChangeHandler(ids);
|
|
10528
10584
|
});
|
|
@@ -10951,8 +11007,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10951
11007
|
const doc = stage?.renderer.contentWindow?.document;
|
|
10952
11008
|
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
10953
11009
|
let parent = page.value;
|
|
10954
|
-
|
|
10955
|
-
|
|
11010
|
+
const parentId = getIdFromEl()(parentEl);
|
|
11011
|
+
if (parentId) {
|
|
11012
|
+
parent = services?.editorService.getNodeById(parentId, false);
|
|
10956
11013
|
}
|
|
10957
11014
|
if (parent && stageContainer.value && stage) {
|
|
10958
11015
|
const layout = await services?.editorService.getLayout(parent);
|
|
@@ -11530,52 +11587,6 @@ class DataSource extends BaseService {
|
|
|
11530
11587
|
}
|
|
11531
11588
|
const dataSourceService = new DataSource();
|
|
11532
11589
|
|
|
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
11590
|
const idleTask = new IdleTask();
|
|
11580
11591
|
class Dep extends BaseService {
|
|
11581
11592
|
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
@@ -12017,7 +12028,8 @@ class StageOverlay extends BaseService {
|
|
|
12017
12028
|
subStage?.renderer.contentWindow?.magic.onPageElUpdate(wrapDiv);
|
|
12018
12029
|
});
|
|
12019
12030
|
if (await stageOptions?.canSelect?.(contentEl)) {
|
|
12020
|
-
|
|
12031
|
+
const id = getIdFromEl()(contentEl);
|
|
12032
|
+
id && subStage?.select(id);
|
|
12021
12033
|
}
|
|
12022
12034
|
}
|
|
12023
12035
|
updateHandler = () => {
|
|
@@ -12068,7 +12080,7 @@ const defaultEditorProps = {
|
|
|
12068
12080
|
eventMethodList: () => ({}),
|
|
12069
12081
|
datasourceValues: () => ({}),
|
|
12070
12082
|
datasourceConfigs: () => ({}),
|
|
12071
|
-
canSelect: (el) => Boolean(el
|
|
12083
|
+
canSelect: (el) => Boolean(getIdFromEl()(el)),
|
|
12072
12084
|
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
12073
12085
|
codeOptions: () => ({})
|
|
12074
12086
|
};
|
|
@@ -12213,6 +12225,44 @@ const initServiceState = (props, {
|
|
|
12213
12225
|
});
|
|
12214
12226
|
};
|
|
12215
12227
|
const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
|
|
12228
|
+
const rootChangeHandler = async (value, preValue) => {
|
|
12229
|
+
if (!value) return;
|
|
12230
|
+
value.codeBlocks = value.codeBlocks || {};
|
|
12231
|
+
value.dataSources = value.dataSources || [];
|
|
12232
|
+
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
12233
|
+
dataSourceService.set("dataSources", value.dataSources);
|
|
12234
|
+
depService.removeTargets(DepTargetType.CODE_BLOCK);
|
|
12235
|
+
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
12236
|
+
depService.addTarget(createCodeBlockTarget(id, code));
|
|
12237
|
+
});
|
|
12238
|
+
dataSourceService.get("dataSources").forEach((ds) => {
|
|
12239
|
+
initDataSourceDepTarget(ds);
|
|
12240
|
+
});
|
|
12241
|
+
if (Array.isArray(value.items)) {
|
|
12242
|
+
collectIdle(value.items, true);
|
|
12243
|
+
} else {
|
|
12244
|
+
depService.clear();
|
|
12245
|
+
delete value.dataSourceDeps;
|
|
12246
|
+
delete value.dataSourceCondDeps;
|
|
12247
|
+
}
|
|
12248
|
+
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
12249
|
+
let node;
|
|
12250
|
+
if (nodeId) {
|
|
12251
|
+
node = editorService.getNodeById(nodeId);
|
|
12252
|
+
}
|
|
12253
|
+
if (node && node !== value) {
|
|
12254
|
+
await editorService.select(node.id);
|
|
12255
|
+
} else if (value.items?.length) {
|
|
12256
|
+
await editorService.select(value.items[0]);
|
|
12257
|
+
} else if (value.id) {
|
|
12258
|
+
editorService.set("nodes", [value]);
|
|
12259
|
+
editorService.set("parent", null);
|
|
12260
|
+
editorService.set("page", null);
|
|
12261
|
+
}
|
|
12262
|
+
if (toRaw(value) !== toRaw(preValue)) {
|
|
12263
|
+
emit("update:modelValue", value);
|
|
12264
|
+
}
|
|
12265
|
+
};
|
|
12216
12266
|
const getApp = () => {
|
|
12217
12267
|
const stage = editorService.get("stage");
|
|
12218
12268
|
return stage?.renderer.runtime?.getApp?.();
|
|
@@ -12292,45 +12342,6 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12292
12342
|
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
12293
12343
|
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
12294
12344
|
};
|
|
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
12345
|
const collectIdle = (nodes, deep) => {
|
|
12335
12346
|
nodes.forEach((node) => {
|
|
12336
12347
|
let pageId;
|
|
@@ -12353,7 +12364,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12353
12364
|
depService.clear(nodes);
|
|
12354
12365
|
};
|
|
12355
12366
|
const historyChangeHandler = (page) => {
|
|
12356
|
-
|
|
12367
|
+
collectIdle([page], true);
|
|
12357
12368
|
};
|
|
12358
12369
|
editorService.on("history-change", historyChangeHandler);
|
|
12359
12370
|
editorService.on("root-change", rootChangeHandler);
|
|
@@ -12380,9 +12391,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12380
12391
|
const root = editorService.get("root");
|
|
12381
12392
|
removeDataSourceTarget(config.id);
|
|
12382
12393
|
initDataSourceDepTarget(config);
|
|
12383
|
-
(root?.items || [])
|
|
12384
|
-
depService.collectIdle([page], { pageId: page.id }, true);
|
|
12385
|
-
});
|
|
12394
|
+
collectIdle(root?.items || [], true);
|
|
12386
12395
|
};
|
|
12387
12396
|
const removeDataSourceTarget = (id) => {
|
|
12388
12397
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
@@ -12660,4 +12669,4 @@ const index = {
|
|
|
12660
12669
|
}
|
|
12661
12670
|
};
|
|
12662
12671
|
|
|
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 };
|
|
12672
|
+
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, 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, useFloatBox, useStage, useWindowRect, warn };
|