Reusable fixed-width table primitives for TUI dialogs/pickers.
Reusable fixed-width table primitives for TUI dialogs/pickers.
(boxed-border-line widths kind)Render top/middle/bottom border for boxed-row-line.
Render top/middle/bottom border for `boxed-row-line`.
(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.
(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.
(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.
(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)
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.
(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.
(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.
(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.
(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).
(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).
(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.
(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.
(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.
(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.
(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.
(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.
(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`.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |