/** * Defines the shape of the measure column size state within the tanstack tables state. * @public */ export type DataTableLayoutColumnMeasureInfoState = Record; /** * @internal * Extension interface to extend the tanstack table state with the LineWrap state. */ export interface DataTableLayoutTableState { columnMeasureInfo: DataTableLayoutColumnMeasureInfoState; observedHeaderHeight: number; } /** * @internal * Extension interface to extend the types of the `Column` from the tanstack table. */ export interface DataTableLayoutRow { getGridRowPosition: (rowIndex: number) => { gridColumnStart: number; gridColumnEnd: number | `span ${number}` | 'row-end'; gridRowStart: number; gridRowEnd: number | `span ${number}`; }; } /** * @internal * Extension interface to extend the types of the `Column` from the tanstack table. */ export interface DataTableLayoutColumn { getGridColumnPosition: (columnIndex: number) => { gridColumnStart: number; gridColumnEnd: number | `span ${number}`; }; } /** * @internal * Extension interface to extend the types of the `HeaderCell` from the tanstack table. */ export interface DataTableLayoutHeader { getGridPosition: (headers: THeader[]) => { gridColumnStart: number; gridColumnEnd: number | `span ${number}`; gridRowStart: number; gridRowEnd: number | `span ${number}`; }; } /** * @internal * Extension interface to extend the types of the columnDefinition from the tanstack table. */ export interface DataTableLayoutColumnDef { minWidth?: number; /** * Defines the preferred width of a column. * Options number | `${number}fr` | 'auto' | 'content' * - number: Defines the width of a column in pixels * - `${number}fr`: Lets you define a fractioned width. Child columns with fractions can split their fractions between the parents fraction. * - auto: Will distribute the space evenly between the auto columns. Leverages the auto sizing feature of a CSS grid * - content: Will look at content visible in the first render and size the columns according to their max-content. * - object with type and maxWidth: this maxWidth is the initial maxWidth and if resizing is enabled then you can resize beyond this maxWidth. */ width?: number | `${number}fr` | 'auto' | 'content' | { type: 'auto' | 'content'; /** * Initial maximum width of the column. If resizing is enabled, * it is possible to resize beyond this maxWidth. */ maxWidth?: number; }; /** * Absolute maximum width of the column. */ maxWidth?: number; } /** * @internal * Extension interface to extend the types from the tanstack table instance. */ export interface DataTableLayoutInstance { /** * Evaluates if any element in the grid template has a fractional unit in there * as this will drive some feature decisions that are mutually exclusive. */ getHasFractionalTemplate: () => boolean; /** * Returns the number of currently visible header rows. */ getVisibleHeaderGroupsCount: () => number; /** * Saves the height of the table header measured by the ResizeObserver. */ setObservedHeaderHeight: (height: number) => void; /** * Allows other features and template to access the headerSizes by header id or column id. */ getHeaderSize: (columnOrHeaderId: string) => { width: number; height: number; }; /** * Retrieves the width of a column or header with the given id. */ getColumnOrHeaderWidth: (columnOrHeaderId: string) => number; /** * Returns the height of the entire header. * If possible, a measured height is returned, otherwise it falls back to an estimation based on the table config. */ getTotalHeaderHeight: () => number; /** * Estimates the row height for a row at a given index based on the row density and row separation. */ estimateRowHeight: (props?: { index?: number; isHeaderRow?: boolean; }) => number; /** * Creates the grid template rows for the table header, based on the number of header groups. */ getHeaderGridTemplateRows: () => string; /** * Creates the grid template rows for the entire table, based on the number of header groups and the currently rendered rows. */ getGridTemplateRows: () => string; /** * Creates the grid template columns based on the specified widths in the column definition. */ getGridTemplateColumns: () => string; } /** * Extension interface to extend the types from the tanstack table options. * @internal */ export interface DataTableLayoutOptions { layout?: { fullWidth?: boolean; fullHeight?: boolean; }; } /** * The column grid templates for left, center and right pinned columns. * @internal */ export type DataTableColumnGridTemplates = { left: string[]; center: string[]; right: string[]; }; /** * Type alias for the function retrieving the measured column width. * @internal */ export type GetMeasuredColumnWidthFn = (columnId: string, isFractionWidth?: boolean) => number | undefined;