@@ -69,6 +69,9 @@ const paginationMode = computed(() =>
6969 viewMode .value === ' table' ? ' paginated' : (props .paginationMode ?? ' infinite' ),
7070)
7171const currentPage = computed (() => props .currentPage ?? 1 )
72+ const pageSize = computed (() => props .pageSize ?? 25 )
73+ // Numeric page size for virtual scroll and arithmetic (when 'all' is selected, use 25 as default)
74+ const numericPageSize = computed (() => (pageSize .value === ' all' ? 25 : pageSize .value ))
7275
7376// Compute paginated results for paginated mode
7477const displayedResults = computed (() => {
@@ -79,23 +82,22 @@ const displayedResults = computed(() => {
7982 if (pageSize .value === ' all' ) {
8083 return props .results
8184 }
82- const start = (currentPage .value - 1 ) * pageSize .value
83- const end = start + pageSize .value
85+ const start = (currentPage .value - 1 ) * numericPageSize .value
86+ const end = start + numericPageSize .value
8487 return props .results .slice (start , end )
8588})
8689
8790// Set up infinite scroll if hasMore is provided
8891const hasMore = computed (() => props .hasMore ?? false )
8992const isLoading = computed (() => props .isLoading ?? false )
9093const itemCount = computed (() => props .results .length )
91- const pageSize = computed (() => props .pageSize ?? 20 )
9294
9395const { handleScroll, scrollToPage } = useVirtualInfiniteScroll ({
9496 listRef ,
9597 itemCount ,
9698 hasMore ,
9799 isLoading ,
98- pageSize: pageSize .value ,
100+ pageSize: numericPageSize .value ,
99101 threshold: 5 ,
100102 onLoadMore : () => emit (' loadMore' ),
101103 onPageChange : page => emit (' pageChange' , page ),
0 commit comments