Raxol.UI.Layout.Table (Raxol v2.9.2)

View Source

Table layout operations for the UI system.

Provides advanced table layout functionality including:

  • Column width calculation
  • Row height computation
  • Table scrolling support
  • Responsive column sizing

A table's :border (:single, the default, :double, :rounded, :bold, ... or :none) frames it: one row above and below, one column either side, and a header rule under the header row. :none draws none of them and takes no space for them. measure/2 counts exactly the rows and columns Raxol.UI.ElementRenderer.render_table/6 draws.

Summary

Functions

Whether border draws a frame: anything but :none, false or nil.

Measures a table element.

Measures and positions a table element, prepending the positioned table to acc (the layout engine's process_element/3 contract).

Normalizes DSL top-level headers/rows/data into attrs.columns/attrs.rows; existing attrs.columns wins. The top-level :border lands in attrs.border (default :single) unless attrs already name one.

Functions

framed?(border)

@spec framed?(term()) :: boolean()

Whether border draws a frame: anything but :none, false or nil.

measure(attrs_map, available_space)

Measures a table element.

Calculates the required dimensions for a table based on:

  • Column widths (auto-sized or fixed)
  • Row count and height
  • The header row, and the frame and header rule of a bordered table
  • Available space constraints

measure_and_position(table_element, space, acc)

Measures and positions a table element, prepending the positioned table to acc (the layout engine's process_element/3 contract).

normalize_table_attrs(table_element)

Normalizes DSL top-level headers/rows/data into attrs.columns/attrs.rows; existing attrs.columns wins. The top-level :border lands in attrs.border (default :single) unless attrs already name one.