import type { Column, ColumnDef, InitialTableState, Row, RowData, RowModel, TableInstance, TableMeta, TableOptions, TableOptionsResolved, TableState, Updater } from "../types.js"; import { type RequiredKeys } from "../utils.js"; export interface TableFeature { createCell?: (cell: any, column: any, row: any, table: any) => any; createColumn?: (column: any, table: any) => any; createHeader?: (column: any, table: any) => any; createRow?: (row: any, table: any) => any; createTable?: (table: any) => any; getDefaultColumnDef?: () => any; getDefaultOptions?: (table: any) => any; getInitialState?: (initialState?: InitialTableState) => any; } export interface CoreTableState { } export interface CoreOptions { /** * Set this option to override any of the `autoReset...` feature options. */ autoResetAll?: boolean; /** * The array of column defs to use for the table. * * @inheritDoc */ columns: ColumnDef[]; /** * The data for the table to display. This array should match the type you * provided to `table.setRowType<...>`. Columns can access this data via * string/index or a functional accessor. When the `data` option changes * reference, the table will reprocess the data. */ data: TData[]; /** * Set this option to `true` to output all debugging information to the console. */ debugAll?: boolean; /** * Set this option to `true` to output column debugging information to the console. */ debugColumns?: boolean; /** * Set this option to `true` to output header debugging information to the console. */ debugHeaders?: boolean; /** * Set this option to `true` to output row debugging information to the console. */ debugRows?: boolean; /** * Set this option to `true` to output table debugging information to the console. */ debugTable?: boolean; /** * Default column options to use for all column defs supplied to the table. * * @inheritDoc */ defaultColumn?: Partial>; /** * This required option is a factory for a function that computes and returns the * core row model for the table. * * @inheritDoc */ getCoreRowModel?: (table: TableInstance) => () => RowModel; /** * This optional function is used to derive a unique ID for any given row. If not * provided the rows index is used (nested rows join together with `.` using their * grandparents' index e.g.,`index.index.index`). If you need to identify * individual rows that are originating from any server-side operations, it's * suggested you use this function to return an ID that makes sense regardless of * network IO/ambiguity e.g., a userId, taskId, database ID field, etc. * * @example getRowId: row => row.userI */ getRowId?: (originalRow: TData, index: number, /** @inheritDoc */ parent?: Row) => string; /** * This optional function is used to access the sub rows for any given row. If you * are using nested rows, you will need to use this function to return the sub * rows object (or undefined) from the row. * * @example getSubRows: row => row.subRow */ getSubRows?: (originalRow: TData, index: number) => undefined | TData[]; /** * Use this option to optionally pass initial state to the table. This state will * be used when resetting various table states either automatically by the table * (e.g.,`options.autoResetPageIndex`) or via functions like * `table.resetRowSelection()`. Most reset functions allow you to optionally pass a * flag to reset to a blank/default state instead of the initial state. * * Table state will not be reset when this object changes, which also means that * the initial state object does not need to be stable. * * @inheritDoc */ initialState?: InitialTableState; /** * This option is used to optionally implement the merging of table options. * * @inheritDoc */ mergeOptions?: ( /** @inheritDoc */ defaultOptions: TableOptions, /** @inheritDoc */ options: Partial>) => TableOptions; /** * You can pass any object to `options.meta` and access it anywhere the `table` is * available via `table.options.meta`. * * @inheritDoc */ meta?: TableMeta; /** * The `onStateChange` option can be used to optionally listen to state changes * within the table. * * @inheritDoc */ onStateChange: (updater: Updater) => void; /** * Value used when the desired value is not found in the data. */ renderFallbackValue: any; /** * The `state` option can be used to optionally _control_ part or all of the table * state. The state you pass here will merge with and overwrite the internal * automatically-managed state to produce the final state for the table. You can * also listen to state changes via the `onStateChange` option. > Note: Any state * passed in here will override both the internal state and any other * `initialState` you provide. * * @inheritDoc */ state: Partial; } export interface CoreInstance { /** @internal */ _features: readonly TableFeature[]; /** @internal */ _getAllFlatColumnsById: () => Record>; /** @internal */ _getColumnDefs: () => ColumnDef[]; /** @internal */ _getCoreRowModel?: () => RowModel; /** @internal */ _getDefaultColumnDef: () => Partial>; /** @internal */ _getRowId: (_: TData, index: number, parent?: Row) => string; /** @internal */ _queue: (cb: () => void) => void; /** * Returns all columns in the table in their normalized and nested hierarchy. * * @inheritDoc */ getAllColumns: () => Column[]; /** * Returns all columns in the table flattened to a single level. * * @inheritDoc */ getAllFlatColumns: () => Column[]; /** * Returns all leaf-node columns in the table flattened to a single level. This * does not include parent columns. * * @inheritDoc */ getAllLeafColumns: () => Column[]; /** * Returns a single column by its ID. * * @inheritDoc */ getColumn: (columnId: string) => Column | undefined; /** * Returns the core row model before any processing has been applied. * * @inheritDoc */ getCoreRowModel: () => RowModel; /** * Returns the row with the given ID. * * @inheritDoc */ getRow: (id: string, searchAll?: boolean) => Row; /** * Returns the final model after all processing from other used features has been * applied. This is the row model that is most commonly used for rendering. * * @inheritDoc */ getRowModel: () => RowModel; /** * Call this function to get the table's current state. It's recommended to use * this function and its state, especially when managing the table state manually. * It is the exact same state used internally by the table for every feature and * function it provides. * * @inheritDoc */ getState: () => TableState; /** * This is the resolved initial state of the table. * * @inheritDoc */ initialState: TableState; /** * A read-only reference to the table's current options. * * @inheritDoc */ options: RequiredKeys, "state">; /** * Call this function to reset the table state to the initial state. */ reset: () => void; /** * This function can be used to provide new table options. * * @inheritDoc */ setOptions: (newOptions: Updater>) => void; /** * Call this function to update the table state. * * @inheritDoc */ setState: (updater: Updater) => void; /** * Use this function to update the table options. * * @inheritDoc */ updateOptions: (options: Partial>) => void; } export declare function createTable(options: TableOptionsResolved): TableInstance; //# sourceMappingURL=table.d.ts.map