Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / COLLECTIONS AND INTERACTION
Table
A selectable table with fixed headers/footers and clipped, independently scrollable body rows.
Sorting/filtering and cell actions belong to the caller. Set minimumWidth to allow
horizontal scrolling instead of squeezing columns into a narrow viewport.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
var table = Table(columns: [TableColumn("Name", width: .length(8))], rows: [TableRow(id: 1, cells: [TableCell("Ready")])])
table.columnFlex = .center
_ = table.columnAreas(width: 40)Members on this page
Feature guides and release status
Table
struct Table<ID> where ID : HashableConforms to: StatefulWidget.
A selectable table with fixed headers/footers and clipped, independently scrollable body rows.
Sorting/filtering and cell actions belong to the caller. Set minimumWidth to allow
horizontal scrolling instead of squeezing columns into a narrow viewport.
columns
var columns: [TableColumn]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:134rows
var rows: [TableRow<ID>]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:135columnSpacing
var columnSpacing: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:136columnFlex
var columnFlex: FlexPlaces unused horizontal cells around columns after widths and column spacing are reserved.
Uses the same allocation and remainder rules as Layout.
automaticHeights
var automaticHeights: BoolMeasures body text using the final column widths.
Source · Table.swift:142wrapping
var wrapping: TextWrappingA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:143wrapOptions
var wrapOptions: TextWrapOptionsA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:144minimumWidth
var minimumWidth: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:145showsHeader
var showsHeader: BoolA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:146headerHeight
var headerHeight: IntA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:147style
var style: StyleVisual attributes used when painting this value.
Source · Table.swift:150headerStyle
var headerStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:151selectionStyle
var selectionStyle: StyleStyle used for the selected choice/icon.
Source · Table.swift:153markedStyle
var markedStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:154cellSelectionStyle
var cellSelectionStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:155columnSelectionStyle
var columnSelectionStyle: StyleA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:156selectionSymbol
var selectionSymbol: StringA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:157prefixReservation
var prefixReservation: SelectionPrefixReservationA public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:158selectionPatch
var selectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:159columnSelectionPatch
var columnSelectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:160cellSelectionPatch
var cellSelectionPatch: StylePatch?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Table.swift:161emptyMessage
var emptyMessage: StringText shown when the popup has no items.
Source · Table.swift:162init(columns:rows:)
init(columns: [TableColumn], rows: [TableRow<ID>])Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (2)
columns- Cell-column count or signed column movement, according to the method.
rows- Row count or signed row movement, according to the method.
bodyArea(in:)
func bodyArea(in area: Rect) -> RectReturns the body rectangle after reserving header and footer rows, clamped for small viewports.
Parameters (1)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Rect.
columnAreas(width:)
func columnAreas(width: Int) -> [Rect]Column regions in logical content coordinates, before horizontal scrolling.
Parameters (1)
width- Available columns in terminal cells.
Returns [Rect].
update(in:state:)
func update(in area: Rect, state: inout TableState<ID>)Synchronizes data and geometry before dispatching events.
Drawing also calls this method.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
state- Argument type and any default are shown in the declaration; see the behavior notes above.
render(in:buffer:state:)
func render(in area: Rect, buffer: inout Buffer, state: inout TableState<ID>)Reconciles the caller-owned selection metrics and paints visible rows using the same geometry as hit testing.
Parameters (3)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.
state- Argument type and any default are shown in the declaration; see the behavior notes above.
cell(at:in:state:)
func cell(at point: Point, in area: Rect, state: TableState<ID>) -> (row: ID, column: Int)?Returns body cells only; headers, footers, spacing, and unused columns return nil.
Parameters (3)
at- Argument type and any default are shown in the declaration; see the behavior notes above.
in- Argument type and any default are shown in the declaration; see the behavior notes above.
state- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns (row: ID, column: Int)?.
contentArea(in:state:)
func contentArea(in area: Rect, state: TableState<ID>) -> RectContent viewport after the fixed selection prefix gutter.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
state- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Rect.