import type { ReactiveController } from 'lit'; import type { GridHost, PaginationState } from '../internal/types.js'; /** * Default pagination state used when no `pagination` configuration is provided. */ export declare const DEFAULT_PAGINATION: Readonly<{ mode: "local"; page: 0; pageSize: 25; pageSizeOptions: readonly number[]; }>; /** * Reactive controller that owns the grid's pagination state. * * @remarks * Exposes a state machine for the current `page` and `pageSize`, derives `pageCount` * from the host's data, and emits the cancellable `pageChanging` + `pageChanged` * events on the grid host. Page slicing itself is performed by * {@link PaginationDataOperation} so the controller does not mutate `dataView`. */ export declare class PaginationController implements ReactiveController { #private; protected host: GridHost; /** * The current zero-based page index. */ page: number; /** * The current page size. */ pageSize: number; constructor(host: GridHost); hostConnected(): void; /** * Whether pagination is enabled on the host grid. */ get enabled(): boolean; /** * The total number of records before pagination is applied. * * @remarks * For `'local'` mode this is the post-filter, post-sort dataset length. For `'remote'` * mode the consumer must supply the value via `pagination.totalItems`. */ get totalItems(): number; /** * The total number of pages for the current data view and `pageSize`. * * @remarks * Always at least `1` so a paginator can render a sensible "1 / 1" label for empty data. */ get pageCount(): number; /** * Returns the resolved {@link PaginationState} for the current host. */ get state(): PaginationState; /** * Clamps a candidate `page` index into the valid `[0, pageCount - 1]` range. * * @param page - The candidate page index. */ clamp(page: number): number; /** * Re-clamps the current page after the dataset size (or `pageSize`) changes. * * @remarks * Called from the grid pipeline so paging never points past the last valid page. * Mutates `page` in place and requests a re-render when the value changes. */ reclamp(): void; /** * Navigates to `page`, emitting the cancellable `pageChanging` event first and * the `pageChanged` event after the pipeline has applied. * * @param page - The target zero-based page index. Out-of-range values are clamped. * @returns `true` if the change was applied, `false` if it was cancelled or a no-op. */ gotoPage(page: number): Promise; /** * Sets the current page size and resets to the first page. * * @param size - The new page size. Must be a positive integer. * @returns `true` if the change was applied, `false` if it was cancelled or a no-op. */ setPageSize(size: number): Promise; /** * Navigates to the next page if not already on the last one. */ nextPage(): Promise; /** * Navigates to the previous page if not already on the first one. */ previousPage(): Promise; /** * Navigates to the first page. */ firstPage(): Promise; /** * Navigates to the last page. */ lastPage(): Promise; }