@lv-x-software-house/x_view 1.2.4-dev.10 → 1.2.4-dev.11
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 +105 -26
- package/dist/index.mjs +105 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -948,7 +948,7 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
|
|
|
948
948
|
if (useImage && nodeData.textureImageUrl) {
|
|
949
949
|
geometry = new THREE.CircleGeometry(1.5, 48);
|
|
950
950
|
const texture = getTexture(nodeData.textureImageUrl);
|
|
951
|
-
material = new
|
|
951
|
+
material = new MeshBasicMaterial({
|
|
952
952
|
map: texture,
|
|
953
953
|
color: 16777215,
|
|
954
954
|
side: THREE.DoubleSide,
|
|
@@ -1839,6 +1839,7 @@ var userActionHandlers = {
|
|
|
1839
1839
|
setters.setFormPosition((p) => ({ ...p, opacity: 0 }));
|
|
1840
1840
|
},
|
|
1841
1841
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1842
|
+
var _a;
|
|
1842
1843
|
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1843
1844
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1844
1845
|
const { sourceNodeData } = versionMode;
|
|
@@ -1858,9 +1859,21 @@ var userActionHandlers = {
|
|
|
1858
1859
|
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
|
|
1859
1860
|
specificParentData.nodes.push(newNode);
|
|
1860
1861
|
specificParentData.links.push(newLink);
|
|
1861
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
1862
1862
|
try {
|
|
1863
|
-
|
|
1863
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1864
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
1865
|
+
const viewFilePayload = {
|
|
1866
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
1867
|
+
nodes: sceneDataRef.current.nodes,
|
|
1868
|
+
links: sceneDataRef.current.links,
|
|
1869
|
+
quest_nodes: specificParentData.nodes,
|
|
1870
|
+
quest_links: specificParentData.links
|
|
1871
|
+
};
|
|
1872
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
1873
|
+
} else {
|
|
1874
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
1875
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
1876
|
+
}
|
|
1864
1877
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
1865
1878
|
const finalPosition = stateRef.current.ghostElements.node.position.clone();
|
|
1866
1879
|
addNewNodeToScene(stateRef.current, newNode, newLink, finalPosition);
|
|
@@ -2017,6 +2030,7 @@ var userActionHandlers = {
|
|
|
2017
2030
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
2018
2031
|
},
|
|
2019
2032
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
2033
|
+
var _a;
|
|
2020
2034
|
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
2021
2035
|
const { sourceNodeData } = stateRef.current.connection;
|
|
2022
2036
|
if (!graphDataRef.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
@@ -2039,12 +2053,26 @@ var userActionHandlers = {
|
|
|
2039
2053
|
source: sourceNodeData.id,
|
|
2040
2054
|
target: targetNodeData.id
|
|
2041
2055
|
};
|
|
2042
|
-
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileIdToSave]));
|
|
2043
|
-
specificParentData.links.push(newLink);
|
|
2044
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
2045
2056
|
try {
|
|
2046
|
-
|
|
2047
|
-
|
|
2057
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2058
|
+
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
2059
|
+
const specificParentData = graphDataRef.current[context.sceneConfigId];
|
|
2060
|
+
specificParentData.links.push(newLink);
|
|
2061
|
+
const viewFilePayload = {
|
|
2062
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2063
|
+
nodes: sceneDataRef.current.nodes,
|
|
2064
|
+
links: sceneDataRef.current.links,
|
|
2065
|
+
quest_nodes: specificParentData.nodes,
|
|
2066
|
+
quest_links: specificParentData.links
|
|
2067
|
+
};
|
|
2068
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2069
|
+
} else {
|
|
2070
|
+
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileIdToSave]));
|
|
2071
|
+
specificParentData.links.push(newLink);
|
|
2072
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
2073
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2074
|
+
graphDataRef.current[parentFileIdToSave] = specificParentData;
|
|
2075
|
+
}
|
|
2048
2076
|
addNewLinkToScene(stateRef.current, newLink);
|
|
2049
2077
|
} catch (error) {
|
|
2050
2078
|
console.error("Falha ao salvar a nova conex\xE3o:", error);
|
|
@@ -2128,6 +2156,22 @@ var userActionHandlers = {
|
|
|
2128
2156
|
target: newTargetId,
|
|
2129
2157
|
id: linkId
|
|
2130
2158
|
};
|
|
2159
|
+
const saveParentData = async (fileId, fileOwnerId, data) => {
|
|
2160
|
+
var _a;
|
|
2161
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2162
|
+
if (isView && fileId === context.sceneConfigId) {
|
|
2163
|
+
const viewFilePayload = {
|
|
2164
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2165
|
+
nodes: sceneDataRef.current.nodes,
|
|
2166
|
+
links: sceneDataRef.current.links,
|
|
2167
|
+
quest_nodes: data.nodes,
|
|
2168
|
+
quest_links: data.links
|
|
2169
|
+
};
|
|
2170
|
+
return context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2171
|
+
} else {
|
|
2172
|
+
return context.actions.save_view_data(`x_view_dbs/${fileOwnerId}/${fileId}`, data);
|
|
2173
|
+
}
|
|
2174
|
+
};
|
|
2131
2175
|
const savePromises = [];
|
|
2132
2176
|
const filesToUpdate = {};
|
|
2133
2177
|
if (originalParentInfo.parentFileId !== newParentInfo.parentFileId) {
|
|
@@ -2136,16 +2180,12 @@ var userActionHandlers = {
|
|
|
2136
2180
|
(l) => String(l.id) !== String(linkId)
|
|
2137
2181
|
);
|
|
2138
2182
|
filesToUpdate[originalParentInfo.parentFileId] = updatedOriginalParentData;
|
|
2139
|
-
savePromises.push(
|
|
2140
|
-
context.actions.save_view_data(`x_view_dbs/${originalParentInfo.ownerId}/${originalParentInfo.parentFileId}`, updatedOriginalParentData)
|
|
2141
|
-
);
|
|
2183
|
+
savePromises.push(saveParentData(originalParentInfo.parentFileId, originalParentInfo.ownerId, updatedOriginalParentData));
|
|
2142
2184
|
const updatedNewParentData = JSON.parse(JSON.stringify(graphDataRef.current[newParentInfo.parentFileId]));
|
|
2143
2185
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
2144
2186
|
updatedNewParentData.links.push(newLinkData);
|
|
2145
2187
|
filesToUpdate[newParentInfo.parentFileId] = updatedNewParentData;
|
|
2146
|
-
savePromises.push(
|
|
2147
|
-
context.actions.save_view_data(`x_view_dbs/${newParentInfo.ownerId}/${newParentInfo.parentFileId}`, updatedNewParentData)
|
|
2148
|
-
);
|
|
2188
|
+
savePromises.push(saveParentData(newParentInfo.parentFileId, newParentInfo.ownerId, updatedNewParentData));
|
|
2149
2189
|
} else {
|
|
2150
2190
|
const updatedParentData = JSON.parse(JSON.stringify(graphDataRef.current[originalParentInfo.parentFileId]));
|
|
2151
2191
|
updatedParentData.links = updatedParentData.links.filter(
|
|
@@ -2153,9 +2193,7 @@ var userActionHandlers = {
|
|
|
2153
2193
|
);
|
|
2154
2194
|
updatedParentData.links.push(newLinkData);
|
|
2155
2195
|
filesToUpdate[originalParentInfo.parentFileId] = updatedParentData;
|
|
2156
|
-
savePromises.push(
|
|
2157
|
-
context.actions.save_view_data(`x_view_dbs/${originalParentInfo.ownerId}/${originalParentInfo.parentFileId}`, updatedParentData)
|
|
2158
|
-
);
|
|
2196
|
+
savePromises.push(saveParentData(originalParentInfo.parentFileId, originalParentInfo.ownerId, updatedParentData));
|
|
2159
2197
|
}
|
|
2160
2198
|
try {
|
|
2161
2199
|
await Promise.all(savePromises);
|
|
@@ -2173,7 +2211,7 @@ var userActionHandlers = {
|
|
|
2173
2211
|
}
|
|
2174
2212
|
},
|
|
2175
2213
|
handleDeleteLink: async (context, linkObject) => {
|
|
2176
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2214
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2177
2215
|
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
2178
2216
|
setters.setRelationshipMenu({ visible: false });
|
|
2179
2217
|
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current) return;
|
|
@@ -2196,7 +2234,8 @@ var userActionHandlers = {
|
|
|
2196
2234
|
specificParentData.links = newLinks;
|
|
2197
2235
|
let filenameToSave;
|
|
2198
2236
|
let payloadToSave;
|
|
2199
|
-
|
|
2237
|
+
const isView = ((_g = context.viewType) == null ? void 0 : _g.toLowerCase()) === "view";
|
|
2238
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2200
2239
|
filenameToSave = context.sceneSaveUrl;
|
|
2201
2240
|
sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => String(l.id) !== String(linkIdToDelete));
|
|
2202
2241
|
payloadToSave = {
|
|
@@ -2356,6 +2395,7 @@ var userActionHandlers = {
|
|
|
2356
2395
|
stateRef.current.selectedNodes.clear();
|
|
2357
2396
|
},
|
|
2358
2397
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
2398
|
+
var _a;
|
|
2359
2399
|
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2360
2400
|
setters.setMultiContextMenu({ visible: false });
|
|
2361
2401
|
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current) return;
|
|
@@ -2410,7 +2450,8 @@ var userActionHandlers = {
|
|
|
2410
2450
|
);
|
|
2411
2451
|
let filenameToSave;
|
|
2412
2452
|
let payloadToSave;
|
|
2413
|
-
|
|
2453
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2454
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2414
2455
|
filenameToSave = context.sceneSaveUrl;
|
|
2415
2456
|
const strNodesToDelete = Array.from(nodesToDelete).map(String);
|
|
2416
2457
|
const strLinksToDelete = Array.from(linksToDelete).map(String);
|
|
@@ -2448,6 +2489,7 @@ var userActionHandlers = {
|
|
|
2448
2489
|
}
|
|
2449
2490
|
},
|
|
2450
2491
|
handleDeleteNode: async (context, nodeData) => {
|
|
2492
|
+
var _a;
|
|
2451
2493
|
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2452
2494
|
if (actions.delete_file && nodeData) {
|
|
2453
2495
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
@@ -2473,7 +2515,8 @@ var userActionHandlers = {
|
|
|
2473
2515
|
specificParentData.links = newLinks;
|
|
2474
2516
|
let filenameToSave;
|
|
2475
2517
|
let payloadToSave;
|
|
2476
|
-
|
|
2518
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2519
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2477
2520
|
filenameToSave = context.sceneSaveUrl;
|
|
2478
2521
|
const newVisualNodes = sceneDataRef.current.nodes.filter((n) => String(n.id) !== strNodeId);
|
|
2479
2522
|
const newVisualLinks = sceneDataRef.current.links.filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
|
|
@@ -2502,6 +2545,7 @@ var userActionHandlers = {
|
|
|
2502
2545
|
}
|
|
2503
2546
|
},
|
|
2504
2547
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2548
|
+
var _a;
|
|
2505
2549
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2506
2550
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2507
2551
|
const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
|
|
@@ -2521,9 +2565,21 @@ var userActionHandlers = {
|
|
|
2521
2565
|
alert("Erro interno: Node n\xE3o encontrado para salvar.");
|
|
2522
2566
|
return;
|
|
2523
2567
|
}
|
|
2524
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2525
2568
|
try {
|
|
2526
|
-
|
|
2569
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2570
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2571
|
+
const viewFilePayload = {
|
|
2572
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2573
|
+
nodes: sceneDataRef.current.nodes,
|
|
2574
|
+
links: sceneDataRef.current.links,
|
|
2575
|
+
quest_nodes: specificParentData.nodes,
|
|
2576
|
+
quest_links: specificParentData.links
|
|
2577
|
+
};
|
|
2578
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2579
|
+
} else {
|
|
2580
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2581
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2582
|
+
}
|
|
2527
2583
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2528
2584
|
updateExistingNodeVisuals(stateRef.current, nodeToSave);
|
|
2529
2585
|
setters.setSceneVersion((v) => v + 1);
|
|
@@ -2536,6 +2592,7 @@ var userActionHandlers = {
|
|
|
2536
2592
|
}
|
|
2537
2593
|
},
|
|
2538
2594
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2595
|
+
var _a;
|
|
2539
2596
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2540
2597
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2541
2598
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
@@ -2555,9 +2612,21 @@ var userActionHandlers = {
|
|
|
2555
2612
|
alert("Erro interno: link n\xE3o encontrado para salvar.");
|
|
2556
2613
|
return;
|
|
2557
2614
|
}
|
|
2558
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2559
2615
|
try {
|
|
2560
|
-
|
|
2616
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2617
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2618
|
+
const viewFilePayload = {
|
|
2619
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2620
|
+
nodes: sceneDataRef.current.nodes,
|
|
2621
|
+
links: sceneDataRef.current.links,
|
|
2622
|
+
quest_nodes: specificParentData.nodes,
|
|
2623
|
+
quest_links: specificParentData.links
|
|
2624
|
+
};
|
|
2625
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2626
|
+
} else {
|
|
2627
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2628
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2629
|
+
}
|
|
2561
2630
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2562
2631
|
const lineObject = stateRef.current.allLinks.find(
|
|
2563
2632
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
@@ -13442,6 +13511,12 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13442
13511
|
}
|
|
13443
13512
|
const sceneData = sceneResponse.data;
|
|
13444
13513
|
const parentDbObjects = sceneData.parent_dbs || [];
|
|
13514
|
+
if (type && type.toLowerCase().includes("database")) {
|
|
13515
|
+
const selfExists = parentDbObjects.some((db) => String(db.db_id) === String(scene_config));
|
|
13516
|
+
if (!selfExists) {
|
|
13517
|
+
parentDbObjects.push({ db_id: scene_config, owner_id });
|
|
13518
|
+
}
|
|
13519
|
+
}
|
|
13445
13520
|
const parentResponsesPromises = parentDbObjects.map(
|
|
13446
13521
|
(db_info) => db_services.get_file(`x_view_dbs/${db_info.owner_id}/${db_info.db_id}`)
|
|
13447
13522
|
);
|
|
@@ -13475,7 +13550,11 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13475
13550
|
if (nodeTypes.includes("quest")) {
|
|
13476
13551
|
return sceneNode;
|
|
13477
13552
|
}
|
|
13478
|
-
|
|
13553
|
+
const dbNode = parentNodeMap.get(String(sceneNode.id));
|
|
13554
|
+
if (dbNode) {
|
|
13555
|
+
return { ...dbNode, ...sceneNode };
|
|
13556
|
+
}
|
|
13557
|
+
return null;
|
|
13479
13558
|
}).filter(Boolean);
|
|
13480
13559
|
const validNodeIdsInScene = new Set(validatedNodes.map((node) => String(node.id)));
|
|
13481
13560
|
const validatedLinks = (sceneData.links || []).filter((sceneLink) => {
|
package/dist/index.mjs
CHANGED
|
@@ -904,7 +904,7 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
|
|
|
904
904
|
if (useImage && nodeData.textureImageUrl) {
|
|
905
905
|
geometry = new THREE.CircleGeometry(1.5, 48);
|
|
906
906
|
const texture = getTexture(nodeData.textureImageUrl);
|
|
907
|
-
material = new
|
|
907
|
+
material = new MeshBasicMaterial({
|
|
908
908
|
map: texture,
|
|
909
909
|
color: 16777215,
|
|
910
910
|
side: THREE.DoubleSide,
|
|
@@ -1795,6 +1795,7 @@ var userActionHandlers = {
|
|
|
1795
1795
|
setters.setFormPosition((p) => ({ ...p, opacity: 0 }));
|
|
1796
1796
|
},
|
|
1797
1797
|
handleSaveVersionNode: async (context, newNodeData) => {
|
|
1798
|
+
var _a;
|
|
1798
1799
|
const { graphDataRef, sceneDataRef, stateRef, versionMode, setters } = context;
|
|
1799
1800
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
1800
1801
|
const { sourceNodeData } = versionMode;
|
|
@@ -1814,9 +1815,21 @@ var userActionHandlers = {
|
|
|
1814
1815
|
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
|
|
1815
1816
|
specificParentData.nodes.push(newNode);
|
|
1816
1817
|
specificParentData.links.push(newLink);
|
|
1817
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
1818
1818
|
try {
|
|
1819
|
-
|
|
1819
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
1820
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
1821
|
+
const viewFilePayload = {
|
|
1822
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
1823
|
+
nodes: sceneDataRef.current.nodes,
|
|
1824
|
+
links: sceneDataRef.current.links,
|
|
1825
|
+
quest_nodes: specificParentData.nodes,
|
|
1826
|
+
quest_links: specificParentData.links
|
|
1827
|
+
};
|
|
1828
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
1829
|
+
} else {
|
|
1830
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
1831
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
1832
|
+
}
|
|
1820
1833
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
1821
1834
|
const finalPosition = stateRef.current.ghostElements.node.position.clone();
|
|
1822
1835
|
addNewNodeToScene(stateRef.current, newNode, newLink, finalPosition);
|
|
@@ -1973,6 +1986,7 @@ var userActionHandlers = {
|
|
|
1973
1986
|
if (mountRef.current) mountRef.current.style.cursor = "grab";
|
|
1974
1987
|
},
|
|
1975
1988
|
handleCompleteConnection: async (context, targetNodeData) => {
|
|
1989
|
+
var _a;
|
|
1976
1990
|
const { stateRef, graphDataRef, sceneDataRef } = context;
|
|
1977
1991
|
const { sourceNodeData } = stateRef.current.connection;
|
|
1978
1992
|
if (!graphDataRef.current || !sceneDataRef.current || !sourceNodeData || !targetNodeData) {
|
|
@@ -1995,12 +2009,26 @@ var userActionHandlers = {
|
|
|
1995
2009
|
source: sourceNodeData.id,
|
|
1996
2010
|
target: targetNodeData.id
|
|
1997
2011
|
};
|
|
1998
|
-
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileIdToSave]));
|
|
1999
|
-
specificParentData.links.push(newLink);
|
|
2000
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
2001
2012
|
try {
|
|
2002
|
-
|
|
2003
|
-
|
|
2013
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2014
|
+
if (isView && parentFileIdToSave === context.sceneConfigId) {
|
|
2015
|
+
const specificParentData = graphDataRef.current[context.sceneConfigId];
|
|
2016
|
+
specificParentData.links.push(newLink);
|
|
2017
|
+
const viewFilePayload = {
|
|
2018
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2019
|
+
nodes: sceneDataRef.current.nodes,
|
|
2020
|
+
links: sceneDataRef.current.links,
|
|
2021
|
+
quest_nodes: specificParentData.nodes,
|
|
2022
|
+
quest_links: specificParentData.links
|
|
2023
|
+
};
|
|
2024
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2025
|
+
} else {
|
|
2026
|
+
const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileIdToSave]));
|
|
2027
|
+
specificParentData.links.push(newLink);
|
|
2028
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
2029
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2030
|
+
graphDataRef.current[parentFileIdToSave] = specificParentData;
|
|
2031
|
+
}
|
|
2004
2032
|
addNewLinkToScene(stateRef.current, newLink);
|
|
2005
2033
|
} catch (error) {
|
|
2006
2034
|
console.error("Falha ao salvar a nova conex\xE3o:", error);
|
|
@@ -2084,6 +2112,22 @@ var userActionHandlers = {
|
|
|
2084
2112
|
target: newTargetId,
|
|
2085
2113
|
id: linkId
|
|
2086
2114
|
};
|
|
2115
|
+
const saveParentData = async (fileId, fileOwnerId, data) => {
|
|
2116
|
+
var _a;
|
|
2117
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2118
|
+
if (isView && fileId === context.sceneConfigId) {
|
|
2119
|
+
const viewFilePayload = {
|
|
2120
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2121
|
+
nodes: sceneDataRef.current.nodes,
|
|
2122
|
+
links: sceneDataRef.current.links,
|
|
2123
|
+
quest_nodes: data.nodes,
|
|
2124
|
+
quest_links: data.links
|
|
2125
|
+
};
|
|
2126
|
+
return context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2127
|
+
} else {
|
|
2128
|
+
return context.actions.save_view_data(`x_view_dbs/${fileOwnerId}/${fileId}`, data);
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2087
2131
|
const savePromises = [];
|
|
2088
2132
|
const filesToUpdate = {};
|
|
2089
2133
|
if (originalParentInfo.parentFileId !== newParentInfo.parentFileId) {
|
|
@@ -2092,16 +2136,12 @@ var userActionHandlers = {
|
|
|
2092
2136
|
(l) => String(l.id) !== String(linkId)
|
|
2093
2137
|
);
|
|
2094
2138
|
filesToUpdate[originalParentInfo.parentFileId] = updatedOriginalParentData;
|
|
2095
|
-
savePromises.push(
|
|
2096
|
-
context.actions.save_view_data(`x_view_dbs/${originalParentInfo.ownerId}/${originalParentInfo.parentFileId}`, updatedOriginalParentData)
|
|
2097
|
-
);
|
|
2139
|
+
savePromises.push(saveParentData(originalParentInfo.parentFileId, originalParentInfo.ownerId, updatedOriginalParentData));
|
|
2098
2140
|
const updatedNewParentData = JSON.parse(JSON.stringify(graphDataRef.current[newParentInfo.parentFileId]));
|
|
2099
2141
|
if (!updatedNewParentData.links) updatedNewParentData.links = [];
|
|
2100
2142
|
updatedNewParentData.links.push(newLinkData);
|
|
2101
2143
|
filesToUpdate[newParentInfo.parentFileId] = updatedNewParentData;
|
|
2102
|
-
savePromises.push(
|
|
2103
|
-
context.actions.save_view_data(`x_view_dbs/${newParentInfo.ownerId}/${newParentInfo.parentFileId}`, updatedNewParentData)
|
|
2104
|
-
);
|
|
2144
|
+
savePromises.push(saveParentData(newParentInfo.parentFileId, newParentInfo.ownerId, updatedNewParentData));
|
|
2105
2145
|
} else {
|
|
2106
2146
|
const updatedParentData = JSON.parse(JSON.stringify(graphDataRef.current[originalParentInfo.parentFileId]));
|
|
2107
2147
|
updatedParentData.links = updatedParentData.links.filter(
|
|
@@ -2109,9 +2149,7 @@ var userActionHandlers = {
|
|
|
2109
2149
|
);
|
|
2110
2150
|
updatedParentData.links.push(newLinkData);
|
|
2111
2151
|
filesToUpdate[originalParentInfo.parentFileId] = updatedParentData;
|
|
2112
|
-
savePromises.push(
|
|
2113
|
-
context.actions.save_view_data(`x_view_dbs/${originalParentInfo.ownerId}/${originalParentInfo.parentFileId}`, updatedParentData)
|
|
2114
|
-
);
|
|
2152
|
+
savePromises.push(saveParentData(originalParentInfo.parentFileId, originalParentInfo.ownerId, updatedParentData));
|
|
2115
2153
|
}
|
|
2116
2154
|
try {
|
|
2117
2155
|
await Promise.all(savePromises);
|
|
@@ -2129,7 +2167,7 @@ var userActionHandlers = {
|
|
|
2129
2167
|
}
|
|
2130
2168
|
},
|
|
2131
2169
|
handleDeleteLink: async (context, linkObject) => {
|
|
2132
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2170
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2133
2171
|
const { stateRef, graphDataRef, sceneDataRef, setters } = context;
|
|
2134
2172
|
setters.setRelationshipMenu({ visible: false });
|
|
2135
2173
|
if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current) return;
|
|
@@ -2152,7 +2190,8 @@ var userActionHandlers = {
|
|
|
2152
2190
|
specificParentData.links = newLinks;
|
|
2153
2191
|
let filenameToSave;
|
|
2154
2192
|
let payloadToSave;
|
|
2155
|
-
|
|
2193
|
+
const isView = ((_g = context.viewType) == null ? void 0 : _g.toLowerCase()) === "view";
|
|
2194
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2156
2195
|
filenameToSave = context.sceneSaveUrl;
|
|
2157
2196
|
sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => String(l.id) !== String(linkIdToDelete));
|
|
2158
2197
|
payloadToSave = {
|
|
@@ -2312,6 +2351,7 @@ var userActionHandlers = {
|
|
|
2312
2351
|
stateRef.current.selectedNodes.clear();
|
|
2313
2352
|
},
|
|
2314
2353
|
handleDeleteMultipleNodes: async (context, nodeIds) => {
|
|
2354
|
+
var _a;
|
|
2315
2355
|
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2316
2356
|
setters.setMultiContextMenu({ visible: false });
|
|
2317
2357
|
if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current) return;
|
|
@@ -2366,7 +2406,8 @@ var userActionHandlers = {
|
|
|
2366
2406
|
);
|
|
2367
2407
|
let filenameToSave;
|
|
2368
2408
|
let payloadToSave;
|
|
2369
|
-
|
|
2409
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2410
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2370
2411
|
filenameToSave = context.sceneSaveUrl;
|
|
2371
2412
|
const strNodesToDelete = Array.from(nodesToDelete).map(String);
|
|
2372
2413
|
const strLinksToDelete = Array.from(linksToDelete).map(String);
|
|
@@ -2404,6 +2445,7 @@ var userActionHandlers = {
|
|
|
2404
2445
|
}
|
|
2405
2446
|
},
|
|
2406
2447
|
handleDeleteNode: async (context, nodeData) => {
|
|
2448
|
+
var _a;
|
|
2407
2449
|
const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
|
|
2408
2450
|
if (actions.delete_file && nodeData) {
|
|
2409
2451
|
const urls = extractFileUrlsFromProperties(nodeData);
|
|
@@ -2429,7 +2471,8 @@ var userActionHandlers = {
|
|
|
2429
2471
|
specificParentData.links = newLinks;
|
|
2430
2472
|
let filenameToSave;
|
|
2431
2473
|
let payloadToSave;
|
|
2432
|
-
|
|
2474
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2475
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2433
2476
|
filenameToSave = context.sceneSaveUrl;
|
|
2434
2477
|
const newVisualNodes = sceneDataRef.current.nodes.filter((n) => String(n.id) !== strNodeId);
|
|
2435
2478
|
const newVisualLinks = sceneDataRef.current.links.filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
|
|
@@ -2458,6 +2501,7 @@ var userActionHandlers = {
|
|
|
2458
2501
|
}
|
|
2459
2502
|
},
|
|
2460
2503
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2504
|
+
var _a;
|
|
2461
2505
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2462
2506
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2463
2507
|
const { _baseEmissiveIntensity: ignored, ...nodeToSave } = updatedNode;
|
|
@@ -2477,9 +2521,21 @@ var userActionHandlers = {
|
|
|
2477
2521
|
alert("Erro interno: Node n\xE3o encontrado para salvar.");
|
|
2478
2522
|
return;
|
|
2479
2523
|
}
|
|
2480
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2481
2524
|
try {
|
|
2482
|
-
|
|
2525
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2526
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2527
|
+
const viewFilePayload = {
|
|
2528
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2529
|
+
nodes: sceneDataRef.current.nodes,
|
|
2530
|
+
links: sceneDataRef.current.links,
|
|
2531
|
+
quest_nodes: specificParentData.nodes,
|
|
2532
|
+
quest_links: specificParentData.links
|
|
2533
|
+
};
|
|
2534
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2535
|
+
} else {
|
|
2536
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2537
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2538
|
+
}
|
|
2483
2539
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2484
2540
|
updateExistingNodeVisuals(stateRef.current, nodeToSave);
|
|
2485
2541
|
setters.setSceneVersion((v) => v + 1);
|
|
@@ -2492,6 +2548,7 @@ var userActionHandlers = {
|
|
|
2492
2548
|
}
|
|
2493
2549
|
},
|
|
2494
2550
|
handleSaveLinkDetails: async (context, updatedLink, keepOpen = false) => {
|
|
2551
|
+
var _a;
|
|
2495
2552
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2496
2553
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2497
2554
|
const { sourceNode, targetNode, ...linkToSave } = updatedLink;
|
|
@@ -2511,9 +2568,21 @@ var userActionHandlers = {
|
|
|
2511
2568
|
alert("Erro interno: link n\xE3o encontrado para salvar.");
|
|
2512
2569
|
return;
|
|
2513
2570
|
}
|
|
2514
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2515
2571
|
try {
|
|
2516
|
-
|
|
2572
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2573
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2574
|
+
const viewFilePayload = {
|
|
2575
|
+
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2576
|
+
nodes: sceneDataRef.current.nodes,
|
|
2577
|
+
links: sceneDataRef.current.links,
|
|
2578
|
+
quest_nodes: specificParentData.nodes,
|
|
2579
|
+
quest_links: specificParentData.links
|
|
2580
|
+
};
|
|
2581
|
+
await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
|
|
2582
|
+
} else {
|
|
2583
|
+
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2584
|
+
await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
|
|
2585
|
+
}
|
|
2517
2586
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2518
2587
|
const lineObject = stateRef.current.allLinks.find(
|
|
2519
2588
|
(l) => String(l.userData.id) === String(linkToSave.id)
|
|
@@ -13442,6 +13511,12 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13442
13511
|
}
|
|
13443
13512
|
const sceneData = sceneResponse.data;
|
|
13444
13513
|
const parentDbObjects = sceneData.parent_dbs || [];
|
|
13514
|
+
if (type && type.toLowerCase().includes("database")) {
|
|
13515
|
+
const selfExists = parentDbObjects.some((db) => String(db.db_id) === String(scene_config));
|
|
13516
|
+
if (!selfExists) {
|
|
13517
|
+
parentDbObjects.push({ db_id: scene_config, owner_id });
|
|
13518
|
+
}
|
|
13519
|
+
}
|
|
13445
13520
|
const parentResponsesPromises = parentDbObjects.map(
|
|
13446
13521
|
(db_info) => db_services.get_file(`x_view_dbs/${db_info.owner_id}/${db_info.db_id}`)
|
|
13447
13522
|
);
|
|
@@ -13475,7 +13550,11 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13475
13550
|
if (nodeTypes.includes("quest")) {
|
|
13476
13551
|
return sceneNode;
|
|
13477
13552
|
}
|
|
13478
|
-
|
|
13553
|
+
const dbNode = parentNodeMap.get(String(sceneNode.id));
|
|
13554
|
+
if (dbNode) {
|
|
13555
|
+
return { ...dbNode, ...sceneNode };
|
|
13556
|
+
}
|
|
13557
|
+
return null;
|
|
13479
13558
|
}).filter(Boolean);
|
|
13480
13559
|
const validNodeIdsInScene = new Set(validatedNodes.map((node) => String(node.id)));
|
|
13481
13560
|
const validatedLinks = (sceneData.links || []).filter((sceneLink) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.4-dev.
|
|
3
|
+
"version": "1.2.4-dev.11",
|
|
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",
|