Created
July 4, 2024 17:20
-
-
Save wilsaantos/5dde5a227c2ba17d7ccb0b910c756a3f to your computer and use it in GitHub Desktop.
Angular Material Paginator Intl pt-BR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MatPaginatorIntl } from '@angular/material/paginator'; | |
export class MatPaginatorIntlCustom extends MatPaginatorIntl { | |
override itemsPerPageLabel = 'Itens por páginas'; | |
override nextPageLabel = 'Próxima'; | |
override previousPageLabel = 'Anterior'; | |
override firstPageLabel = 'Primeira página'; | |
override lastPageLabel = 'Última página'; | |
// tslint:disable-next-line:only-arrow-functions | |
override getRangeLabel = (page: number, pageSize: number, length: number) => { | |
if (length === 0 || pageSize === 0) { | |
return `0 of ${length}`; | |
} | |
length = Math.max(length, 0); | |
const startIndex = page * pageSize; | |
const endIndex = | |
startIndex < length | |
? Math.min(startIndex + pageSize, length) | |
: startIndex + pageSize; | |
const label = `${startIndex + 1} - ${endIndex} de ${length}`; | |
return label; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment