terminal_table/layouts

Layout types shared by table models and renderers.

Types

CellPadding = object
  left*, right*, top*, bottom*: int
Blank cells placed inside a cell around its content.
OverflowMode = enum
  overflowWrapWords, overflowWrapCharacters, overflowTruncate
How content that exceeds its allocated width is handled.
PanelPosition = enum
  panelTop, panelBottom
Placement of a full-width panel relative to normal table data.
Shadow = object
  right*, bottom*: int
  glyph*: string
  style*: TerminalStyle
Optional right and bottom table shadow. Sizes are terminal cells/lines.
TableMargin = object
  left*, right*, top*, bottom*: int
Blank cells and lines placed outside the complete table.
VerticalAlignment = enum
  valignTop, valignCenter, valignBottom
Alignment of content within a cell that is taller than its text.
WidthConstraint = object
  kind*: WidthKind
  value*: int
A column width rule. Width values exclude padding and borders.
WidthKind = enum
  widthContent, widthFixed, widthMinimum, widthMaximum, widthPercentage
Strategy used to choose a column's content width.

Consts

contentWidth = (kind: widthContent, value: 0)
Uses the widest unwrapped value in the column.

Procs

proc fixedWidth(width: Positive): WidthConstraint {....raises: [], tags: [],
    forbids: [].}
Fixes a column's content width.
proc initCellPadding(left = 1; right = 1; top = 0; bottom = 0): CellPadding {.
    ...raises: [ValueError], tags: [], forbids: [].}
Constructs validated cell padding.
proc initShadow(right = 1; bottom = 1; glyph = "â–‘"; style = TerminalStyle()): Shadow {.
    ...raises: [ValueError], tags: [], forbids: [].}
Constructs a validated table shadow. Zero sizes disable either edge.
proc initTableMargin(left = 0; right = 0; top = 0; bottom = 0): TableMargin {.
    ...raises: [ValueError], tags: [], forbids: [].}
Constructs validated outer table margins.
proc maximumWidth(width: Positive): WidthConstraint {....raises: [], tags: [],
    forbids: [].}
Caps a content-derived column at width.
proc minimumWidth(width: Positive): WidthConstraint {....raises: [], tags: [],
    forbids: [].}
Prevents a content-derived column from becoming narrower than width.
proc percentageWidth(percentage: range[1 .. 100]): WidthConstraint {....raises: [],
    tags: [], forbids: [].}
Uses a percentage of the content space available within maxWidth.