import type { ColumnFiltersColumn, ColumnFiltersColumnDef, ColumnFiltersInstance, ColumnFiltersOptions, ColumnFiltersRow, ColumnFiltersTableState, ColumnOrderColumn, ColumnOrderInstance, ColumnOrderOptions, ColumnOrderTableState, ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningRow, ColumnPinningTableState, ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ExpandedInstance, ExpandedOptions, ExpandedRow, ExpandedTableState, FacetedColumn, FacetedOptions, Getter, GlobalFacetingInstance, GlobalFilterColumn, GlobalFilterInstance, GlobalFilterOptions, GlobalFilterTableState, GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState, PaginationInstance, PartialKeys, RowPinningInstance, RowPinningOptions, RowPinningRow, RowPinningTableState, RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState, SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState, UnionToIntersection, VisibilityColumn, VisibilityColumnDef, VisibilityInstance, VisibilityOptions, VisibilityTableState } from '@tanstack/react-table'; import { CoreInstance, CoreOptions, CoreTableState } from './createTable.js'; import type { DataTableV2AlignmentColumnDef } from '../../features/ColumnAlignment.js'; import type { DataTableV2ColumnFontStyleColumn, DataTableV2ColumnFontStyleInstance, DataTableV2ColumnFontStyleOptions, DataTableV2ColumnFontStyleTableState } from '../../features/ColumnFontStyle.js'; import type { DataTableV2ColumnOrderColumn, DataTableV2ColumnOrderHeader, DataTableV2ColumnOrderInstance, DataTableV2ColumnOrderOptions, DataTableV2ColumnOrderState } from '../../features/ColumnOrder/ColumnOrder.js'; import type { DataTableV2ColumnPinningInstance } from '../../features/ColumnPinning/ColumnPinning.js'; import type { DataTableV2ColumnSizingHeader, DataTableV2ColumnSizingTableState } from '../../features/ColumnSizing.js'; import type { DataTableV2ColumnType, DataTableV2MeterbarColumnConfig, DataTableV2SparklineColumnConfig, DataTableV2GanttColumnConfig, DataTableV2MarkdownColumnConfig, DataTableV2LogContentColumnConfig, DataTableV2TextColumnConfig } from '../../features/ColumnTypes/ColumnTypes.js'; import type { DataTableV2ColumnVisibilityColumn, DataTableV2ColumnVisibilityInstance, DataTableV2VisibilityOptions } from '../../features/ColumnVisibility/ColumnVisibility.js'; import type { DataTableV2DownloadDataCell, DataTableV2DownloadDataHeader, DataTableV2DownloadDataInstance, DataTableV2DownloadDataOptions } from '../../features/Download/Download.js'; import type { DataTableV2GanttChartState } from '../../features/GanttChart/GanttChart.js'; import type { DataTableV2LayoutCell, DataTableV2LayoutColumn, DataTableV2LayoutColumnDef, DataTableV2LayoutHeader, DataTableV2LayoutInstance, DataTableV2LayoutOptions, DataTableV2LayoutRow, DataTableV2LayoutTableState } from '../../features/Layout.js'; import type { DataTableV2LineWrapColumn, DataTableV2LineWrapInstance, DataTableV2LineWrapOptions, DataTableV2LineWrapTableState } from '../../features/LineWrap.js'; import type { DataTableV2LoadingState } from '../../features/LoadingState.js'; import type { DataTableV2MeterbarChartState } from '../../features/MeterBarChart/MeterBarChart.js'; import type { DataTableV2PaginationInitialTableState, DataTableV2PaginationInstance, DataTableV2PaginationOptions, DataTableV2PaginationTableState } from '../../features/Pagination/Pagination.js'; import type { DataTableV2RowDetailsOptions, DataTableV2RowDetailsRow, DataTableV2RowDetailsState, DataTableV2RowDetailsInstance } from '../../features/RowDetails/RowDetails.js'; import type { DataTableV2RowIdentificationOptions } from '../../features/RowIdentification/RowIdentification.js'; import type { DataTableV2RowInteractivityInstance, DataTableV2RowInteractivityOptions, DataTableV2RowInteractivityRow, DataTableV2RowInteractivityState } from '../../features/RowInteractivity/RowInteractivity.js'; import type { DataTableV2RowOrderInstance, DataTableV2RowOrderOptions, DataTableV2RowOrderRow, DataTableV2RowOrderState } from '../../features/RowOrder/RowOrder.js'; import type { DataTableV2RowSelectionInstance, DataTableV2RowSelectionOptions, DataTableV2RowSelectionRow } from '../../features/RowSelection/RowSelection.js'; import type { DataTableV2CustomSortingFn, DataTableV2SortingColumnDef, DataTableV2SortingHeader, DataTableV2SortingOptions, DataTableV2SortingRow } from '../../features/Sorting/Sorting.js'; import type { DataTableV2SubRowsInstance, DataTableV2SubRowsOptions, DataTableV2SubRowsRow } from '../../features/SubRows/SubRows.js'; import type { DataTableV2RowThresholdOptions, DataTableV2ThresholdCell, DataTableV2ThresholdColumn, DataTableV2ThresholdColumnDef, DataTableV2ThresholdRow } from '../../features/Thresholds/Thresholds.js'; import type { DataTableV2UserActionColumnDef, DataTableV2UserActionsCell, DataTableV2UserActionsColumn, DataTableV2UserActionsInstance, DataTableV2UserActionsOptions, DataTableV2UserActionsState } from '../../features/UserActions/UserActions.js'; import type { DataTableV2VirtualScrollingInstance } from '../../features/VirtualScrolling/VirtualScrolling.js'; import type { DataTableV2VisualVariantCell, DataTableV2VisualVariantColumn, DataTableV2VisualVariantHeader, DataTableV2VisualVariantTableInstance, DataTableV2VisualVariantTableState } from '../../features/VisualVariants.js'; /** @internal */ export interface TableMeta { } /** @internal */ export interface ColumnMeta { config?: DataTableV2SparklineColumnConfig | DataTableV2MeterbarColumnConfig | DataTableV2GanttColumnConfig | DataTableV2MarkdownColumnConfig | DataTableV2LogContentColumnConfig | DataTableV2TextColumnConfig | never; hasFormatter?: boolean; hasCustomCellRenderer?: boolean; hasCustomHeaderRenderer?: boolean; /** Specifies if the column is an automatically generated, internal one. */ /** * Defines if it is considered a spacer column. Most likely the last * one that makes sure the columns continue on. */ spacer?: boolean; /** Specifies if the column is a automatically generated internal one. */ builtin?: true; /** Specifies if the column is a builtin prefix or postfix. */ builtinPlacement?: 'prefix' | 'suffix'; /** * Font style defined based on column level. */ fontStyle?: 'text' | 'code'; /** * This is used to control the memoization on our custom header renderers. * The returned value will be bound as a string prop to the DataTableV2Header component * in order to control the React.memo invalidation on the component. */ headerDeps?: (header: Header) => Array; /** * This is used to control the memoization on our custom cell renderers. * The returned value will be bound as a string prop to the DataTableV2Cell component * in order to control the React.memo invalidation on the component. */ cellDeps?: (cell: Cell) => Array; } /** @internal */ export interface FilterMeta { } /** @internal */ export interface FilterFns { } /** @internal */ export interface SortingFns { } /** @internal */ export interface AggregationFns { } /** @internal */ export type Updater = T | ((old: T) => T); /** @internal */ export type OnChangeFn = (updaterOrValue: Updater) => void; /** @internal */ export type RowData = unknown | object | any[]; /** @internal */ export type AnyRender = (Comp: any, props: any) => any; /** @internal */ 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; } /** @internal */ export interface Table extends CoreInstance, HeadersInstance, Omit, 'getVisibleFlatColumns' | 'getVisibleLeafColumns'>, Omit, '_getOrderColumnsFn'>, Omit, 'getLeftLeafColumns' | 'getRightLeafColumns' | 'getCenterLeafColumns'>, RowPinningInstance, ColumnFiltersInstance, GlobalFilterInstance, GlobalFacetingInstance, Omit, 'getPreSortedRowModel'>, GroupingInstance, ColumnSizingInstance, Omit, 'getExpandedRowModel'>, Omit, 'getPrePaginationRowModel' | 'getPaginationRowModel' | 'setPageIndex' | 'setPagination'>, Omit, 'getSelectedRowModel'>, DataTableV2LineWrapInstance, DataTableV2ColumnFontStyleInstance, DataTableV2LayoutInstance, DataTableV2VisualVariantTableInstance, DataTableV2ColumnVisibilityInstance, DataTableV2ColumnPinningInstance, DataTableV2ColumnOrderInstance, DataTableV2RowSelectionInstance, DataTableV2SubRowsInstance, DataTableV2RowInteractivityInstance, DataTableV2VirtualScrollingInstance, DataTableV2DownloadDataInstance, DataTableV2RowDetailsInstance, DataTableV2UserActionsInstance, DataTableV2PaginationInstance, DataTableV2RowOrderInstance { getPreSortedRowModel: () => RowModel; getPrePaginationRowModel: () => RowModel; getPaginationRowModel: () => RowModel; getSelectedRowModel: () => RowModel; getExpandedRowModel: () => RowModel; } /** @internal */ export interface FeatureOptions extends VisibilityOptions, DataTableV2VisibilityOptions, ColumnOrderOptions, DataTableV2ColumnOrderOptions, ColumnPinningOptions, RowPinningOptions, FacetedOptions, ColumnFiltersOptions, GlobalFilterOptions, Omit, 'getSortedRowModel'>, GroupingOptions, ExpandedOptions, ColumnSizingOptions, Omit, 'enableRowSelection'>, DataTableV2LineWrapOptions, DataTableV2ColumnFontStyleOptions, DataTableV2UserActionsOptions, DataTableV2PaginationOptions, DataTableV2RowThresholdOptions, DataTableV2LayoutOptions, DataTableV2SortingOptions, DataTableV2RowSelectionOptions, DataTableV2RowInteractivityOptions, DataTableV2DownloadDataOptions, DataTableV2SubRowsOptions, DataTableV2RowIdentificationOptions, DataTableV2RowDetailsOptions, DataTableV2RowOrderOptions { } /** @internal */ export type TableOptionsResolved = CoreOptions & FeatureOptions; /** @internal */ export type TableOptions = PartialKeys, 'state' | 'onStateChange' | 'renderFallbackValue'>; /** @internal */ export interface TableState extends CoreTableState, VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, RowPinningTableState, ColumnFiltersTableState, GlobalFilterTableState, SortingTableState, ExpandedTableState, GroupingTableState, DataTableV2ColumnSizingTableState, DataTableV2PaginationTableState, RowSelectionTableState, DataTableV2LineWrapTableState, DataTableV2ColumnFontStyleTableState, DataTableV2LayoutTableState, DataTableV2VisualVariantTableState, DataTableV2LoadingState, DataTableV2RowInteractivityState, DataTableV2GanttChartState, DataTableV2MeterbarChartState, DataTableV2RowDetailsState, DataTableV2RowOrderState, DataTableV2UserActionsState, DataTableV2ColumnOrderState { } /** @internal */ export interface CompleteInitialTableState extends CoreTableState, VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, RowPinningTableState, ColumnFiltersTableState, GlobalFilterTableState, SortingTableState, ExpandedTableState, GroupingTableState, DataTableV2ColumnSizingTableState, DataTableV2PaginationInitialTableState, RowSelectionTableState, DataTableV2LineWrapTableState, DataTableV2LayoutTableState, DataTableV2VisualVariantTableState, DataTableV2RowInteractivityState, DataTableV2RowDetailsState, DataTableV2RowOrderState, DataTableV2ColumnOrderState { } /** @internal */ export type InitialTableState = Partial; /** @internal */ export interface CoreRow { _getAllCellsByColumnId: () => Record>; _uniqueValuesCache: Record; _valuesCache: Record; /** * The depth of the row (if nested or grouped) relative to the root row array. */ depth: number; /** * Returns all of the cells for the row. */ getAllCells: () => Cell[]; /** * Returns the leaf rows for the row, not including any parent rows. */ getLeafRows: () => Row[]; /** * Returns the parent row for the row, if it exists. */ getParentRow: () => Row | undefined; /** * Returns the parent rows for the row, all the way up to a root row. */ getParentRows: () => Row[]; /** * Returns a unique array of values from the row for a given columnId. */ getUniqueValues: (columnId: string) => TValue[]; /** * Returns the value from the row for a given columnId. */ getValue: (columnId: string) => TValue; /** * The resolved unique identifier for the row resolved via the `options.getRowId` option. Defaults to the row's index (or relative index if it is a subRow). */ id: string; /** * The index of the row within its parent array (or the root data array). */ index: number; /** * The original row object provided to the table. If the row is a grouped row, the original row object will be the first original in the group. */ original: TData; /** * An array of the original subRows as returned by the `options.getSubRows` option. */ originalSubRows?: TData[]; /** * If nested, this row's parent row id. */ parentId?: string; /** * Renders the value for the row in a given columnId the same as `getValue`, but will return the `renderFallbackValue` if no value is found. */ renderValue: (columnId: string) => TValue; /** * An array of subRows for the row as returned and created by the `options.getSubRows` option. */ subRows: Row[]; } /** @internal */ export interface VisibilityRow { _getAllVisibleCells: () => Cell[]; /** * Returns an array of cells that account for column visibility for the row. */ getVisibleCells: () => Cell[]; } /** @internal */ export interface Row extends CoreRow, VisibilityRow, ColumnPinningRow, RowPinningRow, ColumnFiltersRow, GroupingRow, Omit, DataTableV2LayoutRow, DataTableV2ThresholdRow, ExpandedRow, DataTableV2SubRowsRow, DataTableV2SortingRow, DataTableV2RowInteractivityRow, DataTableV2RowDetailsRow, DataTableV2RowSelectionRow, DataTableV2RowOrderRow { } /** @internal */ export interface RowModel { rows: Row[]; flatRows: Row[]; rowsById: Record>; } /** @internal */ export type AccessorFn = (originalRow: TData, index: number) => TValue; /** @internal */ export type ColumnDefTemplate = string | ((props: TProps) => any); /** @internal */ export type StringOrTemplateHeader = string | ColumnDefTemplate>; /** @internal */ export interface StringHeaderIdentifier { header: string; id?: string; } /** @internal */ export interface IdIdentifier { id: string; header?: StringOrTemplateHeader; } /** @internal */ export type ColumnIdentifiers = IdIdentifier | StringHeaderIdentifier; /** @internal */ export interface ColumnDefExtensions extends VisibilityColumnDef, ColumnPinningColumnDef, ColumnFiltersColumnDef, SortingColumnDef, GroupingColumnDef, ColumnSizingColumnDef, DataTableV2LayoutColumnDef, DataTableV2ThresholdColumnDef, DataTableV2AlignmentColumnDef, DataTableV2SortingColumnDef, DataTableV2UserActionColumnDef { } /** @internal */ export interface ColumnDefBase extends ColumnDefExtensions { getUniqueValues?: AccessorFn; columnType?: DataTableV2ColumnType; sortType?: DataTableV2SortingColumnDef['sortType']; sortAccessor?: DataTableV2SortingColumnDef['sortAccessor']; customSortingFn?: DataTableV2CustomSortingFn; footer?: ColumnDefTemplate>; cell?: ColumnDefTemplate>; meta?: ColumnMeta; } /** @internal */ export interface IdentifiedColumnDef extends ColumnDefBase { id?: string; header?: StringOrTemplateHeader; } /** @internal */ export type DisplayColumnDef = ColumnDefBase & ColumnIdentifiers; /** @internal */ export interface GroupColumnDefBase extends ColumnDefBase { columns?: ColumnDef[]; } /** @internal */ export type GroupColumnDef = GroupColumnDefBase & ColumnIdentifiers; /** @internal */ export interface AccessorFnColumnDefBase extends ColumnDefBase { accessorFn: AccessorFn; } /** @internal */ export type AccessorFnColumnDef = AccessorFnColumnDefBase & ColumnIdentifiers; /** @internal */ export interface AccessorKeyColumnDefBase extends ColumnDefBase { id?: string; accessorKey: (string & {}) | keyof TData; } /** @internal */ export type AccessorKeyColumnDef = AccessorKeyColumnDefBase & Partial>; /** @internal */ export type AccessorColumnDef = AccessorKeyColumnDef | AccessorFnColumnDef; /** @internal */ export type ColumnDef = DisplayColumnDef | GroupColumnDef | AccessorColumnDef; /** @internal */ export type ColumnDefResolved = Partial>> & { accessorKey?: string; }; /** @internal */ export interface CoreColumn { /** * The resolved accessor function to use when extracting the value for the column from each row. Will only be defined if the column def has a valid accessor key or function defined. */ accessorFn?: AccessorFn; /** * The original column def used to create the column. */ columnDef: ColumnDef; /** * The child column (if the column is a group column). Will be an empty array if the column is not a group column. */ columns: Column[]; /** * The depth of the column (if grouped) relative to the root column def array. */ depth: number; /** * Returns the flattened array of this column and all child/grand-child columns for this column. */ getFlatColumns: () => Column[]; /** * Returns an array of all leaf-node columns for this column. If a column has no children, it is considered the only leaf-node column. */ getLeafColumns: () => Column[]; /** * The resolved unique identifier for the column resolved in this priority: - A manual `id` property from the column def - The accessor key from the column def - The header string from the column def */ id: string; /** * The parent column for this column. Will be undefined if this is a root column. */ parent?: Column; } /** @internal */ export interface Column extends CoreColumn, VisibilityColumn, ColumnPinningColumn, FacetedColumn, ColumnFiltersColumn, GlobalFilterColumn, DataTableV2UserActionsColumn, SortingColumn, GroupingColumn, ColumnSizingColumn, ColumnOrderColumn, DataTableV2LineWrapColumn, DataTableV2ColumnFontStyleColumn, DataTableV2LayoutColumn, DataTableV2ColumnVisibilityColumn, DataTableV2ColumnOrderColumn, DataTableV2ThresholdColumn, DataTableV2VisualVariantColumn { getCustomSortingFn: () => DataTableV2CustomSortingFn; getIsSortableTable: () => boolean; } /** @internal */ export interface CellContext { cell: Cell; column: Column; getValue: Getter; renderValue: Getter; row: Row; table: Table; } /** @internal */ export interface CoreCell { /** * The associated Column object for the cell. */ column: Column; /** * Returns the rendering context (or props) for cell-based components like cells and aggregated cells. Use these props with your framework's `flexRender` utility to render these using the template of your choice: */ getContext: () => CellContext; /** * Returns the value for the cell, accessed via the associated column's accessor key or accessor function. */ getValue: CellContext['getValue']; /** * The unique ID for the cell across the entire table. */ id: string; /** * Renders the value for a cell the same as `getValue`, but will return the `renderFallbackValue` if no value is found. */ renderValue: CellContext['renderValue']; /** * The associated Row object for the cell. */ row: Row; } /** @internal */ export interface Cell extends CoreCell, GroupingCell, DataTableV2LayoutCell, DataTableV2VisualVariantCell, DataTableV2ThresholdCell, DataTableV2UserActionsCell, DataTableV2DownloadDataCell { } /** @internal */ export interface HeaderContext { /** * An instance of a column. */ column: Column; /** * An instance of a header. */ header: Header; /** * The table instance. */ table: Table; } /** @internal */ export interface HeadersInstance { /** * Returns all header groups for the table. */ getHeaderGroups: () => HeaderGroup[]; /** * If pinning, returns the header groups for the left pinned columns. */ getLeftHeaderGroups: () => HeaderGroup[]; /** * If pinning, returns the header groups for columns that are not pinned. */ getCenterHeaderGroups: () => HeaderGroup[]; /** * If pinning, returns the header groups for the right pinned columns. */ getRightHeaderGroups: () => HeaderGroup[]; /** * Returns the footer groups for the table. */ getFooterGroups: () => HeaderGroup[]; /** * If pinning, returns the footer groups for the left pinned columns. */ getLeftFooterGroups: () => HeaderGroup[]; /** * If pinning, returns the footer groups for columns that are not pinned. */ getCenterFooterGroups: () => HeaderGroup[]; /** * If pinning, returns the footer groups for the right pinned columns. */ getRightFooterGroups: () => HeaderGroup[]; /** * Returns headers for all columns in the table, including parent headers. */ getFlatHeaders: () => Header[]; /** * If pinning, returns headers for all left pinned columns in the table, including parent headers. */ getLeftFlatHeaders: () => Header[]; /** * If pinning, returns headers for all columns that are not pinned, including parent headers. */ getCenterFlatHeaders: () => Header[]; /** * If pinning, returns headers for all right pinned columns in the table, including parent headers. */ getRightFlatHeaders: () => Header[]; /** * Returns headers for all leaf columns in the table, (not including parent headers). */ getLeafHeaders: () => Header[]; /** * If pinning, returns headers for all left pinned leaf columns in the table, (not including parent headers). */ getLeftLeafHeaders: () => Header[]; /** * If pinning, returns headers for all columns that are not pinned, (not including parent headers). */ getCenterLeafHeaders: () => Header[]; /** * If pinning, returns headers for all right pinned leaf columns in the table, (not including parent headers). */ getRightLeafHeaders: () => Header[]; } /** @internal */ export interface CoreHeader { /** * The col-span for the header. */ colSpan: number; /** * The header's associated column object. */ column: Column; /** * The depth of the header, zero-indexed based. */ depth: number; /** * Returns the rendering context (or props) for column-based components like headers, footers and filters. */ getContext: () => HeaderContext; /** * Returns the leaf headers hierarchically nested under this header. */ getLeafHeaders: () => Header[]; /** * The header's associated header group object. */ headerGroup: HeaderGroup; /** * The unique identifier for the header. */ id: string; /** * The index for the header within the header group. */ index: number; /** * A boolean denoting if the header is a placeholder header. */ isPlaceholder: boolean; /** * If the header is a placeholder header, this will be a unique header ID that does not conflict with any other headers across the table. */ placeholderId?: string; /** * The row-span for the header. */ rowSpan: number; /** * The header's hierarchical sub/child headers. Will be empty if the header's associated column is a leaf-column. */ subHeaders: Header[]; } /** @internal */ export interface Header extends CoreHeader, Omit, DataTableV2LayoutHeader, DataTableV2ColumnSizingHeader, DataTableV2SortingHeader, DataTableV2ColumnOrderHeader, DataTableV2DownloadDataHeader, DataTableV2VisualVariantHeader { } /** @internal */ export interface CoreHeaderGroup { depth: number; headers: Header[]; id: string; } /** @internal */ export type HeaderGroup = CoreHeaderGroup; /** * Transform object for dnd kit drag and drop. * * The x and y coordinates represent the delta from the point of origin of your draggable element since it started being dragged. * The scaleX and scaleY properties represent the difference in scale between the item that is dragged and the droppable container it is currently over. * @internal */ export type DragAndDropTransform = { x: number; y: number; scaleX: number; scaleY: number; };