@umriss-ui/table 0.42.0 → 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 +24 -0
- package/README.md +11 -2
- package/dist/index.d.ts +38 -18
- package/dist/table.css +1 -1
- package/dist/table.js +2335 -2195
- package/docs/llms-full.md +429 -292
- package/package.json +3 -3
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` | — |
|
|
1281
|
+
| `ariaLabel` | `string` | — | *Deprecated* since 0.43 - use `aria-label`. Accessible name of the table. |
|
|
1285
1282
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
| Prop | Type | Default | Description |
|
|
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 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.
|
|
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,7 +1857,7 @@ 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
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 |
|
|
@@ -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 />
|
|
@@ -6630,7 +6595,7 @@ export default function MatrixWithTotals() {
|
|
|
6630
6595
|
const { rows, years } = pivot(FACTS);
|
|
6631
6596
|
const { Table, Column } = useTable(rows, { rowKey: (r) => r.plant });
|
|
6632
6597
|
return (
|
|
6633
|
-
<Table
|
|
6598
|
+
<Table aria-label="Output by plant and year">
|
|
6634
6599
|
<Column value="plant" label="Plant" rowHeader />
|
|
6635
6600
|
{years.map((y) => (
|
|
6636
6601
|
<Column key={y} id={`y${y}`} label={String(y)} value={(r: Row) => r.byYear[y]} aggregate="sum" format="count" filter="range" />
|
|
@@ -6726,7 +6691,7 @@ type Displayable = string | number | boolean | Date;
|
|
|
6726
6691
|
|
|
6727
6692
|
- No footer in [server mode](#server-mode): a sum over one page would misstate the server's set.
|
|
6728
6693
|
|
|
6729
|
-
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).
|
|
6730
6695
|
|
|
6731
6696
|
## Rows
|
|
6732
6697
|
|
|
@@ -6774,7 +6739,7 @@ export default function Selection() {
|
|
|
6774
6739
|
|
|
6775
6740
|
return (
|
|
6776
6741
|
<Stack gap={3}>
|
|
6777
|
-
<Table selectable
|
|
6742
|
+
<Table selectable aria-label="Shipments">
|
|
6778
6743
|
<Toolbar>
|
|
6779
6744
|
<Search placeholder="Search customer" />
|
|
6780
6745
|
</Toolbar>
|
|
@@ -6832,7 +6797,7 @@ export default function HoldTheSelectionYourself() {
|
|
|
6832
6797
|
{selection.count} of {SHIPMENTS.length} to load
|
|
6833
6798
|
</Text>
|
|
6834
6799
|
</Stack>
|
|
6835
|
-
<Table selectable
|
|
6800
|
+
<Table selectable aria-label="Shipments">
|
|
6836
6801
|
<Column value="id" label="Shipment" rowHeader />
|
|
6837
6802
|
<Column value="customer" label="Customer" />
|
|
6838
6803
|
<Column value="tour" label="Tour" />
|
|
@@ -6842,6 +6807,57 @@ export default function HoldTheSelectionYourself() {
|
|
|
6842
6807
|
}
|
|
6843
6808
|
```
|
|
6844
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
|
+
|
|
6845
6861
|
#### When to use something else
|
|
6846
6862
|
|
|
6847
6863
|
- Actions that act on the ticked rows → RowActions
|
|
@@ -6857,14 +6873,10 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
6857
6873
|
| Prop | Type | Default | Description |
|
|
6858
6874
|
|---|---|---|---|
|
|
6859
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. |
|
|
6860
6878
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
6861
6879
|
|
|
6862
|
-
###### Accessibility
|
|
6863
|
-
|
|
6864
|
-
| Prop | Type | Default | Description |
|
|
6865
|
-
|---|---|---|---|
|
|
6866
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
6867
|
-
|
|
6868
6880
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
6869
6881
|
|
|
6870
6882
|
| Prop | Type | Default | Description |
|
|
@@ -6908,7 +6920,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
6908
6920
|
|
|
6909
6921
|
- In [server mode](#server-mode) “select all” selects the page the table holds.
|
|
6910
6922
|
|
|
6911
|
-
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).
|
|
6912
6924
|
|
|
6913
6925
|
### Row appearance
|
|
6914
6926
|
|
|
@@ -6949,7 +6961,7 @@ function Services({ caption, density }: { caption: string; density?: "regular" |
|
|
|
6949
6961
|
<Text size="xs" tone="muted">
|
|
6950
6962
|
{caption}
|
|
6951
6963
|
</Text>
|
|
6952
|
-
<Table density={density}
|
|
6964
|
+
<Table density={density} aria-label={`Services, ${caption}`}>
|
|
6953
6965
|
<Column value="name" label="Service" rowHeader />
|
|
6954
6966
|
<Column value="team" label="Team" />
|
|
6955
6967
|
<Column value="p95" label="p95 latency (ms)" />
|
|
@@ -7004,7 +7016,7 @@ export default function StylingRows() {
|
|
|
7004
7016
|
return (
|
|
7005
7017
|
<>
|
|
7006
7018
|
<style>{STYLE}</style>
|
|
7007
|
-
<Table className="invoice-list"
|
|
7019
|
+
<Table className="invoice-list" aria-label="Invoices" rowProps={(i) => ({ "data-overdue": i.overdue ? "" : undefined })}>
|
|
7008
7020
|
<Column value="id" label="Invoice" rowHeader />
|
|
7009
7021
|
<Column value="supplier" label="Supplier" />
|
|
7010
7022
|
<Column value="due" label="Due" format="date" />
|
|
@@ -7041,7 +7053,7 @@ const NONE: Incident[] = [];
|
|
|
7041
7053
|
function Incidents({ rows, label, ...props }: { rows: Incident[]; label: string; loading?: boolean; empty?: ReactNode; search?: string }) {
|
|
7042
7054
|
const { Table, Column } = useTable(rows, { rowKey: (i) => i.id, initialView: props.search ? { search: props.search } : undefined });
|
|
7043
7055
|
return (
|
|
7044
|
-
<Table
|
|
7056
|
+
<Table aria-label={label} loading={props.loading} empty={props.empty}>
|
|
7045
7057
|
{props.search !== undefined && (
|
|
7046
7058
|
<Toolbar>
|
|
7047
7059
|
<Search placeholder="Search incidents" />
|
|
@@ -7109,7 +7121,7 @@ export default function StripesAcrossAWideTable() {
|
|
|
7109
7121
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7110
7122
|
|
|
7111
7123
|
return (
|
|
7112
|
-
<Table striped stickyRowHeader
|
|
7124
|
+
<Table striped stickyRowHeader aria-label="Shipments with their addresses">
|
|
7113
7125
|
<Column value="id" label="Shipment" rowHeader />
|
|
7114
7126
|
<Column value="customer" label="Customer" />
|
|
7115
7127
|
<Column value="street" label="Street" />
|
|
@@ -7147,18 +7159,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
7147
7159
|
| [`rowProps`](#first-table) | `(row: Z) => `[`RowAttributes`](#first-table) | — | Classes and data attributes per row. |
|
|
7148
7160
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
7149
7161
|
|
|
7150
|
-
###### Accessibility
|
|
7151
|
-
|
|
7152
|
-
| Prop | Type | Default | Description |
|
|
7153
|
-
|---|---|---|---|
|
|
7154
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
7155
|
-
|
|
7156
|
-
###### Styling
|
|
7157
|
-
|
|
7158
|
-
| Prop | Type | Default | Description |
|
|
7159
|
-
|---|---|---|---|
|
|
7160
|
-
| [`className`](#first-table) | `string` | — | Classes on the outer frame of the table. |
|
|
7161
|
-
|
|
7162
7162
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
7163
7163
|
|
|
7164
7164
|
| Prop | Type | Default | Description |
|
|
@@ -7243,7 +7243,7 @@ export default function OpenADetail() {
|
|
|
7243
7243
|
const { Table, Column, RowDetail } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7244
7244
|
|
|
7245
7245
|
return (
|
|
7246
|
-
<Table
|
|
7246
|
+
<Table aria-label="Shipments">
|
|
7247
7247
|
<Column value="id" label="Shipment" rowHeader />
|
|
7248
7248
|
<Column value="customer" label="Customer" />
|
|
7249
7249
|
<RowDetail>
|
|
@@ -7285,7 +7285,7 @@ export default function KeepRowsOpen() {
|
|
|
7285
7285
|
const { Table, Column, RowDetail } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
7286
7286
|
|
|
7287
7287
|
return (
|
|
7288
|
-
<Table
|
|
7288
|
+
<Table aria-label="Shipments with notes">
|
|
7289
7289
|
<Toolbar>
|
|
7290
7290
|
<Search placeholder="Search customer" />
|
|
7291
7291
|
</Toolbar>
|
|
@@ -7432,7 +7432,7 @@ const time = (t: number) => new Date(t).toLocaleTimeString("en-GB", { hour: "2-d
|
|
|
7432
7432
|
function Stops({ tour }: { tour: Tour }) {
|
|
7433
7433
|
const { Table, Column } = useTable(tour.stops, { rowKey: (s) => s.id });
|
|
7434
7434
|
return (
|
|
7435
|
-
<Table density="compact"
|
|
7435
|
+
<Table density="compact" aria-label={`Stops of ${tour.id}`}>
|
|
7436
7436
|
<Column value="shipment" label="Shipment" rowHeader />
|
|
7437
7437
|
<Column value="customer" label="Customer" />
|
|
7438
7438
|
<Column id="window" label="Window" value={(s) => `${time(s.window[0])}–${time(s.window[1])}`} />
|
|
@@ -7445,7 +7445,7 @@ export default function StopsOfATour() {
|
|
|
7445
7445
|
const { Table, Column, RowDetail } = useTable(TOURS, { rowKey: (t) => t.id });
|
|
7446
7446
|
|
|
7447
7447
|
return (
|
|
7448
|
-
<Table
|
|
7448
|
+
<Table aria-label="Tours">
|
|
7449
7449
|
<Column value="id" label="Tour" rowHeader />
|
|
7450
7450
|
<Column id="driver" label="Driver" value={(t) => DRIVERS.find((d) => d.id === t.driver)?.name ?? t.driver} />
|
|
7451
7451
|
<Column id="stops" label="Stops" value={(t) => t.stops.length} />
|
|
@@ -7499,7 +7499,7 @@ export default function OpenADetailFromOutside() {
|
|
|
7499
7499
|
Close all details
|
|
7500
7500
|
</Button>
|
|
7501
7501
|
</Stack>
|
|
7502
|
-
<Table
|
|
7502
|
+
<Table aria-label="Shipments">
|
|
7503
7503
|
<Column value="id" label="Shipment" rowHeader />
|
|
7504
7504
|
<Column value="customer" label="Customer" />
|
|
7505
7505
|
<Column value="window" label="Window" />
|
|
@@ -7576,7 +7576,7 @@ export default function TwoActions() {
|
|
|
7576
7576
|
|
|
7577
7577
|
return (
|
|
7578
7578
|
<Stack gap={3}>
|
|
7579
|
-
<Table
|
|
7579
|
+
<Table aria-label="Invoices">
|
|
7580
7580
|
<Column value="id" label="Invoice" rowHeader />
|
|
7581
7581
|
<Column value="supplier" label="Supplier" />
|
|
7582
7582
|
<RowActions>
|
|
@@ -7620,7 +7620,7 @@ export default function ActOnASelection() {
|
|
|
7620
7620
|
|
|
7621
7621
|
return (
|
|
7622
7622
|
<Stack gap={3}>
|
|
7623
|
-
<Table selectable
|
|
7623
|
+
<Table selectable aria-label="Invoices awaiting approval">
|
|
7624
7624
|
<Toolbar />
|
|
7625
7625
|
<Column value="id" label="Invoice" rowHeader />
|
|
7626
7626
|
<Column value="supplier" label="Supplier" />
|
|
@@ -7665,7 +7665,7 @@ export default function MoreThanTwo() {
|
|
|
7665
7665
|
|
|
7666
7666
|
return (
|
|
7667
7667
|
<Stack gap={3}>
|
|
7668
|
-
<Table
|
|
7668
|
+
<Table aria-label="Invoices">
|
|
7669
7669
|
<Column value="id" label="Invoice" rowHeader />
|
|
7670
7670
|
<Column value="supplier" label="Supplier" />
|
|
7671
7671
|
<RowActions>
|
|
@@ -7770,7 +7770,7 @@ export default function SearchArrangeAndExport() {
|
|
|
7770
7770
|
|
|
7771
7771
|
return (
|
|
7772
7772
|
<Stack gap={3}>
|
|
7773
|
-
<Table selectable
|
|
7773
|
+
<Table selectable aria-label="Incidents">
|
|
7774
7774
|
<Toolbar>
|
|
7775
7775
|
<Search placeholder="Search incidents" />
|
|
7776
7776
|
<ColumnMenu />
|
|
@@ -7823,7 +7823,7 @@ export default function PlaceItOutside() {
|
|
|
7823
7823
|
<Search of={t} placeholder="Search incidents" />
|
|
7824
7824
|
<Export of={t} filename="incidents.csv" />
|
|
7825
7825
|
</Toolbar>
|
|
7826
|
-
<Table
|
|
7826
|
+
<Table aria-label="Incidents">
|
|
7827
7827
|
<Column value="id" label="Incident" rowHeader />
|
|
7828
7828
|
<Column value="title" label="Title" />
|
|
7829
7829
|
</Table>
|
|
@@ -7878,7 +7878,7 @@ export default function PartsOutsideAToolbar() {
|
|
|
7878
7878
|
<CardBody>
|
|
7879
7879
|
<Stack gap={2}>
|
|
7880
7880
|
<Pagination of={t} pageSizes={[4, 10]} />
|
|
7881
|
-
<Table
|
|
7881
|
+
<Table aria-label="Incidents">
|
|
7882
7882
|
<Column value="id" label="Incident" rowHeader />
|
|
7883
7883
|
<Column value="title" label="Title" />
|
|
7884
7884
|
<Column value="service" label="Service" />
|
|
@@ -7906,9 +7906,10 @@ The parts the table puts in name themselves: the search field “Search table”
|
|
|
7906
7906
|
|
|
7907
7907
|
| Prop | Type | Default | Description |
|
|
7908
7908
|
|---|---|---|---|
|
|
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
|
|
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 |
|
|
7910
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) |
|
|
7911
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) |
|
|
7912
7913
|
|
|
7913
7914
|
###### Styling
|
|
7914
7915
|
|
|
@@ -7916,6 +7917,8 @@ The parts the table puts in name themselves: the search field “Search table”
|
|
|
7916
7917
|
|---|---|---|---|
|
|
7917
7918
|
| `className` | `string` | — | Classes on the table toolbar. |
|
|
7918
7919
|
|
|
7920
|
+
Also takes every attribute of `<div>` – without `children`.
|
|
7921
|
+
|
|
7919
7922
|
##### Types on this page
|
|
7920
7923
|
|
|
7921
7924
|
###### `ToolbarSize`
|
|
@@ -8135,7 +8138,7 @@ export default function ControlsAtTheToolbarsSize() {
|
|
|
8135
8138
|
const { Table, Column } = t;
|
|
8136
8139
|
|
|
8137
8140
|
return (
|
|
8138
|
-
<Table
|
|
8141
|
+
<Table aria-label="Shipments">
|
|
8139
8142
|
<Toolbar>
|
|
8140
8143
|
<Search placeholder="Shipment or customer" />
|
|
8141
8144
|
<MultiSelect
|
|
@@ -8339,7 +8342,7 @@ export default function ALargerToolbar() {
|
|
|
8339
8342
|
const { Table, Column } = t;
|
|
8340
8343
|
|
|
8341
8344
|
return (
|
|
8342
|
-
<Table
|
|
8345
|
+
<Table aria-label="Shipments">
|
|
8343
8346
|
<Toolbar size="md">
|
|
8344
8347
|
<Search placeholder="Shipment or customer" />
|
|
8345
8348
|
<MultiSelect
|
|
@@ -8572,7 +8575,7 @@ export default function ADispatchersBar() {
|
|
|
8572
8575
|
</Button>
|
|
8573
8576
|
</Stack>
|
|
8574
8577
|
|
|
8575
|
-
<Table
|
|
8578
|
+
<Table aria-label="Shipments of the day">
|
|
8576
8579
|
<Toolbar size="md">
|
|
8577
8580
|
<Search placeholder="Shipment" />
|
|
8578
8581
|
<MultiSelect
|
|
@@ -8628,9 +8631,10 @@ The keys of [First table](#first-table), Input, [ColumnMenu](#columnmenu), Selec
|
|
|
8628
8631
|
|
|
8629
8632
|
| Prop | Type | Default | Description |
|
|
8630
8633
|
|---|---|---|---|
|
|
8631
|
-
| `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 |
|
|
8632
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) |
|
|
8633
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) |
|
|
8634
8638
|
|
|
8635
8639
|
###### Styling
|
|
8636
8640
|
|
|
@@ -8638,6 +8642,8 @@ The keys of [First table](#first-table), Input, [ColumnMenu](#columnmenu), Selec
|
|
|
8638
8642
|
|---|---|---|---|
|
|
8639
8643
|
| `className` | `string` | — | Classes on the table toolbar. |
|
|
8640
8644
|
|
|
8645
|
+
Also takes every attribute of `<div>` – without `children`.
|
|
8646
|
+
|
|
8641
8647
|
##### `RowFilter<Z, B>`
|
|
8642
8648
|
|
|
8643
8649
|
| Prop | Type | Default | Description |
|
|
@@ -8709,7 +8715,7 @@ export default function ShowHideAndArrange() {
|
|
|
8709
8715
|
const { Table, Column } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
8710
8716
|
|
|
8711
8717
|
return (
|
|
8712
|
-
<Table stickyRowHeader
|
|
8718
|
+
<Table stickyRowHeader aria-label="Cost centres in March">
|
|
8713
8719
|
<Toolbar>
|
|
8714
8720
|
<ColumnMenu />
|
|
8715
8721
|
</Toolbar>
|
|
@@ -8748,7 +8754,7 @@ export default function PinAColumn() {
|
|
|
8748
8754
|
const { Table, Column } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
8749
8755
|
|
|
8750
8756
|
return (
|
|
8751
|
-
<Table
|
|
8757
|
+
<Table aria-label="Cost centres by month">
|
|
8752
8758
|
<Toolbar>
|
|
8753
8759
|
<ColumnMenu />
|
|
8754
8760
|
</Toolbar>
|
|
@@ -8778,6 +8784,9 @@ export default function PinAColumn() {
|
|
|
8778
8784
|
|---|---|---|---|
|
|
8779
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) |
|
|
8780
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>`.
|
|
8781
8790
|
|
|
8782
8791
|
##### Types on this page
|
|
8783
8792
|
|
|
@@ -8842,7 +8851,7 @@ export default function DownloadAFile() {
|
|
|
8842
8851
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id });
|
|
8843
8852
|
|
|
8844
8853
|
return (
|
|
8845
|
-
<Table
|
|
8854
|
+
<Table aria-label="Shipments">
|
|
8846
8855
|
<Toolbar>
|
|
8847
8856
|
<Search placeholder="Search customer" />
|
|
8848
8857
|
<Export filename="shipments.csv" />
|
|
@@ -8883,7 +8892,7 @@ export default function TakeTheText() {
|
|
|
8883
8892
|
|
|
8884
8893
|
return (
|
|
8885
8894
|
<Stack gap={3}>
|
|
8886
|
-
<Table
|
|
8895
|
+
<Table aria-label="Shipments to export">
|
|
8887
8896
|
<Toolbar>
|
|
8888
8897
|
<Export onExport={setText} />
|
|
8889
8898
|
</Toolbar>
|
|
@@ -8934,7 +8943,7 @@ export default function CopyTheSelection() {
|
|
|
8934
8943
|
{t.selection.count} selected
|
|
8935
8944
|
</Text>
|
|
8936
8945
|
</Stack>
|
|
8937
|
-
<Table selectable
|
|
8946
|
+
<Table selectable aria-label="Shipments to copy">
|
|
8938
8947
|
<Column value="id" label="Shipment" rowHeader />
|
|
8939
8948
|
<Column value="customer" label="Customer" />
|
|
8940
8949
|
<Column value="weight" label="Weight (kg)" />
|
|
@@ -8957,6 +8966,7 @@ The keys of [First table](#first-table), Input and Button apply here.
|
|
|
8957
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 |
|
|
8958
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) |
|
|
8959
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) |
|
|
8960
8970
|
|
|
8961
8971
|
###### Events
|
|
8962
8972
|
|
|
@@ -8964,6 +8974,8 @@ The keys of [First table](#first-table), Input and Button apply here.
|
|
|
8964
8974
|
|---|---|---|---|
|
|
8965
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) |
|
|
8966
8976
|
|
|
8977
|
+
Also takes every attribute of `<button>`.
|
|
8978
|
+
|
|
8967
8979
|
##### Types on this page
|
|
8968
8980
|
|
|
8969
8981
|
###### `ToolbarSize`
|
|
@@ -8990,7 +9002,7 @@ type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
|
|
|
8990
9002
|
|
|
8991
9003
|
- One format, CSV: no workbook, PDF or print layout.
|
|
8992
9004
|
|
|
8993
|
-
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).
|
|
8994
9006
|
|
|
8995
9007
|
### View
|
|
8996
9008
|
|
|
@@ -9043,7 +9055,7 @@ export default function InitialView() {
|
|
|
9043
9055
|
|
|
9044
9056
|
return (
|
|
9045
9057
|
<Stack gap={3}>
|
|
9046
|
-
<Table
|
|
9058
|
+
<Table aria-label="Invoices">
|
|
9047
9059
|
<Toolbar>
|
|
9048
9060
|
<Search placeholder="Invoice or supplier" />
|
|
9049
9061
|
<ColumnMenu />
|
|
@@ -9090,12 +9102,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9090
9102
|
|---|---|---|---|
|
|
9091
9103
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9092
9104
|
|
|
9093
|
-
###### Accessibility
|
|
9094
|
-
|
|
9095
|
-
| Prop | Type | Default | Description |
|
|
9096
|
-
|---|---|---|---|
|
|
9097
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9098
|
-
|
|
9099
9105
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9100
9106
|
|
|
9101
9107
|
| Prop | Type | Default | Description |
|
|
@@ -9322,7 +9328,7 @@ export default function PageThroughShipments() {
|
|
|
9322
9328
|
const { Table, Column } = useTable(SHIPMENTS, { rowKey: (s) => s.id, pageSize: 10 });
|
|
9323
9329
|
|
|
9324
9330
|
return (
|
|
9325
|
-
<Table
|
|
9331
|
+
<Table aria-label="Today's shipments">
|
|
9326
9332
|
<Toolbar>
|
|
9327
9333
|
<Search placeholder="Search customer" />
|
|
9328
9334
|
</Toolbar>
|
|
@@ -9357,7 +9363,7 @@ export default function ShowEveryRow() {
|
|
|
9357
9363
|
const { Table, Column } = useTable(DELIVERIES, { rowKey: (d) => d.id, pageSize: 5 });
|
|
9358
9364
|
|
|
9359
9365
|
return (
|
|
9360
|
-
<Table density="compact"
|
|
9366
|
+
<Table density="compact" aria-label="Deliveries without a paging bar">
|
|
9361
9367
|
<Column value="id" label="Shipment" rowHeader />
|
|
9362
9368
|
<Column value="parcels" label="Parcels" />
|
|
9363
9369
|
</Table>
|
|
@@ -9381,6 +9387,7 @@ The keys of [First table](#first-table), Input, Select and Button apply here.
|
|
|
9381
9387
|
|---|---|---|---|
|
|
9382
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 |
|
|
9383
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) |
|
|
9384
9391
|
|
|
9385
9392
|
###### Styling
|
|
9386
9393
|
|
|
@@ -9388,6 +9395,8 @@ The keys of [First table](#first-table), Input, Select and Button apply here.
|
|
|
9388
9395
|
|---|---|---|---|
|
|
9389
9396
|
| `className` | `string` | — | Classes on the pagination bar. |
|
|
9390
9397
|
|
|
9398
|
+
Also takes every attribute of the rendered element – without `children`.
|
|
9399
|
+
|
|
9391
9400
|
##### Types on this page
|
|
9392
9401
|
|
|
9393
9402
|
###### `TableRef`
|
|
@@ -9406,7 +9415,7 @@ type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "conditionOf"> & {
|
|
|
9406
9415
|
|
|
9407
9416
|
- In [server mode](#server-mode) the page goes to the server in the request, and `rowCount` decides how many pages there are.
|
|
9408
9417
|
|
|
9409
|
-
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).
|
|
9410
9419
|
|
|
9411
9420
|
### Virtualisation
|
|
9412
9421
|
|
|
@@ -9491,7 +9500,7 @@ export default function Virtualisation() {
|
|
|
9491
9500
|
return (
|
|
9492
9501
|
<Stack gap={2}>
|
|
9493
9502
|
<style>{STYLE}</style>
|
|
9494
|
-
<Table className="request-log" selectable stickyHeader stickyRowHeader maxHeight="340px"
|
|
9503
|
+
<Table className="request-log" selectable stickyHeader stickyRowHeader maxHeight="340px" aria-label="Requests">
|
|
9495
9504
|
<Toolbar>
|
|
9496
9505
|
<Search placeholder="Request or service" />
|
|
9497
9506
|
</Toolbar>
|
|
@@ -9514,6 +9523,139 @@ export default function Virtualisation() {
|
|
|
9514
9523
|
}
|
|
9515
9524
|
```
|
|
9516
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
|
+
|
|
9517
9659
|
#### Keyboard
|
|
9518
9660
|
|
|
9519
9661
|
| Key | Action |
|
|
@@ -9530,20 +9672,11 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9530
9672
|
| [`stickyHeader`](#first-table) | `boolean` | — | Keeps the header row visible while scrolling. |
|
|
9531
9673
|
| [`stickyRowHeader`](#first-table) | `boolean` | — | Keeps the row header column visible while scrolling sideways - the same as `pin="start"` on the row header. |
|
|
9532
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. |
|
|
9533
9678
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9534
9679
|
|
|
9535
|
-
###### Accessibility
|
|
9536
|
-
|
|
9537
|
-
| Prop | Type | Default | Description |
|
|
9538
|
-
|---|---|---|---|
|
|
9539
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9540
|
-
|
|
9541
|
-
###### Styling
|
|
9542
|
-
|
|
9543
|
-
| Prop | Type | Default | Description |
|
|
9544
|
-
|---|---|---|---|
|
|
9545
|
-
| [`className`](#first-table) | `string` | — | Classes on the outer frame of the table. |
|
|
9546
|
-
|
|
9547
9680
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9548
9681
|
|
|
9549
9682
|
| Prop | Type | Default | Description |
|
|
@@ -9593,7 +9726,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
9593
9726
|
- Paging and virtualisation do not combine; one table does one or the other.
|
|
9594
9727
|
- No loading more rows while scrolling: a table on a server pages ([Server mode](#server-mode)).
|
|
9595
9728
|
|
|
9596
|
-
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).
|
|
9597
9730
|
|
|
9598
9731
|
### Benchmark
|
|
9599
9732
|
|
|
@@ -9684,7 +9817,7 @@ function Measured({ rows, mode, onTable }: { rows: Request[]; mode: Mode; tick:
|
|
|
9684
9817
|
onTable(t);
|
|
9685
9818
|
const { Table, Column } = t;
|
|
9686
9819
|
return (
|
|
9687
|
-
<Table maxHeight="340px" stickyHeader
|
|
9820
|
+
<Table maxHeight="340px" stickyHeader aria-label="Requests">
|
|
9688
9821
|
<Toolbar>
|
|
9689
9822
|
<Search placeholder="Request or service" />
|
|
9690
9823
|
</Toolbar>
|
|
@@ -9927,12 +10060,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
9927
10060
|
| [`maxHeight`](#first-table) | `string` | — | Height of the scroll area, e.g. "480px". A virtualised table needs it. |
|
|
9928
10061
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
9929
10062
|
|
|
9930
|
-
###### Accessibility
|
|
9931
|
-
|
|
9932
|
-
| Prop | Type | Default | Description |
|
|
9933
|
-
|---|---|---|---|
|
|
9934
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
9935
|
-
|
|
9936
10063
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
9937
10064
|
|
|
9938
10065
|
| Prop | Type | Default | Description |
|
|
@@ -10166,7 +10293,7 @@ export default function OnlyPages() {
|
|
|
10166
10293
|
});
|
|
10167
10294
|
|
|
10168
10295
|
return (
|
|
10169
|
-
<Table
|
|
10296
|
+
<Table aria-label="Shipments on the server">
|
|
10170
10297
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10171
10298
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10172
10299
|
<Column value="weight" label="Weight (kg)" sortable={false} />
|
|
@@ -10366,7 +10493,7 @@ export default function SortAndSearch() {
|
|
|
10366
10493
|
|
|
10367
10494
|
return (
|
|
10368
10495
|
<Stack gap={2}>
|
|
10369
|
-
<Table
|
|
10496
|
+
<Table aria-label="Shipments on the server">
|
|
10370
10497
|
<Toolbar>
|
|
10371
10498
|
<Search placeholder="Shipment or customer" />
|
|
10372
10499
|
</Toolbar>
|
|
@@ -10565,7 +10692,7 @@ export default function ListFilter() {
|
|
|
10565
10692
|
});
|
|
10566
10693
|
|
|
10567
10694
|
return (
|
|
10568
|
-
<Table
|
|
10695
|
+
<Table aria-label="Shipments on the server">
|
|
10569
10696
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10570
10697
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10571
10698
|
<Column value="status" label="Status" filter="list" sortable={false} />
|
|
@@ -10765,7 +10892,7 @@ export default function LoadingAndLateAnswers() {
|
|
|
10765
10892
|
});
|
|
10766
10893
|
|
|
10767
10894
|
return (
|
|
10768
|
-
<Table
|
|
10895
|
+
<Table aria-label="Shipments on the server" loading={loading}>
|
|
10769
10896
|
<Column value="id" label="Shipment" rowHeader sortable={false} />
|
|
10770
10897
|
<Column value="customer" label="Customer" sortable={false} />
|
|
10771
10898
|
<Column value="weight" label="Weight (kg)" sortable={false} />
|
|
@@ -10887,7 +11014,7 @@ export default function AMillionRowsOnAServer() {
|
|
|
10887
11014
|
|
|
10888
11015
|
return (
|
|
10889
11016
|
<Stack gap={2}>
|
|
10890
|
-
<Table selectable loading={loading}
|
|
11017
|
+
<Table selectable loading={loading} aria-label="Requests on the server">
|
|
10891
11018
|
<Toolbar>
|
|
10892
11019
|
<Search placeholder="Request or service" />
|
|
10893
11020
|
<ColumnMenu />
|
|
@@ -10925,12 +11052,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
10925
11052
|
| [`loading`](#first-table) | `boolean` | — | Shows placeholder rows instead of the rows. |
|
|
10926
11053
|
| [`children`](#first-table) | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
|
|
10927
11054
|
|
|
10928
|
-
###### Accessibility
|
|
10929
|
-
|
|
10930
|
-
| Prop | Type | Default | Description |
|
|
10931
|
-
|---|---|---|---|
|
|
10932
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
10933
|
-
|
|
10934
11055
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
10935
11056
|
|
|
10936
11057
|
| Prop | Type | Default | Description |
|
|
@@ -10978,7 +11099,7 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
10978
11099
|
- A list filter offers what `filterOptions` names; the table cannot count values it does not hold.
|
|
10979
11100
|
- No loading more rows while scrolling: paging and virtualisation do not combine.
|
|
10980
11101
|
|
|
10981
|
-
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).
|
|
10982
11103
|
|
|
10983
11104
|
## Editing
|
|
10984
11105
|
|
|
@@ -11022,7 +11143,7 @@ const SERVICES: Service[] = [
|
|
|
11022
11143
|
export default function GridMode() {
|
|
11023
11144
|
const { Table, Column, RowActions, Action } = useTable(SERVICES, { rowKey: (s) => s.id });
|
|
11024
11145
|
return (
|
|
11025
|
-
<Table grid selectable
|
|
11146
|
+
<Table grid selectable aria-label="Services">
|
|
11026
11147
|
<Column value="name" label="Service" rowHeader />
|
|
11027
11148
|
<Column value="team" label="Team" />
|
|
11028
11149
|
<Column value="requests" label="Requests a minute" format="count" aggregate="sum" />
|
|
@@ -11086,7 +11207,7 @@ export default function TheWholeGrid() {
|
|
|
11086
11207
|
selectable
|
|
11087
11208
|
stickyHeader
|
|
11088
11209
|
maxHeight="360px"
|
|
11089
|
-
|
|
11210
|
+
aria-label="Parcels by depot"
|
|
11090
11211
|
onCellEdit={({ rowKey, columnId, value }) =>
|
|
11091
11212
|
setParcels((all) => all.map((p) => (p.id === rowKey ? { ...p, [columnId]: value } : p)))
|
|
11092
11213
|
}
|
|
@@ -11141,12 +11262,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
11141
11262
|
|---|---|---|---|
|
|
11142
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. |
|
|
11143
11264
|
|
|
11144
|
-
###### Accessibility
|
|
11145
|
-
|
|
11146
|
-
| Prop | Type | Default | Description |
|
|
11147
|
-
|---|---|---|---|
|
|
11148
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
11149
|
-
|
|
11150
11265
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
11151
11266
|
|
|
11152
11267
|
| Prop | Type | Default | Description |
|
|
@@ -11241,7 +11356,7 @@ export default function CommentsColumn() {
|
|
|
11241
11356
|
return (
|
|
11242
11357
|
<Table
|
|
11243
11358
|
grid
|
|
11244
|
-
|
|
11359
|
+
aria-label="Today's tours"
|
|
11245
11360
|
onCellEdit={({ rowKey, value }) => setTours((all) => all.map((t) => (t.id === rowKey ? { ...t, comment: String(value) } : t)))}
|
|
11246
11361
|
>
|
|
11247
11362
|
<Column value="id" label="Tour" rowHeader />
|
|
@@ -11293,7 +11408,7 @@ export default function ValidatedEdits() {
|
|
|
11293
11408
|
|
|
11294
11409
|
return (
|
|
11295
11410
|
<Stack gap={2}>
|
|
11296
|
-
<Table grid
|
|
11411
|
+
<Table grid aria-label="Capacity" onCellEdit={apply}>
|
|
11297
11412
|
<Column value="name" label="Person" rowHeader />
|
|
11298
11413
|
<Column value="team" label="Team" />
|
|
11299
11414
|
<Column
|
|
@@ -11352,7 +11467,7 @@ export default function SaveARowOnPurpose() {
|
|
|
11352
11467
|
|
|
11353
11468
|
return (
|
|
11354
11469
|
<Stack gap={2}>
|
|
11355
|
-
<Table grid editMode="row"
|
|
11470
|
+
<Table grid editMode="row" aria-label="Projects" onRowSave={save}>
|
|
11356
11471
|
<Column value="name" label="Project" rowHeader />
|
|
11357
11472
|
<Column value="phase" label="Phase" edit="select" editOptions={["Discovery", "Build", "Launch"]} width={140} />
|
|
11358
11473
|
<Column value="owner" label="Owner" edit="text" />
|
|
@@ -11398,7 +11513,7 @@ export default function CheckAWholeRow() {
|
|
|
11398
11513
|
<Table
|
|
11399
11514
|
grid
|
|
11400
11515
|
editMode="row"
|
|
11401
|
-
|
|
11516
|
+
aria-label="Price list"
|
|
11402
11517
|
onRowSave={({ rowKey, changes }) => setOffers((all) => all.map((o) => (o.id === rowKey ? { ...o, ...changes } : o)))}
|
|
11403
11518
|
>
|
|
11404
11519
|
<Column value="product" label="Product" rowHeader />
|
|
@@ -11451,7 +11566,7 @@ export default function KeepAList() {
|
|
|
11451
11566
|
<Table
|
|
11452
11567
|
grid
|
|
11453
11568
|
editMode="row"
|
|
11454
|
-
|
|
11569
|
+
aria-label="Stores"
|
|
11455
11570
|
newRow={() => ({ kind: "Spare part", stock: 0 })}
|
|
11456
11571
|
onRowSave={({ rowKey, changes }) => setItems((all) => all.map((i) => (i.id === rowKey ? { ...i, ...changes } : i)))}
|
|
11457
11572
|
onRowAdd={({ values }) => setItems((all) => [...all, { id: `i${++next}`, ...(values as Omit<Item, "id">) }])}
|
|
@@ -11498,7 +11613,7 @@ export default function EditADenseTable() {
|
|
|
11498
11613
|
grid
|
|
11499
11614
|
editMode="row"
|
|
11500
11615
|
density="compact"
|
|
11501
|
-
|
|
11616
|
+
aria-label="Meeting rooms"
|
|
11502
11617
|
onRowSave={({ rowKey, changes }) => setRooms((all) => all.map((r) => (r.id === rowKey ? { ...r, ...changes } : r)))}
|
|
11503
11618
|
onRowDelete={({ rowKey }) => setRooms((all) => all.filter((r) => r.id !== rowKey))}
|
|
11504
11619
|
>
|
|
@@ -11539,12 +11654,6 @@ From `TableProps` — the full table stands on [First table](#first-table).
|
|
|
11539
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. |
|
|
11540
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. |
|
|
11541
11656
|
|
|
11542
|
-
###### Accessibility
|
|
11543
|
-
|
|
11544
|
-
| Prop | Type | Default | Description |
|
|
11545
|
-
|---|---|---|---|
|
|
11546
|
-
| [`ariaLabel`](#first-table) | `string` | — | Accessible name of the table (not of the outer frame). |
|
|
11547
|
-
|
|
11548
11657
|
From `TableOptions` — the full table stands on [First table](#first-table).
|
|
11549
11658
|
|
|
11550
11659
|
| Prop | Type | Default | Description |
|
|
@@ -11577,9 +11686,9 @@ From `ToolbarProps` — the full table stands on [Toolbar](#toolbar).
|
|
|
11577
11686
|
|
|
11578
11687
|
#### Known limits
|
|
11579
11688
|
|
|
11580
|
-
- 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)).
|
|
11581
11690
|
|
|
11582
|
-
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).
|
|
11583
11692
|
|
|
11584
11693
|
## Limits and alarms
|
|
11585
11694
|
|
|
@@ -11631,7 +11740,7 @@ export default function ReadLatency() {
|
|
|
11631
11740
|
const { Table, Column, VerdictColumn } = useTable(ENDPOINTS, { rowKey: (e) => e.path });
|
|
11632
11741
|
|
|
11633
11742
|
return (
|
|
11634
|
-
<Table
|
|
11743
|
+
<Table aria-label="Checkout endpoints">
|
|
11635
11744
|
<Column value="path" label="Endpoint" rowHeader />
|
|
11636
11745
|
<VerdictColumn value="p95" label="p95 latency (ms)" limits={OBJECTIVE} />
|
|
11637
11746
|
</Table>
|
|
@@ -11677,7 +11786,7 @@ function Tours({ sortBy }: { sortBy: "verdict" | "value" }) {
|
|
|
11677
11786
|
defaultSort: { column: "load", direction: "desc" },
|
|
11678
11787
|
});
|
|
11679
11788
|
return (
|
|
11680
|
-
<Table
|
|
11789
|
+
<Table aria-label={sortBy === "verdict" ? "Tours by verdict" : "Tours by load"}>
|
|
11681
11790
|
<Column value="tour" label="Tour" rowHeader />
|
|
11682
11791
|
<VerdictColumn value="load" label="Load (%)" limits={LOAD} sortBy={sortBy} />
|
|
11683
11792
|
</Table>
|
|
@@ -11736,7 +11845,7 @@ export default function JudgeAComputedShare() {
|
|
|
11736
11845
|
const { Table, Column, VerdictColumn } = useTable(CENTRES, { rowKey: (c) => c.name });
|
|
11737
11846
|
|
|
11738
11847
|
return (
|
|
11739
|
-
<Table
|
|
11848
|
+
<Table aria-label="Budget use in March">
|
|
11740
11849
|
<Column value="name" label="Cost centre" rowHeader />
|
|
11741
11850
|
<Column value="actual" label="Actual (€)" format="count" />
|
|
11742
11851
|
<VerdictColumn id="used" label="Budget used" value={(c) => c.actual / c.budget} limits={SPEND} format="percent" />
|
|
@@ -11793,7 +11902,7 @@ export default function ShowTheWorst() {
|
|
|
11793
11902
|
const { Table, Column, VerdictColumn } = useTable(PEOPLE, { rowKey: (p) => p.id });
|
|
11794
11903
|
|
|
11795
11904
|
return (
|
|
11796
|
-
<Table
|
|
11905
|
+
<Table aria-label="Booked hours this week">
|
|
11797
11906
|
<Column value="name" label="Name" rowHeader />
|
|
11798
11907
|
<Column value="team" label="Team" />
|
|
11799
11908
|
<Column value="capacity" label="Capacity (h)" />
|
|
@@ -11851,10 +11960,11 @@ violated, and it is never the edge of a region.
|
|
|
11851
11960
|
|
|
11852
11961
|
###### `NumberFormat`
|
|
11853
11962
|
|
|
11854
|
-
|
|
11963
|
+
How a number column is written: `"percent"`, `"count"`, or Intl's number
|
|
11964
|
+
options plus `decimals`; the same shape as core's `NumberFormat`.
|
|
11855
11965
|
|
|
11856
11966
|
```ts
|
|
11857
|
-
type NumberFormat = "percent" | "count" |
|
|
11967
|
+
type NumberFormat = "percent" | "count" | NumberOptions;
|
|
11858
11968
|
```
|
|
11859
11969
|
|
|
11860
11970
|
###### `Pin`
|
|
@@ -11881,6 +11991,17 @@ force a `null` on one edge in the one-sided case.
|
|
|
11881
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 |
|
|
11882
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 |
|
|
11883
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
|
+
|
|
11884
12005
|
###### `Side`
|
|
11885
12006
|
|
|
11886
12007
|
From `@umriss-ui/core`.
|
|
@@ -11908,7 +12029,7 @@ type Severity = "warning" | "alarm";
|
|
|
11908
12029
|
- No list filter: four verdicts are sorted, not filtered.
|
|
11909
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)).
|
|
11910
12031
|
|
|
11911
|
-
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).
|
|
11912
12033
|
|
|
11913
12034
|
## API index
|
|
11914
12035
|
|
|
@@ -12436,10 +12557,11 @@ type NumberField<Z> = {
|
|
|
12436
12557
|
|
|
12437
12558
|
##### `NumberFormat`
|
|
12438
12559
|
|
|
12439
|
-
|
|
12560
|
+
How a number column is written: `"percent"`, `"count"`, or Intl's number
|
|
12561
|
+
options plus `decimals`; the same shape as core's `NumberFormat`.
|
|
12440
12562
|
|
|
12441
12563
|
```ts
|
|
12442
|
-
type NumberFormat = "percent" | "count" |
|
|
12564
|
+
type NumberFormat = "percent" | "count" | NumberOptions;
|
|
12443
12565
|
```
|
|
12444
12566
|
|
|
12445
12567
|
##### `OwnAggregate<Z = never>`
|
|
@@ -12601,13 +12723,15 @@ row. Pass it as `of` to a part that stands outside the table.
|
|
|
12601
12723
|
|
|
12602
12724
|
| Prop | Type | Default | Description |
|
|
12603
12725
|
|---|---|---|---|
|
|
12604
|
-
| `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
|
|
12605
|
-
| `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 |
|
|
12606
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 |
|
|
12607
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 |
|
|
12608
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 |
|
|
12609
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 |
|
|
12610
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) |
|
|
12611
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) |
|
|
12612
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) |
|
|
12613
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) |
|
|
@@ -12797,3 +12921,16 @@ interface VerdictColumnComponent<Z> {
|
|
|
12797
12921
|
<K extends NumberField<Z>>(props: VerdictBase & { value: K; id?: string }): ReactNode;
|
|
12798
12922
|
}
|
|
12799
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
|
+
```
|