@lv-x-software-house/x_view 1.2.6-dev.23 → 1.2.6-dev.25
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 +72 -66
- package/dist/index.mjs +72 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13311,12 +13311,12 @@ var BoardItem = ({
|
|
|
13311
13311
|
const isNested = onOutdent !== void 0;
|
|
13312
13312
|
const getIndentUpTooltip = () => {
|
|
13313
13313
|
if (!prevItem) return null;
|
|
13314
|
-
const typeLabel = prevItem.type === "folder" ? "
|
|
13314
|
+
const typeLabel = prevItem.type === "folder" ? "pasta" : "grupo de texto";
|
|
13315
13315
|
return isFolder ? prevItem.type === "folder" ? "Aninhar na pasta acima" : null : `Mover para dentro do ${typeLabel} acima`;
|
|
13316
13316
|
};
|
|
13317
13317
|
const getIndentDownTooltip = () => {
|
|
13318
13318
|
if (!nextItem) return null;
|
|
13319
|
-
const typeLabel = nextItem.type === "folder" ? "
|
|
13319
|
+
const typeLabel = nextItem.type === "folder" ? "pasta" : "grupo de texto";
|
|
13320
13320
|
return isFolder ? nextItem.type === "folder" ? "Aninhar na pasta abaixo" : null : `Mover para dentro do ${typeLabel} abaixo`;
|
|
13321
13321
|
};
|
|
13322
13322
|
const showIndentUp = !!getIndentUpTooltip();
|
|
@@ -13420,14 +13420,14 @@ var BoardItem = ({
|
|
|
13420
13420
|
onMentionClick,
|
|
13421
13421
|
searchItems,
|
|
13422
13422
|
readOnly: !canEdit,
|
|
13423
|
-
placeholder: "Escreva sobre este grupo\u2026 ou @ para mencionar"
|
|
13423
|
+
placeholder: "Escreva sobre este grupo de texto\u2026 ou @ para mencionar"
|
|
13424
13424
|
}
|
|
13425
13425
|
), canEdit && /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex items-center justify-between pt-2 mt-1 border-t border-white/5 opacity-40 group-hover/item:opacity-100 transition-opacity" }, /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react29.default.createElement(
|
|
13426
13426
|
"button",
|
|
13427
13427
|
{
|
|
13428
|
-
onClick: () => onAddSubgroup(item.id, "
|
|
13428
|
+
onClick: () => onAddSubgroup(item.id, "text_group"),
|
|
13429
13429
|
className: "flex items-center gap-1 px-1.5 py-1 text-[10px] uppercase font-bold tracking-wider text-slate-500 hover:text-white hover:bg-white/10 rounded transition-colors",
|
|
13430
|
-
title: "Criar Subgrupo"
|
|
13430
|
+
title: "Criar Subgrupo de Texto"
|
|
13431
13431
|
},
|
|
13432
13432
|
/* @__PURE__ */ import_react29.default.createElement(import_fi23.FiPlus, { size: 12 }),
|
|
13433
13433
|
/* @__PURE__ */ import_react29.default.createElement("span", null, "Subgrupo")
|
|
@@ -13469,7 +13469,7 @@ var BoardItem = ({
|
|
|
13469
13469
|
className: `p-1.5 rounded transition-colors ${!onOutdent ? "text-slate-800 cursor-not-allowed" : "text-slate-500 hover:text-white hover:bg-white/10"}`
|
|
13470
13470
|
},
|
|
13471
13471
|
/* @__PURE__ */ import_react29.default.createElement(import_fi23.FiCornerUpLeft, { size: 14 })
|
|
13472
|
-
)), /* @__PURE__ */ import_react29.default.createElement("div", { className: "w-px h-3 bg-white/10 mx-1" }), /* @__PURE__ */ import_react29.default.createElement(Tooltip, { text: "Remover Grupo" }, /* @__PURE__ */ import_react29.default.createElement(
|
|
13472
|
+
)), /* @__PURE__ */ import_react29.default.createElement("div", { className: "w-px h-3 bg-white/10 mx-1" }), /* @__PURE__ */ import_react29.default.createElement(Tooltip, { text: "Remover Grupo de Texto" }, /* @__PURE__ */ import_react29.default.createElement(
|
|
13473
13473
|
"button",
|
|
13474
13474
|
{
|
|
13475
13475
|
onClick: () => onDelete(item.id),
|
|
@@ -13506,29 +13506,35 @@ function AncestryBoard({
|
|
|
13506
13506
|
onSelect,
|
|
13507
13507
|
availableAncestries = [],
|
|
13508
13508
|
availableNodes = [],
|
|
13509
|
-
|
|
13509
|
+
initialBoardItems = [],
|
|
13510
13510
|
onSave,
|
|
13511
13511
|
userRole
|
|
13512
13512
|
}) {
|
|
13513
|
-
const [
|
|
13513
|
+
const [boardItems, setBoardItems] = (0, import_react29.useState)([]);
|
|
13514
13514
|
const [isLoaded, setIsLoaded] = (0, import_react29.useState)(false);
|
|
13515
13515
|
const [saveStatus, setSaveStatus] = (0, import_react29.useState)("idle");
|
|
13516
13516
|
const [navigationStack, setNavigationStack] = (0, import_react29.useState)([]);
|
|
13517
|
-
const
|
|
13517
|
+
const lastSavedBoardItemsRef = (0, import_react29.useRef)(null);
|
|
13518
13518
|
const canEdit = (0, import_react29.useMemo)(() => userRole !== "viewer", [userRole]);
|
|
13519
13519
|
(0, import_react29.useEffect)(() => {
|
|
13520
|
-
if (
|
|
13521
|
-
const
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13520
|
+
if (initialBoardItems && !isLoaded) {
|
|
13521
|
+
const hasLegacyTypes = (list) => list.some((g) => g.type === "group" || hasLegacyTypes(g.children || []));
|
|
13522
|
+
if (hasLegacyTypes(initialBoardItems)) {
|
|
13523
|
+
console.warn("Legacy AncestryBoard detected. Resetting board to empty list.");
|
|
13524
|
+
setBoardItems([]);
|
|
13525
|
+
} else {
|
|
13526
|
+
const prepare = (list) => list.map((g) => ({
|
|
13527
|
+
id: g.id || (0, import_uuid11.v4)(),
|
|
13528
|
+
type: g.type || "text_group",
|
|
13529
|
+
name: g.name || "",
|
|
13530
|
+
content: Array.isArray(g.content) ? g.content : [],
|
|
13531
|
+
children: prepare(g.children || [])
|
|
13532
|
+
}));
|
|
13533
|
+
setBoardItems(prepare(initialBoardItems));
|
|
13534
|
+
}
|
|
13529
13535
|
setIsLoaded(true);
|
|
13530
13536
|
}
|
|
13531
|
-
}, [
|
|
13537
|
+
}, [initialBoardItems, isLoaded]);
|
|
13532
13538
|
const allSearchableItems = (0, import_react29.useMemo)(() => {
|
|
13533
13539
|
const items = [];
|
|
13534
13540
|
availableAncestries.forEach((anc) => {
|
|
@@ -13555,23 +13561,23 @@ function AncestryBoard({
|
|
|
13555
13561
|
});
|
|
13556
13562
|
return items;
|
|
13557
13563
|
}, [availableAncestries, availableNodes]);
|
|
13558
|
-
const
|
|
13564
|
+
const sanitizeBoardItems = (list) => list.map((g) => ({
|
|
13559
13565
|
id: g.id,
|
|
13560
|
-
type: g.type || "
|
|
13566
|
+
type: g.type || "text_group",
|
|
13561
13567
|
name: g.name || "",
|
|
13562
13568
|
content: g.content || [],
|
|
13563
|
-
children:
|
|
13569
|
+
children: sanitizeBoardItems(g.children || [])
|
|
13564
13570
|
}));
|
|
13565
13571
|
(0, import_react29.useEffect)(() => {
|
|
13566
13572
|
if (!isLoaded || !onSave) return;
|
|
13567
13573
|
const id = setTimeout(async () => {
|
|
13568
|
-
const currentSanitized =
|
|
13574
|
+
const currentSanitized = sanitizeBoardItems(boardItems);
|
|
13569
13575
|
const currentJson = JSON.stringify(currentSanitized);
|
|
13570
|
-
if (currentJson ===
|
|
13576
|
+
if (currentJson === lastSavedBoardItemsRef.current) return;
|
|
13571
13577
|
setSaveStatus("saving");
|
|
13572
13578
|
try {
|
|
13573
13579
|
await onSave(currentSanitized);
|
|
13574
|
-
|
|
13580
|
+
lastSavedBoardItemsRef.current = currentJson;
|
|
13575
13581
|
setSaveStatus("saved");
|
|
13576
13582
|
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
13577
13583
|
} catch (err) {
|
|
@@ -13580,12 +13586,12 @@ function AncestryBoard({
|
|
|
13580
13586
|
}
|
|
13581
13587
|
}, 3e3);
|
|
13582
13588
|
return () => clearTimeout(id);
|
|
13583
|
-
}, [
|
|
13584
|
-
const triggerInstantSave = async (
|
|
13589
|
+
}, [boardItems, isLoaded, onSave]);
|
|
13590
|
+
const triggerInstantSave = async (updatedBoardItems) => {
|
|
13585
13591
|
if (!onSave) return;
|
|
13586
|
-
const sanitized =
|
|
13592
|
+
const sanitized = sanitizeBoardItems(updatedBoardItems);
|
|
13587
13593
|
const sanitizedJson = JSON.stringify(sanitized);
|
|
13588
|
-
|
|
13594
|
+
lastSavedBoardItemsRef.current = sanitizedJson;
|
|
13589
13595
|
setSaveStatus("saving");
|
|
13590
13596
|
try {
|
|
13591
13597
|
await onSave(sanitized);
|
|
@@ -13610,7 +13616,7 @@ function AncestryBoard({
|
|
|
13610
13616
|
}, [isOpen, onClose]);
|
|
13611
13617
|
const currentPath = (0, import_react29.useMemo)(() => {
|
|
13612
13618
|
const path = [];
|
|
13613
|
-
let currentLevel =
|
|
13619
|
+
let currentLevel = boardItems;
|
|
13614
13620
|
for (const folderId of navigationStack) {
|
|
13615
13621
|
const folder = currentLevel.find((f) => f.id === folderId);
|
|
13616
13622
|
if (folder) {
|
|
@@ -13619,11 +13625,11 @@ function AncestryBoard({
|
|
|
13619
13625
|
}
|
|
13620
13626
|
}
|
|
13621
13627
|
return path;
|
|
13622
|
-
}, [
|
|
13623
|
-
const
|
|
13628
|
+
}, [boardItems, navigationStack]);
|
|
13629
|
+
const currentBoardItems = (0, import_react29.useMemo)(() => {
|
|
13624
13630
|
const lastFolder = currentPath[currentPath.length - 1];
|
|
13625
|
-
return lastFolder ? lastFolder.children :
|
|
13626
|
-
}, [
|
|
13631
|
+
return lastFolder ? lastFolder.children : boardItems;
|
|
13632
|
+
}, [boardItems, currentPath]);
|
|
13627
13633
|
const navigateUp = () => {
|
|
13628
13634
|
setNavigationStack((prev) => prev.slice(0, -1));
|
|
13629
13635
|
};
|
|
@@ -13636,7 +13642,7 @@ function AncestryBoard({
|
|
|
13636
13642
|
const navigateHome = () => {
|
|
13637
13643
|
setNavigationStack([]);
|
|
13638
13644
|
};
|
|
13639
|
-
const handleAddItem = (type = "
|
|
13645
|
+
const handleAddItem = (type = "text_group") => {
|
|
13640
13646
|
const newItem = {
|
|
13641
13647
|
id: (0, import_uuid11.v4)(),
|
|
13642
13648
|
type,
|
|
@@ -13645,19 +13651,19 @@ function AncestryBoard({
|
|
|
13645
13651
|
children: []
|
|
13646
13652
|
};
|
|
13647
13653
|
if (navigationStack.length === 0) {
|
|
13648
|
-
|
|
13654
|
+
setBoardItems((prev) => [...prev, newItem]);
|
|
13649
13655
|
} else {
|
|
13650
13656
|
const parentId = navigationStack[navigationStack.length - 1];
|
|
13651
13657
|
const add = (list) => list.map(
|
|
13652
13658
|
(g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
|
|
13653
13659
|
);
|
|
13654
|
-
|
|
13660
|
+
setBoardItems((prev) => add(prev));
|
|
13655
13661
|
}
|
|
13656
13662
|
};
|
|
13657
|
-
const handleAddSubgroup = (parentId, type = "
|
|
13663
|
+
const handleAddSubgroup = (parentId, type = "text_group") => {
|
|
13658
13664
|
const add = (list) => list.map((g) => {
|
|
13659
13665
|
if (g.id === parentId) {
|
|
13660
|
-
if (g.type === "
|
|
13666
|
+
if (g.type === "text_group" && type === "folder") return g;
|
|
13661
13667
|
const newItem = {
|
|
13662
13668
|
id: (0, import_uuid11.v4)(),
|
|
13663
13669
|
type,
|
|
@@ -13669,17 +13675,17 @@ function AncestryBoard({
|
|
|
13669
13675
|
}
|
|
13670
13676
|
return { ...g, children: add(g.children) };
|
|
13671
13677
|
});
|
|
13672
|
-
|
|
13678
|
+
setBoardItems((prev) => add(prev));
|
|
13673
13679
|
};
|
|
13674
13680
|
const handleUpdateItem = (id, newData) => {
|
|
13675
13681
|
const update = (list) => list.map(
|
|
13676
13682
|
(g) => g.id === id ? newData : { ...g, children: update(g.children) }
|
|
13677
13683
|
);
|
|
13678
|
-
|
|
13684
|
+
setBoardItems((prev) => update(prev));
|
|
13679
13685
|
};
|
|
13680
13686
|
const handleDeleteItem = (id) => {
|
|
13681
13687
|
const del = (list) => list.filter((g) => g.id !== id).map((g) => ({ ...g, children: del(g.children) }));
|
|
13682
|
-
|
|
13688
|
+
setBoardItems((prev) => del(prev));
|
|
13683
13689
|
};
|
|
13684
13690
|
const findGroupAndParent = (list, targetId, parent = null) => {
|
|
13685
13691
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -13693,35 +13699,35 @@ function AncestryBoard({
|
|
|
13693
13699
|
return null;
|
|
13694
13700
|
};
|
|
13695
13701
|
const handleIndent = (id) => {
|
|
13696
|
-
const next = JSON.parse(JSON.stringify(
|
|
13702
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13697
13703
|
const found = findGroupAndParent(next, id);
|
|
13698
13704
|
if (!found || found.index === 0) return;
|
|
13699
13705
|
const { group, siblings, index } = found;
|
|
13700
13706
|
const targetParent = siblings[index - 1];
|
|
13701
|
-
if (group.type === "folder" && targetParent.type === "
|
|
13707
|
+
if (group.type === "folder" && targetParent.type === "text_group") {
|
|
13702
13708
|
return;
|
|
13703
13709
|
}
|
|
13704
13710
|
siblings.splice(index, 1);
|
|
13705
13711
|
targetParent.children.push(group);
|
|
13706
|
-
|
|
13712
|
+
setBoardItems(next);
|
|
13707
13713
|
triggerInstantSave(next);
|
|
13708
13714
|
};
|
|
13709
13715
|
const handleIndentDown = (id) => {
|
|
13710
|
-
const next = JSON.parse(JSON.stringify(
|
|
13716
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13711
13717
|
const found = findGroupAndParent(next, id);
|
|
13712
13718
|
if (!found || found.index === found.siblings.length - 1) return;
|
|
13713
13719
|
const { group, siblings, index } = found;
|
|
13714
13720
|
const targetParent = siblings[index + 1];
|
|
13715
|
-
if (group.type === "folder" && targetParent.type === "
|
|
13721
|
+
if (group.type === "folder" && targetParent.type === "text_group") {
|
|
13716
13722
|
return;
|
|
13717
13723
|
}
|
|
13718
13724
|
siblings.splice(index, 1);
|
|
13719
13725
|
targetParent.children.push(group);
|
|
13720
|
-
|
|
13726
|
+
setBoardItems(next);
|
|
13721
13727
|
triggerInstantSave(next);
|
|
13722
13728
|
};
|
|
13723
13729
|
const handleOutdent = (id) => {
|
|
13724
|
-
const next = JSON.parse(JSON.stringify(
|
|
13730
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13725
13731
|
const found = findGroupAndParent(next, id);
|
|
13726
13732
|
if (!found || !found.parent) return;
|
|
13727
13733
|
const { group, siblings, index, parent } = found;
|
|
@@ -13732,29 +13738,29 @@ function AncestryBoard({
|
|
|
13732
13738
|
} else {
|
|
13733
13739
|
next.push(group);
|
|
13734
13740
|
}
|
|
13735
|
-
|
|
13741
|
+
setBoardItems(next);
|
|
13736
13742
|
triggerInstantSave(next);
|
|
13737
13743
|
};
|
|
13738
13744
|
const handleMoveUp = (id) => {
|
|
13739
|
-
const next = JSON.parse(JSON.stringify(
|
|
13745
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13740
13746
|
const found = findGroupAndParent(next, id);
|
|
13741
13747
|
if (!found || found.index === 0) return;
|
|
13742
13748
|
const { siblings, index } = found;
|
|
13743
13749
|
const item = siblings[index];
|
|
13744
13750
|
siblings.splice(index, 1);
|
|
13745
13751
|
siblings.splice(index - 1, 0, item);
|
|
13746
|
-
|
|
13752
|
+
setBoardItems(next);
|
|
13747
13753
|
triggerInstantSave(next);
|
|
13748
13754
|
};
|
|
13749
13755
|
const handleMoveDown = (id) => {
|
|
13750
|
-
const next = JSON.parse(JSON.stringify(
|
|
13756
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13751
13757
|
const found = findGroupAndParent(next, id);
|
|
13752
13758
|
if (!found || found.index === found.siblings.length - 1) return;
|
|
13753
13759
|
const { siblings, index } = found;
|
|
13754
13760
|
const item = siblings[index];
|
|
13755
13761
|
siblings.splice(index, 1);
|
|
13756
13762
|
siblings.splice(index + 1, 0, item);
|
|
13757
|
-
|
|
13763
|
+
setBoardItems(next);
|
|
13758
13764
|
triggerInstantSave(next);
|
|
13759
13765
|
};
|
|
13760
13766
|
const handleMentionClick = (item) => {
|
|
@@ -13784,11 +13790,11 @@ function AncestryBoard({
|
|
|
13784
13790
|
), /* @__PURE__ */ import_react29.default.createElement(
|
|
13785
13791
|
"button",
|
|
13786
13792
|
{
|
|
13787
|
-
onClick: () => handleAddItem("
|
|
13793
|
+
onClick: () => handleAddItem("text_group"),
|
|
13788
13794
|
className: "flex items-center gap-2 px-3 py-1.5 bg-white/5 hover:bg-white/10 border border-white/10 hover:border-white/20 backdrop-blur-sm text-slate-200 hover:text-white rounded-md transition-all duration-200 text-xs font-medium shadow-sm"
|
|
13789
13795
|
},
|
|
13790
13796
|
/* @__PURE__ */ import_react29.default.createElement(import_fi23.FiPlus, { size: 14, className: "text-indigo-400" }),
|
|
13791
|
-
/* @__PURE__ */ import_react29.default.createElement("span", { className: "hidden sm:inline" }, "Novo Grupo")
|
|
13797
|
+
/* @__PURE__ */ import_react29.default.createElement("span", { className: "hidden sm:inline" }, "Novo Grupo de Texto")
|
|
13792
13798
|
)), /* @__PURE__ */ import_react29.default.createElement(
|
|
13793
13799
|
"button",
|
|
13794
13800
|
{
|
|
@@ -13820,13 +13826,13 @@ function AncestryBoard({
|
|
|
13820
13826
|
/* @__PURE__ */ import_react29.default.createElement(import_fi23.FiArrowLeft, { size: 10 }),
|
|
13821
13827
|
/* @__PURE__ */ import_react29.default.createElement("span", null, "Voltar")
|
|
13822
13828
|
))),
|
|
13823
|
-
/* @__PURE__ */ import_react29.default.createElement("div", { className: "flex-1 overflow-y-auto custom-scrollbar bg-slate-950/30 p-6 space-y-4" },
|
|
13829
|
+
/* @__PURE__ */ import_react29.default.createElement("div", { className: "flex-1 overflow-y-auto custom-scrollbar bg-slate-950/30 p-6 space-y-4" }, currentBoardItems.length === 0 ? /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex flex-col items-center justify-center h-full text-slate-500 gap-3 border-2 border-dashed border-white/5 rounded-xl bg-slate-900/20" }, /* @__PURE__ */ import_react29.default.createElement(import_fi23.FiLayers, { size: 24, className: "opacity-20" }), /* @__PURE__ */ import_react29.default.createElement("p", { className: "text-xs text-center px-4" }, canEdit ? /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, "Esta pasta est\xE1 vazia.", /* @__PURE__ */ import_react29.default.createElement("br", null), "Use os bot\xF5es acima para criar conte\xFAdo.") : /* @__PURE__ */ import_react29.default.createElement(import_react29.default.Fragment, null, "Nenhum conte\xFAdo dispon\xEDvel nesta pasta."))) : currentBoardItems.map((item, index) => /* @__PURE__ */ import_react29.default.createElement(
|
|
13824
13830
|
BoardItem,
|
|
13825
13831
|
{
|
|
13826
13832
|
key: item.id,
|
|
13827
13833
|
index,
|
|
13828
|
-
prevItem:
|
|
13829
|
-
nextItem:
|
|
13834
|
+
prevItem: currentBoardItems[index - 1],
|
|
13835
|
+
nextItem: currentBoardItems[index + 1],
|
|
13830
13836
|
item,
|
|
13831
13837
|
onUpdate: handleUpdateItem,
|
|
13832
13838
|
onDelete: handleDeleteItem,
|
|
@@ -13843,7 +13849,7 @@ function AncestryBoard({
|
|
|
13843
13849
|
isAtRoot: navigationStack.length === 0
|
|
13844
13850
|
}
|
|
13845
13851
|
))),
|
|
13846
|
-
/* @__PURE__ */ import_react29.default.createElement("div", { className: "px-5 py-2 border-t border-white/10 bg-slate-950/50 text-xs text-slate-500 flex justify-end flex-shrink-0" }, /* @__PURE__ */ import_react29.default.createElement("span", null,
|
|
13852
|
+
/* @__PURE__ */ import_react29.default.createElement("div", { className: "px-5 py-2 border-t border-white/10 bg-slate-950/50 text-xs text-slate-500 flex justify-end flex-shrink-0" }, /* @__PURE__ */ import_react29.default.createElement("span", null, currentBoardItems.length, " itens nesta visualiza\xE7\xE3o"))
|
|
13847
13853
|
)
|
|
13848
13854
|
);
|
|
13849
13855
|
}
|
|
@@ -14189,7 +14195,7 @@ function XViewScene({
|
|
|
14189
14195
|
const [invalidTargetError, setInvalidTargetError] = (0, import_react31.useState)(null);
|
|
14190
14196
|
const [highlightedNodeId, setHighlightedNodeId] = (0, import_react31.useState)(null);
|
|
14191
14197
|
const [isAncestryBoardOpen, setIsAncestryBoardOpen] = (0, import_react31.useState)(false);
|
|
14192
|
-
const [
|
|
14198
|
+
const [boardItems, setBoardItems] = (0, import_react31.useState)([]);
|
|
14193
14199
|
const [isSidebarOpen, setIsSidebarOpen] = (0, import_react31.useState)(false);
|
|
14194
14200
|
const [isMilestoneManagerOpen, setIsMilestoneManagerOpen] = (0, import_react31.useState)(false);
|
|
14195
14201
|
const mountRef = (0, import_react31.useRef)(null);
|
|
@@ -18076,13 +18082,13 @@ function XViewScene({
|
|
|
18076
18082
|
[handleStartReadingAncestry, handleOpenReference]
|
|
18077
18083
|
);
|
|
18078
18084
|
const handleSaveAncestryBoard = (0, import_react31.useCallback)(
|
|
18079
|
-
async (
|
|
18085
|
+
async (boardItems2) => {
|
|
18080
18086
|
if (!sceneConfigId || !viewParams || !session) return;
|
|
18081
18087
|
const sceneType = (viewParams.type || "").toLowerCase().includes("database") ? "database" : "view";
|
|
18082
18088
|
await save_ancestry_board_action(
|
|
18083
18089
|
sceneConfigId,
|
|
18084
18090
|
sceneType,
|
|
18085
|
-
|
|
18091
|
+
boardItems2,
|
|
18086
18092
|
session,
|
|
18087
18093
|
ownerId
|
|
18088
18094
|
);
|
|
@@ -18897,7 +18903,7 @@ function XViewScene({
|
|
|
18897
18903
|
onSelect: handleSelectAncestryFromBoard,
|
|
18898
18904
|
availableAncestries: allAvailableAncestries,
|
|
18899
18905
|
availableNodes: allAvailableNodes,
|
|
18900
|
-
|
|
18906
|
+
initialBoardItems: boardItems,
|
|
18901
18907
|
onSave: handleSaveAncestryBoard,
|
|
18902
18908
|
userRole: userPermissionRole
|
|
18903
18909
|
}
|
|
@@ -19396,10 +19402,10 @@ async function get_ancestry_file_logic(db_services, file_id, owner_id) {
|
|
|
19396
19402
|
return { success: false, error: error.message };
|
|
19397
19403
|
}
|
|
19398
19404
|
}
|
|
19399
|
-
async function save_ancestry_board_logic(db_services, scene_id, type,
|
|
19405
|
+
async function save_ancestry_board_logic(db_services, scene_id, type, boardItems, session, owner_id) {
|
|
19400
19406
|
try {
|
|
19401
19407
|
const targetOwnerId = owner_id || session.user.id;
|
|
19402
|
-
return await db_services.save_ancestry_board(session, scene_id, type,
|
|
19408
|
+
return await db_services.save_ancestry_board(session, scene_id, type, boardItems, targetOwnerId);
|
|
19403
19409
|
} catch (error) {
|
|
19404
19410
|
console.error("Erro em save_ancestry_board_logic:", error);
|
|
19405
19411
|
return { success: false, error: error.message };
|
package/dist/index.mjs
CHANGED
|
@@ -13361,12 +13361,12 @@ var BoardItem = ({
|
|
|
13361
13361
|
const isNested = onOutdent !== void 0;
|
|
13362
13362
|
const getIndentUpTooltip = () => {
|
|
13363
13363
|
if (!prevItem) return null;
|
|
13364
|
-
const typeLabel = prevItem.type === "folder" ? "
|
|
13364
|
+
const typeLabel = prevItem.type === "folder" ? "pasta" : "grupo de texto";
|
|
13365
13365
|
return isFolder ? prevItem.type === "folder" ? "Aninhar na pasta acima" : null : `Mover para dentro do ${typeLabel} acima`;
|
|
13366
13366
|
};
|
|
13367
13367
|
const getIndentDownTooltip = () => {
|
|
13368
13368
|
if (!nextItem) return null;
|
|
13369
|
-
const typeLabel = nextItem.type === "folder" ? "
|
|
13369
|
+
const typeLabel = nextItem.type === "folder" ? "pasta" : "grupo de texto";
|
|
13370
13370
|
return isFolder ? nextItem.type === "folder" ? "Aninhar na pasta abaixo" : null : `Mover para dentro do ${typeLabel} abaixo`;
|
|
13371
13371
|
};
|
|
13372
13372
|
const showIndentUp = !!getIndentUpTooltip();
|
|
@@ -13470,14 +13470,14 @@ var BoardItem = ({
|
|
|
13470
13470
|
onMentionClick,
|
|
13471
13471
|
searchItems,
|
|
13472
13472
|
readOnly: !canEdit,
|
|
13473
|
-
placeholder: "Escreva sobre este grupo\u2026 ou @ para mencionar"
|
|
13473
|
+
placeholder: "Escreva sobre este grupo de texto\u2026 ou @ para mencionar"
|
|
13474
13474
|
}
|
|
13475
13475
|
), canEdit && /* @__PURE__ */ React28.createElement("div", { className: "flex items-center justify-between pt-2 mt-1 border-t border-white/5 opacity-40 group-hover/item:opacity-100 transition-opacity" }, /* @__PURE__ */ React28.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React28.createElement(
|
|
13476
13476
|
"button",
|
|
13477
13477
|
{
|
|
13478
|
-
onClick: () => onAddSubgroup(item.id, "
|
|
13478
|
+
onClick: () => onAddSubgroup(item.id, "text_group"),
|
|
13479
13479
|
className: "flex items-center gap-1 px-1.5 py-1 text-[10px] uppercase font-bold tracking-wider text-slate-500 hover:text-white hover:bg-white/10 rounded transition-colors",
|
|
13480
|
-
title: "Criar Subgrupo"
|
|
13480
|
+
title: "Criar Subgrupo de Texto"
|
|
13481
13481
|
},
|
|
13482
13482
|
/* @__PURE__ */ React28.createElement(FiPlus10, { size: 12 }),
|
|
13483
13483
|
/* @__PURE__ */ React28.createElement("span", null, "Subgrupo")
|
|
@@ -13519,7 +13519,7 @@ var BoardItem = ({
|
|
|
13519
13519
|
className: `p-1.5 rounded transition-colors ${!onOutdent ? "text-slate-800 cursor-not-allowed" : "text-slate-500 hover:text-white hover:bg-white/10"}`
|
|
13520
13520
|
},
|
|
13521
13521
|
/* @__PURE__ */ React28.createElement(FiCornerUpLeft3, { size: 14 })
|
|
13522
|
-
)), /* @__PURE__ */ React28.createElement("div", { className: "w-px h-3 bg-white/10 mx-1" }), /* @__PURE__ */ React28.createElement(Tooltip, { text: "Remover Grupo" }, /* @__PURE__ */ React28.createElement(
|
|
13522
|
+
)), /* @__PURE__ */ React28.createElement("div", { className: "w-px h-3 bg-white/10 mx-1" }), /* @__PURE__ */ React28.createElement(Tooltip, { text: "Remover Grupo de Texto" }, /* @__PURE__ */ React28.createElement(
|
|
13523
13523
|
"button",
|
|
13524
13524
|
{
|
|
13525
13525
|
onClick: () => onDelete(item.id),
|
|
@@ -13556,29 +13556,35 @@ function AncestryBoard({
|
|
|
13556
13556
|
onSelect,
|
|
13557
13557
|
availableAncestries = [],
|
|
13558
13558
|
availableNodes = [],
|
|
13559
|
-
|
|
13559
|
+
initialBoardItems = [],
|
|
13560
13560
|
onSave,
|
|
13561
13561
|
userRole
|
|
13562
13562
|
}) {
|
|
13563
|
-
const [
|
|
13563
|
+
const [boardItems, setBoardItems] = useState27([]);
|
|
13564
13564
|
const [isLoaded, setIsLoaded] = useState27(false);
|
|
13565
13565
|
const [saveStatus, setSaveStatus] = useState27("idle");
|
|
13566
13566
|
const [navigationStack, setNavigationStack] = useState27([]);
|
|
13567
|
-
const
|
|
13567
|
+
const lastSavedBoardItemsRef = useRef20(null);
|
|
13568
13568
|
const canEdit = useMemo12(() => userRole !== "viewer", [userRole]);
|
|
13569
13569
|
useEffect23(() => {
|
|
13570
|
-
if (
|
|
13571
|
-
const
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13570
|
+
if (initialBoardItems && !isLoaded) {
|
|
13571
|
+
const hasLegacyTypes = (list) => list.some((g) => g.type === "group" || hasLegacyTypes(g.children || []));
|
|
13572
|
+
if (hasLegacyTypes(initialBoardItems)) {
|
|
13573
|
+
console.warn("Legacy AncestryBoard detected. Resetting board to empty list.");
|
|
13574
|
+
setBoardItems([]);
|
|
13575
|
+
} else {
|
|
13576
|
+
const prepare = (list) => list.map((g) => ({
|
|
13577
|
+
id: g.id || uuidv411(),
|
|
13578
|
+
type: g.type || "text_group",
|
|
13579
|
+
name: g.name || "",
|
|
13580
|
+
content: Array.isArray(g.content) ? g.content : [],
|
|
13581
|
+
children: prepare(g.children || [])
|
|
13582
|
+
}));
|
|
13583
|
+
setBoardItems(prepare(initialBoardItems));
|
|
13584
|
+
}
|
|
13579
13585
|
setIsLoaded(true);
|
|
13580
13586
|
}
|
|
13581
|
-
}, [
|
|
13587
|
+
}, [initialBoardItems, isLoaded]);
|
|
13582
13588
|
const allSearchableItems = useMemo12(() => {
|
|
13583
13589
|
const items = [];
|
|
13584
13590
|
availableAncestries.forEach((anc) => {
|
|
@@ -13605,23 +13611,23 @@ function AncestryBoard({
|
|
|
13605
13611
|
});
|
|
13606
13612
|
return items;
|
|
13607
13613
|
}, [availableAncestries, availableNodes]);
|
|
13608
|
-
const
|
|
13614
|
+
const sanitizeBoardItems = (list) => list.map((g) => ({
|
|
13609
13615
|
id: g.id,
|
|
13610
|
-
type: g.type || "
|
|
13616
|
+
type: g.type || "text_group",
|
|
13611
13617
|
name: g.name || "",
|
|
13612
13618
|
content: g.content || [],
|
|
13613
|
-
children:
|
|
13619
|
+
children: sanitizeBoardItems(g.children || [])
|
|
13614
13620
|
}));
|
|
13615
13621
|
useEffect23(() => {
|
|
13616
13622
|
if (!isLoaded || !onSave) return;
|
|
13617
13623
|
const id = setTimeout(async () => {
|
|
13618
|
-
const currentSanitized =
|
|
13624
|
+
const currentSanitized = sanitizeBoardItems(boardItems);
|
|
13619
13625
|
const currentJson = JSON.stringify(currentSanitized);
|
|
13620
|
-
if (currentJson ===
|
|
13626
|
+
if (currentJson === lastSavedBoardItemsRef.current) return;
|
|
13621
13627
|
setSaveStatus("saving");
|
|
13622
13628
|
try {
|
|
13623
13629
|
await onSave(currentSanitized);
|
|
13624
|
-
|
|
13630
|
+
lastSavedBoardItemsRef.current = currentJson;
|
|
13625
13631
|
setSaveStatus("saved");
|
|
13626
13632
|
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
13627
13633
|
} catch (err) {
|
|
@@ -13630,12 +13636,12 @@ function AncestryBoard({
|
|
|
13630
13636
|
}
|
|
13631
13637
|
}, 3e3);
|
|
13632
13638
|
return () => clearTimeout(id);
|
|
13633
|
-
}, [
|
|
13634
|
-
const triggerInstantSave = async (
|
|
13639
|
+
}, [boardItems, isLoaded, onSave]);
|
|
13640
|
+
const triggerInstantSave = async (updatedBoardItems) => {
|
|
13635
13641
|
if (!onSave) return;
|
|
13636
|
-
const sanitized =
|
|
13642
|
+
const sanitized = sanitizeBoardItems(updatedBoardItems);
|
|
13637
13643
|
const sanitizedJson = JSON.stringify(sanitized);
|
|
13638
|
-
|
|
13644
|
+
lastSavedBoardItemsRef.current = sanitizedJson;
|
|
13639
13645
|
setSaveStatus("saving");
|
|
13640
13646
|
try {
|
|
13641
13647
|
await onSave(sanitized);
|
|
@@ -13660,7 +13666,7 @@ function AncestryBoard({
|
|
|
13660
13666
|
}, [isOpen, onClose]);
|
|
13661
13667
|
const currentPath = useMemo12(() => {
|
|
13662
13668
|
const path = [];
|
|
13663
|
-
let currentLevel =
|
|
13669
|
+
let currentLevel = boardItems;
|
|
13664
13670
|
for (const folderId of navigationStack) {
|
|
13665
13671
|
const folder = currentLevel.find((f) => f.id === folderId);
|
|
13666
13672
|
if (folder) {
|
|
@@ -13669,11 +13675,11 @@ function AncestryBoard({
|
|
|
13669
13675
|
}
|
|
13670
13676
|
}
|
|
13671
13677
|
return path;
|
|
13672
|
-
}, [
|
|
13673
|
-
const
|
|
13678
|
+
}, [boardItems, navigationStack]);
|
|
13679
|
+
const currentBoardItems = useMemo12(() => {
|
|
13674
13680
|
const lastFolder = currentPath[currentPath.length - 1];
|
|
13675
|
-
return lastFolder ? lastFolder.children :
|
|
13676
|
-
}, [
|
|
13681
|
+
return lastFolder ? lastFolder.children : boardItems;
|
|
13682
|
+
}, [boardItems, currentPath]);
|
|
13677
13683
|
const navigateUp = () => {
|
|
13678
13684
|
setNavigationStack((prev) => prev.slice(0, -1));
|
|
13679
13685
|
};
|
|
@@ -13686,7 +13692,7 @@ function AncestryBoard({
|
|
|
13686
13692
|
const navigateHome = () => {
|
|
13687
13693
|
setNavigationStack([]);
|
|
13688
13694
|
};
|
|
13689
|
-
const handleAddItem = (type = "
|
|
13695
|
+
const handleAddItem = (type = "text_group") => {
|
|
13690
13696
|
const newItem = {
|
|
13691
13697
|
id: uuidv411(),
|
|
13692
13698
|
type,
|
|
@@ -13695,19 +13701,19 @@ function AncestryBoard({
|
|
|
13695
13701
|
children: []
|
|
13696
13702
|
};
|
|
13697
13703
|
if (navigationStack.length === 0) {
|
|
13698
|
-
|
|
13704
|
+
setBoardItems((prev) => [...prev, newItem]);
|
|
13699
13705
|
} else {
|
|
13700
13706
|
const parentId = navigationStack[navigationStack.length - 1];
|
|
13701
13707
|
const add = (list) => list.map(
|
|
13702
13708
|
(g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
|
|
13703
13709
|
);
|
|
13704
|
-
|
|
13710
|
+
setBoardItems((prev) => add(prev));
|
|
13705
13711
|
}
|
|
13706
13712
|
};
|
|
13707
|
-
const handleAddSubgroup = (parentId, type = "
|
|
13713
|
+
const handleAddSubgroup = (parentId, type = "text_group") => {
|
|
13708
13714
|
const add = (list) => list.map((g) => {
|
|
13709
13715
|
if (g.id === parentId) {
|
|
13710
|
-
if (g.type === "
|
|
13716
|
+
if (g.type === "text_group" && type === "folder") return g;
|
|
13711
13717
|
const newItem = {
|
|
13712
13718
|
id: uuidv411(),
|
|
13713
13719
|
type,
|
|
@@ -13719,17 +13725,17 @@ function AncestryBoard({
|
|
|
13719
13725
|
}
|
|
13720
13726
|
return { ...g, children: add(g.children) };
|
|
13721
13727
|
});
|
|
13722
|
-
|
|
13728
|
+
setBoardItems((prev) => add(prev));
|
|
13723
13729
|
};
|
|
13724
13730
|
const handleUpdateItem = (id, newData) => {
|
|
13725
13731
|
const update = (list) => list.map(
|
|
13726
13732
|
(g) => g.id === id ? newData : { ...g, children: update(g.children) }
|
|
13727
13733
|
);
|
|
13728
|
-
|
|
13734
|
+
setBoardItems((prev) => update(prev));
|
|
13729
13735
|
};
|
|
13730
13736
|
const handleDeleteItem = (id) => {
|
|
13731
13737
|
const del = (list) => list.filter((g) => g.id !== id).map((g) => ({ ...g, children: del(g.children) }));
|
|
13732
|
-
|
|
13738
|
+
setBoardItems((prev) => del(prev));
|
|
13733
13739
|
};
|
|
13734
13740
|
const findGroupAndParent = (list, targetId, parent = null) => {
|
|
13735
13741
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -13743,35 +13749,35 @@ function AncestryBoard({
|
|
|
13743
13749
|
return null;
|
|
13744
13750
|
};
|
|
13745
13751
|
const handleIndent = (id) => {
|
|
13746
|
-
const next = JSON.parse(JSON.stringify(
|
|
13752
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13747
13753
|
const found = findGroupAndParent(next, id);
|
|
13748
13754
|
if (!found || found.index === 0) return;
|
|
13749
13755
|
const { group, siblings, index } = found;
|
|
13750
13756
|
const targetParent = siblings[index - 1];
|
|
13751
|
-
if (group.type === "folder" && targetParent.type === "
|
|
13757
|
+
if (group.type === "folder" && targetParent.type === "text_group") {
|
|
13752
13758
|
return;
|
|
13753
13759
|
}
|
|
13754
13760
|
siblings.splice(index, 1);
|
|
13755
13761
|
targetParent.children.push(group);
|
|
13756
|
-
|
|
13762
|
+
setBoardItems(next);
|
|
13757
13763
|
triggerInstantSave(next);
|
|
13758
13764
|
};
|
|
13759
13765
|
const handleIndentDown = (id) => {
|
|
13760
|
-
const next = JSON.parse(JSON.stringify(
|
|
13766
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13761
13767
|
const found = findGroupAndParent(next, id);
|
|
13762
13768
|
if (!found || found.index === found.siblings.length - 1) return;
|
|
13763
13769
|
const { group, siblings, index } = found;
|
|
13764
13770
|
const targetParent = siblings[index + 1];
|
|
13765
|
-
if (group.type === "folder" && targetParent.type === "
|
|
13771
|
+
if (group.type === "folder" && targetParent.type === "text_group") {
|
|
13766
13772
|
return;
|
|
13767
13773
|
}
|
|
13768
13774
|
siblings.splice(index, 1);
|
|
13769
13775
|
targetParent.children.push(group);
|
|
13770
|
-
|
|
13776
|
+
setBoardItems(next);
|
|
13771
13777
|
triggerInstantSave(next);
|
|
13772
13778
|
};
|
|
13773
13779
|
const handleOutdent = (id) => {
|
|
13774
|
-
const next = JSON.parse(JSON.stringify(
|
|
13780
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13775
13781
|
const found = findGroupAndParent(next, id);
|
|
13776
13782
|
if (!found || !found.parent) return;
|
|
13777
13783
|
const { group, siblings, index, parent } = found;
|
|
@@ -13782,29 +13788,29 @@ function AncestryBoard({
|
|
|
13782
13788
|
} else {
|
|
13783
13789
|
next.push(group);
|
|
13784
13790
|
}
|
|
13785
|
-
|
|
13791
|
+
setBoardItems(next);
|
|
13786
13792
|
triggerInstantSave(next);
|
|
13787
13793
|
};
|
|
13788
13794
|
const handleMoveUp = (id) => {
|
|
13789
|
-
const next = JSON.parse(JSON.stringify(
|
|
13795
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13790
13796
|
const found = findGroupAndParent(next, id);
|
|
13791
13797
|
if (!found || found.index === 0) return;
|
|
13792
13798
|
const { siblings, index } = found;
|
|
13793
13799
|
const item = siblings[index];
|
|
13794
13800
|
siblings.splice(index, 1);
|
|
13795
13801
|
siblings.splice(index - 1, 0, item);
|
|
13796
|
-
|
|
13802
|
+
setBoardItems(next);
|
|
13797
13803
|
triggerInstantSave(next);
|
|
13798
13804
|
};
|
|
13799
13805
|
const handleMoveDown = (id) => {
|
|
13800
|
-
const next = JSON.parse(JSON.stringify(
|
|
13806
|
+
const next = JSON.parse(JSON.stringify(boardItems));
|
|
13801
13807
|
const found = findGroupAndParent(next, id);
|
|
13802
13808
|
if (!found || found.index === found.siblings.length - 1) return;
|
|
13803
13809
|
const { siblings, index } = found;
|
|
13804
13810
|
const item = siblings[index];
|
|
13805
13811
|
siblings.splice(index, 1);
|
|
13806
13812
|
siblings.splice(index + 1, 0, item);
|
|
13807
|
-
|
|
13813
|
+
setBoardItems(next);
|
|
13808
13814
|
triggerInstantSave(next);
|
|
13809
13815
|
};
|
|
13810
13816
|
const handleMentionClick = (item) => {
|
|
@@ -13834,11 +13840,11 @@ function AncestryBoard({
|
|
|
13834
13840
|
), /* @__PURE__ */ React28.createElement(
|
|
13835
13841
|
"button",
|
|
13836
13842
|
{
|
|
13837
|
-
onClick: () => handleAddItem("
|
|
13843
|
+
onClick: () => handleAddItem("text_group"),
|
|
13838
13844
|
className: "flex items-center gap-2 px-3 py-1.5 bg-white/5 hover:bg-white/10 border border-white/10 hover:border-white/20 backdrop-blur-sm text-slate-200 hover:text-white rounded-md transition-all duration-200 text-xs font-medium shadow-sm"
|
|
13839
13845
|
},
|
|
13840
13846
|
/* @__PURE__ */ React28.createElement(FiPlus10, { size: 14, className: "text-indigo-400" }),
|
|
13841
|
-
/* @__PURE__ */ React28.createElement("span", { className: "hidden sm:inline" }, "Novo Grupo")
|
|
13847
|
+
/* @__PURE__ */ React28.createElement("span", { className: "hidden sm:inline" }, "Novo Grupo de Texto")
|
|
13842
13848
|
)), /* @__PURE__ */ React28.createElement(
|
|
13843
13849
|
"button",
|
|
13844
13850
|
{
|
|
@@ -13870,13 +13876,13 @@ function AncestryBoard({
|
|
|
13870
13876
|
/* @__PURE__ */ React28.createElement(FiArrowLeft3, { size: 10 }),
|
|
13871
13877
|
/* @__PURE__ */ React28.createElement("span", null, "Voltar")
|
|
13872
13878
|
))),
|
|
13873
|
-
/* @__PURE__ */ React28.createElement("div", { className: "flex-1 overflow-y-auto custom-scrollbar bg-slate-950/30 p-6 space-y-4" },
|
|
13879
|
+
/* @__PURE__ */ React28.createElement("div", { className: "flex-1 overflow-y-auto custom-scrollbar bg-slate-950/30 p-6 space-y-4" }, currentBoardItems.length === 0 ? /* @__PURE__ */ React28.createElement("div", { className: "flex flex-col items-center justify-center h-full text-slate-500 gap-3 border-2 border-dashed border-white/5 rounded-xl bg-slate-900/20" }, /* @__PURE__ */ React28.createElement(FiLayers7, { size: 24, className: "opacity-20" }), /* @__PURE__ */ React28.createElement("p", { className: "text-xs text-center px-4" }, canEdit ? /* @__PURE__ */ React28.createElement(React28.Fragment, null, "Esta pasta est\xE1 vazia.", /* @__PURE__ */ React28.createElement("br", null), "Use os bot\xF5es acima para criar conte\xFAdo.") : /* @__PURE__ */ React28.createElement(React28.Fragment, null, "Nenhum conte\xFAdo dispon\xEDvel nesta pasta."))) : currentBoardItems.map((item, index) => /* @__PURE__ */ React28.createElement(
|
|
13874
13880
|
BoardItem,
|
|
13875
13881
|
{
|
|
13876
13882
|
key: item.id,
|
|
13877
13883
|
index,
|
|
13878
|
-
prevItem:
|
|
13879
|
-
nextItem:
|
|
13884
|
+
prevItem: currentBoardItems[index - 1],
|
|
13885
|
+
nextItem: currentBoardItems[index + 1],
|
|
13880
13886
|
item,
|
|
13881
13887
|
onUpdate: handleUpdateItem,
|
|
13882
13888
|
onDelete: handleDeleteItem,
|
|
@@ -13893,7 +13899,7 @@ function AncestryBoard({
|
|
|
13893
13899
|
isAtRoot: navigationStack.length === 0
|
|
13894
13900
|
}
|
|
13895
13901
|
))),
|
|
13896
|
-
/* @__PURE__ */ React28.createElement("div", { className: "px-5 py-2 border-t border-white/10 bg-slate-950/50 text-xs text-slate-500 flex justify-end flex-shrink-0" }, /* @__PURE__ */ React28.createElement("span", null,
|
|
13902
|
+
/* @__PURE__ */ React28.createElement("div", { className: "px-5 py-2 border-t border-white/10 bg-slate-950/50 text-xs text-slate-500 flex justify-end flex-shrink-0" }, /* @__PURE__ */ React28.createElement("span", null, currentBoardItems.length, " itens nesta visualiza\xE7\xE3o"))
|
|
13897
13903
|
)
|
|
13898
13904
|
);
|
|
13899
13905
|
}
|
|
@@ -14239,7 +14245,7 @@ function XViewScene({
|
|
|
14239
14245
|
const [invalidTargetError, setInvalidTargetError] = useState29(null);
|
|
14240
14246
|
const [highlightedNodeId, setHighlightedNodeId] = useState29(null);
|
|
14241
14247
|
const [isAncestryBoardOpen, setIsAncestryBoardOpen] = useState29(false);
|
|
14242
|
-
const [
|
|
14248
|
+
const [boardItems, setBoardItems] = useState29([]);
|
|
14243
14249
|
const [isSidebarOpen, setIsSidebarOpen] = useState29(false);
|
|
14244
14250
|
const [isMilestoneManagerOpen, setIsMilestoneManagerOpen] = useState29(false);
|
|
14245
14251
|
const mountRef = useRef21(null);
|
|
@@ -18126,13 +18132,13 @@ function XViewScene({
|
|
|
18126
18132
|
[handleStartReadingAncestry, handleOpenReference]
|
|
18127
18133
|
);
|
|
18128
18134
|
const handleSaveAncestryBoard = useCallback5(
|
|
18129
|
-
async (
|
|
18135
|
+
async (boardItems2) => {
|
|
18130
18136
|
if (!sceneConfigId || !viewParams || !session) return;
|
|
18131
18137
|
const sceneType = (viewParams.type || "").toLowerCase().includes("database") ? "database" : "view";
|
|
18132
18138
|
await save_ancestry_board_action(
|
|
18133
18139
|
sceneConfigId,
|
|
18134
18140
|
sceneType,
|
|
18135
|
-
|
|
18141
|
+
boardItems2,
|
|
18136
18142
|
session,
|
|
18137
18143
|
ownerId
|
|
18138
18144
|
);
|
|
@@ -18947,7 +18953,7 @@ function XViewScene({
|
|
|
18947
18953
|
onSelect: handleSelectAncestryFromBoard,
|
|
18948
18954
|
availableAncestries: allAvailableAncestries,
|
|
18949
18955
|
availableNodes: allAvailableNodes,
|
|
18950
|
-
|
|
18956
|
+
initialBoardItems: boardItems,
|
|
18951
18957
|
onSave: handleSaveAncestryBoard,
|
|
18952
18958
|
userRole: userPermissionRole
|
|
18953
18959
|
}
|
|
@@ -19446,10 +19452,10 @@ async function get_ancestry_file_logic(db_services, file_id, owner_id) {
|
|
|
19446
19452
|
return { success: false, error: error.message };
|
|
19447
19453
|
}
|
|
19448
19454
|
}
|
|
19449
|
-
async function save_ancestry_board_logic(db_services, scene_id, type,
|
|
19455
|
+
async function save_ancestry_board_logic(db_services, scene_id, type, boardItems, session, owner_id) {
|
|
19450
19456
|
try {
|
|
19451
19457
|
const targetOwnerId = owner_id || session.user.id;
|
|
19452
|
-
return await db_services.save_ancestry_board(session, scene_id, type,
|
|
19458
|
+
return await db_services.save_ancestry_board(session, scene_id, type, boardItems, targetOwnerId);
|
|
19453
19459
|
} catch (error) {
|
|
19454
19460
|
console.error("Erro em save_ancestry_board_logic:", error);
|
|
19455
19461
|
return { success: false, error: error.message };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.6-dev.
|
|
3
|
+
"version": "1.2.6-dev.25",
|
|
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",
|