The "card" table: one row per record in a rounded tray (lu-card), with an optional heading, a
footer line and sub-lines. For long lists (orders, invoices, clients).
<.card_table id="orders" rows={@streams.orders} on_select="select" selected={@selected}
status={&order_status/1}>
<:col :let={{_id, o}} label="Pedido" class="mono">{o.number}</:col>
<:col :let={{_id, o}} label="Cliente">
{o.client}
<.ctable_sub priority={2}>{o.issuer}</.ctable_sub>
</:col>
<:col :let={{_id, o}} label="Total" align="right">{o.total}</:col>
<:foot><span>Mostrando 1–6 de 128</span></:foot>
</.card_table>It renders LedgerUI.Components.Table.table/1 inside the tray, so rows (list or stream), sorting,
selection and the other row_* attrs work as there. variant="flat" is the plain table of the
canvas dashboards (lu-table flat), in a card only when it has a title, :top, :actions or
:foot.
Columns leave by priority (1 to 4) when the table's own box is narrower than breakpoints
([1180, 960, 720, 520] by default; between 2 and 5 strictly descending integers, else
ArgumentError). A <.ctable_sub> is a second line inside a cell that leaves by its own
priority, or shows only once the columns of when_hidden (p1..p4) have left.
<:expand :let={row}> is a full-width line under each row for which row_expanded is true.
Card layout, panel, copy, edit
- Under the last breakpoint (
520by default) rows with a columnrole(head,status,title,value) become two-line cards;cardkeeps a column in its own line,truncate,widthshape the tracks,<:action card={false}>leaves the action cell out. - With
<:detail>slots or columns withpriority, a click on a row (rows variant) opens a panel under it (hookLedgerUI.CardTable, on the<tbody>);panel_labelnames it. copy/copy_label/copied_label/copy_show/copy_tipon a column draw a copy button (same hook).row_editing+<:edit>swap a row for an inline form;row_actiondrops the action of a row.
status paints an inset bar through box-shadow on the row (data-status carries the colour name).
Summary
Functions
A second line inside a card_table cell (12px, faint) that leaves by its own priority; or,
with when_hidden="p2", shows only once the columns of priority 2 have left.
Functions
Attributes
id(:string) (required)rows(:any) (required) - A list or a@streams.xstream.row_id(:any) - Defaults tonil.row_item(:any) - Defaults to&Function.identity/1.row_key(:any) - Defaults tonil.row_attrs(:any) - Function of the row returning extra<tr>attributes. Defaults tonil.status(:any) - Function of the row returning a colour for the bar at its left, ornil. Defaults tonil.on_select(:any) - Defaults tonil.on_select_all(:any) - Defaults tonil.selected(:list) - Defaults to[].all_selected(:boolean) - Defaults tonil.select_all_label(:string) - Defaults to"Select all rows".select_label(:string) - Defaults to"Select row".panel_label(:string) - The accessible name of the details panel. Defaults to"Details".on_sort(:any) - Defaults tonil.sort_by(:string) - Defaults tonil.sort_dir(:string) - Defaults to"asc". Must be one of"asc", or"desc".target(:any) - Defaults tonil.title(:string) - Defaults tonil.description(:string) - Defaults tonil.meta(:string) - A small muted text right after the title. Defaults tonil.bordered(:boolean) -falsedrops the tray's own border, shadow and background. Defaults totrue.row_expanded(:any) - Defaults tonil.row_editing(:any) - Function of the row; true shows the<:edit>slot in place of the cells. Defaults tonil.row_action(:any) - Function of the row; false leaves out the content of its action cell. Defaults tonil.breakpoints(:list) - Widths (px) under which priority 1, 2, 3... leave, descending; the last is the card layout. Defaults to[1180, 960, 720, 520].body_class(:any) - Classes of the<tbody>. Defaults tonil.variant(:string) - Defaults to"rows". Must be one of"rows", or"flat".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
action- The last cell of every row (a menu button); receives the row. Accepts attributes:priority(:integer)card(:boolean)
actions- Buttons at the right of the heading.col(required) - A column; receives the row (afterrow_item). Accepts attributes:label(:string)width(:string)priority(:integer)role(:string)align(:string) - Must be one of"start","end","left","center", or"right".truncate(:boolean)class(:any)sort_key(:string)copy(:any)copy_label(:string)copied_label(:string)copy_show(:string)card(:boolean)copy_tip(:string)style(:string)
detail- A line of the details panel that opens when a row is clicked. Accepts attributes:label(:string)
edit- Inline form in place of the cells of a row being edited.empty- Shown when there are no rows. Receives%{id, rows, selected, title}.expand- A full-width line under a row (seerow_expanded); receives the row.foot- A line inside the card under the rows. Receives%{id, rows, selected, title}.top- Withvariant="flat", what heads the card instead of the title (tabs).
A second line inside a card_table cell (12px, faint) that leaves by its own priority; or,
with when_hidden="p2", shows only once the columns of priority 2 have left.
Attributes
priority(:integer) - 1 to 4: leaves where the columns of that priority leave. Defaults tonil.when_hidden(:string) - Defaults tonil.Must be one ofnil,"p1","p2","p3", or"p4".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)