@lv-x-software-house/x_view 1.2.6-dev.78 → 1.2.6-dev.79
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/index.js +57 -65
- package/dist/index.mjs +57 -65
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1030,14 +1030,14 @@ var userActionHandlers = {
|
|
|
1030
1030
|
},
|
|
1031
1031
|
handleSaveNode: async (context, newNodeData) => {
|
|
1032
1032
|
const {
|
|
1033
|
-
graphDataRef
|
|
1033
|
+
graphDataRef,
|
|
1034
1034
|
sceneDataRef,
|
|
1035
1035
|
stateRef,
|
|
1036
1036
|
creationMode,
|
|
1037
1037
|
setters,
|
|
1038
1038
|
actions
|
|
1039
1039
|
} = context;
|
|
1040
|
-
if (!
|
|
1040
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1041
1041
|
const { sourceNodeData } = creationMode;
|
|
1042
1042
|
const { targetDatasetId, ...nodeDataToSave } = newNodeData;
|
|
1043
1043
|
const newNode = { id: import_short_uuid.default.generate(), ...nodeDataToSave };
|
|
@@ -1059,9 +1059,9 @@ var userActionHandlers = {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
|
|
1061
1061
|
const sourceDataToUpdate = JSON.parse(
|
|
1062
|
-
JSON.stringify(
|
|
1062
|
+
JSON.stringify(graphDataRef.current[sourceParentInfo.parentFileId])
|
|
1063
1063
|
);
|
|
1064
|
-
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(
|
|
1064
|
+
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef.current[finalTargetDatasetId])) : sourceDataToUpdate;
|
|
1065
1065
|
targetDataToUpdate.nodes.push(newNode);
|
|
1066
1066
|
sourceDataToUpdate.links.push(newLink);
|
|
1067
1067
|
const savePromises = [];
|
|
@@ -1088,9 +1088,9 @@ var userActionHandlers = {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
try {
|
|
1090
1090
|
await Promise.all(savePromises);
|
|
1091
|
-
|
|
1091
|
+
graphDataRef.current[sourceParentInfo.parentFileId] = sourceDataToUpdate;
|
|
1092
1092
|
if (isCrossDataset) {
|
|
1093
|
-
|
|
1093
|
+
graphDataRef.current[finalTargetDatasetId] = targetDataToUpdate;
|
|
1094
1094
|
}
|
|
1095
1095
|
if (sceneDataRef.current.parent_dbs.some((db) => String(db.db_id) === String(sourceParentInfo.parentFileId))) {
|
|
1096
1096
|
}
|
|
@@ -1233,8 +1233,8 @@ var userActionHandlers = {
|
|
|
1233
1233
|
},
|
|
1234
1234
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1235
1235
|
var _a;
|
|
1236
|
-
const { graphDataRef
|
|
1237
|
-
if (!
|
|
1236
|
+
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1237
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1238
1238
|
const { sourceNodeData } = versionMode;
|
|
1239
1239
|
const newNode = {
|
|
1240
1240
|
id: import_short_uuid.default.generate(),
|
|
@@ -1247,7 +1247,7 @@ var userActionHandlers = {
|
|
|
1247
1247
|
target: newNode.id
|
|
1248
1248
|
};
|
|
1249
1249
|
const parentInfo = getParentFileInfoForNode(
|
|
1250
|
-
|
|
1250
|
+
graphDataRef.current,
|
|
1251
1251
|
sceneDataRef.current,
|
|
1252
1252
|
sourceNodeData.id,
|
|
1253
1253
|
context.sceneConfigId,
|
|
@@ -1265,7 +1265,7 @@ var userActionHandlers = {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
const { parentFileId, ownerId } = parentInfo;
|
|
1267
1267
|
const specificParentData = JSON.parse(
|
|
1268
|
-
JSON.stringify(
|
|
1268
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
1269
1269
|
);
|
|
1270
1270
|
specificParentData.nodes.push(newNode);
|
|
1271
1271
|
specificParentData.links.push(newLink);
|
|
@@ -1291,7 +1291,7 @@ var userActionHandlers = {
|
|
|
1291
1291
|
specificParentData
|
|
1292
1292
|
);
|
|
1293
1293
|
}
|
|
1294
|
-
|
|
1294
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
1295
1295
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
1296
1296
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
1297
1297
|
}
|
|
@@ -1308,7 +1308,7 @@ var userActionHandlers = {
|
|
|
1308
1308
|
const {
|
|
1309
1309
|
stateRef,
|
|
1310
1310
|
sceneDataRef,
|
|
1311
|
-
graphDataRef
|
|
1311
|
+
graphDataRef,
|
|
1312
1312
|
mountRef,
|
|
1313
1313
|
setters,
|
|
1314
1314
|
tweenToTarget
|
|
@@ -1322,7 +1322,7 @@ var userActionHandlers = {
|
|
|
1322
1322
|
renderer,
|
|
1323
1323
|
tweenGroup
|
|
1324
1324
|
} = stateRef.current;
|
|
1325
|
-
if (!graphGroup || !sceneDataRef.current || !
|
|
1325
|
+
if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0)
|
|
1326
1326
|
return;
|
|
1327
1327
|
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
1328
1328
|
if (!sourceNodeMesh) return;
|
|
@@ -1337,7 +1337,7 @@ var userActionHandlers = {
|
|
|
1337
1337
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
1338
1338
|
const targetNodeId = isSource ? link.target : link.source;
|
|
1339
1339
|
if (!nodeObjects[String(targetNodeId)]) {
|
|
1340
|
-
const allParentNodes = Object.values(
|
|
1340
|
+
const allParentNodes = Object.values(graphDataRef.current).flatMap(
|
|
1341
1341
|
(fileData) => fileData.nodes
|
|
1342
1342
|
);
|
|
1343
1343
|
const nodeData = allParentNodes.find(
|
|
@@ -1496,15 +1496,15 @@ var userActionHandlers = {
|
|
|
1496
1496
|
},
|
|
1497
1497
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
1498
1498
|
var _a;
|
|
1499
|
-
const { stateRef, graphDataRef
|
|
1499
|
+
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1500
1500
|
const { sourceNodeData } = stateRef.current.connection;
|
|
1501
|
-
if (!
|
|
1501
|
+
if (!graphDataRef.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
1502
1502
|
console.error("Dados insuficientes para completar a conex\xE3o.");
|
|
1503
1503
|
userActionHandlers.handleCancelConnection(context);
|
|
1504
1504
|
return;
|
|
1505
1505
|
}
|
|
1506
1506
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
1507
|
-
|
|
1507
|
+
graphDataRef.current,
|
|
1508
1508
|
sceneDataRef.current,
|
|
1509
1509
|
sourceNodeData.id,
|
|
1510
1510
|
context.sceneConfigId,
|
|
@@ -1532,7 +1532,7 @@ var userActionHandlers = {
|
|
|
1532
1532
|
try {
|
|
1533
1533
|
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1534
1534
|
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
1535
|
-
const specificParentData =
|
|
1535
|
+
const specificParentData = graphDataRef.current[context.sceneConfigId];
|
|
1536
1536
|
specificParentData.links.push(newLink);
|
|
1537
1537
|
const viewFilePayload = {
|
|
1538
1538
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
@@ -1548,7 +1548,7 @@ var userActionHandlers = {
|
|
|
1548
1548
|
);
|
|
1549
1549
|
} else {
|
|
1550
1550
|
const specificParentData = JSON.parse(
|
|
1551
|
-
JSON.stringify(
|
|
1551
|
+
JSON.stringify(graphDataRef.current[parentFileIdToSave])
|
|
1552
1552
|
);
|
|
1553
1553
|
specificParentData.links.push(newLink);
|
|
1554
1554
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -1556,7 +1556,7 @@ var userActionHandlers = {
|
|
|
1556
1556
|
filenameForSpecificParent,
|
|
1557
1557
|
specificParentData
|
|
1558
1558
|
);
|
|
1559
|
-
|
|
1559
|
+
graphDataRef.current[parentFileIdToSave] = specificParentData;
|
|
1560
1560
|
}
|
|
1561
1561
|
addNewLinkToScene(stateRef.current, newLink);
|
|
1562
1562
|
} catch (error) {
|
|
@@ -1619,7 +1619,7 @@ var userActionHandlers = {
|
|
|
1619
1619
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
1620
1620
|
},
|
|
1621
1621
|
handleCompleteRelink: async (context, newEndNodeData) => {
|
|
1622
|
-
const { stateRef, graphDataRef
|
|
1622
|
+
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1623
1623
|
const { relink, nodeObjects } = stateRef.current;
|
|
1624
1624
|
const originalLinkData = relink.originalLine.userData;
|
|
1625
1625
|
const oldSourceId = originalLinkData.source;
|
|
@@ -1633,28 +1633,28 @@ var userActionHandlers = {
|
|
|
1633
1633
|
newTargetId = newEndNodeData.id;
|
|
1634
1634
|
}
|
|
1635
1635
|
const oldSourceInfo = getParentFileInfoForNode(
|
|
1636
|
-
|
|
1636
|
+
graphDataRef.current,
|
|
1637
1637
|
sceneDataRef.current,
|
|
1638
1638
|
oldSourceId,
|
|
1639
1639
|
context.sceneConfigId,
|
|
1640
1640
|
context.ownerId
|
|
1641
1641
|
);
|
|
1642
1642
|
const oldTargetInfo = getParentFileInfoForNode(
|
|
1643
|
-
|
|
1643
|
+
graphDataRef.current,
|
|
1644
1644
|
sceneDataRef.current,
|
|
1645
1645
|
oldTargetId,
|
|
1646
1646
|
context.sceneConfigId,
|
|
1647
1647
|
context.ownerId
|
|
1648
1648
|
);
|
|
1649
1649
|
const newSourceInfo = getParentFileInfoForNode(
|
|
1650
|
-
|
|
1650
|
+
graphDataRef.current,
|
|
1651
1651
|
sceneDataRef.current,
|
|
1652
1652
|
newSourceId,
|
|
1653
1653
|
context.sceneConfigId,
|
|
1654
1654
|
context.ownerId
|
|
1655
1655
|
);
|
|
1656
1656
|
const newTargetInfo = getParentFileInfoForNode(
|
|
1657
|
-
|
|
1657
|
+
graphDataRef.current,
|
|
1658
1658
|
sceneDataRef.current,
|
|
1659
1659
|
newTargetId,
|
|
1660
1660
|
context.sceneConfigId,
|
|
@@ -1714,7 +1714,7 @@ var userActionHandlers = {
|
|
|
1714
1714
|
const filesToUpdate = {};
|
|
1715
1715
|
if (oldGoverningFileId !== newGoverningFileId) {
|
|
1716
1716
|
const updatedOriginalParentData = JSON.parse(
|
|
1717
|
-
JSON.stringify(
|
|
1717
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
1718
1718
|
);
|
|
1719
1719
|
updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
|
|
1720
1720
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1728,7 +1728,7 @@ var userActionHandlers = {
|
|
|
1728
1728
|
)
|
|
1729
1729
|
);
|
|
1730
1730
|
const updatedNewParentData = JSON.parse(
|
|
1731
|
-
JSON.stringify(
|
|
1731
|
+
JSON.stringify(graphDataRef.current[newGoverningFileId])
|
|
1732
1732
|
);
|
|
1733
1733
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
1734
1734
|
updatedNewParentData.links.push(newLinkData);
|
|
@@ -1742,7 +1742,7 @@ var userActionHandlers = {
|
|
|
1742
1742
|
);
|
|
1743
1743
|
} else {
|
|
1744
1744
|
const updatedParentData = JSON.parse(
|
|
1745
|
-
JSON.stringify(
|
|
1745
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
1746
1746
|
);
|
|
1747
1747
|
updatedParentData.links = updatedParentData.links.filter(
|
|
1748
1748
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1760,7 +1760,7 @@ var userActionHandlers = {
|
|
|
1760
1760
|
try {
|
|
1761
1761
|
await Promise.all(savePromises);
|
|
1762
1762
|
for (const fileId in filesToUpdate) {
|
|
1763
|
-
|
|
1763
|
+
graphDataRef.current[fileId] = filesToUpdate[fileId];
|
|
1764
1764
|
}
|
|
1765
1765
|
removeLinkFromScene(stateRef.current, relink.originalLine);
|
|
1766
1766
|
addNewLinkToScene(stateRef.current, newLinkData);
|
|
@@ -1774,9 +1774,9 @@ var userActionHandlers = {
|
|
|
1774
1774
|
},
|
|
1775
1775
|
handleDeleteLink: async (context, linkObject) => {
|
|
1776
1776
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1777
|
-
const { stateRef, graphDataRef
|
|
1777
|
+
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
1778
1778
|
setters.setRelationshipMenu({ visible: false });
|
|
1779
|
-
if (!(linkObject == null ? void 0 : linkObject.userData) || !
|
|
1779
|
+
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current)
|
|
1780
1780
|
return;
|
|
1781
1781
|
const linkIdToDelete = linkObject.userData.id;
|
|
1782
1782
|
if (!linkIdToDelete) {
|
|
@@ -1787,7 +1787,7 @@ var userActionHandlers = {
|
|
|
1787
1787
|
return;
|
|
1788
1788
|
}
|
|
1789
1789
|
const parentInfo = getParentFileInfoForNode(
|
|
1790
|
-
|
|
1790
|
+
graphDataRef.current,
|
|
1791
1791
|
sceneDataRef.current,
|
|
1792
1792
|
linkObject.userData.source,
|
|
1793
1793
|
context.sceneConfigId,
|
|
@@ -1807,7 +1807,7 @@ var userActionHandlers = {
|
|
|
1807
1807
|
const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
|
|
1808
1808
|
const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
|
|
1809
1809
|
const specificParentData = JSON.parse(
|
|
1810
|
-
JSON.stringify(
|
|
1810
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
1811
1811
|
);
|
|
1812
1812
|
const newLinks = (specificParentData.links || []).filter(
|
|
1813
1813
|
(l) => String(l.id) !== String(linkIdToDelete)
|
|
@@ -1835,7 +1835,7 @@ var userActionHandlers = {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
try {
|
|
1837
1837
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
1838
|
-
|
|
1838
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
1839
1839
|
setters.setDetailsLink(
|
|
1840
1840
|
(prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
|
|
1841
1841
|
);
|
|
@@ -1973,9 +1973,9 @@ var userActionHandlers = {
|
|
|
1973
1973
|
},
|
|
1974
1974
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
1975
1975
|
var _a;
|
|
1976
|
-
const { stateRef, graphDataRef
|
|
1976
|
+
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
1977
1977
|
setters.setMultiContextMenu({ visible: false });
|
|
1978
|
-
if (!nodeIds || nodeIds.size === 0 || !
|
|
1978
|
+
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current)
|
|
1979
1979
|
return;
|
|
1980
1980
|
const strNodeIdsToDelete = Array.from(nodeIds).map(String);
|
|
1981
1981
|
if (actions.delete_file) {
|
|
@@ -1995,7 +1995,7 @@ var userActionHandlers = {
|
|
|
1995
1995
|
const changesByParentFile = {};
|
|
1996
1996
|
for (const nodeId of strNodeIdsToDelete) {
|
|
1997
1997
|
const parentInfo = getParentFileInfoForNode(
|
|
1998
|
-
|
|
1998
|
+
graphDataRef.current,
|
|
1999
1999
|
sceneDataRef.current,
|
|
2000
2000
|
nodeId,
|
|
2001
2001
|
context.sceneConfigId,
|
|
@@ -2016,7 +2016,7 @@ var userActionHandlers = {
|
|
|
2016
2016
|
nodesToDelete: /* @__PURE__ */ new Set(),
|
|
2017
2017
|
linksToDelete: /* @__PURE__ */ new Set(),
|
|
2018
2018
|
originalData: JSON.parse(
|
|
2019
|
-
JSON.stringify(
|
|
2019
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2020
2020
|
)
|
|
2021
2021
|
};
|
|
2022
2022
|
}
|
|
@@ -2080,7 +2080,7 @@ var userActionHandlers = {
|
|
|
2080
2080
|
try {
|
|
2081
2081
|
await Promise.all(savePromises);
|
|
2082
2082
|
for (const fileId in updatedParentDataCache) {
|
|
2083
|
-
|
|
2083
|
+
graphDataRef.current[fileId] = updatedParentDataCache[fileId];
|
|
2084
2084
|
}
|
|
2085
2085
|
strNodeIdsToDelete.forEach((nodeId) => {
|
|
2086
2086
|
setters.setDetailsNode(
|
|
@@ -2097,7 +2097,7 @@ var userActionHandlers = {
|
|
|
2097
2097
|
},
|
|
2098
2098
|
handleDeleteNode: async (context, nodeData) => {
|
|
2099
2099
|
var _a;
|
|
2100
|
-
const { stateRef, graphDataRef
|
|
2100
|
+
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2101
2101
|
if (actions.delete_file && nodeData) {
|
|
2102
2102
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2103
2103
|
if (urls.length > 0) {
|
|
@@ -2107,11 +2107,11 @@ var userActionHandlers = {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
}
|
|
2109
2109
|
setters.setContextMenu({ visible: false });
|
|
2110
|
-
if (!nodeData || !
|
|
2110
|
+
if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
|
|
2111
2111
|
const nodeIdToDelete = nodeData.id;
|
|
2112
2112
|
const strNodeId = String(nodeIdToDelete);
|
|
2113
2113
|
const parentInfo = getParentFileInfoForNode(
|
|
2114
|
-
|
|
2114
|
+
graphDataRef.current,
|
|
2115
2115
|
sceneDataRef.current,
|
|
2116
2116
|
nodeIdToDelete,
|
|
2117
2117
|
context.sceneConfigId,
|
|
@@ -2129,7 +2129,7 @@ var userActionHandlers = {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
const { parentFileId, ownerId } = parentInfo;
|
|
2131
2131
|
const specificParentData = JSON.parse(
|
|
2132
|
-
JSON.stringify(
|
|
2132
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2133
2133
|
);
|
|
2134
2134
|
const newNodes = (specificParentData.nodes || []).filter(
|
|
2135
2135
|
(n) => String(n.id) !== strNodeId
|
|
@@ -2166,7 +2166,7 @@ var userActionHandlers = {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
try {
|
|
2168
2168
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2169
|
-
|
|
2169
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2170
2170
|
setters.setDetailsNode(
|
|
2171
2171
|
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
2172
2172
|
);
|
|
@@ -2179,8 +2179,8 @@ var userActionHandlers = {
|
|
|
2179
2179
|
},
|
|
2180
2180
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2181
2181
|
var _a, _b, _c;
|
|
2182
|
-
const { graphDataRef
|
|
2183
|
-
if (!
|
|
2182
|
+
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2183
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2184
2184
|
const {
|
|
2185
2185
|
_baseEmissiveIntensity,
|
|
2186
2186
|
_baseScale,
|
|
@@ -2191,7 +2191,7 @@ var userActionHandlers = {
|
|
|
2191
2191
|
...nodeToSave
|
|
2192
2192
|
} = updatedNode;
|
|
2193
2193
|
const parentInfo = getParentFileInfoForNode(
|
|
2194
|
-
|
|
2194
|
+
graphDataRef.current,
|
|
2195
2195
|
sceneDataRef.current,
|
|
2196
2196
|
nodeToSave.id,
|
|
2197
2197
|
context.sceneConfigId,
|
|
@@ -2209,7 +2209,7 @@ var userActionHandlers = {
|
|
|
2209
2209
|
}
|
|
2210
2210
|
const { parentFileId, ownerId } = parentInfo;
|
|
2211
2211
|
const specificParentData = JSON.parse(
|
|
2212
|
-
JSON.stringify(
|
|
2212
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2213
2213
|
);
|
|
2214
2214
|
const nodeIndex = specificParentData.nodes.findIndex(
|
|
2215
2215
|
(n) => String(n.id) === String(nodeToSave.id)
|
|
@@ -2325,7 +2325,7 @@ var userActionHandlers = {
|
|
|
2325
2325
|
specificParentData
|
|
2326
2326
|
);
|
|
2327
2327
|
}
|
|
2328
|
-
|
|
2328
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2329
2329
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2330
2330
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2331
2331
|
sceneDataRef.current.quest_counter = specificParentData.quest_counter || sceneDataRef.current.quest_counter;
|
|
@@ -2342,11 +2342,11 @@ var userActionHandlers = {
|
|
|
2342
2342
|
},
|
|
2343
2343
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2344
2344
|
var _a;
|
|
2345
|
-
const { graphDataRef
|
|
2346
|
-
if (!
|
|
2345
|
+
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2346
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2347
2347
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2348
2348
|
const parentInfo = getParentFileInfoForNode(
|
|
2349
|
-
|
|
2349
|
+
graphDataRef.current,
|
|
2350
2350
|
sceneDataRef.current,
|
|
2351
2351
|
linkToSave.source,
|
|
2352
2352
|
context.sceneConfigId,
|
|
@@ -2364,7 +2364,7 @@ var userActionHandlers = {
|
|
|
2364
2364
|
}
|
|
2365
2365
|
const { parentFileId, ownerId } = parentInfo;
|
|
2366
2366
|
const specificParentData = JSON.parse(
|
|
2367
|
-
JSON.stringify(
|
|
2367
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2368
2368
|
);
|
|
2369
2369
|
const linkIndex = specificParentData.links.findIndex(
|
|
2370
2370
|
(l) => String(l.id) === String(linkToSave.id)
|
|
@@ -2402,7 +2402,7 @@ var userActionHandlers = {
|
|
|
2402
2402
|
specificParentData
|
|
2403
2403
|
);
|
|
2404
2404
|
}
|
|
2405
|
-
|
|
2405
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2406
2406
|
const lineObject = stateRef.current.allLinks.find(
|
|
2407
2407
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
2408
2408
|
);
|
|
@@ -2425,9 +2425,9 @@ var userActionHandlers = {
|
|
|
2425
2425
|
},
|
|
2426
2426
|
handleAddExistingNodeById: (context, nodeId) => {
|
|
2427
2427
|
var _a;
|
|
2428
|
-
const { stateRef, sceneDataRef, graphDataRef
|
|
2428
|
+
const { stateRef, sceneDataRef, graphDataRef, tweenToTarget, setters } = context;
|
|
2429
2429
|
const state = stateRef.current;
|
|
2430
|
-
const graphFull =
|
|
2430
|
+
const graphFull = graphDataRef.current;
|
|
2431
2431
|
if (!graphFull) return;
|
|
2432
2432
|
const strNodeId = String(nodeId);
|
|
2433
2433
|
const allParentNodes = Object.values(graphFull).flatMap(
|
|
@@ -15492,6 +15492,7 @@ function XViewScene({
|
|
|
15492
15492
|
}, [ownerId, sceneConfigId]);
|
|
15493
15493
|
const sceneDataRef = (0, import_react33.useRef)(null);
|
|
15494
15494
|
const parentDataRef = (0, import_react33.useRef)(null);
|
|
15495
|
+
const graphDataRef = parentDataRef;
|
|
15495
15496
|
const ancestryDataRef = (0, import_react33.useRef)(null);
|
|
15496
15497
|
const [isLoading, setIsLoading] = (0, import_react33.useState)(true);
|
|
15497
15498
|
const [permissionStatus, setPermissionStatus] = (0, import_react33.useState)("loading");
|
|
@@ -18059,15 +18060,6 @@ function XViewScene({
|
|
|
18059
18060
|
if (questIndex !== -1) {
|
|
18060
18061
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18061
18062
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18062
|
-
if (graphDataRef.current[sceneConfigId]) {
|
|
18063
|
-
const graphIndex = graphDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18064
|
-
(q) => String(q.id) === String(questNodeId)
|
|
18065
|
-
);
|
|
18066
|
-
if (graphIndex !== -1) {
|
|
18067
|
-
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_tree = formattedTree;
|
|
18068
|
-
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18069
|
-
}
|
|
18070
|
-
}
|
|
18071
18063
|
if (parentDataRef.current[sceneConfigId]) {
|
|
18072
18064
|
const parentIndex = parentDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18073
18065
|
(q) => String(q.id) === String(questNodeId)
|
package/dist/index.mjs
CHANGED
|
@@ -991,14 +991,14 @@ var userActionHandlers = {
|
|
|
991
991
|
},
|
|
992
992
|
handleSaveNode: async (context, newNodeData) => {
|
|
993
993
|
const {
|
|
994
|
-
graphDataRef
|
|
994
|
+
graphDataRef,
|
|
995
995
|
sceneDataRef,
|
|
996
996
|
stateRef,
|
|
997
997
|
creationMode,
|
|
998
998
|
setters,
|
|
999
999
|
actions
|
|
1000
1000
|
} = context;
|
|
1001
|
-
if (!
|
|
1001
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1002
1002
|
const { sourceNodeData } = creationMode;
|
|
1003
1003
|
const { targetDatasetId, ...nodeDataToSave } = newNodeData;
|
|
1004
1004
|
const newNode = { id: short.generate(), ...nodeDataToSave };
|
|
@@ -1020,9 +1020,9 @@ var userActionHandlers = {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
|
|
1022
1022
|
const sourceDataToUpdate = JSON.parse(
|
|
1023
|
-
JSON.stringify(
|
|
1023
|
+
JSON.stringify(graphDataRef.current[sourceParentInfo.parentFileId])
|
|
1024
1024
|
);
|
|
1025
|
-
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(
|
|
1025
|
+
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef.current[finalTargetDatasetId])) : sourceDataToUpdate;
|
|
1026
1026
|
targetDataToUpdate.nodes.push(newNode);
|
|
1027
1027
|
sourceDataToUpdate.links.push(newLink);
|
|
1028
1028
|
const savePromises = [];
|
|
@@ -1049,9 +1049,9 @@ var userActionHandlers = {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
try {
|
|
1051
1051
|
await Promise.all(savePromises);
|
|
1052
|
-
|
|
1052
|
+
graphDataRef.current[sourceParentInfo.parentFileId] = sourceDataToUpdate;
|
|
1053
1053
|
if (isCrossDataset) {
|
|
1054
|
-
|
|
1054
|
+
graphDataRef.current[finalTargetDatasetId] = targetDataToUpdate;
|
|
1055
1055
|
}
|
|
1056
1056
|
if (sceneDataRef.current.parent_dbs.some((db) => String(db.db_id) === String(sourceParentInfo.parentFileId))) {
|
|
1057
1057
|
}
|
|
@@ -1194,8 +1194,8 @@ var userActionHandlers = {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1196
1196
|
var _a;
|
|
1197
|
-
const { graphDataRef
|
|
1198
|
-
if (!
|
|
1197
|
+
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1198
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1199
1199
|
const { sourceNodeData } = versionMode;
|
|
1200
1200
|
const newNode = {
|
|
1201
1201
|
id: short.generate(),
|
|
@@ -1208,7 +1208,7 @@ var userActionHandlers = {
|
|
|
1208
1208
|
target: newNode.id
|
|
1209
1209
|
};
|
|
1210
1210
|
const parentInfo = getParentFileInfoForNode(
|
|
1211
|
-
|
|
1211
|
+
graphDataRef.current,
|
|
1212
1212
|
sceneDataRef.current,
|
|
1213
1213
|
sourceNodeData.id,
|
|
1214
1214
|
context.sceneConfigId,
|
|
@@ -1226,7 +1226,7 @@ var userActionHandlers = {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
const { parentFileId, ownerId } = parentInfo;
|
|
1228
1228
|
const specificParentData = JSON.parse(
|
|
1229
|
-
JSON.stringify(
|
|
1229
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
1230
1230
|
);
|
|
1231
1231
|
specificParentData.nodes.push(newNode);
|
|
1232
1232
|
specificParentData.links.push(newLink);
|
|
@@ -1252,7 +1252,7 @@ var userActionHandlers = {
|
|
|
1252
1252
|
specificParentData
|
|
1253
1253
|
);
|
|
1254
1254
|
}
|
|
1255
|
-
|
|
1255
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
1256
1256
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
1257
1257
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
1258
1258
|
}
|
|
@@ -1269,7 +1269,7 @@ var userActionHandlers = {
|
|
|
1269
1269
|
const {
|
|
1270
1270
|
stateRef,
|
|
1271
1271
|
sceneDataRef,
|
|
1272
|
-
graphDataRef
|
|
1272
|
+
graphDataRef,
|
|
1273
1273
|
mountRef,
|
|
1274
1274
|
setters,
|
|
1275
1275
|
tweenToTarget
|
|
@@ -1283,7 +1283,7 @@ var userActionHandlers = {
|
|
|
1283
1283
|
renderer,
|
|
1284
1284
|
tweenGroup
|
|
1285
1285
|
} = stateRef.current;
|
|
1286
|
-
if (!graphGroup || !sceneDataRef.current || !
|
|
1286
|
+
if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0)
|
|
1287
1287
|
return;
|
|
1288
1288
|
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
1289
1289
|
if (!sourceNodeMesh) return;
|
|
@@ -1298,7 +1298,7 @@ var userActionHandlers = {
|
|
|
1298
1298
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
1299
1299
|
const targetNodeId = isSource ? link.target : link.source;
|
|
1300
1300
|
if (!nodeObjects[String(targetNodeId)]) {
|
|
1301
|
-
const allParentNodes = Object.values(
|
|
1301
|
+
const allParentNodes = Object.values(graphDataRef.current).flatMap(
|
|
1302
1302
|
(fileData) => fileData.nodes
|
|
1303
1303
|
);
|
|
1304
1304
|
const nodeData = allParentNodes.find(
|
|
@@ -1457,15 +1457,15 @@ var userActionHandlers = {
|
|
|
1457
1457
|
},
|
|
1458
1458
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
1459
1459
|
var _a;
|
|
1460
|
-
const { stateRef, graphDataRef
|
|
1460
|
+
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1461
1461
|
const { sourceNodeData } = stateRef.current.connection;
|
|
1462
|
-
if (!
|
|
1462
|
+
if (!graphDataRef.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
1463
1463
|
console.error("Dados insuficientes para completar a conex\xE3o.");
|
|
1464
1464
|
userActionHandlers.handleCancelConnection(context);
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
1467
1467
|
const sourceParentInfo = getParentFileInfoForNode(
|
|
1468
|
-
|
|
1468
|
+
graphDataRef.current,
|
|
1469
1469
|
sceneDataRef.current,
|
|
1470
1470
|
sourceNodeData.id,
|
|
1471
1471
|
context.sceneConfigId,
|
|
@@ -1493,7 +1493,7 @@ var userActionHandlers = {
|
|
|
1493
1493
|
try {
|
|
1494
1494
|
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1495
1495
|
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
1496
|
-
const specificParentData =
|
|
1496
|
+
const specificParentData = graphDataRef.current[context.sceneConfigId];
|
|
1497
1497
|
specificParentData.links.push(newLink);
|
|
1498
1498
|
const viewFilePayload = {
|
|
1499
1499
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
@@ -1509,7 +1509,7 @@ var userActionHandlers = {
|
|
|
1509
1509
|
);
|
|
1510
1510
|
} else {
|
|
1511
1511
|
const specificParentData = JSON.parse(
|
|
1512
|
-
JSON.stringify(
|
|
1512
|
+
JSON.stringify(graphDataRef.current[parentFileIdToSave])
|
|
1513
1513
|
);
|
|
1514
1514
|
specificParentData.links.push(newLink);
|
|
1515
1515
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
@@ -1517,7 +1517,7 @@ var userActionHandlers = {
|
|
|
1517
1517
|
filenameForSpecificParent,
|
|
1518
1518
|
specificParentData
|
|
1519
1519
|
);
|
|
1520
|
-
|
|
1520
|
+
graphDataRef.current[parentFileIdToSave] = specificParentData;
|
|
1521
1521
|
}
|
|
1522
1522
|
addNewLinkToScene(stateRef.current, newLink);
|
|
1523
1523
|
} catch (error) {
|
|
@@ -1580,7 +1580,7 @@ var userActionHandlers = {
|
|
|
1580
1580
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
1581
1581
|
},
|
|
1582
1582
|
handleCompleteRelink: async (context, newEndNodeData) => {
|
|
1583
|
-
const { stateRef, graphDataRef
|
|
1583
|
+
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1584
1584
|
const { relink, nodeObjects } = stateRef.current;
|
|
1585
1585
|
const originalLinkData = relink.originalLine.userData;
|
|
1586
1586
|
const oldSourceId = originalLinkData.source;
|
|
@@ -1594,28 +1594,28 @@ var userActionHandlers = {
|
|
|
1594
1594
|
newTargetId = newEndNodeData.id;
|
|
1595
1595
|
}
|
|
1596
1596
|
const oldSourceInfo = getParentFileInfoForNode(
|
|
1597
|
-
|
|
1597
|
+
graphDataRef.current,
|
|
1598
1598
|
sceneDataRef.current,
|
|
1599
1599
|
oldSourceId,
|
|
1600
1600
|
context.sceneConfigId,
|
|
1601
1601
|
context.ownerId
|
|
1602
1602
|
);
|
|
1603
1603
|
const oldTargetInfo = getParentFileInfoForNode(
|
|
1604
|
-
|
|
1604
|
+
graphDataRef.current,
|
|
1605
1605
|
sceneDataRef.current,
|
|
1606
1606
|
oldTargetId,
|
|
1607
1607
|
context.sceneConfigId,
|
|
1608
1608
|
context.ownerId
|
|
1609
1609
|
);
|
|
1610
1610
|
const newSourceInfo = getParentFileInfoForNode(
|
|
1611
|
-
|
|
1611
|
+
graphDataRef.current,
|
|
1612
1612
|
sceneDataRef.current,
|
|
1613
1613
|
newSourceId,
|
|
1614
1614
|
context.sceneConfigId,
|
|
1615
1615
|
context.ownerId
|
|
1616
1616
|
);
|
|
1617
1617
|
const newTargetInfo = getParentFileInfoForNode(
|
|
1618
|
-
|
|
1618
|
+
graphDataRef.current,
|
|
1619
1619
|
sceneDataRef.current,
|
|
1620
1620
|
newTargetId,
|
|
1621
1621
|
context.sceneConfigId,
|
|
@@ -1675,7 +1675,7 @@ var userActionHandlers = {
|
|
|
1675
1675
|
const filesToUpdate = {};
|
|
1676
1676
|
if (oldGoverningFileId !== newGoverningFileId) {
|
|
1677
1677
|
const updatedOriginalParentData = JSON.parse(
|
|
1678
|
-
JSON.stringify(
|
|
1678
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
1679
1679
|
);
|
|
1680
1680
|
updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
|
|
1681
1681
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1689,7 +1689,7 @@ var userActionHandlers = {
|
|
|
1689
1689
|
)
|
|
1690
1690
|
);
|
|
1691
1691
|
const updatedNewParentData = JSON.parse(
|
|
1692
|
-
JSON.stringify(
|
|
1692
|
+
JSON.stringify(graphDataRef.current[newGoverningFileId])
|
|
1693
1693
|
);
|
|
1694
1694
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
1695
1695
|
updatedNewParentData.links.push(newLinkData);
|
|
@@ -1703,7 +1703,7 @@ var userActionHandlers = {
|
|
|
1703
1703
|
);
|
|
1704
1704
|
} else {
|
|
1705
1705
|
const updatedParentData = JSON.parse(
|
|
1706
|
-
JSON.stringify(
|
|
1706
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
1707
1707
|
);
|
|
1708
1708
|
updatedParentData.links = updatedParentData.links.filter(
|
|
1709
1709
|
(l) => String(l.id) !== String(linkId)
|
|
@@ -1721,7 +1721,7 @@ var userActionHandlers = {
|
|
|
1721
1721
|
try {
|
|
1722
1722
|
await Promise.all(savePromises);
|
|
1723
1723
|
for (const fileId in filesToUpdate) {
|
|
1724
|
-
|
|
1724
|
+
graphDataRef.current[fileId] = filesToUpdate[fileId];
|
|
1725
1725
|
}
|
|
1726
1726
|
removeLinkFromScene(stateRef.current, relink.originalLine);
|
|
1727
1727
|
addNewLinkToScene(stateRef.current, newLinkData);
|
|
@@ -1735,9 +1735,9 @@ var userActionHandlers = {
|
|
|
1735
1735
|
},
|
|
1736
1736
|
handleDeleteLink: async (context, linkObject) => {
|
|
1737
1737
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1738
|
-
const { stateRef, graphDataRef
|
|
1738
|
+
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
1739
1739
|
setters.setRelationshipMenu({ visible: false });
|
|
1740
|
-
if (!(linkObject == null ? void 0 : linkObject.userData) || !
|
|
1740
|
+
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current)
|
|
1741
1741
|
return;
|
|
1742
1742
|
const linkIdToDelete = linkObject.userData.id;
|
|
1743
1743
|
if (!linkIdToDelete) {
|
|
@@ -1748,7 +1748,7 @@ var userActionHandlers = {
|
|
|
1748
1748
|
return;
|
|
1749
1749
|
}
|
|
1750
1750
|
const parentInfo = getParentFileInfoForNode(
|
|
1751
|
-
|
|
1751
|
+
graphDataRef.current,
|
|
1752
1752
|
sceneDataRef.current,
|
|
1753
1753
|
linkObject.userData.source,
|
|
1754
1754
|
context.sceneConfigId,
|
|
@@ -1768,7 +1768,7 @@ var userActionHandlers = {
|
|
|
1768
1768
|
const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
|
|
1769
1769
|
const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
|
|
1770
1770
|
const specificParentData = JSON.parse(
|
|
1771
|
-
JSON.stringify(
|
|
1771
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
1772
1772
|
);
|
|
1773
1773
|
const newLinks = (specificParentData.links || []).filter(
|
|
1774
1774
|
(l) => String(l.id) !== String(linkIdToDelete)
|
|
@@ -1796,7 +1796,7 @@ var userActionHandlers = {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
try {
|
|
1798
1798
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
1799
|
-
|
|
1799
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
1800
1800
|
setters.setDetailsLink(
|
|
1801
1801
|
(prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
|
|
1802
1802
|
);
|
|
@@ -1934,9 +1934,9 @@ var userActionHandlers = {
|
|
|
1934
1934
|
},
|
|
1935
1935
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
1936
1936
|
var _a;
|
|
1937
|
-
const { stateRef, graphDataRef
|
|
1937
|
+
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
1938
1938
|
setters.setMultiContextMenu({ visible: false });
|
|
1939
|
-
if (!nodeIds || nodeIds.size === 0 || !
|
|
1939
|
+
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current)
|
|
1940
1940
|
return;
|
|
1941
1941
|
const strNodeIdsToDelete = Array.from(nodeIds).map(String);
|
|
1942
1942
|
if (actions.delete_file) {
|
|
@@ -1956,7 +1956,7 @@ var userActionHandlers = {
|
|
|
1956
1956
|
const changesByParentFile = {};
|
|
1957
1957
|
for (const nodeId of strNodeIdsToDelete) {
|
|
1958
1958
|
const parentInfo = getParentFileInfoForNode(
|
|
1959
|
-
|
|
1959
|
+
graphDataRef.current,
|
|
1960
1960
|
sceneDataRef.current,
|
|
1961
1961
|
nodeId,
|
|
1962
1962
|
context.sceneConfigId,
|
|
@@ -1977,7 +1977,7 @@ var userActionHandlers = {
|
|
|
1977
1977
|
nodesToDelete: /* @__PURE__ */ new Set(),
|
|
1978
1978
|
linksToDelete: /* @__PURE__ */ new Set(),
|
|
1979
1979
|
originalData: JSON.parse(
|
|
1980
|
-
JSON.stringify(
|
|
1980
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
1981
1981
|
)
|
|
1982
1982
|
};
|
|
1983
1983
|
}
|
|
@@ -2041,7 +2041,7 @@ var userActionHandlers = {
|
|
|
2041
2041
|
try {
|
|
2042
2042
|
await Promise.all(savePromises);
|
|
2043
2043
|
for (const fileId in updatedParentDataCache) {
|
|
2044
|
-
|
|
2044
|
+
graphDataRef.current[fileId] = updatedParentDataCache[fileId];
|
|
2045
2045
|
}
|
|
2046
2046
|
strNodeIdsToDelete.forEach((nodeId) => {
|
|
2047
2047
|
setters.setDetailsNode(
|
|
@@ -2058,7 +2058,7 @@ var userActionHandlers = {
|
|
|
2058
2058
|
},
|
|
2059
2059
|
handleDeleteNode: async (context, nodeData) => {
|
|
2060
2060
|
var _a;
|
|
2061
|
-
const { stateRef, graphDataRef
|
|
2061
|
+
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2062
2062
|
if (actions.delete_file && nodeData) {
|
|
2063
2063
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2064
2064
|
if (urls.length > 0) {
|
|
@@ -2068,11 +2068,11 @@ var userActionHandlers = {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
2070
|
setters.setContextMenu({ visible: false });
|
|
2071
|
-
if (!nodeData || !
|
|
2071
|
+
if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
|
|
2072
2072
|
const nodeIdToDelete = nodeData.id;
|
|
2073
2073
|
const strNodeId = String(nodeIdToDelete);
|
|
2074
2074
|
const parentInfo = getParentFileInfoForNode(
|
|
2075
|
-
|
|
2075
|
+
graphDataRef.current,
|
|
2076
2076
|
sceneDataRef.current,
|
|
2077
2077
|
nodeIdToDelete,
|
|
2078
2078
|
context.sceneConfigId,
|
|
@@ -2090,7 +2090,7 @@ var userActionHandlers = {
|
|
|
2090
2090
|
}
|
|
2091
2091
|
const { parentFileId, ownerId } = parentInfo;
|
|
2092
2092
|
const specificParentData = JSON.parse(
|
|
2093
|
-
JSON.stringify(
|
|
2093
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2094
2094
|
);
|
|
2095
2095
|
const newNodes = (specificParentData.nodes || []).filter(
|
|
2096
2096
|
(n) => String(n.id) !== strNodeId
|
|
@@ -2127,7 +2127,7 @@ var userActionHandlers = {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
try {
|
|
2129
2129
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2130
|
-
|
|
2130
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2131
2131
|
setters.setDetailsNode(
|
|
2132
2132
|
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
2133
2133
|
);
|
|
@@ -2140,8 +2140,8 @@ var userActionHandlers = {
|
|
|
2140
2140
|
},
|
|
2141
2141
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2142
2142
|
var _a, _b, _c;
|
|
2143
|
-
const { graphDataRef
|
|
2144
|
-
if (!
|
|
2143
|
+
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2144
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2145
2145
|
const {
|
|
2146
2146
|
_baseEmissiveIntensity,
|
|
2147
2147
|
_baseScale,
|
|
@@ -2152,7 +2152,7 @@ var userActionHandlers = {
|
|
|
2152
2152
|
...nodeToSave
|
|
2153
2153
|
} = updatedNode;
|
|
2154
2154
|
const parentInfo = getParentFileInfoForNode(
|
|
2155
|
-
|
|
2155
|
+
graphDataRef.current,
|
|
2156
2156
|
sceneDataRef.current,
|
|
2157
2157
|
nodeToSave.id,
|
|
2158
2158
|
context.sceneConfigId,
|
|
@@ -2170,7 +2170,7 @@ var userActionHandlers = {
|
|
|
2170
2170
|
}
|
|
2171
2171
|
const { parentFileId, ownerId } = parentInfo;
|
|
2172
2172
|
const specificParentData = JSON.parse(
|
|
2173
|
-
JSON.stringify(
|
|
2173
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2174
2174
|
);
|
|
2175
2175
|
const nodeIndex = specificParentData.nodes.findIndex(
|
|
2176
2176
|
(n) => String(n.id) === String(nodeToSave.id)
|
|
@@ -2286,7 +2286,7 @@ var userActionHandlers = {
|
|
|
2286
2286
|
specificParentData
|
|
2287
2287
|
);
|
|
2288
2288
|
}
|
|
2289
|
-
|
|
2289
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2290
2290
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2291
2291
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2292
2292
|
sceneDataRef.current.quest_counter = specificParentData.quest_counter || sceneDataRef.current.quest_counter;
|
|
@@ -2303,11 +2303,11 @@ var userActionHandlers = {
|
|
|
2303
2303
|
},
|
|
2304
2304
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2305
2305
|
var _a;
|
|
2306
|
-
const { graphDataRef
|
|
2307
|
-
if (!
|
|
2306
|
+
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2307
|
+
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2308
2308
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2309
2309
|
const parentInfo = getParentFileInfoForNode(
|
|
2310
|
-
|
|
2310
|
+
graphDataRef.current,
|
|
2311
2311
|
sceneDataRef.current,
|
|
2312
2312
|
linkToSave.source,
|
|
2313
2313
|
context.sceneConfigId,
|
|
@@ -2325,7 +2325,7 @@ var userActionHandlers = {
|
|
|
2325
2325
|
}
|
|
2326
2326
|
const { parentFileId, ownerId } = parentInfo;
|
|
2327
2327
|
const specificParentData = JSON.parse(
|
|
2328
|
-
JSON.stringify(
|
|
2328
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2329
2329
|
);
|
|
2330
2330
|
const linkIndex = specificParentData.links.findIndex(
|
|
2331
2331
|
(l) => String(l.id) === String(linkToSave.id)
|
|
@@ -2363,7 +2363,7 @@ var userActionHandlers = {
|
|
|
2363
2363
|
specificParentData
|
|
2364
2364
|
);
|
|
2365
2365
|
}
|
|
2366
|
-
|
|
2366
|
+
graphDataRef.current[parentFileId] = specificParentData;
|
|
2367
2367
|
const lineObject = stateRef.current.allLinks.find(
|
|
2368
2368
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
2369
2369
|
);
|
|
@@ -2386,9 +2386,9 @@ var userActionHandlers = {
|
|
|
2386
2386
|
},
|
|
2387
2387
|
handleAddExistingNodeById: (context, nodeId) => {
|
|
2388
2388
|
var _a;
|
|
2389
|
-
const { stateRef, sceneDataRef, graphDataRef
|
|
2389
|
+
const { stateRef, sceneDataRef, graphDataRef, tweenToTarget, setters } = context;
|
|
2390
2390
|
const state = stateRef.current;
|
|
2391
|
-
const graphFull =
|
|
2391
|
+
const graphFull = graphDataRef.current;
|
|
2392
2392
|
if (!graphFull) return;
|
|
2393
2393
|
const strNodeId = String(nodeId);
|
|
2394
2394
|
const allParentNodes = Object.values(graphFull).flatMap(
|
|
@@ -15556,6 +15556,7 @@ function XViewScene({
|
|
|
15556
15556
|
}, [ownerId, sceneConfigId]);
|
|
15557
15557
|
const sceneDataRef = useRef21(null);
|
|
15558
15558
|
const parentDataRef = useRef21(null);
|
|
15559
|
+
const graphDataRef = parentDataRef;
|
|
15559
15560
|
const ancestryDataRef = useRef21(null);
|
|
15560
15561
|
const [isLoading, setIsLoading] = useState30(true);
|
|
15561
15562
|
const [permissionStatus, setPermissionStatus] = useState30("loading");
|
|
@@ -18123,15 +18124,6 @@ function XViewScene({
|
|
|
18123
18124
|
if (questIndex !== -1) {
|
|
18124
18125
|
sceneData.quest_nodes[questIndex].quest_tree = formattedTree;
|
|
18125
18126
|
sceneData.quest_nodes[questIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18126
|
-
if (graphDataRef.current[sceneConfigId]) {
|
|
18127
|
-
const graphIndex = graphDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18128
|
-
(q) => String(q.id) === String(questNodeId)
|
|
18129
|
-
);
|
|
18130
|
-
if (graphIndex !== -1) {
|
|
18131
|
-
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_tree = formattedTree;
|
|
18132
|
-
graphDataRef.current[sceneConfigId].nodes[graphIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18133
|
-
}
|
|
18134
|
-
}
|
|
18135
18127
|
if (parentDataRef.current[sceneConfigId]) {
|
|
18136
18128
|
const parentIndex = parentDataRef.current[sceneConfigId].nodes.findIndex(
|
|
18137
18129
|
(q) => String(q.id) === String(questNodeId)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.6-dev.
|
|
3
|
+
"version": "1.2.6-dev.79",
|
|
4
4
|
"description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
|
|
5
5
|
"author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
|
|
6
6
|
"license": "UNLICENSED",
|