UNPKG

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

942 lines (926 loc) 43.9 kB
import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, EventEmitter, inject, booleanAttribute, numberAttribute, 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 { AngleDoubleLeftIcon, AngleDoubleRightIcon, AngleLeftIcon, AngleRightIcon } from 'primeng/icons'; import { InputNumber } from 'primeng/inputnumber'; import { Ripple } from 'primeng/ripple'; import { Select } from 'primeng/select'; import { BaseStyle } from 'primeng/base'; const theme = ({ dt }) => ` .p-paginator { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; background: ${dt('paginator.background')}; color: ${dt('paginator.color')}; padding: ${dt('paginator.padding')}; border-radius: ${dt('paginator.border.radius')}; gap: ${dt('paginator.gap')}; } .p-paginator-content { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: ${dt('paginator.gap')}; } .p-paginator-content-start { margin-inline-end: auto; } .p-paginator-content-end { margin-inline-start: auto; } .p-paginator-page, .p-paginator-next, .p-paginator-last, .p-paginator-first, .p-paginator-prev { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; user-select: none; overflow: hidden; position: relative; background: ${dt('paginator.nav.button.background')}; border: 0 none; color: ${dt('paginator.nav.button.color')}; min-width: ${dt('paginator.nav.button.width')}; height: ${dt('paginator.nav.button.height')}; transition: background ${dt('paginator.transition.duration')}, color ${dt('paginator.transition.duration')}, outline-color ${dt('paginator.transition.duration')}, box-shadow ${dt('paginator.transition.duration')}; border-radius: ${dt('paginator.nav.button.border.radius')}; padding: 0; margin: 0; } .p-paginator-page:focus-visible, .p-paginator-next:focus-visible, .p-paginator-last:focus-visible, .p-paginator-first:focus-visible, .p-paginator-prev:focus-visible { box-shadow: ${dt('paginator.nav.button.focus.ring.shadow')}; outline: ${dt('paginator.nav.button.focus.ring.width')} ${dt('paginator.nav.button.focus.ring.style')} ${dt('paginator.nav.button.focus.ring.color')}; outline-offset: ${dt('paginator.nav.button.focus.ring.offset')}; } .p-paginator-page:not(.p-disabled):not(.p-paginator-page-selected):hover, .p-paginator-first:not(.p-disabled):hover, .p-paginator-prev:not(.p-disabled):hover, .p-paginator-next:not(.p-disabled):hover, .p-paginator-last:not(.p-disabled):hover { background: ${dt('paginator.nav.button.hover.background')}; color: ${dt('paginator.nav.button.hover.color')}; } .p-paginator-first:dir(rtl), .p-paginator-prev:dir(rtl), .p-paginator-next:dir(rtl), .p-paginator-last:dir(rtl) { transform: rotate(180deg); } .p-paginator-page.p-paginator-page-selected { background: ${dt('paginator.nav.button.selected.background')}; color: ${dt('paginator.nav.button.selected.color')}; } .p-paginator-current { color: ${dt('paginator.current.page.report.color')}; } .p-paginator-pages { display: flex; align-items: center; gap: ${dt('paginator.gap')}; } .p-paginator-jtp-input .p-inputtext { max-width: ${dt('paginator.jump.to.page.input.max.width')}; } `; const classes = { paginator: ({ instance, key }) => [ 'p-paginator p-component', { 'p-paginator-default': !instance.hasBreakpoints(), [`p-paginator-${key}`]: instance.hasBreakpoints() } ], content: 'p-paginator-content', contentStart: 'p-paginator-content-start', contentEnd: 'p-paginator-content-end', first: ({ instance }) => [ 'p-paginator-first', { 'p-disabled': instance.$attrs.disabled } ], firstIcon: 'p-paginator-first-icon', prev: ({ instance }) => [ 'p-paginator-prev', { 'p-disabled': instance.$attrs.disabled } ], prevIcon: 'p-paginator-prev-icon', next: ({ instance }) => [ 'p-paginator-next', { 'p-disabled': instance.$attrs.disabled } ], nextIcon: 'p-paginator-next-icon', last: ({ instance }) => [ 'p-paginator-last', { 'p-disabled': instance.$attrs.disabled } ], lastIcon: 'p-paginator-last-icon', pages: 'p-paginator-pages', page: ({ props, pageLink }) => [ 'p-paginator-page', { 'p-paginator-page-selected': pageLink - 1 === props.page } ], 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 = theme; classes = classes; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: PaginatorStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: PaginatorStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", 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; /** * Inline style of the component. * @group Props */ style; /** * Style class of the component. * @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). * @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; /** * 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). * @group Props */ appendTo; /** * 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; } /** * 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); 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: "19.2.2", ngImport: i0, type: Paginator, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: Paginator, isStandalone: true, selector: "p-paginator", inputs: { pageLinkSize: ["pageLinkSize", "pageLinkSize", numberAttribute], style: "style", styleClass: "styleClass", alwaysShow: ["alwaysShow", "alwaysShow", booleanAttribute], dropdownAppendTo: "dropdownAppendTo", templateLeft: "templateLeft", templateRight: "templateRight", appendTo: "appendTo", dropdownScrollHeight: "dropdownScrollHeight", currentPageReportTemplate: "currentPageReportTemplate", showCurrentPageReport: ["showCurrentPageReport", "showCurrentPageReport", booleanAttribute], showFirstLastIcon: ["showFirstLastIcon", "showFirstLastIcon", booleanAttribute], totalRecords: ["totalRecords", "totalRecords", numberAttribute], rows: ["rows", "rows", numberAttribute], rowsPerPageOptions: "rowsPerPageOptions", showJumpToPageDropdown: ["showJumpToPageDropdown", "showJumpToPageDropdown", booleanAttribute], showJumpToPageInput: ["showJumpToPageInput", "showJumpToPageInput", booleanAttribute], jumpToPageItemTemplate: "jumpToPageItemTemplate", showPageLinks: ["showPageLinks", "showPageLinks", booleanAttribute], locale: "locale", dropdownItemTemplate: "dropdownItemTemplate", first: "first" }, outputs: { onPageChange: "onPageChange" }, 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]="styleClass" [ngStyle]="style" [ngClass]="'p-paginator p-component'" *ngIf="alwaysShow ? true : pageLinks && pageLinks.length > 1" [attr.data-pc-section]="'paginator'" [attr.data-pc-section]="'root'"> <div class="p-paginator-content-start" *ngIf="templateLeft" [attr.data-pc-section]="'start'"> <ng-container *ngTemplateOutlet="templateLeft; context: { $implicit: paginatorState }"></ng-container> </div> <span class="p-paginator-current" *ngIf="showCurrentPageReport">{{ currentPageReport }}</span> <button *ngIf="showFirstLastIcon" type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToFirst($event)" pRipple class="p-paginator-first" [ngClass]="{ 'p-disabled': isFirstPage() || empty() }" [attr.aria-label]="getAriaLabel('firstPageLabel')" > <AngleDoubleLeftIcon *ngIf="!firstPageLinkIconTemplate && !_firstPageLinkIconTemplate" [styleClass]="'p-paginator-first-icon'" /> <span class="p-paginator-first-icon" *ngIf="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"></ng-template> </span> </button> <button type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToPrev($event)" pRipple class="p-paginator-prev" [ngClass]="{ 'p-disabled': isFirstPage() || empty() }" [attr.aria-label]="getAriaLabel('prevPageLabel')"> <AngleLeftIcon *ngIf="!previousPageLinkIconTemplate && !_previousPageLinkIconTemplate" [styleClass]="'p-paginator-prev-icon'" /> <span class="p-paginator-prev-icon" *ngIf="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"></ng-template> </span> </button> <span class="p-paginator-pages" *ngIf="showPageLinks"> <button type="button" *ngFor="let pageLink of pageLinks" class="p-paginator-page" [ngClass]="{ 'p-paginator-page-selected': pageLink - 1 == getPage() }" [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="p-paginator-jtp-dropdown" (onChange)="onPageDropdownChange($event)" [appendTo]="dropdownAppendTo" [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="p-paginator-next" [ngClass]="{ 'p-disabled': isLastPage() || empty() }" [attr.aria-label]="getAriaLabel('nextPageLabel')"> <AngleRightIcon *ngIf="!nextPageLinkIconTemplate && !_nextPageLinkIconTemplate" [styleClass]="'p-paginator-next-icon'" /> <span class="p-paginator-next-icon" *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="p-paginator-last" [ngClass]="{ 'p-disabled': isLastPage() || empty() }" [attr.aria-label]="getAriaLabel('lastPageLabel')" > <AngleDoubleRightIcon *ngIf="!lastPageLinkIconTemplate && !_lastPageLinkIconTemplate" [styleClass]="'p-paginator-last-icon'" /> <span class="p-paginator-last-icon" *ngIf="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"></ng-template> </span> </button> <p-inputnumber *ngIf="showJumpToPageInput" [ngModel]="currentPage()" class="p-paginator-jtp-input" [disabled]="empty()" (ngModelChange)="changePage($event - 1)"></p-inputnumber> <p-select [options]="rowsPerPageItems" [(ngModel)]="rows" *ngIf="rowsPerPageOptions" styleClass="p-paginator-rpp-dropdown" [disabled]="empty()" (onChange)="onRppChange($event)" [appendTo]="dropdownAppendTo" [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="p-paginator-content-end" *ngIf="templateRight" [attr.data-pc-section]="'end'"> <ng-container *ngTemplateOutlet="templateRight; context: { $implicit: paginatorState }"></ng-container> </div> </div> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], 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", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], 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: "AngleDoubleLeftIcon" }, { kind: "component", type: AngleDoubleRightIcon, selector: "AngleDoubleRightIcon" }, { kind: "component", type: AngleLeftIcon, selector: "AngleLeftIcon" }, { kind: "component", type: AngleRightIcon, selector: "AngleRightIcon" }, { 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: "19.2.2", 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]="styleClass" [ngStyle]="style" [ngClass]="'p-paginator p-component'" *ngIf="alwaysShow ? true : pageLinks && pageLinks.length > 1" [attr.data-pc-section]="'paginator'" [attr.data-pc-section]="'root'"> <div class="p-paginator-content-start" *ngIf="templateLeft" [attr.data-pc-section]="'start'"> <ng-container *ngTemplateOutlet="templateLeft; context: { $implicit: paginatorState }"></ng-container> </div> <span class="p-paginator-current" *ngIf="showCurrentPageReport">{{ currentPageReport }}</span> <button *ngIf="showFirstLastIcon" type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToFirst($event)" pRipple class="p-paginator-first" [ngClass]="{ 'p-disabled': isFirstPage() || empty() }" [attr.aria-label]="getAriaLabel('firstPageLabel')" > <AngleDoubleLeftIcon *ngIf="!firstPageLinkIconTemplate && !_firstPageLinkIconTemplate" [styleClass]="'p-paginator-first-icon'" /> <span class="p-paginator-first-icon" *ngIf="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="firstPageLinkIconTemplate || _firstPageLinkIconTemplate"></ng-template> </span> </button> <button type="button" [disabled]="isFirstPage() || empty()" (click)="changePageToPrev($event)" pRipple class="p-paginator-prev" [ngClass]="{ 'p-disabled': isFirstPage() || empty() }" [attr.aria-label]="getAriaLabel('prevPageLabel')"> <AngleLeftIcon *ngIf="!previousPageLinkIconTemplate && !_previousPageLinkIconTemplate" [styleClass]="'p-paginator-prev-icon'" /> <span class="p-paginator-prev-icon" *ngIf="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="previousPageLinkIconTemplate || _previousPageLinkIconTemplate"></ng-template> </span> </button> <span class="p-paginator-pages" *ngIf="showPageLinks"> <button type="button" *ngFor="let pageLink of pageLinks" class="p-paginator-page" [ngClass]="{ 'p-paginator-page-selected': pageLink - 1 == getPage() }" [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="p-paginator-jtp-dropdown" (onChange)="onPageDropdownChange($event)" [appendTo]="dropdownAppendTo" [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="p-paginator-next" [ngClass]="{ 'p-disabled': isLastPage() || empty() }" [attr.aria-label]="getAriaLabel('nextPageLabel')"> <AngleRightIcon *ngIf="!nextPageLinkIconTemplate && !_nextPageLinkIconTemplate" [styleClass]="'p-paginator-next-icon'" /> <span class="p-paginator-next-icon" *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="p-paginator-last" [ngClass]="{ 'p-disabled': isLastPage() || empty() }" [attr.aria-label]="getAriaLabel('lastPageLabel')" > <AngleDoubleRightIcon *ngIf="!lastPageLinkIconTemplate && !_lastPageLinkIconTemplate" [styleClass]="'p-paginator-last-icon'" /> <span class="p-paginator-last-icon" *ngIf="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"> <ng-template *ngTemplateOutlet="lastPageLinkIconTemplate || _lastPageLinkIconTemplate"></ng-template> </span> </button> <p-inputnumber *ngIf="showJumpToPageInput" [ngModel]="currentPage()" class="p-paginator-jtp-input" [disabled]="empty()" (ngModelChange)="changePage($event - 1)"></p-inputnumber> <p-select [options]="rowsPerPageItems" [(ngModel)]="rows" *ngIf="rowsPerPageOptions" styleClass="p-paginator-rpp-dropdown" [disabled]="empty()" (onChange)="onRppChange($event)" [appendTo]="dropdownAppendTo" [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="p-paginator-content-end" *ngIf="templateRight" [attr.data-pc-section]="'end'"> <ng-container *ngTemplateOutlet="templateRight; context: { $implicit: paginatorState }"></ng-container> </div> </div> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [PaginatorStyle] }] }], ctorParameters: () => [], propDecorators: { pageLinkSize: [{ type: Input, args: [{ transform: numberAttribute }] }], style: [{ type: Input }], styleClass: [{ type: Input }], alwaysShow: [{ type: Input, args: [{ transform: booleanAttribute }] }], dropdownAppendTo: [{ type: Input }], templateLeft: [{ type: Input }], templateRight: [{ type: Input }], appendTo: [{ 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] }] } }); class PaginatorModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: PaginatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: PaginatorModule, imports: [Paginator, SharedModule], exports: [Paginator, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: PaginatorModule, imports: [Paginator, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", 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