import { default as CxPagination } from '../../../../../../atoms/src/components/pagination/pagination.ts';
import { IPage, IRow } from '../../../../../../types/src/table';
import { default as Module } from '../../core/Module';
import { default as Tabulator } from '../../core/Tabulator';

export default class Page extends Module implements IPage {
    static readonly moduleName = "page";
    paginationElement: CxPagination;
    element: HTMLElement | null;
    size: number | true;
    page: number;
    count: number;
    max: number;
    remoteRowCountEstimate: number | null;
    initialLoad: boolean;
    progressiveLoad: boolean;
    /**
     * flag to check if data is being changed by this module
     */
    dataChanging: boolean;
    pageSizes: number[];
    mode: 'remote' | 'local' | 'progressive_load' | 'progressive_scroll';
    constructor(table: Tabulator);
    options(key: string): any;
    initialize(): void;
    rowAddingPosition(row: any, top: boolean): {
        index: IRow | undefined;
        top: boolean;
    };
    calculatePageSizes(): void;
    initialLoadComplete(): void;
    remotePageParams(data: any, config: any, silent: boolean, params: any): any;
    /**
     * Table Functions
     */
    userSetPageToRow(row: any): Promise<unknown> | undefined;
    userSetPageSize(size: number): Promise<boolean>;
    scrollVertical(top: number, dir: boolean): void;
    restOnRenderBefore(rows: any[], renderInPosition: boolean): any[];
    rowsUpdated(): void;
    createElements(): void;
    generatePageSizeSelectList(): void;
    initializePageCounter(): void;
    /**
     * Pagination is mounted on `table.toolbar` (outside Tabulator's root element).
     * Tabulator.destroy() only clears the table element, so we must detach on destroy
     * or a full re-init (e.g. pageSizeOptions change) leaves duplicate cx-pagination nodes.
     */
    cleanup(): void;
    initializePaginator(): void;
    initializeProgressive(mode: 'scroll' | 'load'): void;
    trackChanges(): void;
    setMaxRows(rowCount: number): void;
    reset(force: boolean): void;
    setMaxPage(max: string | number): void;
    setPage: (page: string | number) => Promise<unknown> | undefined;
    setPageToRow(row: any): Promise<unknown> | undefined;
    setPageSize(size: number | true | string): void;
    _setPageCounter(totalRows: number, size?: number | true, currentRow?: number): void;
    previousPage(): Promise<void>;
    nextPage(): Promise<void>;
    getPage(): number;
    getPageMax(): number;
    getPageSize(): number | true;
    getMode(): "local" | "remote" | "progressive_load" | "progressive_scroll";
    getRows(data: any[]): any[];
    trigger(): Promise<void>;
    _parseRemoteData(data: any): any;
}
