@umriss-ui/table 0.41.1 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -2
- package/README.md +23 -5
- package/dist/index.d.ts +38 -30
- package/dist/table.css +1 -1
- package/dist/table.js +2351 -2208
- package/docs/llms-full.md +487 -301
- package/package.json +7 -6
package/docs/llms-full.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @umriss-ui/table 0.
|
|
1
|
+
# @umriss-ui/table 0.43.0
|
|
2
2
|
|
|
3
3
|
> React data table for data-dense applications - sorting, filtering, grouping, aggregates, virtualisation. Declared the way it reads: columns as JSX, typed against their rows.
|
|
4
4
|
|
|
@@ -152,7 +152,7 @@ export default function WorkThroughTheAlerts() {
|
|
|
152
152
|
</div>
|
|
153
153
|
|
|
154
154
|
<div data-callout="2">
|
|
155
|
-
<Table selectable
|
|
155
|
+
<Table selectable aria-label="Alerts">
|
|
156
156
|
<Column value="raised" label="Raised">
|
|
157
157
|
{(raised) => time(raised)}
|
|
158
158
|
</Column>
|
|
@@ -474,7 +474,7 @@ export default function FindALateShipment() {
|
|
|
474
474
|
</Button>
|
|
475
475
|
</Stack>
|
|
476
476
|
|
|
477
|
-
<Table selectable
|
|
477
|
+
<Table selectable aria-label="Shipments">
|
|
478
478
|
<Toolbar>
|
|
479
479
|
<span data-callout="2">
|
|
480
480
|
<Search placeholder="Shipment or customer" />
|
|
@@ -683,7 +683,7 @@ export default function ReviewCostCentres() {
|
|
|
683
683
|
</Toolbar>
|
|
684
684
|
|
|
685
685
|
<div data-callout="3">
|
|
686
|
-
<Table
|
|
686
|
+
<Table aria-label="Cost centres, first quarter">
|
|
687
687
|
<Column value="area" label="Area" />
|
|
688
688
|
<Column value="id" label="Cost centre" rowHeader />
|
|
689
689
|
<Column value="name" label="Name">
|
|
@@ -848,7 +848,7 @@ export default function PlanTheTeamCapacity() {
|
|
|
848
848
|
<div data-callout="2">
|
|
849
849
|
<Table
|
|
850
850
|
grid
|
|
851
|
-
|
|
851
|
+
aria-label="Booked hours per person and week"
|
|
852
852
|
onCellEdit={({ rowKey, columnId, value, row }) => {
|
|
853
853
|
setRows((all) => all.map((r) => (r.id === rowKey ? { ...r, [columnId]: value } : r)));
|
|
854
854
|
setLast(`${row.name}, ${columnId === "capacity" ? "capacity" : `week of ${columnId.slice(4)} March`}: ${String(value)} h`);
|
|
@@ -932,7 +932,7 @@ export default function FirstTable() {
|
|
|
932
932
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.id });
|
|
933
933
|
|
|
934
934
|
return (
|
|
935
|
-
<Table
|
|
935
|
+
<Table aria-label="Team">
|
|
936
936
|
<Column value="name" label="Name" rowHeader />
|
|
937
937
|
<Column value="role" label="Role" />
|
|
938
938
|
<Column value="team" label="Team" />
|
|
@@ -954,12 +954,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
954
954
|
|---|---|---|---|
|
|
955
955
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
956
956
|
|
|
957
|
-
###### Accessibility
|
|
958
|
-
|
|
959
|
-
| Prop | Type | Default | Description |
|
|
960
|
-
|---|---|---|---|
|
|
961
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
962
|
-
|
|
963
957
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
964
958
|
|
|
965
959
|
| Prop | Type | Default | Description |
|
|
@@ -1019,7 +1013,7 @@ export default function FirstTable() {
|
|
|
1019
1013
|
const { Table, Column } = useTable(SERVICES, { rowKey: (s) => s.id });
|
|
1020
1014
|
|
|
1021
1015
|
return (
|
|
1022
|
-
<Table
|
|
1016
|
+
<Table aria-label="Services">
|
|
1023
1017
|
<Column value="name" label="Service" rowHeader />
|
|
1024
1018
|
<Column value="team" label="Team" />
|
|
1025
1019
|
<Column value="tier" label="Tier" />
|
|
@@ -1113,7 +1107,7 @@ export default function SearchAndPageFromAHeader() {
|
|
|
1113
1107
|
}
|
|
1114
1108
|
/>
|
|
1115
1109
|
<CardBody>
|
|
1116
|
-
<Table
|
|
1110
|
+
<Table aria-label="Services">
|
|
1117
1111
|
<Column value="name" label="Service" rowHeader />
|
|
1118
1112
|
<Column value="team" label="Team" />
|
|
1119
1113
|
<Column value="tier" label="Tier" />
|
|
@@ -1216,7 +1210,7 @@ export default function SortArrangeAndExport() {
|
|
|
1216
1210
|
);
|
|
1217
1211
|
})}
|
|
1218
1212
|
</Stack>
|
|
1219
|
-
<Table
|
|
1213
|
+
<Table aria-label="Services">
|
|
1220
1214
|
<Column value="name" label="Service" rowHeader />
|
|
1221
1215
|
<Column value="team" label="Team" />
|
|
1222
1216
|
<Column value="tier" label="Tier" />
|
|
@@ -1241,7 +1235,7 @@ export default function SortArrangeAndExport() {
|
|
|
1241
1235
|
|
|
1242
1236
|
#### Accessibility
|
|
1243
1237
|
|
|
1244
|
-
A native `table`, named by `
|
|
1238
|
+
A native `table`, named by `aria-label`: without it a screen reader announces a table with no name, so pass one, the more so where a page holds two. The `rowHeader` column's cells are row headers, so a reader names the row as it moves along it, and the row's checkbox, expander and actions are named after it too.
|
|
1245
1239
|
|
|
1246
1240
|
A sortable header holds a button, and its cell carries `aria-sort`, so the reader says which column orders the rows and in which direction. While `loading` is set the table is `aria-busy`.
|
|
1247
1241
|
|
|
@@ -1253,20 +1247,23 @@ A value cut short at the edge of its cell shows whole in a tip, under the pointe
|
|
|
1253
1247
|
|
|
1254
1248
|
| Prop | Type | Default | Description |
|
|
1255
1249
|
|---|---|---|---|
|
|
1256
|
-
| `selectable` | `boolean` | — | Adds the selection column. "All" means: the filtered set.<br>Shown in: [Name the row (Column)](#column), [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Keep the header and the names in view (Width and pinning)](#width-and-pinning) and
|
|
1257
|
-
| `stickyHeader` | `boolean` | — | Keeps the header row visible while scrolling.<br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Fold groups into a summary (Grouping)](#grouping-1), [Group twenty thousand rows (Grouping)](#grouping-1) and
|
|
1250
|
+
| `selectable` | `boolean` | — | Adds the selection column. "All" means: the filtered set.<br>Shown in: [Name the row (Column)](#column), [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Keep the header and the names in view (Width and pinning)](#width-and-pinning) and 15 more |
|
|
1251
|
+
| `stickyHeader` | `boolean` | — | Keeps the header row visible while scrolling.<br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Fold groups into a summary (Grouping)](#grouping-1), [Group twenty thousand rows (Grouping)](#grouping-1) and 7 more |
|
|
1258
1252
|
| `stickyRowHeader` | `boolean` | — | Keeps the row header column visible while scrolling sideways - the same as `pin="start"` on the row header.<br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Stripes across a wide table (Row appearance)](#row-appearance), [Show, hide and arrange (ColumnMenu)](#columnmenu) and 1 more |
|
|
1259
1253
|
| `striped` | `boolean` | — | Discreet zebra stripes.<br>Shown in: [Stripes across a wide table (Row appearance)](#row-appearance) |
|
|
1260
1254
|
| `density` | `"regular" \| "compact"` | the density of the `UmrissProvider`, else `"regular"` | How tightly the rows stand.<br>Shown in: [Fit long group names in a compact table (Grouping)](#grouping-1), [Employees in the detail (Tree rows)](#tree-rows), [Own staff and teams (Tree rows)](#tree-rows) and 4 more |
|
|
1261
|
-
| `maxHeight` | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it.<br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Fold groups into a summary (Grouping)](#grouping-1), [Group twenty thousand rows (Grouping)](#grouping-1) and
|
|
1255
|
+
| `maxHeight` | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it.<br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Fold groups into a summary (Grouping)](#grouping-1), [Group twenty thousand rows (Grouping)](#grouping-1) and 6 more |
|
|
1262
1256
|
| `empty` | `ReactNode` | — | What stands in the body when there are no rows. Empty because of a filter the table shows itself – with the way back.<br>Shown in: [Restrict which rows a table has (Pre-filter)](#pre-filter), [Show loading, empty, failed and no match (Row appearance)](#row-appearance) |
|
|
1263
1257
|
| `loading` | `boolean` | — | Shows placeholder rows instead of the rows.<br>Shown in: [Rows from a request (Filter)](#filter), [Show loading, empty, failed and no match (Row appearance)](#row-appearance), [Show loading, and drop a late answer (Server mode)](#server-mode) and 1 more |
|
|
1264
1258
|
| `rowProps` | `(row: Z) => ``RowAttributes` | — | Classes and data attributes per row.<br>Shown in: [Mark rows by their state (Row appearance)](#row-appearance) |
|
|
1259
|
+
| `currentRow` | `string \| null` | — | The key of the row the rest of the screen follows - the table marks it with `aria-current` and an accent bar, apart from the selection. The table keeps no copy: pass the key you hold, `null` for none.<br>Shown in: [The current row (Selection)](#selection), [Another view chooses a row (Virtualisation)](#virtualisation) |
|
|
1260
|
+
| `onCurrentRowChange` | `(key: string, row: Z) => void` | — | A primary click on a row, outside its controls - the checkbox, the expander, the actions and any button of yours in a cell - with the row's key and the row. Also called for the row already current, so that you decide whether a second click clears it. By the keyboard: in a native table the content of the row-header cell becomes a button (Enter and Space), so a control of your own in that cell would stand inside it; in grid mode Enter on a cell with nothing to edit or enter. Without a `rowHeader` column the keyboard cannot choose a row.<br>Shown in: [The current row (Selection)](#selection), [Another view chooses a row (Virtualisation)](#virtualisation) |
|
|
1265
1261
|
| `groupable` | `boolean` | — | `false`: the user cannot group this table - the column menu offers no grouping, and a grouping handed in is passed over.<br>Shown in: [Switch grouping off (Grouping)](#grouping-1) |
|
|
1266
|
-
| `grid` | `boolean` | — | Grid mode: the table is one tab stop, and the arrows walk its cells - Home and End in the row, Ctrl+Home and Ctrl+End to the table's ends, PageUp and PageDown by the rows in view. A cell's own controls are reached with Enter or F2 and left with Escape; a column with `edit` is edited in place. Without it the table stays a native table.<br>Shown in: [Work cell by cell (Grid mode)](#grid-mode), [Combine grid mode with groups, pinning and many rows (Grid mode)](#grid-mode)
|
|
1262
|
+
| `grid` | `boolean` | — | Grid mode: the table is one tab stop, and the arrows walk its cells - Home and End in the row, Ctrl+Home and Ctrl+End to the table's ends, PageUp and PageDown by the rows in view. A cell's own controls are reached with Enter or F2 and left with Escape; a column with `edit` is edited in place. Without it the table stays a native table.<br>Shown in: [Bring a row into view from outside (Virtualisation)](#virtualisation), [Work cell by cell (Grid mode)](#grid-mode), [Combine grid mode with groups, pinning and many rows (Grid mode)](#grid-mode) and 7 more |
|
|
1267
1263
|
| `editMode` | `"cell" \| "row"` | — | Grid mode ([ADR-0036](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0036-a-grid-edits-on-the-first-click-and-saves-rows-on-purpose.md)): `"cell"` reports every cell as it is left (`onCellEdit`); `"row"` opens every cell of a row that edits at once, as one **Row draft**, and reports it only when the row is saved on purpose (`onRowSave`) - by its Save button or Enter; Escape or Discard drops it. A row with a draft is left only by saving or discarding it.<br>Shown in: [Save a row on purpose (Edits)](#edits), [Check a whole row before it is saved (Edits)](#edits), [Keep a list: add, change and delete rows (Edits)](#edits) and 1 more |
|
|
1268
1264
|
| `newRow` | `() => Partial<Z>` | — | What a new row starts with - the values the columns read before anything is typed. Without it, nothing.<br>Shown in: [Keep a list: add, change and delete rows (Edits)](#edits) |
|
|
1269
|
-
| `children` | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts.<br>Shown in: [Show a list of services](#first-table), [Search and page from a header of your own](#first-table), [Sort, arrange and export from controls of your own](#first-table) and
|
|
1265
|
+
| `children` | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts.<br>Shown in: [Show a list of services](#first-table), [Search and page from a header of your own](#first-table), [Sort, arrange and export from controls of your own](#first-table) and 123 more |
|
|
1266
|
+
| `ref` | `Ref<HTMLDivElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
1270
1267
|
|
|
1271
1268
|
###### Events
|
|
1272
1269
|
|
|
@@ -1281,26 +1278,22 @@ A value cut short at the edge of its cell shows whole in a tip, under the pointe
|
|
|
1281
1278
|
|
|
1282
1279
|
| Prop | Type | Default | Description |
|
|
1283
1280
|
|---|---|---|---|
|
|
1284
|
-
| `ariaLabel` | `string` | — |
|
|
1285
|
-
|
|
1286
|
-
###### Styling
|
|
1281
|
+
| `ariaLabel` | `string` | — | *Deprecated* since 0.43 - use `aria-label`. Accessible name of the table. |
|
|
1287
1282
|
|
|
1288
|
-
|
|
1289
|
-
|---|---|---|---|
|
|
1290
|
-
| `className` | `string` | — | Classes on the outer frame of the table.<br>Shown in: [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Pin and size from controls of your own (Width and pinning)](#width-and-pinning) and 2 more |
|
|
1283
|
+
Also takes every attribute of `<div>` – without `children`.
|
|
1291
1284
|
|
|
1292
1285
|
##### `TableOptions<Z>`
|
|
1293
1286
|
|
|
1294
1287
|
| Prop | Type | Default | Description |
|
|
1295
1288
|
|---|---|---|---|
|
|
1296
|
-
| `rowKey` *required* | `(row: Z) => string` | — | A stable key per row – the basis of selection and expansion.<br>Shown in: [Show a list of services](#first-table), [Search and page from a header of your own](#first-table), [Sort, arrange and export from controls of your own](#first-table) and
|
|
1289
|
+
| `rowKey` *required* | `(row: Z) => string` | — | A stable key per row – the basis of selection and expansion.<br>Shown in: [Show a list of services](#first-table), [Search and page from a header of your own](#first-table), [Sort, arrange and export from controls of your own](#first-table) and 123 more |
|
|
1297
1290
|
| `pageSize` | `number` | `10` | How many rows a page holds.<br>Shown in: [Search and page from a header of your own](#first-table), [Ask a question over several fields (Filter)](#filter), [Restrict which rows a table has (Pre-filter)](#pre-filter) and 7 more |
|
|
1298
1291
|
| `defaultSort` | `SortLevel`` \| readonly ``SortLevel``[] \| null` | `null` | The application's sort; it is the default that `view` leaves out.<br>Shown in: [Sort, arrange and export from controls of your own](#first-table), [A label wider than its column (Width and pinning)](#width-and-pinning), [Sort by several columns (Sorting)](#sorting) and 10 more |
|
|
1299
1292
|
| `defaultGrouping` | `GroupingId``<Z> \| readonly ``GroupingId``<Z>[]` | ungrouped, until the user groups | The application's grouping: a column or group key, or up to three, the outermost first. It is the default that `view` leaves out.<br>Shown in: [Group by one column (Grouping)](#grouping-1), [Group on two levels (Grouping)](#grouping-1), [Group on three levels (Grouping)](#grouping-1) and 23 more |
|
|
1300
1293
|
| `preFilter` | `(row: Z) => boolean` | — | Which rows the table has at all – by permission, by tenant, by anything the user is not meant to undo. It is invisible: never a condition, never reset, never part of the view, and "43 of 1,204" counts only the rows it admits. It may stand in the call; a change leaves the page standing, and the model clamps it.<br>Shown in: [Restrict which rows a table has (Pre-filter)](#pre-filter) |
|
|
1301
1294
|
| `rowFilters` | `readonly `[`RowFilter`](#filter)`<Z, any>[]` | — | The row filters the table has: conditions the application defines over the whole row and sets with `t.setFilter(filter, condition)` from a control of its own. Named here so that a condition from `initialView`, which arrives by id, is known in the first render.<br>Shown in: [Filter by a field no column shows (Filter)](#filter), [Rows from a request (Filter)](#filter), [Ask a question over several fields (Filter)](#filter) and 3 more |
|
|
1302
1295
|
| `initialView` | `TableView` | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The table remembers none: where a view is kept is the application's decision. Names no column carries fall out.<br>Shown in: [Ask a question over several fields (Filter)](#filter), [Fold groups into a summary (Grouping)](#grouping-1), [Show loading, empty, failed and no match (Row appearance)](#row-appearance) and 2 more |
|
|
1303
|
-
| `virtual` | `boolean \| { overscan?: number }` | — | Renders only what stands in the scroll area; paging is then off. Every row is one row pitch tall, which the table measures itself ([ADR-0042](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0042-a-rows-height-never-follows-what-it-shows.md)).<br>Shown in: [Group twenty thousand rows (Grouping)](#grouping-1), [Scroll twenty thousand rows (Virtualisation)](#virtualisation), [
|
|
1296
|
+
| `virtual` | `boolean \| { overscan?: number }` | — | Renders only what stands in the scroll area; paging is then off. Every row is one row pitch tall, which the table measures itself ([ADR-0042](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0042-a-rows-height-never-follows-what-it-shows.md)).<br>Shown in: [Group twenty thousand rows (Grouping)](#grouping-1), [Scroll twenty thousand rows (Virtualisation)](#virtualisation), [Inside a pane of fixed height (Virtualisation)](#virtualisation) and 4 more |
|
|
1304
1297
|
| `selection` | `TableSelection``<string>` | — | A selection from outside instead of its own – when the application holds it.<br>Shown in: [Hold the selection yourself (Selection)](#selection) |
|
|
1305
1298
|
|
|
1306
1299
|
###### Events
|
|
@@ -1553,10 +1546,10 @@ type Absent = null | undefined;
|
|
|
1553
1546
|
|
|
1554
1547
|
#### Known limits
|
|
1555
1548
|
|
|
1556
|
-
- No cell range selection and no undo: an edit is reported, never applied, and the application owns the rows ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
1557
|
-
- No pivot: compute the pivoted rows and
|
|
1549
|
+
- No cell range selection and no undo: an edit is reported, never applied, and the application owns the rows ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
1550
|
+
- No pivot: compute the pivoted rows and map one computed column per key from the data, as in [a matrix with row and column totals](#aggregate) ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
1558
1551
|
|
|
1559
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
1552
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
1560
1553
|
|
|
1561
1554
|
### Provider
|
|
1562
1555
|
|
|
@@ -1608,7 +1601,7 @@ const INVOICES: Invoice[] = [
|
|
|
1608
1601
|
function Invoices() {
|
|
1609
1602
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id });
|
|
1610
1603
|
return (
|
|
1611
|
-
<Table
|
|
1604
|
+
<Table aria-label="Invoices">
|
|
1612
1605
|
<Toolbar>
|
|
1613
1606
|
<Search />
|
|
1614
1607
|
<ColumnMenu />
|
|
@@ -1648,12 +1641,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
1648
1641
|
|---|---|---|---|
|
|
1649
1642
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
1650
1643
|
|
|
1651
|
-
###### Accessibility
|
|
1652
|
-
|
|
1653
|
-
| Prop | Type | Default | Description |
|
|
1654
|
-
|---|---|---|---|
|
|
1655
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
1656
|
-
|
|
1657
1644
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
1658
1645
|
|
|
1659
1646
|
| Prop | Type | Default | Description |
|
|
@@ -1729,7 +1716,7 @@ export default function ValueFromField() {
|
|
|
1729
1716
|
const { Table, Column } = useTable(VEHICLES, { rowKey: (v) => v.plate });
|
|
1730
1717
|
|
|
1731
1718
|
return (
|
|
1732
|
-
<Table
|
|
1719
|
+
<Table aria-label="Vehicles">
|
|
1733
1720
|
<Column value="plate" label="Plate" rowHeader />
|
|
1734
1721
|
<Column value="type" label="Type" />
|
|
1735
1722
|
<Column value="capacity" label="Payload (kg)" />
|
|
@@ -1761,7 +1748,7 @@ export default function ComputedValue() {
|
|
|
1761
1748
|
const { Table, Column } = useTable(LINES, { rowKey: (l) => l.description });
|
|
1762
1749
|
|
|
1763
1750
|
return (
|
|
1764
|
-
<Table
|
|
1751
|
+
<Table aria-label="Invoice lines">
|
|
1765
1752
|
<Column value="description" label="Description" rowHeader />
|
|
1766
1753
|
<Column value="quantity" label="Quantity" />
|
|
1767
1754
|
<Column value="unitPrice" label="Unit price (€)" format={{ decimals: 2 }} />
|
|
@@ -1795,7 +1782,7 @@ export default function Defaults() {
|
|
|
1795
1782
|
const { Table, Column } = useTable(SERVICES, { rowKey: (s) => s.name });
|
|
1796
1783
|
|
|
1797
1784
|
return (
|
|
1798
|
-
<Table
|
|
1785
|
+
<Table aria-label="Defaults per value type">
|
|
1799
1786
|
<Column value="name" label="Text" rowHeader />
|
|
1800
1787
|
<Column value="requests" label="Number" />
|
|
1801
1788
|
<Column value="deployed" label="Point in time" />
|
|
@@ -1832,7 +1819,7 @@ export default function RowHeader() {
|
|
|
1832
1819
|
|
|
1833
1820
|
return (
|
|
1834
1821
|
<Stack gap={3}>
|
|
1835
|
-
<Table selectable
|
|
1822
|
+
<Table selectable aria-label="Incidents">
|
|
1836
1823
|
<Toolbar>
|
|
1837
1824
|
<ColumnMenu />
|
|
1838
1825
|
</Toolbar>
|
|
@@ -1870,9 +1857,9 @@ The `label` is the column header's text, and so what a screen reader says for ev
|
|
|
1870
1857
|
|
|
1871
1858
|
| Prop | Type | Default | Description |
|
|
1872
1859
|
|---|---|---|---|
|
|
1873
|
-
| `value` *required* | `K` | — | A field of the row. Supplies the column's `id` at the same time.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and
|
|
1860
|
+
| `value` *required* | `K` | — | A field of the row. Supplies the column's `id` at the same time.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and 123 more |
|
|
1874
1861
|
| `id` | `string` | — | An id of one's own instead of the field name – for two columns over the same field.<br>Shown in: [Pick a standard format (Formats)](#formats), [Share a column between tables (Presets)](#presets) |
|
|
1875
|
-
| `format` | `FormatFor``<Z[K]>` | — | A standard presentation by name: `"percent"`, `"count"` or `{ decimals }` for numbers, `"date"`, `"time"` or `"dateTime"` for points in time. Alignment, sorting, export and footer stay with the value.<br>Shown in: [Compute a value from the row](#column), [Set wording and formats once (Provider)](#provider), [Pick a standard format (Formats)](#formats) and
|
|
1862
|
+
| `format` | `FormatFor``<Z[K]>` | — | A standard presentation by name: `"percent"`, `"count"` or `{ decimals }` for numbers, `"date"`, `"time"` or `"dateTime"` for points in time. Alignment, sorting, export and footer stay with the value.<br>Shown in: [Compute a value from the row](#column), [Set wording and formats once (Provider)](#provider), [Pick a standard format (Formats)](#formats) and 34 more |
|
|
1876
1863
|
| `filter` | `FilterFor``<Z[K]>` | — | A filter in the column header: `"list"` offers the values that occur, `"range"` two bounds (numbers or points in time), a filter from `columnFilter` asks whatever it asks itself. Its condition stands in the table toolbar.<br>Shown in: [A label wider than its column (Width and pinning)](#width-and-pinning), [Share a column between tables (Presets)](#presets), [Choose from the values that occur (Filter)](#filter) and 11 more |
|
|
1877
1864
|
| `group` | `GroupFor``<Z[K]>` | — | Groups points in time by `"day"`, `"week"`, `"month"` or `"year"`.<br>Shown in: [Share a column between tables (Presets)](#presets), [Group dates by month (Grouping)](#grouping-1) |
|
|
1878
1865
|
| `edit` | `EditFor``<Z[K], Z>` | — | Edits the column's cells in place in grid mode: Enter, F2 or typing starts it, Enter or Tab commits, Escape cancels. The table applies nothing - the edit is reported through the table's `onCellEdit`. From `EditOptions`.<br>Shown in: [Share a column between tables (Presets)](#presets), [Combine grid mode with groups, pinning and many rows (Grid mode)](#grid-mode), [Edit a comments column (Edits)](#edits) and 6 more |
|
|
@@ -1886,8 +1873,8 @@ Also every prop of `ColumnBase`, `ValuePaths` and `AggregateOptions`.
|
|
|
1886
1873
|
|
|
1887
1874
|
| Prop | Type | Default | Description |
|
|
1888
1875
|
|---|---|---|---|
|
|
1889
|
-
| `label` *required* | `string` | — | Names the column in its header, in the column menu and in the header row of the export.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and
|
|
1890
|
-
| `rowHeader` | `boolean` | — | This column names the row: row header cells, never hideable, the column `stickyRowHeader` pins, and the name by which the row's selection, expander and actions are read out. At most one per table.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and
|
|
1876
|
+
| `label` *required* | `string` | — | Names the column in its header, in the column menu and in the header row of the export.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and 123 more |
|
|
1877
|
+
| `rowHeader` | `boolean` | — | This column names the row: row header cells, never hideable, the column `stickyRowHeader` pins, and the name by which the row's selection, expander and actions are read out. At most one per table.<br>Shown in: [Read a value from a field](#column), [Compute a value from the row](#column), [Let the value type decide](#column) and 122 more |
|
|
1891
1878
|
| `numeric` | `boolean` | decided by the first value present | Right-aligned with tabular figures.<br>Shown in: [Share a column between tables (Presets)](#presets) |
|
|
1892
1879
|
| `width` | `number` | the browser's | Initial width in pixels.<br>Shown in: [Fit long values (Formats)](#formats), [Fit what does not fit (Formats)](#formats), [Let people set the width (Width and pinning)](#width-and-pinning) and 15 more |
|
|
1893
1880
|
| `resizable` | `boolean` | — | Shows the drag grip on the header cell.<br>Shown in: [Let people set the width (Width and pinning)](#width-and-pinning), [Pin and size from controls of your own (Width and pinning)](#width-and-pinning), [Share a column between tables (Presets)](#presets) and 1 more |
|
|
@@ -1990,10 +1977,11 @@ type Absent = null | undefined;
|
|
|
1990
1977
|
|
|
1991
1978
|
###### `NumberFormat`
|
|
1992
1979
|
|
|
1993
|
-
|
|
1980
|
+
How a number column is written: `"percent"`, `"count"`, or Intl's number
|
|
1981
|
+
options plus `decimals`; the same shape as core's `NumberFormat`.
|
|
1994
1982
|
|
|
1995
1983
|
```ts
|
|
1996
|
-
type NumberFormat = "percent" | "count" |
|
|
1984
|
+
type NumberFormat = "percent" | "count" | NumberOptions;
|
|
1997
1985
|
```
|
|
1998
1986
|
|
|
1999
1987
|
###### `DateFormat`
|
|
@@ -2045,6 +2033,17 @@ Escape and Tab stay the table's, bubbling up from the field.
|
|
|
2045
2033
|
|---|---|---|---|
|
|
2046
2034
|
| `onChange` *required* | `(value: W \| null) => void` | — | Changes the draft. |
|
|
2047
2035
|
|
|
2036
|
+
###### `NumberOptions`
|
|
2037
|
+
|
|
2038
|
+
From `@umriss-ui/core`.
|
|
2039
|
+
|
|
2040
|
+
Intl's number options, plus `decimals`: the shorthand for the minimum and the
|
|
2041
|
+
maximum fraction digits. An Intl digit option given beside it wins.
|
|
2042
|
+
|
|
2043
|
+
```ts
|
|
2044
|
+
type NumberOptions = Intl.NumberFormatOptions & { decimals?: number };
|
|
2045
|
+
```
|
|
2046
|
+
|
|
2048
2047
|
###### `Displayable`
|
|
2049
2048
|
|
|
2050
2049
|
What can appear as text without `children`.
|
|
@@ -2069,7 +2068,7 @@ A format or a presentation changes what the cell shows and nothing else: sorting
|
|
|
2069
2068
|
|
|
2070
2069
|
##### Pick a standard format
|
|
2071
2070
|
|
|
2072
|
-
`format` names a presentation from the provider's formats; it is typed against the value and keeps sorting, export and totals.
|
|
2071
|
+
`format` names a presentation from the provider's formats; it is typed against the value and keeps sorting, export and totals. The object form is Intl's options: `{ decimals }` for places, `useGrouping: false` for a year, `style: "currency"` for money.
|
|
2073
2072
|
|
|
2074
2073
|
```tsx
|
|
2075
2074
|
import { useTable } from "@umriss-ui/table";
|
|
@@ -2079,24 +2078,28 @@ interface Service {
|
|
|
2079
2078
|
availability: number;
|
|
2080
2079
|
requests: number;
|
|
2081
2080
|
p95: number;
|
|
2081
|
+
since: number;
|
|
2082
|
+
monthly: number;
|
|
2082
2083
|
deployed: Date;
|
|
2083
2084
|
}
|
|
2084
2085
|
|
|
2085
2086
|
const SERVICES: Service[] = [
|
|
2086
|
-
{ name: "Checkout", availability: 0.99921, requests: 1_284_310, p95: 412.37, deployed: new Date(2026, 2, 17, 9, 5) },
|
|
2087
|
-
{ name: "Billing", availability: 0.99958, requests: 402_118, p95: 238.9, deployed: new Date(2026, 2, 16, 16, 40) },
|
|
2088
|
-
{ name: "Search", availability: 0.99803, requests: 2_910_455, p95: 186.02, deployed: new Date(2026, 2, 12, 11, 15) },
|
|
2087
|
+
{ name: "Checkout", availability: 0.99921, requests: 1_284_310, p95: 412.37, since: 2019, monthly: 18400.5, deployed: new Date(2026, 2, 17, 9, 5) },
|
|
2088
|
+
{ name: "Billing", availability: 0.99958, requests: 402_118, p95: 238.9, since: 2021, monthly: 9250, deployed: new Date(2026, 2, 16, 16, 40) },
|
|
2089
|
+
{ name: "Search", availability: 0.99803, requests: 2_910_455, p95: 186.02, since: 2024, monthly: 31200.75, deployed: new Date(2026, 2, 12, 11, 15) },
|
|
2089
2090
|
];
|
|
2090
2091
|
|
|
2091
2092
|
export default function Format() {
|
|
2092
2093
|
const { Table, Column } = useTable(SERVICES, { rowKey: (s) => s.name });
|
|
2093
2094
|
|
|
2094
2095
|
return (
|
|
2095
|
-
<Table
|
|
2096
|
+
<Table aria-label="Services this month">
|
|
2096
2097
|
<Column value="name" label="Service" rowHeader />
|
|
2097
2098
|
<Column value="availability" label="Availability" format="percent" />
|
|
2098
2099
|
<Column value="requests" label="Requests" format="count" />
|
|
2099
2100
|
<Column value="p95" label="p95 (ms)" format={{ decimals: 1 }} />
|
|
2101
|
+
<Column value="since" label="Since" format={{ useGrouping: false }} />
|
|
2102
|
+
<Column value="monthly" label="Cost" format={{ style: "currency", currency: "EUR" }} />
|
|
2100
2103
|
<Column value="deployed" label="Deployed" format="date" />
|
|
2101
2104
|
{/* A second column over the same field names its own id. */}
|
|
2102
2105
|
<Column id="deployedAt" value="deployed" label="At" format="time" />
|
|
@@ -2131,7 +2134,7 @@ export default function Presentation() {
|
|
|
2131
2134
|
const { Table, Column } = useTable(SERVICES, { rowKey: (s) => s.name });
|
|
2132
2135
|
|
|
2133
2136
|
return (
|
|
2134
|
-
<Table
|
|
2137
|
+
<Table aria-label="Services">
|
|
2135
2138
|
<Column value="name" label="Service" rowHeader />
|
|
2136
2139
|
<Column value="state" label="State">
|
|
2137
2140
|
{(state) => <Badge tone={TONE[state]}>{state}</Badge>}
|
|
@@ -2171,7 +2174,7 @@ export default function AbsentValues() {
|
|
|
2171
2174
|
const { Table, Column } = useTable(WORK, { rowKey: (w) => w.id });
|
|
2172
2175
|
|
|
2173
2176
|
return (
|
|
2174
|
-
<Table
|
|
2177
|
+
<Table aria-label="Work items">
|
|
2175
2178
|
<Column value="id" label="Item" rowHeader />
|
|
2176
2179
|
<Column value="name" label="Title" />
|
|
2177
2180
|
<Column value="estimate" label="Estimate" aggregate="avg">
|
|
@@ -2219,7 +2222,7 @@ export default function LongValues() {
|
|
|
2219
2222
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
2220
2223
|
|
|
2221
2224
|
return (
|
|
2222
|
-
<Table
|
|
2225
|
+
<Table aria-label="Shipments with delivery instructions">
|
|
2223
2226
|
<Column value="id" label="Shipment" rowHeader width={120} />
|
|
2224
2227
|
<Column value="customer" label="Customer" width={200} />
|
|
2225
2228
|
<Column value="address" label="Address" width={200} />
|
|
@@ -2254,7 +2257,7 @@ export default function ValuesThatDoNotFit() {
|
|
|
2254
2257
|
const { Table, Column } = useTable(SERVICES, { rowKey: (s) => s.name });
|
|
2255
2258
|
|
|
2256
2259
|
return (
|
|
2257
|
-
<Table
|
|
2260
|
+
<Table aria-label="Services with tags and notes">
|
|
2258
2261
|
<Column value="name" label="Service" rowHeader width={120} />
|
|
2259
2262
|
<Column value="tags" label="Tags" width={170} sortable={false}>
|
|
2260
2263
|
{(tags) =>
|
|
@@ -2289,12 +2292,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
2289
2292
|
|---|---|---|---|
|
|
2290
2293
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
2291
2294
|
|
|
2292
|
-
###### Accessibility
|
|
2293
|
-
|
|
2294
|
-
| Prop | Type | Default | Description |
|
|
2295
|
-
|---|---|---|---|
|
|
2296
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
2297
|
-
|
|
2298
2295
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
2299
2296
|
|
|
2300
2297
|
| Prop | Type | Default | Description |
|
|
@@ -2358,7 +2355,7 @@ export default function Width() {
|
|
|
2358
2355
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
2359
2356
|
|
|
2360
2357
|
return (
|
|
2361
|
-
<Table
|
|
2358
|
+
<Table aria-label="Shipments with a note">
|
|
2362
2359
|
<Column value="id" label="Shipment" rowHeader width={120} />
|
|
2363
2360
|
<Column value="customer" label="Customer" resizable width={180} />
|
|
2364
2361
|
<Column value="note" label="Note" resizable sortable={false} width={160} />
|
|
@@ -2429,7 +2426,7 @@ export default function PinnedBothSides() {
|
|
|
2429
2426
|
return (
|
|
2430
2427
|
<Stack gap={2}>
|
|
2431
2428
|
<style>{STYLE}</style>
|
|
2432
|
-
<Table className="hourly-output" selectable
|
|
2429
|
+
<Table className="hourly-output" selectable aria-label="Output per hour">
|
|
2433
2430
|
<Toolbar>
|
|
2434
2431
|
<ColumnMenu />
|
|
2435
2432
|
</Toolbar>
|
|
@@ -2503,7 +2500,7 @@ export default function StickyParts() {
|
|
|
2503
2500
|
return (
|
|
2504
2501
|
<>
|
|
2505
2502
|
<style>{STYLE}</style>
|
|
2506
|
-
<Table className="week-table" selectable stickyHeader stickyRowHeader maxHeight="300px"
|
|
2503
|
+
<Table className="week-table" selectable stickyHeader stickyRowHeader maxHeight="300px" aria-label="Planned hours per day">
|
|
2507
2504
|
<Column value="team" label="Team" width={96} />
|
|
2508
2505
|
<Column value="name" label="Person" rowHeader width={160} />
|
|
2509
2506
|
{DAYS.map((day, d) => (
|
|
@@ -2575,7 +2572,7 @@ export default function PinAndSizeFromControls() {
|
|
|
2575
2572
|
Note: {t.widths.note} px
|
|
2576
2573
|
</Text>
|
|
2577
2574
|
</Stack>
|
|
2578
|
-
<Table className="delivery-notes"
|
|
2575
|
+
<Table className="delivery-notes" aria-label="Shipments with a note">
|
|
2579
2576
|
<Column value="id" label="Shipment" rowHeader width={120} />
|
|
2580
2577
|
<Column value="customer" label="Customer" width={200} />
|
|
2581
2578
|
<Column value="town" label="Town" width={120} />
|
|
@@ -2611,7 +2608,7 @@ export default function ALabelWiderThanItsColumn() {
|
|
|
2611
2608
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id, defaultSort: { column: "weight", direction: "desc" } });
|
|
2612
2609
|
|
|
2613
2610
|
return (
|
|
2614
|
-
<Table
|
|
2611
|
+
<Table aria-label="Shipments in narrow columns">
|
|
2615
2612
|
<Column value="id" label="Shipment" rowHeader />
|
|
2616
2613
|
<Column value="weight" label="Gross weight in kilograms" width={75} />
|
|
2617
2614
|
<Column value="carrier" label="Carrier responsible for delivery" width={75} filter="list" />
|
|
@@ -2639,18 +2636,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
2639
2636
|
| [`maxHeight`](#first-table) | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it. |
|
|
2640
2637
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
2641
2638
|
|
|
2642
|
-
###### Accessibility
|
|
2643
|
-
|
|
2644
|
-
| Prop | Type | Default | Description |
|
|
2645
|
-
|---|---|---|---|
|
|
2646
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
2647
|
-
|
|
2648
|
-
###### Styling
|
|
2649
|
-
|
|
2650
|
-
| Prop | Type | Default | Description |
|
|
2651
|
-
|---|---|---|---|
|
|
2652
|
-
| [`className`](#first-table) | `string` | — | Classes on the outer frame of the table. |
|
|
2653
|
-
|
|
2654
2639
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
2655
2640
|
|
|
2656
2641
|
| Prop | Type | Default | Description |
|
|
@@ -2771,7 +2756,7 @@ const BUDGETS: Budget[] = [
|
|
|
2771
2756
|
function Invoices() {
|
|
2772
2757
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id });
|
|
2773
2758
|
return (
|
|
2774
|
-
<Table
|
|
2759
|
+
<Table aria-label="Invoices">
|
|
2775
2760
|
<Column value="id" label="Invoice" rowHeader />
|
|
2776
2761
|
<Column {...amount} />
|
|
2777
2762
|
</Table>
|
|
@@ -2781,7 +2766,7 @@ function Invoices() {
|
|
|
2781
2766
|
function Budgets() {
|
|
2782
2767
|
const { Table, Column } = useTable(BUDGETS, { rowKey: (b) => b.costCentre });
|
|
2783
2768
|
return (
|
|
2784
|
-
<Table
|
|
2769
|
+
<Table aria-label="Monthly budgets">
|
|
2785
2770
|
<Column value="costCentre" label="Cost centre" rowHeader />
|
|
2786
2771
|
<Column {...amount} label="Monthly budget (€)" />
|
|
2787
2772
|
</Table>
|
|
@@ -2837,7 +2822,7 @@ export default function Wrapper() {
|
|
|
2837
2822
|
const { Table, Column } = t;
|
|
2838
2823
|
|
|
2839
2824
|
return (
|
|
2840
|
-
<Table
|
|
2825
|
+
<Table aria-label="Incidents">
|
|
2841
2826
|
<Column value="id" label="Incident" rowHeader />
|
|
2842
2827
|
<SeverityColumn of={t} />
|
|
2843
2828
|
</Table>
|
|
@@ -2857,12 +2842,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
2857
2842
|
|---|---|---|---|
|
|
2858
2843
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
2859
2844
|
|
|
2860
|
-
###### Accessibility
|
|
2861
|
-
|
|
2862
|
-
| Prop | Type | Default | Description |
|
|
2863
|
-
|---|---|---|---|
|
|
2864
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
2865
|
-
|
|
2866
2845
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
2867
2846
|
|
|
2868
2847
|
| Prop | Type | Default | Description |
|
|
@@ -2962,7 +2941,7 @@ export default function SortBySeveralColumns() {
|
|
|
2962
2941
|
});
|
|
2963
2942
|
|
|
2964
2943
|
return (
|
|
2965
|
-
<Table
|
|
2944
|
+
<Table aria-label="Incidents, most severe and newest first">
|
|
2966
2945
|
<Column value="id" label="Incident" rowHeader />
|
|
2967
2946
|
<Column value="title" label="Title" />
|
|
2968
2947
|
<Column value="severity" label="Severity" />
|
|
@@ -2999,7 +2978,7 @@ export default function OwnOrdering() {
|
|
|
2999
2978
|
|
|
3000
2979
|
return (
|
|
3001
2980
|
<Stack gap={3}>
|
|
3002
|
-
<Table
|
|
2981
|
+
<Table aria-label="Parcels">
|
|
3003
2982
|
<Toolbar>
|
|
3004
2983
|
<Export onExport={setCsv} />
|
|
3005
2984
|
</Toolbar>
|
|
@@ -3035,12 +3014,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
3035
3014
|
|---|---|---|---|
|
|
3036
3015
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
3037
3016
|
|
|
3038
|
-
###### Accessibility
|
|
3039
|
-
|
|
3040
|
-
| Prop | Type | Default | Description |
|
|
3041
|
-
|---|---|---|---|
|
|
3042
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
3043
|
-
|
|
3044
3017
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
3045
3018
|
|
|
3046
3019
|
| Prop | Type | Default | Description |
|
|
@@ -3088,7 +3061,7 @@ From `ExportProps` — the full table stands on [Export](#export).
|
|
|
3088
3061
|
|
|
3089
3062
|
- In [server mode](#server-mode) the table sorts nothing itself; the sort goes to the server in the request.
|
|
3090
3063
|
|
|
3091
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
3064
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
3092
3065
|
|
|
3093
3066
|
### Search
|
|
3094
3067
|
|
|
@@ -3128,7 +3101,7 @@ export default function FindAPerson() {
|
|
|
3128
3101
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.name });
|
|
3129
3102
|
|
|
3130
3103
|
return (
|
|
3131
|
-
<Table
|
|
3104
|
+
<Table aria-label="People">
|
|
3132
3105
|
<Toolbar>
|
|
3133
3106
|
<Search placeholder="Search people" />
|
|
3134
3107
|
</Toolbar>
|
|
@@ -3165,7 +3138,7 @@ export default function LeaveAColumnOut() {
|
|
|
3165
3138
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.name });
|
|
3166
3139
|
|
|
3167
3140
|
return (
|
|
3168
|
-
<Table
|
|
3141
|
+
<Table aria-label="People by role">
|
|
3169
3142
|
<Toolbar>
|
|
3170
3143
|
<Search placeholder="Search name or role" />
|
|
3171
3144
|
</Toolbar>
|
|
@@ -3204,7 +3177,7 @@ export default function SearchFromACardHeader() {
|
|
|
3204
3177
|
<Card>
|
|
3205
3178
|
<CardHeader divider title="Apps team" actions={<Search of={t} placeholder="Search people" aria-label="Search the Apps team" />} />
|
|
3206
3179
|
<CardBody>
|
|
3207
|
-
<Table
|
|
3180
|
+
<Table aria-label="Apps team">
|
|
3208
3181
|
<Column value="name" label="Name" rowHeader />
|
|
3209
3182
|
<Column value="role" label="Role" />
|
|
3210
3183
|
</Table>
|
|
@@ -3237,7 +3210,7 @@ export default function SearchTakesTheLine() {
|
|
|
3237
3210
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.name });
|
|
3238
3211
|
|
|
3239
3212
|
return (
|
|
3240
|
-
<Table
|
|
3213
|
+
<Table aria-label="Apps team">
|
|
3241
3214
|
<Toolbar>
|
|
3242
3215
|
<Search grow placeholder="Search people" />
|
|
3243
3216
|
<ColumnMenu />
|
|
@@ -3265,10 +3238,12 @@ The keys of [First table](#first-table) and Input apply here.
|
|
|
3265
3238
|
|
|
3266
3239
|
| Prop | Type | Default | Description |
|
|
3267
3240
|
|---|---|---|---|
|
|
3268
|
-
| `placeholder` | `string` | the wording's "Search …" | The placeholder in the field.<br>Shown in: [Find a person](#search), [Leave a column out](#search), [Search from a card header](#search) and
|
|
3241
|
+
| `placeholder` | `string` | the wording's "Search …" | The placeholder in the field.<br>Shown in: [Find a person](#search), [Leave a column out](#search), [Search from a card header](#search) and 24 more |
|
|
3269
3242
|
| `size` | `ToolbarSize`<br>`"sm" \| "md"` | the size of the toolbar it stands in, `"sm"` outside one | The size of the part: `sm` or `md`.<br>Shown in: [Parts outside a toolbar (Toolbar)](#toolbar) |
|
|
3270
3243
|
| `grow` | `boolean` | `false` | Take the rest of the toolbar's line: the parts after the search - column menu, export - stand at its end.<br>Shown in: [Search takes the line](#search) |
|
|
3271
3244
|
| `of` | `TableRef` | — | The table, when the part does not stand inside it: the return value of `useTable`.<br>Shown in: [Search from a card header](#search), [Place it outside the table (Toolbar)](#toolbar), [Parts outside a toolbar (Toolbar)](#toolbar) and 1 more |
|
|
3245
|
+
| `chars` | `number` | — | The width in characters - room for the value; the field adds its own padding and cross. Given, the field is that wide wherever it stands, and never wider than its place. Without it the field fills its place, and is 20 characters wide where the place asks - in a toolbar or a row. From `InputProps`.<br>Shown in: [Search and page from a header of your own (First table)](#first-table) |
|
|
3246
|
+
| `ref` | `Ref<HTMLInputElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
3272
3247
|
|
|
3273
3248
|
###### Accessibility
|
|
3274
3249
|
|
|
@@ -3282,6 +3257,8 @@ The keys of [First table](#first-table) and Input apply here.
|
|
|
3282
3257
|
|---|---|---|---|
|
|
3283
3258
|
| `className` | `string` | — | Classes on the field. |
|
|
3284
3259
|
|
|
3260
|
+
Also takes every attribute of `<input>` – without `size`.
|
|
3261
|
+
|
|
3285
3262
|
##### Types on this page
|
|
3286
3263
|
|
|
3287
3264
|
###### `ToolbarSize`
|
|
@@ -3308,7 +3285,7 @@ type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
|
|
|
3308
3285
|
|
|
3309
3286
|
- In [server mode](#server-mode) the table searches nothing itself; the term goes to the server in the request.
|
|
3310
3287
|
|
|
3311
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
3288
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
3312
3289
|
|
|
3313
3290
|
### Filter
|
|
3314
3291
|
|
|
@@ -3349,7 +3326,7 @@ export default function ListFilter() {
|
|
|
3349
3326
|
const { Table, Column } = useTable(INCIDENTS, { rowKey: (i) => i.id });
|
|
3350
3327
|
|
|
3351
3328
|
return (
|
|
3352
|
-
<Table
|
|
3329
|
+
<Table aria-label="Incidents">
|
|
3353
3330
|
<Column value="id" label="Incident" rowHeader />
|
|
3354
3331
|
<Column value="service" label="Service" filter="list" />
|
|
3355
3332
|
<Column value="assignee" label="Assignee" filter="list" />
|
|
@@ -3385,7 +3362,7 @@ export default function RangeFilter() {
|
|
|
3385
3362
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id });
|
|
3386
3363
|
|
|
3387
3364
|
return (
|
|
3388
|
-
<Table
|
|
3365
|
+
<Table aria-label="Invoices">
|
|
3389
3366
|
<Column value="id" label="Invoice" rowHeader />
|
|
3390
3367
|
<Column value="supplier" label="Supplier" />
|
|
3391
3368
|
<Column value="amount" label="Amount (€)" format={{ decimals: 2 }} filter="range" aggregate="sum" />
|
|
@@ -3433,7 +3410,7 @@ export default function OwnFilterMinimal() {
|
|
|
3433
3410
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id });
|
|
3434
3411
|
|
|
3435
3412
|
return (
|
|
3436
|
-
<Table
|
|
3413
|
+
<Table aria-label="Invoices">
|
|
3437
3414
|
<Column value="id" label="Invoice" rowHeader />
|
|
3438
3415
|
<Column value="supplier" label="Supplier" />
|
|
3439
3416
|
<Column value="due" label="Due" format="date" filter={overdue} />
|
|
@@ -3485,7 +3462,7 @@ export default function OwnFilter() {
|
|
|
3485
3462
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.id });
|
|
3486
3463
|
|
|
3487
3464
|
return (
|
|
3488
|
-
<Table
|
|
3465
|
+
<Table aria-label="Team">
|
|
3489
3466
|
<Column value="name" label="Person" rowHeader />
|
|
3490
3467
|
<Column value="role" label="Role" />
|
|
3491
3468
|
<Column value="capacity" label="Hours a week" filter={workload} />
|
|
@@ -3558,7 +3535,7 @@ export default function ConditionsFromOutside() {
|
|
|
3558
3535
|
</Button>
|
|
3559
3536
|
</Stack>
|
|
3560
3537
|
|
|
3561
|
-
<Table
|
|
3538
|
+
<Table aria-label="Shipments">
|
|
3562
3539
|
<Toolbar>
|
|
3563
3540
|
<Search placeholder="Shipment or customer" />
|
|
3564
3541
|
</Toolbar>
|
|
@@ -3757,7 +3734,7 @@ export default function FieldNoColumnShows() {
|
|
|
3757
3734
|
const { Table, Column } = t;
|
|
3758
3735
|
|
|
3759
3736
|
return (
|
|
3760
|
-
<Table
|
|
3737
|
+
<Table aria-label="Shipments by tour">
|
|
3761
3738
|
<Toolbar>
|
|
3762
3739
|
<Search placeholder="Shipment or customer" />
|
|
3763
3740
|
<MultiSelect
|
|
@@ -3986,7 +3963,7 @@ export default function RowsFromARequest() {
|
|
|
3986
3963
|
const { Table, Column } = t;
|
|
3987
3964
|
|
|
3988
3965
|
return (
|
|
3989
|
-
<Table
|
|
3966
|
+
<Table aria-label="Shipments from a request" loading={isPending}>
|
|
3990
3967
|
<Toolbar>
|
|
3991
3968
|
<MultiSelect<Status>
|
|
3992
3969
|
aria-label="Status"
|
|
@@ -4213,7 +4190,7 @@ export default function QuestionOverSeveralFields() {
|
|
|
4213
4190
|
/>
|
|
4214
4191
|
</Stack>
|
|
4215
4192
|
|
|
4216
|
-
<Table
|
|
4193
|
+
<Table aria-label="Shipments and their windows">
|
|
4217
4194
|
<Toolbar />
|
|
4218
4195
|
<Column value="id" label="Shipment" rowHeader />
|
|
4219
4196
|
<Column value="customer" label="Customer" />
|
|
@@ -4266,7 +4243,7 @@ export default function OfferTheValuesThatOccur() {
|
|
|
4266
4243
|
const { Table, Column } = useTable(PEOPLE, { rowKey: (p) => p.id });
|
|
4267
4244
|
|
|
4268
4245
|
return (
|
|
4269
|
-
<Table
|
|
4246
|
+
<Table aria-label="Team">
|
|
4270
4247
|
<Column value="name" label="Person" rowHeader />
|
|
4271
4248
|
<Column value="role" label="Role" />
|
|
4272
4249
|
<Column value="capacity" label="Hours a week" filter={atLeast} />
|
|
@@ -4335,7 +4312,7 @@ type Absent = null | undefined;
|
|
|
4335
4312
|
- No text filter per column: the search covers text.
|
|
4336
4313
|
- In [server mode](#server-mode) a list filter offers what the application names; the table cannot count values it does not hold.
|
|
4337
4314
|
|
|
4338
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
4315
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
4339
4316
|
|
|
4340
4317
|
### Pre-filter
|
|
4341
4318
|
|
|
@@ -4392,7 +4369,7 @@ export default function PreFilter() {
|
|
|
4392
4369
|
</option>
|
|
4393
4370
|
))}
|
|
4394
4371
|
</Select>
|
|
4395
|
-
<Table
|
|
4372
|
+
<Table aria-label="Shipments of the depot" empty="This depot has no shipments today.">
|
|
4396
4373
|
<Toolbar>
|
|
4397
4374
|
<Search placeholder="Shipment or customer" />
|
|
4398
4375
|
</Toolbar>
|
|
@@ -4423,12 +4400,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
4423
4400
|
| [`empty`](#first-table) | `ReactNode` | — | What stands in the body when there are no rows. Empty because of a filter the table shows itself – with the way back. |
|
|
4424
4401
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
4425
4402
|
|
|
4426
|
-
###### Accessibility
|
|
4427
|
-
|
|
4428
|
-
| Prop | Type | Default | Description |
|
|
4429
|
-
|---|---|---|---|
|
|
4430
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
4431
|
-
|
|
4432
4403
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
4433
4404
|
|
|
4434
4405
|
| Prop | Type | Default | Description |
|
|
@@ -4516,7 +4487,7 @@ const SHIPMENTS: Shipment[] = [
|
|
|
4516
4487
|
export default function OneLevel() {
|
|
4517
4488
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id, defaultGrouping: "tour" });
|
|
4518
4489
|
return (
|
|
4519
|
-
<Table
|
|
4490
|
+
<Table aria-label="Shipments by tour">
|
|
4520
4491
|
<Column value="id" label="Shipment" rowHeader />
|
|
4521
4492
|
<Column value="tour" label="Tour" />
|
|
4522
4493
|
<Column value="customer" label="Customer" />
|
|
@@ -4554,7 +4525,7 @@ const INCIDENTS: Incident[] = [
|
|
|
4554
4525
|
export default function NothingDeclared() {
|
|
4555
4526
|
const { Table, Column } = useTable(INCIDENTS, { rowKey: (i) => i.id });
|
|
4556
4527
|
return (
|
|
4557
|
-
<Table
|
|
4528
|
+
<Table aria-label="Incidents">
|
|
4558
4529
|
<Toolbar>
|
|
4559
4530
|
<ColumnMenu />
|
|
4560
4531
|
</Toolbar>
|
|
@@ -4607,7 +4578,7 @@ export default function TwoLevels() {
|
|
|
4607
4578
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id, defaultGrouping: ["costCentre", "supplier"] });
|
|
4608
4579
|
|
|
4609
4580
|
return (
|
|
4610
|
-
<Table
|
|
4581
|
+
<Table aria-label="Invoices by cost centre and supplier">
|
|
4611
4582
|
<Toolbar>
|
|
4612
4583
|
<ColumnMenu />
|
|
4613
4584
|
</Toolbar>
|
|
@@ -4654,7 +4625,7 @@ const INCIDENTS: Incident[] = [
|
|
|
4654
4625
|
export default function ThreeLevels() {
|
|
4655
4626
|
const { Table, Column } = useTable(INCIDENTS, { rowKey: (i) => i.id, defaultGrouping: ["tier", "team", "service"] });
|
|
4656
4627
|
return (
|
|
4657
|
-
<Table
|
|
4628
|
+
<Table aria-label="Incidents by tier, team and service">
|
|
4658
4629
|
<Column value="service" label="Service" />
|
|
4659
4630
|
<Column value="id" label="Incident" rowHeader />
|
|
4660
4631
|
<Column value="tier" label="Tier" />
|
|
@@ -4693,7 +4664,7 @@ const INVOICES: Invoice[] = [
|
|
|
4693
4664
|
export default function ByMonth() {
|
|
4694
4665
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id, defaultGrouping: "received" });
|
|
4695
4666
|
return (
|
|
4696
|
-
<Table
|
|
4667
|
+
<Table aria-label="Invoices by month received">
|
|
4697
4668
|
<Column value="received" label="Received" format="date" group="month" />
|
|
4698
4669
|
<Column value="id" label="Invoice" rowHeader />
|
|
4699
4670
|
<Column value="supplier" label="Supplier" />
|
|
@@ -4731,7 +4702,7 @@ const band = (amount: number) => (amount < 1000 ? "Small (under €1,000)" : amo
|
|
|
4731
4702
|
export default function InBands() {
|
|
4732
4703
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id, defaultGrouping: "size" });
|
|
4733
4704
|
return (
|
|
4734
|
-
<Table
|
|
4705
|
+
<Table aria-label="Invoices by size">
|
|
4735
4706
|
<Column id="size" value={(i) => i.amount} label="Size" groupValue={band} format={{ decimals: 2 }} />
|
|
4736
4707
|
<Column value="id" label="Invoice" rowHeader />
|
|
4737
4708
|
<Column value="supplier" label="Supplier" />
|
|
@@ -4773,7 +4744,7 @@ const dayOf = (d: Date) => `${d.getDate()} March, ${d.toLocaleDateString("en-GB"
|
|
|
4773
4744
|
export default function KeyThatIsNoColumn() {
|
|
4774
4745
|
const { Table, Column, GroupBy } = useTable(INCIDENTS, { rowKey: (i) => i.id, defaultGrouping: "day" });
|
|
4775
4746
|
return (
|
|
4776
|
-
<Table
|
|
4747
|
+
<Table aria-label="Incidents by day">
|
|
4777
4748
|
<Toolbar>
|
|
4778
4749
|
<ColumnMenu />
|
|
4779
4750
|
</Toolbar>
|
|
@@ -4818,7 +4789,7 @@ export default function GroupsByAggregate() {
|
|
|
4818
4789
|
defaultSort: { column: "weight", direction: "desc" },
|
|
4819
4790
|
});
|
|
4820
4791
|
return (
|
|
4821
|
-
<Table
|
|
4792
|
+
<Table aria-label="Shipments by tour, heaviest first">
|
|
4822
4793
|
<Column value="tour" label="Tour" />
|
|
4823
4794
|
<Column value="id" label="Shipment" rowHeader />
|
|
4824
4795
|
<Column value="customer" label="Customer" />
|
|
@@ -4920,7 +4891,7 @@ export default function Overview() {
|
|
|
4920
4891
|
const { Table, Column } = t;
|
|
4921
4892
|
return (
|
|
4922
4893
|
<Stack gap={3}>
|
|
4923
|
-
<Table
|
|
4894
|
+
<Table aria-label="Budget by cost centre" maxHeight="480px" stickyHeader>
|
|
4924
4895
|
<Column value="centre" label="Cost centre" />
|
|
4925
4896
|
<Column value="month" label="Month" rowHeader />
|
|
4926
4897
|
<Column value="budget" label="Budget (€)" aggregate="sum" />
|
|
@@ -4975,7 +4946,7 @@ export default function WholeGroup() {
|
|
|
4975
4946
|
pageSize: 5,
|
|
4976
4947
|
});
|
|
4977
4948
|
return (
|
|
4978
|
-
<Table
|
|
4949
|
+
<Table aria-label="Shipments to reschedule" selectable>
|
|
4979
4950
|
<Toolbar />
|
|
4980
4951
|
<Pagination pageSizes={[5, 10]} />
|
|
4981
4952
|
<Column value="tour" label="Tour" />
|
|
@@ -5022,7 +4993,7 @@ const INVOICES: Invoice[] = [
|
|
|
5022
4993
|
export default function Paging() {
|
|
5023
4994
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id, defaultGrouping: ["costCentre", "supplier"], pageSize: 5 });
|
|
5024
4995
|
return (
|
|
5025
|
-
<Table
|
|
4996
|
+
<Table aria-label="Invoices, five lines per page">
|
|
5026
4997
|
<Pagination pageSizes={[5, 10, 25]} />
|
|
5027
4998
|
<Column value="supplier" label="Supplier" />
|
|
5028
4999
|
<Column value="id" label="Invoice" rowHeader />
|
|
@@ -5061,7 +5032,7 @@ const SHIPMENTS: Shipment[] = [
|
|
|
5061
5032
|
export default function FilterAndSearch() {
|
|
5062
5033
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id, defaultGrouping: "tour" });
|
|
5063
5034
|
return (
|
|
5064
|
-
<Table
|
|
5035
|
+
<Table aria-label="Shipments by tour, searchable">
|
|
5065
5036
|
<Toolbar>
|
|
5066
5037
|
<Search />
|
|
5067
5038
|
</Toolbar>
|
|
@@ -5102,7 +5073,7 @@ export default function SwitchedOff() {
|
|
|
5102
5073
|
const report = useTable(INCIDENTS, { rowKey: (i) => i.id });
|
|
5103
5074
|
return (
|
|
5104
5075
|
<Stack gap={4}>
|
|
5105
|
-
<list.Table
|
|
5076
|
+
<list.Table aria-label="Incidents, groupable but not by id">
|
|
5106
5077
|
<Toolbar>
|
|
5107
5078
|
<ColumnMenu />
|
|
5108
5079
|
</Toolbar>
|
|
@@ -5111,7 +5082,7 @@ export default function SwitchedOff() {
|
|
|
5111
5082
|
<list.Column value="severity" label="Severity" />
|
|
5112
5083
|
<list.Column value="minutes" label="Minutes to resolve" groupable={false} aggregate="sum" />
|
|
5113
5084
|
</list.Table>
|
|
5114
|
-
<report.Table
|
|
5085
|
+
<report.Table aria-label="Incident report, never grouped" groupable={false}>
|
|
5115
5086
|
<Toolbar>
|
|
5116
5087
|
<ColumnMenu />
|
|
5117
5088
|
</Toolbar>
|
|
@@ -5152,7 +5123,7 @@ const WORK: WorkItem[] = [
|
|
|
5152
5123
|
export default function NoValue() {
|
|
5153
5124
|
const { Table, Column } = useTable(WORK, { rowKey: (w) => w.id, defaultGrouping: "person" });
|
|
5154
5125
|
return (
|
|
5155
|
-
<Table
|
|
5126
|
+
<Table aria-label="Work items by person">
|
|
5156
5127
|
<Column value="person" label="Person" />
|
|
5157
5128
|
<Column value="id" label="Item" rowHeader />
|
|
5158
5129
|
<Column value="name" label="Title" />
|
|
@@ -5190,7 +5161,7 @@ const WORK: WorkItem[] = [
|
|
|
5190
5161
|
export default function GroupOfOne() {
|
|
5191
5162
|
const { Table, Column } = useTable(WORK, { rowKey: (w) => w.id, defaultGrouping: ["team", "person"] });
|
|
5192
5163
|
return (
|
|
5193
|
-
<Table
|
|
5164
|
+
<Table aria-label="Work items by team and person">
|
|
5194
5165
|
<Column value="person" label="Person" />
|
|
5195
5166
|
<Column value="id" label="Item" rowHeader />
|
|
5196
5167
|
<Column value="team" label="Team" />
|
|
@@ -5235,7 +5206,7 @@ const WORK: WorkItem[] = [
|
|
|
5235
5206
|
export default function CompactAndLong() {
|
|
5236
5207
|
const { Table, Column } = useTable(WORK, { rowKey: (w) => w.id, defaultGrouping: ["team", "project", "person"] });
|
|
5237
5208
|
return (
|
|
5238
|
-
<Table
|
|
5209
|
+
<Table aria-label="Backlog, compact" density="compact" selectable>
|
|
5239
5210
|
<Column value="person" label="Person" />
|
|
5240
5211
|
<Column value="id" label="Item" rowHeader />
|
|
5241
5212
|
<Column value="team" label="Team" />
|
|
@@ -5296,7 +5267,7 @@ export default function TwentyThousand() {
|
|
|
5296
5267
|
virtual: true,
|
|
5297
5268
|
});
|
|
5298
5269
|
return (
|
|
5299
|
-
<Table
|
|
5270
|
+
<Table aria-label="Requests" maxHeight="480px" stickyHeader>
|
|
5300
5271
|
<Column value="service" label="Service" />
|
|
5301
5272
|
<Column value="at" label="Received" format="dateTime" aggregate="range" />
|
|
5302
5273
|
<Column value="duration" label="Duration (ms)" format={{ decimals: 0 }} aggregate="avg" />
|
|
@@ -5508,7 +5479,7 @@ export default function DispatchReport() {
|
|
|
5508
5479
|
defaultGrouping: ["depot", "part"],
|
|
5509
5480
|
});
|
|
5510
5481
|
return (
|
|
5511
|
-
<Table
|
|
5482
|
+
<Table aria-label="Deliveries by depot" selectable stickyHeader maxHeight="560px">
|
|
5512
5483
|
<Toolbar>
|
|
5513
5484
|
<Search />
|
|
5514
5485
|
<ColumnMenu />
|
|
@@ -5590,7 +5561,7 @@ export default function GroupAndFoldFromControls() {
|
|
|
5590
5561
|
Fold finished tours
|
|
5591
5562
|
</Button>
|
|
5592
5563
|
</Stack>
|
|
5593
|
-
<Table
|
|
5564
|
+
<Table aria-label="Shipments by tour">
|
|
5594
5565
|
<Column value="id" label="Shipment" rowHeader />
|
|
5595
5566
|
<Column value="tour" label="Tour" />
|
|
5596
5567
|
<Column value="customer" label="Customer" />
|
|
@@ -5623,11 +5594,11 @@ export default function GroupAndFoldFromControls() {
|
|
|
5623
5594
|
|
|
5624
5595
|
#### Known limits
|
|
5625
5596
|
|
|
5626
|
-
- No pivot and no more than three levels ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
5597
|
+
- No pivot and no more than three levels ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
5627
5598
|
- No bar to drag headers onto: grouping is chosen in the column menu.
|
|
5628
5599
|
- No groups in [server mode](#server-mode): they would be made of one page.
|
|
5629
5600
|
|
|
5630
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
5601
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
5631
5602
|
|
|
5632
5603
|
### Tree rows
|
|
5633
5604
|
|
|
@@ -5686,7 +5657,7 @@ const UNITS: Unit[] = [
|
|
|
5686
5657
|
export default function ASmallTree() {
|
|
5687
5658
|
const { Table, Column } = useTable(UNITS, { rowKey: (u) => u.id, childRows: (u) => u.children });
|
|
5688
5659
|
return (
|
|
5689
|
-
<Table
|
|
5660
|
+
<Table aria-label="Organisation">
|
|
5690
5661
|
<Column value="name" label="Unit" rowHeader />
|
|
5691
5662
|
<Column value="headcount" label="Headcount" />
|
|
5692
5663
|
</Table>
|
|
@@ -5763,7 +5734,7 @@ const UNITS: Unit[] = [
|
|
|
5763
5734
|
export default function AnUnevenOrganisation() {
|
|
5764
5735
|
const { Table, Column } = useTable(UNITS, { rowKey: (u) => u.id, childRows: (u) => u.children, defaultBranches: 1 });
|
|
5765
5736
|
return (
|
|
5766
|
-
<Table
|
|
5737
|
+
<Table aria-label="Budget by unit">
|
|
5767
5738
|
<Toolbar>
|
|
5768
5739
|
<Search />
|
|
5769
5740
|
<ColumnMenu />
|
|
@@ -5826,7 +5797,7 @@ const PLACES: Place[] = [
|
|
|
5826
5797
|
export default function RegionsAndPlaces() {
|
|
5827
5798
|
const { Table, Column } = useTable(PLACES, { rowKey: (p) => p.id, childRows: (p) => p.children, defaultBranches: 2 });
|
|
5828
5799
|
return (
|
|
5829
|
-
<Table
|
|
5800
|
+
<Table aria-label="Sites by region">
|
|
5830
5801
|
<Column value="name" label="Region" rowHeader />
|
|
5831
5802
|
<Column value="sites" label="Sites" />
|
|
5832
5803
|
<Column value="postcode" label="Postcode" />
|
|
@@ -5894,7 +5865,7 @@ const TEAMS: Team[] = [
|
|
|
5894
5865
|
function Employees({ team }: { team: Team }) {
|
|
5895
5866
|
const { Table, Column } = useTable(team.employees ?? [], { rowKey: (e) => e.id, defaultSort: { column: "name", direction: "asc" } });
|
|
5896
5867
|
return (
|
|
5897
|
-
<Table
|
|
5868
|
+
<Table aria-label={`Employees of ${team.name}`} density="compact">
|
|
5898
5869
|
<Column value="name" label="Employee" rowHeader />
|
|
5899
5870
|
<Column value="role" label="Role" />
|
|
5900
5871
|
<Column value="since" label="Since" />
|
|
@@ -5906,7 +5877,7 @@ function Employees({ team }: { team: Team }) {
|
|
|
5906
5877
|
export default function EmployeesInTheDetail() {
|
|
5907
5878
|
const { Table, Column, RowDetail } = useTable(TEAMS, { rowKey: (t) => t.id, childRows: (t) => t.children, defaultBranches: 1 });
|
|
5908
5879
|
return (
|
|
5909
|
-
<Table
|
|
5880
|
+
<Table aria-label="Teams">
|
|
5910
5881
|
<Column value="name" label="Team" rowHeader />
|
|
5911
5882
|
<Column value="headcount" label="Headcount" />
|
|
5912
5883
|
<Column value="hours" label="Hours a week" />
|
|
@@ -5994,7 +5965,7 @@ const UNITS: Unit[] = [
|
|
|
5994
5965
|
function Staff({ unit }: { unit: Unit }) {
|
|
5995
5966
|
const { Table, Column } = useTable(unit.staff ?? [], { rowKey: (e) => e.id });
|
|
5996
5967
|
return (
|
|
5997
|
-
<Table
|
|
5968
|
+
<Table aria-label={`Staff of ${unit.name}`} density="compact">
|
|
5998
5969
|
<Column value="name" label="Employee" rowHeader />
|
|
5999
5970
|
<Column value="role" label="Role" />
|
|
6000
5971
|
<Column value="hours" label="Hours" />
|
|
@@ -6005,7 +5976,7 @@ function Staff({ unit }: { unit: Unit }) {
|
|
|
6005
5976
|
export default function OwnStaffAndTeams() {
|
|
6006
5977
|
const { Table, Column, RowDetail } = useTable(UNITS, { rowKey: (u) => u.id, childRows: (u) => u.children, defaultBranches: ["it"] });
|
|
6007
5978
|
return (
|
|
6008
|
-
<Table
|
|
5979
|
+
<Table aria-label="Units with their staff">
|
|
6009
5980
|
<Column value="name" label="Unit" rowHeader />
|
|
6010
5981
|
<Column value="headcount" label="Headcount" />
|
|
6011
5982
|
<Column value="hours" label="Hours a week" />
|
|
@@ -6057,7 +6028,7 @@ export default function FromAFlatList() {
|
|
|
6057
6028
|
const rows = useMemo(() => nest(FLAT), []);
|
|
6058
6029
|
const { Table, Column } = useTable(rows, { rowKey: (c) => c.id, childRows: (c) => c.children, defaultBranches: 1 });
|
|
6059
6030
|
return (
|
|
6060
|
-
<Table
|
|
6031
|
+
<Table aria-label="Cost centres">
|
|
6061
6032
|
<Column value="name" label="Name" rowHeader />
|
|
6062
6033
|
<Column value="id" label="Cost centre" />
|
|
6063
6034
|
<Column value="amount" label="Amount (k€)" />
|
|
@@ -6139,7 +6110,7 @@ export default function OpenBranchesFromControls() {
|
|
|
6139
6110
|
Show it
|
|
6140
6111
|
</Button>
|
|
6141
6112
|
</Stack>
|
|
6142
|
-
<Table
|
|
6113
|
+
<Table aria-label="Budget by unit">
|
|
6143
6114
|
<Column value="name" label="Unit" rowHeader />
|
|
6144
6115
|
<Column value="budget" label="Budget (k€)" />
|
|
6145
6116
|
<Column value="spent" label="Spent (k€)" />
|
|
@@ -6171,12 +6142,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
6171
6142
|
| [`density`](#first-table) | `"regular" \| "compact"` | the density of the `UmrissProvider`, else `"regular"` | How tightly the rows stand. |
|
|
6172
6143
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
6173
6144
|
|
|
6174
|
-
###### Accessibility
|
|
6175
|
-
|
|
6176
|
-
| Prop | Type | Default | Description |
|
|
6177
|
-
|---|---|---|---|
|
|
6178
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
6179
|
-
|
|
6180
6145
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
6181
6146
|
|
|
6182
6147
|
| Prop | Type | Default | Description |
|
|
@@ -6231,7 +6196,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
6231
6196
|
- Not in [server mode](#server-mode), and no branches loaded on demand yet.
|
|
6232
6197
|
- One column set for every level; a level without a value shows it as absent.
|
|
6233
6198
|
|
|
6234
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
6199
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
6235
6200
|
|
|
6236
6201
|
### Aggregate
|
|
6237
6202
|
|
|
@@ -6273,7 +6238,7 @@ const TOURS: Tour[] = [
|
|
|
6273
6238
|
export default function SumAndAverage() {
|
|
6274
6239
|
const { Table, Column } = useTable(TOURS, { rowKey: (t) => t.id });
|
|
6275
6240
|
return (
|
|
6276
|
-
<Table
|
|
6241
|
+
<Table aria-label="Tours">
|
|
6277
6242
|
<Toolbar>
|
|
6278
6243
|
<Search placeholder="Search depot" />
|
|
6279
6244
|
</Toolbar>
|
|
@@ -6313,7 +6278,7 @@ const INCIDENTS: Incident[] = [
|
|
|
6313
6278
|
export default function MinimumAndMaximum() {
|
|
6314
6279
|
const { Table, Column } = useTable(INCIDENTS, { rowKey: (i) => i.id });
|
|
6315
6280
|
return (
|
|
6316
|
-
<Table
|
|
6281
|
+
<Table aria-label="Time to acknowledge">
|
|
6317
6282
|
<Column value="id" label="Incident" rowHeader />
|
|
6318
6283
|
<Column value="toAcknowledge" label="Minutes to acknowledge" aggregate="max" />
|
|
6319
6284
|
<Column value="opened" label="Opened" format="dateTime" aggregate="min" />
|
|
@@ -6353,7 +6318,7 @@ const WORK: WorkItem[] = [
|
|
|
6353
6318
|
export default function RangeOfDates() {
|
|
6354
6319
|
const { Table, Column } = useTable(WORK, { rowKey: (w) => w.id, defaultGrouping: ["project", "person"] });
|
|
6355
6320
|
return (
|
|
6356
|
-
<Table
|
|
6321
|
+
<Table aria-label="Work items by project and person">
|
|
6357
6322
|
<Column value="person" label="Person" />
|
|
6358
6323
|
<Column value="project" label="Project" />
|
|
6359
6324
|
<Column value="id" label="Item" rowHeader />
|
|
@@ -6392,7 +6357,7 @@ const ALERTS: Alert[] = [
|
|
|
6392
6357
|
export default function CountAndDistinct() {
|
|
6393
6358
|
const { Table, Column } = useTable(ALERTS, { rowKey: (a) => a.id });
|
|
6394
6359
|
return (
|
|
6395
|
-
<Table
|
|
6360
|
+
<Table aria-label="Alerts this morning">
|
|
6396
6361
|
<Column value="id" label="Alert" rowHeader aggregate="count" />
|
|
6397
6362
|
<Column value="service" label="Service" aggregate="distinct" />
|
|
6398
6363
|
<Column value="assignee" label="Assignee" aggregate="distinct" />
|
|
@@ -6429,7 +6394,7 @@ const INVOICES: Invoice[] = [
|
|
|
6429
6394
|
export default function ShareBar() {
|
|
6430
6395
|
const { Table, Column } = useTable(INVOICES, { rowKey: (i) => i.id, defaultGrouping: ["costCentre", "supplier"] });
|
|
6431
6396
|
return (
|
|
6432
|
-
<Table
|
|
6397
|
+
<Table aria-label="Invoices by cost centre and supplier">
|
|
6433
6398
|
<Column value="supplier" label="Supplier" />
|
|
6434
6399
|
<Column value="costCentre" label="Cost centre" />
|
|
6435
6400
|
{/* The amount with its bar right beside the groups: after the invoice
|
|
@@ -6469,7 +6434,7 @@ const rate = (t: Tour) => t.failed / t.parcels;
|
|
|
6469
6434
|
export default function NeverAnAverageOfAverages() {
|
|
6470
6435
|
const { Table, Column } = useTable(TOURS, { rowKey: (t) => t.id, defaultGrouping: "depot" });
|
|
6471
6436
|
return (
|
|
6472
|
-
<Table
|
|
6437
|
+
<Table aria-label="Failed deliveries by depot">
|
|
6473
6438
|
<Column value="depot" label="Depot" />
|
|
6474
6439
|
<Column value="id" label="Tour" rowHeader />
|
|
6475
6440
|
<Column value="parcels" label="Parcels" format="count" aggregate="sum" share={false} />
|
|
@@ -6513,7 +6478,7 @@ const LINES: Line[] = [
|
|
|
6513
6478
|
export default function OwnAggregate() {
|
|
6514
6479
|
const { Table, Column } = useTable(LINES, { rowKey: (l) => l.id, defaultGrouping: "costCentre" });
|
|
6515
6480
|
return (
|
|
6516
|
-
<Table
|
|
6481
|
+
<Table aria-label="Invoice lines by cost centre">
|
|
6517
6482
|
<Column value="costCentre" label="Cost centre" />
|
|
6518
6483
|
<Column value="description" label="Description" rowHeader />
|
|
6519
6484
|
<Column value="quantity" label="Quantity" aggregate="sum" />
|
|
@@ -6575,7 +6540,7 @@ const READINGS: Reading[] = [
|
|
|
6575
6540
|
export default function WorstVerdict() {
|
|
6576
6541
|
const { Table, Column, VerdictColumn } = useTable(READINGS, { rowKey: (r) => r.id, defaultGrouping: ["kiln", "zone"] });
|
|
6577
6542
|
return (
|
|
6578
|
-
<Table
|
|
6543
|
+
<Table aria-label="Kiln temperature by zone">
|
|
6579
6544
|
<Column value="zone" label="Zone" />
|
|
6580
6545
|
<Column value="kiln" label="Kiln" />
|
|
6581
6546
|
<Column value="at" label="Hour" rowHeader />
|
|
@@ -6585,6 +6550,62 @@ export default function WorstVerdict() {
|
|
|
6585
6550
|
}
|
|
6586
6551
|
```
|
|
6587
6552
|
|
|
6553
|
+
##### A matrix with row and column totals
|
|
6554
|
+
|
|
6555
|
+
Pivot the facts into rows, then map one computed column per year from the data, `key` by the year. An accessor closes only over what is constant for its column, so the row total is a field of the row, not a function over the years: it stays right when a year arrives.
|
|
6556
|
+
|
|
6557
|
+
```tsx
|
|
6558
|
+
import { useTable } from "@umriss-ui/table";
|
|
6559
|
+
|
|
6560
|
+
interface Fact {
|
|
6561
|
+
plant: string;
|
|
6562
|
+
year: number;
|
|
6563
|
+
tonnes: number;
|
|
6564
|
+
}
|
|
6565
|
+
|
|
6566
|
+
interface Row {
|
|
6567
|
+
plant: string;
|
|
6568
|
+
byYear: Record<number, number>;
|
|
6569
|
+
total: number;
|
|
6570
|
+
}
|
|
6571
|
+
|
|
6572
|
+
const FACTS: Fact[] = [
|
|
6573
|
+
{ plant: "Ulm", year: 2024, tonnes: 410 },
|
|
6574
|
+
{ plant: "Ulm", year: 2025, tonnes: 435 },
|
|
6575
|
+
{ plant: "Ulm", year: 2026, tonnes: 452 },
|
|
6576
|
+
{ plant: "Hof", year: 2024, tonnes: 220 },
|
|
6577
|
+
{ plant: "Hof", year: 2026, tonnes: 205 },
|
|
6578
|
+
{ plant: "Kiel", year: 2025, tonnes: 310 },
|
|
6579
|
+
{ plant: "Kiel", year: 2026, tonnes: 342 },
|
|
6580
|
+
];
|
|
6581
|
+
|
|
6582
|
+
/** One row per plant, its cells keyed by year, its total as a field. */
|
|
6583
|
+
function pivot(facts: Fact[]) {
|
|
6584
|
+
const rows = new Map<string, Row>();
|
|
6585
|
+
for (const f of facts) {
|
|
6586
|
+
const row = rows.get(f.plant) ?? { plant: f.plant, byYear: {}, total: 0 };
|
|
6587
|
+
row.byYear[f.year] = (row.byYear[f.year] ?? 0) + f.tonnes;
|
|
6588
|
+
row.total += f.tonnes;
|
|
6589
|
+
rows.set(f.plant, row);
|
|
6590
|
+
}
|
|
6591
|
+
return { rows: [...rows.values()], years: [...new Set(facts.map((f) => f.year))].sort() };
|
|
6592
|
+
}
|
|
6593
|
+
|
|
6594
|
+
export default function MatrixWithTotals() {
|
|
6595
|
+
const { rows, years } = pivot(FACTS);
|
|
6596
|
+
const { Table, Column } = useTable(rows, { rowKey: (r) => r.plant });
|
|
6597
|
+
return (
|
|
6598
|
+
<Table aria-label="Output by plant and year">
|
|
6599
|
+
<Column value="plant" label="Plant" rowHeader />
|
|
6600
|
+
{years.map((y) => (
|
|
6601
|
+
<Column key={y} id={`y${y}`} label={String(y)} value={(r: Row) => r.byYear[y]} aggregate="sum" format="count" filter="range" />
|
|
6602
|
+
))}
|
|
6603
|
+
<Column value="total" label="Total" aggregate="sum" format="count" />
|
|
6604
|
+
</Table>
|
|
6605
|
+
);
|
|
6606
|
+
}
|
|
6607
|
+
```
|
|
6608
|
+
|
|
6588
6609
|
#### When to use something else
|
|
6589
6610
|
|
|
6590
6611
|
- A key figure outside the table → `Stat` from @umriss-ui/core
|
|
@@ -6599,7 +6620,7 @@ The keys of [First table](#first-table) and Input apply here.
|
|
|
6599
6620
|
|
|
6600
6621
|
| Prop | Type | Default | Description |
|
|
6601
6622
|
|---|---|---|---|
|
|
6602
|
-
| `aggregate` | `AggregateFor``<W, Z>` | — | What the column's values come to: in the footer over the filtered set, in a group's header over its rows. `"sum"`, `"avg"` for numbers; `"min"`, `"max"` for numbers and points in time; `"range"` for points in time; `"count"`, `"distinct"` for every value with a text form - or a function of one's own. Always from the values, never from other aggregates; absent values count towards nothing.<br>Shown in: [Total a column](#aggregate), [Find the extremes](#aggregate), [Show a range of dates](#aggregate) and
|
|
6623
|
+
| `aggregate` | `AggregateFor``<W, Z>` | — | What the column's values come to: in the footer over the filtered set, in a group's header over its rows. `"sum"`, `"avg"` for numbers; `"min"`, `"max"` for numbers and points in time; `"range"` for points in time; `"count"`, `"distinct"` for every value with a text form - or a function of one's own. Always from the values, never from other aggregates; absent values count towards nothing.<br>Shown in: [Total a column](#aggregate), [Find the extremes](#aggregate), [Show a range of dates](#aggregate) and 35 more |
|
|
6603
6624
|
| `share` | `boolean` | — | The share bar in a group's header – the group's share of the filtered set's sum. It stands under the first column with a sum, one per header; `false` passes it on to the next.<br>Shown in: [Show each group's share](#aggregate), [Weight a rate by its rows](#aggregate), [Share a column between tables (Presets)](#presets) and 2 more |
|
|
6604
6625
|
|
|
6605
6626
|
##### Types on this page
|
|
@@ -6670,7 +6691,7 @@ type Displayable = string | number | boolean | Date;
|
|
|
6670
6691
|
|
|
6671
6692
|
- No footer in [server mode](#server-mode): a sum over one page would misstate the server's set.
|
|
6672
6693
|
|
|
6673
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
6694
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
6674
6695
|
|
|
6675
6696
|
## Rows
|
|
6676
6697
|
|
|
@@ -6718,7 +6739,7 @@ export default function Selection() {
|
|
|
6718
6739
|
|
|
6719
6740
|
return (
|
|
6720
6741
|
<Stack gap={3}>
|
|
6721
|
-
<Table selectable
|
|
6742
|
+
<Table selectable aria-label="Shipments">
|
|
6722
6743
|
<Toolbar>
|
|
6723
6744
|
<Search placeholder="Search customer" />
|
|
6724
6745
|
</Toolbar>
|
|
@@ -6776,7 +6797,7 @@ export default function HoldTheSelectionYourself() {
|
|
|
6776
6797
|
{selection.count} of {SHIPMENTS.length} to load
|
|
6777
6798
|
</Text>
|
|
6778
6799
|
</Stack>
|
|
6779
|
-
<Table selectable
|
|
6800
|
+
<Table selectable aria-label="Shipments">
|
|
6780
6801
|
<Column value="id" label="Shipment" rowHeader />
|
|
6781
6802
|
<Column value="customer" label="Customer" />
|
|
6782
6803
|
<Column value="tour" label="Tour" />
|
|
@@ -6786,6 +6807,57 @@ export default function HoldTheSelectionYourself() {
|
|
|
6786
6807
|
}
|
|
6787
6808
|
```
|
|
6788
6809
|
|
|
6810
|
+
##### The current row
|
|
6811
|
+
|
|
6812
|
+
`currentRow` marks the row you hold and `onCurrentRowChange` reports a click on one - or Enter on the focused machine name. The current row and the selection are independent: choosing a row ticks nothing, and ticking moves nothing.
|
|
6813
|
+
|
|
6814
|
+
```tsx
|
|
6815
|
+
import { useState } from "react";
|
|
6816
|
+
import { Stack, Text } from "@umriss-ui/core";
|
|
6817
|
+
import { useTable } from "@umriss-ui/table";
|
|
6818
|
+
|
|
6819
|
+
interface Machine {
|
|
6820
|
+
id: string;
|
|
6821
|
+
name: string;
|
|
6822
|
+
line: string;
|
|
6823
|
+
state: string;
|
|
6824
|
+
}
|
|
6825
|
+
|
|
6826
|
+
const MACHINES: Machine[] = [
|
|
6827
|
+
{ id: "M-101", name: "Press 4", line: "Line 1", state: "Running" },
|
|
6828
|
+
{ id: "M-102", name: "Lathe 2", line: "Line 1", state: "Stopped" },
|
|
6829
|
+
{ id: "M-201", name: "Mill 7", line: "Line 2", state: "Running" },
|
|
6830
|
+
{ id: "M-202", name: "Grinder 1", line: "Line 2", state: "Service" },
|
|
6831
|
+
{ id: "M-301", name: "Welder 3", line: "Line 3", state: "Running" },
|
|
6832
|
+
];
|
|
6833
|
+
|
|
6834
|
+
export default function TheCurrentRow() {
|
|
6835
|
+
const [current, setCurrent] = useState<string | null>("M-201");
|
|
6836
|
+
const { Table, Column } = useTable(MACHINES, { rowKey: (m) => m.id });
|
|
6837
|
+
const machine = MACHINES.find((m) => m.id === current);
|
|
6838
|
+
|
|
6839
|
+
return (
|
|
6840
|
+
<Stack direction="row" gap={4} align="start" wrap>
|
|
6841
|
+
<Table selectable aria-label="Machines" currentRow={current} onCurrentRowChange={(key) => setCurrent(key)}>
|
|
6842
|
+
<Column value="name" label="Machine" rowHeader />
|
|
6843
|
+
<Column value="line" label="Line" />
|
|
6844
|
+
<Column value="state" label="State" />
|
|
6845
|
+
</Table>
|
|
6846
|
+
<Stack gap={1}>
|
|
6847
|
+
<Text size="sm" weight="medium">
|
|
6848
|
+
{machine ? machine.name : "No machine chosen"}
|
|
6849
|
+
</Text>
|
|
6850
|
+
{machine && (
|
|
6851
|
+
<Text size="xs" tone="muted">
|
|
6852
|
+
{machine.id} on {machine.line}, {machine.state.toLowerCase()}.
|
|
6853
|
+
</Text>
|
|
6854
|
+
)}
|
|
6855
|
+
</Stack>
|
|
6856
|
+
</Stack>
|
|
6857
|
+
);
|
|
6858
|
+
}
|
|
6859
|
+
```
|
|
6860
|
+
|
|
6789
6861
|
#### When to use something else
|
|
6790
6862
|
|
|
6791
6863
|
- Actions that act on the ticked rows → RowActions
|
|
@@ -6801,14 +6873,10 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
6801
6873
|
| Prop | Type | Default | Description |
|
|
6802
6874
|
|---|---|---|---|
|
|
6803
6875
|
| [`selectable`](#first-table) | `boolean` | — | Adds the selection column. "All" means: the filtered set. |
|
|
6876
|
+
| [`currentRow`](#first-table) | `string \| null` | — | The key of the row the rest of the screen follows - the table marks it with `aria-current` and an accent bar, apart from the selection. The table keeps no copy: pass the key you hold, `null` for none. |
|
|
6877
|
+
| [`onCurrentRowChange`](#first-table) | `(key: string, row: Z) => void` | — | A primary click on a row, outside its controls - the checkbox, the expander, the actions and any button of yours in a cell - with the row's key and the row. Also called for the row already current, so that you decide whether a second click clears it. By the keyboard: in a native table the content of the row-header cell becomes a button (Enter and Space), so a control of your own in that cell would stand inside it; in grid mode Enter on a cell with nothing to edit or enter. Without a `rowHeader` column the keyboard cannot choose a row. |
|
|
6804
6878
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
6805
6879
|
|
|
6806
|
-
###### Accessibility
|
|
6807
|
-
|
|
6808
|
-
| Prop | Type | Default | Description |
|
|
6809
|
-
|---|---|---|---|
|
|
6810
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
6811
|
-
|
|
6812
6880
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
6813
6881
|
|
|
6814
6882
|
| Prop | Type | Default | Description |
|
|
@@ -6852,7 +6920,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
6852
6920
|
|
|
6853
6921
|
- In [server mode](#server-mode) “select all” selects the page the table holds.
|
|
6854
6922
|
|
|
6855
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
6923
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
6856
6924
|
|
|
6857
6925
|
### Row appearance
|
|
6858
6926
|
|
|
@@ -6893,7 +6961,7 @@ function Services({ caption, density }: { caption: string; density?: "regular" |
|
|
|
6893
6961
|
<Text size="xs" tone="muted">
|
|
6894
6962
|
{caption}
|
|
6895
6963
|
</Text>
|
|
6896
|
-
<Table density={density}
|
|
6964
|
+
<Table density={density} aria-label={`Services, ${caption}`}>
|
|
6897
6965
|
<Column value="name" label="Service" rowHeader />
|
|
6898
6966
|
<Column value="team" label="Team" />
|
|
6899
6967
|
<Column value="p95" label="p95 latency (ms)" />
|
|
@@ -6948,7 +7016,7 @@ export default function StylingRows() {
|
|
|
6948
7016
|
return (
|
|
6949
7017
|
<>
|
|
6950
7018
|
<style>{STYLE}</style>
|
|
6951
|
-
<Table className="invoice-list"
|
|
7019
|
+
<Table className="invoice-list" aria-label="Invoices" rowProps={(i) => ({ "data-overdue": i.overdue ? "" : undefined })}>
|
|
6952
7020
|
<Column value="id" label="Invoice" rowHeader />
|
|
6953
7021
|
<Column value="supplier" label="Supplier" />
|
|
6954
7022
|
<Column value="due" label="Due" format="date" />
|
|
@@ -6985,7 +7053,7 @@ const NONE: Incident[] = [];
|
|
|
6985
7053
|
function Incidents({ rows, label, ...props }: { rows: Incident[]; label: string; loading?: boolean; empty?: ReactNode; search?: string }) {
|
|
6986
7054
|
const { Table, Column } = useTable(rows, { rowKey: (i) => i.id, initialView: props.search ? { search: props.search } : undefined });
|
|
6987
7055
|
return (
|
|
6988
|
-
<Table
|
|
7056
|
+
<Table aria-label={label} loading={props.loading} empty={props.empty}>
|
|
6989
7057
|
{props.search !== undefined && (
|
|
6990
7058
|
<Toolbar>
|
|
6991
7059
|
<Search placeholder="Search incidents" />
|
|
@@ -7053,7 +7121,7 @@ export default function StripesAcrossAWideTable() {
|
|
|
7053
7121
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7054
7122
|
|
|
7055
7123
|
return (
|
|
7056
|
-
<Table striped stickyRowHeader
|
|
7124
|
+
<Table striped stickyRowHeader aria-label="Shipments with their addresses">
|
|
7057
7125
|
<Column value="id" label="Shipment" rowHeader />
|
|
7058
7126
|
<Column value="customer" label="Customer" />
|
|
7059
7127
|
<Column value="street" label="Street" />
|
|
@@ -7091,18 +7159,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
7091
7159
|
| [`rowProps`](#first-table) | `(row: Z) => `[`RowAttributes`](#first-table) | — | Classes and data attributes per row. |
|
|
7092
7160
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
7093
7161
|
|
|
7094
|
-
###### Accessibility
|
|
7095
|
-
|
|
7096
|
-
| Prop | Type | Default | Description |
|
|
7097
|
-
|---|---|---|---|
|
|
7098
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
7099
|
-
|
|
7100
|
-
###### Styling
|
|
7101
|
-
|
|
7102
|
-
| Prop | Type | Default | Description |
|
|
7103
|
-
|---|---|---|---|
|
|
7104
|
-
| [`className`](#first-table) | `string` | — | Classes on the outer frame of the table. |
|
|
7105
|
-
|
|
7106
7162
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
7107
7163
|
|
|
7108
7164
|
| Prop | Type | Default | Description |
|
|
@@ -7187,7 +7243,7 @@ export default function OpenADetail() {
|
|
|
7187
7243
|
const { Table, Column, RowDetail } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7188
7244
|
|
|
7189
7245
|
return (
|
|
7190
|
-
<Table
|
|
7246
|
+
<Table aria-label="Shipments">
|
|
7191
7247
|
<Column value="id" label="Shipment" rowHeader />
|
|
7192
7248
|
<Column value="customer" label="Customer" />
|
|
7193
7249
|
<RowDetail>
|
|
@@ -7229,7 +7285,7 @@ export default function KeepRowsOpen() {
|
|
|
7229
7285
|
const { Table, Column, RowDetail } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7230
7286
|
|
|
7231
7287
|
return (
|
|
7232
|
-
<Table
|
|
7288
|
+
<Table aria-label="Shipments with notes">
|
|
7233
7289
|
<Toolbar>
|
|
7234
7290
|
<Search placeholder="Search customer" />
|
|
7235
7291
|
</Toolbar>
|
|
@@ -7376,7 +7432,7 @@ const time = (t: number) => new Date(t).toLocaleTimeString("en-GB", { hour: "2-d
|
|
|
7376
7432
|
function Stops({ tour }: { tour: Tour }) {
|
|
7377
7433
|
const { Table, Column } = useTable(tour.stops, { rowKey: (s) => s.id });
|
|
7378
7434
|
return (
|
|
7379
|
-
<Table density="compact"
|
|
7435
|
+
<Table density="compact" aria-label={`Stops of ${tour.id}`}>
|
|
7380
7436
|
<Column value="shipment" label="Shipment" rowHeader />
|
|
7381
7437
|
<Column value="customer" label="Customer" />
|
|
7382
7438
|
<Column id="window" label="Window" value={(s) => `${time(s.window[0])}–${time(s.window[1])}`} />
|
|
@@ -7389,7 +7445,7 @@ export default function StopsOfATour() {
|
|
|
7389
7445
|
const { Table, Column, RowDetail } = useTable(TOURS, { rowKey: (t) => t.id });
|
|
7390
7446
|
|
|
7391
7447
|
return (
|
|
7392
|
-
<Table
|
|
7448
|
+
<Table aria-label="Tours">
|
|
7393
7449
|
<Column value="id" label="Tour" rowHeader />
|
|
7394
7450
|
<Column id="driver" label="Driver" value={(t) => DRIVERS.find((d) => d.id === t.driver)?.name ?? t.driver} />
|
|
7395
7451
|
<Column id="stops" label="Stops" value={(t) => t.stops.length} />
|
|
@@ -7443,7 +7499,7 @@ export default function OpenADetailFromOutside() {
|
|
|
7443
7499
|
Close all details
|
|
7444
7500
|
</Button>
|
|
7445
7501
|
</Stack>
|
|
7446
|
-
<Table
|
|
7502
|
+
<Table aria-label="Shipments">
|
|
7447
7503
|
<Column value="id" label="Shipment" rowHeader />
|
|
7448
7504
|
<Column value="customer" label="Customer" />
|
|
7449
7505
|
<Column value="window" label="Window" />
|
|
@@ -7520,7 +7576,7 @@ export default function TwoActions() {
|
|
|
7520
7576
|
|
|
7521
7577
|
return (
|
|
7522
7578
|
<Stack gap={3}>
|
|
7523
|
-
<Table
|
|
7579
|
+
<Table aria-label="Invoices">
|
|
7524
7580
|
<Column value="id" label="Invoice" rowHeader />
|
|
7525
7581
|
<Column value="supplier" label="Supplier" />
|
|
7526
7582
|
<RowActions>
|
|
@@ -7564,7 +7620,7 @@ export default function ActOnASelection() {
|
|
|
7564
7620
|
|
|
7565
7621
|
return (
|
|
7566
7622
|
<Stack gap={3}>
|
|
7567
|
-
<Table selectable
|
|
7623
|
+
<Table selectable aria-label="Invoices awaiting approval">
|
|
7568
7624
|
<Toolbar />
|
|
7569
7625
|
<Column value="id" label="Invoice" rowHeader />
|
|
7570
7626
|
<Column value="supplier" label="Supplier" />
|
|
@@ -7609,7 +7665,7 @@ export default function MoreThanTwo() {
|
|
|
7609
7665
|
|
|
7610
7666
|
return (
|
|
7611
7667
|
<Stack gap={3}>
|
|
7612
|
-
<Table
|
|
7668
|
+
<Table aria-label="Invoices">
|
|
7613
7669
|
<Column value="id" label="Invoice" rowHeader />
|
|
7614
7670
|
<Column value="supplier" label="Supplier" />
|
|
7615
7671
|
<RowActions>
|
|
@@ -7714,7 +7770,7 @@ export default function SearchArrangeAndExport() {
|
|
|
7714
7770
|
|
|
7715
7771
|
return (
|
|
7716
7772
|
<Stack gap={3}>
|
|
7717
|
-
<Table selectable
|
|
7773
|
+
<Table selectable aria-label="Incidents">
|
|
7718
7774
|
<Toolbar>
|
|
7719
7775
|
<Search placeholder="Search incidents" />
|
|
7720
7776
|
<ColumnMenu />
|
|
@@ -7767,7 +7823,7 @@ export default function PlaceItOutside() {
|
|
|
7767
7823
|
<Search of={t} placeholder="Search incidents" />
|
|
7768
7824
|
<Export of={t} filename="incidents.csv" />
|
|
7769
7825
|
</Toolbar>
|
|
7770
|
-
<Table
|
|
7826
|
+
<Table aria-label="Incidents">
|
|
7771
7827
|
<Column value="id" label="Incident" rowHeader />
|
|
7772
7828
|
<Column value="title" label="Title" />
|
|
7773
7829
|
</Table>
|
|
@@ -7822,7 +7878,7 @@ export default function PartsOutsideAToolbar() {
|
|
|
7822
7878
|
<CardBody>
|
|
7823
7879
|
<Stack gap={2}>
|
|
7824
7880
|
<Pagination of={t} pageSizes={[4, 10]} />
|
|
7825
|
-
<Table
|
|
7881
|
+
<Table aria-label="Incidents">
|
|
7826
7882
|
<Column value="id" label="Incident" rowHeader />
|
|
7827
7883
|
<Column value="title" label="Title" />
|
|
7828
7884
|
<Column value="service" label="Service" />
|
|
@@ -7850,9 +7906,10 @@ The parts the table puts in name themselves: the search field “Search table”
|
|
|
7850
7906
|
|
|
7851
7907
|
| Prop | Type | Default | Description |
|
|
7852
7908
|
|---|---|---|---|
|
|
7853
|
-
| `children` | `ReactNode` | — | Search, column menu, export – on the left in the table toolbar, before the conditions.<br>Shown in: [Search, arrange and export](#toolbar), [Place it outside the table](#toolbar), [Set wording and formats once (Provider)](#provider) and
|
|
7909
|
+
| `children` | `ReactNode` | — | Search, column menu, export – on the left in the table toolbar, before the conditions.<br>Shown in: [Search, arrange and export](#toolbar), [Place it outside the table](#toolbar), [Set wording and formats once (Provider)](#provider) and 38 more |
|
|
7854
7910
|
| `size` | `ToolbarSize`<br>`"sm" \| "md"` | `"sm"` | The size of every control the table puts into it - search, column menu, export, "reset", the bulk actions -: `sm` or `md`. A control of one's own takes the same size by its own prop.<br>Shown in: [A larger toolbar (Toolbar controls)](#toolbar-controls), [A dispatcher's bar (Toolbar controls)](#toolbar-controls) |
|
|
7855
7911
|
| `of` | `TableRef` | — | The table, when the table toolbar does not stand inside it. If it then stands behind the table in the tree, it registers only after the first frame – until then a table with a search or a column filter shows its own toolbar. Placed before the table, there is no such change.<br>Shown in: [Place it outside the table](#toolbar), [Review cost centres against budget (Scenarios)](#review-cost-centres-against-budget) |
|
|
7912
|
+
| `ref` | `Ref<HTMLDivElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
7856
7913
|
|
|
7857
7914
|
###### Styling
|
|
7858
7915
|
|
|
@@ -7860,6 +7917,8 @@ The parts the table puts in name themselves: the search field “Search table”
|
|
|
7860
7917
|
|---|---|---|---|
|
|
7861
7918
|
| `className` | `string` | — | Classes on the table toolbar. |
|
|
7862
7919
|
|
|
7920
|
+
Also takes every attribute of `<div>` – without `children`.
|
|
7921
|
+
|
|
7863
7922
|
##### Types on this page
|
|
7864
7923
|
|
|
7865
7924
|
###### `ToolbarSize`
|
|
@@ -8079,7 +8138,7 @@ export default function ControlsAtTheToolbarsSize() {
|
|
|
8079
8138
|
const { Table, Column } = t;
|
|
8080
8139
|
|
|
8081
8140
|
return (
|
|
8082
|
-
<Table
|
|
8141
|
+
<Table aria-label="Shipments">
|
|
8083
8142
|
<Toolbar>
|
|
8084
8143
|
<Search placeholder="Shipment or customer" />
|
|
8085
8144
|
<MultiSelect
|
|
@@ -8283,7 +8342,7 @@ export default function ALargerToolbar() {
|
|
|
8283
8342
|
const { Table, Column } = t;
|
|
8284
8343
|
|
|
8285
8344
|
return (
|
|
8286
|
-
<Table
|
|
8345
|
+
<Table aria-label="Shipments">
|
|
8287
8346
|
<Toolbar size="md">
|
|
8288
8347
|
<Search placeholder="Shipment or customer" />
|
|
8289
8348
|
<MultiSelect
|
|
@@ -8516,7 +8575,7 @@ export default function ADispatchersBar() {
|
|
|
8516
8575
|
</Button>
|
|
8517
8576
|
</Stack>
|
|
8518
8577
|
|
|
8519
|
-
<Table
|
|
8578
|
+
<Table aria-label="Shipments of the day">
|
|
8520
8579
|
<Toolbar size="md">
|
|
8521
8580
|
<Search placeholder="Shipment" />
|
|
8522
8581
|
<MultiSelect
|
|
@@ -8572,9 +8631,10 @@ The keys of [First table](#first-table), Input, [ColumnMenu](#columnmenu), Selec
|
|
|
8572
8631
|
|
|
8573
8632
|
| Prop | Type | Default | Description |
|
|
8574
8633
|
|---|---|---|---|
|
|
8575
|
-
| `children` | `ReactNode` | — | Search, column menu, export – on the left in the table toolbar, before the conditions.<br>Shown in: [Controls of your own at the toolbar's size](#toolbar-controls), [A larger toolbar](#toolbar-controls), [A dispatcher's bar](#toolbar-controls) and
|
|
8634
|
+
| `children` | `ReactNode` | — | Search, column menu, export – on the left in the table toolbar, before the conditions.<br>Shown in: [Controls of your own at the toolbar's size](#toolbar-controls), [A larger toolbar](#toolbar-controls), [A dispatcher's bar](#toolbar-controls) and 38 more |
|
|
8576
8635
|
| `size` | `ToolbarSize`<br>`"sm" \| "md"` | `"sm"` | The size of every control the table puts into it - search, column menu, export, "reset", the bulk actions -: `sm` or `md`. A control of one's own takes the same size by its own prop.<br>Shown in: [A larger toolbar](#toolbar-controls), [A dispatcher's bar](#toolbar-controls) |
|
|
8577
8636
|
| `of` | `TableRef` | — | The table, when the table toolbar does not stand inside it. If it then stands behind the table in the tree, it registers only after the first frame – until then a table with a search or a column filter shows its own toolbar. Placed before the table, there is no such change.<br>Shown in: [Place it outside the table (Toolbar)](#toolbar), [Review cost centres against budget (Scenarios)](#review-cost-centres-against-budget) |
|
|
8637
|
+
| `ref` | `Ref<HTMLDivElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
8578
8638
|
|
|
8579
8639
|
###### Styling
|
|
8580
8640
|
|
|
@@ -8582,6 +8642,8 @@ The keys of [First table](#first-table), Input, [ColumnMenu](#columnmenu), Selec
|
|
|
8582
8642
|
|---|---|---|---|
|
|
8583
8643
|
| `className` | `string` | — | Classes on the table toolbar. |
|
|
8584
8644
|
|
|
8645
|
+
Also takes every attribute of `<div>` – without `children`.
|
|
8646
|
+
|
|
8585
8647
|
##### `RowFilter<Z, B>`
|
|
8586
8648
|
|
|
8587
8649
|
| Prop | Type | Default | Description |
|
|
@@ -8653,7 +8715,7 @@ export default function ShowHideAndArrange() {
|
|
|
8653
8715
|
const { Table, Column } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
8654
8716
|
|
|
8655
8717
|
return (
|
|
8656
|
-
<Table stickyRowHeader
|
|
8718
|
+
<Table stickyRowHeader aria-label="Cost centres in March">
|
|
8657
8719
|
<Toolbar>
|
|
8658
8720
|
<ColumnMenu />
|
|
8659
8721
|
</Toolbar>
|
|
@@ -8692,7 +8754,7 @@ export default function PinAColumn() {
|
|
|
8692
8754
|
const { Table, Column } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
8693
8755
|
|
|
8694
8756
|
return (
|
|
8695
|
-
<Table
|
|
8757
|
+
<Table aria-label="Cost centres by month">
|
|
8696
8758
|
<Toolbar>
|
|
8697
8759
|
<ColumnMenu />
|
|
8698
8760
|
</Toolbar>
|
|
@@ -8722,6 +8784,9 @@ export default function PinAColumn() {
|
|
|
8722
8784
|
|---|---|---|---|
|
|
8723
8785
|
| `size` | `ToolbarSize`<br>`"sm" \| "md"` | the size of the toolbar it stands in, `"sm"` outside one | The size of the part: `sm` or `md`.<br>Shown in: [Parts outside a toolbar (Toolbar)](#toolbar) |
|
|
8724
8786
|
| `of` | `TableRef` | — | The table, when the part does not stand inside it: the return value of `useTable`.<br>Shown in: [Parts outside a toolbar (Toolbar)](#toolbar) |
|
|
8787
|
+
| `ref` | `Ref<HTMLButtonElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
8788
|
+
|
|
8789
|
+
Also takes every attribute of `<button>`.
|
|
8725
8790
|
|
|
8726
8791
|
##### Types on this page
|
|
8727
8792
|
|
|
@@ -8786,7 +8851,7 @@ export default function DownloadAFile() {
|
|
|
8786
8851
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
8787
8852
|
|
|
8788
8853
|
return (
|
|
8789
|
-
<Table
|
|
8854
|
+
<Table aria-label="Shipments">
|
|
8790
8855
|
<Toolbar>
|
|
8791
8856
|
<Search placeholder="Search customer" />
|
|
8792
8857
|
<Export filename="shipments.csv" />
|
|
@@ -8827,7 +8892,7 @@ export default function TakeTheText() {
|
|
|
8827
8892
|
|
|
8828
8893
|
return (
|
|
8829
8894
|
<Stack gap={3}>
|
|
8830
|
-
<Table
|
|
8895
|
+
<Table aria-label="Shipments to export">
|
|
8831
8896
|
<Toolbar>
|
|
8832
8897
|
<Export onExport={setText} />
|
|
8833
8898
|
</Toolbar>
|
|
@@ -8878,7 +8943,7 @@ export default function CopyTheSelection() {
|
|
|
8878
8943
|
{t.selection.count} selected
|
|
8879
8944
|
</Text>
|
|
8880
8945
|
</Stack>
|
|
8881
|
-
<Table selectable
|
|
8946
|
+
<Table selectable aria-label="Shipments to copy">
|
|
8882
8947
|
<Column value="id" label="Shipment" rowHeader />
|
|
8883
8948
|
<Column value="customer" label="Customer" />
|
|
8884
8949
|
<Column value="weight" label="Weight (kg)" />
|
|
@@ -8901,6 +8966,7 @@ The keys of [First table](#first-table), Input and Button apply here.
|
|
|
8901
8966
|
| `filename` | `string` | the wording's "table.csv" | File name of the download.<br>Shown in: [Download a file](#export), [Set wording and formats once (Provider)](#provider), [Search takes the line (Search)](#search) and 6 more |
|
|
8902
8967
|
| `size` | `ToolbarSize`<br>`"sm" \| "md"` | the size of the toolbar it stands in, `"sm"` outside one | The size of the part: `sm` or `md`.<br>Shown in: [Parts outside a toolbar (Toolbar)](#toolbar) |
|
|
8903
8968
|
| `of` | `TableRef` | — | The table, when the part does not stand inside it: the return value of `useTable`.<br>Shown in: [Place it outside the table (Toolbar)](#toolbar), [Parts outside a toolbar (Toolbar)](#toolbar), [Review cost centres against budget (Scenarios)](#review-cost-centres-against-budget) |
|
|
8969
|
+
| `ref` | `Ref<HTMLButtonElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
8904
8970
|
|
|
8905
8971
|
###### Events
|
|
8906
8972
|
|
|
@@ -8908,6 +8974,8 @@ The keys of [First table](#first-table), Input and Button apply here.
|
|
|
8908
8974
|
|---|---|---|---|
|
|
8909
8975
|
| `onExport` | `(text: string) => void` | — | Gets the text instead of triggering a file.<br>Shown in: [Take the text](#export), [Sort and export a value that is an object (Sorting)](#sorting) |
|
|
8910
8976
|
|
|
8977
|
+
Also takes every attribute of `<button>`.
|
|
8978
|
+
|
|
8911
8979
|
##### Types on this page
|
|
8912
8980
|
|
|
8913
8981
|
###### `ToolbarSize`
|
|
@@ -8934,7 +9002,7 @@ type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
|
|
|
8934
9002
|
|
|
8935
9003
|
- One format, CSV: no workbook, PDF or print layout.
|
|
8936
9004
|
|
|
8937
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
9005
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
8938
9006
|
|
|
8939
9007
|
### View
|
|
8940
9008
|
|
|
@@ -8987,7 +9055,7 @@ export default function InitialView() {
|
|
|
8987
9055
|
|
|
8988
9056
|
return (
|
|
8989
9057
|
<Stack gap={3}>
|
|
8990
|
-
<Table
|
|
9058
|
+
<Table aria-label="Invoices">
|
|
8991
9059
|
<Toolbar>
|
|
8992
9060
|
<Search placeholder="Invoice or supplier" />
|
|
8993
9061
|
<ColumnMenu />
|
|
@@ -9034,12 +9102,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9034
9102
|
|---|---|---|---|
|
|
9035
9103
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9036
9104
|
|
|
9037
|
-
###### Accessibility
|
|
9038
|
-
|
|
9039
|
-
| Prop | Type | Default | Description |
|
|
9040
|
-
|---|---|---|---|
|
|
9041
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9042
|
-
|
|
9043
9105
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9044
9106
|
|
|
9045
9107
|
| Prop | Type | Default | Description |
|
|
@@ -9266,7 +9328,7 @@ export default function PageThroughShipments() {
|
|
|
9266
9328
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id, pageSize: 10 });
|
|
9267
9329
|
|
|
9268
9330
|
return (
|
|
9269
|
-
<Table
|
|
9331
|
+
<Table aria-label="Today's shipments">
|
|
9270
9332
|
<Toolbar>
|
|
9271
9333
|
<Search placeholder="Search customer" />
|
|
9272
9334
|
</Toolbar>
|
|
@@ -9301,7 +9363,7 @@ export default function ShowEveryRow() {
|
|
|
9301
9363
|
const { Table, Column } = useTable(DELIVERIES, { rowKey: (d) => d.id, pageSize: 5 });
|
|
9302
9364
|
|
|
9303
9365
|
return (
|
|
9304
|
-
<Table density="compact"
|
|
9366
|
+
<Table density="compact" aria-label="Deliveries without a paging bar">
|
|
9305
9367
|
<Column value="id" label="Shipment" rowHeader />
|
|
9306
9368
|
<Column value="parcels" label="Parcels" />
|
|
9307
9369
|
</Table>
|
|
@@ -9325,6 +9387,7 @@ The keys of [First table](#first-table), Input, Select and Button apply here.
|
|
|
9325
9387
|
|---|---|---|---|
|
|
9326
9388
|
| `pageSizes` | `readonly number[]` | `[10, 25, 50]` | The selectable page sizes.<br>Shown in: [Page through shipments](#pagination), [Search and page from a header of your own (First table)](#first-table), [Restrict which rows a table has (Pre-filter)](#pre-filter) and 4 more |
|
|
9327
9389
|
| `of` | `TableRef` | — | The table, when the part does not stand inside it: the return value of `useTable`.<br>Shown in: [Parts outside a toolbar (Toolbar)](#toolbar) |
|
|
9390
|
+
| `ref` | `Ref<HTMLElement> \| undefined` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [Find a late shipment (Scenarios)](#find-a-late-shipment), [Plan the team's capacity (Scenarios)](#plan-the-teams-capacity) |
|
|
9328
9391
|
|
|
9329
9392
|
###### Styling
|
|
9330
9393
|
|
|
@@ -9332,6 +9395,8 @@ The keys of [First table](#first-table), Input, Select and Button apply here.
|
|
|
9332
9395
|
|---|---|---|---|
|
|
9333
9396
|
| `className` | `string` | — | Classes on the pagination bar. |
|
|
9334
9397
|
|
|
9398
|
+
Also takes every attribute of the rendered element – without `children`.
|
|
9399
|
+
|
|
9335
9400
|
##### Types on this page
|
|
9336
9401
|
|
|
9337
9402
|
###### `TableRef`
|
|
@@ -9350,7 +9415,7 @@ type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
|
|
|
9350
9415
|
|
|
9351
9416
|
- In [server mode](#server-mode) the page goes to the server in the request, and `rowCount` decides how many pages there are.
|
|
9352
9417
|
|
|
9353
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
9418
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
9354
9419
|
|
|
9355
9420
|
### Virtualisation
|
|
9356
9421
|
|
|
@@ -9435,7 +9500,7 @@ export default function Virtualisation() {
|
|
|
9435
9500
|
return (
|
|
9436
9501
|
<Stack gap={2}>
|
|
9437
9502
|
<style>{STYLE}</style>
|
|
9438
|
-
<Table className="request-log" selectable stickyHeader stickyRowHeader maxHeight="340px"
|
|
9503
|
+
<Table className="request-log" selectable stickyHeader stickyRowHeader maxHeight="340px" aria-label="Requests">
|
|
9439
9504
|
<Toolbar>
|
|
9440
9505
|
<Search placeholder="Request or service" />
|
|
9441
9506
|
</Toolbar>
|
|
@@ -9458,6 +9523,139 @@ export default function Virtualisation() {
|
|
|
9458
9523
|
}
|
|
9459
9524
|
```
|
|
9460
9525
|
|
|
9526
|
+
##### Inside a pane of fixed height
|
|
9527
|
+
|
|
9528
|
+
In a parent of definite height the table stays within it: the toolbar keeps its place, the rows scroll, and `virtual` renders only the window - no `maxHeight` needed.
|
|
9529
|
+
|
|
9530
|
+
```tsx
|
|
9531
|
+
import { useMemo } from "react";
|
|
9532
|
+
import { Text } from "@umriss-ui/core";
|
|
9533
|
+
import { Search, Toolbar, useTable } from "@umriss-ui/table";
|
|
9534
|
+
|
|
9535
|
+
interface Stop {
|
|
9536
|
+
id: string;
|
|
9537
|
+
street: string;
|
|
9538
|
+
parcels: number;
|
|
9539
|
+
}
|
|
9540
|
+
|
|
9541
|
+
export default function InAPane() {
|
|
9542
|
+
const stops = useMemo<Stop[]>(
|
|
9543
|
+
() => Array.from({ length: 300 }, (_, i) => ({ id: `ST-${String(i + 1).padStart(4, "0")}`, street: `Dock ${1 + (i % 24)}`, parcels: 1 + ((i * 7) % 9) })),
|
|
9544
|
+
[],
|
|
9545
|
+
);
|
|
9546
|
+
const { Table, Column } = useTable(stops, { rowKey: (s) => s.id, virtual: true });
|
|
9547
|
+
|
|
9548
|
+
return (
|
|
9549
|
+
<div data-pane style={{ height: 320, display: "flex", flexDirection: "column" }}>
|
|
9550
|
+
<div style={{ flex: "1 1 0", minHeight: 0 }}>
|
|
9551
|
+
<Table stickyHeader aria-label="Stops">
|
|
9552
|
+
<Toolbar>
|
|
9553
|
+
<Search placeholder="Stop or dock" />
|
|
9554
|
+
</Toolbar>
|
|
9555
|
+
<Column value="id" label="Stop" rowHeader />
|
|
9556
|
+
<Column value="street" label="Dock" />
|
|
9557
|
+
<Column value="parcels" label="Parcels" />
|
|
9558
|
+
</Table>
|
|
9559
|
+
</div>
|
|
9560
|
+
<Text size="xs" tone="muted">The pane is 320 px tall.</Text>
|
|
9561
|
+
</div>
|
|
9562
|
+
);
|
|
9563
|
+
}
|
|
9564
|
+
```
|
|
9565
|
+
|
|
9566
|
+
##### Another view chooses a row
|
|
9567
|
+
|
|
9568
|
+
When `currentRow` becomes the key of a row outside the window, the table renders that row and scrolls it in. Focus stays where it was.
|
|
9569
|
+
|
|
9570
|
+
```tsx
|
|
9571
|
+
import { useMemo, useState } from "react";
|
|
9572
|
+
import { Button, Stack } from "@umriss-ui/core";
|
|
9573
|
+
import { useTable } from "@umriss-ui/table";
|
|
9574
|
+
|
|
9575
|
+
interface Parcel {
|
|
9576
|
+
id: string;
|
|
9577
|
+
town: string;
|
|
9578
|
+
weight: number;
|
|
9579
|
+
}
|
|
9580
|
+
|
|
9581
|
+
export default function AnotherViewChooses() {
|
|
9582
|
+
const parcels = useMemo<Parcel[]>(
|
|
9583
|
+
() => Array.from({ length: 2000 }, (_, i) => ({ id: `P-${String(i + 1).padStart(4, "0")}`, town: `Town ${1 + ((i * 7) % 40)}`, weight: 1 + ((i * 13) % 30) })),
|
|
9584
|
+
[],
|
|
9585
|
+
);
|
|
9586
|
+
const [current, setCurrent] = useState<string | null>(null);
|
|
9587
|
+
const { Table, Column } = useTable(parcels, { rowKey: (p) => p.id, virtual: true });
|
|
9588
|
+
|
|
9589
|
+
return (
|
|
9590
|
+
<Stack gap={2} align="start">
|
|
9591
|
+
<Stack direction="row" gap={2}>
|
|
9592
|
+
<Button onClick={() => setCurrent("P-1500")}>Choose parcel 1,500</Button>
|
|
9593
|
+
<Button onClick={() => setCurrent("P-0001")}>Choose parcel 1</Button>
|
|
9594
|
+
</Stack>
|
|
9595
|
+
<Table stickyHeader maxHeight="300px" aria-label="Parcels" currentRow={current} onCurrentRowChange={(key) => setCurrent(key)}>
|
|
9596
|
+
<Column value="id" label="Parcel" rowHeader />
|
|
9597
|
+
<Column value="town" label="Town" />
|
|
9598
|
+
<Column value="weight" label="Weight (kg)" />
|
|
9599
|
+
</Table>
|
|
9600
|
+
</Stack>
|
|
9601
|
+
);
|
|
9602
|
+
}
|
|
9603
|
+
```
|
|
9604
|
+
|
|
9605
|
+
##### Bring a row into view from outside
|
|
9606
|
+
|
|
9607
|
+
`scrollToRow(key)` scrolls a row of the table into view from anywhere, also one that is not rendered yet; in grid mode `focusCell(key, column)` puts the focus on one of its cells. Both return `false` for a row the table does not show.
|
|
9608
|
+
|
|
9609
|
+
```tsx
|
|
9610
|
+
import { useMemo, useState } from "react";
|
|
9611
|
+
import { Button, Stack } from "@umriss-ui/core";
|
|
9612
|
+
import { useTable } from "@umriss-ui/table";
|
|
9613
|
+
|
|
9614
|
+
interface Tag {
|
|
9615
|
+
id: string;
|
|
9616
|
+
name: string;
|
|
9617
|
+
value: number;
|
|
9618
|
+
}
|
|
9619
|
+
|
|
9620
|
+
const ALARMS = ["TAG-00042", "TAG-07500", "TAG-10000"];
|
|
9621
|
+
|
|
9622
|
+
export default function ScrollToARow() {
|
|
9623
|
+
const tags = useMemo<Tag[]>(
|
|
9624
|
+
() => Array.from({ length: 10_000 }, (_, i) => ({ id: `TAG-${String(i + 1).padStart(5, "0")}`, name: `Sensor ${i + 1}`, value: (i * 37) % 100 })),
|
|
9625
|
+
[],
|
|
9626
|
+
);
|
|
9627
|
+
const { Table, Column, scrollToRow, focusCell } = useTable(tags, { rowKey: (t) => t.id, virtual: true });
|
|
9628
|
+
const [picked, setPicked] = useState(ALARMS[1]!);
|
|
9629
|
+
|
|
9630
|
+
return (
|
|
9631
|
+
<Stack gap={2}>
|
|
9632
|
+
<Stack direction="row" gap={1}>
|
|
9633
|
+
{ALARMS.map((id) => (
|
|
9634
|
+
<Button
|
|
9635
|
+
key={id}
|
|
9636
|
+
variant="secondary"
|
|
9637
|
+
onClick={() => {
|
|
9638
|
+
setPicked(id);
|
|
9639
|
+
scrollToRow(id);
|
|
9640
|
+
}}
|
|
9641
|
+
>
|
|
9642
|
+
{`Show ${id}`}
|
|
9643
|
+
</Button>
|
|
9644
|
+
))}
|
|
9645
|
+
<Button variant="secondary" onClick={() => focusCell(picked, "value")}>
|
|
9646
|
+
{`Focus the value of ${picked}`}
|
|
9647
|
+
</Button>
|
|
9648
|
+
</Stack>
|
|
9649
|
+
<Table grid maxHeight="240px" stickyHeader aria-label="Tags">
|
|
9650
|
+
<Column value="id" label="Tag" rowHeader />
|
|
9651
|
+
<Column value="name" label="Name" />
|
|
9652
|
+
<Column value="value" label="Value" />
|
|
9653
|
+
</Table>
|
|
9654
|
+
</Stack>
|
|
9655
|
+
);
|
|
9656
|
+
}
|
|
9657
|
+
```
|
|
9658
|
+
|
|
9461
9659
|
#### Keyboard
|
|
9462
9660
|
|
|
9463
9661
|
| Key | Action |
|
|
@@ -9474,20 +9672,11 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9474
9672
|
| [`stickyHeader`](#first-table) | `boolean` | — | Keeps the header row visible while scrolling. |
|
|
9475
9673
|
| [`stickyRowHeader`](#first-table) | `boolean` | — | Keeps the row header column visible while scrolling sideways - the same as `pin="start"` on the row header. |
|
|
9476
9674
|
| [`maxHeight`](#first-table) | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it. |
|
|
9675
|
+
| [`currentRow`](#first-table) | `string \| null` | — | The key of the row the rest of the screen follows - the table marks it with `aria-current` and an accent bar, apart from the selection. The table keeps no copy: pass the key you hold, `null` for none. |
|
|
9676
|
+
| [`onCurrentRowChange`](#first-table) | `(key: string, row: Z) => void` | — | A primary click on a row, outside its controls - the checkbox, the expander, the actions and any button of yours in a cell - with the row's key and the row. Also called for the row already current, so that you decide whether a second click clears it. By the keyboard: in a native table the content of the row-header cell becomes a button (Enter and Space), so a control of your own in that cell would stand inside it; in grid mode Enter on a cell with nothing to edit or enter. Without a `rowHeader` column the keyboard cannot choose a row. |
|
|
9677
|
+
| [`grid`](#first-table) | `boolean` | — | Grid mode: the table is one tab stop, and the arrows walk its cells - Home and End in the row, Ctrl+Home and Ctrl+End to the table's ends, PageUp and PageDown by the rows in view. A cell's own controls are reached with Enter or F2 and left with Escape; a column with `edit` is edited in place. Without it the table stays a native table. |
|
|
9477
9678
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9478
9679
|
|
|
9479
|
-
###### Accessibility
|
|
9480
|
-
|
|
9481
|
-
| Prop | Type | Default | Description |
|
|
9482
|
-
|---|---|---|---|
|
|
9483
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9484
|
-
|
|
9485
|
-
###### Styling
|
|
9486
|
-
|
|
9487
|
-
| Prop | Type | Default | Description |
|
|
9488
|
-
|---|---|---|---|
|
|
9489
|
-
| [`className`](#first-table) | `string` | — | Classes on the outer frame of the table. |
|
|
9490
|
-
|
|
9491
9680
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9492
9681
|
|
|
9493
9682
|
| Prop | Type | Default | Description |
|
|
@@ -9537,7 +9726,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
9537
9726
|
- Paging and virtualisation do not combine; one table does one or the other.
|
|
9538
9727
|
- No loading more rows while scrolling: a table on a server pages ([Server mode](#server-mode)).
|
|
9539
9728
|
|
|
9540
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
9729
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
9541
9730
|
|
|
9542
9731
|
### Benchmark
|
|
9543
9732
|
|
|
@@ -9628,7 +9817,7 @@ function Measured({ rows, mode, onTable }: { rows: Request[]; mode: Mode; tick:
|
|
|
9628
9817
|
onTable(t);
|
|
9629
9818
|
const { Table, Column } = t;
|
|
9630
9819
|
return (
|
|
9631
|
-
<Table maxHeight="340px" stickyHeader
|
|
9820
|
+
<Table maxHeight="340px" stickyHeader aria-label="Requests">
|
|
9632
9821
|
<Toolbar>
|
|
9633
9822
|
<Search placeholder="Request or service" />
|
|
9634
9823
|
</Toolbar>
|
|
@@ -9871,12 +10060,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9871
10060
|
| [`maxHeight`](#first-table) | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it. |
|
|
9872
10061
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9873
10062
|
|
|
9874
|
-
###### Accessibility
|
|
9875
|
-
|
|
9876
|
-
| Prop | Type | Default | Description |
|
|
9877
|
-
|---|---|---|---|
|
|
9878
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9879
|
-
|
|
9880
10063
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9881
10064
|
|
|
9882
10065
|
| Prop | Type | Default | Description |
|
|
@@ -10110,7 +10293,7 @@ export default function OnlyPages() {
|
|
|
10110
10293
|
});
|
|
10111
10294
|
|
|
10112
10295
|
return (
|
|
10113
|
-
<Table
|
|
10296
|
+
<Table aria-label="Shipments on the server">
|
|
10114
10297
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10115
10298
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10116
10299
|
<Column value="weight" label="Weight (kg)" sortable={false} />
|
|
@@ -10310,7 +10493,7 @@ export default function SortAndSearch() {
|
|
|
10310
10493
|
|
|
10311
10494
|
return (
|
|
10312
10495
|
<Stack gap={2}>
|
|
10313
|
-
<Table
|
|
10496
|
+
<Table aria-label="Shipments on the server">
|
|
10314
10497
|
<Toolbar>
|
|
10315
10498
|
<Search placeholder="Shipment or customer" />
|
|
10316
10499
|
</Toolbar>
|
|
@@ -10509,7 +10692,7 @@ export default function ListFilter() {
|
|
|
10509
10692
|
});
|
|
10510
10693
|
|
|
10511
10694
|
return (
|
|
10512
|
-
<Table
|
|
10695
|
+
<Table aria-label="Shipments on the server">
|
|
10513
10696
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10514
10697
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10515
10698
|
<Column value="status" label="Status" filter="list" sortable={false} />
|
|
@@ -10709,7 +10892,7 @@ export default function LoadingAndLateAnswers() {
|
|
|
10709
10892
|
});
|
|
10710
10893
|
|
|
10711
10894
|
return (
|
|
10712
|
-
<Table
|
|
10895
|
+
<Table aria-label="Shipments on the server" loading={loading}>
|
|
10713
10896
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10714
10897
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10715
10898
|
<Column value="weight" label="Weight (kg)" sortable={false} />
|
|
@@ -10831,7 +11014,7 @@ export default function AMillionRowsOnAServer() {
|
|
|
10831
11014
|
|
|
10832
11015
|
return (
|
|
10833
11016
|
<Stack gap={2}>
|
|
10834
|
-
<Table selectable loading={loading}
|
|
11017
|
+
<Table selectable loading={loading} aria-label="Requests on the server">
|
|
10835
11018
|
<Toolbar>
|
|
10836
11019
|
<Search placeholder="Request or service" />
|
|
10837
11020
|
<ColumnMenu />
|
|
@@ -10869,12 +11052,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
10869
11052
|
| [`loading`](#first-table) | `boolean` | — | Shows placeholder rows instead of the rows. |
|
|
10870
11053
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
10871
11054
|
|
|
10872
|
-
###### Accessibility
|
|
10873
|
-
|
|
10874
|
-
| Prop | Type | Default | Description |
|
|
10875
|
-
|---|---|---|---|
|
|
10876
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
10877
|
-
|
|
10878
11055
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
10879
11056
|
|
|
10880
11057
|
| Prop | Type | Default | Description |
|
|
@@ -10922,7 +11099,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
10922
11099
|
- A list filter offers what `filterOptions` names; the table cannot count values it does not hold.
|
|
10923
11100
|
- No loading more rows while scrolling: paging and virtualisation do not combine.
|
|
10924
11101
|
|
|
10925
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
11102
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
10926
11103
|
|
|
10927
11104
|
## Editing
|
|
10928
11105
|
|
|
@@ -10966,7 +11143,7 @@ const SERVICES: Service[] = [
|
|
|
10966
11143
|
export default function GridMode() {
|
|
10967
11144
|
const { Table, Column, RowActions, Action } = useTable(SERVICES, { rowKey: (s) => s.id });
|
|
10968
11145
|
return (
|
|
10969
|
-
<Table grid selectable
|
|
11146
|
+
<Table grid selectable aria-label="Services">
|
|
10970
11147
|
<Column value="name" label="Service" rowHeader />
|
|
10971
11148
|
<Column value="team" label="Team" />
|
|
10972
11149
|
<Column value="requests" label="Requests a minute" format="count" aggregate="sum" />
|
|
@@ -11030,7 +11207,7 @@ export default function TheWholeGrid() {
|
|
|
11030
11207
|
selectable
|
|
11031
11208
|
stickyHeader
|
|
11032
11209
|
maxHeight="360px"
|
|
11033
|
-
|
|
11210
|
+
aria-label="Parcels by depot"
|
|
11034
11211
|
onCellEdit={({ rowKey, columnId, value }) =>
|
|
11035
11212
|
setParcels((all) => all.map((p) => (p.id === rowKey ? { ...p, [columnId]: value } : p)))
|
|
11036
11213
|
}
|
|
@@ -11085,12 +11262,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
11085
11262
|
|---|---|---|---|
|
|
11086
11263
|
| [`onCellEdit`](#first-table) | `(edit: `[`CellEdit`](#first-table)`<Z>) => void` | — | Grid mode: an edit the user committed. The table applies nothing; the cell shows the new value when the rows passed in carry it. |
|
|
11087
11264
|
|
|
11088
|
-
###### Accessibility
|
|
11089
|
-
|
|
11090
|
-
| Prop | Type | Default | Description |
|
|
11091
|
-
|---|---|---|---|
|
|
11092
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
11093
|
-
|
|
11094
11265
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
11095
11266
|
|
|
11096
11267
|
| Prop | Type | Default | Description |
|
|
@@ -11185,7 +11356,7 @@ export default function CommentsColumn() {
|
|
|
11185
11356
|
return (
|
|
11186
11357
|
<Table
|
|
11187
11358
|
grid
|
|
11188
|
-
|
|
11359
|
+
aria-label="Today's tours"
|
|
11189
11360
|
onCellEdit={({ rowKey, value }) => setTours((all) => all.map((t) => (t.id === rowKey ? { ...t, comment: String(value) } : t)))}
|
|
11190
11361
|
>
|
|
11191
11362
|
<Column value="id" label="Tour" rowHeader />
|
|
@@ -11237,7 +11408,7 @@ export default function ValidatedEdits() {
|
|
|
11237
11408
|
|
|
11238
11409
|
return (
|
|
11239
11410
|
<Stack gap={2}>
|
|
11240
|
-
<Table grid
|
|
11411
|
+
<Table grid aria-label="Capacity" onCellEdit={apply}>
|
|
11241
11412
|
<Column value="name" label="Person" rowHeader />
|
|
11242
11413
|
<Column value="team" label="Team" />
|
|
11243
11414
|
<Column
|
|
@@ -11296,7 +11467,7 @@ export default function SaveARowOnPurpose() {
|
|
|
11296
11467
|
|
|
11297
11468
|
return (
|
|
11298
11469
|
<Stack gap={2}>
|
|
11299
|
-
<Table grid editMode="row"
|
|
11470
|
+
<Table grid editMode="row" aria-label="Projects" onRowSave={save}>
|
|
11300
11471
|
<Column value="name" label="Project" rowHeader />
|
|
11301
11472
|
<Column value="phase" label="Phase" edit="select" editOptions={["Discovery", "Build", "Launch"]} width={140} />
|
|
11302
11473
|
<Column value="owner" label="Owner" edit="text" />
|
|
@@ -11342,7 +11513,7 @@ export default function CheckAWholeRow() {
|
|
|
11342
11513
|
<Table
|
|
11343
11514
|
grid
|
|
11344
11515
|
editMode="row"
|
|
11345
|
-
|
|
11516
|
+
aria-label="Price list"
|
|
11346
11517
|
onRowSave={({ rowKey, changes }) => setOffers((all) => all.map((o) => (o.id === rowKey ? { ...o, ...changes } : o)))}
|
|
11347
11518
|
>
|
|
11348
11519
|
<Column value="product" label="Product" rowHeader />
|
|
@@ -11395,7 +11566,7 @@ export default function KeepAList() {
|
|
|
11395
11566
|
<Table
|
|
11396
11567
|
grid
|
|
11397
11568
|
editMode="row"
|
|
11398
|
-
|
|
11569
|
+
aria-label="Stores"
|
|
11399
11570
|
newRow={() => ({ kind: "Spare part", stock: 0 })}
|
|
11400
11571
|
onRowSave={({ rowKey, changes }) => setItems((all) => all.map((i) => (i.id === rowKey ? { ...i, ...changes } : i)))}
|
|
11401
11572
|
onRowAdd={({ values }) => setItems((all) => [...all, { id: `i${++next}`, ...(values as Omit<Item, "id">) }])}
|
|
@@ -11442,7 +11613,7 @@ export default function EditADenseTable() {
|
|
|
11442
11613
|
grid
|
|
11443
11614
|
editMode="row"
|
|
11444
11615
|
density="compact"
|
|
11445
|
-
|
|
11616
|
+
aria-label="Meeting rooms"
|
|
11446
11617
|
onRowSave={({ rowKey, changes }) => setRooms((all) => all.map((r) => (r.id === rowKey ? { ...r, ...changes } : r)))}
|
|
11447
11618
|
onRowDelete={({ rowKey }) => setRooms((all) => all.filter((r) => r.id !== rowKey))}
|
|
11448
11619
|
>
|
|
@@ -11483,12 +11654,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
11483
11654
|
| [`onRowAdd`](#first-table) | `(add: `[`RowAdd`](#first-table)`) => void` | — | Grid mode: puts up a "New row" button - in the table toolbar, or beneath the table without one. It opens an empty Row draft above the rows; saved, it is reported whole. The row appears when the rows passed in carry it. |
|
|
11484
11655
|
| [`onRowDelete`](#first-table) | `(remove: `[`RowDelete`](#first-table)`<Z>) => void` | — | Grid mode: a Delete button on every row, which asks inside its row before the delete is reported. The table removes nothing. |
|
|
11485
11656
|
|
|
11486
|
-
###### Accessibility
|
|
11487
|
-
|
|
11488
|
-
| Prop | Type | Default | Description |
|
|
11489
|
-
|---|---|---|---|
|
|
11490
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
11491
|
-
|
|
11492
11657
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
11493
11658
|
|
|
11494
11659
|
| Prop | Type | Default | Description |
|
|
@@ -11521,9 +11686,9 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
11521
11686
|
|
|
11522
11687
|
#### Known limits
|
|
11523
11688
|
|
|
11524
|
-
- No cell range selection and no undo ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
11689
|
+
- No cell range selection and no undo ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
11525
11690
|
|
|
11526
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
11691
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
11527
11692
|
|
|
11528
11693
|
## Limits and alarms
|
|
11529
11694
|
|
|
@@ -11575,7 +11740,7 @@ export default function ReadLatency() {
|
|
|
11575
11740
|
const { Table, Column, VerdictColumn } = useTable(ENDPOINTS, { rowKey: (e) => e.path });
|
|
11576
11741
|
|
|
11577
11742
|
return (
|
|
11578
|
-
<Table
|
|
11743
|
+
<Table aria-label="Checkout endpoints">
|
|
11579
11744
|
<Column value="path" label="Endpoint" rowHeader />
|
|
11580
11745
|
<VerdictColumn value="p95" label="p95 latency (ms)" limits={OBJECTIVE} />
|
|
11581
11746
|
</Table>
|
|
@@ -11621,7 +11786,7 @@ function Tours({ sortBy }: { sortBy: "verdict" | "value" }) {
|
|
|
11621
11786
|
defaultSort: { column: "load", direction: "desc" },
|
|
11622
11787
|
});
|
|
11623
11788
|
return (
|
|
11624
|
-
<Table
|
|
11789
|
+
<Table aria-label={sortBy === "verdict" ? "Tours by verdict" : "Tours by load"}>
|
|
11625
11790
|
<Column value="tour" label="Tour" rowHeader />
|
|
11626
11791
|
<VerdictColumn value="load" label="Load (%)" limits={LOAD} sortBy={sortBy} />
|
|
11627
11792
|
</Table>
|
|
@@ -11680,7 +11845,7 @@ export default function JudgeAComputedShare() {
|
|
|
11680
11845
|
const { Table, Column, VerdictColumn } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
11681
11846
|
|
|
11682
11847
|
return (
|
|
11683
|
-
<Table
|
|
11848
|
+
<Table aria-label="Budget use in March">
|
|
11684
11849
|
<Column value="name" label="Cost centre" rowHeader />
|
|
11685
11850
|
<Column value="actual" label="Actual (€)" format="count" />
|
|
11686
11851
|
<VerdictColumn id="used" label="Budget used" value={(c) => c.actual / c.budget} limits={SPEND} format="percent" />
|
|
@@ -11737,7 +11902,7 @@ export default function ShowTheWorst() {
|
|
|
11737
11902
|
const { Table, Column, VerdictColumn } = useTable(PEOPLE, { rowKey: (p) => p.id });
|
|
11738
11903
|
|
|
11739
11904
|
return (
|
|
11740
|
-
<Table
|
|
11905
|
+
<Table aria-label="Booked hours this week">
|
|
11741
11906
|
<Column value="name" label="Name" rowHeader />
|
|
11742
11907
|
<Column value="team" label="Team" />
|
|
11743
11908
|
<Column value="capacity" label="Capacity (h)" />
|
|
@@ -11795,10 +11960,11 @@ violated, and it is never the edge of a region.
|
|
|
11795
11960
|
|
|
11796
11961
|
###### `NumberFormat`
|
|
11797
11962
|
|
|
11798
|
-
|
|
11963
|
+
How a number column is written: `"percent"`, `"count"`, or Intl's number
|
|
11964
|
+
options plus `decimals`; the same shape as core's `NumberFormat`.
|
|
11799
11965
|
|
|
11800
11966
|
```ts
|
|
11801
|
-
type NumberFormat = "percent" | "count" |
|
|
11967
|
+
type NumberFormat = "percent" | "count" | NumberOptions;
|
|
11802
11968
|
```
|
|
11803
11969
|
|
|
11804
11970
|
###### `Pin`
|
|
@@ -11825,6 +11991,17 @@ force a `null` on one edge in the one-sided case.
|
|
|
11825
11991
|
| `side` *required* | `Side`<br>`"upper" \| "lower"` | — | <br>Shown in: [Read latency against its objective](#verdictcolumn), [Sort by verdict or by value](#verdictcolumn), [Judge a computed share](#verdictcolumn) and 5 more |
|
|
11826
11992
|
| `severity` *required* | `Severity`<br>`"warning" \| "alarm"` | — | <br>Shown in: [Read latency against its objective](#verdictcolumn), [Sort by verdict or by value](#verdictcolumn), [Judge a computed share](#verdictcolumn) and 5 more |
|
|
11827
11993
|
|
|
11994
|
+
###### `NumberOptions`
|
|
11995
|
+
|
|
11996
|
+
From `@umriss-ui/core`.
|
|
11997
|
+
|
|
11998
|
+
Intl's number options, plus `decimals`: the shorthand for the minimum and the
|
|
11999
|
+
maximum fraction digits. An Intl digit option given beside it wins.
|
|
12000
|
+
|
|
12001
|
+
```ts
|
|
12002
|
+
type NumberOptions = Intl.NumberFormatOptions & { decimals?: number };
|
|
12003
|
+
```
|
|
12004
|
+
|
|
11828
12005
|
###### `Side`
|
|
11829
12006
|
|
|
11830
12007
|
From `@umriss-ui/core`.
|
|
@@ -11852,7 +12029,7 @@ type Severity = "warning" | "alarm";
|
|
|
11852
12029
|
- No list filter: four verdicts are sorted, not filtered.
|
|
11853
12030
|
- It does not judge whether a value is stale; a stale value keeps its verdict ([ADR-0010](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0010-a-stale-value-keeps-its-verdict.md)).
|
|
11854
12031
|
|
|
11855
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.
|
|
12032
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/table-v0.43.0/docs/adr/0032-what-umriss-is-not.md).
|
|
11856
12033
|
|
|
11857
12034
|
## API index
|
|
11858
12035
|
|
|
@@ -12072,13 +12249,9 @@ value.
|
|
|
12072
12249
|
|
|
12073
12250
|
```ts
|
|
12074
12251
|
interface ColumnComponent<Z> {
|
|
12075
|
-
<W extends number | Absent>(
|
|
12076
|
-
props: Computed<Z, W> & { footer: "sum" | "avg"; aggregate?: never; format?: NumberFormat; children?: Presentation<W, Z>; share?: boolean },
|
|
12077
|
-
): ReactNode;
|
|
12078
12252
|
<W extends number | Absent>(
|
|
12079
12253
|
props: Computed<Z, W> & {
|
|
12080
12254
|
aggregate: "sum" | "avg" | "min" | "max" | "count" | "distinct";
|
|
12081
|
-
footer?: never;
|
|
12082
12255
|
share?: boolean;
|
|
12083
12256
|
format?: NumberFormat;
|
|
12084
12257
|
children?: Presentation<W, Z>;
|
|
@@ -12087,7 +12260,6 @@ interface ColumnComponent<Z> {
|
|
|
12087
12260
|
<W extends Date | Absent>(
|
|
12088
12261
|
props: Computed<Z, W> & {
|
|
12089
12262
|
aggregate: "min" | "max" | "range" | "count" | "distinct";
|
|
12090
|
-
footer?: never;
|
|
12091
12263
|
format?: DateFormat;
|
|
12092
12264
|
group?: DatePeriod;
|
|
12093
12265
|
children?: Presentation<W, Z>;
|
|
@@ -12097,7 +12269,6 @@ interface ColumnComponent<Z> {
|
|
|
12097
12269
|
props: Computed<Z, W> & {
|
|
12098
12270
|
group: DatePeriod;
|
|
12099
12271
|
aggregate?: "min" | "max" | "range" | "count" | "distinct";
|
|
12100
|
-
footer?: never;
|
|
12101
12272
|
format?: DateFormat;
|
|
12102
12273
|
children?: Presentation<W, Z>;
|
|
12103
12274
|
},
|
|
@@ -12110,14 +12281,13 @@ interface ColumnComponent<Z> {
|
|
|
12110
12281
|
): ReactNode;
|
|
12111
12282
|
<W>(
|
|
12112
12283
|
props: Computed<Z, W> & {
|
|
12113
|
-
footer?: never;
|
|
12114
12284
|
format?: never;
|
|
12115
12285
|
aggregate?: AggregateFunction<W, Z>;
|
|
12116
12286
|
children: Presentation<W, Z>;
|
|
12117
12287
|
},
|
|
12118
12288
|
): ReactNode;
|
|
12119
12289
|
<W extends Displayable | Absent>(
|
|
12120
|
-
props: Computed<Z, W> & {
|
|
12290
|
+
props: Computed<Z, W> & { format?: never; aggregate?: "count" | "distinct" | AggregateFunction<W, Z>; children?: never },
|
|
12121
12291
|
): ReactNode;
|
|
12122
12292
|
<K extends Field<Z>>(props: FieldColumn<Z, K>): ReactNode;
|
|
12123
12293
|
}
|
|
@@ -12387,10 +12557,11 @@ type NumberField<Z> = {
|
|
|
12387
12557
|
|
|
12388
12558
|
##### `NumberFormat`
|
|
12389
12559
|
|
|
12390
|
-
|
|
12560
|
+
How a number column is written: `"percent"`, `"count"`, or Intl's number
|
|
12561
|
+
options plus `decimals`; the same shape as core's `NumberFormat`.
|
|
12391
12562
|
|
|
12392
12563
|
```ts
|
|
12393
|
-
type NumberFormat = "percent" | "count" |
|
|
12564
|
+
type NumberFormat = "percent" | "count" | NumberOptions;
|
|
12394
12565
|
```
|
|
12395
12566
|
|
|
12396
12567
|
##### `OwnAggregate<Z = never>`
|
|
@@ -12552,13 +12723,15 @@ row. Pass it as `of` to a part that stands outside the table.
|
|
|
12552
12723
|
|
|
12553
12724
|
| Prop | Type | Default | Description |
|
|
12554
12725
|
|---|---|---|---|
|
|
12555
|
-
| `Table` *required* | `(props: `[`TableProps`](#first-table)`<Z>) => ReactNode` | — | <br>Shown in: [A first table (Installation)](#installation), [Show a list of services (First table)](#first-table), [Search and page from a header of your own (First table)](#first-table) and
|
|
12556
|
-
| `Column` *required* | `ColumnComponent``<Z>` | — | <br>Shown in: [A first table (Installation)](#installation), [Show a list of services (First table)](#first-table), [Search and page from a header of your own (First table)](#first-table) and
|
|
12726
|
+
| `Table` *required* | `(props: `[`TableProps`](#first-table)`<Z>) => ReactNode` | — | <br>Shown in: [A first table (Installation)](#installation), [Show a list of services (First table)](#first-table), [Search and page from a header of your own (First table)](#first-table) and 123 more |
|
|
12727
|
+
| `Column` *required* | `ColumnComponent``<Z>` | — | <br>Shown in: [A first table (Installation)](#installation), [Show a list of services (First table)](#first-table), [Search and page from a header of your own (First table)](#first-table) and 123 more |
|
|
12557
12728
|
| `VerdictColumn` *required* | `VerdictColumnComponent``<Z>` | — | <br>Shown in: [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Read a day's deliveries by depot (Grouping)](#grouping-1), [Carry the worst verdict up (Aggregate)](#aggregate) and 5 more |
|
|
12558
12729
|
| `RowDetail` *required* | `(props: `[`RowDetailProps`](#rowdetail)`<Z>) => ReactNode` | — | <br>Shown in: [Keep the header and the names in view (Width and pinning)](#width-and-pinning), [Employees in the detail (Tree rows)](#tree-rows), [Own staff and teams (Tree rows)](#tree-rows) and 5 more |
|
|
12559
12730
|
| `RowActions` *required* | `(props: `[`RowActionsProps`](#rowactions)`) => ReactNode` | — | <br>Shown in: [Name the row (Column)](#column), [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Select a whole group (Grouping)](#grouping-1) and 7 more |
|
|
12560
12731
|
| `Action` *required* | `(props: `[`ActionProps`](#rowactions)`<Z>) => ReactNode` | — | <br>Shown in: [Name the row (Column)](#column), [Pin columns to both sides (Width and pinning)](#width-and-pinning), [Select a whole group (Grouping)](#grouping-1) and 7 more |
|
|
12561
12732
|
| `GroupBy` *required* | `GroupByComponent``<Z>` | — | <br>Shown in: [Group by a value that is no column (Grouping)](#grouping-1), [Group twenty thousand rows (Grouping)](#grouping-1), [Read a day's deliveries by depot (Grouping)](#grouping-1) |
|
|
12733
|
+
| `scrollToRow` *required* | `(key: string) => boolean` | — | Brings the row with this key into view and returns `true`: in a paged table its page, in a scroll area, virtual or not, the scroll to it. `false`, with nothing changed, for a key the table does not have, a row a search, a condition or the `preFilter` hides, a row inside a folded group or branch, or a table not mounted; nothing is unfolded and no filter cleared. In server mode it reaches the rows of the page it holds.<br>Shown in: [Bring a row into view from outside (Virtualisation)](#virtualisation) |
|
|
12734
|
+
| `focusCell` *required* | `(key: string, column: string) => boolean` | — | In grid mode, brings the row into view as `scrollToRow` does, makes the cell of that row and column the Active cell and moves the focus to it. Outside grid mode, for a column the table does not show, and wherever `scrollToRow` returns `false`, it returns `false` and changes nothing.<br>Shown in: [Bring a row into view from outside (Virtualisation)](#virtualisation) |
|
|
12562
12735
|
| `rows` *required* | `readonly Z[]` | — | All the rows passed in, including those the pre-filter does not admit. From `TableSnapshot`.<br>Shown in: [Search and page from a header of your own (First table)](#first-table) |
|
|
12563
12736
|
| `filtered` *required* | `readonly Z[]` | — | The filtered set: what the pre-filter admits and search and filters leave, across all pages. From `TableSnapshot`.<br>Shown in: [Select rows (Selection)](#selection), [Scroll twenty thousand rows (Virtualisation)](#virtualisation) |
|
|
12564
12737
|
| `visible` *required* | `readonly Z[]` | — | What is rendered right now: the page or the window. From `TableSnapshot`.<br>Shown in: [Scroll twenty thousand rows (Virtualisation)](#virtualisation) |
|
|
@@ -12748,3 +12921,16 @@ interface VerdictColumnComponent<Z> {
|
|
|
12748
12921
|
<K extends NumberField<Z>>(props: VerdictBase & { value: K; id?: string }): ReactNode;
|
|
12749
12922
|
}
|
|
12750
12923
|
```
|
|
12924
|
+
|
|
12925
|
+
#### Types on this page
|
|
12926
|
+
|
|
12927
|
+
##### `NumberOptions`
|
|
12928
|
+
|
|
12929
|
+
From `@umriss-ui/core`.
|
|
12930
|
+
|
|
12931
|
+
Intl's number options, plus `decimals`: the shorthand for the minimum and the
|
|
12932
|
+
maximum fraction digits. An Intl digit option given beside it wins.
|
|
12933
|
+
|
|
12934
|
+
```ts
|
|
12935
|
+
type NumberOptions = Intl.NumberFormatOptions & { decimals?: number };
|
|
12936
|
+
```
|