import { TableRenderer } from "./TableRenderer.js"; export type ListColumn = { /** The header to display for this column. */ header?: string; /** * Whether this column counts as an extended column. Extended columns are only * displayed when the `extended` option is set to `true`. */ extended?: boolean; /** * A function to extract the value to display for this column from the item. * If not set, the column will be extracted from the item by its key. */ get?: (row: TItem) => string | undefined; /** * The minimum width of this column. If the content is smaller, the column * will be padded with spaces. If the content is larger, the column might be * expanded based on the available remaining space, or truncated. */ minWidth?: number; /** * The exact width of this column. If set, the column will be exactly this * wide, regardless of the content. */ exactWidth?: number; /** * Whether this column should expand to fill the remaining space. Currently, * only one column can be set to expand. */ expand?: boolean; }; export type ListColumns = { [key: string]: ListColumn; }; export interface TableOptions { /** Whether to include extended columns in the output. */ extended: boolean; } export default class Table { private readonly columns; private readonly opts; private readonly renderer; constructor(columns: ListColumns, renderer: TableRenderer, opts?: Partial); render(data: TItem[]): string; /** The columns with their names as an array of tuples. */ get columnsWithNames(): [string, ListColumn][]; extractRowValues(data: TItem[]): string[][]; }