PageNumberPaginator

Source
import { PageNumberPaginator } from "@prestojs/util";
Hierarchy
  • Paginator<
    An object with these properties:
    PropertyTypeDescription
    pagestring|number
    pageSizestring|number
    ,
    An object with these properties:
    PropertyTypeDescription
    *totalnumber|null
    >
  • PageNumberPaginator

API

Constructor

new PageNumberPaginator(?currentStatePair,?internalStatePair)

Arguments:

ArgumentTypeDescription
currentStatePairnull
internalStatePairnull

Methods

first()
Returns:void
firstState()
Returns:
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
getRequestInit(props)

Arguments:

ArgumentTypeDescription
*propsObject
Returns:
An object with these properties:
PropertyTypeDescription
headersHeadersInit|Record
queryRecord
urlArgsRecord
...any
Any properties from RequestInit except for these:
  • headers
hasNextPage()
Returns:boolean
last()
Returns:void
lastState()
Returns:null|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
next()
Returns:void
nextState()
Returns:
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
pageSizeState(pageSize)

Arguments:

ArgumentTypeDescription
*pageSizenull|number
Returns:
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
pageState(page)

Arguments:

ArgumentTypeDescription
*pagenumber
Returns:
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
previous()
Returns:void
previousState()
Returns:
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
replaceStateControllers(currentStatePair,internalStatePair)

Arguments:

ArgumentTypeDescription
*currentStatePairany
*internalStatePairany
Returns:void
setCurrentState(set)

Component Props:

PropTypeDescription
*set
setInternalState(set)

Component Props:

PropTypeDescription
*set
setPage(page)

Arguments:

ArgumentTypeDescription
*pagenumber
Returns:void
setPageSize(pageSize)

Arguments:

ArgumentTypeDescription
*pageSizenull|number
Returns:void
setResponse(props)

Arguments:

ArgumentTypeDescription
*props
Returns:void

Properties

currentState

Source
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number

internalState

Source
An object with these properties:
PropertyTypeDescription
responseIsSetboolean
*totalnumber|null

page

Source
null|number

pageSize

Source
null|number

responseIsSet

Source
boolean

total

Source
null|number

totalPages

Source
null|number

Static Methods

getPaginationState(requestDetails)

Arguments:

ArgumentTypeDescription
*
requestDetails
An object with the properties below
requestDetails.decodedBodyany
requestDetails.queryRecord
requestDetails.responseResponse
*requestDetails.urlstring
requestDetails.urlArgsRecord
Returns:false|Record