@umriss-ui/table 0.2.0-rc.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 ADDED
@@ -0,0 +1,247 @@
1
+ # Changes to `@umriss-ui/table`
2
+
3
+ This document describes what changes for **callers** of the package: exports,
4
+ props, behaviour. What was worked on in the repository stands in its journal
5
+ (`docs/journal.md`) and in the specs under `.scratch/`.
6
+
7
+ **The numbers** follow the rule of `@umriss-ui/core` and `@umriss-ui/charts`: the
8
+ middle digit rises when something is added, the last one when something is
9
+ repaired, and **whatever changes existing behaviour stands under a heading
10
+ "Changed" of its own**, no matter which digit rose.
11
+
12
+ **Names read forwards.** Where an entry describes a name that has since been
13
+ renamed, it is named here as it is called today; names that were removed stand
14
+ as they stood.
15
+
16
+ **Release candidates.** `0.2.0-rc.0` is the first version for the registry, under
17
+ the tag `next` rather than `latest`: `pnpm add @umriss-ui/table@next @umriss-ui/core`.
18
+ `0.1.0` was never published. Where an entry below names a `@umriss-ui/core`
19
+ version, it is one of the internal numbers from before core's first publication
20
+ as `0.1.0` (see core's changelog).
21
+
22
+ ---
23
+
24
+ ## 0.2.0-rc.0 – One language, one scope
25
+
26
+ Delivery report for `.scratch/english-and-umriss-ui/spec.md`, the table's share.
27
+
28
+ - **The package is called `@umriss-ui/table`**, and it takes
29
+ **`@umriss-ui/core`** as its peer — the package that was `@umriss/ui` and now
30
+ lies at `packages/core`. The npm scope moved from `@umriss/*` to
31
+ `@umriss-ui/*`, the org actually secured for this library. Nothing was ever
32
+ published under the old names — all three returned 404 from the registry — so
33
+ there is no alias and no deprecation window, and the version number stays where
34
+ it is. An import line changes from `@umriss/table` to `@umriss-ui/table` and
35
+ from `@umriss/ui` to `@umriss-ui/core`; nothing else about the call changes.
36
+ - **Every identifier and every document is English** (ADR-0018, which supersedes
37
+ ADR-0015). The hook is `useTable`, the model `tableModel`, the companion
38
+ `useCompanion`, the alarm model `alarmModel`; `src/kern/` is `src/model/` —
39
+ not `core/`, which would name both the package and this layer, one grep with
40
+ two answers. The long prose headers that carry the design reasoning were
41
+ translated, not shortened.
42
+ - **The library ships two wordings, English by default** (ADR-0019). The table
43
+ reads its texts out of the wording of `@umriss-ui/core`, as it always did, so
44
+ its labels are now English by default: the column menu, the search, the export,
45
+ the row actions, the empty state, the conditions in the table toolbar and the
46
+ ratio "43 of 1.204". The German that used to be the default is unchanged and
47
+ ships as the subpath `@umriss-ui/core/wording/de`; one `UmrissProvider` with
48
+ it switches both packages back at once.
49
+ - **The formats are still `de-DE`**, so the default renders English words around
50
+ German digits — "43 of 1.204", a date as "17.03.2026". A locale is not a
51
+ language, and changing it is its own decision with its own pass over the
52
+ baselines; ADR-0019 records this rather than hiding it. An application that
53
+ wants otherwise passes `formats` to the `UmrissProvider`, and the table's tests
54
+ prove the cells use it rather than formatters of their own.
55
+ - The licence is MIT, and a `LICENSE` file ships in the package.
56
+
57
+ ---
58
+
59
+ ### Changed — the values, not only the names
60
+
61
+ - **The alarm lifecycle.** `LifecycleState` is `"standing-unacknowledged"`,
62
+ `"standing-acknowledged"`, `"cleared-unacknowledged"`,
63
+ `"cleared-acknowledged"`; `Transition` is `"raised"`, `"acknowledged"`,
64
+ `"cleared"`; `Priority` is `"high"`, `"medium"`, `"low"`. In the DOM,
65
+ `data-zustand` is `data-lifecycle` and `data-prioritaet` is `data-priority`.
66
+ - **The limit model's wire format** follows `@umriss-ui/core` and
67
+ `@umriss-ui/charts`: `data-urteil` is `data-verdict`, and `VerdictColumn`
68
+ reads `assessment.verdict` and `assessment.excess`.
69
+ - **Freshness** is `"fresh" | "stale" | "lost"`, and the `freshness` prop of
70
+ `AlarmList` takes `{ stale, lost }` instead of `{ alt, abgerissen }`.
71
+ `data-aktualitaet` is `data-freshness`.
72
+ - **The `virtual` prop is `{ rowHeight, overscan }`**, not
73
+ `{ zeilenHoehe, puffer }`.
74
+
75
+ ### Fixed
76
+
77
+ - **Virtualisation never measured a real row.** `useVirtual` in
78
+ `@umriss-ui/core` looked for `[data-zeile]`, which the table does not write —
79
+ its rows carry `data-row`. The measured row height therefore stayed at the
80
+ `rowHeight` passed as a starting point, and the filler rows that hold the
81
+ scrollbar at the right length were sized against it. Two visual tests had been
82
+ failing on this.
83
+
84
+ ## 0.2.0-rc.0 – Column filters that do not shift the table
85
+
86
+ Delivery report for `.scratch/table-filters/spec.md`.
87
+
88
+ ### Added
89
+
90
+ - **`columnFilter({ matches, Input, describe })`**: a filter an application
91
+ writes itself — its check, its panel, the text of its condition. It is bound to
92
+ a value type, not to a row kind; the compiler accepts it at a column only if
93
+ that column's value fits. The table shows it, counts it and resets it like any
94
+ other. `matches` is never called for an absent value, and an absent value
95
+ satisfies no condition of its own. The list filter is built with the same
96
+ interface.
97
+ - **`filter="range"`**: two bounds on a column, both inclusive, each may stay
98
+ open. Over a number two number fields that take effect while typing — if "from"
99
+ lies behind "to" they are invalid and the condition stays the last valid one —
100
+ and over an instant the range picker. The bounds of an instant are calendar days
101
+ in local time: "to 30.09." includes the whole of 30.09. An absent value never
102
+ fits. The compiler allows `"range"` only on numbers and instants.
103
+ - **`t.filter` and `t.setFilter(column, condition | null)`**: read and set
104
+ conditions from outside, for instance out of a tile "3 blocked". Typing happens
105
+ at the field of the row — a list of its values, and for numbers and instants a
106
+ range as well; an id that is no field name takes any condition. A condition
107
+ that does not fit the kind of the filter is passed over with a warning in
108
+ development. A change resets to page one.
109
+ - **`conditions` in the view**: `initialView` sets them for the first render,
110
+ without the unfiltered table flashing up; `t.view` reads them back. A condition
111
+ for an unknown column falls out.
112
+
113
+ ### Changed
114
+
115
+ - **`filterWerte` and `setFilterWerte` are `t.filter` and `t.setFilter`.** The
116
+ condition of a list filter is the chosen values themselves, an absent one as
117
+ `null` — no longer the keys `"wert:…"`.
118
+ - **Conditions stand in the table toolbar**, no longer in a row of their own
119
+ between the toolbar and the header. On the left, behind whatever is placed in
120
+ it, stands one tag per condition — a click opens the panel of its filter, the
121
+ cross lifts it — and on the right the ratio "43 of 1.204" in a status a screen
122
+ reader announces, and "Reset". A table with a search or a column filter has a
123
+ table toolbar even where none is placed: it then carries only the conditions,
124
+ the ratio and "Reset"; the number of the selection and its bulk actions belong
125
+ to a toolbar somebody put there. A `Toolbar` standing behind the table with `of`
126
+ registers only after the first frame (`ToolbarProps`).
127
+ - **The search no longer appears as a condition.** It still counts, and "Reset"
128
+ empties it.
129
+ - **`filter="list"` only on values with a text form.** On an array or an object
130
+ the compiler rejects it; at runtime no filter appeared there even before.
131
+ - **The application's filter is called `preFilter`** and is what its name says:
132
+ it determines which rows the table has at all. It never appears as a condition,
133
+ "Reset" leaves it standing, and it never belongs to the view. The ratio "43 of
134
+ 1.204" counts only the rows it admits, the list filter offers only their
135
+ values, and a table it leaves empty shows `empty` instead of "Nothing matches
136
+ the search and filters". `filter` remains as the deprecated name for one minor
137
+ version.
138
+ - **A change of the pre-filter no longer resets the page.** The page stays
139
+ standing and is clamped to those that exist. Whoever wants to start at page one
140
+ after a change calls `t.setPage(1)`. A pre-filter determines the rows of the
141
+ table; whoever reset on every change of the admitted rows reset on every data
142
+ refresh.
143
+
144
+ ### Fixed
145
+
146
+ - **The table moved down on the first keystroke** (D1): the strip of active
147
+ filters came into being with the first condition as a row of its own above the
148
+ header and disappeared again when emptied. A browser check now holds that the
149
+ header stays put while searching, filtering and resetting.
150
+ - **The search stood there twice** (D2): in its field and as a condition
151
+ "Suche: …" beside it.
152
+ - **A condition outlived its column** (D6): when a filtered column left the JSX,
153
+ its choice stayed in the state, went on counting as a restriction in the empty
154
+ state, and took effect again when the column came back. The condition now goes
155
+ with the column. A hidden column is still there and keeps its own.
156
+ - **A filter written in the call made the table crash** (D4): `filter: (z) => …`
157
+ yielded "Too many re-renders" on the first render, because a change of its
158
+ identity reset the page while still rendering. The documentation demanded only
159
+ `useCallback`. `preFilter` may stand in the call.
160
+ - **The list filter offered values the application's filter excludes** (D5) —
161
+ under a filter by plant, the values of the other plants.
162
+ - **Figures and the empty state counted excluded rows** (D3): the ratio named all
163
+ rows, and where the application's filter alone left the table empty it offered
164
+ "reset everything" — which left the table empty.
165
+
166
+ ### Removed
167
+
168
+ - **The view as search parameters.** `alsSuchparameter`, `ausSuchparametern`,
169
+ `AusSuchparameternOptionen`, `t.suchparameter` and the text form of
170
+ `initialeAnsicht` have gone. The table writes no part of its state into the
171
+ address: what the URLs of an application contain the application decides. What
172
+ remains is the view as an object — `initialView` on the first render, `t.view`
173
+ to read it back — which an application can keep wherever it likes. Whoever
174
+ wants to go on using the address writes the few fields of `TableView` into it
175
+ themselves.
176
+
177
+ ---
178
+
179
+ ## 0.1.0 – A table, declared the way it reads (never published)
180
+
181
+ Delivery report for `.scratch/umriss-table/spec.md`, tickets 01–13 (ADR-0016,
182
+ ADR-0017). The package depends on `@umriss-ui/core` as a peer and imports only
183
+ its public entry; it has no runtime dependencies.
184
+
185
+ `@umriss-ui/core` has no table any more (ticket 14, `@umriss-ui/core` 0.9.0).
186
+ Model, export, view, selection and the alarm model stand only here; their
187
+ behaviour tests run against this package's demo
188
+ (`.scratch/table-demo/spec.md`).
189
+
190
+ ### Fixed before publication
191
+
192
+ - **The sticky row header sticks where it belongs**, even when every column has a
193
+ `width` and the table is wider than their sum. Until then the table layout
194
+ distributed the excess over the selection and expander cells as well; they grew
195
+ wider than the 34 px the sticky offsets are computed from, and when scrolling
196
+ sideways the row header slid over the expander. Found by the demo's browser
197
+ suite — jsdom knows no layout.
198
+ - **The label of a condition in the filter strip** ("Suche", "Status") stands in
199
+ the secondary type rather than the muted one. On the surface of the tag the
200
+ muted type held 4.5:1 in neither theme (3.09:1 light, 3.74:1 dark). Found by
201
+ the demo's accessibility check, which saw a table with a condition at rest for
202
+ the first time.
203
+
204
+ ### Added
205
+
206
+ - **`useTable(rows, options)`** derives the row kind from the rows and gives out
207
+ the parts that need it: `Table`, `Column`, `VerdictColumn`, `RowDetail`,
208
+ `RowActions`, `Action`. With them the state — filtered and visible rows,
209
+ search, sort levels, page, hidden columns, order, widths, expanded rows, list
210
+ filters, selection —, the view as an object (`view`) and as text
211
+ (`suchparameter`) and `asCsv()`. Options: `rowKey`, `pageSize`, `defaultSort`,
212
+ `filter`, `initialView` (also as text out of the address bar), `virtual`,
213
+ `selection`.
214
+ - **A column is an element** with exactly one value — a field name or a function
215
+ with an `id` — and optionally its presentation as `children(value, row)`.
216
+ `children` is not called for an absent value; without `children` the type of
217
+ the value decides text, alignment, sorting and export. `format` chooses a
218
+ standard presentation (`"prozent"`, `"anzahl"`, `{ decimals }`, `"datum"`,
219
+ `"zeit"`, `"datumZeit"`), `footer` sums or averages over the filtered set,
220
+ `rowHeader` names the row, `filter="list"` offers the values that occur,
221
+ `sortValue` and `exportValue` sort and write a value that has no order of its
222
+ own. The compiler rejects a mistyped field name, `footer` on text, a date format
223
+ on a number, and a missing renderer for an array.
224
+ - **The table renders its rows itself**: hiding and reordering act on header,
225
+ body and footer at once. Props: `selectable`, `stickyHeader`,
226
+ `stickyRowHeader`, `striped`, `density`, `maxHeight`, `empty`, `loading`,
227
+ `rowProps`, `ariaLabel`.
228
+ - **`column<P>(…)`** — a column bound to a property instead of to a row kind, to
229
+ be spread into `Column`.
230
+ - **Unbound parts** `Toolbar` (with the bulk actions of the selection), `Search`,
231
+ `ColumnMenu` (show, hide, arrange), `Export` (download or `onExport`),
232
+ `Pagination`; placed inside the table or with `of={t}`.
233
+ - **`VerdictColumn`** — a numeric value against a `LimitSet`, with a character, a
234
+ word and the excess; sorted by severity or with `sortBy="value"`.
235
+ - **`AlarmList`** and **`alarmModel`**, taken over from `@umriss-ui/core` and
236
+ expressed in the same interface. The props are English here: `view`,
237
+ `selection`, `onAcknowledge`, `asOf`, `freshness`.
238
+ - `alsSuchparameter`, `ausSuchparametern`, `useTableSelection` and their types.
239
+
240
+ ### Worth knowing
241
+
242
+ - **A table pages only when a `Pagination` stands.** Without one it shows the
243
+ whole filtered set; `pageSize` applies as soon as there is a bar.
244
+ - The table renders in the browser. Server-side rendering is not foreseen.
245
+ - A `Column` out of a different `useTable` call can be placed into a table
246
+ without the compiler objecting — JSX does not check children against their
247
+ parents. In development the table warns.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Roman Händler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @umriss-ui/table
2
+
3
+ The umriss table, declared the way it reads: columns are JSX elements, typed
4
+ against the rows they came from. The hook binds the row kind once and hands back
5
+ the `Table` and the `Column` that belong to it, so a column can only name a
6
+ field the row actually has.
7
+
8
+ Filtering, sorting, paging, selection, row detail, row actions, column widths
9
+ and virtualisation are in the model, not in the markup — and the model is a pure
10
+ module with tests of its own.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @umriss-ui/table@next @umriss-ui/core
16
+ ```
17
+
18
+ The fonts are the application's, as for `@umriss-ui/core`: Geist is loaded with
19
+ `@fontsource/geist-sans` and `@fontsource/geist-mono`, and without it the tokens
20
+ fall back to the system fonts.
21
+
22
+ The table is a **release candidate**, published under the tag `next` (and, as
23
+ long as no released version exists, under `latest` too — npm insists on one); the
24
+ core it takes as a peer is the released `@umriss-ui/core`.
25
+
26
+ `@umriss-ui/core` is a **peer dependency** (ADR-0016): the table reads its
27
+ provider, its formats and its wording, and enters it by the public entry only.
28
+ React 18 or 19 as a peer as well.
29
+
30
+ ## The smallest table that runs
31
+
32
+ ```tsx
33
+ import { useTable } from "@umriss-ui/table";
34
+ import "@umriss-ui/core/styles.css";
35
+ import "@umriss-ui/table/styles.css";
36
+
37
+ interface Order {
38
+ number: string;
39
+ customer: string;
40
+ quantity: number;
41
+ }
42
+
43
+ const ORDERS: Order[] = [
44
+ { number: "A-2041", customer: "Brandt Metalworks", quantity: 120 },
45
+ { number: "A-2042", customer: "Keller & Sons", quantity: 48 },
46
+ { number: "A-2043", customer: "Northworks", quantity: 1250 },
47
+ ];
48
+
49
+ export function Orders() {
50
+ const { Table, Column } = useTable(ORDERS, { rowKey: (o) => o.number });
51
+
52
+ return (
53
+ <Table ariaLabel="Orders">
54
+ <Column value="number" label="Order" rowHeader />
55
+ <Column value="customer" label="Customer" />
56
+ <Column value="quantity" label="Quantity" />
57
+ </Table>
58
+ );
59
+ }
60
+ ```
61
+
62
+ What the columns do not say is decided by the value: text on the left, a number
63
+ right-aligned in the provider's notation and sortable. `rowHeader` makes the
64
+ order number the name of the row — for a screen reader, and for the sticky
65
+ column.
66
+
67
+ ## The stylesheets
68
+
69
+ ```ts
70
+ import "@umriss-ui/core/styles.css";
71
+ import "@umriss-ui/table/styles.css";
72
+ ```
73
+
74
+ Both are needed, and the order is part of the appearance: the core stylesheet
75
+ carries the tokens and the base layer the table's own styles read. Neither
76
+ package's JavaScript loads CSS of its own, so the application imports both.
77
+
78
+ ## What it can do
79
+
80
+ * **Columns by composition** (ADR-0017): a value from a field or computed, its
81
+ presentation, defaults per value type, absent values, a footer, a row header.
82
+ * **Restricting a column**: the values that occur, two bounds, or a filter the
83
+ application writes itself — plus conditions set from outside and read back.
84
+ * **Around the table**: toolbar, search, column menu, export, paging — each
85
+ usable inside the table toolbar or anywhere else on the page with `of`.
86
+ * **On a row**: a detail row that stays open across a change of filter, row
87
+ actions that stay quiet until the row is meant, and a bulk action that always
88
+ receives a list.
89
+ * **For producing plants**: `VerdictColumn` reads a measured value against a
90
+ limit set, and `AlarmList` shows alarms with a lifecycle — standing or
91
+ cleared, acknowledged or not. The library generates no alarms (ADR-0009).
92
+ * **Twenty thousand rows** where it has to be: virtualisation, sticky parts and
93
+ column widths that survive a view being restored.
94
+
95
+ ## More
96
+
97
+ * The demo: <https://romanhaendler.github.io/umriss-ui/table/>, or locally
98
+ `pnpm dev:table` (port 4175). It is the documentation — every page
99
+ shows running examples with their source and the props table generated from
100
+ `src/`.
101
+ * [`CHANGELOG.md`](CHANGELOG.md) — what changes for a caller.
102
+ * [`../../docs/design-language.md`](../../docs/design-language.md) — the design
103
+ language all three packages share.
104
+ * [`../core/README.md`](../core/README.md) — the component library underneath.
105
+
106
+ ## Licence
107
+
108
+ MIT — see [`LICENSE`](LICENSE).