@nocobase/plugin-graph-collection-manager 0.12.0-alpha.3 → 0.12.0-alpha.5
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/client/index.js +22 -19
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -64746,11 +64746,11 @@
|
|
|
64746
64746
|
const categoryCtx = React.useContext(client.CollectionCategroriesContext);
|
|
64747
64747
|
const scope = { ...options == null ? void 0 : options.scope };
|
|
64748
64748
|
const components = { ...options == null ? void 0 : options.components };
|
|
64749
|
-
const
|
|
64749
|
+
const saveGraphPositionAction = async (data) => {
|
|
64750
64750
|
await api.resource("graphPositions").create({ values: data });
|
|
64751
64751
|
await refreshPositions();
|
|
64752
64752
|
};
|
|
64753
|
-
const
|
|
64753
|
+
const updatePositionAction = async (data, isbatch = false) => {
|
|
64754
64754
|
if (isbatch) {
|
|
64755
64755
|
await api.resource("graphPositions").update({
|
|
64756
64756
|
values: data
|
|
@@ -64777,7 +64777,7 @@
|
|
|
64777
64777
|
const refreshGM = async () => {
|
|
64778
64778
|
const data = await refreshCM();
|
|
64779
64779
|
targetGraph.collections = data;
|
|
64780
|
-
targetGraph.updatePositionAction =
|
|
64780
|
+
targetGraph.updatePositionAction = updatePositionAction;
|
|
64781
64781
|
const currentNodes = targetGraph.getNodes();
|
|
64782
64782
|
setCollectionData(data);
|
|
64783
64783
|
setCollectionList(data);
|
|
@@ -64918,12 +64918,12 @@
|
|
|
64918
64918
|
const currentPosition = node.position();
|
|
64919
64919
|
const oldPosition = targetGraph.positions.find((v2) => v2.collectionName === node.store.data.name);
|
|
64920
64920
|
if (oldPosition) {
|
|
64921
|
-
(oldPosition.x !== currentPosition.x || oldPosition.y !== currentPosition.y) &&
|
|
64921
|
+
(oldPosition.x !== currentPosition.x || oldPosition.y !== currentPosition.y) && updatePositionAction({
|
|
64922
64922
|
collectionName: node.store.data.name,
|
|
64923
64923
|
...currentPosition
|
|
64924
64924
|
});
|
|
64925
64925
|
} else {
|
|
64926
|
-
|
|
64926
|
+
saveGraphPositionAction({
|
|
64927
64927
|
collectionName: node.store.data.name,
|
|
64928
64928
|
...currentPosition
|
|
64929
64929
|
});
|
|
@@ -64960,7 +64960,7 @@
|
|
|
64960
64960
|
const handleEdgeUnActive = (targetEdge) => {
|
|
64961
64961
|
var _a;
|
|
64962
64962
|
targetGraph.activeEdge = null;
|
|
64963
|
-
const { m2m, connectionType } = (_a = targetEdge.store) == null ? void 0 : _a.data;
|
|
64963
|
+
const { m2m, connectionType } = ((_a = targetEdge.store) == null ? void 0 : _a.data) ?? {};
|
|
64964
64964
|
const m2mLineId = m2m == null ? void 0 : m2m.find((v2) => v2 !== targetEdge.id);
|
|
64965
64965
|
const m2mEdge = targetGraph.getCellById(m2mLineId);
|
|
64966
64966
|
const lightsOut = (edge) => {
|
|
@@ -64998,7 +64998,7 @@
|
|
|
64998
64998
|
const handleEdgeActive = (targetEdge) => {
|
|
64999
64999
|
var _a;
|
|
65000
65000
|
targetGraph.activeEdge = targetEdge;
|
|
65001
|
-
const { associated, m2m, connectionType } = (_a = targetEdge.store) == null ? void 0 : _a.data;
|
|
65001
|
+
const { associated, m2m, connectionType } = ((_a = targetEdge.store) == null ? void 0 : _a.data) ?? {};
|
|
65002
65002
|
const m2mLineId = m2m == null ? void 0 : m2m.find((v2) => v2 !== targetEdge.id);
|
|
65003
65003
|
const m2mEdge = targetGraph.getCellById(m2mLineId);
|
|
65004
65004
|
const lightUp = (edge) => {
|
|
@@ -65052,7 +65052,7 @@
|
|
|
65052
65052
|
getNodes(nodesData);
|
|
65053
65053
|
getEdges(edgesData);
|
|
65054
65054
|
getEdges(inheritEdges);
|
|
65055
|
-
layout(
|
|
65055
|
+
layout(saveGraphPositionAction);
|
|
65056
65056
|
};
|
|
65057
65057
|
const renderDiffGraphCollection = (rawData) => {
|
|
65058
65058
|
const { positions } = targetGraph;
|
|
@@ -65069,18 +65069,18 @@
|
|
|
65069
65069
|
const diffNodes = getDiffNode(nodesData, currentNodes);
|
|
65070
65070
|
const diffEdges = getDiffEdge(edgesData, currentEdgesGroup.currentRelateEdges || []);
|
|
65071
65071
|
const diffInheritEdge = getDiffEdge(inheritEdges, currentEdgesGroup.currentInheritEdges || []);
|
|
65072
|
+
const maxY = maxBy(positions, "y").y;
|
|
65073
|
+
const minX = minBy(positions, "x").x;
|
|
65074
|
+
const yNodes = positions.filter((v2) => {
|
|
65075
|
+
return Math.abs(v2.y - maxY) < 100;
|
|
65076
|
+
});
|
|
65077
|
+
let referenceNode = maxBy(yNodes, "x");
|
|
65078
|
+
let position2;
|
|
65072
65079
|
diffNodes.forEach(({ status, node, port: port2 }) => {
|
|
65073
65080
|
const updateNode = targetGraph.getCellById(node.id);
|
|
65074
65081
|
switch (status) {
|
|
65075
65082
|
case "add":
|
|
65076
|
-
const maxY = maxBy(positions, "y").y;
|
|
65077
|
-
const yNodes = positions.filter((v2) => {
|
|
65078
|
-
return Math.abs(v2.y - maxY) < 100;
|
|
65079
|
-
});
|
|
65080
|
-
let referenceNode = maxBy(yNodes, "x");
|
|
65081
|
-
let position2;
|
|
65082
65083
|
if (referenceNode.x > 4500) {
|
|
65083
|
-
const minX = minBy(positions, "x").x;
|
|
65084
65084
|
referenceNode = minBy(yNodes, "x");
|
|
65085
65085
|
position2 = { x: minX, y: referenceNode.y + 400 };
|
|
65086
65086
|
} else {
|
|
@@ -65090,7 +65090,7 @@
|
|
|
65090
65090
|
...node,
|
|
65091
65091
|
position: position2
|
|
65092
65092
|
});
|
|
65093
|
-
|
|
65093
|
+
saveGraphPositionAction({
|
|
65094
65094
|
collectionName: node.name,
|
|
65095
65095
|
...position2
|
|
65096
65096
|
});
|
|
@@ -65107,17 +65107,18 @@
|
|
|
65107
65107
|
break;
|
|
65108
65108
|
case "delete":
|
|
65109
65109
|
targetGraph.removeCell(node.id);
|
|
65110
|
+
break;
|
|
65110
65111
|
default:
|
|
65111
65112
|
return null;
|
|
65112
65113
|
}
|
|
65113
65114
|
});
|
|
65114
65115
|
const renderDiffEdges = (data) => {
|
|
65115
65116
|
data.forEach(({ status, edge }) => {
|
|
65117
|
+
const newEdge = targetGraph.addEdge({
|
|
65118
|
+
...edge
|
|
65119
|
+
});
|
|
65116
65120
|
switch (status) {
|
|
65117
65121
|
case "add":
|
|
65118
|
-
const newEdge = targetGraph.addEdge({
|
|
65119
|
-
...edge
|
|
65120
|
-
});
|
|
65121
65122
|
optimizeEdge(newEdge);
|
|
65122
65123
|
break;
|
|
65123
65124
|
case "delete":
|
|
@@ -65387,6 +65388,8 @@
|
|
|
65387
65388
|
React.useEffect(() => {
|
|
65388
65389
|
refreshPositions().then(() => {
|
|
65389
65390
|
refreshGM();
|
|
65391
|
+
}).catch((err) => {
|
|
65392
|
+
throw err;
|
|
65390
65393
|
});
|
|
65391
65394
|
}, []);
|
|
65392
65395
|
const loadCollections = async () => {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据库可视化管理",
|
|
5
5
|
"description": "database collection manage",
|
|
6
6
|
"description.zh-CN": "数据库管理。",
|
|
7
|
-
"version": "0.12.0-alpha.
|
|
7
|
+
"version": "0.12.0-alpha.5",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"@nocobase/test": "0.x",
|
|
28
28
|
"@nocobase/utils": "0.x"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "689cc16e83361c4d0b91907e0deac30bdb907692"
|
|
31
31
|
}
|