import { TableRenderer, TableRendererOptions } from "./TableRenderer.js"; import Table from "./Table.js"; import { Options as ChalkOptions } from "chalk"; export interface TableColumnRendererOptions extends TableRendererOptions { /** * The maximum width of the table in characters. If columns exceed this width, * they will be truncated. If omitted, the table will be as wide as necessary * (but not wider). */ maxWidth: number | undefined; /** Whether to truncate columns that exceed the maximum width. */ truncate: boolean; /** The gap between columns in characters. */ gap: number; /** Options to pass to the Chalk instance used for rendering. */ chalkOptions: ChalkOptions; /** * When columns were truncated and some space is still left, the remaining * space is distributed among the columns. This factor determines how much * smaller columns are favored over larger columns. * * Default is 0.2. */ favorSmallColumnsFactor: number; } export default class TableColumnRenderer implements TableRenderer { private opts; private readonly chalk; constructor(opts: Partial); render(table: Table, data: TItem[]): string; private renderItems; private renderHeader; private widenColumnsToFitAvailableSpace; private widenColumnsProportionally; private widenColumnsToFitTruncatedContent; /** The total width reserved for column gaps. */ private totalColumnGapReservation; }