import type { NewTablePropSet, TablePlugin } from '../types/TablePlugin.js'; /** * Utility type that extracts keys from Item whose values are arrays of Item. * Used to infer valid children property keys. * * @template Item - The type of data items. */ export type ValidChildrenKey = { [Key in keyof Item]: Item[Key] extends Item[] ? Key : never; }[keyof Item]; /** * Function type for extracting child items from a parent item. * * @template Item - The type of data items. */ export type ValidChildrenFn = (_item: Item) => Item[] | undefined; /** * Configuration options for the addSubRows plugin. * * @template Item - The type of data items. */ export interface SubRowsConfig { /** Property key or function to extract child items from each item. */ children: ValidChildrenKey | ValidChildrenFn; } /** * Creates a sub-rows plugin that enables hierarchical data display. * Extracts child items from each row using the specified children accessor. * * @template Item - The type of data items in the table. * @param config - Configuration with the children accessor. * @returns A TablePlugin that creates hierarchical row structure. * @example * ```typescript * interface Employee { * name: string * directReports?: Employee[] * } * * const table = createTable(data, { * subRows: addSubRows({ * children: 'directReports' // or: (item) => item.directReports * }) * }) * ``` */ export declare const addSubRows: ({ children }: SubRowsConfig) => TablePlugin, Record, NewTablePropSet>;