@lv-x-software-house/x_view 1.2.5-dev.40 → 1.2.5-dev.43
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 +719 -229
- package/dist/index.mjs +719 -229
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1148,11 +1148,7 @@ import { LineMaterial } from "three/addons/lines/LineMaterial.js";
|
|
|
1148
1148
|
import { LineGeometry } from "three/addons/lines/LineGeometry.js";
|
|
1149
1149
|
var DEFAULT_LAYER = 0;
|
|
1150
1150
|
var GHOST_BLOOM_LAYER = 1;
|
|
1151
|
-
var ANCESTRY_COLORS = [
|
|
1152
|
-
30719,
|
|
1153
|
-
2278750,
|
|
1154
|
-
15680580
|
|
1155
|
-
];
|
|
1151
|
+
var ANCESTRY_COLORS = [30719, 2278750, 15680580];
|
|
1156
1152
|
var NODE_SCALE_FACTORS = {
|
|
1157
1153
|
small: 0.4,
|
|
1158
1154
|
medium: 1,
|
|
@@ -1252,7 +1248,12 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
|
|
|
1252
1248
|
bgMesh.position.z = -0.01;
|
|
1253
1249
|
bgMesh.layers.set(DEFAULT_LAYER);
|
|
1254
1250
|
mesh.add(bgMesh);
|
|
1255
|
-
const aura = addGlowAura(
|
|
1251
|
+
const aura = addGlowAura(
|
|
1252
|
+
mesh,
|
|
1253
|
+
colorHex,
|
|
1254
|
+
glowTexture,
|
|
1255
|
+
x_view_config.GLOW.auraScale
|
|
1256
|
+
);
|
|
1256
1257
|
if (aura && aura.material) {
|
|
1257
1258
|
aura.material.opacity = Math.min(0.8, userIntensity * 0.15);
|
|
1258
1259
|
}
|
|
@@ -1267,7 +1268,12 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
|
|
|
1267
1268
|
metalness: 0
|
|
1268
1269
|
});
|
|
1269
1270
|
mesh = new THREE.Mesh(geometry, material);
|
|
1270
|
-
const aura = addGlowAura(
|
|
1271
|
+
const aura = addGlowAura(
|
|
1272
|
+
mesh,
|
|
1273
|
+
colorHex,
|
|
1274
|
+
glowTexture,
|
|
1275
|
+
x_view_config.GLOW.auraScale
|
|
1276
|
+
);
|
|
1271
1277
|
if (aura && aura.material) {
|
|
1272
1278
|
aura.material.opacity = Math.min(0.8, userIntensity * 0.15);
|
|
1273
1279
|
}
|
|
@@ -1311,7 +1317,8 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
|
|
|
1311
1317
|
state.graphGroup.remove(existingMesh);
|
|
1312
1318
|
if (existingMesh.geometry) existingMesh.geometry.dispose();
|
|
1313
1319
|
if (existingMesh.material) {
|
|
1314
|
-
if (Array.isArray(existingMesh.material))
|
|
1320
|
+
if (Array.isArray(existingMesh.material))
|
|
1321
|
+
existingMesh.material.forEach((m) => m.dispose());
|
|
1315
1322
|
else existingMesh.material.dispose();
|
|
1316
1323
|
}
|
|
1317
1324
|
existingMesh.traverse((child) => {
|
|
@@ -1343,18 +1350,24 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
|
|
|
1343
1350
|
else state.clickableNodes.push(newMesh);
|
|
1344
1351
|
if (state.allLinks) {
|
|
1345
1352
|
state.allLinks.forEach((line) => {
|
|
1346
|
-
if (String(line.userData.source) === nodeId)
|
|
1347
|
-
|
|
1353
|
+
if (String(line.userData.source) === nodeId)
|
|
1354
|
+
line.userData.sourceNode = newMesh;
|
|
1355
|
+
if (String(line.userData.target) === nodeId)
|
|
1356
|
+
line.userData.targetNode = newMesh;
|
|
1348
1357
|
});
|
|
1349
1358
|
}
|
|
1350
1359
|
if (state.ancestryLinks) {
|
|
1351
1360
|
state.ancestryLinks.forEach((line) => {
|
|
1352
|
-
if (String(line.userData.sourceNode.userData.id) === nodeId)
|
|
1353
|
-
|
|
1361
|
+
if (String(line.userData.sourceNode.userData.id) === nodeId)
|
|
1362
|
+
line.userData.sourceNode = newMesh;
|
|
1363
|
+
if (String(line.userData.targetNode.userData.id) === nodeId)
|
|
1364
|
+
line.userData.targetNode = newMesh;
|
|
1354
1365
|
});
|
|
1355
1366
|
}
|
|
1356
1367
|
} else {
|
|
1357
|
-
const { color, emissive } = computeNodeMaterialProps(
|
|
1368
|
+
const { color, emissive } = computeNodeMaterialProps(
|
|
1369
|
+
updatedNode.color || "#ffffff"
|
|
1370
|
+
);
|
|
1358
1371
|
if (newIsImage) {
|
|
1359
1372
|
const borderMesh = existingMesh.getObjectByName("borderRing");
|
|
1360
1373
|
if (borderMesh && borderMesh.material) {
|
|
@@ -1373,7 +1386,10 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
|
|
|
1373
1386
|
}
|
|
1374
1387
|
const aura = existingMesh.getObjectByName("aura");
|
|
1375
1388
|
if (aura && aura.material) {
|
|
1376
|
-
const auraColor = new THREE.Color(updatedNode.color || "#ffffff").lerp(
|
|
1389
|
+
const auraColor = new THREE.Color(updatedNode.color || "#ffffff").lerp(
|
|
1390
|
+
new THREE.Color("#ffffff"),
|
|
1391
|
+
0.25
|
|
1392
|
+
);
|
|
1377
1393
|
aura.material.color.copy(auraColor);
|
|
1378
1394
|
aura.material.opacity = Math.min(0.8, newIntensity * 0.15);
|
|
1379
1395
|
}
|
|
@@ -1461,7 +1477,10 @@ var createLinkLine = (linkData, sourceNodeMesh, targetNodeMesh, resolution, isCu
|
|
|
1461
1477
|
const points = curve.getPoints(x_view_config.CURVE_SEGMENTS);
|
|
1462
1478
|
points.forEach((p) => positions.push(p.x, p.y, p.z));
|
|
1463
1479
|
} else {
|
|
1464
|
-
positions.push(
|
|
1480
|
+
positions.push(
|
|
1481
|
+
...sourceNodeMesh.position.toArray(),
|
|
1482
|
+
...targetNodeMesh.position.toArray()
|
|
1483
|
+
);
|
|
1465
1484
|
}
|
|
1466
1485
|
lineGeometry.setPositions(positions);
|
|
1467
1486
|
const lineMaterial = new LineMaterial({
|
|
@@ -1580,12 +1599,22 @@ var updateSceneHighlights = (state) => {
|
|
|
1580
1599
|
const userDefinedIntensity = node.userData.intensity !== void 0 ? Number(node.userData.intensity) : 0;
|
|
1581
1600
|
const finalIntensity = userDefinedIntensity + MIN_VISIBILITY_INTENSITY + addedIntensity;
|
|
1582
1601
|
const targetScale = scaleMultiplier * getNodeBaseScale(node);
|
|
1583
|
-
node.scale.lerp(
|
|
1602
|
+
node.scale.lerp(
|
|
1603
|
+
new THREE.Vector3(targetScale, targetScale, targetScale),
|
|
1604
|
+
0.1
|
|
1605
|
+
);
|
|
1584
1606
|
const aura = node.getObjectByName("aura");
|
|
1585
1607
|
if (aura) {
|
|
1586
1608
|
aura.material.color.lerp(targetColor, 0.1);
|
|
1587
|
-
const targetOpacity = Math.min(
|
|
1588
|
-
|
|
1609
|
+
const targetOpacity = Math.min(
|
|
1610
|
+
0.8,
|
|
1611
|
+
finalIntensity * 0.15 + (addedIntensity > 0 ? 0.3 : 0)
|
|
1612
|
+
);
|
|
1613
|
+
aura.material.opacity = THREE.MathUtils.lerp(
|
|
1614
|
+
aura.material.opacity,
|
|
1615
|
+
targetOpacity,
|
|
1616
|
+
0.1
|
|
1617
|
+
);
|
|
1589
1618
|
}
|
|
1590
1619
|
if (isImageNode) {
|
|
1591
1620
|
const borderMesh = node.getObjectByName("borderRing");
|
|
@@ -1662,7 +1691,10 @@ var updateSceneHighlights = (state) => {
|
|
|
1662
1691
|
);
|
|
1663
1692
|
} else if (hoveredLink) {
|
|
1664
1693
|
connectedLinks = [hoveredLink];
|
|
1665
|
-
connectedNodes = [
|
|
1694
|
+
connectedNodes = [
|
|
1695
|
+
hoveredLink.userData.sourceNode,
|
|
1696
|
+
hoveredLink.userData.targetNode
|
|
1697
|
+
];
|
|
1666
1698
|
}
|
|
1667
1699
|
clickableNodes.forEach((node) => {
|
|
1668
1700
|
const nodeIdStr = String(node.userData.id);
|
|
@@ -1719,7 +1751,14 @@ var updateSceneHighlights = (state) => {
|
|
|
1719
1751
|
}
|
|
1720
1752
|
};
|
|
1721
1753
|
var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
1722
|
-
const {
|
|
1754
|
+
const {
|
|
1755
|
+
graphGroup,
|
|
1756
|
+
nodeObjects,
|
|
1757
|
+
clickableNodes,
|
|
1758
|
+
allLinks,
|
|
1759
|
+
glowTexture,
|
|
1760
|
+
renderer
|
|
1761
|
+
} = state;
|
|
1723
1762
|
const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
|
|
1724
1763
|
if (!sourceNodeMesh || !graphGroup) return;
|
|
1725
1764
|
const mesh = createNodeMesh(newNodeData, position, glowTexture);
|
|
@@ -1733,7 +1772,12 @@ var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
|
|
|
1733
1772
|
renderer.domElement.clientWidth,
|
|
1734
1773
|
renderer.domElement.clientHeight
|
|
1735
1774
|
);
|
|
1736
|
-
const lines = createMultipleLinkLines(
|
|
1775
|
+
const lines = createMultipleLinkLines(
|
|
1776
|
+
[newLinkData],
|
|
1777
|
+
sourceNodeMesh,
|
|
1778
|
+
mesh,
|
|
1779
|
+
resolution
|
|
1780
|
+
);
|
|
1737
1781
|
lines.forEach((line) => {
|
|
1738
1782
|
graphGroup.add(line);
|
|
1739
1783
|
allLinks.push(line);
|
|
@@ -1752,13 +1796,20 @@ var addNewLinkToScene = (state, newLinkData) => {
|
|
|
1752
1796
|
(l) => String(l.userData.source) === String(newLinkData.source) && String(l.userData.target) === String(newLinkData.target) || String(l.userData.source) === String(newLinkData.target) && String(l.userData.target) === String(newLinkData.source)
|
|
1753
1797
|
).map((l) => l.userData);
|
|
1754
1798
|
existingLinksData.forEach((linkData) => {
|
|
1755
|
-
const linkToRemove = allLinks.find(
|
|
1799
|
+
const linkToRemove = allLinks.find(
|
|
1800
|
+
(l) => String(l.userData.id) === String(linkData.id)
|
|
1801
|
+
);
|
|
1756
1802
|
if (linkToRemove) {
|
|
1757
1803
|
removeLinkFromScene(state, linkToRemove);
|
|
1758
1804
|
}
|
|
1759
1805
|
});
|
|
1760
1806
|
const allLinksToRender = [...existingLinksData, newLinkData];
|
|
1761
|
-
const newRenderedLines = createMultipleLinkLines(
|
|
1807
|
+
const newRenderedLines = createMultipleLinkLines(
|
|
1808
|
+
allLinksToRender,
|
|
1809
|
+
sourceNodeMesh,
|
|
1810
|
+
targetNodeMesh,
|
|
1811
|
+
resolution
|
|
1812
|
+
);
|
|
1762
1813
|
newRenderedLines.forEach((line) => {
|
|
1763
1814
|
graphGroup.add(line);
|
|
1764
1815
|
allLinks.push(line);
|
|
@@ -1772,12 +1823,19 @@ var removeLinkFromScene = (state, linkObject) => {
|
|
|
1772
1823
|
if (graphGroup) graphGroup.remove(linkObject);
|
|
1773
1824
|
if (linkObject.geometry) linkObject.geometry.dispose();
|
|
1774
1825
|
if (linkObject.material) {
|
|
1775
|
-
if (Array.isArray(linkObject.material))
|
|
1826
|
+
if (Array.isArray(linkObject.material))
|
|
1827
|
+
linkObject.material.forEach((m) => m.dispose());
|
|
1776
1828
|
else linkObject.material.dispose();
|
|
1777
1829
|
}
|
|
1778
1830
|
};
|
|
1779
1831
|
var removeNodeFromScene = (state, nodeId) => {
|
|
1780
|
-
const {
|
|
1832
|
+
const {
|
|
1833
|
+
graphGroup,
|
|
1834
|
+
nodeObjects,
|
|
1835
|
+
clickableNodes,
|
|
1836
|
+
allLinks,
|
|
1837
|
+
timelineIntervalsGroup
|
|
1838
|
+
} = state;
|
|
1781
1839
|
const nodeToRemove = nodeObjects[String(nodeId)];
|
|
1782
1840
|
if (!nodeToRemove) return;
|
|
1783
1841
|
const strNodeId = String(nodeId);
|
|
@@ -1804,7 +1862,8 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
1804
1862
|
if (timelineEndLabel) {
|
|
1805
1863
|
timelineIntervalsGroup.remove(timelineEndLabel);
|
|
1806
1864
|
if (timelineEndLabel.material) {
|
|
1807
|
-
if (timelineEndLabel.material.map)
|
|
1865
|
+
if (timelineEndLabel.material.map)
|
|
1866
|
+
timelineEndLabel.material.map.dispose();
|
|
1808
1867
|
timelineEndLabel.material.dispose();
|
|
1809
1868
|
}
|
|
1810
1869
|
}
|
|
@@ -1844,13 +1903,17 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId
|
|
|
1844
1903
|
if (allParentData.hasOwnProperty(parentFileId)) {
|
|
1845
1904
|
const parentFile = allParentData[parentFileId];
|
|
1846
1905
|
if (parentFile.nodes && parentFile.nodes.some((n) => String(n.id) === String(nodeId))) {
|
|
1847
|
-
const parentDbInfo = parentDbsArray.find(
|
|
1906
|
+
const parentDbInfo = parentDbsArray.find(
|
|
1907
|
+
(db) => String(db.db_id) === String(parentFileId)
|
|
1908
|
+
);
|
|
1848
1909
|
if (parentDbInfo) {
|
|
1849
1910
|
return { parentFileId, ownerId: parentDbInfo.owner_id };
|
|
1850
1911
|
} else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
|
|
1851
1912
|
return { parentFileId, ownerId: sceneOwnerId };
|
|
1852
1913
|
} else {
|
|
1853
|
-
console.warn(
|
|
1914
|
+
console.warn(
|
|
1915
|
+
`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`
|
|
1916
|
+
);
|
|
1854
1917
|
return { parentFileId, ownerId: null };
|
|
1855
1918
|
}
|
|
1856
1919
|
}
|
|
@@ -1895,7 +1958,12 @@ var userActionHandlers = {
|
|
|
1895
1958
|
opacity: 0.75
|
|
1896
1959
|
});
|
|
1897
1960
|
const ghostNode = new THREE.Mesh(ghostGeometry, ghostMaterial);
|
|
1898
|
-
const ghostAura = addGlowAura(
|
|
1961
|
+
const ghostAura = addGlowAura(
|
|
1962
|
+
ghostNode,
|
|
1963
|
+
sourceColor,
|
|
1964
|
+
glowTexture,
|
|
1965
|
+
x_view_config.GLOW.auraScale
|
|
1966
|
+
);
|
|
1899
1967
|
const ghostLabel = createTextSprite("New Node", 48);
|
|
1900
1968
|
ghostLabel.name = "label";
|
|
1901
1969
|
ghostNode.userData.labelObject = ghostLabel;
|
|
@@ -1918,15 +1986,25 @@ var userActionHandlers = {
|
|
|
1918
1986
|
dashSize: 1,
|
|
1919
1987
|
gapSize: 0.5,
|
|
1920
1988
|
depthWrite: false,
|
|
1921
|
-
resolution: new THREE.Vector2(
|
|
1989
|
+
resolution: new THREE.Vector2(
|
|
1990
|
+
renderer.domElement.clientWidth,
|
|
1991
|
+
renderer.domElement.clientHeight
|
|
1992
|
+
)
|
|
1922
1993
|
});
|
|
1923
1994
|
const ghostLine = new Line2(lineGeometry, lineMaterial);
|
|
1924
1995
|
ghostLine.layers.set(GHOST_BLOOM_LAYER);
|
|
1925
1996
|
stateRef.current.graphGroup.add(ghostLine);
|
|
1926
|
-
stateRef.current.ghostElements = {
|
|
1997
|
+
stateRef.current.ghostElements = {
|
|
1998
|
+
node: ghostNode,
|
|
1999
|
+
line: ghostLine,
|
|
2000
|
+
aura: ghostAura
|
|
2001
|
+
};
|
|
1927
2002
|
setters.setCreationMode({ isActive: true, sourceNodeData });
|
|
1928
2003
|
setters.setFormPosition({ left: 16, top: 16, opacity: 1 });
|
|
1929
|
-
tweenToTarget(
|
|
2004
|
+
tweenToTarget(
|
|
2005
|
+
sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5),
|
|
2006
|
+
1.5
|
|
2007
|
+
);
|
|
1930
2008
|
},
|
|
1931
2009
|
handleCancelCreation: (context) => {
|
|
1932
2010
|
const { stateRef, setters } = context;
|
|
@@ -1959,35 +2037,61 @@ var userActionHandlers = {
|
|
|
1959
2037
|
setters.setFormPosition((p) => ({ ...p, opacity: 0 }));
|
|
1960
2038
|
},
|
|
1961
2039
|
handleSaveNode: async (context, newNodeData) => {
|
|
1962
|
-
const {
|
|
2040
|
+
const {
|
|
2041
|
+
graphDataRef,
|
|
2042
|
+
sceneDataRef,
|
|
2043
|
+
stateRef,
|
|
2044
|
+
creationMode,
|
|
2045
|
+
setters,
|
|
2046
|
+
actions
|
|
2047
|
+
} = context;
|
|
1963
2048
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1964
2049
|
const { sourceNodeData } = creationMode;
|
|
1965
2050
|
const { targetDatasetId, ...nodeDataToSave } = newNodeData;
|
|
1966
2051
|
const newNode = { id: short.generate(), ...nodeDataToSave };
|
|
1967
|
-
const newLink = {
|
|
1968
|
-
|
|
2052
|
+
const newLink = {
|
|
2053
|
+
id: `link_${short.generate()}`,
|
|
2054
|
+
source: sourceNodeData.id,
|
|
2055
|
+
target: newNode.id
|
|
2056
|
+
};
|
|
2057
|
+
const sourceParentInfo = stateRef.current.nodeIdToParentFileMap.get(
|
|
2058
|
+
String(sourceNodeData.id)
|
|
2059
|
+
);
|
|
1969
2060
|
const finalTargetDatasetId = targetDatasetId || sourceParentInfo.parentFileId;
|
|
1970
|
-
const targetParentInfo = sceneDataRef.current.parent_dbs.find(
|
|
2061
|
+
const targetParentInfo = sceneDataRef.current.parent_dbs.find(
|
|
2062
|
+
(db) => String(db.db_id) === String(finalTargetDatasetId)
|
|
2063
|
+
);
|
|
1971
2064
|
if (!sourceParentInfo || !targetParentInfo) {
|
|
1972
2065
|
alert("Erro ao identificar os datasets de origem ou destino.");
|
|
1973
2066
|
return;
|
|
1974
2067
|
}
|
|
1975
2068
|
const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
|
|
1976
|
-
const sourceDataToUpdate = JSON.parse(
|
|
2069
|
+
const sourceDataToUpdate = JSON.parse(
|
|
2070
|
+
JSON.stringify(graphDataRef.current[sourceParentInfo.parentFileId])
|
|
2071
|
+
);
|
|
1977
2072
|
let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef.current[finalTargetDatasetId])) : sourceDataToUpdate;
|
|
1978
2073
|
targetDataToUpdate.nodes.push(newNode);
|
|
1979
2074
|
sourceDataToUpdate.links.push(newLink);
|
|
1980
2075
|
const savePromises = [];
|
|
1981
2076
|
if (isCrossDataset) {
|
|
1982
2077
|
savePromises.push(
|
|
1983
|
-
actions.save_view_data(
|
|
2078
|
+
actions.save_view_data(
|
|
2079
|
+
`x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`,
|
|
2080
|
+
sourceDataToUpdate
|
|
2081
|
+
)
|
|
1984
2082
|
);
|
|
1985
2083
|
savePromises.push(
|
|
1986
|
-
actions.save_view_data(
|
|
2084
|
+
actions.save_view_data(
|
|
2085
|
+
`x_view_dbs/${targetParentInfo.owner_id}/${finalTargetDatasetId}`,
|
|
2086
|
+
targetDataToUpdate
|
|
2087
|
+
)
|
|
1987
2088
|
);
|
|
1988
2089
|
} else {
|
|
1989
2090
|
savePromises.push(
|
|
1990
|
-
actions.save_view_data(
|
|
2091
|
+
actions.save_view_data(
|
|
2092
|
+
`x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`,
|
|
2093
|
+
sourceDataToUpdate
|
|
2094
|
+
)
|
|
1991
2095
|
);
|
|
1992
2096
|
}
|
|
1993
2097
|
try {
|
|
@@ -2018,7 +2122,8 @@ var userActionHandlers = {
|
|
|
2018
2122
|
if (ghostElements.node && graphGroup) {
|
|
2019
2123
|
if (ghostElements.node.userData.labelObject) {
|
|
2020
2124
|
graphGroup.remove(ghostElements.node.userData.labelObject);
|
|
2021
|
-
if (ghostElements.node.userData.labelObject.material.map)
|
|
2125
|
+
if (ghostElements.node.userData.labelObject.material.map)
|
|
2126
|
+
ghostElements.node.userData.labelObject.material.map.dispose();
|
|
2022
2127
|
ghostElements.node.userData.labelObject.material.dispose();
|
|
2023
2128
|
}
|
|
2024
2129
|
graphGroup.remove(ghostElements.node);
|
|
@@ -2051,7 +2156,12 @@ var userActionHandlers = {
|
|
|
2051
2156
|
opacity: 0.75
|
|
2052
2157
|
});
|
|
2053
2158
|
const ghostNode = new THREE.Mesh(ghostGeometry, ghostMaterial);
|
|
2054
|
-
const ghostAura = addGlowAura(
|
|
2159
|
+
const ghostAura = addGlowAura(
|
|
2160
|
+
ghostNode,
|
|
2161
|
+
sourceColor,
|
|
2162
|
+
glowTexture,
|
|
2163
|
+
x_view_config.GLOW.auraScale
|
|
2164
|
+
);
|
|
2055
2165
|
const ghostLabel = createTextSprite("New Version", 48);
|
|
2056
2166
|
ghostLabel.name = "label";
|
|
2057
2167
|
ghostNode.userData.labelObject = ghostLabel;
|
|
@@ -2075,15 +2185,25 @@ var userActionHandlers = {
|
|
|
2075
2185
|
dashSize: 1,
|
|
2076
2186
|
gapSize: 0.5,
|
|
2077
2187
|
depthWrite: false,
|
|
2078
|
-
resolution: new THREE.Vector2(
|
|
2188
|
+
resolution: new THREE.Vector2(
|
|
2189
|
+
renderer.domElement.clientWidth,
|
|
2190
|
+
renderer.domElement.clientHeight
|
|
2191
|
+
)
|
|
2079
2192
|
});
|
|
2080
2193
|
const ghostLine = new Line2(lineGeometry, lineMaterial);
|
|
2081
2194
|
ghostLine.layers.set(GHOST_BLOOM_LAYER);
|
|
2082
2195
|
stateRef.current.graphGroup.add(ghostLine);
|
|
2083
|
-
stateRef.current.ghostElements = {
|
|
2196
|
+
stateRef.current.ghostElements = {
|
|
2197
|
+
node: ghostNode,
|
|
2198
|
+
line: ghostLine,
|
|
2199
|
+
aura: ghostAura
|
|
2200
|
+
};
|
|
2084
2201
|
setters.setVersionMode({ isActive: true, sourceNodeData });
|
|
2085
2202
|
setters.setFormPosition({ left: 16, top: 16, opacity: 1 });
|
|
2086
|
-
tweenToTarget(
|
|
2203
|
+
tweenToTarget(
|
|
2204
|
+
sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5),
|
|
2205
|
+
1.5
|
|
2206
|
+
);
|
|
2087
2207
|
},
|
|
2088
2208
|
handleCancelVersioning: (context) => {
|
|
2089
2209
|
const { stateRef, setters } = context;
|
|
@@ -2127,15 +2247,32 @@ var userActionHandlers = {
|
|
|
2127
2247
|
...newNodeData,
|
|
2128
2248
|
version_node: { is_version: true, parent_node: sourceNodeData.id }
|
|
2129
2249
|
};
|
|
2130
|
-
const newLink = {
|
|
2131
|
-
|
|
2250
|
+
const newLink = {
|
|
2251
|
+
id: `link_${short.generate()}`,
|
|
2252
|
+
source: sourceNodeData.id,
|
|
2253
|
+
target: newNode.id
|
|
2254
|
+
};
|
|
2255
|
+
const parentInfo = getParentFileInfoForNode(
|
|
2256
|
+
graphDataRef.current,
|
|
2257
|
+
sceneDataRef.current,
|
|
2258
|
+
sourceNodeData.id,
|
|
2259
|
+
context.sceneConfigId,
|
|
2260
|
+
context.ownerId
|
|
2261
|
+
);
|
|
2132
2262
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2133
|
-
console.error(
|
|
2134
|
-
|
|
2263
|
+
console.error(
|
|
2264
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
|
|
2265
|
+
sourceNodeData.id
|
|
2266
|
+
);
|
|
2267
|
+
alert(
|
|
2268
|
+
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
|
|
2269
|
+
);
|
|
2135
2270
|
return;
|
|
2136
2271
|
}
|
|
2137
2272
|
const { parentFileId, ownerId } = parentInfo;
|
|
2138
|
-
const specificParentData = JSON.parse(
|
|
2273
|
+
const specificParentData = JSON.parse(
|
|
2274
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2275
|
+
);
|
|
2139
2276
|
specificParentData.nodes.push(newNode);
|
|
2140
2277
|
specificParentData.links.push(newLink);
|
|
2141
2278
|
try {
|
|
@@ -2148,10 +2285,16 @@ var userActionHandlers = {
|
|
|
2148
2285
|
quest_nodes: specificParentData.nodes,
|
|
2149
2286
|
quest_links: specificParentData.links
|
|
2150
2287
|
};
|
|
2151
|
-
await context.actions.save_view_data(
|
|
2288
|
+
await context.actions.save_view_data(
|
|
2289
|
+
context.sceneSaveUrl,
|
|
2290
|
+
viewFilePayload
|
|
2291
|
+
);
|
|
2152
2292
|
} else {
|
|
2153
2293
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2154
|
-
await context.actions.save_view_data(
|
|
2294
|
+
await context.actions.save_view_data(
|
|
2295
|
+
filenameForSpecificParent,
|
|
2296
|
+
specificParentData
|
|
2297
|
+
);
|
|
2155
2298
|
}
|
|
2156
2299
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2157
2300
|
const finalPosition = stateRef.current.ghostElements.node.position.clone();
|
|
@@ -2164,12 +2307,31 @@ var userActionHandlers = {
|
|
|
2164
2307
|
userActionHandlers.handleCancelVersioning(context);
|
|
2165
2308
|
},
|
|
2166
2309
|
handleExpandConnections: (context, sourceNode, linksToExpand) => {
|
|
2167
|
-
const {
|
|
2168
|
-
|
|
2169
|
-
|
|
2310
|
+
const {
|
|
2311
|
+
stateRef,
|
|
2312
|
+
sceneDataRef,
|
|
2313
|
+
graphDataRef,
|
|
2314
|
+
mountRef,
|
|
2315
|
+
setters,
|
|
2316
|
+
tweenToTarget
|
|
2317
|
+
} = context;
|
|
2318
|
+
const {
|
|
2319
|
+
graphGroup,
|
|
2320
|
+
nodeObjects,
|
|
2321
|
+
clickableNodes,
|
|
2322
|
+
allLinks,
|
|
2323
|
+
glowTexture,
|
|
2324
|
+
renderer,
|
|
2325
|
+
tweenGroup
|
|
2326
|
+
} = stateRef.current;
|
|
2327
|
+
if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0)
|
|
2328
|
+
return;
|
|
2170
2329
|
const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
|
|
2171
2330
|
if (!sourceNodeMesh) return;
|
|
2172
|
-
const resolution = new THREE.Vector2(
|
|
2331
|
+
const resolution = new THREE.Vector2(
|
|
2332
|
+
mountRef.current.clientWidth,
|
|
2333
|
+
mountRef.current.clientHeight
|
|
2334
|
+
);
|
|
2173
2335
|
const targetFinalPositions = [];
|
|
2174
2336
|
const newVersionMeshes = [];
|
|
2175
2337
|
linksToExpand.forEach((link) => {
|
|
@@ -2177,15 +2339,25 @@ var userActionHandlers = {
|
|
|
2177
2339
|
const isSource = String(link.source) === String(sourceNode.id);
|
|
2178
2340
|
const targetNodeId = isSource ? link.target : link.source;
|
|
2179
2341
|
if (!nodeObjects[String(targetNodeId)]) {
|
|
2180
|
-
const allParentNodes = Object.values(graphDataRef.current).flatMap(
|
|
2181
|
-
|
|
2342
|
+
const allParentNodes = Object.values(graphDataRef.current).flatMap(
|
|
2343
|
+
(fileData) => fileData.nodes
|
|
2344
|
+
);
|
|
2345
|
+
const nodeData = allParentNodes.find(
|
|
2346
|
+
(n) => String(n.id) === String(targetNodeId)
|
|
2347
|
+
);
|
|
2182
2348
|
if (!nodeData) {
|
|
2183
|
-
console.warn(
|
|
2349
|
+
console.warn(
|
|
2350
|
+
`Dados do Node com ID ${targetNodeId} n\xE3o encontrados no cache.`
|
|
2351
|
+
);
|
|
2184
2352
|
return;
|
|
2185
2353
|
}
|
|
2186
2354
|
const startPosition = sourceNodeMesh.position.clone();
|
|
2187
2355
|
const endPosition = startPosition.clone().add(
|
|
2188
|
-
new THREE.Vector3(
|
|
2356
|
+
new THREE.Vector3(
|
|
2357
|
+
(Math.random() - 0.5) * 60,
|
|
2358
|
+
(Math.random() - 0.5) * 15,
|
|
2359
|
+
(Math.random() - 0.5) * 60
|
|
2360
|
+
)
|
|
2189
2361
|
);
|
|
2190
2362
|
targetFinalPositions.push(endPosition);
|
|
2191
2363
|
const targetMesh = createNodeMesh(nodeData, startPosition, glowTexture);
|
|
@@ -2209,7 +2381,9 @@ var userActionHandlers = {
|
|
|
2209
2381
|
}
|
|
2210
2382
|
});
|
|
2211
2383
|
linksToExpand.forEach((link) => {
|
|
2212
|
-
const linkAlreadyInSceneObjects = allLinks.some(
|
|
2384
|
+
const linkAlreadyInSceneObjects = allLinks.some(
|
|
2385
|
+
(l) => String(l.userData.id) === String(link.id)
|
|
2386
|
+
);
|
|
2213
2387
|
if (linkAlreadyInSceneObjects) return;
|
|
2214
2388
|
const sourceMesh = nodeObjects[String(link.source)];
|
|
2215
2389
|
const targetMesh = nodeObjects[String(link.target)];
|
|
@@ -2218,13 +2392,20 @@ var userActionHandlers = {
|
|
|
2218
2392
|
(l) => String(l.userData.source) === String(link.source) && String(l.userData.target) === String(link.target) || String(l.userData.source) === String(link.target) && String(l.userData.target) === String(link.source)
|
|
2219
2393
|
).map((l) => l.userData);
|
|
2220
2394
|
currentLinksBetweenNodesData.forEach((linkData) => {
|
|
2221
|
-
const linkToRemove = allLinks.find(
|
|
2395
|
+
const linkToRemove = allLinks.find(
|
|
2396
|
+
(l) => String(l.userData.id) === String(linkData.id)
|
|
2397
|
+
);
|
|
2222
2398
|
if (linkToRemove) {
|
|
2223
2399
|
removeLinkFromScene(stateRef.current, linkToRemove);
|
|
2224
2400
|
}
|
|
2225
2401
|
});
|
|
2226
2402
|
const allLinksToRender = [...currentLinksBetweenNodesData, link];
|
|
2227
|
-
const newRenderedLinks = createMultipleLinkLines(
|
|
2403
|
+
const newRenderedLinks = createMultipleLinkLines(
|
|
2404
|
+
allLinksToRender,
|
|
2405
|
+
sourceMesh,
|
|
2406
|
+
targetMesh,
|
|
2407
|
+
resolution
|
|
2408
|
+
);
|
|
2228
2409
|
newRenderedLinks.forEach((newLine) => {
|
|
2229
2410
|
newLine.material.opacity = 0;
|
|
2230
2411
|
graphGroup.add(newLine);
|
|
@@ -2243,7 +2424,10 @@ var userActionHandlers = {
|
|
|
2243
2424
|
const size = new THREE.Vector3();
|
|
2244
2425
|
boundingBox.getSize(size);
|
|
2245
2426
|
const spread = Math.max(size.x, size.y, size.z, 1);
|
|
2246
|
-
const desiredDistance = Math.max(
|
|
2427
|
+
const desiredDistance = Math.max(
|
|
2428
|
+
x_view_config.CAMERA_ZOOM_DISTANCE,
|
|
2429
|
+
spread * 1.2
|
|
2430
|
+
);
|
|
2247
2431
|
const zoomFactor = x_view_config.CAMERA_ZOOM_DISTANCE / desiredDistance;
|
|
2248
2432
|
tweenToTarget(center, zoomFactor);
|
|
2249
2433
|
}
|
|
@@ -2278,7 +2462,10 @@ var userActionHandlers = {
|
|
|
2278
2462
|
dashSize: 0.5,
|
|
2279
2463
|
gapSize: 0.25,
|
|
2280
2464
|
depthWrite: false,
|
|
2281
|
-
resolution: new THREE.Vector2(
|
|
2465
|
+
resolution: new THREE.Vector2(
|
|
2466
|
+
renderer.domElement.clientWidth,
|
|
2467
|
+
renderer.domElement.clientHeight
|
|
2468
|
+
)
|
|
2282
2469
|
});
|
|
2283
2470
|
const lineGeometry = new LineGeometry().setPositions([
|
|
2284
2471
|
...sourceNodeMesh.position.toArray(),
|
|
@@ -2287,7 +2474,11 @@ var userActionHandlers = {
|
|
|
2287
2474
|
const connectingLine = new Line2(lineGeometry, lineMaterial);
|
|
2288
2475
|
connectingLine.layers.set(GHOST_BLOOM_LAYER);
|
|
2289
2476
|
graphGroup.add(connectingLine);
|
|
2290
|
-
stateRef.current.connection = {
|
|
2477
|
+
stateRef.current.connection = {
|
|
2478
|
+
isActive: true,
|
|
2479
|
+
sourceNodeData,
|
|
2480
|
+
line: connectingLine
|
|
2481
|
+
};
|
|
2291
2482
|
},
|
|
2292
2483
|
handleCancelConnection: (context) => {
|
|
2293
2484
|
const { stateRef, mountRef } = context;
|
|
@@ -2297,7 +2488,11 @@ var userActionHandlers = {
|
|
|
2297
2488
|
connection.line.geometry.dispose();
|
|
2298
2489
|
connection.line.material.dispose();
|
|
2299
2490
|
}
|
|
2300
|
-
stateRef.current.connection = {
|
|
2491
|
+
stateRef.current.connection = {
|
|
2492
|
+
isActive: false,
|
|
2493
|
+
sourceNodeData: null,
|
|
2494
|
+
line: null
|
|
2495
|
+
};
|
|
2301
2496
|
if (controls) controls.enabled = true;
|
|
2302
2497
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
2303
2498
|
},
|
|
@@ -2310,10 +2505,21 @@ var userActionHandlers = {
|
|
|
2310
2505
|
userActionHandlers.handleCancelConnection(context);
|
|
2311
2506
|
return;
|
|
2312
2507
|
}
|
|
2313
|
-
const sourceParentInfo = getParentFileInfoForNode(
|
|
2508
|
+
const sourceParentInfo = getParentFileInfoForNode(
|
|
2509
|
+
graphDataRef.current,
|
|
2510
|
+
sceneDataRef.current,
|
|
2511
|
+
sourceNodeData.id,
|
|
2512
|
+
context.sceneConfigId,
|
|
2513
|
+
context.ownerId
|
|
2514
|
+
);
|
|
2314
2515
|
if (!sourceParentInfo || !sourceParentInfo.ownerId) {
|
|
2315
|
-
console.error(
|
|
2316
|
-
|
|
2516
|
+
console.error(
|
|
2517
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
|
|
2518
|
+
sourceNodeData.id
|
|
2519
|
+
);
|
|
2520
|
+
alert(
|
|
2521
|
+
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
|
|
2522
|
+
);
|
|
2317
2523
|
userActionHandlers.handleCancelConnection(context);
|
|
2318
2524
|
return;
|
|
2319
2525
|
}
|
|
@@ -2337,12 +2543,20 @@ var userActionHandlers = {
|
|
|
2337
2543
|
quest_nodes: specificParentData.nodes,
|
|
2338
2544
|
quest_links: specificParentData.links
|
|
2339
2545
|
};
|
|
2340
|
-
await context.actions.save_view_data(
|
|
2546
|
+
await context.actions.save_view_data(
|
|
2547
|
+
context.sceneSaveUrl,
|
|
2548
|
+
viewFilePayload
|
|
2549
|
+
);
|
|
2341
2550
|
} else {
|
|
2342
|
-
const specificParentData = JSON.parse(
|
|
2551
|
+
const specificParentData = JSON.parse(
|
|
2552
|
+
JSON.stringify(graphDataRef.current[parentFileIdToSave])
|
|
2553
|
+
);
|
|
2343
2554
|
specificParentData.links.push(newLink);
|
|
2344
2555
|
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
2345
|
-
await context.actions.save_view_data(
|
|
2556
|
+
await context.actions.save_view_data(
|
|
2557
|
+
filenameForSpecificParent,
|
|
2558
|
+
specificParentData
|
|
2559
|
+
);
|
|
2346
2560
|
graphDataRef.current[parentFileIdToSave] = specificParentData;
|
|
2347
2561
|
}
|
|
2348
2562
|
addNewLinkToScene(stateRef.current, newLink);
|
|
@@ -2395,7 +2609,13 @@ var userActionHandlers = {
|
|
|
2395
2609
|
if (relink.originalLine) {
|
|
2396
2610
|
relink.originalLine.visible = true;
|
|
2397
2611
|
}
|
|
2398
|
-
stateRef.current.relink = {
|
|
2612
|
+
stateRef.current.relink = {
|
|
2613
|
+
isActive: false,
|
|
2614
|
+
end: null,
|
|
2615
|
+
fixedNodeId: null,
|
|
2616
|
+
originalLine: null,
|
|
2617
|
+
line: null
|
|
2618
|
+
};
|
|
2399
2619
|
if (controls) controls.enabled = true;
|
|
2400
2620
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
2401
2621
|
},
|
|
@@ -2413,13 +2633,39 @@ var userActionHandlers = {
|
|
|
2413
2633
|
} else {
|
|
2414
2634
|
newTargetId = newEndNodeData.id;
|
|
2415
2635
|
}
|
|
2416
|
-
const oldSourceInfo = getParentFileInfoForNode(
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2636
|
+
const oldSourceInfo = getParentFileInfoForNode(
|
|
2637
|
+
graphDataRef.current,
|
|
2638
|
+
sceneDataRef.current,
|
|
2639
|
+
oldSourceId,
|
|
2640
|
+
context.sceneConfigId,
|
|
2641
|
+
context.ownerId
|
|
2642
|
+
);
|
|
2643
|
+
const oldTargetInfo = getParentFileInfoForNode(
|
|
2644
|
+
graphDataRef.current,
|
|
2645
|
+
sceneDataRef.current,
|
|
2646
|
+
oldTargetId,
|
|
2647
|
+
context.sceneConfigId,
|
|
2648
|
+
context.ownerId
|
|
2649
|
+
);
|
|
2650
|
+
const newSourceInfo = getParentFileInfoForNode(
|
|
2651
|
+
graphDataRef.current,
|
|
2652
|
+
sceneDataRef.current,
|
|
2653
|
+
newSourceId,
|
|
2654
|
+
context.sceneConfigId,
|
|
2655
|
+
context.ownerId
|
|
2656
|
+
);
|
|
2657
|
+
const newTargetInfo = getParentFileInfoForNode(
|
|
2658
|
+
graphDataRef.current,
|
|
2659
|
+
sceneDataRef.current,
|
|
2660
|
+
newTargetId,
|
|
2661
|
+
context.sceneConfigId,
|
|
2662
|
+
context.ownerId
|
|
2663
|
+
);
|
|
2420
2664
|
if (!oldSourceInfo || !oldTargetInfo || !newSourceInfo || !newTargetInfo) {
|
|
2421
2665
|
console.error("Informa\xE7\xF5es dos arquivos pai incompletas para o relink.");
|
|
2422
|
-
alert(
|
|
2666
|
+
alert(
|
|
2667
|
+
"Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o."
|
|
2668
|
+
);
|
|
2423
2669
|
userActionHandlers.handleCancelRelink(context);
|
|
2424
2670
|
return;
|
|
2425
2671
|
}
|
|
@@ -2453,33 +2699,63 @@ var userActionHandlers = {
|
|
|
2453
2699
|
quest_nodes: data.nodes,
|
|
2454
2700
|
quest_links: data.links
|
|
2455
2701
|
};
|
|
2456
|
-
return context.actions.save_view_data(
|
|
2702
|
+
return context.actions.save_view_data(
|
|
2703
|
+
context.sceneSaveUrl,
|
|
2704
|
+
viewFilePayload
|
|
2705
|
+
);
|
|
2457
2706
|
} else {
|
|
2458
|
-
return context.actions.save_view_data(
|
|
2707
|
+
return context.actions.save_view_data(
|
|
2708
|
+
`x_view_dbs/${fileOwnerId}/${fileId}`,
|
|
2709
|
+
data
|
|
2710
|
+
);
|
|
2459
2711
|
}
|
|
2460
2712
|
};
|
|
2461
2713
|
const savePromises = [];
|
|
2462
2714
|
const filesToUpdate = {};
|
|
2463
2715
|
if (oldGoverningFileId !== newGoverningFileId) {
|
|
2464
|
-
const updatedOriginalParentData = JSON.parse(
|
|
2716
|
+
const updatedOriginalParentData = JSON.parse(
|
|
2717
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
2718
|
+
);
|
|
2465
2719
|
updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
|
|
2466
2720
|
(l) => String(l.id) !== String(linkId)
|
|
2467
2721
|
);
|
|
2468
2722
|
filesToUpdate[oldGoverningFileId] = updatedOriginalParentData;
|
|
2469
|
-
savePromises.push(
|
|
2470
|
-
|
|
2723
|
+
savePromises.push(
|
|
2724
|
+
saveParentData(
|
|
2725
|
+
oldGoverningFileId,
|
|
2726
|
+
oldGoverningOwnerId,
|
|
2727
|
+
updatedOriginalParentData
|
|
2728
|
+
)
|
|
2729
|
+
);
|
|
2730
|
+
const updatedNewParentData = JSON.parse(
|
|
2731
|
+
JSON.stringify(graphDataRef.current[newGoverningFileId])
|
|
2732
|
+
);
|
|
2471
2733
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
2472
2734
|
updatedNewParentData.links.push(newLinkData);
|
|
2473
2735
|
filesToUpdate[newGoverningFileId] = updatedNewParentData;
|
|
2474
|
-
savePromises.push(
|
|
2736
|
+
savePromises.push(
|
|
2737
|
+
saveParentData(
|
|
2738
|
+
newGoverningFileId,
|
|
2739
|
+
newGoverningOwnerId,
|
|
2740
|
+
updatedNewParentData
|
|
2741
|
+
)
|
|
2742
|
+
);
|
|
2475
2743
|
} else {
|
|
2476
|
-
const updatedParentData = JSON.parse(
|
|
2744
|
+
const updatedParentData = JSON.parse(
|
|
2745
|
+
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
2746
|
+
);
|
|
2477
2747
|
updatedParentData.links = updatedParentData.links.filter(
|
|
2478
2748
|
(l) => String(l.id) !== String(linkId)
|
|
2479
2749
|
);
|
|
2480
2750
|
updatedParentData.links.push(newLinkData);
|
|
2481
2751
|
filesToUpdate[oldGoverningFileId] = updatedParentData;
|
|
2482
|
-
savePromises.push(
|
|
2752
|
+
savePromises.push(
|
|
2753
|
+
saveParentData(
|
|
2754
|
+
oldGoverningFileId,
|
|
2755
|
+
oldGoverningOwnerId,
|
|
2756
|
+
updatedParentData
|
|
2757
|
+
)
|
|
2758
|
+
);
|
|
2483
2759
|
}
|
|
2484
2760
|
try {
|
|
2485
2761
|
await Promise.all(savePromises);
|
|
@@ -2500,30 +2776,51 @@ var userActionHandlers = {
|
|
|
2500
2776
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2501
2777
|
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
2502
2778
|
setters.setRelationshipMenu({ visible: false });
|
|
2503
|
-
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current)
|
|
2779
|
+
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current)
|
|
2780
|
+
return;
|
|
2504
2781
|
const linkIdToDelete = linkObject.userData.id;
|
|
2505
2782
|
if (!linkIdToDelete) {
|
|
2506
|
-
console.error(
|
|
2783
|
+
console.error(
|
|
2784
|
+
"Tentativa de deletar um link sem ID.",
|
|
2785
|
+
linkObject.userData
|
|
2786
|
+
);
|
|
2507
2787
|
return;
|
|
2508
2788
|
}
|
|
2509
|
-
const parentInfo = getParentFileInfoForNode(
|
|
2789
|
+
const parentInfo = getParentFileInfoForNode(
|
|
2790
|
+
graphDataRef.current,
|
|
2791
|
+
sceneDataRef.current,
|
|
2792
|
+
linkObject.userData.source,
|
|
2793
|
+
context.sceneConfigId,
|
|
2794
|
+
context.ownerId
|
|
2795
|
+
);
|
|
2510
2796
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2511
|
-
console.error(
|
|
2512
|
-
|
|
2797
|
+
console.error(
|
|
2798
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:",
|
|
2799
|
+
linkIdToDelete
|
|
2800
|
+
);
|
|
2801
|
+
alert(
|
|
2802
|
+
"Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o."
|
|
2803
|
+
);
|
|
2513
2804
|
return;
|
|
2514
2805
|
}
|
|
2515
2806
|
const { parentFileId, ownerId } = parentInfo;
|
|
2516
2807
|
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;
|
|
2517
2808
|
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;
|
|
2518
|
-
const specificParentData = JSON.parse(
|
|
2519
|
-
|
|
2809
|
+
const specificParentData = JSON.parse(
|
|
2810
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
2811
|
+
);
|
|
2812
|
+
const newLinks = (specificParentData.links || []).filter(
|
|
2813
|
+
(l) => String(l.id) !== String(linkIdToDelete)
|
|
2814
|
+
);
|
|
2520
2815
|
specificParentData.links = newLinks;
|
|
2521
2816
|
let filenameToSave;
|
|
2522
2817
|
let payloadToSave;
|
|
2523
2818
|
const isView = ((_g = context.viewType) == null ? void 0 : _g.toLowerCase()) === "view";
|
|
2524
2819
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2525
2820
|
filenameToSave = context.sceneSaveUrl;
|
|
2526
|
-
sceneDataRef.current.links = sceneDataRef.current.links.filter(
|
|
2821
|
+
sceneDataRef.current.links = sceneDataRef.current.links.filter(
|
|
2822
|
+
(l) => String(l.id) !== String(linkIdToDelete)
|
|
2823
|
+
);
|
|
2527
2824
|
payloadToSave = {
|
|
2528
2825
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2529
2826
|
nodes: sceneDataRef.current.nodes,
|
|
@@ -2539,7 +2836,9 @@ var userActionHandlers = {
|
|
|
2539
2836
|
try {
|
|
2540
2837
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2541
2838
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2542
|
-
setters.setDetailsLink(
|
|
2839
|
+
setters.setDetailsLink(
|
|
2840
|
+
(prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
|
|
2841
|
+
);
|
|
2543
2842
|
if (stateRef.current.hoveredLink === linkObject) {
|
|
2544
2843
|
stateRef.current.hoveredLink = null;
|
|
2545
2844
|
}
|
|
@@ -2571,7 +2870,9 @@ var userActionHandlers = {
|
|
|
2571
2870
|
stateRef.current.renderedAncestries = [];
|
|
2572
2871
|
}
|
|
2573
2872
|
removeNodeFromScene(stateRef.current, nodeIdToDismiss);
|
|
2574
|
-
setters.setDetailsNode(
|
|
2873
|
+
setters.setDetailsNode(
|
|
2874
|
+
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDismiss) ? null : prev
|
|
2875
|
+
);
|
|
2575
2876
|
},
|
|
2576
2877
|
handleDismissOtherNodes: (context, nodeData) => {
|
|
2577
2878
|
const { stateRef, sceneDataRef, setters } = context;
|
|
@@ -2580,7 +2881,9 @@ var userActionHandlers = {
|
|
|
2580
2881
|
const nodeIdToKeep = nodeData.id;
|
|
2581
2882
|
const strNodeIdToKeep = String(nodeIdToKeep);
|
|
2582
2883
|
const allVisibleNodeIds = Object.keys(stateRef.current.nodeObjects);
|
|
2583
|
-
const nodeIdsToDismiss = allVisibleNodeIds.filter(
|
|
2884
|
+
const nodeIdsToDismiss = allVisibleNodeIds.filter(
|
|
2885
|
+
(id) => id !== strNodeIdToKeep
|
|
2886
|
+
);
|
|
2584
2887
|
if (nodeIdsToDismiss.length === 0) return;
|
|
2585
2888
|
const { ancestryGroup, ancestryLinks } = stateRef.current;
|
|
2586
2889
|
if (ancestryGroup && ancestryLinks) {
|
|
@@ -2594,7 +2897,9 @@ var userActionHandlers = {
|
|
|
2594
2897
|
}
|
|
2595
2898
|
nodeIdsToDismiss.forEach((nodeId) => {
|
|
2596
2899
|
removeNodeFromScene(stateRef.current, nodeId);
|
|
2597
|
-
setters.setDetailsNode(
|
|
2900
|
+
setters.setDetailsNode(
|
|
2901
|
+
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev
|
|
2902
|
+
);
|
|
2598
2903
|
});
|
|
2599
2904
|
},
|
|
2600
2905
|
handleDismissMultipleNodes: (context, nodeIds) => {
|
|
@@ -2620,7 +2925,9 @@ var userActionHandlers = {
|
|
|
2620
2925
|
stateRef.current.renderedAncestries = [];
|
|
2621
2926
|
}
|
|
2622
2927
|
strNodeIds.forEach((nodeId) => {
|
|
2623
|
-
setters.setDetailsNode(
|
|
2928
|
+
setters.setDetailsNode(
|
|
2929
|
+
(prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev
|
|
2930
|
+
);
|
|
2624
2931
|
removeNodeFromScene(stateRef.current, nodeId);
|
|
2625
2932
|
});
|
|
2626
2933
|
stateRef.current.selectedNodes.clear();
|
|
@@ -2628,10 +2935,13 @@ var userActionHandlers = {
|
|
|
2628
2935
|
handleDismissOtherMultipleNodes: (context, nodeIdsToKeep) => {
|
|
2629
2936
|
const { stateRef, sceneDataRef, setters } = context;
|
|
2630
2937
|
setters.setMultiContextMenu({ visible: false });
|
|
2631
|
-
if (!nodeIdsToKeep || nodeIdsToKeep.size === 0 || !sceneDataRef.current)
|
|
2938
|
+
if (!nodeIdsToKeep || nodeIdsToKeep.size === 0 || !sceneDataRef.current)
|
|
2939
|
+
return;
|
|
2632
2940
|
const strNodeIdsToKeep = Array.from(nodeIdsToKeep).map(String);
|
|
2633
2941
|
const allVisibleNodeIds = Object.keys(stateRef.current.nodeObjects);
|
|
2634
|
-
const nodeIdsToDismiss = allVisibleNodeIds.filter(
|
|
2942
|
+
const nodeIdsToDismiss = allVisibleNodeIds.filter(
|
|
2943
|
+
(id) => !strNodeIdsToKeep.includes(id)
|
|
2944
|
+
);
|
|
2635
2945
|
if (nodeIdsToDismiss.length === 0) {
|
|
2636
2946
|
stateRef.current.selectedNodes.clear();
|
|
2637
2947
|
return;
|
|
@@ -2655,7 +2965,9 @@ var userActionHandlers = {
|
|
|
2655
2965
|
}
|
|
2656
2966
|
nodeIdsToDismiss.forEach((nodeId) => {
|
|
2657
2967
|
removeNodeFromScene(stateRef.current, nodeId);
|
|
2658
|
-
setters.setDetailsNode(
|
|
2968
|
+
setters.setDetailsNode(
|
|
2969
|
+
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev
|
|
2970
|
+
);
|
|
2659
2971
|
});
|
|
2660
2972
|
stateRef.current.selectedNodes.clear();
|
|
2661
2973
|
},
|
|
@@ -2663,7 +2975,8 @@ var userActionHandlers = {
|
|
|
2663
2975
|
var _a;
|
|
2664
2976
|
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2665
2977
|
setters.setMultiContextMenu({ visible: false });
|
|
2666
|
-
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current)
|
|
2978
|
+
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current)
|
|
2979
|
+
return;
|
|
2667
2980
|
const strNodeIdsToDelete = Array.from(nodeIds).map(String);
|
|
2668
2981
|
if (actions.delete_file) {
|
|
2669
2982
|
strNodeIdsToDelete.forEach((id) => {
|
|
@@ -2672,16 +2985,26 @@ var userActionHandlers = {
|
|
|
2672
2985
|
if (nodeData) {
|
|
2673
2986
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2674
2987
|
if (urls.length > 0) {
|
|
2675
|
-
Promise.all(urls.map((url) => actions.delete_file(url))).catch(
|
|
2988
|
+
Promise.all(urls.map((url) => actions.delete_file(url))).catch(
|
|
2989
|
+
(err) => console.error(`Erro ao deletar arquivos do node ${id}:`, err)
|
|
2990
|
+
);
|
|
2676
2991
|
}
|
|
2677
2992
|
}
|
|
2678
2993
|
});
|
|
2679
2994
|
}
|
|
2680
2995
|
const changesByParentFile = {};
|
|
2681
2996
|
for (const nodeId of strNodeIdsToDelete) {
|
|
2682
|
-
const parentInfo = getParentFileInfoForNode(
|
|
2997
|
+
const parentInfo = getParentFileInfoForNode(
|
|
2998
|
+
graphDataRef.current,
|
|
2999
|
+
sceneDataRef.current,
|
|
3000
|
+
nodeId,
|
|
3001
|
+
context.sceneConfigId,
|
|
3002
|
+
context.ownerId
|
|
3003
|
+
);
|
|
2683
3004
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2684
|
-
console.warn(
|
|
3005
|
+
console.warn(
|
|
3006
|
+
`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`
|
|
3007
|
+
);
|
|
2685
3008
|
continue;
|
|
2686
3009
|
}
|
|
2687
3010
|
const { parentFileId, ownerId } = parentInfo;
|
|
@@ -2692,21 +3015,31 @@ var userActionHandlers = {
|
|
|
2692
3015
|
parentFileId,
|
|
2693
3016
|
nodesToDelete: /* @__PURE__ */ new Set(),
|
|
2694
3017
|
linksToDelete: /* @__PURE__ */ new Set(),
|
|
2695
|
-
originalData: JSON.parse(
|
|
3018
|
+
originalData: JSON.parse(
|
|
3019
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
3020
|
+
)
|
|
2696
3021
|
};
|
|
2697
3022
|
}
|
|
2698
3023
|
changesByParentFile[fileKey].nodesToDelete.add(nodeId);
|
|
2699
3024
|
const associatedLinks = (changesByParentFile[fileKey].originalData.links || []).filter(
|
|
2700
3025
|
(l) => String(l.source) === nodeId || String(l.target) === nodeId
|
|
2701
3026
|
);
|
|
2702
|
-
associatedLinks.forEach(
|
|
3027
|
+
associatedLinks.forEach(
|
|
3028
|
+
(link) => changesByParentFile[fileKey].linksToDelete.add(link.id)
|
|
3029
|
+
);
|
|
2703
3030
|
}
|
|
2704
3031
|
const savePromises = [];
|
|
2705
3032
|
const updatedParentDataCache = {};
|
|
2706
3033
|
for (const fileKey in changesByParentFile) {
|
|
2707
3034
|
if (changesByParentFile.hasOwnProperty(fileKey)) {
|
|
2708
3035
|
const change = changesByParentFile[fileKey];
|
|
2709
|
-
const {
|
|
3036
|
+
const {
|
|
3037
|
+
nodesToDelete,
|
|
3038
|
+
linksToDelete,
|
|
3039
|
+
originalData,
|
|
3040
|
+
ownerId,
|
|
3041
|
+
parentFileId
|
|
3042
|
+
} = change;
|
|
2710
3043
|
originalData.nodes = (originalData.nodes || []).filter(
|
|
2711
3044
|
(n) => !nodesToDelete.has(String(n.id))
|
|
2712
3045
|
);
|
|
@@ -2720,8 +3053,12 @@ var userActionHandlers = {
|
|
|
2720
3053
|
filenameToSave = context.sceneSaveUrl;
|
|
2721
3054
|
const strNodesToDelete = Array.from(nodesToDelete).map(String);
|
|
2722
3055
|
const strLinksToDelete = Array.from(linksToDelete).map(String);
|
|
2723
|
-
sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter(
|
|
2724
|
-
|
|
3056
|
+
sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter(
|
|
3057
|
+
(n) => !strNodesToDelete.includes(String(n.id))
|
|
3058
|
+
);
|
|
3059
|
+
sceneDataRef.current.links = sceneDataRef.current.links.filter(
|
|
3060
|
+
(l) => !strLinksToDelete.includes(String(l.id))
|
|
3061
|
+
);
|
|
2725
3062
|
payloadToSave = {
|
|
2726
3063
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2727
3064
|
nodes: sceneDataRef.current.nodes,
|
|
@@ -2734,7 +3071,9 @@ var userActionHandlers = {
|
|
|
2734
3071
|
filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2735
3072
|
payloadToSave = originalData;
|
|
2736
3073
|
}
|
|
2737
|
-
savePromises.push(
|
|
3074
|
+
savePromises.push(
|
|
3075
|
+
context.actions.save_view_data(filenameToSave, payloadToSave)
|
|
3076
|
+
);
|
|
2738
3077
|
updatedParentDataCache[parentFileId] = originalData;
|
|
2739
3078
|
}
|
|
2740
3079
|
}
|
|
@@ -2744,7 +3083,9 @@ var userActionHandlers = {
|
|
|
2744
3083
|
graphDataRef.current[fileId] = updatedParentDataCache[fileId];
|
|
2745
3084
|
}
|
|
2746
3085
|
strNodeIdsToDelete.forEach((nodeId) => {
|
|
2747
|
-
setters.setDetailsNode(
|
|
3086
|
+
setters.setDetailsNode(
|
|
3087
|
+
(prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev
|
|
3088
|
+
);
|
|
2748
3089
|
removeNodeFromScene(stateRef.current, nodeId);
|
|
2749
3090
|
});
|
|
2750
3091
|
stateRef.current.selectedNodes.clear();
|
|
@@ -2760,23 +3101,42 @@ var userActionHandlers = {
|
|
|
2760
3101
|
if (actions.delete_file && nodeData) {
|
|
2761
3102
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
2762
3103
|
if (urls.length > 0) {
|
|
2763
|
-
Promise.all(urls.map((url) => actions.delete_file(url))).then(() => console.log("Arquivos do node deletados.")).catch(
|
|
3104
|
+
Promise.all(urls.map((url) => actions.delete_file(url))).then(() => console.log("Arquivos do node deletados.")).catch(
|
|
3105
|
+
(err) => console.error("Erro ao deletar arquivos do node:", err)
|
|
3106
|
+
);
|
|
2764
3107
|
}
|
|
2765
3108
|
}
|
|
2766
3109
|
setters.setContextMenu({ visible: false });
|
|
2767
3110
|
if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
|
|
2768
3111
|
const nodeIdToDelete = nodeData.id;
|
|
2769
3112
|
const strNodeId = String(nodeIdToDelete);
|
|
2770
|
-
const parentInfo = getParentFileInfoForNode(
|
|
3113
|
+
const parentInfo = getParentFileInfoForNode(
|
|
3114
|
+
graphDataRef.current,
|
|
3115
|
+
sceneDataRef.current,
|
|
3116
|
+
nodeIdToDelete,
|
|
3117
|
+
context.sceneConfigId,
|
|
3118
|
+
context.ownerId
|
|
3119
|
+
);
|
|
2771
3120
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2772
|
-
console.error(
|
|
2773
|
-
|
|
3121
|
+
console.error(
|
|
3122
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:",
|
|
3123
|
+
nodeIdToDelete
|
|
3124
|
+
);
|
|
3125
|
+
alert(
|
|
3126
|
+
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o."
|
|
3127
|
+
);
|
|
2774
3128
|
return;
|
|
2775
3129
|
}
|
|
2776
3130
|
const { parentFileId, ownerId } = parentInfo;
|
|
2777
|
-
const specificParentData = JSON.parse(
|
|
2778
|
-
|
|
2779
|
-
|
|
3131
|
+
const specificParentData = JSON.parse(
|
|
3132
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
3133
|
+
);
|
|
3134
|
+
const newNodes = (specificParentData.nodes || []).filter(
|
|
3135
|
+
(n) => String(n.id) !== strNodeId
|
|
3136
|
+
);
|
|
3137
|
+
const newLinks = (specificParentData.links || []).filter(
|
|
3138
|
+
(l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId
|
|
3139
|
+
);
|
|
2780
3140
|
specificParentData.nodes = newNodes;
|
|
2781
3141
|
specificParentData.links = newLinks;
|
|
2782
3142
|
let filenameToSave;
|
|
@@ -2784,8 +3144,12 @@ var userActionHandlers = {
|
|
|
2784
3144
|
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2785
3145
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2786
3146
|
filenameToSave = context.sceneSaveUrl;
|
|
2787
|
-
const newVisualNodes = sceneDataRef.current.nodes.filter(
|
|
2788
|
-
|
|
3147
|
+
const newVisualNodes = sceneDataRef.current.nodes.filter(
|
|
3148
|
+
(n) => String(n.id) !== strNodeId
|
|
3149
|
+
);
|
|
3150
|
+
const newVisualLinks = sceneDataRef.current.links.filter(
|
|
3151
|
+
(l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId
|
|
3152
|
+
);
|
|
2789
3153
|
sceneDataRef.current.nodes = newVisualNodes;
|
|
2790
3154
|
sceneDataRef.current.links = newVisualLinks;
|
|
2791
3155
|
payloadToSave = {
|
|
@@ -2803,7 +3167,9 @@ var userActionHandlers = {
|
|
|
2803
3167
|
try {
|
|
2804
3168
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2805
3169
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2806
|
-
setters.setDetailsNode(
|
|
3170
|
+
setters.setDetailsNode(
|
|
3171
|
+
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
3172
|
+
);
|
|
2807
3173
|
removeNodeFromScene(stateRef.current, nodeIdToDelete);
|
|
2808
3174
|
setters.setSceneVersion((v) => v + 1);
|
|
2809
3175
|
} catch (e) {
|
|
@@ -2824,17 +3190,35 @@ var userActionHandlers = {
|
|
|
2824
3190
|
timelineEndLabel,
|
|
2825
3191
|
...nodeToSave
|
|
2826
3192
|
} = updatedNode;
|
|
2827
|
-
const parentInfo = getParentFileInfoForNode(
|
|
3193
|
+
const parentInfo = getParentFileInfoForNode(
|
|
3194
|
+
graphDataRef.current,
|
|
3195
|
+
sceneDataRef.current,
|
|
3196
|
+
nodeToSave.id,
|
|
3197
|
+
context.sceneConfigId,
|
|
3198
|
+
context.ownerId
|
|
3199
|
+
);
|
|
2828
3200
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2829
|
-
console.error(
|
|
2830
|
-
|
|
3201
|
+
console.error(
|
|
3202
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:",
|
|
3203
|
+
nodeToSave.id
|
|
3204
|
+
);
|
|
3205
|
+
alert(
|
|
3206
|
+
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o."
|
|
3207
|
+
);
|
|
2831
3208
|
return;
|
|
2832
3209
|
}
|
|
2833
3210
|
const { parentFileId, ownerId } = parentInfo;
|
|
2834
|
-
const specificParentData = JSON.parse(
|
|
2835
|
-
|
|
3211
|
+
const specificParentData = JSON.parse(
|
|
3212
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
3213
|
+
);
|
|
3214
|
+
const nodeIndex = specificParentData.nodes.findIndex(
|
|
3215
|
+
(n) => String(n.id) === String(nodeToSave.id)
|
|
3216
|
+
);
|
|
2836
3217
|
if (nodeIndex === -1) {
|
|
2837
|
-
console.error(
|
|
3218
|
+
console.error(
|
|
3219
|
+
"Node n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:",
|
|
3220
|
+
nodeToSave.id
|
|
3221
|
+
);
|
|
2838
3222
|
alert("Erro interno: Node n\xE3o encontrado para salvar.");
|
|
2839
3223
|
return;
|
|
2840
3224
|
}
|
|
@@ -2842,7 +3226,9 @@ var userActionHandlers = {
|
|
|
2842
3226
|
const isNewDone = oldNode.status !== "Done" && nodeToSave.status === "Done";
|
|
2843
3227
|
specificParentData.nodes[nodeIndex] = { ...nodeToSave };
|
|
2844
3228
|
if (isNewDone && nodeToSave.is_quest && ((_a = nodeToSave.recurrence_config) == null ? void 0 : _a.enabled)) {
|
|
2845
|
-
const nextDateObj = calculateNextRecurrenceDate(
|
|
3229
|
+
const nextDateObj = calculateNextRecurrenceDate(
|
|
3230
|
+
nodeToSave.recurrence_config
|
|
3231
|
+
);
|
|
2846
3232
|
if (nextDateObj) {
|
|
2847
3233
|
const currentCounter = sceneDataRef.current.quest_counter || 1;
|
|
2848
3234
|
const usedCounter = currentCounter;
|
|
@@ -2872,21 +3258,26 @@ var userActionHandlers = {
|
|
|
2872
3258
|
// QUEST_STATUS_COLORS["Backlog"]
|
|
2873
3259
|
assignee_id: nodeToSave.recurrence_config.next_assignee_id || "",
|
|
2874
3260
|
Date: nextDateObj,
|
|
2875
|
-
timeline: [
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
3261
|
+
timeline: [
|
|
3262
|
+
{
|
|
3263
|
+
id: short.generate(),
|
|
3264
|
+
type: "status_changed",
|
|
3265
|
+
timestamp: Date.now(),
|
|
3266
|
+
actorId: "system",
|
|
3267
|
+
description: `Quest criada automaticamente via recorr\xEAncia`,
|
|
3268
|
+
links: [],
|
|
3269
|
+
images: [],
|
|
3270
|
+
metadata: { status: "Backlog" }
|
|
3271
|
+
}
|
|
3272
|
+
],
|
|
2885
3273
|
version_node: {
|
|
2886
3274
|
is_version: true,
|
|
2887
3275
|
parent_node: ((_b = nodeToSave.version_node) == null ? void 0 : _b.parent_node) || nodeToSave.id
|
|
2888
3276
|
},
|
|
2889
|
-
reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
|
|
3277
|
+
reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
|
|
3278
|
+
...r,
|
|
3279
|
+
status: "pending"
|
|
3280
|
+
})),
|
|
2890
3281
|
recurrence_config: nextRecurrenceConfig
|
|
2891
3282
|
};
|
|
2892
3283
|
specificParentData.nodes.push(nextQuestNode);
|
|
@@ -2900,7 +3291,9 @@ var userActionHandlers = {
|
|
|
2900
3291
|
try {
|
|
2901
3292
|
const isView = ((_c = context.viewType) == null ? void 0 : _c.toLowerCase()) === "view";
|
|
2902
3293
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2903
|
-
const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
|
|
3294
|
+
const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
|
|
3295
|
+
(n) => String(n.id) === String(nodeToSave.id)
|
|
3296
|
+
);
|
|
2904
3297
|
if (visualNodeIndex > -1) {
|
|
2905
3298
|
sceneDataRef.current.nodes[visualNodeIndex] = {
|
|
2906
3299
|
...sceneDataRef.current.nodes[visualNodeIndex],
|
|
@@ -2915,10 +3308,16 @@ var userActionHandlers = {
|
|
|
2915
3308
|
quest_links: specificParentData.links,
|
|
2916
3309
|
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
2917
3310
|
};
|
|
2918
|
-
await context.actions.save_view_data(
|
|
3311
|
+
await context.actions.save_view_data(
|
|
3312
|
+
context.sceneSaveUrl,
|
|
3313
|
+
viewFilePayload
|
|
3314
|
+
);
|
|
2919
3315
|
} else {
|
|
2920
3316
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2921
|
-
await context.actions.save_view_data(
|
|
3317
|
+
await context.actions.save_view_data(
|
|
3318
|
+
filenameForSpecificParent,
|
|
3319
|
+
specificParentData
|
|
3320
|
+
);
|
|
2922
3321
|
}
|
|
2923
3322
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2924
3323
|
updateExistingNodeVisuals(stateRef.current, nodeToSave);
|
|
@@ -2936,19 +3335,37 @@ var userActionHandlers = {
|
|
|
2936
3335
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2937
3336
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2938
3337
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
2939
|
-
const parentInfo = getParentFileInfoForNode(
|
|
3338
|
+
const parentInfo = getParentFileInfoForNode(
|
|
3339
|
+
graphDataRef.current,
|
|
3340
|
+
sceneDataRef.current,
|
|
3341
|
+
linkToSave.source,
|
|
3342
|
+
context.sceneConfigId,
|
|
3343
|
+
context.ownerId
|
|
3344
|
+
);
|
|
2940
3345
|
if (!parentInfo || !parentInfo.ownerId) {
|
|
2941
|
-
console.error(
|
|
2942
|
-
|
|
3346
|
+
console.error(
|
|
3347
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:",
|
|
3348
|
+
linkToSave.id
|
|
3349
|
+
);
|
|
3350
|
+
alert(
|
|
3351
|
+
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o."
|
|
3352
|
+
);
|
|
2943
3353
|
return;
|
|
2944
3354
|
}
|
|
2945
3355
|
const { parentFileId, ownerId } = parentInfo;
|
|
2946
|
-
const specificParentData = JSON.parse(
|
|
2947
|
-
|
|
3356
|
+
const specificParentData = JSON.parse(
|
|
3357
|
+
JSON.stringify(graphDataRef.current[parentFileId])
|
|
3358
|
+
);
|
|
3359
|
+
const linkIndex = specificParentData.links.findIndex(
|
|
3360
|
+
(l) => String(l.id) === String(linkToSave.id)
|
|
3361
|
+
);
|
|
2948
3362
|
if (linkIndex > -1) {
|
|
2949
3363
|
specificParentData.links[linkIndex] = linkToSave;
|
|
2950
3364
|
} else {
|
|
2951
|
-
console.error(
|
|
3365
|
+
console.error(
|
|
3366
|
+
"Link n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:",
|
|
3367
|
+
linkToSave.id
|
|
3368
|
+
);
|
|
2952
3369
|
alert("Erro interno: link n\xE3o encontrado para salvar.");
|
|
2953
3370
|
return;
|
|
2954
3371
|
}
|
|
@@ -2963,10 +3380,16 @@ var userActionHandlers = {
|
|
|
2963
3380
|
quest_links: specificParentData.links,
|
|
2964
3381
|
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
2965
3382
|
};
|
|
2966
|
-
await context.actions.save_view_data(
|
|
3383
|
+
await context.actions.save_view_data(
|
|
3384
|
+
context.sceneSaveUrl,
|
|
3385
|
+
viewFilePayload
|
|
3386
|
+
);
|
|
2967
3387
|
} else {
|
|
2968
3388
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2969
|
-
await context.actions.save_view_data(
|
|
3389
|
+
await context.actions.save_view_data(
|
|
3390
|
+
filenameForSpecificParent,
|
|
3391
|
+
specificParentData
|
|
3392
|
+
);
|
|
2970
3393
|
}
|
|
2971
3394
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2972
3395
|
const lineObject = stateRef.current.allLinks.find(
|
|
@@ -2996,7 +3419,9 @@ var userActionHandlers = {
|
|
|
2996
3419
|
const graphFull = graphDataRef.current;
|
|
2997
3420
|
if (!graphFull) return;
|
|
2998
3421
|
const strNodeId = String(nodeId);
|
|
2999
|
-
const allParentNodes = Object.values(graphFull).flatMap(
|
|
3422
|
+
const allParentNodes = Object.values(graphFull).flatMap(
|
|
3423
|
+
(fileData) => fileData.nodes
|
|
3424
|
+
);
|
|
3000
3425
|
const nodeData = allParentNodes.find((n) => String(n.id) === strNodeId);
|
|
3001
3426
|
if (!nodeData) {
|
|
3002
3427
|
alert("Node n\xE3o encontrado no banco de dados completo.");
|
|
@@ -3007,7 +3432,11 @@ var userActionHandlers = {
|
|
|
3007
3432
|
return;
|
|
3008
3433
|
}
|
|
3009
3434
|
const base = state.controls ? state.controls.target.clone() : new THREE.Vector3(0, 0, 0);
|
|
3010
|
-
const offset = new THREE.Vector3(
|
|
3435
|
+
const offset = new THREE.Vector3(
|
|
3436
|
+
(Math.random() - 0.5) * 20,
|
|
3437
|
+
(Math.random() - 0.5) * 6,
|
|
3438
|
+
(Math.random() - 0.5) * 20
|
|
3439
|
+
);
|
|
3011
3440
|
const position = base.add(offset);
|
|
3012
3441
|
addStandaloneNodeToScene(state, nodeData, position);
|
|
3013
3442
|
tweenToTarget(position, 1.3);
|
|
@@ -3792,7 +4221,11 @@ function calculateNextRecurrenceDate(config) {
|
|
|
3792
4221
|
const d = String(nextDate.getDate()).padStart(2, "0");
|
|
3793
4222
|
const m = String(nextDate.getMonth() + 1).padStart(2, "0");
|
|
3794
4223
|
const y = nextDate.getFullYear();
|
|
3795
|
-
return {
|
|
4224
|
+
return {
|
|
4225
|
+
type: "Data",
|
|
4226
|
+
value: `${d}/${m}/${y}`,
|
|
4227
|
+
confirmed: true
|
|
4228
|
+
};
|
|
3796
4229
|
}
|
|
3797
4230
|
|
|
3798
4231
|
// src/components/CustomPropertyDisplay.jsx
|
|
@@ -9230,26 +9663,17 @@ function InSceneQuestForm({
|
|
|
9230
9663
|
"button",
|
|
9231
9664
|
{
|
|
9232
9665
|
type: "button",
|
|
9233
|
-
onClick: () => setQuestDate({ type: "Data", value: "" }),
|
|
9666
|
+
onClick: () => setQuestDate({ type: "Data", value: "", confirmed: false }),
|
|
9234
9667
|
className: "text-[10px] text-indigo-400 hover:text-indigo-300 font-bold uppercase transition-colors"
|
|
9235
9668
|
},
|
|
9236
9669
|
"+ Adicionar"
|
|
9237
|
-
)), questDate && /* @__PURE__ */ React16.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ React16.createElement(
|
|
9238
|
-
"button",
|
|
9239
|
-
{
|
|
9240
|
-
type: "button",
|
|
9241
|
-
onClick: () => setQuestDate(null),
|
|
9242
|
-
className: "absolute top-2 right-2 w-6 h-6 grid place-items-center rounded-full bg-red-500/10 text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
9243
|
-
title: "Remover data"
|
|
9244
|
-
},
|
|
9245
|
-
/* @__PURE__ */ React16.createElement(FiX5, { size: 12 })
|
|
9246
|
-
), /* @__PURE__ */ React16.createElement("div", { className: "flex items-center gap-1 rounded-lg bg-slate-800/50 p-1" }, ["Data", "Ano", "Date Interval"].map((t) => /* @__PURE__ */ React16.createElement(
|
|
9670
|
+
)), questDate && /* @__PURE__ */ React16.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ React16.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ React16.createElement("div", { className: "flex-1 flex items-center gap-1 rounded-lg bg-slate-800/50 p-1" }, !questDate.confirmed ? ["Data", "Date Interval"].map((t) => /* @__PURE__ */ React16.createElement(
|
|
9247
9671
|
"button",
|
|
9248
9672
|
{
|
|
9249
9673
|
key: t,
|
|
9250
9674
|
type: "button",
|
|
9251
9675
|
onClick: () => {
|
|
9252
|
-
const newDate = { type: t };
|
|
9676
|
+
const newDate = { type: t, confirmed: false };
|
|
9253
9677
|
if (t === "Date Interval") {
|
|
9254
9678
|
newDate.start = "";
|
|
9255
9679
|
newDate.end = "";
|
|
@@ -9261,7 +9685,34 @@ function InSceneQuestForm({
|
|
|
9261
9685
|
className: `flex-1 text-[10px] px-2 py-1.5 rounded-md transition-colors ${questDate.type === t ? "bg-indigo-600 text-white font-semibold shadow" : "text-slate-400 hover:bg-slate-700/50"}`
|
|
9262
9686
|
},
|
|
9263
9687
|
t === "Date Interval" ? "Intervalo" : t
|
|
9264
|
-
))), questDate.type === "Data"
|
|
9688
|
+
)) : /* @__PURE__ */ React16.createElement("div", { className: "flex-1 flex items-center gap-2 px-2 py-1.5" }, /* @__PURE__ */ React16.createElement(FiCalendar, { className: "text-indigo-400", size: 12 }), /* @__PURE__ */ React16.createElement("span", { className: "text-xs font-medium text-slate-200" }, questDate.type === "Data" ? questDate.value || "Sem data" : `${questDate.start || "In\xEDcio"} - ${questDate.end || "Fim"}`))), /* @__PURE__ */ React16.createElement("div", { className: "flex items-center gap-1" }, !questDate.confirmed ? /* @__PURE__ */ React16.createElement(
|
|
9689
|
+
"button",
|
|
9690
|
+
{
|
|
9691
|
+
type: "button",
|
|
9692
|
+
onClick: () => setQuestDate({ ...questDate, confirmed: true }),
|
|
9693
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-green-500/10 text-green-400 hover:bg-green-500/20 transition-colors",
|
|
9694
|
+
title: "Confirmar data"
|
|
9695
|
+
},
|
|
9696
|
+
/* @__PURE__ */ React16.createElement(FiCheck9, { size: 14 })
|
|
9697
|
+
) : /* @__PURE__ */ React16.createElement(
|
|
9698
|
+
"button",
|
|
9699
|
+
{
|
|
9700
|
+
type: "button",
|
|
9701
|
+
onClick: () => setQuestDate({ ...questDate, confirmed: false }),
|
|
9702
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-indigo-500/10 text-indigo-400 hover:bg-indigo-500/20 transition-colors",
|
|
9703
|
+
title: "Editar data"
|
|
9704
|
+
},
|
|
9705
|
+
/* @__PURE__ */ React16.createElement(FiEdit26, { size: 14 })
|
|
9706
|
+
), /* @__PURE__ */ React16.createElement(
|
|
9707
|
+
"button",
|
|
9708
|
+
{
|
|
9709
|
+
type: "button",
|
|
9710
|
+
onClick: () => setQuestDate(null),
|
|
9711
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",
|
|
9712
|
+
title: "Remover data"
|
|
9713
|
+
},
|
|
9714
|
+
/* @__PURE__ */ React16.createElement(FiX5, { size: 14 })
|
|
9715
|
+
))), !questDate.confirmed && /* @__PURE__ */ React16.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200" }, questDate.type === "Data" && /* @__PURE__ */ React16.createElement(
|
|
9265
9716
|
"input",
|
|
9266
9717
|
{
|
|
9267
9718
|
type: "text",
|
|
@@ -9281,34 +9732,47 @@ function InSceneQuestForm({
|
|
|
9281
9732
|
maxLength: "10",
|
|
9282
9733
|
className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
9283
9734
|
}
|
|
9284
|
-
), questDate.type === "Ano" && /* @__PURE__ */ React16.createElement(
|
|
9285
|
-
"input",
|
|
9286
|
-
{
|
|
9287
|
-
type: "number",
|
|
9288
|
-
placeholder: "AAAA",
|
|
9289
|
-
value: questDate.value || "",
|
|
9290
|
-
onChange: (e) => setQuestDate({ ...questDate, value: e.target.value }),
|
|
9291
|
-
className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
|
|
9292
|
-
}
|
|
9293
9735
|
), questDate.type === "Date Interval" && /* @__PURE__ */ React16.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React16.createElement(
|
|
9294
9736
|
"input",
|
|
9295
9737
|
{
|
|
9296
|
-
type: "
|
|
9297
|
-
placeholder: "In\xEDcio (
|
|
9738
|
+
type: "text",
|
|
9739
|
+
placeholder: "In\xEDcio (DD/MM/AAAA)",
|
|
9298
9740
|
value: questDate.start || "",
|
|
9299
|
-
onChange: (e) =>
|
|
9300
|
-
|
|
9741
|
+
onChange: (e) => {
|
|
9742
|
+
const rawValue = e.target.value;
|
|
9743
|
+
const digits = rawValue.replace(/\D/g, "");
|
|
9744
|
+
const len = digits.length;
|
|
9745
|
+
let formattedValue = digits;
|
|
9746
|
+
if (len > 2 && len <= 4)
|
|
9747
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
9748
|
+
else if (len > 4)
|
|
9749
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
9750
|
+
setQuestDate({ ...questDate, start: formattedValue });
|
|
9751
|
+
},
|
|
9752
|
+
maxLength: "10",
|
|
9753
|
+
className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
9301
9754
|
}
|
|
9302
9755
|
), /* @__PURE__ */ React16.createElement("span", { className: "text-slate-500" }, "-"), /* @__PURE__ */ React16.createElement(
|
|
9303
9756
|
"input",
|
|
9304
9757
|
{
|
|
9305
|
-
type: "
|
|
9306
|
-
placeholder: "Fim (
|
|
9758
|
+
type: "text",
|
|
9759
|
+
placeholder: "Fim (DD/MM/AAAA)",
|
|
9307
9760
|
value: questDate.end || "",
|
|
9308
|
-
onChange: (e) =>
|
|
9309
|
-
|
|
9761
|
+
onChange: (e) => {
|
|
9762
|
+
const rawValue = e.target.value;
|
|
9763
|
+
const digits = rawValue.replace(/\D/g, "");
|
|
9764
|
+
const len = digits.length;
|
|
9765
|
+
let formattedValue = digits;
|
|
9766
|
+
if (len > 2 && len <= 4)
|
|
9767
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
9768
|
+
else if (len > 4)
|
|
9769
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
9770
|
+
setQuestDate({ ...questDate, end: formattedValue });
|
|
9771
|
+
},
|
|
9772
|
+
maxLength: "10",
|
|
9773
|
+
className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
9310
9774
|
}
|
|
9311
|
-
)))), /* @__PURE__ */ React16.createElement("div", { className: "pt-4 border-t border-white/5 mt-2" }, /* @__PURE__ */ React16.createElement("div", { className: "flex items-center justify-between mb-3" }, /* @__PURE__ */ React16.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React16.createElement(FiRepeat, { className: `w-3.5 h-3.5 ${recurrenceConfig.enabled ? "text-indigo-400" : "text-slate-500"}` }), /* @__PURE__ */ React16.createElement("span", { className: "text-xs text-slate-300 font-medium uppercase tracking-wider" }, "Recorr\xEAncia")), /* @__PURE__ */ React16.createElement(
|
|
9775
|
+
))))), /* @__PURE__ */ React16.createElement("div", { className: "pt-4 border-t border-white/5 mt-2" }, /* @__PURE__ */ React16.createElement("div", { className: "flex items-center justify-between mb-3" }, /* @__PURE__ */ React16.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React16.createElement(FiRepeat, { className: `w-3.5 h-3.5 ${recurrenceConfig.enabled ? "text-indigo-400" : "text-slate-500"}` }), /* @__PURE__ */ React16.createElement("span", { className: "text-xs text-slate-300 font-medium uppercase tracking-wider" }, "Recorr\xEAncia")), /* @__PURE__ */ React16.createElement(
|
|
9312
9776
|
"button",
|
|
9313
9777
|
{
|
|
9314
9778
|
type: "button",
|
|
@@ -10588,31 +11052,19 @@ ${noteText}` : noteText : entry.notes,
|
|
|
10588
11052
|
{
|
|
10589
11053
|
type: "button",
|
|
10590
11054
|
onClick: () => {
|
|
10591
|
-
setQuestDate({ type: "Data", value: "" });
|
|
11055
|
+
setQuestDate({ type: "Data", value: "", confirmed: false });
|
|
10592
11056
|
setHasUnsavedChanges(true);
|
|
10593
11057
|
},
|
|
10594
11058
|
className: "text-[10px] text-indigo-400 hover:text-indigo-300 font-bold uppercase transition-colors"
|
|
10595
11059
|
},
|
|
10596
11060
|
"+ Adicionar"
|
|
10597
|
-
)), questDate && /* @__PURE__ */ React19.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, canEdit
|
|
10598
|
-
"button",
|
|
10599
|
-
{
|
|
10600
|
-
type: "button",
|
|
10601
|
-
onClick: () => {
|
|
10602
|
-
setQuestDate(null);
|
|
10603
|
-
setHasUnsavedChanges(true);
|
|
10604
|
-
},
|
|
10605
|
-
className: "absolute top-2 right-2 w-6 h-6 grid place-items-center rounded-full bg-red-500/10 text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
10606
|
-
title: "Remover data"
|
|
10607
|
-
},
|
|
10608
|
-
/* @__PURE__ */ React19.createElement(FiX7, { size: 12 })
|
|
10609
|
-
), /* @__PURE__ */ React19.createElement("div", { className: `flex items-center gap-1 rounded-lg bg-slate-800/50 p-1 ${!canEdit ? "opacity-70 pointer-events-none" : ""}` }, ["Data", "Ano", "Date Interval"].map((t) => /* @__PURE__ */ React19.createElement(
|
|
11061
|
+
)), questDate && /* @__PURE__ */ React19.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ React19.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ React19.createElement("div", { className: `flex-1 flex items-center gap-1 rounded-lg bg-slate-800/50 p-1 ${!canEdit ? "opacity-70 pointer-events-none" : ""}` }, !questDate.confirmed ? ["Data", "Date Interval"].map((t) => /* @__PURE__ */ React19.createElement(
|
|
10610
11062
|
"button",
|
|
10611
11063
|
{
|
|
10612
11064
|
key: t,
|
|
10613
11065
|
type: "button",
|
|
10614
11066
|
onClick: () => {
|
|
10615
|
-
const newDate = { type: t };
|
|
11067
|
+
const newDate = { type: t, confirmed: false };
|
|
10616
11068
|
if (t === "Date Interval") {
|
|
10617
11069
|
newDate.start = "";
|
|
10618
11070
|
newDate.end = "";
|
|
@@ -10625,11 +11077,46 @@ ${noteText}` : noteText : entry.notes,
|
|
|
10625
11077
|
className: `flex-1 text-[10px] px-2 py-1.5 rounded-md transition-colors ${questDate.type === t ? "bg-indigo-600 text-white font-semibold shadow" : "text-slate-400 hover:bg-slate-700/50"}`
|
|
10626
11078
|
},
|
|
10627
11079
|
t === "Date Interval" ? "Intervalo" : t
|
|
10628
|
-
))), questDate.type === "Data" && /* @__PURE__ */ React19.createElement(
|
|
11080
|
+
)) : /* @__PURE__ */ React19.createElement("div", { className: "flex-1 flex items-center gap-2 px-2 py-1.5" }, /* @__PURE__ */ React19.createElement(FiCalendar2, { className: "text-indigo-400", size: 12 }), /* @__PURE__ */ React19.createElement("span", { className: "text-xs font-medium text-slate-200" }, questDate.type === "Data" ? questDate.value || "Sem data" : `${questDate.start || "In\xEDcio"} - ${questDate.end || "Fim"}`))), canEdit && /* @__PURE__ */ React19.createElement("div", { className: "flex items-center gap-1" }, !questDate.confirmed ? /* @__PURE__ */ React19.createElement(
|
|
11081
|
+
"button",
|
|
11082
|
+
{
|
|
11083
|
+
type: "button",
|
|
11084
|
+
onClick: () => {
|
|
11085
|
+
setQuestDate({ ...questDate, confirmed: true });
|
|
11086
|
+
setHasUnsavedChanges(true);
|
|
11087
|
+
},
|
|
11088
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-green-500/10 text-green-400 hover:bg-green-500/20 transition-colors",
|
|
11089
|
+
title: "Confirmar data"
|
|
11090
|
+
},
|
|
11091
|
+
/* @__PURE__ */ React19.createElement(FiCheck11, { size: 14 })
|
|
11092
|
+
) : /* @__PURE__ */ React19.createElement(
|
|
11093
|
+
"button",
|
|
11094
|
+
{
|
|
11095
|
+
type: "button",
|
|
11096
|
+
onClick: () => {
|
|
11097
|
+
setQuestDate({ ...questDate, confirmed: false });
|
|
11098
|
+
setHasUnsavedChanges(true);
|
|
11099
|
+
},
|
|
11100
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-indigo-500/10 text-indigo-400 hover:bg-indigo-500/20 transition-colors",
|
|
11101
|
+
title: "Editar data"
|
|
11102
|
+
},
|
|
11103
|
+
/* @__PURE__ */ React19.createElement(FiEdit28, { size: 14 })
|
|
11104
|
+
), /* @__PURE__ */ React19.createElement(
|
|
11105
|
+
"button",
|
|
11106
|
+
{
|
|
11107
|
+
type: "button",
|
|
11108
|
+
onClick: () => {
|
|
11109
|
+
setQuestDate(null);
|
|
11110
|
+
setHasUnsavedChanges(true);
|
|
11111
|
+
},
|
|
11112
|
+
className: "w-8 h-8 grid place-items-center rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",
|
|
11113
|
+
title: "Remover data"
|
|
11114
|
+
},
|
|
11115
|
+
/* @__PURE__ */ React19.createElement(FiX7, { size: 14 })
|
|
11116
|
+
))), !questDate.confirmed && canEdit && /* @__PURE__ */ React19.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200" }, questDate.type === "Data" && /* @__PURE__ */ React19.createElement(
|
|
10629
11117
|
"input",
|
|
10630
11118
|
{
|
|
10631
11119
|
type: "text",
|
|
10632
|
-
readOnly: !canEdit,
|
|
10633
11120
|
placeholder: "DD/MM/AAAA",
|
|
10634
11121
|
value: questDate.value || "",
|
|
10635
11122
|
onChange: (e) => {
|
|
@@ -10645,48 +11132,51 @@ ${noteText}` : noteText : entry.notes,
|
|
|
10645
11132
|
setHasUnsavedChanges(true);
|
|
10646
11133
|
},
|
|
10647
11134
|
maxLength: "10",
|
|
10648
|
-
className:
|
|
10649
|
-
}
|
|
10650
|
-
), questDate.type === "Ano" && /* @__PURE__ */ React19.createElement(
|
|
10651
|
-
"input",
|
|
10652
|
-
{
|
|
10653
|
-
type: "number",
|
|
10654
|
-
readOnly: !canEdit,
|
|
10655
|
-
placeholder: "AAAA",
|
|
10656
|
-
value: questDate.value || "",
|
|
10657
|
-
onChange: (e) => {
|
|
10658
|
-
setQuestDate({ ...questDate, value: e.target.value });
|
|
10659
|
-
setHasUnsavedChanges(true);
|
|
10660
|
-
},
|
|
10661
|
-
className: `w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none ${canEdit ? "focus:ring-1 focus:ring-indigo-400/60" : "text-slate-400 cursor-default"}`
|
|
11135
|
+
className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
10662
11136
|
}
|
|
10663
11137
|
), questDate.type === "Date Interval" && /* @__PURE__ */ React19.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React19.createElement(
|
|
10664
11138
|
"input",
|
|
10665
11139
|
{
|
|
10666
|
-
type: "
|
|
10667
|
-
|
|
10668
|
-
placeholder: "In\xEDcio (Ano)",
|
|
11140
|
+
type: "text",
|
|
11141
|
+
placeholder: "In\xEDcio (DD/MM/AAAA)",
|
|
10669
11142
|
value: questDate.start || "",
|
|
10670
11143
|
onChange: (e) => {
|
|
10671
|
-
|
|
11144
|
+
const rawValue = e.target.value;
|
|
11145
|
+
const digits = rawValue.replace(/\D/g, "");
|
|
11146
|
+
const len = digits.length;
|
|
11147
|
+
let formattedValue = digits;
|
|
11148
|
+
if (len > 2 && len <= 4)
|
|
11149
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
11150
|
+
else if (len > 4)
|
|
11151
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
11152
|
+
setQuestDate({ ...questDate, start: formattedValue });
|
|
10672
11153
|
setHasUnsavedChanges(true);
|
|
10673
11154
|
},
|
|
10674
|
-
|
|
11155
|
+
maxLength: "10",
|
|
11156
|
+
className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
10675
11157
|
}
|
|
10676
11158
|
), /* @__PURE__ */ React19.createElement("span", { className: "text-slate-500" }, "-"), /* @__PURE__ */ React19.createElement(
|
|
10677
11159
|
"input",
|
|
10678
11160
|
{
|
|
10679
|
-
type: "
|
|
10680
|
-
|
|
10681
|
-
placeholder: "Fim (Ano)",
|
|
11161
|
+
type: "text",
|
|
11162
|
+
placeholder: "Fim (DD/MM/AAAA)",
|
|
10682
11163
|
value: questDate.end || "",
|
|
10683
11164
|
onChange: (e) => {
|
|
10684
|
-
|
|
11165
|
+
const rawValue = e.target.value;
|
|
11166
|
+
const digits = rawValue.replace(/\D/g, "");
|
|
11167
|
+
const len = digits.length;
|
|
11168
|
+
let formattedValue = digits;
|
|
11169
|
+
if (len > 2 && len <= 4)
|
|
11170
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
11171
|
+
else if (len > 4)
|
|
11172
|
+
formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
11173
|
+
setQuestDate({ ...questDate, end: formattedValue });
|
|
10685
11174
|
setHasUnsavedChanges(true);
|
|
10686
11175
|
},
|
|
10687
|
-
|
|
11176
|
+
maxLength: "10",
|
|
11177
|
+
className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
|
|
10688
11178
|
}
|
|
10689
|
-
)))), /* @__PURE__ */ React19.createElement("div", { className: "space-y-1.5 relative mt-2" }, /* @__PURE__ */ React19.createElement("label", { className: "text-xs text-slate-300" }, "Status da Quest"), /* @__PURE__ */ React19.createElement("div", { className: "relative" }, /* @__PURE__ */ React19.createElement(
|
|
11179
|
+
))))), /* @__PURE__ */ React19.createElement("div", { className: "space-y-1.5 relative mt-2" }, /* @__PURE__ */ React19.createElement("label", { className: "text-xs text-slate-300" }, "Status da Quest"), /* @__PURE__ */ React19.createElement("div", { className: "relative" }, /* @__PURE__ */ React19.createElement(
|
|
10690
11180
|
"button",
|
|
10691
11181
|
{
|
|
10692
11182
|
type: "button",
|