import type { OnChangeFn, Row, TableFeature, TableOptions } from '../../hooks/useTable/types.js'; import type { DataTableV2RowData } from '../../public.api.js'; /** @internal */ export type ExpandedState = true | Record; /** * @public */ export interface DataTableV2SubRowsBaseProps { /** * @defaultValue false */ subRows?: boolean | { accessor?: // With a keyof TData we would have type safety for the objects first level and would be able to suggest and ensure that the key given actually exists in the given TData row data. To support pathed accessors like 'some.nested' we need to fall back to a string. string | ((row: TData) => TData[] | undefined); /** * Allows to specify a columnId that the subRow indicator will be injected to. * By default, this will be the first visible column provided by the columns prop. */ subRowColumnId?: string; /** * Allows to specify a function that will evalute if a specific subRows trigger in a row * should be disabled. */ disableSubRow?: (row: TData) => boolean; }; /** * Callback triggered when open subrows change. */ onOpenSubRowsChange?: (openSubRows: Record) => void; } /** * @public */ export interface DataTableV2SubRowsControlledProps extends DataTableV2SubRowsBaseProps { /** * Currently open sub rows in a controlled scenario. */ openSubRows?: true | Record; /** * Initially open sub rows in an uncontrolled scenario. */ defaultOpenSubRows?: never; } /** * @public */ export interface DataTableV2SubRowsUncontrolledProps extends DataTableV2SubRowsBaseProps { /** * Currently open sub rows in a controlled scenario. */ openSubRows?: never; /** * Initially open sub rows in an uncontrolled scenario. */ defaultOpenSubRows?: true | Record; } /** * DataTableV2 props for SubRows definition. * @public */ export type DataTableV2SubRowsProps = DataTableV2SubRowsControlledProps | DataTableV2SubRowsUncontrolledProps; /** * Default accessor for the subRows * @internal */ export declare function defaultSubRowsAccessor(originalRow: TData): TData[]; /** * Extension interface to extend the types from the tanstack table instance. * @internal */ export interface DataTableV2SubRowsInstance { /** * Returns the column id that should show the subrow expand indicator. * This does not consider builtin columns and only respects consumer provided columns. */ getSubRowIndicatorColumnId: () => string | null; /** * Calculates the width of the maximum expanded subrow in pixels. * This is helpful for layout purposes to already size the column with the subrow. */ getSubRowIndentationWidth: () => number; /** * Gets the current maximum open depth of the subrows. */ getSubRowOpenDepth: () => number; /** * Returns whether some of the row's ancestors are disabled. */ getIsAncestorDisabled: () => (row: Row | undefined) => boolean; /** * Returns true, if the table has at least one row with at least one sub-row, false otherwise. */ getHasSubRows: () => boolean; _getRowLineConfig: () => (rowId: string) => Array<'Line' | 'TShape' | 'LShape' | 'Empty'>; } /** * Extension interface to extend the types from the tanstack table options. * @internal */ export interface DataTableV2SubRowsOptions { /** * Defines the columnId where the subrow indicator will be injected to. */ subRowColumnId?: string; /** * Enable/disable expanding for all rows. */ enableExpanding?: boolean; /** * Control function that defines whether a subrow expand is disabled or not. */ getRowExpandDisabled?: (row: TData) => boolean; /** * This function is called when the `expanded` table state changes. */ onExpandedChange?: OnChangeFn; } /** * Extension interface to extend the types from the tanstack table instance. * @internal */ export interface DataTableV2SubRowsRow { _getIsLastInExpandedOnLevel: () => boolean; /** The last expanded sub-row of this row, depending on the order of the rows. Can be a direct sub-row or a deeper nested one. */ _getLastExpandedSubRow: () => Row | undefined; /** Determines whether the given subRow expander is disabled. */ getCanExpandDisabled: () => boolean; /** The nesting level of the (sub) row. Top level parent row will have depth: 0, it's child depth: 1 and so on. */ getSubRowDepth: () => number; /** Returns the expanded leaf rows for the row, not including any parent rows. */ getExpandedLeafRows: () => Row[]; } /** * @internal */ export declare function calculateMaxVisibleDepth(rowIds: string[], separator?: string): number; /** * @internal */ export declare const DataTableV2SubRows: TableFeature; /** * @internal */ export declare function SubRowsHeaderWidthCorrection(): import("react/jsx-runtime.js").JSX.Element; /** * Configuration hook for subrows of the DataTableV2. * @internal */ export declare function useSubRows(props: DataTableV2SubRowsProps, options: TableOptions): void;