Skip to main content
Module

x/cliffy/table/layout.ts>TableLayout

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
class TableLayout
import { TableLayout } from "https://deno.land/x/cliffy@v0.25.1/table/layout.ts";

Table layout renderer.

Constructors

new
TableLayout(table: Table, options: ITableSettings)

Table layout constructor.

Methods

protected
createCell(cell: ICell | null | undefined, row: Row): Cell

Create a new cell from existing cell or cell value.

protected
createLayout(): IRenderSettings

Generates table layout including row and col span, converts all none Cell/Row values to Cells and Rows and returns the layout rendering settings.

protected
createRow(row: IRow): Row<Cell>

Create a new row from existing row or cell array.

protected
getDeleteCount(
rows: Array<Array<unknown>>,
rowIndex: number,
colIndex: number,
)
protected
renderBorderCell(
colIndex: number,
prevRow: Row<Cell> | undefined,
nextRow: Row<Cell> | undefined,
rowSpan: number[],
opts: IRenderSettings,
): string

Render border cell.

protected
renderBorderRow(
prevRow: Row<Cell> | undefined,
nextRow: Row<Cell> | undefined,
rowSpan: number[],
opts: IRenderSettings,
): string

Render border row.

protected
renderCell(
colIndex: number,
row: Row<Cell>,
opts: IRenderSettings,
noBorder?: boolean,
): string

Render cell.

protected
renderCellValue(cell: Cell, maxLength: number): { current: string; next: Cell; }

Render specified length of cell. Returns the rendered value and a new cell with the rest value.

protected
renderRow(
rowSpan: number[],
rowIndex: number,
opts: IRenderSettings,
isMultiline?: boolean,
): string

Render row.

protected
renderRows(opts: IRenderSettings): string

Render table layout.

protected
spanRows(rows: Array<IRow>)

Fills rows and cols by specified row/col span with a reference of the original cell.

toString(): string

Generate table string.