Release v2.2.0

This commit is contained in:
2026-08-01 21:41:44 +01:00
parent c643d2fb07
commit d6417b667c
673 changed files with 146752 additions and 7389 deletions
+12 -1
View File
@@ -1,3 +1,5 @@
// Shared helpers for building paginated list response state.
function normalizePageNumber(value) {
const pageNumber = Math.floor(Number(value) || 1);
return Math.max(1, pageNumber);
@@ -89,6 +91,15 @@ function buildPagination(totalItems, currentPage, pageParam, queryState, pageSiz
const firstQuery = Object.assign({}, queryState, { [normalizedPageParam]: 1 });
const lastQuery = Object.assign({}, queryState, { [normalizedPageParam]: totalPages });
let normalizedItemLabel = String(itemLabel || 'items');
const total = Number(totalItems) || 0;
if (total === 1 && normalizedItemLabel.endsWith('s')) {
normalizedItemLabel = normalizedItemLabel.slice(0, -1);
} else if (total > 1 && !normalizedItemLabel.endsWith('s')) {
normalizedItemLabel += 's';
}
return {
currentPage: safeCurrentPage,
totalPages: totalPages,
@@ -107,7 +118,7 @@ function buildPagination(totalItems, currentPage, pageParam, queryState, pageSiz
pages: pages,
pageSize: normalizedPageSize,
pageParam: normalizedPageParam,
itemLabel: String(itemLabel || 'items'),
itemLabel: String(normalizedItemLabel || 'item'),
ariaLabel: String(ariaLabel || 'Pagination')
};
}