Skip to main content
Deno 2 is finally here 🎉️
Learn more
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.17.0/table/layout.ts";

Table layout renderer.

Constructors

new
TableLayout(table: Table, options: ITableSettings)

Table layout constructor.

Methods

protected
createCell(cell: ICell | null, 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 Cell's and Row's and returns the layout rendering settings.

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

Create a new row from existing row or cell array.

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>,
prevRow: Row<Cell> | undefined,
rowSpan: number[],
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: IRow[],
rowIndex?,
colIndex?,
rowSpan?: number[],
colSpan?,
): Row<Cell>[]

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

toString(): string

Generate table string.