Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.channel-tui.table

Reusable fixed-width table primitives for TUI dialogs/pickers.

Reusable fixed-width table primitives for TUI dialogs/pickers.
raw docstring

border-lineclj

(border-line widths kind)
(border-line columns table-w kind)
source

boxed-border-lineclj

(boxed-border-line widths kind)

Render top/middle/bottom border for boxed-row-line.

Render top/middle/bottom border for `boxed-row-line`.
sourceraw docstring

boxed-row-lineclj

(boxed-row-line widths cells aligns)

Render fixed-width cells with outer vertical borders. Use inside dialog bodies when table should visually read as nested dialog chrome.

Render fixed-width cells with outer vertical borders. Use inside dialog
bodies when table should visually read as nested dialog chrome.
sourceraw docstring

column-widthsclj

(column-widths columns table-w)

Return concrete widths for columns inside total rendered table-w. Column spec accepts :width for fixed cells and :flex for proportional leftover. Total row width includes outer spaces and separators.

Return concrete widths for `columns` inside total rendered `table-w`.
Column spec accepts `:width` for fixed cells and `:flex` for proportional
leftover. Total row width includes outer spaces and ` │ ` separators.
sourceraw docstring

csv-alignsclj

(csv-aligns rows)

Per-column alignment for rows (first row = header): numbers right, text left — the convention every spreadsheet uses to make magnitudes comparable.

Per-column alignment for `rows` (first row = header): numbers right, text
left — the convention every spreadsheet uses to make magnitudes comparable.
sourceraw docstring

csv-grid-linesclj

(csv-grid-lines rows table-w)
(csv-grid-lines rows table-w {:keys [widths aligns header]})

Render rows (first row = header) as boxed grid lines at most table-w columns wide: top border, header, rule, one line per data row, bottom border. Opts reuse a measurement or restyle the head: :widths precomputed column widths (default csv-widths) :aligns per-column alignment (default csv-aligns) :header replacement header cells (e.g. carrying a sort arrow)

Render `rows` (first row = header) as boxed grid lines at most `table-w`
columns wide: top border, header, rule, one line per data row, bottom border.
Opts reuse a measurement or restyle the head:
  :widths  precomputed column widths (default `csv-widths`)
  :aligns  per-column alignment (default `csv-aligns`)
  :header  replacement header cells (e.g. carrying a sort arrow)
sourceraw docstring

csv-max-col-widthclj

Ceiling on ONE column's natural width. A single essay-length cell must not push every other column off the grid; the cell ellipsizes instead.

Ceiling on ONE column's natural width. A single essay-length cell must not
push every other column off the grid; the cell ellipsizes instead.
sourceraw docstring

csv-natural-widthclj

(csv-natural-width rows)

Total rendered width csv-grid-lines wants for rows when nothing is squeezed — borders and separators included. 0 for an empty grid.

Total rendered width `csv-grid-lines` wants for `rows` when nothing is
squeezed — borders and separators included. 0 for an empty grid.
sourceraw docstring

csv-numberclj

(csv-number cell)

Parse a cell as a number for sorting/alignment. Thousands separators, a leading currency mark and a trailing % are formatting, not text — a 1,234.5 column still sorts numerically. nil when the cell is not a number.

Parse a cell as a number for sorting/alignment. Thousands separators, a
leading currency mark and a trailing `%` are formatting, not text — a
`1,234.5` column still sorts numerically. nil when the cell is not a number.
sourceraw docstring

csv-stretch-widthsclj

(csv-stretch-widths widths table-w)

Grow widths so the rendered grid FILLS table-w instead of leaving a ragged gap on the right — what a spreadsheet pane does. Slack is spread evenly, left to right; a grid already wider than table-w is returned untouched.

Grow `widths` so the rendered grid FILLS `table-w` instead of leaving a ragged
gap on the right — what a spreadsheet pane does. Slack is spread evenly, left
to right; a grid already wider than `table-w` is returned untouched.
sourceraw docstring

csv-widthsclj

(csv-widths rows table-w)

Concrete column widths for a grid drawn with boxed-row-line inside table-w columns: natural widths when they fit, otherwise shrunk in proportion to them (never below one column).

Concrete column widths for a grid drawn with `boxed-row-line` inside
`table-w` columns: natural widths when they fit, otherwise shrunk in
proportion to them (never below one column).
sourceraw docstring

draw-line!clj

(draw-line! g x row width selected? line)
source

ellipsizeclj

(ellipsize s max-w)

Right-truncate s to max-w columns with a trailing . Thin delegate over the canonical p/ellipsize (lanterna-backed).

Right-truncate `s` to `max-w` columns with a trailing `…`.
Thin delegate over the canonical `p/ellipsize` (lanterna-backed).
sourceraw docstring

fit-cellclj

(fit-cell value width)
(fit-cell value width align)
source

header-lineclj

(header-line columns table-w)
(header-line columns table-w opts)
source

middle-ellipsizeclj

(middle-ellipsize s max-w)

Truncate s in the middle when it exceeds max-w display columns, keeping the filename (after last /) fully visible. Falls back to right-ellipsize when there is no / or the column is too narrow.

Truncate `s` in the middle when it exceeds `max-w` display columns,
keeping the filename (after last /) fully visible. Falls back to
right-ellipsize when there is no `/` or the column is too narrow.
sourceraw docstring

numeric-column?clj

(numeric-column? rows idx)

True when every non-blank cell of DATA rows (header excluded) under column idx reads as a number — the test that right-aligns a column.

True when every non-blank cell of DATA rows (header excluded) under column
`idx` reads as a number — the test that right-aligns a column.
sourceraw docstring

page-countclj

(page-count total page-size)

How many pages of page-size rows total rows fill — never fewer than one, so page 1/1 exists even for an empty sheet.

How many pages of `page-size` rows `total` rows fill — never fewer than one, so
`page 1/1` exists even for an empty sheet.
sourceraw docstring

page-indexclj

(page-index idx page-size)

0-based page holding row idx when a page shows page-size rows.

0-based page holding row `idx` when a page shows `page-size` rows.
sourceraw docstring

page-startclj

(page-start idx page-size)

First row index of the page holding idx — the grid's scroll offset, which is why the viewer moves a WHOLE page at a time instead of creeping row by row.

First row index of the page holding `idx` — the grid's scroll offset, which is
why the viewer moves a WHOLE page at a time instead of creeping row by row.
sourceraw docstring

parse-csvclj

(parse-csv text)

Parse RFC-4180 text into a vector of row vectors of strings — quoted fields, doubled "" escapes and embedded newlines included. Every row is padded to the widest one, so (nth row i) is total across the grid.

Parse RFC-4180 `text` into a vector of row vectors of strings — quoted
fields, doubled `""` escapes and embedded newlines included. Every row is
padded to the widest one, so `(nth row i)` is total across the grid.
sourceraw docstring

row-lineclj

(row-line widths cells)
(row-line widths cells aligns)
(row-line columns row table-w opts)

Render cells to one fixed-width table row. Legacy arity accepts explicit widths; column arity accepts specs + row map. opts supports :sep.

Render `cells` to one fixed-width table row. Legacy arity accepts explicit
widths; column arity accepts specs + row map. `opts` supports `:sep`.
sourceraw docstring

row-matches?clj

(row-matches? row query)
source

sort-csv-rowsclj

(sort-csv-rows rows idx dir)

Sort DATA rows (header excluded) by column idx; dir is :asc/:desc. A column whose every non-blank cell parses as a number sorts NUMERICALLY (so 9 comes before 10), any other column case-insensitively; blanks sort last.

Sort DATA rows (header excluded) by column `idx`; `dir` is `:asc`/`:desc`. A
column whose every non-blank cell parses as a number sorts NUMERICALLY (so 9
comes before 10), any other column case-insensitively; blanks sort last.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close