feat(search): add direct page-jump control to document search pagination (#340) #346

Merged
marcel merged 5 commits from feat/issue-340-pagination-page-jump into main 2026-04-26 21:53:18 +02:00
Showing only changes of commit d97b62c072 - Show all commits

View File

@@ -40,20 +40,20 @@ const pageWindow = $derived.by(() => {
result.push(first);
if (windowStart > first + 1) {
if (windowStart > first + 2) {
result.push(null); // left ellipsis
} else if (windowStart === first + 1) {
result.push(windowStart);
} else if (windowStart === first + 2) {
result.push(first + 1); // bridge: one page gap, show directly instead of ellipsis
}
for (let p = Math.max(windowStart, first + 1); p <= Math.min(windowEnd, last - 1); p++) {
result.push(p);
}
if (windowEnd < last - 1) {
if (windowEnd < last - 2) {
result.push(null); // right ellipsis
} else if (windowEnd === last - 1) {
result.push(windowEnd);
} else if (windowEnd === last - 2) {
result.push(last - 1); // bridge: one page gap, show directly instead of ellipsis
}
if (last > first) {
@@ -105,7 +105,7 @@ const pageWindow = $derived.by(() => {
<!-- Desktop: numbered page buttons (hidden below sm:) -->
<div data-testid="pagination-pages" class="hidden items-center gap-1 sm:flex">
{#each pageWindow as entry, i (i)}
{#each pageWindow as entry, i (entry === null ? 'ellipsis-' + i : entry)}
{#if entry === null}
{#if i === 1}
<span