@umriss-ui/table 0.6.2 → 0.7.1

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/docs/llms-full.md CHANGED
@@ -1,6 +1,6 @@
1
- # @umriss-ui/table 0.6.2
1
+ # @umriss-ui/table 0.7.1
2
2
 
3
- > The umriss table for data-dense applications - declared the way it reads: columns as JSX, typed against their rows.
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
 
5
5
  Install with `pnpm add @umriss-ui/table`. This text is generated from the package's demo (https://romanhaendler.github.io/umriss-ui/table/): every page with its import line, its examples - the source exactly as it runs, with the package name where the demo imports its own source - its props tables generated from the code, and what it deliberately does not do. The pages index stands in https://romanhaendler.github.io/umriss-ui/table/llms.txt.
6
6
 
@@ -526,7 +526,7 @@ Two packages, no stylesheet to import, and one hook that turns an array of rows
526
526
  import { useTable } from "@umriss-ui/table";
527
527
  ```
528
528
 
529
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/installation
529
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/installation/
530
530
 
531
531
  Install `pnpm add @umriss-ui/table @umriss-ui/core`. The core package is a peer dependency: the table reads its provider, its formats and its wording (ADR-0016). React 18 or 19 as a peer as well.
532
532
 
@@ -581,7 +581,7 @@ Rows of records to scan, sort, search and select (also called a data table or da
581
581
  import { useTable } from "@umriss-ui/table";
582
582
  ```
583
583
 
584
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/table
584
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/table/
585
585
 
586
586
  `useTable` takes the rows and hands back the `Table` and the `Column` that belong to them, so a column can only name a field the row has. The parts that touch no row, such as `Toolbar` or `Search`, are ordinary imports.
587
587
 
@@ -651,6 +651,11 @@ export default function FirstTable() {
651
651
  | `groupable` | `boolean` | — | `false`: the user cannot group this table - the column menu offers no grouping, and a grouping handed in is passed over. |
652
652
  | `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. |
653
653
  | `onCellEdit` | `(edit: CellEdit<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. |
654
+ | `editMode` | `"cell" \| "row"` | — | Grid mode (ADR-0036): `"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. |
655
+ | `onRowSave` | `(save: RowSave<Z>) => void` | — | `editMode="row"`: a saved Row draft, with the columns it changed. |
656
+ | `onRowAdd` | `(add: RowAdd) => 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. |
657
+ | `newRow` | `() => Partial<Z>` | — | What a new row starts with - the values the columns read before anything is typed. Without it, nothing. |
658
+ | `onRowDelete` | `(remove: RowDelete<Z>) => void` | — | Grid mode: a Delete button on every row, which asks inside its row before the delete is reported. The table removes nothing. |
654
659
  | `children` | `ReactNode` | — | Columns, `RowDetail`, `RowActions` and the unbound parts. |
655
660
 
656
661
  ##### `TableOptions<Z>`
@@ -723,7 +728,7 @@ Set the table's wording, formats and density once for the whole application, at
723
728
  import { UmrissProvider } from "@umriss-ui/table";
724
729
  ```
725
730
 
726
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/provider
731
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/provider/
727
732
 
728
733
  The table has no provider of its own: it reads the one of @umriss-ui/core (ADR-0016). German wording ships as `@umriss-ui/core/wording/de` (ADR-0019).
729
734
 
@@ -807,7 +812,7 @@ One value per row, read from a field or computed. Everything the table does with
807
812
  import { useTable } from "@umriss-ui/table";
808
813
  ```
809
814
 
810
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/column
815
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/column/
811
816
 
812
817
  Without a presentation the value type decides: text on the left, numbers right-aligned with tabular figures, points in time as date and time, truth values as a word.
813
818
 
@@ -1016,7 +1021,7 @@ How a value looks in its cell: a standard format, a presentation of its own, an
1016
1021
  import { useTable } from "@umriss-ui/table";
1017
1022
  ```
1018
1023
 
1019
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/formats
1024
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/formats/
1020
1025
 
1021
1026
  A format or a presentation changes what the cell shows and nothing else: sorting, search, export and totals keep working on the value.
1022
1027
 
@@ -1195,7 +1200,7 @@ How wide a column stands, which columns stay in view while the table scrolls sid
1195
1200
  import { useTable } from "@umriss-ui/table";
1196
1201
  ```
1197
1202
 
1198
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/width-and-pinning
1203
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/width-and-pinning/
1199
1204
 
1200
1205
  #### Examples
1201
1206
 
@@ -1393,7 +1398,7 @@ A column written once and used in many tables: as a preset spread into a column,
1393
1398
  import { column } from "@umriss-ui/table";
1394
1399
  ```
1395
1400
 
1396
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/presets
1401
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/presets/
1397
1402
 
1398
1403
  #### Examples
1399
1404
 
@@ -1519,7 +1524,7 @@ Order the rows by a column, and by further columns where the first ties. Reach f
1519
1524
  import { useTable } from "@umriss-ui/table";
1520
1525
  ```
1521
1526
 
1522
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/sorting
1527
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/sorting/
1523
1528
 
1524
1529
  #### Examples
1525
1530
 
@@ -1638,7 +1643,7 @@ A text field that narrows the table to the rows containing what the user types (
1638
1643
  import { Search } from "@umriss-ui/table";
1639
1644
  ```
1640
1645
 
1641
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/search
1646
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/search/
1642
1647
 
1643
1648
  It searches the columns whose value is text, and it searches the value, not its presentation; `searchable` on a column adds or removes one. A search term goes back to page one and counts as a restriction – the toolbar shows the matches and “Reset” – but it is not listed as a condition, since the field already shows it.
1644
1649
 
@@ -1785,7 +1790,7 @@ Narrow a column to some of its values: those that occur, a range between two bou
1785
1790
  import { columnFilter } from "@umriss-ui/table";
1786
1791
  ```
1787
1792
 
1788
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/filter
1793
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/filter/
1789
1794
 
1790
1795
  Every condition stands in the table toolbar with the count of matches, a cross to lift it and “Reset” for all. A click on a condition opens its filter again.
1791
1796
 
@@ -2072,7 +2077,7 @@ Decide which rows a table has at all – by permission, by site, by tenant. The
2072
2077
  import { useTable } from "@umriss-ui/table";
2073
2078
  ```
2074
2079
 
2075
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/pre-filter
2080
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/pre-filter/
2076
2081
 
2077
2082
  #### Examples
2078
2083
 
@@ -2147,7 +2152,7 @@ The bar under the table that splits long results into pages, with the page size
2147
2152
  import { Pagination } from "@umriss-ui/table";
2148
2153
  ```
2149
2154
 
2150
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/pagination
2155
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/pagination/
2151
2156
 
2152
2157
  `pageSize` on the hook sets the rows per page, `pageSizes` the choices. A search, a filter, a new sort or a new page size go back to page one, and a page that no longer exists after a filter becomes the last one. A virtualised table does not page, and the bar is not drawn.
2153
2158
 
@@ -2242,7 +2247,7 @@ Gather rows that share a value under one header with their count and totals (als
2242
2247
  import { useTable } from "@umriss-ui/table";
2243
2248
  ```
2244
2249
 
2245
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/grouping
2250
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/grouping/
2246
2251
 
2247
2252
  The outer levels become header rows that carry every total under its column; the innermost of several levels stands as a span beside its rows. The form follows the level, never the data (ADR-0029).
2248
2253
 
@@ -3118,7 +3123,7 @@ What a column's values come to: a sum, an average, the extremes, a count. It sta
3118
3123
  import { useTable } from "@umriss-ui/table";
3119
3124
  ```
3120
3125
 
3121
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/aggregate
3126
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/aggregate/
3122
3127
 
3123
3128
  An aggregate is always computed from rows: a group's average is over its rows, not over the averages of the groups inside it. Absent values do not count.
3124
3129
 
@@ -3479,7 +3484,7 @@ Tick rows to act on them together (also called row selection or multi-select).
3479
3484
  import { useTable } from "@umriss-ui/table";
3480
3485
  ```
3481
3486
 
3482
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/selection
3487
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/selection/
3483
3488
 
3484
3489
  “Select all” selects what search and filters leave, on every page.
3485
3490
 
@@ -3549,7 +3554,7 @@ How rows look: dense or regular, marked by their state, and what stands while ro
3549
3554
  import { useTable } from "@umriss-ui/table";
3550
3555
  ```
3551
3556
 
3552
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/row-appearance
3557
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/row-appearance/
3553
3558
 
3554
3559
  A row's mark is the application's stylesheet at work; say the same in a word in a column too, so the colour is never the only sign.
3555
3560
 
@@ -3719,7 +3724,7 @@ More about a row, opened beneath it on demand (also called an expandable or mast
3719
3724
  import { useTable } from "@umriss-ui/table";
3720
3725
  ```
3721
3726
 
3722
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/rowdetail
3727
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/rowdetail/
3723
3728
 
3724
3729
  The table puts an expander at the start of each row, named after the row – “Expand FP-1004210”. Several rows can be open at once, and a row stays open by its key: a search or a filter that hides it for a moment does not close it.
3725
3730
 
@@ -3881,7 +3886,7 @@ Buttons at the end of each row for what the user does to that row – open, appr
3881
3886
  import { useTable } from "@umriss-ui/table";
3882
3887
  ```
3883
3888
 
3884
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/rowactions
3889
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/rowactions/
3885
3890
 
3886
3891
  Up to two actions stand in the row as buttons; from three on, all of them move into one menu per row, so the column keeps its width and no action changes place when another is added. Each is read out with the row's name – “Open: INV-26-0318”.
3887
3892
 
@@ -4063,7 +4068,7 @@ The bar above the table that holds its search, column menu and export, shows how
4063
4068
  import { Toolbar } from "@umriss-ui/table";
4064
4069
  ```
4065
4070
 
4066
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/toolbar
4071
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/toolbar/
4067
4072
 
4068
4073
  It stands above the table wherever it stands in the JSX. On the left go the parts you put into it, then the conditions of the column filters; on the right the count of matches and “Reset” while something restricts, and the selection with its bulk actions while rows are ticked.
4069
4074
 
@@ -4184,7 +4189,7 @@ A menu in which the user shows, hides, reorders and pins the table's columns and
4184
4189
  import { ColumnMenu } from "@umriss-ui/table";
4185
4190
  ```
4186
4191
 
4187
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/columnmenu
4192
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/columnmenu/
4188
4193
 
4189
4194
  Every change applies to header, body and footer together. The row header cannot be hidden. A column moves only within its block – pinned at the start, unpinned, pinned at the end – and after a move the focus stays on the button that was pressed.
4190
4195
 
@@ -4295,7 +4300,7 @@ A button that writes the rows the user sees into a CSV file for a spreadsheet (a
4295
4300
  import { Export } from "@umriss-ui/table";
4296
4301
  ```
4297
4302
 
4298
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/export
4303
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/export/
4299
4304
 
4300
4305
  It writes the filtered set across all pages, in the visible columns, in the order and sorting on screen – and the values, not their presentation: numbers with a decimal comma, a point in time as a timestamp, an absent value as an empty field. Fields are separated by semicolons, and a byte order mark tells the spreadsheet it is UTF-8.
4301
4306
 
@@ -4410,7 +4415,7 @@ What the user did to the table – search, conditions, sort, hidden columns, wid
4410
4415
  import { useTable } from "@umriss-ui/table";
4411
4416
  ```
4412
4417
 
4413
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/view
4418
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/view/
4414
4419
 
4415
4420
  The table remembers nothing, not in the address and not in any storage. Everything stands in `t.view`; keep it where the application keeps things and hand it back through `initialView`.
4416
4421
 
@@ -4510,7 +4515,7 @@ Thousands of rows the user scrolls through without pages: only the rows in view
4510
4515
  import { useTable } from "@umriss-ui/table";
4511
4516
  ```
4512
4517
 
4513
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/virtualisation
4518
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/virtualisation/
4514
4519
 
4515
4520
  #### Examples
4516
4521
 
@@ -4631,7 +4636,7 @@ A table over rows a server holds: the application hands in one page and the serv
4631
4636
  import { useTable } from "@umriss-ui/table";
4632
4637
  ```
4633
4638
 
4634
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/manual-mode
4639
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/manual-mode/
4635
4640
 
4636
4641
  `onViewChange` reports the view whenever what decides the rows changes – search, conditions, sort, page, page size – complete, defaults included, since a server has no default of the table's.
4637
4642
 
@@ -4988,7 +4993,7 @@ Make the table one Tab stop whose cells the arrow keys walk, as in a spreadsheet
4988
4993
  import { useTable } from "@umriss-ui/table";
4989
4994
  ```
4990
4995
 
4991
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/grid-mode
4996
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/grid-mode/
4992
4997
 
4993
4998
  A table is read by default: a native table, where every control is one Tab away and a screen reader keeps its table keys. Grid mode changes that on request only (ADR-0034).
4994
4999
 
@@ -5115,6 +5120,7 @@ export default function TheWholeGrid() {
5115
5120
  | `Home / End` | The first or last cell of the row. |
5116
5121
  | `Ctrl + Home / Ctrl + End` | The first cell of the head, the last cell of the footer. |
5117
5122
  | `Page Up / Page Down` | Moves by the rows in view. |
5123
+ | `Click` | Opens the editor of a cell that edits; a select shows its list, a day its calendar. |
5118
5124
  | `Enter / F2` | Starts an edit, or reaches the cell's own controls. |
5119
5125
  | `Escape` | Cancels an edit, or goes back from a control to its cell. |
5120
5126
  | `Space` | Selects the row of the active cell. |
@@ -5127,10 +5133,14 @@ Let people change a value in its cell. The table reports each edit, and the appl
5127
5133
  import { useTable } from "@umriss-ui/table";
5128
5134
  ```
5129
5135
 
5130
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/edits
5136
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/edits/
5131
5137
 
5132
5138
  An edit is reported, never applied: the application owns the rows. `validate` keeps the editor open with its message until the draft passes.
5133
5139
 
5140
+ By default each cell is reported as it is left (`onCellEdit`) - for another cell, or by a click outside the table. `editMode="row"` opens a whole row as one draft and reports it only when it is saved (`onRowSave`); a row with a draft is left only by saving or discarding it (ADR-0036).
5141
+
5142
+ `onRowAdd` puts up "New row" - in the toolbar, or beneath the table without one - and `onRowDelete` a Delete that asks inside its row. Both work in either mode.
5143
+
5134
5144
  #### Examples
5135
5145
 
5136
5146
  ##### Edit a comments column
@@ -5235,11 +5245,166 @@ export default function ValidatedEdits() {
5235
5245
  }
5236
5246
  ```
5237
5247
 
5248
+ ##### Save a row on purpose
5249
+
5250
+ `editMode="row"` opens every cell of a row that edits at once. Nothing is reported until Save or Enter; `onRowSave` hands over only the columns that changed.
5251
+
5252
+ ```tsx
5253
+ import { useState } from "react";
5254
+ import { Stack, Text } from "@umriss-ui/core";
5255
+ import { useTable } from "@umriss-ui/table";
5256
+ import type { RowSave } from "@umriss-ui/table";
5257
+
5258
+ interface Project {
5259
+ id: string;
5260
+ name: string;
5261
+ phase: string;
5262
+ owner: string;
5263
+ days: number;
5264
+ }
5265
+
5266
+ const PROJECTS: Project[] = [
5267
+ { id: "P-1", name: "Checkout redesign", phase: "Build", owner: "Ines Duarte", days: 40 },
5268
+ { id: "P-2", name: "Mobile app", phase: "Discovery", owner: "Tomasz Wrona", days: 15 },
5269
+ { id: "P-3", name: "Data warehouse", phase: "Launch", owner: "Amira Haddad", days: 60 },
5270
+ ];
5271
+
5272
+ export default function SaveARowOnPurpose() {
5273
+ const [projects, setProjects] = useState(PROJECTS);
5274
+ const [last, setLast] = useState<RowSave<Project> | null>(null);
5275
+ const { Table, Column } = useTable(projects, { rowKey: (p) => p.id });
5276
+
5277
+ const save = (saved: RowSave<Project>) => {
5278
+ setProjects((all) => all.map((p) => (p.id === saved.rowKey ? { ...p, ...saved.changes } : p)));
5279
+ setLast(saved);
5280
+ };
5281
+
5282
+ return (
5283
+ <Stack gap={2}>
5284
+ <Table grid editMode="row" ariaLabel="Projects" onRowSave={save}>
5285
+ <Column value="name" label="Project" rowHeader />
5286
+ <Column value="phase" label="Phase" edit="select" editOptions={["Discovery", "Build", "Launch"]} width={140} />
5287
+ <Column value="owner" label="Owner" edit="text" />
5288
+ <Column value="days" label="Budget (days)" edit="number" width={130} />
5289
+ </Table>
5290
+ <Text size="xs" tone="muted">
5291
+ {last ? `Saved ${last.row.name}: ${Object.keys(last.changes).join(", ")}` : "Nothing saved yet."}
5292
+ </Text>
5293
+ </Stack>
5294
+ );
5295
+ }
5296
+ ```
5297
+
5298
+ ##### Check a whole row before it is saved
5299
+
5300
+ On Save every open cell runs its `validate`; each message stands beneath its field, and the row stays open until all of them pass. A click into another row is refused while the draft is open.
5301
+
5302
+ ```tsx
5303
+ import { useState } from "react";
5304
+ import { useTable } from "@umriss-ui/table";
5305
+
5306
+ interface Offer {
5307
+ id: string;
5308
+ product: string;
5309
+ unit: string;
5310
+ price: number | null;
5311
+ minimum: number | null;
5312
+ maximum: number | null;
5313
+ }
5314
+
5315
+ const OFFERS: Offer[] = [
5316
+ { id: "o1", product: "Printer paper A4", unit: "box", price: 24.5, minimum: 5, maximum: 200 },
5317
+ { id: "o2", product: "Toner cartridge", unit: "piece", price: 68, minimum: 1, maximum: 40 },
5318
+ { id: "o3", product: "Desk lamp", unit: "piece", price: 39.9, minimum: 2, maximum: 25 },
5319
+ ];
5320
+
5321
+ const required = (label: string) => (value: number | null) => (value === null ? `${label} is required` : undefined);
5322
+
5323
+ export default function CheckAWholeRow() {
5324
+ const [offers, setOffers] = useState(OFFERS);
5325
+ const { Table, Column } = useTable(offers, { rowKey: (o) => o.id });
5326
+ return (
5327
+ <Table
5328
+ grid
5329
+ editMode="row"
5330
+ ariaLabel="Price list"
5331
+ onRowSave={({ rowKey, changes }) => setOffers((all) => all.map((o) => (o.id === rowKey ? { ...o, ...changes } : o)))}
5332
+ >
5333
+ <Column value="product" label="Product" rowHeader />
5334
+ <Column value="unit" label="Unit" width={80} />
5335
+ <Column
5336
+ value="price"
5337
+ label="Price"
5338
+ edit="number"
5339
+ width={130}
5340
+ validate={(value) => (value === null ? "A price is required" : value < 0 ? "Not below 0" : undefined)}
5341
+ />
5342
+ <Column value="minimum" label="Minimum order" edit="number" width={150} validate={required("A minimum order")} />
5343
+ <Column value="maximum" label="Maximum order" edit="number" width={150} validate={required("A maximum order")} />
5344
+ </Table>
5345
+ );
5346
+ }
5347
+ ```
5348
+
5349
+ ##### Keep a list: add, change and delete rows
5350
+
5351
+ `onRowAdd` puts up "New row" in the toolbar - an empty row draft above the rows, whatever the sort; `newRow` gives its first values. `onRowDelete` adds a Delete that asks inside its row. The application owns the rows: it inserts, changes and removes them itself.
5352
+
5353
+ ```tsx
5354
+ import { useState } from "react";
5355
+ import { Search, Toolbar, useTable } from "@umriss-ui/table";
5356
+
5357
+ type Kind = "Spare part" | "Consumable" | "Tool";
5358
+
5359
+ interface Item {
5360
+ id: string;
5361
+ name: string;
5362
+ kind: Kind;
5363
+ stock: number | null;
5364
+ location: string;
5365
+ }
5366
+
5367
+ const ITEMS: Item[] = [
5368
+ { id: "i1", name: "Burner nozzle 4 mm", kind: "Spare part", stock: 6, location: "Store A-3" },
5369
+ { id: "i2", name: "Refractory mortar", kind: "Consumable", stock: 14, location: "Yard" },
5370
+ { id: "i3", name: "Thermocouple type K", kind: "Spare part", stock: 3, location: "Store A-1" },
5371
+ { id: "i4", name: "Torque wrench 40-200 Nm", kind: "Tool", stock: 2, location: "Workshop" },
5372
+ ];
5373
+
5374
+ let next = ITEMS.length;
5375
+
5376
+ export default function KeepAList() {
5377
+ const [items, setItems] = useState(ITEMS);
5378
+ const { Table, Column } = useTable(items, { rowKey: (i) => i.id });
5379
+ return (
5380
+ <Table
5381
+ grid
5382
+ editMode="row"
5383
+ ariaLabel="Stores"
5384
+ newRow={() => ({ kind: "Spare part", stock: 0 })}
5385
+ onRowSave={({ rowKey, changes }) => setItems((all) => all.map((i) => (i.id === rowKey ? { ...i, ...changes } : i)))}
5386
+ onRowAdd={({ values }) => setItems((all) => [...all, { id: `i${++next}`, ...(values as Omit<Item, "id">) }])}
5387
+ onRowDelete={({ rowKey }) => setItems((all) => all.filter((i) => i.id !== rowKey))}
5388
+ >
5389
+ <Toolbar>
5390
+ <Search />
5391
+ </Toolbar>
5392
+ <Column value="name" label="Item" rowHeader edit="text" validate={(value) => (value ? undefined : "An item needs a name")} />
5393
+ <Column value="kind" label="Kind" edit="select" editOptions={["Spare part", "Consumable", "Tool"]} width={150} />
5394
+ <Column value="stock" label="In stock" edit="number" width={110} validate={(value) => (value === null || value < 0 ? "0 or more" : undefined)} />
5395
+ <Column value="location" label="Location" edit="text" width={150} />
5396
+ </Table>
5397
+ );
5398
+ }
5399
+ ```
5400
+
5238
5401
  #### Keyboard
5239
5402
 
5240
5403
  | Key | Action |
5241
5404
  |---|---|
5242
- | `Tab (while editing)` | Commits the edit and moves to the next cell that edits. |
5405
+ | `Tab (while editing)` | Commits the edit and moves to the next cell that edits; in a row draft, walks its fields and buttons. |
5406
+ | `Enter (row draft)` | Saves the row. |
5407
+ | `Escape (row draft)` | Discards the row's changes. |
5243
5408
 
5244
5409
  #### Known limits
5245
5410
 
@@ -5259,7 +5424,7 @@ A column that judges each value against limits – ok, warning, alarm or unknown
5259
5424
  import { useTable } from "@umriss-ui/table";
5260
5425
  ```
5261
5426
 
5262
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/verdictcolumn
5427
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/verdictcolumn/
5263
5428
 
5264
5429
  A missing value reads “unknown”: a fourth verdict, not a blank cell. Each verdict carries a shape and a word as well as a colour, and a value past a limit shows its excess beside it.
5265
5430
 
@@ -5494,7 +5659,7 @@ The list of alerts someone has to see and acknowledge, worst first, with their s
5494
5659
  import { AlarmList, alarmModel } from "@umriss-ui/table";
5495
5660
  ```
5496
5661
 
5497
- Demo page: https://romanhaendler.github.io/umriss-ui/table/#/alarmlist
5662
+ Demo page: https://romanhaendler.github.io/umriss-ui/table/alarmlist/
5498
5663
 
5499
5664
  The library receives alerts and raises none (ADR-0009). `alarmModel` turns them into a sorted view – priority, then acknowledgement, then time – and the list shows it; your application applies the transitions (`acknowledge`, `snooze`, `unsnooze`, `disable`, `enable`) to its own state. The lifecycle is one field with four values, active or resolved × acknowledged or not, so an alert that came and went unseen stays until someone acknowledges it.
5500
5665
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@umriss-ui/table",
3
- "version": "0.6.2",
4
- "description": "The umriss table for data-dense applications - declared the way it reads: columns as JSX, typed against their rows.",
3
+ "version": "0.7.1",
4
+ "description": "React data table for data-dense applications - sorting, filtering, grouping, aggregates, virtualisation. Declared the way it reads: columns as JSX, typed against their rows.",
5
5
  "license": "MIT",
6
6
  "author": "Roman Händler",
7
7
  "homepage": "https://romanhaendler.github.io/umriss-ui/table/",
@@ -15,11 +15,17 @@
15
15
  },
16
16
  "keywords": [
17
17
  "react",
18
- "components",
19
- "ui",
20
- "umriss",
18
+ "react-table",
19
+ "data-table",
20
+ "data-grid",
21
+ "datagrid",
21
22
  "table",
22
- "data-grid"
23
+ "sorting",
24
+ "filtering",
25
+ "grouping",
26
+ "virtualization",
27
+ "typescript",
28
+ "umriss"
23
29
  ],
24
30
  "type": "module",
25
31
  "files": [
@@ -45,7 +51,7 @@
45
51
  "peerDependencies": {
46
52
  "react": ">=18",
47
53
  "react-dom": ">=18",
48
- "@umriss-ui/core": "^0.13.0"
54
+ "@umriss-ui/core": "^0.14.1"
49
55
  },
50
56
  "devDependencies": {
51
57
  "@fontsource/geist-mono": "^5.3.0",
@@ -59,8 +65,8 @@
59
65
  "typescript": "^5.6.3",
60
66
  "vite": "^6.0.0",
61
67
  "vite-plugin-dts": "^4.3.0",
62
- "@umriss-ui/demo": "0.0.0",
63
- "@umriss-ui/core": "0.13.0"
68
+ "@umriss-ui/core": "0.14.1",
69
+ "@umriss-ui/demo": "0.0.0"
64
70
  },
65
71
  "scripts": {
66
72
  "props": "node --disable-warning=ExperimentalWarning --experimental-strip-types demo/props.ts",