import { BasePlugin } from '../base'; export declare const PLUGIN_KEY = "pagination"; export declare const PLUGIN_PRIORITY = 900; /** * @plugin Pagination * @class Pagination * * @description * The plugin adds full-featured pagination capabilities to a table component. * It manages splitting rows into pages, rendering navigation controls, and exposing * methods and configuration for initializing and updating pagination state. * * Core responsibilities: * - Calculate which rows should be visible based on current `page` and `pageSize`. * - Render a toolbar area containing: * - a page size dropdown section (if `showPageSize` = `true`) * - a row counter section ("1 - 10 of 50", if `showCounter` = `true`) * - page navigation section (if `showNavigation` = `true`) * - Emit hooks when: * - the user navigates to a different page * - the user changes the number of rows per page * - the user changes the visibility of any sections * - Allow external code to programmatically: * - jump to a specific page * - change the page size * - change the visibility of UI sections * * @example * * ::: only-for javascript * ```js * const hot = new Handsontable(document.getElementById('example'), { * data: getData(), * pagination: { * pageSize: 10, * pageSizeList: ['auto', 5, 10, 20, 50, 100], * initialPage: 1, * showPageSize: true, * showCounter: true, * showNavigation: true, * }, * }); * ``` * ::: * * ::: only-for react * ```jsx * * ``` * ::: * * ::: only-for angular * ```ts * settings = { * pagination: { * pageSize: 10, * pageSizeList: ['auto', 5, 10, 20, 50, 100], * initialPage: 1, * showPageSize: true, * showCounter: true, * showNavigation: true, * }, * }; * ``` * ::: */ export declare class Pagination extends BasePlugin { #private; /** * Returns the plugin key used to identify this plugin in Handsontable settings. */ static get PLUGIN_KEY(): string; /** * Returns the priority order used to determine the order in which plugins are initialized. */ static get PLUGIN_PRIORITY(): number; /** * Returns the default settings applied when the plugin is enabled without explicit configuration. */ static get DEFAULT_SETTINGS(): { pageSize: number; pageSizeList: (string | number)[]; initialPage: number; showPageSize: boolean; showCounter: boolean; showNavigation: boolean; uiContainer: unknown; }; /** * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit} * hook and if it returns `true` than the {@link Pagination#enablePlugin} method is called. * * @returns {boolean} */ isEnabled(): boolean; /** * Enables the plugin functionality for this Handsontable instance. */ enablePlugin(): void; /** * Restores the page after a failed external load. * * @param {number} previousPage Page to restore (1-based). * @category Pagination */ revertPageTo(previousPage: number): void; /** * Restores the page size after a failed external load. * * @param {number | 'auto'} previousPageSize Previous page size. * @category Pagination */ revertPageSizeTo(previousPageSize: number | 'auto'): void; /** * Updates the plugin state. This method is executed when {@link Core#updateSettings} is invoked. */ updatePlugin(): void; /** * Disables the plugin functionality for this Handsontable instance. */ disablePlugin(): void; /** * Gets the pagination current state. Returns an object with the following properties: * - `currentPage`: The current page number. * - `totalPages`: The total number of pages. * - `pageSize`: The page size. * - `pageSizeList`: The list of page sizes. * - `autoPageSize`: Whether the page size is calculated automatically. * - `numberOfRenderedRows`: The number of rendered rows. * - `firstVisibleRowIndex`: The index of the first visible row. * - `lastVisibleRowIndex`: The index of the last visible row. * * @returns {{ * currentPage: number, * totalPages: number, * pageSize: number, * pageSizeList: Array, * autoPageSize: boolean, * numberOfRenderedRows: number, * firstVisibleRowIndex: number, * lastVisibleRowIndex: number * }} */ getPaginationData(): { currentPage: number; totalPages: number; pageSize: number | "auto"; pageSizeList: unknown[]; autoPageSize: boolean; numberOfRenderedRows: number; firstVisibleRowIndex: number; lastVisibleRowIndex: number; }; /** * Returns the current 1-based page index from internal pagination state. * * @returns {number} Current page (at least 1). */ getCurrentPage(): number; /** * Returns the current page size from internal pagination state. May be `'auto'`. * * @returns {number | 'auto'} Current page size or `'auto'`. */ getCurrentPageSize(): number | "auto"; /** * Allows changing the page for specified page number. * * @param {number} pageNumber The page number to set (from 1 to N). If `0` is passed, it * will be transformed to `1`. * @fires Hooks#beforePageChange * @fires Hooks#afterPageChange */ setPage(pageNumber: number): void; /** * Resets the current page to the initial page (`initialValue`) defined in the settings. */ resetPage(): void; /** * Changes the page size for the pagination. The method recalculates the state based * on the new page size and re-renders the table. If `'auto'` is passed, the plugin will * calculate the page size based on the viewport size and row heights to make sure * that there will be no vertical scrollbar in the table. * * @param {number | 'auto'} pageSize The page size to set. * @fires Hooks#beforePageSizeChange * @fires Hooks#afterPageSizeChange */ setPageSize(pageSize: number | 'auto'): void; /** * Resets the page size to the initial value (`pageSize`) defined in the settings. */ resetPageSize(): void; /** * Resets the pagination state to the initial values defined in the settings. */ resetPagination(): void; /** * Switches the page to the next one. */ nextPage(): void; /** * Switches the page to the previous one. */ prevPage(): void; /** * Switches the page to the first one. */ firstPage(): void; /** * Switches the page to the last one. */ lastPage(): void; /** * Checks, based on the current internal state, if there is a previous page. * * @returns {boolean} */ hasPreviousPage(): boolean; /** * Checks, based on the current internal state, if there is a next page. * * @returns {boolean} */ hasNextPage(): boolean; /** * Gets the visual data for the current page. The returned data may be longer than the defined * page size as the data may contain hidden rows (rows that are not rendered in the table). * * @returns {Array} Returns the data for the current page. */ getCurrentPageData(): unknown[]; /** * Shows the page size section in the pagination UI. * * @fires Hooks#afterPageSizeVisibilityChange */ showPageSizeSection(): void; /** * Hides the page size section in the pagination UI. * * @fires Hooks#afterPageSizeVisibilityChange */ hidePageSizeSection(): void; /** * Shows the page counter section in the pagination UI. * * @fires Hooks#afterPageCounterVisibilityChange */ showPageCounterSection(): void; /** * Hides the page counter section in the pagination UI. * * @fires Hooks#afterPageCounterVisibilityChange */ hidePageCounterSection(): void; /** * Shows the page navigation section in the pagination UI. * * @fires Hooks#afterPageNavigationVisibilityChange */ showPageNavigationSection(): void; /** * Hides the page navigation section in the pagination UI. * * @fires Hooks#afterPageNavigationVisibilityChange */ hidePageNavigationSection(): void; /** * Destroys the plugin instance. */ destroy(): void; }