@tmagic/editor 1.3.0-beta.7 → 1.3.0-beta.8
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/tmagic-editor.js +62 -46
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +62 -46
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/components/ContentMenu.vue +2 -6
- package/src/components/SplitView.vue +22 -6
- package/src/layouts/Framework.vue +11 -21
- package/src/layouts/sidebar/data-source/DataSourceList.vue +24 -15
- package/src/layouts/workspace/viewer/NodeListMenu.vue +11 -2
- package/src/services/dep.ts +1 -1
- package/src/utils/dep.ts +7 -2
- package/types/components/ContentMenu.vue.d.ts +4 -1
- package/types/components/SplitView.vue.d.ts +3 -1
|
@@ -4990,19 +4990,22 @@
|
|
|
4990
4990
|
centerClass: {}
|
|
4991
4991
|
},
|
|
4992
4992
|
emits: ["update:left", "change", "update:right"],
|
|
4993
|
-
setup(__props, { emit }) {
|
|
4993
|
+
setup(__props, { expose: __expose, emit }) {
|
|
4994
4994
|
const props = __props;
|
|
4995
4995
|
const el = vue.ref();
|
|
4996
4996
|
const hasLeft = vue.computed(() => typeof props.left !== "undefined");
|
|
4997
4997
|
const hasRight = vue.computed(() => typeof props.right !== "undefined");
|
|
4998
|
-
const getCenterWidth = (clientWidth2,
|
|
4998
|
+
const getCenterWidth = (clientWidth2, l = 0, r = 0) => {
|
|
4999
|
+
let right = r > 0 ? r : 0;
|
|
5000
|
+
let left = l > 0 ? l : 0;
|
|
4999
5001
|
let center2 = clientWidth2 - left - right;
|
|
5000
5002
|
if (center2 < props.minCenter) {
|
|
5001
5003
|
center2 = props.minCenter;
|
|
5002
|
-
if (
|
|
5003
|
-
right = clientWidth2 - left -
|
|
5004
|
+
if (right > center2 + props.minRight) {
|
|
5005
|
+
right = clientWidth2 - left - center2;
|
|
5004
5006
|
} else {
|
|
5005
|
-
|
|
5007
|
+
right = props.minRight;
|
|
5008
|
+
left = clientWidth2 - right - center2;
|
|
5006
5009
|
}
|
|
5007
5010
|
}
|
|
5008
5011
|
return {
|
|
@@ -5065,7 +5068,7 @@
|
|
|
5065
5068
|
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
5066
5069
|
right = props.right;
|
|
5067
5070
|
}
|
|
5068
|
-
const columnWidth = getCenterWidth(clientWidth, props.left
|
|
5071
|
+
const columnWidth = getCenterWidth(clientWidth, props.left, right);
|
|
5069
5072
|
center.value = columnWidth.center;
|
|
5070
5073
|
emit("change", {
|
|
5071
5074
|
left: columnWidth.left,
|
|
@@ -5073,11 +5076,22 @@
|
|
|
5073
5076
|
right: columnWidth.right
|
|
5074
5077
|
});
|
|
5075
5078
|
};
|
|
5079
|
+
__expose({
|
|
5080
|
+
updateWidth() {
|
|
5081
|
+
const columnWidth = getCenterWidth(el.value?.clientWidth || clientWidth, props.left, props.right);
|
|
5082
|
+
emit("change", {
|
|
5083
|
+
left: columnWidth.left,
|
|
5084
|
+
center: center.value,
|
|
5085
|
+
right: columnWidth.right
|
|
5086
|
+
});
|
|
5087
|
+
}
|
|
5088
|
+
});
|
|
5076
5089
|
return (_ctx, _cache) => {
|
|
5077
5090
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
5078
5091
|
ref_key: "el",
|
|
5079
5092
|
ref: el,
|
|
5080
|
-
class: "m-editor-layout"
|
|
5093
|
+
class: "m-editor-layout",
|
|
5094
|
+
style: vue.normalizeStyle(`min-width: ${props.minCenter + props.minLeft + props.minRight}px`)
|
|
5081
5095
|
}, [
|
|
5082
5096
|
hasLeft.value && _ctx.$slots.left ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
5083
5097
|
vue.createElementVNode("div", {
|
|
@@ -5103,7 +5117,7 @@
|
|
|
5103
5117
|
vue.renderSlot(_ctx.$slots, "right")
|
|
5104
5118
|
], 6)
|
|
5105
5119
|
], 64)) : vue.createCommentVNode("", true)
|
|
5106
|
-
],
|
|
5120
|
+
], 4);
|
|
5107
5121
|
};
|
|
5108
5122
|
}
|
|
5109
5123
|
});
|
|
@@ -5161,31 +5175,21 @@
|
|
|
5161
5175
|
const codeOptions = vue.inject("codeOptions", {});
|
|
5162
5176
|
const { editorService, uiService } = vue.inject("services") || {};
|
|
5163
5177
|
const content = vue.ref();
|
|
5178
|
+
const splitView = vue.ref();
|
|
5164
5179
|
const root = vue.computed(() => editorService?.get("root"));
|
|
5165
5180
|
const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
|
|
5166
5181
|
const showSrc = vue.computed(() => uiService?.get("showSrc"));
|
|
5167
|
-
const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
|
|
5168
|
-
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
|
|
5182
|
+
const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
5183
|
+
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
5169
5184
|
const columnWidth = vue.ref({
|
|
5170
5185
|
left: leftColumnWidthCacheData,
|
|
5171
5186
|
center: 0,
|
|
5172
5187
|
right: RightColumnWidthCacheData
|
|
5173
5188
|
});
|
|
5174
5189
|
vue.watch(
|
|
5175
|
-
pageLength,
|
|
5176
|
-
(
|
|
5177
|
-
|
|
5178
|
-
columnWidth.value.left = left;
|
|
5179
|
-
const container = content.value || document.body;
|
|
5180
|
-
if (length <= 0) {
|
|
5181
|
-
columnWidth.value.right = void 0;
|
|
5182
|
-
columnWidth.value.center = container.clientWidth - left;
|
|
5183
|
-
} else {
|
|
5184
|
-
const right = columnWidth.value.right || RightColumnWidthCacheData || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
5185
|
-
columnWidth.value.right = right;
|
|
5186
|
-
columnWidth.value.center = container.clientWidth - left - right;
|
|
5187
|
-
}
|
|
5188
|
-
uiService?.set("columnWidth", columnWidth.value);
|
|
5190
|
+
[pageLength, splitView],
|
|
5191
|
+
() => {
|
|
5192
|
+
splitView.value?.updateWidth();
|
|
5189
5193
|
},
|
|
5190
5194
|
{
|
|
5191
5195
|
immediate: true
|
|
@@ -5223,7 +5227,8 @@
|
|
|
5223
5227
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
5224
5228
|
class: "m-editor",
|
|
5225
5229
|
ref_key: "content",
|
|
5226
|
-
ref: content
|
|
5230
|
+
ref: content,
|
|
5231
|
+
style: { "min-width": "180px" }
|
|
5227
5232
|
}, [
|
|
5228
5233
|
vue.renderSlot(_ctx.$slots, "header"),
|
|
5229
5234
|
vue.renderSlot(_ctx.$slots, "nav"),
|
|
@@ -5237,6 +5242,8 @@
|
|
|
5237
5242
|
}, null, 8, ["init-values", "options"])
|
|
5238
5243
|
]) : (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
5239
5244
|
key: 1,
|
|
5245
|
+
ref_key: "splitView",
|
|
5246
|
+
ref: splitView,
|
|
5240
5247
|
class: "m-editor-content",
|
|
5241
5248
|
"left-class": "m-editor-framework-left",
|
|
5242
5249
|
"center-class": "m-editor-framework-center",
|
|
@@ -5247,6 +5254,7 @@
|
|
|
5247
5254
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
5248
5255
|
"min-left": 65,
|
|
5249
5256
|
"min-right": 20,
|
|
5257
|
+
"min-center": 100,
|
|
5250
5258
|
onChange: columnWidthChange
|
|
5251
5259
|
}, vue.createSlots({
|
|
5252
5260
|
left: vue.withCtx(() => [
|
|
@@ -6091,25 +6099,25 @@
|
|
|
6091
6099
|
id,
|
|
6092
6100
|
children: getKeyTreeConfig(dep, type)
|
|
6093
6101
|
});
|
|
6102
|
+
const mergeChildren = (children, deps, type) => {
|
|
6103
|
+
Object.entries(deps).forEach(([id, dep]) => {
|
|
6104
|
+
const nodeItem = children.find((item) => item.id === id);
|
|
6105
|
+
if (nodeItem) {
|
|
6106
|
+
nodeItem.children = nodeItem.children.concat(getKeyTreeConfig(dep, type));
|
|
6107
|
+
} else {
|
|
6108
|
+
children.push(getNodeTreeConfig(id, dep, type));
|
|
6109
|
+
}
|
|
6110
|
+
});
|
|
6111
|
+
};
|
|
6094
6112
|
const list = vue.computed(
|
|
6095
6113
|
() => dataSources.value.map((ds) => {
|
|
6096
6114
|
const dsDeps = dsDep.value[ds.id].deps;
|
|
6097
6115
|
const dsMethodDeps = dsMethodDep.value[ds.id].deps;
|
|
6098
6116
|
const dsCondDeps = dsCondDep.value[ds.id].deps;
|
|
6099
6117
|
const children = [];
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
if (nodeItem) {
|
|
6104
|
-
nodeItem.children = nodeItem.children.concat(getKeyTreeConfig(dep, type));
|
|
6105
|
-
} else {
|
|
6106
|
-
children.push(getNodeTreeConfig(id, dep, type));
|
|
6107
|
-
}
|
|
6108
|
-
});
|
|
6109
|
-
};
|
|
6110
|
-
mergeChildren(dsDeps);
|
|
6111
|
-
mergeChildren(dsMethodDeps, "method");
|
|
6112
|
-
mergeChildren(dsCondDeps, "cond");
|
|
6118
|
+
mergeChildren(children, dsDeps);
|
|
6119
|
+
mergeChildren(children, dsMethodDeps, "method");
|
|
6120
|
+
mergeChildren(children, dsCondDeps, "cond");
|
|
6113
6121
|
return {
|
|
6114
6122
|
id: ds.id,
|
|
6115
6123
|
name: ds.title,
|
|
@@ -6583,11 +6591,8 @@
|
|
|
6583
6591
|
const show = (e) => {
|
|
6584
6592
|
setTimeout(() => {
|
|
6585
6593
|
visible.value = true;
|
|
6586
|
-
if (!e) {
|
|
6587
|
-
return;
|
|
6588
|
-
}
|
|
6589
6594
|
vue.nextTick(() => {
|
|
6590
|
-
setPosition(e);
|
|
6595
|
+
e && setPosition(e);
|
|
6591
6596
|
emit("show");
|
|
6592
6597
|
});
|
|
6593
6598
|
}, 300);
|
|
@@ -8448,6 +8453,7 @@
|
|
|
8448
8453
|
}
|
|
8449
8454
|
});
|
|
8450
8455
|
|
|
8456
|
+
const PINNED_STATUE_CACHE_KEY = "tmagic-pinned-node-list-pinned-status";
|
|
8451
8457
|
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
8452
8458
|
__name: "NodeListMenu",
|
|
8453
8459
|
props: {
|
|
@@ -8457,7 +8463,8 @@
|
|
|
8457
8463
|
const props = __props;
|
|
8458
8464
|
const menu = vue.ref();
|
|
8459
8465
|
const nodeList = vue.ref([]);
|
|
8460
|
-
const pinned = vue.ref(
|
|
8466
|
+
const pinned = vue.ref(Boolean(globalThis.localStorage.getItem(PINNED_STATUE_CACHE_KEY)));
|
|
8467
|
+
const firstShow = vue.ref(true);
|
|
8461
8468
|
const services = vue.inject("services");
|
|
8462
8469
|
const editorService = services?.editorService;
|
|
8463
8470
|
const componentListService = services?.componentListService;
|
|
@@ -8506,7 +8513,8 @@
|
|
|
8506
8513
|
}
|
|
8507
8514
|
nodeList.value = nodes;
|
|
8508
8515
|
if (nodeList.value.length > 1) {
|
|
8509
|
-
menu.value?.show(pinned.value ? void 0 : event);
|
|
8516
|
+
menu.value?.show(pinned.value && !firstShow.value ? void 0 : event);
|
|
8517
|
+
firstShow.value = false;
|
|
8510
8518
|
}
|
|
8511
8519
|
}, 1500);
|
|
8512
8520
|
});
|
|
@@ -8564,6 +8572,9 @@
|
|
|
8564
8572
|
const closeHandler = () => {
|
|
8565
8573
|
menu.value?.hide();
|
|
8566
8574
|
};
|
|
8575
|
+
vue.watch(pinned, () => {
|
|
8576
|
+
globalThis.localStorage.setItem(PINNED_STATUE_CACHE_KEY, pinned.value.toString());
|
|
8577
|
+
});
|
|
8567
8578
|
return (_ctx, _cache) => {
|
|
8568
8579
|
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
8569
8580
|
ref_key: "menu",
|
|
@@ -9677,7 +9688,7 @@
|
|
|
9677
9688
|
const doCollect = (key, value) => {
|
|
9678
9689
|
const keyIsItems = key === "items";
|
|
9679
9690
|
const fullKey = prop ? `${prop}.${key}` : key;
|
|
9680
|
-
if (target.isTarget(
|
|
9691
|
+
if (target.isTarget(fullKey, value)) {
|
|
9681
9692
|
target.updateDep(node, fullKey);
|
|
9682
9693
|
this.emit("update-dep", node, fullKey);
|
|
9683
9694
|
} else if (!keyIsItems && Array.isArray(value)) {
|
|
@@ -9965,7 +9976,12 @@
|
|
|
9965
9976
|
const createDataSourceCondTarget = (id) => new Target({
|
|
9966
9977
|
type: DepTargetType.DATA_SOURCE_COND,
|
|
9967
9978
|
id,
|
|
9968
|
-
isTarget: (key, value) =>
|
|
9979
|
+
isTarget: (key, value) => {
|
|
9980
|
+
if (!Array.isArray(value) || value[0] !== id || !`${key}`.startsWith("displayConds"))
|
|
9981
|
+
return false;
|
|
9982
|
+
const ds = dataSourceService.getDataSourceById(id);
|
|
9983
|
+
return Boolean(ds?.fields?.find((field) => field.name === value[1]));
|
|
9984
|
+
}
|
|
9969
9985
|
});
|
|
9970
9986
|
const createDataSourceMethodTarget = (id) => new Target({
|
|
9971
9987
|
type: DepTargetType.DATA_SOURCE_METHOD,
|