import UpdateDataProps from "./UpdateCellProps"; import ColumnDef, { Accessor } from "./ColumnDef"; import TableRow from "./TableRow"; import Row from "./Row"; import SortColumn, { SortDirection } from "./SortColumn"; import { TableFilterState, FilterCondition } from "./FilterTypes"; import Cell from "./Cell"; import type { PinnedSectionsState } from "./PinnedSectionsState"; import type { PivotConfig } from "./PivotTypes"; import type { ColumnVisibilityState } from "./ColumnVisibilityTypes"; import type { RowId } from "./RowId"; export interface SetHeaderRenameProps { accessor: Accessor; } export interface ExportToCSVProps { filename?: string; } export type TableAPI = { updateData: (props: UpdateDataProps) => void; setHeaderRename: (props: SetHeaderRenameProps) => void; getVisibleRows: () => TableRow[]; getAllRows: () => TableRow[]; getHeaders: () => ColumnDef[]; exportToCSV: (props?: ExportToCSVProps) => void; getSortState: () => SortColumn | null; applySortState: (props?: { accessor: Accessor; direction?: SortDirection; }) => Promise; /** Ordered root accessors per pin section (left, main/unpinned, right) */ getPinnedState: () => PinnedSectionsState; /** Reorder root columns and set pinned flags; lists must include every root accessor exactly once. Essential order is clamped per section. */ applyPinnedState: (state: PinnedSectionsState) => Promise; getFilterState: () => TableFilterState; applyFilter: (filter: FilterCondition) => Promise; clearFilter: (accessor: Accessor) => Promise; clearAllFilters: () => Promise; getCurrentPage: () => number; getTotalPages: () => number; setPage: (page: number) => Promise; expandAll: () => void; collapseAll: () => void; expandDepth: (depth: number) => void; collapseDepth: (depth: number) => void; toggleDepth: (depth: number) => void; setExpandedDepths: (depths: Set) => void; getExpandedDepths: () => Set; getGroupingProperty: (depth: number) => Accessor | undefined; getGroupingDepth: (property: Accessor) => number; toggleColumnEditor: (open?: boolean) => void; applyColumnVisibility: (visibility: ColumnVisibilityState) => Promise; /** * Reset columns to the configured definitions: default order, widths, and * visibility. All columns become visible again except those explicitly * defined with `hide: true` in `columns`, regardless of any runtime * visibility changes made since mount. */ resetColumns: () => void; setQuickFilter: (text: string) => void; getSelectedCells: () => Set; clearSelection: () => void; selectCell: (cell: Cell) => void; selectCellRange: (startCell: Cell, endCell: Cell) => void; /** * Selected row IDs when row selection is enabled. * Values are the string form of each row id (via `String` / `getRowId`). */ getSelectedRows: () => Set; /** Row data objects for currently selected rows (resolved from visible/current table rows). */ getSelectedRowsData: () => Row[]; /** Look up a row by row id in the current table rows. */ getRow: (rowId: RowId) => Row | undefined; selectRow: (rowId: RowId) => void; deselectRow: (rowId: RowId) => void; toggleRowSelection: (rowId: RowId) => void; /** Clears row selection only (does not clear cell selection). */ clearRowSelection: () => void; /** Enable, update, or clear matrix pivot (`null` disables). */ setPivot: (config: PivotConfig | null) => void; getPivot: () => PivotConfig | null; /** Generated headers while pivot is active; otherwise current headers. */ getPivotHeaders: () => ColumnDef[]; /** Post-pivot rows (pre-flatten) while pivot is active; otherwise source rows. */ getPivotedRows: () => Row[]; };