createPagination

function

createPagination(props?): PaginationWidget

Create a PaginationWidget with given config props

Parameters

props?: PropsConfig<PaginationProps>

Returns

PaginationWidget

a PaginationWidget


DirectionsHrefs

interface

Interface representing the hrefs for pagination navigation links.

Properties
next

next: string

The href for the 'Next' direction link


previous

previous: string

The href for the 'Previous' navigation link


getPaginationDefaultConfig

function

getPaginationDefaultConfig(): PaginationProps

Retrieve a shallow copy of the default Pagination config

Returns

PaginationProps

the default Pagination config


PaginationApi

interface

Interface representing pagination API for navigating through pages.

Methods
first

first(): void

To "go" to the first page

Returns

void


last

last(): void

To "go" to the last page

Returns

void


next

next(): void

To "go" to the next page

Returns

void


previous

previous(): void

To "go" to the previous page

Returns

void


select

select(page): void

To "go" to a specific page

Parameters

page: number

The page number to select

Returns

void


PaginationComponent

class

The PaginationComponent is an Angular component that extends the BaseWidgetDirective to provide a customizable pagination widget. It includes various input properties to configure labels, templates, and behavior for accessibility and internationalization (i18n).

Properties
activeLabel

activeLabel: undefined | string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'

ariaEllipsisLabel

ariaEllipsisLabel: undefined | string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'


ariaFirstLabel

ariaFirstLabel: undefined | string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'

ariaLabel

ariaLabel: undefined | string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'


ariaLastLabel

ariaLastLabel: undefined | string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'

ariaLiveLabel

ariaLiveLabel: undefined | (currentPage, pageCount) => string

Provide the label for the aria-live element This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Param

The current page number

Param

The total number of pages

Default Value
(currentPage: number) => `Current page is ${currentPage}`

ariaNextLabel

ariaNextLabel: undefined | string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'

ariaPageLabel

ariaPageLabel: undefined | (processPage, pageCount) => string

Provide the label for each "Page" page button. This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Param

The current page number

Param

The total number of pages

Default Value
(processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`

ariaPreviousLabel

ariaPreviousLabel: undefined | string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: undefined | boolean

If true, the "First" and "Last" page links are shown.

Default Value

false


className

className: undefined | string

CSS classes to be applied on the widget main container

Default Value

''


collectionSize

collectionSize: undefined | number

The number of items in your paginated collection.

Note, that this is not the number of pages. Page numbers are calculated dynamically based on collectionSize and pageSize.

Ex. if you have 100 items in your collection and displaying 20 items per page, you'll end up with 5 pages.

Whatever the collectionSize the page number is of minimum 1.

Default Value

0


directionLinks: undefined | boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true


disabled

disabled: undefined | boolean

If true, pagination links will be disabled.

Default Value

false


ellipsisLabel

ellipsisLabel: SlotContent<PaginationContext>

The template to use for the ellipsis slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'…'


firstPageLabel

firstPageLabel: SlotContent<PaginationContext>

The template to use for the first slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'«'


lastPageLabel

lastPageLabel: SlotContent<PaginationContext>

The template to use for the last slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'»'


nextPageLabel

nextPageLabel: SlotContent<PaginationContext>

The template to use for the next slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'›'


numberLabel

numberLabel: SlotContent<PaginationNumberContext>

The template to use for the number slot override any configuration parameters provided for this for I18n, we suggest to use the global configuration

Param

The current page number

Default Value
({displayedPage}: PaginationNumberContext) => `${displayedPage}`

page

page: undefined | number

The current page.

Page numbers start with 1.

Default Value

1


pageChange

pageChange: EventEmitter<number>

An event fired when the page is changed.

Event payload is the number of the newly selected page.

Page numbers start with 1.

Default Value
() => {}

pageLink: undefined | (pageNumber) => string

Factory function providing the href for a "Page" page anchor, based on the current page number

Param

The index to use in the link

Default Value
(_page: number) => PAGE_LINK_DEFAULT

pagesDisplay

pagesDisplay: SlotContent<PaginationContext>

The template to use for the pages slot To use to customize the pages view override any configuration parameters provided for this


pagesFactory

pagesFactory: undefined | (page, pageCount) => number[]

pagesFactory returns a function computing the array of pages to be displayed as number (-1 are treated as ellipsis). Use Page slot to customize the pages view and not this

Param

The current page number

Param

The total number of pages

Default Value
(_page: number, pageCount: number) => {
		const pages: number[] = [];
		for (let i = 1; i <= pageCount; i++) {
			pages.push(i);
		}
		return pages;
	}

pageSize

pageSize: undefined | number

The number of items per page.

Remarks

min value is 1

Default Value

10


previousPageLabel

previousPageLabel: SlotContent<PaginationContext>

The template to use for the previous slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'‹'


size

size: undefined | null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


structure

structure: SlotContent<PaginationContext>

The template to use for the structure of the pagination component The default structure uses PaginationProps.ellipsisLabel|ellipsisLabel, PaginationProps.firstPageLabel|firstPageLabel, PaginationProps.previousPageLabel|previousPageLabel, PaginationProps.nextPageLabel|nextPageLabel, PaginationProps.lastPageLabel|lastPageLabel, PaginationProps.pagesDisplay|pagesDisplay, PaginationProps.numberLabel|numberLabel,

Accessors
api

get api(): W["api"]

Retrieves the widget api

Returns

W["api"]

the widget api


directives

get directives(): W["directives"]

Retrieves the widget directives

Returns

W["directives"]

the widget directives


state

get state(): AngularState<W>

Retrieves the widget state as an Angular Signal

Returns

AngularState<W>

the widget state


PaginationContext

interface

A type for the slot context of the pagination widget

Extended by
Properties
api

api: PaginationApi

all the api functions to interact with the widget


directives

directives: PaginationDirectives

directives to be used on html elements in the template of the widget or in the slots


state

state: AngularState<PaginationWidget>

the state of the widget


paginationDefaultSlotPages

constant

const paginationDefaultSlotPages: SlotContent<PaginationContext>

The default slot for the pages


paginationDefaultSlotStructure

constant

const paginationDefaultSlotStructure: SlotContent<PaginationContext>

The default slot for the structure


PaginationDirectives

interface

Interface representing the directives for pagination components.

Properties
pageFirst

pageFirst: Directive

A directive to be applied on the first link


pageLast

pageLast: Directive

A directive to be applied on the Last link


pageLink: Directive<object>

A directive to be applied to each page link This will handle the click, tabindex and aria attributes

Type declaration
page

page: number


pageNext

pageNext: Directive

A directive to be applied on the next link


pagePrev

pagePrev: Directive

A directive to be applied on the previous link


PaginationEllipsisDirective

class

A directive to use to give the 'ellipsis' link template to the pagination component This directive provides a template reference for the PaginationContext.


PaginationFirstDirective

class

A directive to use to give the 'first' link template to the pagination component This directive provides a template reference for the PaginationContext.


PaginationLastDirective

class

A directive to use to give the 'last' link template to the pagination component This directive provides a template reference for the PaginationContext.


PaginationNextDirective

class

A directive to use to give the 'next' link template to the pagination component This directive provides a template reference for the PaginationContext.


PaginationNumberContext

interface

A type for the slot context of the pagination widget when the slot is the number label

Properties
api

api: PaginationApi

all the api functions to interact with the widget


directives

directives: PaginationDirectives

directives to be used on html elements in the template of the widget or in the slots


displayedPage

displayedPage: number

Displayed page


state

state: AngularState<PaginationWidget>

the state of the widget


PaginationNumberDirective

class

A directive to use to give the page 'number' template to the pagination component This directive provides a template reference for the PaginationNumberContext.


PaginationPagesDirective

class

A directive to use to give the 'Pages' template for the Pages slot This directive provides a template reference for the PaginationContext.


PaginationPreviousDirective

class

A directive to use to give the 'previous' link template to the pagination component This directive provides a template reference for the PaginationContext.


PaginationProps

interface

Represents the properties for the Pagination component.

Properties
activeLabel

activeLabel: string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'

ariaEllipsisLabel

ariaEllipsisLabel: string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'


ariaFirstLabel

ariaFirstLabel: string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'

ariaLabel

ariaLabel: string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'


ariaLastLabel

ariaLastLabel: string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'

ariaLiveLabel

ariaLiveLabel: (currentPage, pageCount) => string

Provide the label for the aria-live element This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

currentPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(currentPage: number) => `Current page is ${currentPage}`

ariaNextLabel

ariaNextLabel: string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'

ariaPageLabel

ariaPageLabel: (processPage, pageCount) => string

Provide the label for each "Page" page button. This is used for accessibility purposes. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Parameters

processPage: number

The current page number

pageCount: number

The total number of pages

Returns

string

Default Value
(processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`

ariaPreviousLabel

ariaPreviousLabel: string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: boolean

If true, the "First" and "Last" page links are shown.

Default Value

false


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


collectionSize

collectionSize: number

The number of items in your paginated collection.

Note, that this is not the number of pages. Page numbers are calculated dynamically based on collectionSize and pageSize.

Ex. if you have 100 items in your collection and displaying 20 items per page, you'll end up with 5 pages.

Whatever the collectionSize the page number is of minimum 1.

Default Value

0


directionLinks: boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true


disabled

disabled: boolean

If true, pagination links will be disabled.

Default Value

false


ellipsisLabel

ellipsisLabel: SlotContent<PaginationContext>

The template to use for the ellipsis slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'…'


firstPageLabel

firstPageLabel: SlotContent<PaginationContext>

The template to use for the first slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'«'


lastPageLabel

lastPageLabel: SlotContent<PaginationContext>

The template to use for the last slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'»'


nextPageLabel

nextPageLabel: SlotContent<PaginationContext>

The template to use for the next slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'›'


numberLabel

numberLabel: SlotContent<PaginationNumberContext>

The template to use for the number slot override any configuration parameters provided for this for I18n, we suggest to use the global configuration

Param

The current page number

Default Value
({displayedPage}: PaginationNumberContext) => `${displayedPage}`

onPageChange

onPageChange: (page) => void

An event fired when the page is changed.

Event payload is the number of the newly selected page.

Page numbers start with 1.

Parameters

page: number

Returns

void

Default Value
() => {}

page

page: number

The current page.

Page numbers start with 1.

Default Value

1


pageLink: (pageNumber) => string

Factory function providing the href for a "Page" page anchor, based on the current page number

Parameters

pageNumber: number

The index to use in the link

Returns

string

Default Value
(_page: number) => PAGE_LINK_DEFAULT

pagesDisplay

pagesDisplay: SlotContent<PaginationContext>

The template to use for the pages slot To use to customize the pages view override any configuration parameters provided for this


pagesFactory

pagesFactory: (page, pageCount) => number[]

pagesFactory returns a function computing the array of pages to be displayed as number (-1 are treated as ellipsis). Use Page slot to customize the pages view and not this

Parameters

page: number

The current page number

pageCount: number

The total number of pages

Returns

number[]

Default Value
(_page: number, pageCount: number) => {
		const pages: number[] = [];
		for (let i = 1; i <= pageCount; i++) {
			pages.push(i);
		}
		return pages;
	}

pageSize

pageSize: number

The number of items per page.

Remarks

min value is 1

Default Value

10


previousPageLabel

previousPageLabel: SlotContent<PaginationContext>

The template to use for the previous slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'‹'


size

size: null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


structure

structure: SlotContent<PaginationContext>

The template to use for the structure of the pagination component The default structure uses ellipsisLabel, firstPageLabel, previousPageLabel, nextPageLabel, lastPageLabel, pagesDisplay, numberLabel,


PaginationState

interface

Represents the state of a pagination component.

Properties
activeLabel

activeLabel: string

The label for the "active" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'(current)'

ariaEllipsisLabel

ariaEllipsisLabel: string

The label for the "Ellipsis" page. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Ellipsis page element'


ariaFirstLabel

ariaFirstLabel: string

The label for the "First" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for first page'

ariaLabel

ariaLabel: string

The label for the nav element.

for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'Page navigation'


ariaLastLabel

ariaLastLabel: string

The label for the "Last" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for last page'

ariaLiveLabelText

ariaLiveLabelText: string

The aria-live text


ariaNextLabel

ariaNextLabel: string

The label for the "Next" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for next page'

ariaPreviousLabel

ariaPreviousLabel: string

The label for the "Previous" page button. for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value
'Action link for previous page'

boundaryLinks: boolean

If true, the "First" and "Last" page links are shown.

Default Value

false


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


directionLinks: boolean

If true, the "Next" and "Previous" page links are shown.

Default Value

true


directionsHrefs

directionsHrefs: DirectionsHrefs

The hrefs for the direction links


disabled

disabled: boolean

If true, pagination links will be disabled.

Default Value

false


ellipsisLabel

ellipsisLabel: SlotContent<PaginationContext>

The template to use for the ellipsis slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'…'


firstPageLabel

firstPageLabel: SlotContent<PaginationContext>

The template to use for the first slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'«'


lastPageLabel

lastPageLabel: SlotContent<PaginationContext>

The template to use for the last slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'»'


nextDisabled

nextDisabled: boolean

true if the next link need to be disabled


nextPageLabel

nextPageLabel: SlotContent<PaginationContext>

The template to use for the next slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'›'


numberLabel

numberLabel: SlotContent<PaginationNumberContext>

The template to use for the number slot override any configuration parameters provided for this for I18n, we suggest to use the global configuration

Param

The current page number

Default Value
({displayedPage}: PaginationNumberContext) => `${displayedPage}`

page

page: number

The current page.

Page numbers start with 1.

Default Value

1


pageCount

pageCount: number

The number of pages.


pages

pages: number[]

The current pages, the number in the Array is the number of the page.


pagesDisplay

pagesDisplay: SlotContent<PaginationContext>

The template to use for the pages slot To use to customize the pages view override any configuration parameters provided for this


pagesHrefs

pagesHrefs: string[]

The hrefs for each "Page" page link


pagesLabel

pagesLabel: string[]

The label for each "Page" page link.


previousDisabled

previousDisabled: boolean

true if the previous link need to be disabled


previousPageLabel

previousPageLabel: SlotContent<PaginationContext>

The template to use for the previous slot for I18n, we suggest to use the global configuration override any configuration parameters provided for this

Default Value

'‹'


size

size: null | "sm" | "lg"

The pagination display size.

Bootstrap currently supports small and large sizes.

Default Value

null


structure

structure: SlotContent<PaginationContext>

The template to use for the structure of the pagination component The default structure uses ellipsisLabel, firstPageLabel, previousPageLabel, nextPageLabel, lastPageLabel, pagesDisplay, numberLabel,


PaginationStructureDirective

class

Directive to provide the slot structure for the pagination widget. This directive provides a template reference for the PaginationContext.


PaginationWidget

type alias

PaginationWidget: Widget<PaginationProps, PaginationState, PaginationApi, PaginationDirectives>

Represents a pagination widget component.

This type defines a widget that handles pagination functionality, including properties, state, api and directives specific to pagination.