@lv-x-software-house/x_view 1.2.6-dev.18 → 1.2.6-dev.19

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 CHANGED
@@ -13481,6 +13481,7 @@ function AncestryBoard({
13481
13481
  const [isLoaded, setIsLoaded] = (0, import_react29.useState)(false);
13482
13482
  const [saveStatus, setSaveStatus] = (0, import_react29.useState)("idle");
13483
13483
  const [navigationStack, setNavigationStack] = (0, import_react29.useState)([]);
13484
+ const lastSavedGroupsRef = (0, import_react29.useRef)(null);
13484
13485
  const canEdit = (0, import_react29.useMemo)(() => userRole !== "viewer", [userRole]);
13485
13486
  (0, import_react29.useEffect)(() => {
13486
13487
  if (initialGroups && !isLoaded) {
@@ -13531,9 +13532,13 @@ function AncestryBoard({
13531
13532
  (0, import_react29.useEffect)(() => {
13532
13533
  if (!isLoaded || !onSave) return;
13533
13534
  const id = setTimeout(async () => {
13535
+ const currentSanitized = sanitizeGroups(groups);
13536
+ const currentJson = JSON.stringify(currentSanitized);
13537
+ if (currentJson === lastSavedGroupsRef.current) return;
13534
13538
  setSaveStatus("saving");
13535
13539
  try {
13536
- await onSave(sanitizeGroups(groups));
13540
+ await onSave(currentSanitized);
13541
+ lastSavedGroupsRef.current = currentJson;
13537
13542
  setSaveStatus("saved");
13538
13543
  setTimeout(() => setSaveStatus("idle"), 3e3);
13539
13544
  } catch (err) {
@@ -13545,9 +13550,12 @@ function AncestryBoard({
13545
13550
  }, [groups, isLoaded, onSave]);
13546
13551
  const triggerInstantSave = async (updatedGroups) => {
13547
13552
  if (!onSave) return;
13553
+ const sanitized = sanitizeGroups(updatedGroups);
13554
+ const sanitizedJson = JSON.stringify(sanitized);
13555
+ lastSavedGroupsRef.current = sanitizedJson;
13548
13556
  setSaveStatus("saving");
13549
13557
  try {
13550
- await onSave(sanitizeGroups(updatedGroups));
13558
+ await onSave(sanitized);
13551
13559
  setSaveStatus("saved");
13552
13560
  setTimeout(() => setSaveStatus("idle"), 3e3);
13553
13561
  } catch (err) {
@@ -13652,63 +13660,55 @@ function AncestryBoard({
13652
13660
  return null;
13653
13661
  };
13654
13662
  const handleIndent = (id) => {
13655
- setGroups((prev) => {
13656
- const next = JSON.parse(JSON.stringify(prev));
13657
- const found = findGroupAndParent(next, id);
13658
- if (!found || found.index === 0) return prev;
13659
- const { group, siblings, index } = found;
13660
- const targetParent = siblings[index - 1];
13661
- if (group.type === "folder" && targetParent.type === "group") {
13662
- return prev;
13663
- }
13664
- siblings.splice(index, 1);
13665
- targetParent.children.push(group);
13666
- triggerInstantSave(next);
13667
- return next;
13668
- });
13663
+ const next = JSON.parse(JSON.stringify(groups));
13664
+ const found = findGroupAndParent(next, id);
13665
+ if (!found || found.index === 0) return;
13666
+ const { group, siblings, index } = found;
13667
+ const targetParent = siblings[index - 1];
13668
+ if (group.type === "folder" && targetParent.type === "group") {
13669
+ return;
13670
+ }
13671
+ siblings.splice(index, 1);
13672
+ targetParent.children.push(group);
13673
+ setGroups(next);
13674
+ triggerInstantSave(next);
13669
13675
  };
13670
13676
  const handleOutdent = (id) => {
13671
- setGroups((prev) => {
13672
- const next = JSON.parse(JSON.stringify(prev));
13673
- const found = findGroupAndParent(next, id);
13674
- if (!found || !found.parent) return prev;
13675
- const { group, siblings, index, parent } = found;
13676
- siblings.splice(index, 1);
13677
- const parentFound = findGroupAndParent(next, parent.id);
13678
- if (parentFound) {
13679
- parentFound.siblings.splice(parentFound.index + 1, 0, group);
13680
- } else {
13681
- next.push(group);
13682
- }
13683
- triggerInstantSave(next);
13684
- return next;
13685
- });
13677
+ const next = JSON.parse(JSON.stringify(groups));
13678
+ const found = findGroupAndParent(next, id);
13679
+ if (!found || !found.parent) return;
13680
+ const { group, siblings, index, parent } = found;
13681
+ siblings.splice(index, 1);
13682
+ const parentFound = findGroupAndParent(next, parent.id);
13683
+ if (parentFound) {
13684
+ parentFound.siblings.splice(parentFound.index + 1, 0, group);
13685
+ } else {
13686
+ next.push(group);
13687
+ }
13688
+ setGroups(next);
13689
+ triggerInstantSave(next);
13686
13690
  };
13687
13691
  const handleMoveUp = (id) => {
13688
- setGroups((prev) => {
13689
- const next = JSON.parse(JSON.stringify(prev));
13690
- const found = findGroupAndParent(next, id);
13691
- if (!found || found.index === 0) return prev;
13692
- const { siblings, index } = found;
13693
- const item = siblings[index];
13694
- siblings.splice(index, 1);
13695
- siblings.splice(index - 1, 0, item);
13696
- triggerInstantSave(next);
13697
- return next;
13698
- });
13692
+ const next = JSON.parse(JSON.stringify(groups));
13693
+ const found = findGroupAndParent(next, id);
13694
+ if (!found || found.index === 0) return;
13695
+ const { siblings, index } = found;
13696
+ const item = siblings[index];
13697
+ siblings.splice(index, 1);
13698
+ siblings.splice(index - 1, 0, item);
13699
+ setGroups(next);
13700
+ triggerInstantSave(next);
13699
13701
  };
13700
13702
  const handleMoveDown = (id) => {
13701
- setGroups((prev) => {
13702
- const next = JSON.parse(JSON.stringify(prev));
13703
- const found = findGroupAndParent(next, id);
13704
- if (!found || found.index === found.siblings.length - 1) return prev;
13705
- const { siblings, index } = found;
13706
- const item = siblings[index];
13707
- siblings.splice(index, 1);
13708
- siblings.splice(index + 1, 0, item);
13709
- triggerInstantSave(next);
13710
- return next;
13711
- });
13703
+ const next = JSON.parse(JSON.stringify(groups));
13704
+ const found = findGroupAndParent(next, id);
13705
+ if (!found || found.index === found.siblings.length - 1) return;
13706
+ const { siblings, index } = found;
13707
+ const item = siblings[index];
13708
+ siblings.splice(index, 1);
13709
+ siblings.splice(index + 1, 0, item);
13710
+ setGroups(next);
13711
+ triggerInstantSave(next);
13712
13712
  };
13713
13713
  const handleMentionClick = (item) => {
13714
13714
  if (onSelect) onSelect(item);
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import React30, {
3
3
  useCallback as useCallback5,
4
4
  useEffect as useEffect24,
5
- useRef as useRef20,
5
+ useRef as useRef21,
6
6
  useState as useState29,
7
7
  useMemo as useMemo13
8
8
  } from "react";
@@ -12950,7 +12950,7 @@ function AncestryLinkDetailsPanel({ data, onClose, onOpenImageViewer, onOpenRefe
12950
12950
  }
12951
12951
 
12952
12952
  // src/components/AncestryBoard.jsx
12953
- import React28, { useState as useState27, useMemo as useMemo12, useEffect as useEffect23 } from "react";
12953
+ import React28, { useState as useState27, useMemo as useMemo12, useEffect as useEffect23, useRef as useRef20 } from "react";
12954
12954
  import {
12955
12955
  FiSearch as FiSearch8,
12956
12956
  FiLayers as FiLayers7,
@@ -13531,6 +13531,7 @@ function AncestryBoard({
13531
13531
  const [isLoaded, setIsLoaded] = useState27(false);
13532
13532
  const [saveStatus, setSaveStatus] = useState27("idle");
13533
13533
  const [navigationStack, setNavigationStack] = useState27([]);
13534
+ const lastSavedGroupsRef = useRef20(null);
13534
13535
  const canEdit = useMemo12(() => userRole !== "viewer", [userRole]);
13535
13536
  useEffect23(() => {
13536
13537
  if (initialGroups && !isLoaded) {
@@ -13581,9 +13582,13 @@ function AncestryBoard({
13581
13582
  useEffect23(() => {
13582
13583
  if (!isLoaded || !onSave) return;
13583
13584
  const id = setTimeout(async () => {
13585
+ const currentSanitized = sanitizeGroups(groups);
13586
+ const currentJson = JSON.stringify(currentSanitized);
13587
+ if (currentJson === lastSavedGroupsRef.current) return;
13584
13588
  setSaveStatus("saving");
13585
13589
  try {
13586
- await onSave(sanitizeGroups(groups));
13590
+ await onSave(currentSanitized);
13591
+ lastSavedGroupsRef.current = currentJson;
13587
13592
  setSaveStatus("saved");
13588
13593
  setTimeout(() => setSaveStatus("idle"), 3e3);
13589
13594
  } catch (err) {
@@ -13595,9 +13600,12 @@ function AncestryBoard({
13595
13600
  }, [groups, isLoaded, onSave]);
13596
13601
  const triggerInstantSave = async (updatedGroups) => {
13597
13602
  if (!onSave) return;
13603
+ const sanitized = sanitizeGroups(updatedGroups);
13604
+ const sanitizedJson = JSON.stringify(sanitized);
13605
+ lastSavedGroupsRef.current = sanitizedJson;
13598
13606
  setSaveStatus("saving");
13599
13607
  try {
13600
- await onSave(sanitizeGroups(updatedGroups));
13608
+ await onSave(sanitized);
13601
13609
  setSaveStatus("saved");
13602
13610
  setTimeout(() => setSaveStatus("idle"), 3e3);
13603
13611
  } catch (err) {
@@ -13702,63 +13710,55 @@ function AncestryBoard({
13702
13710
  return null;
13703
13711
  };
13704
13712
  const handleIndent = (id) => {
13705
- setGroups((prev) => {
13706
- const next = JSON.parse(JSON.stringify(prev));
13707
- const found = findGroupAndParent(next, id);
13708
- if (!found || found.index === 0) return prev;
13709
- const { group, siblings, index } = found;
13710
- const targetParent = siblings[index - 1];
13711
- if (group.type === "folder" && targetParent.type === "group") {
13712
- return prev;
13713
- }
13714
- siblings.splice(index, 1);
13715
- targetParent.children.push(group);
13716
- triggerInstantSave(next);
13717
- return next;
13718
- });
13713
+ const next = JSON.parse(JSON.stringify(groups));
13714
+ const found = findGroupAndParent(next, id);
13715
+ if (!found || found.index === 0) return;
13716
+ const { group, siblings, index } = found;
13717
+ const targetParent = siblings[index - 1];
13718
+ if (group.type === "folder" && targetParent.type === "group") {
13719
+ return;
13720
+ }
13721
+ siblings.splice(index, 1);
13722
+ targetParent.children.push(group);
13723
+ setGroups(next);
13724
+ triggerInstantSave(next);
13719
13725
  };
13720
13726
  const handleOutdent = (id) => {
13721
- setGroups((prev) => {
13722
- const next = JSON.parse(JSON.stringify(prev));
13723
- const found = findGroupAndParent(next, id);
13724
- if (!found || !found.parent) return prev;
13725
- const { group, siblings, index, parent } = found;
13726
- siblings.splice(index, 1);
13727
- const parentFound = findGroupAndParent(next, parent.id);
13728
- if (parentFound) {
13729
- parentFound.siblings.splice(parentFound.index + 1, 0, group);
13730
- } else {
13731
- next.push(group);
13732
- }
13733
- triggerInstantSave(next);
13734
- return next;
13735
- });
13727
+ const next = JSON.parse(JSON.stringify(groups));
13728
+ const found = findGroupAndParent(next, id);
13729
+ if (!found || !found.parent) return;
13730
+ const { group, siblings, index, parent } = found;
13731
+ siblings.splice(index, 1);
13732
+ const parentFound = findGroupAndParent(next, parent.id);
13733
+ if (parentFound) {
13734
+ parentFound.siblings.splice(parentFound.index + 1, 0, group);
13735
+ } else {
13736
+ next.push(group);
13737
+ }
13738
+ setGroups(next);
13739
+ triggerInstantSave(next);
13736
13740
  };
13737
13741
  const handleMoveUp = (id) => {
13738
- setGroups((prev) => {
13739
- const next = JSON.parse(JSON.stringify(prev));
13740
- const found = findGroupAndParent(next, id);
13741
- if (!found || found.index === 0) return prev;
13742
- const { siblings, index } = found;
13743
- const item = siblings[index];
13744
- siblings.splice(index, 1);
13745
- siblings.splice(index - 1, 0, item);
13746
- triggerInstantSave(next);
13747
- return next;
13748
- });
13742
+ const next = JSON.parse(JSON.stringify(groups));
13743
+ const found = findGroupAndParent(next, id);
13744
+ if (!found || found.index === 0) return;
13745
+ const { siblings, index } = found;
13746
+ const item = siblings[index];
13747
+ siblings.splice(index, 1);
13748
+ siblings.splice(index - 1, 0, item);
13749
+ setGroups(next);
13750
+ triggerInstantSave(next);
13749
13751
  };
13750
13752
  const handleMoveDown = (id) => {
13751
- setGroups((prev) => {
13752
- const next = JSON.parse(JSON.stringify(prev));
13753
- const found = findGroupAndParent(next, id);
13754
- if (!found || found.index === found.siblings.length - 1) return prev;
13755
- const { siblings, index } = found;
13756
- const item = siblings[index];
13757
- siblings.splice(index, 1);
13758
- siblings.splice(index + 1, 0, item);
13759
- triggerInstantSave(next);
13760
- return next;
13761
- });
13753
+ const next = JSON.parse(JSON.stringify(groups));
13754
+ const found = findGroupAndParent(next, id);
13755
+ if (!found || found.index === found.siblings.length - 1) return;
13756
+ const { siblings, index } = found;
13757
+ const item = siblings[index];
13758
+ siblings.splice(index, 1);
13759
+ siblings.splice(index + 1, 0, item);
13760
+ setGroups(next);
13761
+ triggerInstantSave(next);
13762
13762
  };
13763
13763
  const handleMentionClick = (item) => {
13764
13764
  if (onSelect) onSelect(item);
@@ -14110,9 +14110,9 @@ function XViewScene({
14110
14110
  }
14111
14111
  return null;
14112
14112
  }, [ownerId, sceneConfigId]);
14113
- const sceneDataRef = useRef20(null);
14114
- const parentDataRef = useRef20(null);
14115
- const ancestryDataRef = useRef20(null);
14113
+ const sceneDataRef = useRef21(null);
14114
+ const parentDataRef = useRef21(null);
14115
+ const ancestryDataRef = useRef21(null);
14116
14116
  const [isLoading, setIsLoading] = useState29(true);
14117
14117
  const [permissionStatus, setPermissionStatus] = useState29("loading");
14118
14118
  const [userPermissionRole, setUserPermissionRole] = useState29(null);
@@ -14191,10 +14191,10 @@ function XViewScene({
14191
14191
  const [ancestryBoardData, setAncestryBoardData] = useState29([]);
14192
14192
  const [isSidebarOpen, setIsSidebarOpen] = useState29(false);
14193
14193
  const [isMilestoneManagerOpen, setIsMilestoneManagerOpen] = useState29(false);
14194
- const mountRef = useRef20(null);
14195
- const tooltipRef = useRef20(null);
14196
- const formRef = useRef20(null);
14197
- const stateRef = useRef20({
14194
+ const mountRef = useRef21(null);
14195
+ const tooltipRef = useRef21(null);
14196
+ const formRef = useRef21(null);
14197
+ const stateRef = useRef21({
14198
14198
  readMode: {
14199
14199
  currentMaxIndex: 0,
14200
14200
  progressMap: {}
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.18",
3
+ "version": "1.2.6-dev.19",
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",