@lv-x-software-house/x_view 1.2.5-dev.6 → 1.2.5-dev.9
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 +74 -75
- package/dist/index.mjs +74 -75
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5488,7 +5488,7 @@ function AncestryRelationshipPanel({
|
|
|
5488
5488
|
}, 100);
|
|
5489
5489
|
};
|
|
5490
5490
|
const handleRemoveProp = (i) => setCustomProps((p) => p.filter((_, idx) => idx !== i));
|
|
5491
|
-
const
|
|
5491
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
5492
5492
|
setCustomProps((props) => {
|
|
5493
5493
|
const newProps = [...props];
|
|
5494
5494
|
newProps[index] = updatedProp;
|
|
@@ -5600,7 +5600,7 @@ function AncestryRelationshipPanel({
|
|
|
5600
5600
|
{
|
|
5601
5601
|
key: prop.id,
|
|
5602
5602
|
prop,
|
|
5603
|
-
onUpdate: (updatedProp) =>
|
|
5603
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
5604
5604
|
onRemove: () => handleRemoveProp(idx),
|
|
5605
5605
|
onOpenImageViewer,
|
|
5606
5606
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -5793,7 +5793,6 @@ var NodeItem = ({ nodeData, onSelectParent, onViewSelect, highlightedPathIds = [
|
|
|
5793
5793
|
e.stopPropagation();
|
|
5794
5794
|
if (isEditable) {
|
|
5795
5795
|
onSelectParent(itemId);
|
|
5796
|
-
setHasUnsavedChanges(true);
|
|
5797
5796
|
} else if (onViewSelect) {
|
|
5798
5797
|
onViewSelect(itemId);
|
|
5799
5798
|
}
|
|
@@ -5806,11 +5805,9 @@ var NodeItem = ({ nodeData, onSelectParent, onViewSelect, highlightedPathIds = [
|
|
|
5806
5805
|
level > 0 && isEditable && /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-1 animate-in fade-in duration-200" }, !nodeData.is_section && /* @__PURE__ */ import_react11.default.createElement("button", { onClick: (e) => {
|
|
5807
5806
|
e.stopPropagation();
|
|
5808
5807
|
onEditRelationship(path, nodeData.relationship || {});
|
|
5809
|
-
setHasUnsavedChanges(true);
|
|
5810
5808
|
}, className: "w-6 h-6 grid place-content-center rounded-full hover:bg-cyan-500/20 text-cyan-400 transition-colors flex-shrink-0", title: "Editar detalhes da rela\xE7\xE3o" }, /* @__PURE__ */ import_react11.default.createElement(import_fi9.FiEdit2, { size: 12 })), /* @__PURE__ */ import_react11.default.createElement("button", { onClick: (e) => {
|
|
5811
5809
|
e.stopPropagation();
|
|
5812
5810
|
onRemoveNode(path);
|
|
5813
|
-
setHasUnsavedChanges(true);
|
|
5814
5811
|
}, className: "w-6 h-6 grid place-content-center rounded-full hover:bg-red-500/20 text-red-400 text-lg transition-colors flex-shrink-0", title: "Remover Node" }, "\xD7"))
|
|
5815
5812
|
), hasChildren && /* @__PURE__ */ import_react11.default.createElement("div", { className: "mt-2 space-y-2 pl-8" }, nodeData.children.map((child, index) => /* @__PURE__ */ import_react11.default.createElement(
|
|
5816
5813
|
NodeItem,
|
|
@@ -5866,7 +5863,7 @@ function CreateAncestryPanel({
|
|
|
5866
5863
|
} = ancestryMode;
|
|
5867
5864
|
const [isSaving, setIsSaving] = (0, import_react11.useState)(false);
|
|
5868
5865
|
const [isLinkCopied, setIsLinkCopied] = (0, import_react11.useState)(false);
|
|
5869
|
-
const [hasUnsavedChanges,
|
|
5866
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react11.useState)(false);
|
|
5870
5867
|
const [showDeleteBranchConfirm, setShowDeleteBranchConfirm] = (0, import_react11.useState)(false);
|
|
5871
5868
|
const handleCopyLink = (e) => {
|
|
5872
5869
|
e.stopPropagation();
|
|
@@ -5934,14 +5931,14 @@ function CreateAncestryPanel({
|
|
|
5934
5931
|
};
|
|
5935
5932
|
const handleSelectAncestryParent = (nodeId, isAbstraction = false) => {
|
|
5936
5933
|
setAncestryMode((prev) => isAbstraction ? { ...prev, selectedAbstractionParentId: nodeId } : { ...prev, selectedParentId: nodeId });
|
|
5937
|
-
|
|
5934
|
+
setHasUnsavedChanges(true);
|
|
5938
5935
|
};
|
|
5939
5936
|
const handleToggleAddMode = (isAbstraction = false) => {
|
|
5940
5937
|
if (isAbstraction && !ancestryMode.isAddingAbstractionNodes) {
|
|
5941
5938
|
setTargetRenderNodeId(null);
|
|
5942
5939
|
}
|
|
5943
5940
|
setAncestryMode((prev) => isAbstraction ? { ...prev, isAddingAbstractionNodes: !prev.isAddingAbstractionNodes } : { ...prev, isAddingNodes: !prev.isAddingNodes });
|
|
5944
|
-
|
|
5941
|
+
setHasUnsavedChanges(true);
|
|
5945
5942
|
};
|
|
5946
5943
|
const handleRemoveNode = (0, import_react11.useCallback)((pathToRemove, isAbstraction = false) => {
|
|
5947
5944
|
if (!Array.isArray(pathToRemove) || pathToRemove.length === 0) return;
|
|
@@ -5959,7 +5956,7 @@ function CreateAncestryPanel({
|
|
|
5959
5956
|
const indexToRemove = pathToRemove[pathToRemove.length - 1];
|
|
5960
5957
|
if (currentParent.children && currentParent.children.length > indexToRemove) {
|
|
5961
5958
|
currentParent.children.splice(indexToRemove, 1);
|
|
5962
|
-
|
|
5959
|
+
setHasUnsavedChanges(true);
|
|
5963
5960
|
}
|
|
5964
5961
|
return { ...prev, [treeKey]: newTree };
|
|
5965
5962
|
});
|
|
@@ -6018,7 +6015,7 @@ function CreateAncestryPanel({
|
|
|
6018
6015
|
updateGlobalTree(rootTreeClone);
|
|
6019
6016
|
}
|
|
6020
6017
|
setAncestryMode((prev) => ({ ...prev, [treeKey]: rootTreeClone }));
|
|
6021
|
-
|
|
6018
|
+
setHasUnsavedChanges(true);
|
|
6022
6019
|
} else {
|
|
6023
6020
|
alert("N\xE3o \xE9 poss\xEDvel mover um node para dentro de seus pr\xF3prios descendentes.");
|
|
6024
6021
|
}
|
|
@@ -6091,7 +6088,7 @@ function CreateAncestryPanel({
|
|
|
6091
6088
|
const handleAddProp = () => {
|
|
6092
6089
|
const newProp = createNewCustomProperty(customProps);
|
|
6093
6090
|
setCustomProps((p) => [...p, newProp]);
|
|
6094
|
-
|
|
6091
|
+
setHasUnsavedChanges(true);
|
|
6095
6092
|
setTimeout(() => {
|
|
6096
6093
|
var _a;
|
|
6097
6094
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -6100,13 +6097,13 @@ function CreateAncestryPanel({
|
|
|
6100
6097
|
const handleRemoveProp = (i) => {
|
|
6101
6098
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
6102
6099
|
setCustomProps(newProps);
|
|
6103
|
-
|
|
6100
|
+
setHasUnsavedChanges(true);
|
|
6104
6101
|
};
|
|
6105
|
-
const
|
|
6102
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
6106
6103
|
const newProps = [...customProps];
|
|
6107
6104
|
newProps[index] = updatedProp;
|
|
6108
6105
|
setCustomProps(newProps);
|
|
6109
|
-
|
|
6106
|
+
setHasUnsavedChanges(true);
|
|
6110
6107
|
};
|
|
6111
6108
|
const currentUsedTypes = customProps.map((p) => p.type).filter((t) => UNIQUE_PROP_TYPES.includes(t));
|
|
6112
6109
|
(0, import_react11.useEffect)(() => {
|
|
@@ -6216,7 +6213,7 @@ function CreateAncestryPanel({
|
|
|
6216
6213
|
updateGlobalTree(rootTreeClone);
|
|
6217
6214
|
setBranchStack([...branchStack]);
|
|
6218
6215
|
setIsPickerOpen(false);
|
|
6219
|
-
|
|
6216
|
+
setHasUnsavedChanges(true);
|
|
6220
6217
|
try {
|
|
6221
6218
|
setIsSaving(true);
|
|
6222
6219
|
const rootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6230,7 +6227,7 @@ function CreateAncestryPanel({
|
|
|
6230
6227
|
rootExtras
|
|
6231
6228
|
);
|
|
6232
6229
|
setLastSavedSnapshot(takeSnapshot(rootTreeClone, ancestryName, description, processedSections, [], isPrivate, ancestryMode.abstraction_tree));
|
|
6233
|
-
|
|
6230
|
+
setHasUnsavedChanges(false);
|
|
6234
6231
|
if (onRenderFullAncestry) {
|
|
6235
6232
|
const fullTreePayload = {
|
|
6236
6233
|
ancestry_id: ancestryMode.currentAncestryId || "temp_root",
|
|
@@ -6273,7 +6270,7 @@ function CreateAncestryPanel({
|
|
|
6273
6270
|
if (branchIndex !== -1) {
|
|
6274
6271
|
foundParentPath.node.parallel_branches.splice(branchIndex, 1);
|
|
6275
6272
|
updateGlobalTree(rootTreeClone);
|
|
6276
|
-
|
|
6273
|
+
setHasUnsavedChanges(true);
|
|
6277
6274
|
try {
|
|
6278
6275
|
setIsSaving(true);
|
|
6279
6276
|
const currentRootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6295,7 +6292,7 @@ function CreateAncestryPanel({
|
|
|
6295
6292
|
isPrivate,
|
|
6296
6293
|
ancestryMode.abstraction_tree
|
|
6297
6294
|
));
|
|
6298
|
-
|
|
6295
|
+
setHasUnsavedChanges(false);
|
|
6299
6296
|
if (onClearAncestryVisuals) {
|
|
6300
6297
|
onClearAncestryVisuals(currentStep.branchId);
|
|
6301
6298
|
}
|
|
@@ -6328,7 +6325,7 @@ function CreateAncestryPanel({
|
|
|
6328
6325
|
if (branchIndex !== -1) {
|
|
6329
6326
|
foundParentPath.node.parallel_branches.splice(branchIndex, 1);
|
|
6330
6327
|
updateGlobalTree(rootTreeClone);
|
|
6331
|
-
|
|
6328
|
+
setHasUnsavedChanges(true);
|
|
6332
6329
|
try {
|
|
6333
6330
|
setIsSaving(true);
|
|
6334
6331
|
const currentRootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6350,7 +6347,7 @@ function CreateAncestryPanel({
|
|
|
6350
6347
|
isPrivate,
|
|
6351
6348
|
ancestryMode.abstraction_tree
|
|
6352
6349
|
));
|
|
6353
|
-
|
|
6350
|
+
setHasUnsavedChanges(false);
|
|
6354
6351
|
if (onClearAncestryVisuals) {
|
|
6355
6352
|
onClearAncestryVisuals(currentStep.branchId);
|
|
6356
6353
|
}
|
|
@@ -6612,7 +6609,7 @@ function CreateAncestryPanel({
|
|
|
6612
6609
|
}
|
|
6613
6610
|
setBranchStack(parentStack);
|
|
6614
6611
|
setTargetScrollSectionId(targetFocusId);
|
|
6615
|
-
|
|
6612
|
+
setHasUnsavedChanges(true);
|
|
6616
6613
|
if (onRenderFullAncestry) {
|
|
6617
6614
|
const parentStack2 = currentStack;
|
|
6618
6615
|
const rotation = parentStack2.reduce((acc, step) => {
|
|
@@ -6695,7 +6692,7 @@ function CreateAncestryPanel({
|
|
|
6695
6692
|
savedMaxIndex: parentIndexToSave,
|
|
6696
6693
|
entryDirection: direction
|
|
6697
6694
|
}]);
|
|
6698
|
-
|
|
6695
|
+
setHasUnsavedChanges(true);
|
|
6699
6696
|
if (branch && branch.tree && onRenderFullAncestry) {
|
|
6700
6697
|
const branchAncestryObj = {
|
|
6701
6698
|
ancestry_id: branch.id,
|
|
@@ -6803,7 +6800,7 @@ function CreateAncestryPanel({
|
|
|
6803
6800
|
isPrivate,
|
|
6804
6801
|
ancestryMode.abstraction_tree
|
|
6805
6802
|
));
|
|
6806
|
-
|
|
6803
|
+
setHasUnsavedChanges(false);
|
|
6807
6804
|
if (onRenderFullAncestry) {
|
|
6808
6805
|
const rotation = branchStack.reduce((acc, step) => {
|
|
6809
6806
|
return acc + (step.entryDirection === "left" ? -Math.PI / 2 : Math.PI / 2);
|
|
@@ -6855,7 +6852,7 @@ function CreateAncestryPanel({
|
|
|
6855
6852
|
updatedRootTree,
|
|
6856
6853
|
extrasObj
|
|
6857
6854
|
);
|
|
6858
|
-
|
|
6855
|
+
setHasUnsavedChanges(false);
|
|
6859
6856
|
setLastSavedSnapshot(takeSnapshot(
|
|
6860
6857
|
updatedRootTree,
|
|
6861
6858
|
currentInputName,
|
|
@@ -6878,7 +6875,7 @@ function CreateAncestryPanel({
|
|
|
6878
6875
|
const newTreeString = JSON.stringify(newRootTree);
|
|
6879
6876
|
if (currentTreeString !== newTreeString) {
|
|
6880
6877
|
updateGlobalTree(newRootTree);
|
|
6881
|
-
|
|
6878
|
+
setHasUnsavedChanges(true);
|
|
6882
6879
|
}
|
|
6883
6880
|
}, [description, existingSections]);
|
|
6884
6881
|
const handleTriggerFullRender = () => {
|
|
@@ -6901,7 +6898,7 @@ function CreateAncestryPanel({
|
|
|
6901
6898
|
};
|
|
6902
6899
|
const handleSaveDescriptionInline = (newDesc) => {
|
|
6903
6900
|
setDescription(newDesc);
|
|
6904
|
-
|
|
6901
|
+
setHasUnsavedChanges(true);
|
|
6905
6902
|
handleLocalSave(true, { description: newDesc });
|
|
6906
6903
|
};
|
|
6907
6904
|
const swallow = (e) => e.stopPropagation();
|
|
@@ -7033,7 +7030,7 @@ function CreateAncestryPanel({
|
|
|
7033
7030
|
value: ancestryName,
|
|
7034
7031
|
onChange: (e) => {
|
|
7035
7032
|
setAncestryName(e.target.value);
|
|
7036
|
-
|
|
7033
|
+
setHasUnsavedChanges(true);
|
|
7037
7034
|
},
|
|
7038
7035
|
readOnly: isContextLinked,
|
|
7039
7036
|
placeholder: "Nome da Ancestralidade",
|
|
@@ -7172,7 +7169,7 @@ function CreateAncestryPanel({
|
|
|
7172
7169
|
{
|
|
7173
7170
|
key: prop.id,
|
|
7174
7171
|
prop,
|
|
7175
|
-
onUpdate: (updatedProp) =>
|
|
7172
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
7176
7173
|
onRemove: () => handleRemoveProp(idx),
|
|
7177
7174
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
7178
7175
|
onUploadFile
|
|
@@ -7654,7 +7651,7 @@ function InSceneCreationForm({
|
|
|
7654
7651
|
}, 100);
|
|
7655
7652
|
};
|
|
7656
7653
|
const handleRemoveProp = (index) => setCustomProps(customProps.filter((_, i) => i !== index));
|
|
7657
|
-
const
|
|
7654
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
7658
7655
|
const newProps = [...customProps];
|
|
7659
7656
|
newProps[index] = updatedProp;
|
|
7660
7657
|
setCustomProps(newProps);
|
|
@@ -7892,7 +7889,7 @@ function InSceneCreationForm({
|
|
|
7892
7889
|
{
|
|
7893
7890
|
key: prop.id,
|
|
7894
7891
|
prop,
|
|
7895
|
-
onUpdate: (updatedProp) =>
|
|
7892
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
7896
7893
|
onRemove: () => handleRemoveProp(index),
|
|
7897
7894
|
onOpenImageViewer,
|
|
7898
7895
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -7973,7 +7970,7 @@ function InSceneVersionForm({
|
|
|
7973
7970
|
}
|
|
7974
7971
|
setCustomProps(customProps.filter((_, i) => i !== index));
|
|
7975
7972
|
};
|
|
7976
|
-
const
|
|
7973
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
7977
7974
|
const newProps = [...customProps];
|
|
7978
7975
|
newProps[index] = updatedProp;
|
|
7979
7976
|
setCustomProps(newProps);
|
|
@@ -8111,7 +8108,7 @@ function InSceneVersionForm({
|
|
|
8111
8108
|
{
|
|
8112
8109
|
key: prop.id,
|
|
8113
8110
|
prop,
|
|
8114
|
-
onUpdate: (updatedProp) =>
|
|
8111
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
8115
8112
|
onRemove: () => handleRemoveProp(index),
|
|
8116
8113
|
onOpenImageViewer,
|
|
8117
8114
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -8186,7 +8183,7 @@ function InSceneQuestForm({
|
|
|
8186
8183
|
}, 100);
|
|
8187
8184
|
};
|
|
8188
8185
|
const handleRemoveProp = (index) => setCustomProps(customProps.filter((_, i) => i !== index));
|
|
8189
|
-
const
|
|
8186
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
8190
8187
|
const newProps = [...customProps];
|
|
8191
8188
|
newProps[index] = updatedProp;
|
|
8192
8189
|
setCustomProps(newProps);
|
|
@@ -8340,7 +8337,7 @@ function InSceneQuestForm({
|
|
|
8340
8337
|
{
|
|
8341
8338
|
key: prop.id,
|
|
8342
8339
|
prop,
|
|
8343
|
-
onUpdate: (updatedProp) =>
|
|
8340
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
8344
8341
|
onRemove: () => handleRemoveProp(index),
|
|
8345
8342
|
onOpenImageViewer,
|
|
8346
8343
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -8406,7 +8403,7 @@ function NodeDetailsPanel({
|
|
|
8406
8403
|
return !!(node == null ? void 0 : node.useImageAsTexture);
|
|
8407
8404
|
});
|
|
8408
8405
|
const [selectedImageUrl, setSelectedImageUrl] = (0, import_react17.useState)((node == null ? void 0 : node.textureImageUrl) ?? null);
|
|
8409
|
-
const [hasUnsavedChanges,
|
|
8406
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react17.useState)(false);
|
|
8410
8407
|
const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
|
|
8411
8408
|
const { width: panelWidth, isResizing, handlePointerDown: handleResize, setWidth } = useResizablePanel({
|
|
8412
8409
|
initialWidth: isReadMode ? 700 : 440,
|
|
@@ -8444,7 +8441,7 @@ function NodeDetailsPanel({
|
|
|
8444
8441
|
else if ((node == null ? void 0 : node.useImageAsTexture) === "false") setUseImageAsTexture(false);
|
|
8445
8442
|
else setUseImageAsTexture(!!(node == null ? void 0 : node.useImageAsTexture));
|
|
8446
8443
|
setSelectedImageUrl((node == null ? void 0 : node.textureImageUrl) ?? null);
|
|
8447
|
-
|
|
8444
|
+
setHasUnsavedChanges(false);
|
|
8448
8445
|
}
|
|
8449
8446
|
}, [node]);
|
|
8450
8447
|
const hasImages = customProps.some((p) => p.type === "images" && Array.isArray(p.value) && p.value.length > 0 && p.value.some((img) => img.value));
|
|
@@ -8471,7 +8468,7 @@ function NodeDetailsPanel({
|
|
|
8471
8468
|
setIntensity(val);
|
|
8472
8469
|
onIntensityChange == null ? void 0 : onIntensityChange(node.id, val);
|
|
8473
8470
|
onDataUpdate == null ? void 0 : onDataUpdate({ ...node, intensity: val });
|
|
8474
|
-
|
|
8471
|
+
setHasUnsavedChanges(true);
|
|
8475
8472
|
};
|
|
8476
8473
|
const handleCopyLink = () => {
|
|
8477
8474
|
if (!(node == null ? void 0 : node.id)) return;
|
|
@@ -8489,17 +8486,17 @@ function NodeDetailsPanel({
|
|
|
8489
8486
|
const v = e.target.value;
|
|
8490
8487
|
setName(v);
|
|
8491
8488
|
onNameChange == null ? void 0 : onNameChange(node.id, v);
|
|
8492
|
-
|
|
8489
|
+
setHasUnsavedChanges(true);
|
|
8493
8490
|
};
|
|
8494
8491
|
const handleColorChange = (val) => {
|
|
8495
8492
|
setColor(val);
|
|
8496
8493
|
onColorChange == null ? void 0 : onColorChange(node.id, val);
|
|
8497
|
-
|
|
8494
|
+
setHasUnsavedChanges(true);
|
|
8498
8495
|
};
|
|
8499
8496
|
const handleSizeChange = (newSize) => {
|
|
8500
8497
|
setSize(newSize);
|
|
8501
8498
|
onSizeChange == null ? void 0 : onSizeChange(node.id, newSize);
|
|
8502
|
-
|
|
8499
|
+
setHasUnsavedChanges(true);
|
|
8503
8500
|
};
|
|
8504
8501
|
const handleAddType = (newType) => {
|
|
8505
8502
|
const trimmed = newType.trim();
|
|
@@ -8507,12 +8504,12 @@ function NodeDetailsPanel({
|
|
|
8507
8504
|
setTypes([...types, trimmed]);
|
|
8508
8505
|
setTypeInput("");
|
|
8509
8506
|
setShowTypeSuggestions(false);
|
|
8510
|
-
|
|
8507
|
+
setHasUnsavedChanges(true);
|
|
8511
8508
|
}
|
|
8512
8509
|
};
|
|
8513
8510
|
const handleRemoveType = (indexToRemove) => {
|
|
8514
8511
|
setTypes(types.filter((_, index) => index !== indexToRemove));
|
|
8515
|
-
|
|
8512
|
+
setHasUnsavedChanges(true);
|
|
8516
8513
|
};
|
|
8517
8514
|
const handleTypeInputKeyDown = (e) => {
|
|
8518
8515
|
if (e.key === "Enter") {
|
|
@@ -8525,7 +8522,7 @@ function NodeDetailsPanel({
|
|
|
8525
8522
|
const handleAddProp = () => {
|
|
8526
8523
|
const newProp = createNewCustomProperty(customProps);
|
|
8527
8524
|
setCustomProps((p) => [...p, newProp]);
|
|
8528
|
-
|
|
8525
|
+
setHasUnsavedChanges(true);
|
|
8529
8526
|
setTimeout(() => {
|
|
8530
8527
|
var _a;
|
|
8531
8528
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -8534,21 +8531,21 @@ function NodeDetailsPanel({
|
|
|
8534
8531
|
const handleRemoveProp = (i) => {
|
|
8535
8532
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
8536
8533
|
setCustomProps(newProps);
|
|
8537
|
-
|
|
8534
|
+
setHasUnsavedChanges(true);
|
|
8538
8535
|
triggerAutoSave({ customProps: newProps });
|
|
8539
8536
|
};
|
|
8540
|
-
const
|
|
8537
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
8541
8538
|
const newProps = [...customProps];
|
|
8542
8539
|
newProps[index] = updatedProp;
|
|
8543
8540
|
setCustomProps(newProps);
|
|
8544
|
-
|
|
8541
|
+
setHasUnsavedChanges(true);
|
|
8545
8542
|
if (!updatedProp.isEditing) {
|
|
8546
8543
|
triggerAutoSave({ customProps: newProps });
|
|
8547
8544
|
}
|
|
8548
8545
|
};
|
|
8549
8546
|
const handleToggleImageMode = () => {
|
|
8550
8547
|
setUseImageAsTexture(newValue);
|
|
8551
|
-
|
|
8548
|
+
setHasUnsavedChanges(true);
|
|
8552
8549
|
let activeUrl = null;
|
|
8553
8550
|
if (newValue) {
|
|
8554
8551
|
const firstImageProp = customProps.find((p) => p.type === "images");
|
|
@@ -8570,7 +8567,7 @@ function NodeDetailsPanel({
|
|
|
8570
8567
|
};
|
|
8571
8568
|
const handleSelectTexture = (url) => {
|
|
8572
8569
|
setSelectedImageUrl(url);
|
|
8573
|
-
|
|
8570
|
+
setHasUnsavedChanges(true);
|
|
8574
8571
|
onImageChange == null ? void 0 : onImageChange(true, url, color);
|
|
8575
8572
|
onDataUpdate == null ? void 0 : onDataUpdate({
|
|
8576
8573
|
...node,
|
|
@@ -8581,7 +8578,7 @@ function NodeDetailsPanel({
|
|
|
8581
8578
|
};
|
|
8582
8579
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
8583
8580
|
setDescription(newDescription);
|
|
8584
|
-
|
|
8581
|
+
setHasUnsavedChanges(true);
|
|
8585
8582
|
onDataUpdate({ ...node, description: newDescription });
|
|
8586
8583
|
triggerAutoSave({ description: newDescription });
|
|
8587
8584
|
};
|
|
@@ -8620,7 +8617,7 @@ function NodeDetailsPanel({
|
|
|
8620
8617
|
};
|
|
8621
8618
|
await onSave(dataToSave, keepOpen);
|
|
8622
8619
|
onDataUpdate(dataToSave);
|
|
8623
|
-
|
|
8620
|
+
setHasUnsavedChanges(false);
|
|
8624
8621
|
if (!keepOpen) {
|
|
8625
8622
|
onClose();
|
|
8626
8623
|
}
|
|
@@ -8857,6 +8854,7 @@ function NodeDetailsPanel({
|
|
|
8857
8854
|
initialValue: description,
|
|
8858
8855
|
onSave: (newDescription) => {
|
|
8859
8856
|
setDescription(newDescription);
|
|
8857
|
+
setHasUnsavedChanges(true);
|
|
8860
8858
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
8861
8859
|
triggerAutoSave({ description: newDescription });
|
|
8862
8860
|
},
|
|
@@ -8916,7 +8914,7 @@ function QuestDetailsPanel({
|
|
|
8916
8914
|
const [existingSections, setExistingSections] = (0, import_react18.useState)((node == null ? void 0 : node.description_sections) || []);
|
|
8917
8915
|
const [isSaving, setIsSaving] = (0, import_react18.useState)(false);
|
|
8918
8916
|
const [isLinkCopied, setIsLinkCopied] = (0, import_react18.useState)(false);
|
|
8919
|
-
const [hasUnsavedChanges,
|
|
8917
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react18.useState)(false);
|
|
8920
8918
|
const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
|
|
8921
8919
|
const { width: panelWidth, isResizing, handlePointerDown: handleResize, setWidth } = useResizablePanel({
|
|
8922
8920
|
initialWidth: isReadMode ? 700 : 440,
|
|
@@ -8948,7 +8946,7 @@ function QuestDetailsPanel({
|
|
|
8948
8946
|
setIntensity((node == null ? void 0 : node.intensity) !== void 0 ? node.intensity : 0);
|
|
8949
8947
|
setExistingSections((node == null ? void 0 : node.description_sections) || []);
|
|
8950
8948
|
setCustomProps(extractCustomPropsFromNode(node || {}));
|
|
8951
|
-
|
|
8949
|
+
setHasUnsavedChanges(false);
|
|
8952
8950
|
}
|
|
8953
8951
|
}, [node]);
|
|
8954
8952
|
(0, import_react18.useEffect)(() => {
|
|
@@ -8980,19 +8978,19 @@ function QuestDetailsPanel({
|
|
|
8980
8978
|
setRawTitle(val);
|
|
8981
8979
|
const newStandardName = questPrefix ? `${questPrefix} - \xBB ${val || "Sem t\xEDtulo"}` : val;
|
|
8982
8980
|
onNameChange == null ? void 0 : onNameChange(node.id, newStandardName, val);
|
|
8983
|
-
|
|
8981
|
+
setHasUnsavedChanges(true);
|
|
8984
8982
|
};
|
|
8985
8983
|
const handleSizeChange = (newSize) => {
|
|
8986
8984
|
setSize(newSize);
|
|
8987
8985
|
onSizeChange == null ? void 0 : onSizeChange(node.id, newSize);
|
|
8988
|
-
|
|
8986
|
+
setHasUnsavedChanges(true);
|
|
8989
8987
|
};
|
|
8990
8988
|
const handleStatusChange = (newStatus) => {
|
|
8991
8989
|
setStatus(newStatus);
|
|
8992
8990
|
const newColor = QUEST_STATUS_COLORS3[newStatus];
|
|
8993
8991
|
onColorChange == null ? void 0 : onColorChange(node.id, newColor);
|
|
8994
8992
|
onDataUpdate == null ? void 0 : onDataUpdate({ ...node, status: newStatus, color: newColor });
|
|
8995
|
-
|
|
8993
|
+
setHasUnsavedChanges(true);
|
|
8996
8994
|
};
|
|
8997
8995
|
const handleAddType = (newType) => {
|
|
8998
8996
|
const trimmed = newType.trim();
|
|
@@ -9000,13 +8998,13 @@ function QuestDetailsPanel({
|
|
|
9000
8998
|
setTypes([...types, trimmed]);
|
|
9001
8999
|
setTypeInput("");
|
|
9002
9000
|
setShowTypeSuggestions(false);
|
|
9003
|
-
|
|
9001
|
+
setHasUnsavedChanges(true);
|
|
9004
9002
|
}
|
|
9005
9003
|
};
|
|
9006
9004
|
const handleRemoveType = (indexToRemove) => {
|
|
9007
9005
|
if (types[indexToRemove] === "quest") return;
|
|
9008
9006
|
setTypes(types.filter((_, index) => index !== indexToRemove));
|
|
9009
|
-
|
|
9007
|
+
setHasUnsavedChanges(true);
|
|
9010
9008
|
};
|
|
9011
9009
|
const handleTypeInputKeyDown = (e) => {
|
|
9012
9010
|
if (e.key === "Enter") {
|
|
@@ -9019,7 +9017,7 @@ function QuestDetailsPanel({
|
|
|
9019
9017
|
const handleAddProp = () => {
|
|
9020
9018
|
const newProp = createNewCustomProperty(customProps);
|
|
9021
9019
|
setCustomProps((p) => [...p, newProp]);
|
|
9022
|
-
|
|
9020
|
+
setHasUnsavedChanges(true);
|
|
9023
9021
|
setTimeout(() => {
|
|
9024
9022
|
var _a2;
|
|
9025
9023
|
(_a2 = propsEndRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -9028,21 +9026,21 @@ function QuestDetailsPanel({
|
|
|
9028
9026
|
const handleRemoveProp = (i) => {
|
|
9029
9027
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
9030
9028
|
setCustomProps(newProps);
|
|
9031
|
-
|
|
9029
|
+
setHasUnsavedChanges(true);
|
|
9032
9030
|
triggerAutoSave({ customProps: newProps });
|
|
9033
9031
|
};
|
|
9034
|
-
const
|
|
9032
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
9035
9033
|
const newProps = [...customProps];
|
|
9036
9034
|
newProps[index] = updatedProp;
|
|
9037
9035
|
setCustomProps(newProps);
|
|
9038
|
-
|
|
9036
|
+
setHasUnsavedChanges(true);
|
|
9039
9037
|
if (!updatedProp.isEditing) {
|
|
9040
9038
|
triggerAutoSave({ customProps: newProps });
|
|
9041
9039
|
}
|
|
9042
9040
|
};
|
|
9043
9041
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
9044
9042
|
setDescription(newDescription);
|
|
9045
|
-
|
|
9043
|
+
setHasUnsavedChanges(true);
|
|
9046
9044
|
onDataUpdate({ ...node, description: newDescription });
|
|
9047
9045
|
triggerAutoSave({ description: newDescription });
|
|
9048
9046
|
};
|
|
@@ -9087,7 +9085,7 @@ function QuestDetailsPanel({
|
|
|
9087
9085
|
};
|
|
9088
9086
|
await onSave(dataToSave, keepOpen);
|
|
9089
9087
|
onDataUpdate(dataToSave);
|
|
9090
|
-
|
|
9088
|
+
setHasUnsavedChanges(false);
|
|
9091
9089
|
if (!keepOpen) {
|
|
9092
9090
|
onClose();
|
|
9093
9091
|
}
|
|
@@ -9324,7 +9322,7 @@ function RelationshipDetailsPanel({
|
|
|
9324
9322
|
const [isDescriptionModalOpen, setIsDescriptionModalOpen] = (0, import_react20.useState)(false);
|
|
9325
9323
|
const [isSaving, setIsSaving] = (0, import_react20.useState)(false);
|
|
9326
9324
|
const [isReadMode, setIsReadMode] = (0, import_react20.useState)(false);
|
|
9327
|
-
const [hasUnsavedChanges,
|
|
9325
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react20.useState)(false);
|
|
9328
9326
|
const propsEndRef = (0, import_react20.useRef)(null);
|
|
9329
9327
|
const canEdit = (0, import_react20.useMemo)(() => {
|
|
9330
9328
|
const ability = defineAbilityFor(userRole);
|
|
@@ -9337,14 +9335,14 @@ function RelationshipDetailsPanel({
|
|
|
9337
9335
|
setCustomProps(extractCustomPropsFromNode(link || {}));
|
|
9338
9336
|
setSourceLabel((link == null ? void 0 : link.source_label) ?? "");
|
|
9339
9337
|
setTargetLabel((link == null ? void 0 : link.target_label) ?? "");
|
|
9340
|
-
|
|
9338
|
+
setHasUnsavedChanges(false);
|
|
9341
9339
|
}, [link]);
|
|
9342
9340
|
const swallow = (e) => e.stopPropagation();
|
|
9343
9341
|
const handleAddProp = () => {
|
|
9344
9342
|
if (!canEdit) return;
|
|
9345
9343
|
const newProp = createNewCustomProperty(customProps);
|
|
9346
9344
|
setCustomProps((p) => [...p, newProp]);
|
|
9347
|
-
|
|
9345
|
+
setHasUnsavedChanges(true);
|
|
9348
9346
|
setTimeout(() => {
|
|
9349
9347
|
var _a;
|
|
9350
9348
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -9381,7 +9379,7 @@ function RelationshipDetailsPanel({
|
|
|
9381
9379
|
if (currentTargetLabel.trim()) dataToSave.target_label = currentTargetLabel.trim();
|
|
9382
9380
|
await onSave(dataToSave, keepOpen);
|
|
9383
9381
|
onDataUpdate(dataToSave);
|
|
9384
|
-
|
|
9382
|
+
setHasUnsavedChanges(false);
|
|
9385
9383
|
if (!keepOpen) {
|
|
9386
9384
|
onClose();
|
|
9387
9385
|
}
|
|
@@ -9395,21 +9393,21 @@ function RelationshipDetailsPanel({
|
|
|
9395
9393
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
9396
9394
|
if (!canEdit) return;
|
|
9397
9395
|
setDescription(newDescription);
|
|
9398
|
-
|
|
9396
|
+
setHasUnsavedChanges(true);
|
|
9399
9397
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
9400
9398
|
triggerAutoSave({ description: newDescription });
|
|
9401
9399
|
};
|
|
9402
9400
|
const handleRemoveProp = (i) => {
|
|
9403
9401
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
9404
9402
|
setCustomProps(newProps);
|
|
9405
|
-
|
|
9403
|
+
setHasUnsavedChanges(true);
|
|
9406
9404
|
triggerAutoSave({ customProps: newProps });
|
|
9407
9405
|
};
|
|
9408
|
-
const
|
|
9406
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
9409
9407
|
const newProps = [...customProps];
|
|
9410
9408
|
newProps[index] = updatedProp;
|
|
9411
9409
|
setCustomProps(newProps);
|
|
9412
|
-
|
|
9410
|
+
setHasUnsavedChanges(true);
|
|
9413
9411
|
if (!updatedProp.isEditing) {
|
|
9414
9412
|
triggerAutoSave({ customProps: newProps });
|
|
9415
9413
|
}
|
|
@@ -9464,7 +9462,7 @@ function RelationshipDetailsPanel({
|
|
|
9464
9462
|
value: name,
|
|
9465
9463
|
onChange: (e) => {
|
|
9466
9464
|
setName(e.target.value);
|
|
9467
|
-
|
|
9465
|
+
setHasUnsavedChanges(true);
|
|
9468
9466
|
},
|
|
9469
9467
|
placeholder: "Ex: Controla, Pertence a, Fornece...",
|
|
9470
9468
|
disabled: !canEdit,
|
|
@@ -9479,7 +9477,7 @@ function RelationshipDetailsPanel({
|
|
|
9479
9477
|
value: sourceLabel,
|
|
9480
9478
|
onChange: (e) => {
|
|
9481
9479
|
setSourceLabel(e.target.value);
|
|
9482
|
-
|
|
9480
|
+
setHasUnsavedChanges(true);
|
|
9483
9481
|
},
|
|
9484
9482
|
placeholder: "Ex: Conceitos",
|
|
9485
9483
|
disabled: !canEdit,
|
|
@@ -9494,7 +9492,7 @@ function RelationshipDetailsPanel({
|
|
|
9494
9492
|
value: targetLabel,
|
|
9495
9493
|
onChange: (e) => {
|
|
9496
9494
|
setTargetLabel(e.target.value);
|
|
9497
|
-
|
|
9495
|
+
setHasUnsavedChanges(true);
|
|
9498
9496
|
},
|
|
9499
9497
|
placeholder: "Ex: Refer\xEAncias",
|
|
9500
9498
|
disabled: !canEdit,
|
|
@@ -9544,7 +9542,7 @@ function RelationshipDetailsPanel({
|
|
|
9544
9542
|
{
|
|
9545
9543
|
key: prop.id,
|
|
9546
9544
|
prop,
|
|
9547
|
-
onUpdate: (updatedProp) =>
|
|
9545
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
9548
9546
|
onRemove: () => handleRemoveProp(idx),
|
|
9549
9547
|
onOpenImageViewer,
|
|
9550
9548
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -9572,6 +9570,7 @@ function RelationshipDetailsPanel({
|
|
|
9572
9570
|
onSave: (newDescription) => {
|
|
9573
9571
|
if (!canEdit) return;
|
|
9574
9572
|
setDescription(newDescription);
|
|
9573
|
+
setHasUnsavedChanges(true);
|
|
9575
9574
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
9576
9575
|
triggerAutoSave({ description: newDescription });
|
|
9577
9576
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -5464,7 +5464,7 @@ function AncestryRelationshipPanel({
|
|
|
5464
5464
|
}, 100);
|
|
5465
5465
|
};
|
|
5466
5466
|
const handleRemoveProp = (i) => setCustomProps((p) => p.filter((_, idx) => idx !== i));
|
|
5467
|
-
const
|
|
5467
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
5468
5468
|
setCustomProps((props) => {
|
|
5469
5469
|
const newProps = [...props];
|
|
5470
5470
|
newProps[index] = updatedProp;
|
|
@@ -5576,7 +5576,7 @@ function AncestryRelationshipPanel({
|
|
|
5576
5576
|
{
|
|
5577
5577
|
key: prop.id,
|
|
5578
5578
|
prop,
|
|
5579
|
-
onUpdate: (updatedProp) =>
|
|
5579
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
5580
5580
|
onRemove: () => handleRemoveProp(idx),
|
|
5581
5581
|
onOpenImageViewer,
|
|
5582
5582
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -5786,7 +5786,6 @@ var NodeItem = ({ nodeData, onSelectParent, onViewSelect, highlightedPathIds = [
|
|
|
5786
5786
|
e.stopPropagation();
|
|
5787
5787
|
if (isEditable) {
|
|
5788
5788
|
onSelectParent(itemId);
|
|
5789
|
-
setHasUnsavedChanges(true);
|
|
5790
5789
|
} else if (onViewSelect) {
|
|
5791
5790
|
onViewSelect(itemId);
|
|
5792
5791
|
}
|
|
@@ -5799,11 +5798,9 @@ var NodeItem = ({ nodeData, onSelectParent, onViewSelect, highlightedPathIds = [
|
|
|
5799
5798
|
level > 0 && isEditable && /* @__PURE__ */ React10.createElement("div", { className: "flex items-center gap-1 animate-in fade-in duration-200" }, !nodeData.is_section && /* @__PURE__ */ React10.createElement("button", { onClick: (e) => {
|
|
5800
5799
|
e.stopPropagation();
|
|
5801
5800
|
onEditRelationship(path, nodeData.relationship || {});
|
|
5802
|
-
setHasUnsavedChanges(true);
|
|
5803
5801
|
}, className: "w-6 h-6 grid place-content-center rounded-full hover:bg-cyan-500/20 text-cyan-400 transition-colors flex-shrink-0", title: "Editar detalhes da rela\xE7\xE3o" }, /* @__PURE__ */ React10.createElement(FiEdit23, { size: 12 })), /* @__PURE__ */ React10.createElement("button", { onClick: (e) => {
|
|
5804
5802
|
e.stopPropagation();
|
|
5805
5803
|
onRemoveNode(path);
|
|
5806
|
-
setHasUnsavedChanges(true);
|
|
5807
5804
|
}, className: "w-6 h-6 grid place-content-center rounded-full hover:bg-red-500/20 text-red-400 text-lg transition-colors flex-shrink-0", title: "Remover Node" }, "\xD7"))
|
|
5808
5805
|
), hasChildren && /* @__PURE__ */ React10.createElement("div", { className: "mt-2 space-y-2 pl-8" }, nodeData.children.map((child, index) => /* @__PURE__ */ React10.createElement(
|
|
5809
5806
|
NodeItem,
|
|
@@ -5859,7 +5856,7 @@ function CreateAncestryPanel({
|
|
|
5859
5856
|
} = ancestryMode;
|
|
5860
5857
|
const [isSaving, setIsSaving] = useState11(false);
|
|
5861
5858
|
const [isLinkCopied, setIsLinkCopied] = useState11(false);
|
|
5862
|
-
const [hasUnsavedChanges,
|
|
5859
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState11(false);
|
|
5863
5860
|
const [showDeleteBranchConfirm, setShowDeleteBranchConfirm] = useState11(false);
|
|
5864
5861
|
const handleCopyLink = (e) => {
|
|
5865
5862
|
e.stopPropagation();
|
|
@@ -5927,14 +5924,14 @@ function CreateAncestryPanel({
|
|
|
5927
5924
|
};
|
|
5928
5925
|
const handleSelectAncestryParent = (nodeId, isAbstraction = false) => {
|
|
5929
5926
|
setAncestryMode((prev) => isAbstraction ? { ...prev, selectedAbstractionParentId: nodeId } : { ...prev, selectedParentId: nodeId });
|
|
5930
|
-
|
|
5927
|
+
setHasUnsavedChanges(true);
|
|
5931
5928
|
};
|
|
5932
5929
|
const handleToggleAddMode = (isAbstraction = false) => {
|
|
5933
5930
|
if (isAbstraction && !ancestryMode.isAddingAbstractionNodes) {
|
|
5934
5931
|
setTargetRenderNodeId(null);
|
|
5935
5932
|
}
|
|
5936
5933
|
setAncestryMode((prev) => isAbstraction ? { ...prev, isAddingAbstractionNodes: !prev.isAddingAbstractionNodes } : { ...prev, isAddingNodes: !prev.isAddingNodes });
|
|
5937
|
-
|
|
5934
|
+
setHasUnsavedChanges(true);
|
|
5938
5935
|
};
|
|
5939
5936
|
const handleRemoveNode = useCallback2((pathToRemove, isAbstraction = false) => {
|
|
5940
5937
|
if (!Array.isArray(pathToRemove) || pathToRemove.length === 0) return;
|
|
@@ -5952,7 +5949,7 @@ function CreateAncestryPanel({
|
|
|
5952
5949
|
const indexToRemove = pathToRemove[pathToRemove.length - 1];
|
|
5953
5950
|
if (currentParent.children && currentParent.children.length > indexToRemove) {
|
|
5954
5951
|
currentParent.children.splice(indexToRemove, 1);
|
|
5955
|
-
|
|
5952
|
+
setHasUnsavedChanges(true);
|
|
5956
5953
|
}
|
|
5957
5954
|
return { ...prev, [treeKey]: newTree };
|
|
5958
5955
|
});
|
|
@@ -6011,7 +6008,7 @@ function CreateAncestryPanel({
|
|
|
6011
6008
|
updateGlobalTree(rootTreeClone);
|
|
6012
6009
|
}
|
|
6013
6010
|
setAncestryMode((prev) => ({ ...prev, [treeKey]: rootTreeClone }));
|
|
6014
|
-
|
|
6011
|
+
setHasUnsavedChanges(true);
|
|
6015
6012
|
} else {
|
|
6016
6013
|
alert("N\xE3o \xE9 poss\xEDvel mover um node para dentro de seus pr\xF3prios descendentes.");
|
|
6017
6014
|
}
|
|
@@ -6084,7 +6081,7 @@ function CreateAncestryPanel({
|
|
|
6084
6081
|
const handleAddProp = () => {
|
|
6085
6082
|
const newProp = createNewCustomProperty(customProps);
|
|
6086
6083
|
setCustomProps((p) => [...p, newProp]);
|
|
6087
|
-
|
|
6084
|
+
setHasUnsavedChanges(true);
|
|
6088
6085
|
setTimeout(() => {
|
|
6089
6086
|
var _a;
|
|
6090
6087
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -6093,13 +6090,13 @@ function CreateAncestryPanel({
|
|
|
6093
6090
|
const handleRemoveProp = (i) => {
|
|
6094
6091
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
6095
6092
|
setCustomProps(newProps);
|
|
6096
|
-
|
|
6093
|
+
setHasUnsavedChanges(true);
|
|
6097
6094
|
};
|
|
6098
|
-
const
|
|
6095
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
6099
6096
|
const newProps = [...customProps];
|
|
6100
6097
|
newProps[index] = updatedProp;
|
|
6101
6098
|
setCustomProps(newProps);
|
|
6102
|
-
|
|
6099
|
+
setHasUnsavedChanges(true);
|
|
6103
6100
|
};
|
|
6104
6101
|
const currentUsedTypes = customProps.map((p) => p.type).filter((t) => UNIQUE_PROP_TYPES.includes(t));
|
|
6105
6102
|
useEffect10(() => {
|
|
@@ -6209,7 +6206,7 @@ function CreateAncestryPanel({
|
|
|
6209
6206
|
updateGlobalTree(rootTreeClone);
|
|
6210
6207
|
setBranchStack([...branchStack]);
|
|
6211
6208
|
setIsPickerOpen(false);
|
|
6212
|
-
|
|
6209
|
+
setHasUnsavedChanges(true);
|
|
6213
6210
|
try {
|
|
6214
6211
|
setIsSaving(true);
|
|
6215
6212
|
const rootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6223,7 +6220,7 @@ function CreateAncestryPanel({
|
|
|
6223
6220
|
rootExtras
|
|
6224
6221
|
);
|
|
6225
6222
|
setLastSavedSnapshot(takeSnapshot(rootTreeClone, ancestryName, description, processedSections, [], isPrivate, ancestryMode.abstraction_tree));
|
|
6226
|
-
|
|
6223
|
+
setHasUnsavedChanges(false);
|
|
6227
6224
|
if (onRenderFullAncestry) {
|
|
6228
6225
|
const fullTreePayload = {
|
|
6229
6226
|
ancestry_id: ancestryMode.currentAncestryId || "temp_root",
|
|
@@ -6266,7 +6263,7 @@ function CreateAncestryPanel({
|
|
|
6266
6263
|
if (branchIndex !== -1) {
|
|
6267
6264
|
foundParentPath.node.parallel_branches.splice(branchIndex, 1);
|
|
6268
6265
|
updateGlobalTree(rootTreeClone);
|
|
6269
|
-
|
|
6266
|
+
setHasUnsavedChanges(true);
|
|
6270
6267
|
try {
|
|
6271
6268
|
setIsSaving(true);
|
|
6272
6269
|
const currentRootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6288,7 +6285,7 @@ function CreateAncestryPanel({
|
|
|
6288
6285
|
isPrivate,
|
|
6289
6286
|
ancestryMode.abstraction_tree
|
|
6290
6287
|
));
|
|
6291
|
-
|
|
6288
|
+
setHasUnsavedChanges(false);
|
|
6292
6289
|
if (onClearAncestryVisuals) {
|
|
6293
6290
|
onClearAncestryVisuals(currentStep.branchId);
|
|
6294
6291
|
}
|
|
@@ -6321,7 +6318,7 @@ function CreateAncestryPanel({
|
|
|
6321
6318
|
if (branchIndex !== -1) {
|
|
6322
6319
|
foundParentPath.node.parallel_branches.splice(branchIndex, 1);
|
|
6323
6320
|
updateGlobalTree(rootTreeClone);
|
|
6324
|
-
|
|
6321
|
+
setHasUnsavedChanges(true);
|
|
6325
6322
|
try {
|
|
6326
6323
|
setIsSaving(true);
|
|
6327
6324
|
const currentRootProps = extractCustomPropsFromNode(ancestryMode);
|
|
@@ -6343,7 +6340,7 @@ function CreateAncestryPanel({
|
|
|
6343
6340
|
isPrivate,
|
|
6344
6341
|
ancestryMode.abstraction_tree
|
|
6345
6342
|
));
|
|
6346
|
-
|
|
6343
|
+
setHasUnsavedChanges(false);
|
|
6347
6344
|
if (onClearAncestryVisuals) {
|
|
6348
6345
|
onClearAncestryVisuals(currentStep.branchId);
|
|
6349
6346
|
}
|
|
@@ -6605,7 +6602,7 @@ function CreateAncestryPanel({
|
|
|
6605
6602
|
}
|
|
6606
6603
|
setBranchStack(parentStack);
|
|
6607
6604
|
setTargetScrollSectionId(targetFocusId);
|
|
6608
|
-
|
|
6605
|
+
setHasUnsavedChanges(true);
|
|
6609
6606
|
if (onRenderFullAncestry) {
|
|
6610
6607
|
const parentStack2 = currentStack;
|
|
6611
6608
|
const rotation = parentStack2.reduce((acc, step) => {
|
|
@@ -6688,7 +6685,7 @@ function CreateAncestryPanel({
|
|
|
6688
6685
|
savedMaxIndex: parentIndexToSave,
|
|
6689
6686
|
entryDirection: direction
|
|
6690
6687
|
}]);
|
|
6691
|
-
|
|
6688
|
+
setHasUnsavedChanges(true);
|
|
6692
6689
|
if (branch && branch.tree && onRenderFullAncestry) {
|
|
6693
6690
|
const branchAncestryObj = {
|
|
6694
6691
|
ancestry_id: branch.id,
|
|
@@ -6796,7 +6793,7 @@ function CreateAncestryPanel({
|
|
|
6796
6793
|
isPrivate,
|
|
6797
6794
|
ancestryMode.abstraction_tree
|
|
6798
6795
|
));
|
|
6799
|
-
|
|
6796
|
+
setHasUnsavedChanges(false);
|
|
6800
6797
|
if (onRenderFullAncestry) {
|
|
6801
6798
|
const rotation = branchStack.reduce((acc, step) => {
|
|
6802
6799
|
return acc + (step.entryDirection === "left" ? -Math.PI / 2 : Math.PI / 2);
|
|
@@ -6848,7 +6845,7 @@ function CreateAncestryPanel({
|
|
|
6848
6845
|
updatedRootTree,
|
|
6849
6846
|
extrasObj
|
|
6850
6847
|
);
|
|
6851
|
-
|
|
6848
|
+
setHasUnsavedChanges(false);
|
|
6852
6849
|
setLastSavedSnapshot(takeSnapshot(
|
|
6853
6850
|
updatedRootTree,
|
|
6854
6851
|
currentInputName,
|
|
@@ -6871,7 +6868,7 @@ function CreateAncestryPanel({
|
|
|
6871
6868
|
const newTreeString = JSON.stringify(newRootTree);
|
|
6872
6869
|
if (currentTreeString !== newTreeString) {
|
|
6873
6870
|
updateGlobalTree(newRootTree);
|
|
6874
|
-
|
|
6871
|
+
setHasUnsavedChanges(true);
|
|
6875
6872
|
}
|
|
6876
6873
|
}, [description, existingSections]);
|
|
6877
6874
|
const handleTriggerFullRender = () => {
|
|
@@ -6894,7 +6891,7 @@ function CreateAncestryPanel({
|
|
|
6894
6891
|
};
|
|
6895
6892
|
const handleSaveDescriptionInline = (newDesc) => {
|
|
6896
6893
|
setDescription(newDesc);
|
|
6897
|
-
|
|
6894
|
+
setHasUnsavedChanges(true);
|
|
6898
6895
|
handleLocalSave(true, { description: newDesc });
|
|
6899
6896
|
};
|
|
6900
6897
|
const swallow = (e) => e.stopPropagation();
|
|
@@ -7026,7 +7023,7 @@ function CreateAncestryPanel({
|
|
|
7026
7023
|
value: ancestryName,
|
|
7027
7024
|
onChange: (e) => {
|
|
7028
7025
|
setAncestryName(e.target.value);
|
|
7029
|
-
|
|
7026
|
+
setHasUnsavedChanges(true);
|
|
7030
7027
|
},
|
|
7031
7028
|
readOnly: isContextLinked,
|
|
7032
7029
|
placeholder: "Nome da Ancestralidade",
|
|
@@ -7165,7 +7162,7 @@ function CreateAncestryPanel({
|
|
|
7165
7162
|
{
|
|
7166
7163
|
key: prop.id,
|
|
7167
7164
|
prop,
|
|
7168
|
-
onUpdate: (updatedProp) =>
|
|
7165
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
7169
7166
|
onRemove: () => handleRemoveProp(idx),
|
|
7170
7167
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
7171
7168
|
onUploadFile
|
|
@@ -7647,7 +7644,7 @@ function InSceneCreationForm({
|
|
|
7647
7644
|
}, 100);
|
|
7648
7645
|
};
|
|
7649
7646
|
const handleRemoveProp = (index) => setCustomProps(customProps.filter((_, i) => i !== index));
|
|
7650
|
-
const
|
|
7647
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
7651
7648
|
const newProps = [...customProps];
|
|
7652
7649
|
newProps[index] = updatedProp;
|
|
7653
7650
|
setCustomProps(newProps);
|
|
@@ -7885,7 +7882,7 @@ function InSceneCreationForm({
|
|
|
7885
7882
|
{
|
|
7886
7883
|
key: prop.id,
|
|
7887
7884
|
prop,
|
|
7888
|
-
onUpdate: (updatedProp) =>
|
|
7885
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
7889
7886
|
onRemove: () => handleRemoveProp(index),
|
|
7890
7887
|
onOpenImageViewer,
|
|
7891
7888
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -7966,7 +7963,7 @@ function InSceneVersionForm({
|
|
|
7966
7963
|
}
|
|
7967
7964
|
setCustomProps(customProps.filter((_, i) => i !== index));
|
|
7968
7965
|
};
|
|
7969
|
-
const
|
|
7966
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
7970
7967
|
const newProps = [...customProps];
|
|
7971
7968
|
newProps[index] = updatedProp;
|
|
7972
7969
|
setCustomProps(newProps);
|
|
@@ -8104,7 +8101,7 @@ function InSceneVersionForm({
|
|
|
8104
8101
|
{
|
|
8105
8102
|
key: prop.id,
|
|
8106
8103
|
prop,
|
|
8107
|
-
onUpdate: (updatedProp) =>
|
|
8104
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
8108
8105
|
onRemove: () => handleRemoveProp(index),
|
|
8109
8106
|
onOpenImageViewer,
|
|
8110
8107
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -8179,7 +8176,7 @@ function InSceneQuestForm({
|
|
|
8179
8176
|
}, 100);
|
|
8180
8177
|
};
|
|
8181
8178
|
const handleRemoveProp = (index) => setCustomProps(customProps.filter((_, i) => i !== index));
|
|
8182
|
-
const
|
|
8179
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
8183
8180
|
const newProps = [...customProps];
|
|
8184
8181
|
newProps[index] = updatedProp;
|
|
8185
8182
|
setCustomProps(newProps);
|
|
@@ -8333,7 +8330,7 @@ function InSceneQuestForm({
|
|
|
8333
8330
|
{
|
|
8334
8331
|
key: prop.id,
|
|
8335
8332
|
prop,
|
|
8336
|
-
onUpdate: (updatedProp) =>
|
|
8333
|
+
onUpdate: (updatedProp) => handleUpdateProp(index, updatedProp),
|
|
8337
8334
|
onRemove: () => handleRemoveProp(index),
|
|
8338
8335
|
onOpenImageViewer,
|
|
8339
8336
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -8399,7 +8396,7 @@ function NodeDetailsPanel({
|
|
|
8399
8396
|
return !!(node == null ? void 0 : node.useImageAsTexture);
|
|
8400
8397
|
});
|
|
8401
8398
|
const [selectedImageUrl, setSelectedImageUrl] = useState17((node == null ? void 0 : node.textureImageUrl) ?? null);
|
|
8402
|
-
const [hasUnsavedChanges,
|
|
8399
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState17(false);
|
|
8403
8400
|
const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
|
|
8404
8401
|
const { width: panelWidth, isResizing, handlePointerDown: handleResize, setWidth } = useResizablePanel({
|
|
8405
8402
|
initialWidth: isReadMode ? 700 : 440,
|
|
@@ -8437,7 +8434,7 @@ function NodeDetailsPanel({
|
|
|
8437
8434
|
else if ((node == null ? void 0 : node.useImageAsTexture) === "false") setUseImageAsTexture(false);
|
|
8438
8435
|
else setUseImageAsTexture(!!(node == null ? void 0 : node.useImageAsTexture));
|
|
8439
8436
|
setSelectedImageUrl((node == null ? void 0 : node.textureImageUrl) ?? null);
|
|
8440
|
-
|
|
8437
|
+
setHasUnsavedChanges(false);
|
|
8441
8438
|
}
|
|
8442
8439
|
}, [node]);
|
|
8443
8440
|
const hasImages = customProps.some((p) => p.type === "images" && Array.isArray(p.value) && p.value.length > 0 && p.value.some((img) => img.value));
|
|
@@ -8464,7 +8461,7 @@ function NodeDetailsPanel({
|
|
|
8464
8461
|
setIntensity(val);
|
|
8465
8462
|
onIntensityChange == null ? void 0 : onIntensityChange(node.id, val);
|
|
8466
8463
|
onDataUpdate == null ? void 0 : onDataUpdate({ ...node, intensity: val });
|
|
8467
|
-
|
|
8464
|
+
setHasUnsavedChanges(true);
|
|
8468
8465
|
};
|
|
8469
8466
|
const handleCopyLink = () => {
|
|
8470
8467
|
if (!(node == null ? void 0 : node.id)) return;
|
|
@@ -8482,17 +8479,17 @@ function NodeDetailsPanel({
|
|
|
8482
8479
|
const v = e.target.value;
|
|
8483
8480
|
setName(v);
|
|
8484
8481
|
onNameChange == null ? void 0 : onNameChange(node.id, v);
|
|
8485
|
-
|
|
8482
|
+
setHasUnsavedChanges(true);
|
|
8486
8483
|
};
|
|
8487
8484
|
const handleColorChange = (val) => {
|
|
8488
8485
|
setColor(val);
|
|
8489
8486
|
onColorChange == null ? void 0 : onColorChange(node.id, val);
|
|
8490
|
-
|
|
8487
|
+
setHasUnsavedChanges(true);
|
|
8491
8488
|
};
|
|
8492
8489
|
const handleSizeChange = (newSize) => {
|
|
8493
8490
|
setSize(newSize);
|
|
8494
8491
|
onSizeChange == null ? void 0 : onSizeChange(node.id, newSize);
|
|
8495
|
-
|
|
8492
|
+
setHasUnsavedChanges(true);
|
|
8496
8493
|
};
|
|
8497
8494
|
const handleAddType = (newType) => {
|
|
8498
8495
|
const trimmed = newType.trim();
|
|
@@ -8500,12 +8497,12 @@ function NodeDetailsPanel({
|
|
|
8500
8497
|
setTypes([...types, trimmed]);
|
|
8501
8498
|
setTypeInput("");
|
|
8502
8499
|
setShowTypeSuggestions(false);
|
|
8503
|
-
|
|
8500
|
+
setHasUnsavedChanges(true);
|
|
8504
8501
|
}
|
|
8505
8502
|
};
|
|
8506
8503
|
const handleRemoveType = (indexToRemove) => {
|
|
8507
8504
|
setTypes(types.filter((_, index) => index !== indexToRemove));
|
|
8508
|
-
|
|
8505
|
+
setHasUnsavedChanges(true);
|
|
8509
8506
|
};
|
|
8510
8507
|
const handleTypeInputKeyDown = (e) => {
|
|
8511
8508
|
if (e.key === "Enter") {
|
|
@@ -8518,7 +8515,7 @@ function NodeDetailsPanel({
|
|
|
8518
8515
|
const handleAddProp = () => {
|
|
8519
8516
|
const newProp = createNewCustomProperty(customProps);
|
|
8520
8517
|
setCustomProps((p) => [...p, newProp]);
|
|
8521
|
-
|
|
8518
|
+
setHasUnsavedChanges(true);
|
|
8522
8519
|
setTimeout(() => {
|
|
8523
8520
|
var _a;
|
|
8524
8521
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -8527,21 +8524,21 @@ function NodeDetailsPanel({
|
|
|
8527
8524
|
const handleRemoveProp = (i) => {
|
|
8528
8525
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
8529
8526
|
setCustomProps(newProps);
|
|
8530
|
-
|
|
8527
|
+
setHasUnsavedChanges(true);
|
|
8531
8528
|
triggerAutoSave({ customProps: newProps });
|
|
8532
8529
|
};
|
|
8533
|
-
const
|
|
8530
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
8534
8531
|
const newProps = [...customProps];
|
|
8535
8532
|
newProps[index] = updatedProp;
|
|
8536
8533
|
setCustomProps(newProps);
|
|
8537
|
-
|
|
8534
|
+
setHasUnsavedChanges(true);
|
|
8538
8535
|
if (!updatedProp.isEditing) {
|
|
8539
8536
|
triggerAutoSave({ customProps: newProps });
|
|
8540
8537
|
}
|
|
8541
8538
|
};
|
|
8542
8539
|
const handleToggleImageMode = () => {
|
|
8543
8540
|
setUseImageAsTexture(newValue);
|
|
8544
|
-
|
|
8541
|
+
setHasUnsavedChanges(true);
|
|
8545
8542
|
let activeUrl = null;
|
|
8546
8543
|
if (newValue) {
|
|
8547
8544
|
const firstImageProp = customProps.find((p) => p.type === "images");
|
|
@@ -8563,7 +8560,7 @@ function NodeDetailsPanel({
|
|
|
8563
8560
|
};
|
|
8564
8561
|
const handleSelectTexture = (url) => {
|
|
8565
8562
|
setSelectedImageUrl(url);
|
|
8566
|
-
|
|
8563
|
+
setHasUnsavedChanges(true);
|
|
8567
8564
|
onImageChange == null ? void 0 : onImageChange(true, url, color);
|
|
8568
8565
|
onDataUpdate == null ? void 0 : onDataUpdate({
|
|
8569
8566
|
...node,
|
|
@@ -8574,7 +8571,7 @@ function NodeDetailsPanel({
|
|
|
8574
8571
|
};
|
|
8575
8572
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
8576
8573
|
setDescription(newDescription);
|
|
8577
|
-
|
|
8574
|
+
setHasUnsavedChanges(true);
|
|
8578
8575
|
onDataUpdate({ ...node, description: newDescription });
|
|
8579
8576
|
triggerAutoSave({ description: newDescription });
|
|
8580
8577
|
};
|
|
@@ -8613,7 +8610,7 @@ function NodeDetailsPanel({
|
|
|
8613
8610
|
};
|
|
8614
8611
|
await onSave(dataToSave, keepOpen);
|
|
8615
8612
|
onDataUpdate(dataToSave);
|
|
8616
|
-
|
|
8613
|
+
setHasUnsavedChanges(false);
|
|
8617
8614
|
if (!keepOpen) {
|
|
8618
8615
|
onClose();
|
|
8619
8616
|
}
|
|
@@ -8850,6 +8847,7 @@ function NodeDetailsPanel({
|
|
|
8850
8847
|
initialValue: description,
|
|
8851
8848
|
onSave: (newDescription) => {
|
|
8852
8849
|
setDescription(newDescription);
|
|
8850
|
+
setHasUnsavedChanges(true);
|
|
8853
8851
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
8854
8852
|
triggerAutoSave({ description: newDescription });
|
|
8855
8853
|
},
|
|
@@ -8909,7 +8907,7 @@ function QuestDetailsPanel({
|
|
|
8909
8907
|
const [existingSections, setExistingSections] = useState18((node == null ? void 0 : node.description_sections) || []);
|
|
8910
8908
|
const [isSaving, setIsSaving] = useState18(false);
|
|
8911
8909
|
const [isLinkCopied, setIsLinkCopied] = useState18(false);
|
|
8912
|
-
const [hasUnsavedChanges,
|
|
8910
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState18(false);
|
|
8913
8911
|
const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
|
|
8914
8912
|
const { width: panelWidth, isResizing, handlePointerDown: handleResize, setWidth } = useResizablePanel({
|
|
8915
8913
|
initialWidth: isReadMode ? 700 : 440,
|
|
@@ -8941,7 +8939,7 @@ function QuestDetailsPanel({
|
|
|
8941
8939
|
setIntensity((node == null ? void 0 : node.intensity) !== void 0 ? node.intensity : 0);
|
|
8942
8940
|
setExistingSections((node == null ? void 0 : node.description_sections) || []);
|
|
8943
8941
|
setCustomProps(extractCustomPropsFromNode(node || {}));
|
|
8944
|
-
|
|
8942
|
+
setHasUnsavedChanges(false);
|
|
8945
8943
|
}
|
|
8946
8944
|
}, [node]);
|
|
8947
8945
|
useEffect16(() => {
|
|
@@ -8973,19 +8971,19 @@ function QuestDetailsPanel({
|
|
|
8973
8971
|
setRawTitle(val);
|
|
8974
8972
|
const newStandardName = questPrefix ? `${questPrefix} - \xBB ${val || "Sem t\xEDtulo"}` : val;
|
|
8975
8973
|
onNameChange == null ? void 0 : onNameChange(node.id, newStandardName, val);
|
|
8976
|
-
|
|
8974
|
+
setHasUnsavedChanges(true);
|
|
8977
8975
|
};
|
|
8978
8976
|
const handleSizeChange = (newSize) => {
|
|
8979
8977
|
setSize(newSize);
|
|
8980
8978
|
onSizeChange == null ? void 0 : onSizeChange(node.id, newSize);
|
|
8981
|
-
|
|
8979
|
+
setHasUnsavedChanges(true);
|
|
8982
8980
|
};
|
|
8983
8981
|
const handleStatusChange = (newStatus) => {
|
|
8984
8982
|
setStatus(newStatus);
|
|
8985
8983
|
const newColor = QUEST_STATUS_COLORS3[newStatus];
|
|
8986
8984
|
onColorChange == null ? void 0 : onColorChange(node.id, newColor);
|
|
8987
8985
|
onDataUpdate == null ? void 0 : onDataUpdate({ ...node, status: newStatus, color: newColor });
|
|
8988
|
-
|
|
8986
|
+
setHasUnsavedChanges(true);
|
|
8989
8987
|
};
|
|
8990
8988
|
const handleAddType = (newType) => {
|
|
8991
8989
|
const trimmed = newType.trim();
|
|
@@ -8993,13 +8991,13 @@ function QuestDetailsPanel({
|
|
|
8993
8991
|
setTypes([...types, trimmed]);
|
|
8994
8992
|
setTypeInput("");
|
|
8995
8993
|
setShowTypeSuggestions(false);
|
|
8996
|
-
|
|
8994
|
+
setHasUnsavedChanges(true);
|
|
8997
8995
|
}
|
|
8998
8996
|
};
|
|
8999
8997
|
const handleRemoveType = (indexToRemove) => {
|
|
9000
8998
|
if (types[indexToRemove] === "quest") return;
|
|
9001
8999
|
setTypes(types.filter((_, index) => index !== indexToRemove));
|
|
9002
|
-
|
|
9000
|
+
setHasUnsavedChanges(true);
|
|
9003
9001
|
};
|
|
9004
9002
|
const handleTypeInputKeyDown = (e) => {
|
|
9005
9003
|
if (e.key === "Enter") {
|
|
@@ -9012,7 +9010,7 @@ function QuestDetailsPanel({
|
|
|
9012
9010
|
const handleAddProp = () => {
|
|
9013
9011
|
const newProp = createNewCustomProperty(customProps);
|
|
9014
9012
|
setCustomProps((p) => [...p, newProp]);
|
|
9015
|
-
|
|
9013
|
+
setHasUnsavedChanges(true);
|
|
9016
9014
|
setTimeout(() => {
|
|
9017
9015
|
var _a2;
|
|
9018
9016
|
(_a2 = propsEndRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -9021,21 +9019,21 @@ function QuestDetailsPanel({
|
|
|
9021
9019
|
const handleRemoveProp = (i) => {
|
|
9022
9020
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
9023
9021
|
setCustomProps(newProps);
|
|
9024
|
-
|
|
9022
|
+
setHasUnsavedChanges(true);
|
|
9025
9023
|
triggerAutoSave({ customProps: newProps });
|
|
9026
9024
|
};
|
|
9027
|
-
const
|
|
9025
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
9028
9026
|
const newProps = [...customProps];
|
|
9029
9027
|
newProps[index] = updatedProp;
|
|
9030
9028
|
setCustomProps(newProps);
|
|
9031
|
-
|
|
9029
|
+
setHasUnsavedChanges(true);
|
|
9032
9030
|
if (!updatedProp.isEditing) {
|
|
9033
9031
|
triggerAutoSave({ customProps: newProps });
|
|
9034
9032
|
}
|
|
9035
9033
|
};
|
|
9036
9034
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
9037
9035
|
setDescription(newDescription);
|
|
9038
|
-
|
|
9036
|
+
setHasUnsavedChanges(true);
|
|
9039
9037
|
onDataUpdate({ ...node, description: newDescription });
|
|
9040
9038
|
triggerAutoSave({ description: newDescription });
|
|
9041
9039
|
};
|
|
@@ -9080,7 +9078,7 @@ function QuestDetailsPanel({
|
|
|
9080
9078
|
};
|
|
9081
9079
|
await onSave(dataToSave, keepOpen);
|
|
9082
9080
|
onDataUpdate(dataToSave);
|
|
9083
|
-
|
|
9081
|
+
setHasUnsavedChanges(false);
|
|
9084
9082
|
if (!keepOpen) {
|
|
9085
9083
|
onClose();
|
|
9086
9084
|
}
|
|
@@ -9317,7 +9315,7 @@ function RelationshipDetailsPanel({
|
|
|
9317
9315
|
const [isDescriptionModalOpen, setIsDescriptionModalOpen] = useState20(false);
|
|
9318
9316
|
const [isSaving, setIsSaving] = useState20(false);
|
|
9319
9317
|
const [isReadMode, setIsReadMode] = useState20(false);
|
|
9320
|
-
const [hasUnsavedChanges,
|
|
9318
|
+
const [hasUnsavedChanges, setHasUnsavedChanges] = useState20(false);
|
|
9321
9319
|
const propsEndRef = useRef16(null);
|
|
9322
9320
|
const canEdit = useMemo9(() => {
|
|
9323
9321
|
const ability = defineAbilityFor(userRole);
|
|
@@ -9330,14 +9328,14 @@ function RelationshipDetailsPanel({
|
|
|
9330
9328
|
setCustomProps(extractCustomPropsFromNode(link || {}));
|
|
9331
9329
|
setSourceLabel((link == null ? void 0 : link.source_label) ?? "");
|
|
9332
9330
|
setTargetLabel((link == null ? void 0 : link.target_label) ?? "");
|
|
9333
|
-
|
|
9331
|
+
setHasUnsavedChanges(false);
|
|
9334
9332
|
}, [link]);
|
|
9335
9333
|
const swallow = (e) => e.stopPropagation();
|
|
9336
9334
|
const handleAddProp = () => {
|
|
9337
9335
|
if (!canEdit) return;
|
|
9338
9336
|
const newProp = createNewCustomProperty(customProps);
|
|
9339
9337
|
setCustomProps((p) => [...p, newProp]);
|
|
9340
|
-
|
|
9338
|
+
setHasUnsavedChanges(true);
|
|
9341
9339
|
setTimeout(() => {
|
|
9342
9340
|
var _a;
|
|
9343
9341
|
(_a = propsEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -9374,7 +9372,7 @@ function RelationshipDetailsPanel({
|
|
|
9374
9372
|
if (currentTargetLabel.trim()) dataToSave.target_label = currentTargetLabel.trim();
|
|
9375
9373
|
await onSave(dataToSave, keepOpen);
|
|
9376
9374
|
onDataUpdate(dataToSave);
|
|
9377
|
-
|
|
9375
|
+
setHasUnsavedChanges(false);
|
|
9378
9376
|
if (!keepOpen) {
|
|
9379
9377
|
onClose();
|
|
9380
9378
|
}
|
|
@@ -9388,21 +9386,21 @@ function RelationshipDetailsPanel({
|
|
|
9388
9386
|
const handleSaveDescriptionInline = (newDescription) => {
|
|
9389
9387
|
if (!canEdit) return;
|
|
9390
9388
|
setDescription(newDescription);
|
|
9391
|
-
|
|
9389
|
+
setHasUnsavedChanges(true);
|
|
9392
9390
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
9393
9391
|
triggerAutoSave({ description: newDescription });
|
|
9394
9392
|
};
|
|
9395
9393
|
const handleRemoveProp = (i) => {
|
|
9396
9394
|
const newProps = customProps.filter((_, idx) => idx !== i);
|
|
9397
9395
|
setCustomProps(newProps);
|
|
9398
|
-
|
|
9396
|
+
setHasUnsavedChanges(true);
|
|
9399
9397
|
triggerAutoSave({ customProps: newProps });
|
|
9400
9398
|
};
|
|
9401
|
-
const
|
|
9399
|
+
const handleUpdateProp = (index, updatedProp) => {
|
|
9402
9400
|
const newProps = [...customProps];
|
|
9403
9401
|
newProps[index] = updatedProp;
|
|
9404
9402
|
setCustomProps(newProps);
|
|
9405
|
-
|
|
9403
|
+
setHasUnsavedChanges(true);
|
|
9406
9404
|
if (!updatedProp.isEditing) {
|
|
9407
9405
|
triggerAutoSave({ customProps: newProps });
|
|
9408
9406
|
}
|
|
@@ -9457,7 +9455,7 @@ function RelationshipDetailsPanel({
|
|
|
9457
9455
|
value: name,
|
|
9458
9456
|
onChange: (e) => {
|
|
9459
9457
|
setName(e.target.value);
|
|
9460
|
-
|
|
9458
|
+
setHasUnsavedChanges(true);
|
|
9461
9459
|
},
|
|
9462
9460
|
placeholder: "Ex: Controla, Pertence a, Fornece...",
|
|
9463
9461
|
disabled: !canEdit,
|
|
@@ -9472,7 +9470,7 @@ function RelationshipDetailsPanel({
|
|
|
9472
9470
|
value: sourceLabel,
|
|
9473
9471
|
onChange: (e) => {
|
|
9474
9472
|
setSourceLabel(e.target.value);
|
|
9475
|
-
|
|
9473
|
+
setHasUnsavedChanges(true);
|
|
9476
9474
|
},
|
|
9477
9475
|
placeholder: "Ex: Conceitos",
|
|
9478
9476
|
disabled: !canEdit,
|
|
@@ -9487,7 +9485,7 @@ function RelationshipDetailsPanel({
|
|
|
9487
9485
|
value: targetLabel,
|
|
9488
9486
|
onChange: (e) => {
|
|
9489
9487
|
setTargetLabel(e.target.value);
|
|
9490
|
-
|
|
9488
|
+
setHasUnsavedChanges(true);
|
|
9491
9489
|
},
|
|
9492
9490
|
placeholder: "Ex: Refer\xEAncias",
|
|
9493
9491
|
disabled: !canEdit,
|
|
@@ -9537,7 +9535,7 @@ function RelationshipDetailsPanel({
|
|
|
9537
9535
|
{
|
|
9538
9536
|
key: prop.id,
|
|
9539
9537
|
prop,
|
|
9540
|
-
onUpdate: (updatedProp) =>
|
|
9538
|
+
onUpdate: (updatedProp) => handleUpdateProp(idx, updatedProp),
|
|
9541
9539
|
onRemove: () => handleRemoveProp(idx),
|
|
9542
9540
|
onOpenImageViewer,
|
|
9543
9541
|
unavailableTypes: currentUsedTypes.filter((t) => t !== prop.type),
|
|
@@ -9565,6 +9563,7 @@ function RelationshipDetailsPanel({
|
|
|
9565
9563
|
onSave: (newDescription) => {
|
|
9566
9564
|
if (!canEdit) return;
|
|
9567
9565
|
setDescription(newDescription);
|
|
9566
|
+
setHasUnsavedChanges(true);
|
|
9568
9567
|
onDataUpdate((prev) => ({ ...prev, description: newDescription }));
|
|
9569
9568
|
triggerAutoSave({ description: newDescription });
|
|
9570
9569
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.5-dev.
|
|
3
|
+
"version": "1.2.5-dev.9",
|
|
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",
|