primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
803 lines (798 loc) • 41.2 kB
JavaScript
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, input, EventEmitter, inject, computed, booleanAttribute, numberAttribute, HostBinding, ContentChildren, ContentChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import * as i2 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import * as i3 from 'primeng/api';
import { SharedModule, PrimeTemplate } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import { Select } from 'primeng/select';
import { AngleDoubleLeftIcon, AngleDoubleRightIcon, AngleLeftIcon, AngleRightIcon } from 'primeng/icons';
import { InputNumber } from 'primeng/inputnumber';
import { Ripple } from 'primeng/ripple';
import { style } from '@primeuix/styles/paginator';
import { BaseStyle } from 'primeng/base';
const classes = {
paginator: ({ instance }) => ['p-paginator p-component'],
content: 'p-paginator-content',
contentStart: 'p-paginator-content-start',
contentEnd: 'p-paginator-content-end',
first: ({ instance }) => [
'p-paginator-first',
{
'p-disabled': instance.isFirstPage() || instance.empty()
}
],
firstIcon: 'p-paginator-first-icon',
prev: ({ instance }) => [
'p-paginator-prev',
{
'p-disabled': instance.isFirstPage() || instance.empty()
}
],
prevIcon: 'p-paginator-prev-icon',
next: ({ instance }) => [
'p-paginator-next',
{
'p-disabled': instance.isLastPage() || instance.empty()
}
],
nextIcon: 'p-paginator-next-icon',
last: ({ instance }) => [
'p-paginator-last',
{
'p-disabled': instance.isLastPage() || instance.empty()
}
],
lastIcon: 'p-paginator-last-icon',
pages: 'p-paginator-pages',
page: ({ instance, pageLink }) => [
'p-paginator-page',
{
'p-paginator-page-selected': pageLink - 1 == instance.getPage()
}
],
current: 'p-paginator-current',
pcRowPerPageDropdown: 'p-paginator-rpp-dropdown',
pcJumpToPageDropdown: 'p-paginator-jtp-dropdown',
pcJumpToPageInput: 'p-paginator-jtp-input'
};
class PaginatorStyle extends BaseStyle {
name = 'paginator';
theme = style;
classes = classes;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorStyle });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorStyle, decorators: [{
type: Injectable
}] });
/**
*
* Paginator is a generic component to display content in paged format.
*
* [Live Demo](https://www.primeng.org/paginator)
*
* @module paginatorstyle
*
*/
var PaginatorClasses;
(function (PaginatorClasses) {
/**
* Class name of the paginator element
*/
PaginatorClasses["paginator"] = "p-paginator";
/**
* Class name of the content start element
*/
PaginatorClasses["contentStart"] = "p-paginator-content-start";
/**
* Class name of the content end element
*/
PaginatorClasses["contentEnd"] = "p-paginator-content-end";
/**
* Class name of the first element
*/
PaginatorClasses["first"] = "p-paginator-first";
/**
* Class name of the first icon element
*/
PaginatorClasses["firstIcon"] = "p-paginator-first-icon";
/**
* Class name of the prev element
*/
PaginatorClasses["prev"] = "p-paginator-prev";
/**
* Class name of the prev icon element
*/
PaginatorClasses["prevIcon"] = "p-paginator-prev-icon";
/**
* Class name of the next element
*/
PaginatorClasses["next"] = "p-paginator-next";
/**
* Class name of the next icon element
*/
PaginatorClasses["nextIcon"] = "p-paginator-next-icon";
/**
* Class name of the last element
*/
PaginatorClasses["last"] = "p-paginator-last";
/**
* Class name of the last icon element
*/
PaginatorClasses["lastIcon"] = "p-paginator-last-icon";
/**
* Class name of the pages element
*/
PaginatorClasses["pages"] = "p-paginator-pages";
/**
* Class name of the page element
*/
PaginatorClasses["page"] = "p-paginator-page";
/**
* Class name of the current element
*/
PaginatorClasses["current"] = "p-paginator-current";
/**
* Class name of the row per page dropdown element
*/
PaginatorClasses["pcRowPerPageDropdown"] = "p-paginator-rpp-dropdown";
/**
* Class name of the jump to page dropdown element
*/
PaginatorClasses["pcJumpToPageDropdown"] = "p-paginator-jtp-dropdown";
/**
* Class name of the jump to page input element
*/
PaginatorClasses["pcJumpToPageInput"] = "p-paginator-jtp-input";
})(PaginatorClasses || (PaginatorClasses = {}));
/**
* Paginator is a generic component to display content in paged format.
* @group Components
*/
class Paginator extends BaseComponent {
/**
* Number of page links to display.
* @group Props
*/
pageLinkSize = 5;
/**
* Style class of the component.
* @deprecated since v20.0.0, use `class` instead.
* @group Props
*/
styleClass;
/**
* Whether to show it even there is only one page.
* @group Props
*/
alwaysShow = true;
/**
* Target element to attach the dropdown overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @deprecated since v20.0.0. Use `appendTo` instead.
* @group Props
*/
dropdownAppendTo;
/**
* Template instance to inject into the left side of the paginator.
* @param {PaginatorState} context - Paginator state.
* @group Props
*/
templateLeft;
/**
* Template instance to inject into the right side of the paginator.
* @param {PaginatorState} context - Paginator state.
* @group Props
*/
templateRight;
/**
* Dropdown height of the viewport in pixels, a scrollbar is defined if height of list exceeds this value.
* @group Props
*/
dropdownScrollHeight = '200px';
/**
* Template of the current page report element. Available placeholders are {currentPage},{totalPages},{rows},{first},{last} and {totalRecords}
* @group Props
*/
currentPageReportTemplate = '{currentPage} of {totalPages}';
/**
* Whether to display current page report.
* @group Props
*/
showCurrentPageReport;
/**
* When enabled, icons are displayed on paginator to go first and last page.
* @group Props
*/
showFirstLastIcon = true;
/**
* Number of total records.
* @group Props
*/
totalRecords = 0;
/**
* Data count to display per page.
* @group Props
*/
rows = 0;
/**
* Array of integer/object values to display inside rows per page dropdown. A object that have 'showAll' key can be added to it to show all data. Exp; [10,20,30,{showAll:'All'}]
* @group Props
*/
rowsPerPageOptions;
/**
* Whether to display a dropdown to navigate to any page.
* @group Props
*/
showJumpToPageDropdown;
/**
* Whether to display a input to navigate to any page.
* @group Props
*/
showJumpToPageInput;
/**
* Template instance to inject into the jump to page dropdown item inside in the paginator.
* @param {Object} context - item instance.
* @group Props
*/
jumpToPageItemTemplate;
/**
* Whether to show page links.
* @group Props
*/
showPageLinks = true;
/**
* Locale to be used in formatting.
* @group Props
*/
locale;
/**
* Template instance to inject into the rows per page dropdown item inside in the paginator.
* @param {Object} context - item instance.
* @group Props
*/
dropdownItemTemplate;
/**
* Zero-relative number of the first row to be displayed.
* @group Props
*/
get first() {
return this._first;
}
set first(val) {
this._first = val;
}
/**
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @defaultValue 'self'
* @group Props
*/
appendTo = input(undefined, ...(ngDevMode ? [{ debugName: "appendTo" }] : []));
/**
* Callback to invoke when page changes, the event object contains information about the new state.
* @param {PaginatorState} event - Paginator state.
* @group Emits
*/
onPageChange = new EventEmitter();
/**
* Template for the dropdown icon.
* @group Templates
*/
dropdownIconTemplate;
/**
* Template for the first page link icon.
* @group Templates
*/
firstPageLinkIconTemplate;
/**
* Template for the previous page link icon.
* @group Templates
*/
previousPageLinkIconTemplate;
/**
* Template for the last page link icon.
* @group Templates
*/
lastPageLinkIconTemplate;
/**
* Template for the next page link icon.
* @group Templates
*/
nextPageLinkIconTemplate;
templates;
_dropdownIconTemplate;
_firstPageLinkIconTemplate;
_previousPageLinkIconTemplate;
_lastPageLinkIconTemplate;
_nextPageLinkIconTemplate;
pageLinks;
pageItems;
rowsPerPageItems;
paginatorState;
_first = 0;
_page = 0;
_componentStyle = inject(PaginatorStyle);
$appendTo = computed(() => this.appendTo() || this.config.overlayAppendTo(), ...(ngDevMode ? [{ debugName: "$appendTo" }] : []));
get display() {
return this.alwaysShow || (this.pageLinks && this.pageLinks.length > 1) ? null : 'none';
}
constructor() {
super();
}
ngOnInit() {
super.ngOnInit();
this.updatePaginatorState();
}
ngAfterContentInit() {
this.templates.forEach((item) => {
switch (item.getType()) {
case 'dropdownicon':
this._dropdownIconTemplate = item.template;
break;
case 'firstpagelinkicon':
this._firstPageLinkIconTemplate = item.template;
break;
case 'previouspagelinkicon':
this._previousPageLinkIconTemplate = item.template;
break;
case 'lastpagelinkicon':
this._lastPageLinkIconTemplate = item.template;
break;
case 'nextpagelinkicon':
this._nextPageLinkIconTemplate = item.template;
break;
}
});
}
getAriaLabel(labelType) {
return this.config.translation.aria ? this.config.translation.aria[labelType] : undefined;
}
getPageAriaLabel(value) {
return this.config.translation.aria ? this.config.translation.aria.pageLabel.replace(/{page}/g, `${value}`) : undefined;
}
getLocalization(digit) {
const numerals = [...new Intl.NumberFormat(this.locale, { useGrouping: false }).format(9876543210)].reverse();
const index = new Map(numerals.map((d, i) => [i, d]));
if (digit > 9) {
const numbers = String(digit).split('');
return numbers.map((number) => index.get(Number(number))).join('');
}
else {
return index.get(digit);
}
}
ngOnChanges(simpleChange) {
super.ngOnChanges(simpleChange);
if (simpleChange.totalRecords) {
this.updatePageLinks();
this.updatePaginatorState();
this.updateFirst();
this.updateRowsPerPageOptions();
}
if (simpleChange.first) {
this._first = simpleChange.first.currentValue;
this.updatePageLinks();
this.updatePaginatorState();
}
if (simpleChange.rows) {
this.updatePageLinks();
this.updatePaginatorState();
}
if (simpleChange.rowsPerPageOptions) {
this.updateRowsPerPageOptions();
}
if (simpleChange.pageLinkSize) {
this.updatePageLinks();
}
}
updateRowsPerPageOptions() {
if (this.rowsPerPageOptions) {
this.rowsPerPageItems = [];
let showAllItem = null;
for (let opt of this.rowsPerPageOptions) {
if (typeof opt == 'object' && opt['showAll']) {
showAllItem = { label: opt['showAll'], value: this.totalRecords };
}
else {
this.rowsPerPageItems.push({ label: String(this.getLocalization(opt)), value: opt });
}
}
if (showAllItem) {
this.rowsPerPageItems.push(showAllItem);
}
}
}
isFirstPage() {
return this.getPage() === 0;
}
isLastPage() {
return this.getPage() === this.getPageCount() - 1;
}
getPageCount() {
return Math.ceil(this.totalRecords / this.rows);
}
calculatePageLinkBoundaries() {
let numberOfPages = this.getPageCount(), visiblePages = Math.min(this.pageLinkSize, numberOfPages);
//calculate range, keep current in middle if necessary
let start = Math.max(0, Math.ceil(this.getPage() - visiblePages / 2)), end = Math.min(numberOfPages - 1, start + visiblePages - 1);
//check when approaching to last page
var delta = this.pageLinkSize - (end - start + 1);
start = Math.max(0, start - delta);
return [start, end];
}
updatePageLinks() {
this.pageLinks = [];
let boundaries = this.calculatePageLinkBoundaries(), start = boundaries[0], end = boundaries[1];
for (let i = start; i <= end; i++) {
this.pageLinks.push(i + 1);
}
if (this.showJumpToPageDropdown) {
this.pageItems = [];
for (let i = 0; i < this.getPageCount(); i++) {
this.pageItems.push({ label: String(i + 1), value: i });
}
}
}
changePage(p) {
var pc = this.getPageCount();
if (p >= 0 && p < pc) {
this._first = this.rows * p;
var state = {
page: p,
first: this.first,
rows: this.rows,
pageCount: pc
};
this.updatePageLinks();
this.onPageChange.emit(state);
this.updatePaginatorState();
}
}
updateFirst() {
const page = this.getPage();
if (page > 0 && this.totalRecords && this.first >= this.totalRecords) {
Promise.resolve(null).then(() => this.changePage(page - 1));
}
}
getPage() {
return Math.floor(this.first / this.rows);
}
changePageToFirst(event) {
if (!this.isFirstPage()) {
this.changePage(0);
}
event.preventDefault();
}
changePageToPrev(event) {
this.changePage(this.getPage() - 1);
event.preventDefault();
}
changePageToNext(event) {
this.changePage(this.getPage() + 1);
event.preventDefault();
}
changePageToLast(event) {
if (!this.isLastPage()) {
this.changePage(this.getPageCount() - 1);
}
event.preventDefault();
}
onPageLinkClick(event, page) {
this.changePage(page);
event.preventDefault();
}
onRppChange(event) {
this.changePage(this.getPage());
}
onPageDropdownChange(event) {
this.changePage(event.value);
}
updatePaginatorState() {
this.paginatorState = {
page: this.getPage(),
pageCount: this.getPageCount(),
rows: this.rows,
first: this.first,
totalRecords: this.totalRecords
};
}
empty() {
return this.getPageCount() === 0;
}
currentPage() {
return this.getPageCount() > 0 ? this.getPage() + 1 : 0;
}
get currentPageReport() {
return this.currentPageReportTemplate
.replace('{currentPage}', String(this.currentPage()))
.replace('{totalPages}', String(this.getPageCount()))
.replace('{first}', String(this.totalRecords > 0 ? this._first + 1 : 0))
.replace('{last}', String(Math.min(this._first + this.rows, this.totalRecords)))
.replace('{rows}', String(this.rows))
.replace('{totalRecords}', String(this.totalRecords));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Paginator, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: Paginator, isStandalone: true, selector: "p-paginator", inputs: { pageLinkSize: { classPropertyName: "pageLinkSize", publicName: "pageLinkSize", isSignal: false, isRequired: false, transformFunction: numberAttribute }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: false, isRequired: false, transformFunction: null }, alwaysShow: { classPropertyName: "alwaysShow", publicName: "alwaysShow", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, dropdownAppendTo: { classPropertyName: "dropdownAppendTo", publicName: "dropdownAppendTo", isSignal: false, isRequired: false, transformFunction: null }, templateLeft: { classPropertyName: "templateLeft", publicName: "templateLeft", isSignal: false, isRequired: false, transformFunction: null }, templateRight: { classPropertyName: "templateRight", publicName: "templateRight", isSignal: false, isRequired: false, transformFunction: null }, dropdownScrollHeight: { classPropertyName: "dropdownScrollHeight", publicName: "dropdownScrollHeight", isSignal: false, isRequired: false, transformFunction: null }, currentPageReportTemplate: { classPropertyName: "currentPageReportTemplate", publicName: "currentPageReportTemplate", isSignal: false, isRequired: false, transformFunction: null }, showCurrentPageReport: { classPropertyName: "showCurrentPageReport", publicName: "showCurrentPageReport", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, showFirstLastIcon: { classPropertyName: "showFirstLastIcon", publicName: "showFirstLastIcon", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: false, isRequired: false, transformFunction: numberAttribute }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: false, isRequired: false, transformFunction: numberAttribute }, rowsPerPageOptions: { classPropertyName: "rowsPerPageOptions", publicName: "rowsPerPageOptions", isSignal: false, isRequired: false, transformFunction: null }, showJumpToPageDropdown: { classPropertyName: "showJumpToPageDropdown", publicName: "showJumpToPageDropdown", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, showJumpToPageInput: { classPropertyName: "showJumpToPageInput", publicName: "showJumpToPageInput", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, jumpToPageItemTemplate: { classPropertyName: "jumpToPageItemTemplate", publicName: "jumpToPageItemTemplate", isSignal: false, isRequired: false, transformFunction: null }, showPageLinks: { classPropertyName: "showPageLinks", publicName: "showPageLinks", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: false, isRequired: false, transformFunction: null }, dropdownItemTemplate: { classPropertyName: "dropdownItemTemplate", publicName: "dropdownItemTemplate", isSignal: false, isRequired: false, transformFunction: null }, first: { classPropertyName: "first", publicName: "first", isSignal: false, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onPageChange: "onPageChange" }, host: { properties: { "attr.data-pc-name": "'paginator'", "attr.data-pc-section": "'root'", "class": "cn(cx('paginator'), styleClass)", "style.display": "this.display" } }, providers: [PaginatorStyle], queries: [{ propertyName: "dropdownIconTemplate", first: true, predicate: ["dropdownicon"] }, { propertyName: "firstPageLinkIconTemplate", first: true, predicate: ["firstpagelinkicon"] }, { propertyName: "previousPageLinkIconTemplate", first: true, predicate: ["previouspagelinkicon"] }, { propertyName: "lastPageLinkIconTemplate", first: true, predicate: ["lastpagelinkicon"] }, { propertyName: "nextPageLinkIconTemplate", first: true, predicate: ["nextpagelinkicon"] }, { propertyName: "templates", predicate: PrimeTemplate }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
<div [class]="cx('contentStart')" *ngIf="templateLeft" [attr.data-pc-section]="'start'">
<ng-container *ngTemplateOutlet="templateLeft; context: { $implicit: paginatorState }"></ng-container>
</div>
<span [class]="cx('current')" *ngIf="showCurrentPageReport">{{ currentPageReport }}</span>
<button *ngIf="showFirstLastIcon" type="button" (click)="changePageToFirst($event)" pRipple [class]="cx('first')" [attr.aria-label]="getAriaLabel('firstPageLabel')">
<svg data-p-icon="angle-double-left" *ngIf="!firstPageLinkIconTemplate && !_firstPageLinkIconTemplate" [class]="cx('firstIcon')" />
<span [class]="cx('firstIcon')" *ngIf="firstPageLinkIconTemplate || _firstPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"></ng-template>
</span>
</button>
<button type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToPrev($event)" pRipple [class]="cx('prev')" [attr.aria-label]="getAriaLabel('prevPageLabel')">
<svg data-p-icon="angle-left" *ngIf="!previousPageLinkIconTemplate && !_previousPageLinkIconTemplate" [class]="cx('prevIcon')" />
<span [class]="cx('prevIcon')" *ngIf="previousPageLinkIconTemplate || _previousPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"></ng-template>
</span>
</button>
<span [class]="cx('pages')" *ngIf="showPageLinks">
<button
type="button"
*ngFor="let pageLink of pageLinks"
[class]="cx('page', { pageLink })"
[attr.aria-label]="getPageAriaLabel(pageLink)"
[attr.aria-current]="pageLink - 1 == getPage() ? 'page' : undefined"
(click)="onPageLinkClick($event, pageLink - 1)"
pRipple
>
{{ getLocalization(pageLink) }}
</button>
</span>
<p-select
[options]="pageItems"
[ngModel]="getPage()"
*ngIf="showJumpToPageDropdown"
[disabled]="empty()"
[attr.aria-label]="getAriaLabel('jumpToPageDropdownLabel')"
[styleClass]="cx('pcJumpToPageDropdown')"
(onChange)="onPageDropdownChange($event)"
[appendTo]="dropdownAppendTo || $appendTo()"
[scrollHeight]="dropdownScrollHeight"
>
<ng-template pTemplate="selectedItem">{{ currentPageReport }}</ng-template>
<ng-container *ngIf="jumpToPageItemTemplate">
<ng-template let-item pTemplate="item">
<ng-container *ngTemplateOutlet="jumpToPageItemTemplate; context: { $implicit: item }"></ng-container>
</ng-template>
</ng-container>
<ng-template pTemplate="dropdownicon" *ngIf="dropdownIconTemplate || _dropdownIconTemplate">
<ng-container *ngTemplateOutlet="dropdownIconTemplate || _dropdownIconTemplate"></ng-container>
</ng-template>
</p-select>
<button type="button" [disabled]="isLastPage() || empty()" (click)="changePageToNext($event)" pRipple [class]="cx('next')" [attr.aria-label]="getAriaLabel('nextPageLabel')">
<svg data-p-icon="angle-right" *ngIf="!nextPageLinkIconTemplate && !_nextPageLinkIconTemplate" [class]="cx('nextIcon')" />
<span [class]="cx('nextIcon')" *ngIf="nextPageLinkIconTemplate || _nextPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="nextPageLinkIconTemplate || _nextPageLinkIconTemplate"></ng-template>
</span>
</button>
<button *ngIf="showFirstLastIcon" type="button" [disabled]="isLastPage() || empty()" (click)="changePageToLast($event)" pRipple [class]="cx('last')" [attr.aria-label]="getAriaLabel('lastPageLabel')">
<svg data-p-icon="angle-double-right" *ngIf="!lastPageLinkIconTemplate && !_lastPageLinkIconTemplate" [class]="cx('lastIcon')" />
<span [class]="cx('lastIcon')" *ngIf="lastPageLinkIconTemplate || _lastPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"></ng-template>
</span>
</button>
<p-inputnumber *ngIf="showJumpToPageInput" [ngModel]="currentPage()" [class]="cx('pcJumpToPageInput')" [disabled]="empty()" (ngModelChange)="changePage($event - 1)"></p-inputnumber>
<p-select
[options]="rowsPerPageItems"
[(ngModel)]="rows"
*ngIf="rowsPerPageOptions"
[styleClass]="cx('pcRowPerPageDropdown')"
[disabled]="empty()"
(onChange)="onRppChange($event)"
[appendTo]="dropdownAppendTo || $appendTo()"
[scrollHeight]="dropdownScrollHeight"
[ariaLabel]="getAriaLabel('rowsPerPageLabel')"
>
<ng-container *ngIf="dropdownItemTemplate">
<ng-template let-item pTemplate="item">
<ng-container *ngTemplateOutlet="dropdownItemTemplate; context: { $implicit: item }"></ng-container>
</ng-template>
</ng-container>
<ng-template pTemplate="dropdownicon" *ngIf="dropdownIconTemplate || _dropdownIconTemplate">
<ng-container *ngTemplateOutlet="dropdownIconTemplate || _dropdownIconTemplate"></ng-container>
</ng-template>
</p-select>
<div [class]="cx('contentEnd')" *ngIf="templateRight" [attr.data-pc-section]="'end'">
<ng-container *ngTemplateOutlet="templateRight; context: { $implicit: paginatorState }"></ng-container>
</div>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "component", type: InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: Ripple, selector: "[pRipple]" }, { kind: "component", type: AngleDoubleLeftIcon, selector: "[data-p-icon=\"angle-double-left\"]" }, { kind: "component", type: AngleDoubleRightIcon, selector: "[data-p-icon=\"angle-double-right\"]" }, { kind: "component", type: AngleLeftIcon, selector: "[data-p-icon=\"angle-left\"]" }, { kind: "component", type: AngleRightIcon, selector: "[data-p-icon=\"angle-right\"]" }, { kind: "ngmodule", type: SharedModule }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Paginator, decorators: [{
type: Component,
args: [{
selector: 'p-paginator',
standalone: true,
imports: [CommonModule, Select, InputNumber, FormsModule, Ripple, AngleDoubleLeftIcon, AngleDoubleRightIcon, AngleLeftIcon, AngleRightIcon, SharedModule],
template: `
<div [class]="cx('contentStart')" *ngIf="templateLeft" [attr.data-pc-section]="'start'">
<ng-container *ngTemplateOutlet="templateLeft; context: { $implicit: paginatorState }"></ng-container>
</div>
<span [class]="cx('current')" *ngIf="showCurrentPageReport">{{ currentPageReport }}</span>
<button *ngIf="showFirstLastIcon" type="button" (click)="changePageToFirst($event)" pRipple [class]="cx('first')" [attr.aria-label]="getAriaLabel('firstPageLabel')">
<svg data-p-icon="angle-double-left" *ngIf="!firstPageLinkIconTemplate && !_firstPageLinkIconTemplate" [class]="cx('firstIcon')" />
<span [class]="cx('firstIcon')" *ngIf="firstPageLinkIconTemplate || _firstPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"></ng-template>
</span>
</button>
<button type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToPrev($event)" pRipple [class]="cx('prev')" [attr.aria-label]="getAriaLabel('prevPageLabel')">
<svg data-p-icon="angle-left" *ngIf="!previousPageLinkIconTemplate && !_previousPageLinkIconTemplate" [class]="cx('prevIcon')" />
<span [class]="cx('prevIcon')" *ngIf="previousPageLinkIconTemplate || _previousPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"></ng-template>
</span>
</button>
<span [class]="cx('pages')" *ngIf="showPageLinks">
<button
type="button"
*ngFor="let pageLink of pageLinks"
[class]="cx('page', { pageLink })"
[attr.aria-label]="getPageAriaLabel(pageLink)"
[attr.aria-current]="pageLink - 1 == getPage() ? 'page' : undefined"
(click)="onPageLinkClick($event, pageLink - 1)"
pRipple
>
{{ getLocalization(pageLink) }}
</button>
</span>
<p-select
[options]="pageItems"
[ngModel]="getPage()"
*ngIf="showJumpToPageDropdown"
[disabled]="empty()"
[attr.aria-label]="getAriaLabel('jumpToPageDropdownLabel')"
[styleClass]="cx('pcJumpToPageDropdown')"
(onChange)="onPageDropdownChange($event)"
[appendTo]="dropdownAppendTo || $appendTo()"
[scrollHeight]="dropdownScrollHeight"
>
<ng-template pTemplate="selectedItem">{{ currentPageReport }}</ng-template>
<ng-container *ngIf="jumpToPageItemTemplate">
<ng-template let-item pTemplate="item">
<ng-container *ngTemplateOutlet="jumpToPageItemTemplate; context: { $implicit: item }"></ng-container>
</ng-template>
</ng-container>
<ng-template pTemplate="dropdownicon" *ngIf="dropdownIconTemplate || _dropdownIconTemplate">
<ng-container *ngTemplateOutlet="dropdownIconTemplate || _dropdownIconTemplate"></ng-container>
</ng-template>
</p-select>
<button type="button" [disabled]="isLastPage() || empty()" (click)="changePageToNext($event)" pRipple [class]="cx('next')" [attr.aria-label]="getAriaLabel('nextPageLabel')">
<svg data-p-icon="angle-right" *ngIf="!nextPageLinkIconTemplate && !_nextPageLinkIconTemplate" [class]="cx('nextIcon')" />
<span [class]="cx('nextIcon')" *ngIf="nextPageLinkIconTemplate || _nextPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="nextPageLinkIconTemplate || _nextPageLinkIconTemplate"></ng-template>
</span>
</button>
<button *ngIf="showFirstLastIcon" type="button" [disabled]="isLastPage() || empty()" (click)="changePageToLast($event)" pRipple [class]="cx('last')" [attr.aria-label]="getAriaLabel('lastPageLabel')">
<svg data-p-icon="angle-double-right" *ngIf="!lastPageLinkIconTemplate && !_lastPageLinkIconTemplate" [class]="cx('lastIcon')" />
<span [class]="cx('lastIcon')" *ngIf="lastPageLinkIconTemplate || _lastPageLinkIconTemplate">
<ng-template *ngTemplateOutlet="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"></ng-template>
</span>
</button>
<p-inputnumber *ngIf="showJumpToPageInput" [ngModel]="currentPage()" [class]="cx('pcJumpToPageInput')" [disabled]="empty()" (ngModelChange)="changePage($event - 1)"></p-inputnumber>
<p-select
[options]="rowsPerPageItems"
[(ngModel)]="rows"
*ngIf="rowsPerPageOptions"
[styleClass]="cx('pcRowPerPageDropdown')"
[disabled]="empty()"
(onChange)="onRppChange($event)"
[appendTo]="dropdownAppendTo || $appendTo()"
[scrollHeight]="dropdownScrollHeight"
[ariaLabel]="getAriaLabel('rowsPerPageLabel')"
>
<ng-container *ngIf="dropdownItemTemplate">
<ng-template let-item pTemplate="item">
<ng-container *ngTemplateOutlet="dropdownItemTemplate; context: { $implicit: item }"></ng-container>
</ng-template>
</ng-container>
<ng-template pTemplate="dropdownicon" *ngIf="dropdownIconTemplate || _dropdownIconTemplate">
<ng-container *ngTemplateOutlet="dropdownIconTemplate || _dropdownIconTemplate"></ng-container>
</ng-template>
</p-select>
<div [class]="cx('contentEnd')" *ngIf="templateRight" [attr.data-pc-section]="'end'">
<ng-container *ngTemplateOutlet="templateRight; context: { $implicit: paginatorState }"></ng-container>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [PaginatorStyle],
host: {
'[attr.data-pc-name]': "'paginator'",
'[attr.data-pc-section]': "'root'",
'[class]': "cn(cx('paginator'), styleClass)"
}
}]
}], ctorParameters: () => [], propDecorators: { pageLinkSize: [{
type: Input,
args: [{ transform: numberAttribute }]
}], styleClass: [{
type: Input
}], alwaysShow: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], dropdownAppendTo: [{
type: Input
}], templateLeft: [{
type: Input
}], templateRight: [{
type: Input
}], dropdownScrollHeight: [{
type: Input
}], currentPageReportTemplate: [{
type: Input
}], showCurrentPageReport: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], showFirstLastIcon: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], totalRecords: [{
type: Input,
args: [{ transform: numberAttribute }]
}], rows: [{
type: Input,
args: [{ transform: numberAttribute }]
}], rowsPerPageOptions: [{
type: Input
}], showJumpToPageDropdown: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], showJumpToPageInput: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], jumpToPageItemTemplate: [{
type: Input
}], showPageLinks: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], locale: [{
type: Input
}], dropdownItemTemplate: [{
type: Input
}], first: [{
type: Input
}], onPageChange: [{
type: Output
}], dropdownIconTemplate: [{
type: ContentChild,
args: ['dropdownicon', { descendants: false }]
}], firstPageLinkIconTemplate: [{
type: ContentChild,
args: ['firstpagelinkicon', { descendants: false }]
}], previousPageLinkIconTemplate: [{
type: ContentChild,
args: ['previouspagelinkicon', { descendants: false }]
}], lastPageLinkIconTemplate: [{
type: ContentChild,
args: ['lastpagelinkicon', { descendants: false }]
}], nextPageLinkIconTemplate: [{
type: ContentChild,
args: ['nextpagelinkicon', { descendants: false }]
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}], display: [{
type: HostBinding,
args: ['style.display']
}] } });
class PaginatorModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: PaginatorModule, imports: [Paginator, SharedModule], exports: [Paginator, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorModule, imports: [Paginator, SharedModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: PaginatorModule, decorators: [{
type: NgModule,
args: [{
imports: [Paginator, SharedModule],
exports: [Paginator, SharedModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { Paginator, PaginatorClasses, PaginatorModule, PaginatorStyle };
//# sourceMappingURL=primeng-paginator.mjs.map