/** * ⭐⭐ HOTFIX 2026-09-23 — the read-through grid's pager. * * Owner, verbatim: *"I want fucking either pagination or next page and only load 50 at a time to * be fucking back."* This revokes SDLC 62 R3 (virtualise only). A read-through table holds ONE * page of `size` rows; Previous and Next move it. `total` is the server's count of everything the * predicate matches, so every row stays reachable and the count is never `rows.length`. */ export function pageLabel(offset: number, size: number, total: number): string { if (total <= 0) return "No records"; const from = Math.min(total, offset + 1); const to = Math.min(total, offset + size); return `${from.toLocaleString()} to ${to.toLocaleString()} of ${total.toLocaleString()}`; } export function GridPager({ offset, size, sizes, total, pending, onPage, onSize, itemsLabel = "Rows", totalKnown = true, hasNextPage, }: { offset: number; size: number; /** HOTFIX 2026-09-24: the page-size choices, on the same line as Previous / Next. */ sizes: readonly number[]; total: number; pending: boolean; onPage: (offset: number) => void; onSize: (size: number) => void; itemsLabel?: "Rows" | "Items"; totalKnown?: boolean; hasNextPage?: boolean; }) { const pages = Math.max(1, Math.ceil(total / size)); const page = Math.min(pages, Math.floor(offset / size) + 1); const hasPrev = offset > 0; const hasNext = hasNextPage ?? offset + size < total; return ( ); }