import type { TableFeature } from "../core/table.js"; import type { Cell, Column, OnChangeFn, RowData, Updater } from "../types.js"; export type VisibilityState = Record; export interface VisibilityTableState { columnVisibility: VisibilityState; } export interface VisibilityOptions { enableHiding?: boolean; /** * If provided, this function will be called with an `updaterFn` when * `state.columnVisibility` changes. This overrides the default internal state * management, so you will need to persist the state change either fully or * partially outside of the table. * * @inheritDoc */ onColumnVisibilityChange?: OnChangeFn; } export type VisibilityDefaultOptions = Pick; export interface VisibilityInstance { /** * If column pinning, returns a flat array of leaf-node columns that are visible * in the unpinned/center portion of the table. * * @inheritDoc */ getCenterVisibleLeafColumns: () => Column[]; /** * Returns whether all columns are visible */ getIsAllColumnsVisible: () => boolean; /** * Returns whether any columns are visible */ getIsSomeColumnsVisible: () => boolean; /** * If column pinning, returns a flat array of leaf-node columns that are visible * in the left portion of the table. * * @inheritDoc */ getLeftVisibleLeafColumns: () => Column[]; /** * If column pinning, returns a flat array of leaf-node columns that are visible * in the right portion of the table. * * @inheritDoc */ getRightVisibleLeafColumns: () => Column[]; /** * Returns a handler for toggling the visibility of all columns, meant to be bound * to a `input[type=checkbox]` element. */ getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void; /** * Returns a flat array of columns that are visible, including parent columns. * * @inheritDoc */ getVisibleFlatColumns: () => Column[]; /** * Returns a flat array of leaf-node columns that are visible. * * @inheritDoc */ getVisibleLeafColumns: () => Column[]; /** * Resets the column visibility state to the initial state. If `defaultState` is * provided, the state will be reset to `{}` */ resetColumnVisibility: (defaultState?: boolean) => void; /** * Sets or updates the `state.columnVisibility` state. * * @inheritDoc */ setColumnVisibility: (updater: Updater) => void; /** * Toggles the visibility of all columns. */ toggleAllColumnsVisible: (value?: boolean) => void; } export interface VisibilityColumnDef { /** * Enables/Disables hiding the column. */ enableHiding?: boolean; } export interface VisibilityRow { /** @internal */ _getAllVisibleCells: () => Cell[]; /** * Returns an array of cells that account for column visibility for the row. * * @inheritDoc */ getVisibleCells: () => Cell[]; } export interface VisibilityColumn { /** * Returns whether the column can be hidden. */ getCanHide: () => boolean; /** * Returns whether the column is visible. */ getIsVisible: () => boolean; /** * Returns a function that can be used to toggle the column visibility. This * function can be used to bind to an event handler to an element. */ getToggleVisibilityHandler: () => (event: unknown) => void; /** * Toggles the visibility of the column. */ toggleVisibility: (value?: boolean) => void; } export declare const Visibility: TableFeature; //# sourceMappingURL=visibility.d.ts.map