import type { TableFeature } from "../core/table.js"; import type { Cell, Column, OnChangeFn, Row, RowData, Updater } from "../types.js"; export type ColumnPinningPosition = false | "left" | "right"; export type RowPinningPosition = false | "top" | "bottom"; export interface ColumnPinningState { left?: string[]; right?: string[]; } export interface RowPinningState { bottom?: string[]; includeLeafRows?: boolean; includeParentRows?: boolean; top?: string[]; } export interface ColumnPinningTableState { columnPinning: ColumnPinningState; } export interface RowPinningTableState { rowPinning: RowPinningState; } export interface ColumnPinningOptions { /** * Enables/disables column pinning for the table. Defaults to `true`. */ enableColumnPinning?: boolean; /** * Enables/disables all pinning for the table. Defaults to `true`. */ enablePinning?: boolean; /** * If provided, this function will be called with an `updaterFn` when * `state.columnPinning` changes. This overrides the default internal state * management, so you will also need to supply `state.columnPinning` from your own * managed state. */ onColumnPinningChange?: OnChangeFn; } export interface RowPinningOptions { /** * Enables/disables row pinning for the table. Defaults to `true`. */ enableRowPinning?: boolean | (( /** @inheritDoc */ row: Row) => boolean); /** * Include child rows when pinning parent. */ includeLeafRows?: boolean; /** * Include parent rows when pinning child. */ includeParentRows?: boolean; /** * When `false`, pinned rows will not be visible if they are filtered or paginated * out of the table. When `true`, pinned rows will always be visible regardless of * filtering or pagination. Defaults to `true`. */ keepPinnedRows?: boolean; /** * If provided, this function will be called with an `updaterFn` when * `state.rowPinning` changes. This overrides the default internal state * management, so you will also need to supply `state.rowPinning` from your own * managed state. */ onRowPinningChange?: OnChangeFn; } export interface ColumnPinningDefaultOptions { onColumnPinningChange: OnChangeFn; } export interface RowPinningDefaultOptions { onRowPinningChange: OnChangeFn; } export interface ColumnPinningColumnDef { /** * Enables/disables column pinning for this column. Defaults to `true`. */ enablePinning?: boolean; } export interface ColumnPinningColumn { /** * Returns whether the column can be pinned. */ getCanPin: () => boolean; /** * Returns the pinned position of the column. (`'left'`, `'right'` or `false`) */ getIsPinned: () => ColumnPinningPosition; /** * Returns whether the column is pinned to the left. */ getIsPinnedLeft: () => boolean; /** * Returns whether the column is pinned to the right. */ getIsPinnedRight: () => boolean; /** * Returns the numeric pinned index of the column within a pinned column group. */ getPinnedIndex: () => number; /** * Pins a column to the `'left'` or `'right'`, or unpins the column to the center * if `false` is passed. */ pin: (position: ColumnPinningPosition) => void; } export interface ColumnPinningRow { /** * Returns all center pinned (unpinned) leaf cells in the row. * * @inheritDoc */ getCenterVisibleCells: () => Cell[]; /** * Returns all left pinned leaf cells in the row. * * @inheritDoc */ getLeftVisibleCells: () => Cell[]; /** * Returns all right pinned leaf cells in the row. * * @inheritDoc */ getRightVisibleCells: () => Cell[]; } export interface RowPinningRow { /** * Returns whether the row can be pinned. */ getCanPin: () => boolean; /** * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`) */ getIsPinned: () => RowPinningPosition; /** * Returns whether the row is pinned to the bottom. */ getIsPinnedBottom: () => boolean; /** * Returns whether the row is pinned to the top. */ getIsPinnedTop: () => boolean; /** * Returns the numeric pinned index of the row within a pinned row group. */ getPinnedIndex: () => number; /** * Pins a row to the `top` or `bottom` or unpins the row to the center if `false` * is passed. */ pin: (position: RowPinningPosition, includeLeafRows?: boolean, includeParentRows?: boolean) => void; } export interface ColumnPinningInstance { /** * Returns all center pinned (unpinned) leaf columns. * * @inheritDoc */ getCenterLeafColumns: () => Column[]; /** * Returns whether any columns are pinned. Optionally specify to only check * for pinned columns in either the `left` or `right` position. */ getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean; /** * Returns all left pinned leaf columns. * * @inheritDoc */ getLeftLeafColumns: () => Column[]; /** * Returns all right pinned leaf columns. * * @inheritDoc */ getRightLeafColumns: () => Column[]; /** * Resets the `columnPinning` state to `initialState.columnPinning`, or `true` * can be passed to force a default blank state reset to `{ left: [], right: [], * }`. */ resetColumnPinning: (defaultState?: boolean) => void; /** * Sets or updates the `state.columnPinning` state. * * @inheritDoc */ setColumnPinning: (updater: Updater) => void; } export interface RowPinningInstance { /** @internal */ _getPinnedRows: (position: "top" | "bottom") => Row[]; /** * Returns all bottom pinned rows. * * @inheritDoc */ getBottomRows: () => Row[]; /** * Returns all rows that are not pinned to the top or bottom. * * @inheritDoc */ getCenterRows: () => Row[]; /** * Returns whether any rows are pinned. Optionally specify to only check * for pinned rows in either the `top` or `bottom` position. */ getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean; /** * Returns all top pinned rows. * * @inheritDoc */ getTopRows: () => Row[]; /** * Resets the `rowPinning` state to `initialState.rowPinning`, or `true` can be * passed to force a default blank state reset to `{ top: [], bottom: [], }`. */ resetRowPinning: (defaultState?: boolean) => void; /** * Sets or updates the `state.rowPinning` state. */ setRowPinning: (updater: Updater) => void; } export declare const Pinning: TableFeature; //# sourceMappingURL=pinning.d.ts.map