pixel-react 1.10.10-0 → 1.10.10-1
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/lib/components/Excel/ExcelFile/ExcelFile.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +38 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +38 -9
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +1 -1
- package/src/components/TableTree/TableTree.stories.tsx +1 -0
- package/src/components/TableTree/TableTree.tsx +49 -13
@@ -57,7 +57,7 @@ interface ExcelFileProps {
|
|
57
57
|
/**
|
58
58
|
* Delay time (in milliseconds) before the onSave callback is executed.
|
59
59
|
*/
|
60
|
-
onSaveDelay
|
60
|
+
onSaveDelay?: number;
|
61
61
|
/**
|
62
62
|
* Optional: Sets the vertical (Y-axis) positioning of the context menu.
|
63
63
|
* This allows precise control over where the context menu appears on the screen.
|
package/lib/index.d.ts
CHANGED
@@ -2741,7 +2741,7 @@ interface ExcelFileProps {
|
|
2741
2741
|
/**
|
2742
2742
|
* Delay time (in milliseconds) before the onSave callback is executed.
|
2743
2743
|
*/
|
2744
|
-
onSaveDelay
|
2744
|
+
onSaveDelay?: number;
|
2745
2745
|
/**
|
2746
2746
|
* Optional: Sets the vertical (Y-axis) positioning of the context menu.
|
2747
2747
|
* This allows precise control over where the context menu appears on the screen.
|
package/lib/index.esm.js
CHANGED
@@ -14859,7 +14859,9 @@ const TreeTable = ({
|
|
14859
14859
|
onAddCancel = () => {}
|
14860
14860
|
}) => {
|
14861
14861
|
const observerRef = useRef(null);
|
14862
|
-
const
|
14862
|
+
const isTriggeredAbove = useRef(false); // Track if pagination for "above" direction has been triggered
|
14863
|
+
const isTriggeredBelow = useRef(false); // Track if pagination for "below" direction has been triggered
|
14864
|
+
const isTriggeredOnce = useRef(false); // Ensure 2-second delay triggers only once
|
14863
14865
|
// Throttled version of loadMore
|
14864
14866
|
const throttledLoadMore = useRef(throttle(direction => {
|
14865
14867
|
loadMore(direction);
|
@@ -14872,19 +14874,25 @@ const TreeTable = ({
|
|
14872
14874
|
if (!scrollContainer || !firstNode || !lastNode || !treeData?.length) return;
|
14873
14875
|
const isLastResourceAbove = treeData[0]?.lastResource;
|
14874
14876
|
const isLastResourceBelow = treeData[treeData.length - 1]?.lastResource;
|
14877
|
+
// Skip pagination if both last resources are present
|
14875
14878
|
if (isLastResourceAbove && isLastResourceBelow) return;
|
14876
14879
|
const observerCallback = entries => {
|
14877
14880
|
entries.forEach(entry => {
|
14878
14881
|
const nodeId = entry.target.id;
|
14879
14882
|
const direction = nodeId === 'ff-table-tree-last-node' ? 'below' : 'above';
|
14880
14883
|
if (entry.isIntersecting) {
|
14881
|
-
|
14882
|
-
|
14883
|
-
|
14884
|
+
// Trigger only once for each direction
|
14885
|
+
if (direction === 'above' && !isTriggeredAbove.current) {
|
14886
|
+
if (!isLastResourceAbove) {
|
14887
|
+
throttledLoadMore(direction);
|
14888
|
+
isTriggeredAbove.current = true;
|
14889
|
+
}
|
14890
|
+
} else if (direction === 'below' && !isTriggeredBelow.current) {
|
14891
|
+
if (!isLastResourceBelow) {
|
14892
|
+
throttledLoadMore(direction);
|
14893
|
+
isTriggeredBelow.current = true;
|
14894
|
+
}
|
14884
14895
|
}
|
14885
|
-
} else {
|
14886
|
-
// Remove node from triggered set when it goes out of view
|
14887
|
-
triggeredNodesRef.current.delete(nodeId);
|
14888
14896
|
}
|
14889
14897
|
});
|
14890
14898
|
};
|
@@ -14893,8 +14901,29 @@ const TreeTable = ({
|
|
14893
14901
|
rootMargin: '8px',
|
14894
14902
|
threshold: 0.1
|
14895
14903
|
});
|
14896
|
-
if
|
14897
|
-
|
14904
|
+
// Initial pagination trigger after 2 seconds if first or last node is in view inside the scroll container
|
14905
|
+
const checkInitialPaginationTrigger = () => {
|
14906
|
+
if (isTriggeredOnce.current) return;
|
14907
|
+
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
14908
|
+
const firstNodeRect = firstNode?.getBoundingClientRect();
|
14909
|
+
const lastNodeRect = lastNode?.getBoundingClientRect();
|
14910
|
+
// Check if the first node is inside the scroll container
|
14911
|
+
const isFirstNodeInView = firstNodeRect && firstNodeRect.top >= scrollContainerRect.top && firstNodeRect.bottom <= scrollContainerRect.bottom;
|
14912
|
+
// Check if the last node is inside the scroll container
|
14913
|
+
const isLastNodeInView = lastNodeRect && lastNodeRect.top >= scrollContainerRect.top && lastNodeRect.bottom <= scrollContainerRect.bottom;
|
14914
|
+
if (isFirstNodeInView || isLastNodeInView) {
|
14915
|
+
isTriggeredOnce.current = true;
|
14916
|
+
setTimeout(() => {
|
14917
|
+
if (!isLastResourceAbove) observerRef.current?.observe(firstNode);
|
14918
|
+
if (!isLastResourceBelow) observerRef.current?.observe(lastNode);
|
14919
|
+
}, 2000); // Delay the first pagination trigger by 2 seconds
|
14920
|
+
} else {
|
14921
|
+
// Observe first and last node immediately
|
14922
|
+
if (!isLastResourceAbove) observerRef.current?.observe(firstNode);
|
14923
|
+
if (!isLastResourceBelow) observerRef.current?.observe(lastNode);
|
14924
|
+
}
|
14925
|
+
};
|
14926
|
+
checkInitialPaginationTrigger();
|
14898
14927
|
return () => {
|
14899
14928
|
observerRef.current?.disconnect();
|
14900
14929
|
throttledLoadMore.cancel();
|