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

fix(VPagination): visible items for selection in middle #20322

Merged
merged 1 commit into from
Jan 27, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const VPagination = genericComponent<VPaginationSlots>()({
const rangeStart = length.value - rangeLength + start.value
return [start.value, props.ellipsis, ...createRange(rangeLength, rangeStart)]
} else {
const rangeLength = Math.max(1, totalVisible.value - 3)
const rangeLength = Math.max(1, totalVisible.value - 2)
const rangeStart = rangeLength === 1 ? page.value : page.value - Math.ceil(rangeLength / 2) + start.value
return [start.value, props.ellipsis, ...createRange(rangeLength, rangeStart), props.ellipsis, length.value]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ describe('VPagination', () => {

// 5 buttons and 1 ellipsis
cy.get('.v-pagination__item').should('have.length', 6)

cy.get('.v-btn').contains('4').click()
// 5 buttons and 2 ellipsis
cy.get('.v-pagination__item').should('have.length', 7)
})

it('should limit items when not enough space', () => {
Expand Down