import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
import { FormControl } from '@angular/forms';
import { TsSelectionListChange } from '@terminus/ui/selection-list';
import { TsStyleThemeTypes } from '@terminus/ui/utilities';
/**
* Define the allowed keys and types for an item passed to the {@link TsMenuComponent} within a
* {@link TsPaginatorComponent}
*/
export interface TsPaginatorMenuItem {
/**
* The menu item name
*/
name: string;
/**
* A value for the item
*/
value?: number;
}
/**
* A paginator component
*
* @example
*
*
*
* {{ message }}
* Learn more
*
*
* https://getterminus.github.io/ui-demos-release/components/paginator
*/
export declare class TsPaginatorComponent implements OnChanges, AfterViewInit {
private changeDetectorRef;
/**
* Define the default message to show when too many records are returned
*/
private DEFAULT_HIGH_RECORD_MESSAGE;
/**
* This does not allow user input in selection list
*/
allowUserInput: boolean;
/**
* Define the icon for the 'first page' button
*/
firstPageIcon: string;
/**
* Set up a form control to pass to {@link TsSelectionListComponent}
*/
pageControl: FormControl;
/**
* Define the icon for the 'previous page' button
*/
previousPageIcon: string;
/**
* Define the icon for the 'next page' button
*/
nextPageIcon: string;
/**
* Define the icon for the 'last page' button
*/
lastPageIcon: string;
/**
* Store the array of objects that represent pages of collections
*/
pagesArray: TsPaginatorMenuItem[];
/**
* Store the label for the current page
*/
currentPageLabel: string;
/**
* Define the amount of records show per page
*
* @param value
*/
set recordsPerPage(value: number);
get recordsPerPage(): number;
private _recordsPerPage;
/**
* Define the template context for the record count message
*/
templateContext: {
$implicit: string;
};
/**
* Getter to return the index of the first page
*/
get firstPageIndex(): number;
/**
* Getter to return the index of the next page
*/
get nextPageIndex(): number;
/**
* Getter to return the index of the last page
*/
get lastPageIndex(): number;
/**
* Define if the paging is 0-based or 1-based
*/
isZeroBased: boolean;
/**
* Define the tooltip message for the first page tooltip
*/
firstPageTooltip: string;
/**
* Define the tooltip message for the previous page tooltip
*/
previousPageTooltip: string;
/**
* Define the tooltip message for the next page tooltip
*/
nextPageTooltip: string;
/**
* Define the tooltip message for the last page tooltip
*/
lastPageTooltip: string;
/**
* Define the current page
*
* @param page
*/
set currentPageIndex(page: number);
get currentPageIndex(): number;
private _currentPageIndex;
/**
* Define how many pages exist to show a prompt about better filtering
*/
maxPreferredRecords: number;
/**
* Define the menu location (open up or open down)
*/
menuLocation: 'above' | 'below';
/**
* Allow a custom template to be used for the paginator message
*/
paginatorMessageTemplate: TemplateRef;
/**
* Define the color theme
*/
theme: TsStyleThemeTypes;
/**
* Define the total number of records
*
* @param records
*/
set totalRecords(records: number);
get totalRecords(): number;
private _totalRecords;
/**
* Define the message to show when too many pages exist
*/
recordCountTooHighMessage: string;
/**
* Define how many records are shown per page
*/
recordsPerPageChoices: number[];
/**
* Define the label for the records per page select
*/
recordsSelectLabel: string;
/**
* Define if the records per page select menu should be visible
*/
showRecordsPerPageSelector: boolean;
/**
* Determine if the paginator should be in 'simple' mode
*
* Simple mode: Page jump dropdown is converted to plain text, jump to last page button removed.
*/
isSimpleMode: boolean;
/**
* Override the disabling of the next button
*/
isNextDisabled: boolean | undefined;
/**
* Emit a page selected event
*/
readonly pageSelect: EventEmitter;
/**
* Emit a change event when the records per page changes
*/
readonly recordsPerPageChange: EventEmitter;
constructor(changeDetectorRef: ChangeDetectorRef);
/**
* Initialize after the view is initialized
*/
ngAfterViewInit(): void;
/**
* Initialize on any changes
*
* @param changes - The object containing all changes since last cycle
*/
ngOnChanges(changes: SimpleChanges): void;
/**
* Set up initial resources
*/
private initialize;
/**
* Perform tasks when the current page is changed
*
* @param page - The selected page
*/
currentPageChanged(page: TsPaginatorMenuItem): void;
/**
* Manually trigger a page change event from a number
*
* @param destinationPage - The selected page number
* @param currentPage - The current page number
* @param pages - The collection of pages
*/
changePage(destinationPage: number, currentPage: number, pages: TsPaginatorMenuItem[]): void;
/**
* Check if a page is the first page
*
* @param page - The number of the current page
* @returns A boolean representing if this is the first page
*/
isFirstPage(page: number): boolean;
/**
* Check if a page is the last page
*
* @param page - The number of the current page
* @returns A boolean representing if this is the last page
*/
isLastPage(page: number): boolean;
/**
* Check if the next button is disabled
*
* @param page - The number of the current page
* @returns A boolena representing if the button is disabled.
*/
isNextButtonDisabled(page: number): boolean;
/**
* Determine if the string exists
*
* @param message - The help message when too many results are returned
* @param max - The max number of records before the message should be shown
* @param totalRecords - The number of records
* @returns A boolean representing if the message should be shown
*/
shouldShowRecordsMessage(message: string, max: number, totalRecords: number): boolean;
/**
* Re-initialize the paginator when records per page changes
*
* @param selection - The selected records-per-page count
*/
recordsPerPageUpdated(selection: TsSelectionListChange): void;
/**
* Determine if the page select menu should be disabled
*
* @param pagesCount - The number of pages
* @returns A boolean representing if the menu should be disabled
*/
menuIsDisabled(pagesCount: number): boolean;
/**
* Determine if the records-per-page menu should be disabled
*
* @param totalRecords - The total number of records
* @param recordsPerPageChoices - The array of counts representing how many records may be show
* per page
* @returns A boolean representing if the records select should be disabled
*/
disableRecordsPerPage(totalRecords: number, recordsPerPageChoices: number[]): boolean;
/**
* Create a new label based on the current page
*
* @param currentPage - The current page
* @param pages - The array of all pages
* @param totalRecords - The number of total records
* @returns The string to use as the current page label
*/
private createCurrentPageLabel;
/**
* Create a default label based on the records per page and total records
*
* @param currentPage - The current page
* @param totalRecords - The number of total records
* @returns The string to use as the current page label
*/
private createDefaultPageLabel;
/**
* Create an array containing objects that represent each available page of records
*
* @param total - The total records remaining
* @param perPage - How many records are shown per page
* @param zeroBased - If the pages are based on a `0` index rather than `1`
* @returns The array representing all possible pages of records
*/
private createPagesArray;
/**
* Tracking method for the pagesArray ngFor
*
* @param index - The current index
* @param page - The page object
* @returns The value to be used
*/
trackPagesArray(index: number, page: TsPaginatorMenuItem): string | undefined;
}