refactor(tapops): modularize page code

This commit is contained in:
Dodo
2026-06-04 18:13:23 +07:00
parent 529693cd5f
commit 1270ce60fd
41 changed files with 4678 additions and 4476 deletions
@@ -0,0 +1,16 @@
export class PaginationModel {
static range(current, total) {
if (total <= 7) return Array.from({ length: total }, (_, index) => index + 1);
const pages = [1];
const low = Math.max(2, current - 1);
const high = Math.min(total - 1, current + 1);
if (low > 2) pages.push('...');
for (let page = low; page <= high; page += 1) pages.push(page);
if (high < total - 1) pages.push('...');
pages.push(total);
return pages;
}
}