@@ -27,7 +27,7 @@ import { computed, nextTick, shallowRef, toRef } from 'vue'
2727import { createRange , genericComponent , keyValues , propsFactory , useRender } from '@/util'
2828
2929// Types
30- import type { ComponentPublicInstance } from 'vue'
30+ import type { ComponentPublicInstance , PropType } from 'vue'
3131
3232type ItemSlot = {
3333 isActive : boolean
@@ -117,7 +117,10 @@ export const makeVPaginationProps = propsFactory({
117117 type : String ,
118118 default : '...' ,
119119 } ,
120- showFirstLastPage : Boolean ,
120+ showFirstLastPage : {
121+ type : [ Boolean , String ] as PropType < boolean | 'only-first' > ,
122+ default : false ,
123+ } ,
121124
122125 ...makeBorderProps ( ) ,
123126 ...makeComponentProps ( ) ,
@@ -278,7 +281,7 @@ export const VPagination = genericComponent<VPaginationSlots>()({
278281 const nextDisabled = ! ! props . disabled || page . value >= start . value + length . value - 1
279282
280283 return {
281- first : props . showFirstLastPage ? {
284+ first : [ true , 'only-first' ] . includes ( props . showFirstLastPage ) ? {
282285 icon : isRtl . value ? props . lastIcon : props . firstIcon ,
283286 onClick : ( e : Event ) => setValue ( e , start . value , 'first' ) ,
284287 disabled : prevDisabled ,
@@ -299,7 +302,7 @@ export const VPagination = genericComponent<VPaginationSlots>()({
299302 'aria-label' : t ( props . nextAriaLabel ) ,
300303 'aria-disabled' : nextDisabled ,
301304 } ,
302- last : props . showFirstLastPage ? {
305+ last : props . showFirstLastPage === true ? {
303306 icon : isRtl . value ? props . firstIcon : props . lastIcon ,
304307 onClick : ( e : Event ) => setValue ( e , start . value + length . value - 1 , 'last' ) ,
305308 disabled : nextDisabled ,
@@ -339,7 +342,7 @@ export const VPagination = genericComponent<VPaginationSlots>()({
339342 data-test = "v-pagination-root"
340343 >
341344 < ul class = "v-pagination__list" >
342- { props . showFirstLastPage && (
345+ { [ true , 'only-first' ] . includes ( props . showFirstLastPage ) && (
343346 < li key = "first" class = "v-pagination__first" data-test = "v-pagination-first" >
344347 { slots . first ? slots . first ( controls . value . first ! ) : (
345348 < VBtn _as = "VPaginationBtn" { ...controls . value . first } />
@@ -380,12 +383,8 @@ export const VPagination = genericComponent<VPaginationSlots>()({
380383 ) }
381384 </ li >
382385
383- { props . showFirstLastPage && (
384- < li
385- key = "last"
386- class = "v-pagination__last"
387- data-test = "v-pagination-last"
388- >
386+ { props . showFirstLastPage === true && (
387+ < li key = "last" class = "v-pagination__last" data-test = "v-pagination-last" >
389388 { slots . last ? slots . last ( controls . value . last ! ) : (
390389 < VBtn _as = "VPaginationBtn" { ...controls . value . last } />
391390 ) }
0 commit comments