import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnInit, Renderer2, SimpleChanges } from "@angular/core"; import { MatLegacyPaginator as MatPaginator } from "@angular/material/legacy-paginator"; import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { StarkPaginationConfig } from "./pagination-config.intf"; import { StarkPaginateEvent } from "./paginate-event.intf"; import * as i0 from "@angular/core"; /** * The available modes for the {@link StarkPaginationComponent} */ export type StarkPaginationComponentMode = "compact"; /** * Component to display pagination bar to be used with a collection of items. * * It extends the {@link https://v7.material.angular.io/components/paginator/api#MatPaginator|Angular Material's MatPaginator class} * so it can be integrated as well with the {@link https://v7.material.angular.io/components/table/examples|Angular Material's MatTable}. */ export declare class StarkPaginationComponent extends MatPaginator implements OnInit, OnChanges, AfterViewInit { logger: StarkLoggingService; element: ElementRef; renderer: Renderer2; cdRef: ChangeDetectorRef; /** * Adds class="stark-pagination" attribute on the host component */ class: string; /** * Suffix id given to "items per page" dropdown (`items-per-page-`) * and "page selector" dropdown (`page-selector-`) * * Default: `"pagination"` */ htmlSuffixId?: string; /** * Desired layout or flavour: * - `compact`: Displayed in a compact mode. * - `default`: basic implementation with multiple buttons to change pages */ mode?: StarkPaginationComponentMode; /** * Object containing main information for the pagination. */ paginationConfig: StarkPaginationConfig; /** * Output event emitter that will emit the paginate event when the pagination changed. */ readonly paginated: EventEmitter; /** * Page number entered manually by the user via the "enter page" input field */ get paginationInput(): number; set paginationInput(newValue: number); /** * @ignore */ private _paginationInput; /** * Previous page number entered by the user */ previousPaginationInput: number; /** * Index corresponding to the previous page */ previousPageIndex: number; /** * Page numbers to be displayed by the component when `extended` mode is enabled */ pageNumbers: ("..." | number)[]; /** * Class constructor * @param logger - The `StarkLoggingService` instance of the application. * @param element - Reference to the DOM element where this component is attached to. * @param renderer - Angular `Renderer2` wrapper for DOM manipulations. * @param cdRef - Reference to the change detector attached to this component. */ constructor(logger: StarkLoggingService, element: ElementRef, renderer: Renderer2, cdRef: ChangeDetectorRef); /** * Component lifecycle hook */ ngOnInit(): void; /** * Component lifecycle hook */ ngAfterViewInit(): void; /** * Component lifecycle hook * @param changesObj - Contains the changed properties */ ngOnChanges(changesObj: SimpleChanges): void; /** * Creates a normalized paginationConfig to be used by this component. * If the given config is undefined it will set totalItems only, otherwise it sets default values for the missing properties * @param config - `StarkPaginationConfig` object */ normalizePaginationConfig(config: StarkPaginationConfig): StarkPaginationConfig; /** * Set the properties needed for the {@link https://v7.material.angular.io/components/paginator/api#MatPaginator|MatPaginator} base class * based on the given pagination configuration. * * @param config - The config object which be used to set the `MatPaginator` properties */ setMatPaginatorProperties(config: StarkPaginationConfig): void; /** * Check whether the given value is equal to zero (as number `0` or as string `"0"`). * @param numberToCheck - Number to check */ isZero(numberToCheck: string | number): boolean; /** * Check whether there is a page after the current one. */ hasNext(): boolean; /** * Check whether there is a page before the current one. */ hasPrevious(): boolean; /** * Change page to first one. */ goToFirst(): void; /** * Change page to previous one. */ goToPrevious(): void; /** * Change page to next one. */ goToNext(): void; /** * Change page to last one. */ goToLast(): void; /** * Emit the stark paginate event and the MatPagination event. * Then reload pageNumbers variable. */ onChangePagination(): void; /** * Get total number of pages available based on `itemsPerPage` and `totalItems`. */ getTotalPages(): number; /** * Set page to first then call `onChangePagination` function. * @param itemsPerPage - Items per page to change to */ onChangeItemsPerPage(itemsPerPage: number): void; /** * Set pageNumbers variable. */ setPageNumbers(): void; /** * Change to the given page if it is different than `"..."`. It calls `onChangePagination` afterwards. * @param page - Page to go to */ goToPage(page: number | "..."): void; /** * Change the page when the Enter key is pressed in the page number input */ changePageOnEnter(): void; /** * Return the number of digits of the current total number of pages. */ getPageInputMaxDigits(): number; /** * Whether the component is to be rendered in the `compact` mode */ isCompactMode(): boolean; /** * Emit the `PageEvent` according to the MatPaginator API. * See {@link https://v7.material.angular.io/components/paginator/api#PageEvent|MatPaginator PageEvent} */ emitMatPaginationEvent(): void; /** * Check whether the itemsPerPage should be present according to paginationConfig. * @param paginationConfig - Object containing main information for the pagination */ isItemsPerPagePresent(paginationConfig: StarkPaginationConfig): paginationConfig is StarkPaginationConfig & Required>; /** * @ignore */ trackPageNumberFn(_index: number): number; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }