Skip to content

Commit

Permalink
fix(kpagination): ensure firstDetached consistency [KM-580] (#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
TT1228 authored Oct 15, 2024
1 parent dfba386 commit 18a2e3a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/KPagination/KPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ const endCount = computed((): number => {
const pagesString = computed((): string => `${startCount.value} to ${endCount.value}`)
const pageCountString = computed((): string => ` of ${props.totalCount}`)
const currentlySelectedPage = computed((): number => props.currentPage ? props.currentPage : currPage.value)
const firstDetached = ref<boolean>(currentlySelectedPage.value >= fittingNeighbors.value + (sequentialItemsVisible.value + 1))
// Selected page, first page, last page, 2 placeholders and 2 * neighbors
const visiblePages = computed((): number => 5 + 2 * fittingNeighbors.value)
const firstDetached = ref<boolean>(currentlySelectedPage.value >= fittingNeighbors.value + (sequentialItemsVisible.value + 1) && pageCount.value > visiblePages.value)
const lastDetached = ref<boolean>(pageCount.value > (sequentialItemsVisible.value + 2) + (2 * fittingNeighbors.value))
const pagesVisible = ref<Array<number>>(getVisiblePages(
currentlySelectedPage.value,
Expand Down Expand Up @@ -348,9 +351,7 @@ const updatePage = (): void => {
forwardDisabled.value = lastEntry >= props.totalCount
backDisabled.value = currPage.value === 1
// The view will hold
// Selected page, first page, last page, 2 placeholders and 2 * neighbors
const visiblePages = 5 + 2 * fittingNeighbors.value
if (pageCount.value <= visiblePages) {
if (pageCount.value <= visiblePages.value) {
// All pages will fit in screen
firstDetached.value = false
lastDetached.value = false
Expand Down

0 comments on commit 18a2e3a

Please sign in to comment.