Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination display fix. @cagov/ds-pagination version 2.0.4 #1028

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/pagination/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Pagination changelog

## 2.0.4
- Fixes an issue with small page counts (4,5,6,7) in which on some page numbers
an ellipsis is displayed where a single-page is missing, or both the ellipsis and
a single page are skipped leaving a gap in the sequence. New system uses ellipsis for
2 or more pages only, and displays single pages in its place, when appropriate.

## 2.0.3

- Removed redundant package-lock.json (due to workspaces config in monorepo). This fixes vulnerability in the npm `ip` package.
Expand Down
6 changes: 5 additions & 1 deletion components/pagination/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
</li>
${currentPage > 2 ? pageListItem(page, 1) : ''}

${currentPage > 3 ? pageOverflow() : ''}
${currentPage > 4 ? pageOverflow() : ''}
${currentPage === 4 ? pageListItem(page, 2) : ''}

${currentPage > 1 ? pageListItem(page, currentPage - 1) : ''}

Expand All @@ -54,6 +55,9 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
${currentPage < totalPages ? pageListItem(page, currentPage + 1) : ''}

${currentPage < totalPages - 3 ? pageOverflow() : ''}
${
currentPage === totalPages - 3 ? pageListItem(page, totalPages - 1) : ''
}

${currentPage < totalPages - 1 ? pageListItem(page, totalPages) : ''}

Expand Down
2 changes: 1 addition & 1 deletion components/pagination/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cagov/ds-pagination",
"version": "2.0.3",
"version": "2.0.4",
"description": "",
"main": "dist/index.js",
"customElements": "custom-elements.json",
Expand Down
6 changes: 5 additions & 1 deletion components/pagination/src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
</li>
${currentPage > 2 ? pageListItem(page, 1) : ''}

${currentPage > 3 ? pageOverflow() : ''}
${currentPage > 4 ? pageOverflow() : ''}
${currentPage === 4 ? pageListItem(page, 2) : ''}

${currentPage > 1 ? pageListItem(page, currentPage - 1) : ''}

Expand All @@ -54,6 +55,9 @@ function templateHTML(next, previous, page, currentPage, totalPages) {
${currentPage < totalPages ? pageListItem(page, currentPage + 1) : ''}

${currentPage < totalPages - 3 ? pageOverflow() : ''}
${
currentPage === totalPages - 3 ? pageListItem(page, totalPages - 1) : ''
}

${currentPage < totalPages - 1 ? pageListItem(page, totalPages) : ''}

Expand Down
Loading