adminforth 2.1.0-next.20 → 2.1.0-next.21
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.
|
@@ -658,6 +658,15 @@ const calculateVisibleRows = () => {
|
|
|
658
658
|
const buffer = props.bufferSize || 5;
|
|
659
659
|
const containerHeight = props.containerHeight || 900;
|
|
660
660
|
|
|
661
|
+
// For single item or small datasets, show all rows
|
|
662
|
+
if (props.rows.length <= buffer * 2 + 1) {
|
|
663
|
+
startIndex.value = 0;
|
|
664
|
+
endIndex.value = props.rows.length - 1;
|
|
665
|
+
visibleRows.value = props.rows;
|
|
666
|
+
spacerHeight.value = 0;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
|
|
661
670
|
// Binary search for start index
|
|
662
671
|
let low = 0;
|
|
663
672
|
let high = rowPositions.value.length - 1;
|
|
@@ -678,12 +687,17 @@ const calculateVisibleRows = () => {
|
|
|
678
687
|
newStartIndex + Math.ceil(containerHeight / (props.itemHeight || 52.5)) + buffer * 2
|
|
679
688
|
);
|
|
680
689
|
|
|
681
|
-
|
|
690
|
+
// Ensure at least one row is visible
|
|
691
|
+
if (newEndIndex < newStartIndex) {
|
|
692
|
+
startIndex.value = 0;
|
|
693
|
+
endIndex.value = Math.min(props.rows.length - 1, Math.ceil(containerHeight / (props.itemHeight || 52.5)));
|
|
694
|
+
} else {
|
|
682
695
|
startIndex.value = newStartIndex;
|
|
683
696
|
endIndex.value = newEndIndex;
|
|
684
|
-
visibleRows.value = props.rows.slice(startIndex.value, endIndex.value + 1);
|
|
685
|
-
spacerHeight.value = startIndex.value > 0 ? rowPositions.value[startIndex.value - 1] : 0;
|
|
686
697
|
}
|
|
698
|
+
|
|
699
|
+
visibleRows.value = props.rows.slice(startIndex.value, endIndex.value + 1);
|
|
700
|
+
spacerHeight.value = startIndex.value > 0 ? rowPositions.value[startIndex.value - 1] : 0;
|
|
687
701
|
};
|
|
688
702
|
|
|
689
703
|
// Throttled scroll handler
|