@tmagic/editor 1.3.0 → 1.3.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/tmagic-editor.js +25 -17
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +25 -16
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/layouts/sidebar/data-source/DataSourceList.vue +0 -1
- package/src/services/editor.ts +11 -2
- package/src/utils/editor.ts +18 -13
- package/types/utils/editor.d.ts +2 -1
|
@@ -1635,23 +1635,27 @@
|
|
|
1635
1635
|
}
|
|
1636
1636
|
return style;
|
|
1637
1637
|
};
|
|
1638
|
-
const
|
|
1638
|
+
const setChilrenLayout = (node, layout) => {
|
|
1639
1639
|
node.items?.forEach((child) => {
|
|
1640
|
-
|
|
1641
|
-
return;
|
|
1642
|
-
const style = child.style || {};
|
|
1643
|
-
if (style.position === "fixed")
|
|
1644
|
-
return;
|
|
1645
|
-
if (layout !== Layout.RELATIVE) {
|
|
1646
|
-
style.position = "absolute";
|
|
1647
|
-
} else {
|
|
1648
|
-
child.style = getRelativeStyle(style);
|
|
1649
|
-
child.style.right = "auto";
|
|
1650
|
-
child.style.bottom = "auto";
|
|
1651
|
-
}
|
|
1640
|
+
setLayout(child, layout);
|
|
1652
1641
|
});
|
|
1653
1642
|
return node;
|
|
1654
1643
|
};
|
|
1644
|
+
const setLayout = (node, layout) => {
|
|
1645
|
+
if (utils.isPop(node))
|
|
1646
|
+
return;
|
|
1647
|
+
const style = node.style || {};
|
|
1648
|
+
if (style.position === "fixed")
|
|
1649
|
+
return;
|
|
1650
|
+
if (layout !== Layout.RELATIVE) {
|
|
1651
|
+
style.position = "absolute";
|
|
1652
|
+
} else {
|
|
1653
|
+
node.style = getRelativeStyle(style);
|
|
1654
|
+
node.style.right = "auto";
|
|
1655
|
+
node.style.bottom = "auto";
|
|
1656
|
+
}
|
|
1657
|
+
return node;
|
|
1658
|
+
};
|
|
1655
1659
|
const change2Fixed = (node, root) => {
|
|
1656
1660
|
const path = utils.getNodePath(node.id, root.items);
|
|
1657
1661
|
const offset = {
|
|
@@ -2506,8 +2510,8 @@
|
|
|
2506
2510
|
throw new Error("更新的节点未找到");
|
|
2507
2511
|
const newLayout = await this.getLayout(newConfig);
|
|
2508
2512
|
const layout = await this.getLayout(node);
|
|
2509
|
-
if (newLayout !== layout) {
|
|
2510
|
-
newConfig =
|
|
2513
|
+
if (Array.isArray(newConfig.items) && newLayout !== layout) {
|
|
2514
|
+
newConfig = setChilrenLayout(newConfig, newLayout);
|
|
2511
2515
|
}
|
|
2512
2516
|
parentNodeItems[index] = newConfig;
|
|
2513
2517
|
const nodes = this.get("nodes");
|
|
@@ -2729,6 +2733,11 @@
|
|
|
2729
2733
|
targetIndex -= 1;
|
|
2730
2734
|
}
|
|
2731
2735
|
}
|
|
2736
|
+
const layout = await this.getLayout(parent);
|
|
2737
|
+
const newLayout = await this.getLayout(targetParent);
|
|
2738
|
+
if (newLayout !== layout) {
|
|
2739
|
+
setLayout(config, newLayout);
|
|
2740
|
+
}
|
|
2732
2741
|
parent.items?.splice(index, 1);
|
|
2733
2742
|
targetParent.items?.splice(targetIndex, 0, config);
|
|
2734
2743
|
const page = this.get("page");
|
|
@@ -6152,7 +6161,6 @@
|
|
|
6152
6161
|
const tree = vue.ref();
|
|
6153
6162
|
__expose({
|
|
6154
6163
|
filter(val) {
|
|
6155
|
-
debugger;
|
|
6156
6164
|
tree.value?.filter(val);
|
|
6157
6165
|
}
|
|
6158
6166
|
});
|
|
@@ -10587,6 +10595,7 @@
|
|
|
10587
10595
|
exports.log = log;
|
|
10588
10596
|
exports.propsService = propsService;
|
|
10589
10597
|
exports.serializeConfig = serializeConfig;
|
|
10598
|
+
exports.setChilrenLayout = setChilrenLayout;
|
|
10590
10599
|
exports.setConfig = setConfig;
|
|
10591
10600
|
exports.setLayout = setLayout;
|
|
10592
10601
|
exports.storageService = storageService;
|