@umriss-ui/table 0.3.3 → 0.4.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 +157 -0
- package/README.md +17 -2
- package/dist/index.d.ts +245 -20
- package/dist/table.css +1 -1
- package/dist/table.js +2195 -1498
- package/docs/llms-full.md +5807 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,163 @@ is one of the internal numbers from before core's first publication as `0.1.0`
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
+
## 0.4.0 – Grid, server, pinning, availability (Sep. 2026)
|
|
26
|
+
|
|
27
|
+
Needs `@umriss-ui/core` 0.10: it reads the new wording keys and `--u-shadow-sticky`; the peer range moves to `^0.10.0`.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **Manual mode, for data the browser does not hold**: `useTable(page, {
|
|
32
|
+
manual: true, rowCount, onViewChange })`. The rows are the page a server
|
|
33
|
+
answered and `rowCount` its filtered set; the table searches, filters,
|
|
34
|
+
sorts and pages nothing of its own. `onViewChange(view)` receives a
|
|
35
|
+
`ManualView` - search, conditions, sort, page and page size, always
|
|
36
|
+
present - once when the table first stands and once per change of those
|
|
37
|
+
five (a width or a hidden column fetches nothing). `loading` then lays as
|
|
38
|
+
many placeholders as the page had rows over it, in its rows' height and its
|
|
39
|
+
columns' widths, with `aria-busy`. A list filter offers what
|
|
40
|
+
`filterOptions(column)` names (with a warning in development where it
|
|
41
|
+
names nothing). Keys selected on another page stay selected, and a bulk
|
|
42
|
+
action receives every selected row the table has seen; "select all" selects
|
|
43
|
+
the page and says so ("Select all on this page"). The export writes the
|
|
44
|
+
page, and its button says so ("Export page"). There is no grouping, no
|
|
45
|
+
footer, no pre-filter and no virtualisation in manual mode - each would be
|
|
46
|
+
the page's and not the server's; a grouping asked for is passed over with
|
|
47
|
+
a warning in development. `TableSnapshot` gains `rowCount` and `manual`.
|
|
48
|
+
Without `manual` nothing changes.
|
|
49
|
+
- **Grid mode, on request** (ADR-0034): `<Table grid>` makes the table
|
|
50
|
+
`role="grid"` (`treegrid` when grouped) and one tab stop with an **Active
|
|
51
|
+
cell** - the arrows walk the cells of the head, the rows, group headers,
|
|
52
|
+
folded spans, details and the footer; Home and End go to the row's ends,
|
|
53
|
+
Ctrl+Home and Ctrl+End to the table's, PageUp and PageDown by the rows in
|
|
54
|
+
view. A cell's own controls leave the tab order and are reached with Enter
|
|
55
|
+
or F2 and left with Escape. The Active cell holds on to its row and its
|
|
56
|
+
column: it follows a sort, stands where a filtered row stood, and walks to
|
|
57
|
+
rows a virtual window has not rendered. Without `grid` nothing changes.
|
|
58
|
+
- **Editing in place**: `edit` on a column - `"text"`, `"number"`,
|
|
59
|
+
`"select"` (over `editOptions`, or the values that occur), `"date"`, or an
|
|
60
|
+
editor of one's own receiving `CellEditorProps` - gives it the core field
|
|
61
|
+
for its value. Enter, F2 or typing starts an edit, Enter commits, Escape
|
|
62
|
+
cancels, Tab commits and moves on to the next cell that edits; a picked day
|
|
63
|
+
commits at once. `validate(value, row)` keeps a draft that does not pass
|
|
64
|
+
open, its message beneath the field. The table applies nothing:
|
|
65
|
+
`onCellEdit({ rowKey, columnId, value, row })` on `<Table>` reports, and the
|
|
66
|
+
cell shows the value once the rows carry it. New types `CellEdit`,
|
|
67
|
+
`CellEditorProps`, `EditFor`, `EditOptions`.
|
|
68
|
+
- **The Windows contrast mode** (`forced-colors: active`, forced-colors 03).
|
|
69
|
+
A selected row keeps its selection as lines in the system's selection colour
|
|
70
|
+
and a focused virtual row its ring as lines in the text colour, both drawn
|
|
71
|
+
inside the cells, where the sticky cells cannot paint over them; the frame,
|
|
72
|
+
the panels and every focus ring keep an outline where the box-shadow stood,
|
|
73
|
+
and a group's share bar a system colour. Nothing changes outside forced
|
|
74
|
+
colours.
|
|
75
|
+
- **`docs/llms-full.md`**, the package's documentation as one Markdown file for
|
|
76
|
+
a coding agent, in the npm package and pinned to its version: every demo page
|
|
77
|
+
with its import line, its examples' source, its props tables and why it is
|
|
78
|
+
built as it is, and the declaration of every other export. The same text
|
|
79
|
+
stands online as <https://romanhaendler.github.io/umriss-ui/table/llms-full.txt>,
|
|
80
|
+
with an index of the pages beside it (`llms.txt`).
|
|
81
|
+
- **Availability, the second field beside the lifecycle** (ISA-18.2's special
|
|
82
|
+
states): `availability?: "in-service" | "shelved" | "suppressed-by-design" |
|
|
83
|
+
"out-of-service"` on `Alarm`, never merged into the four lifecycle values.
|
|
84
|
+
Without a statement an alarm is in service, so existing alarms read as
|
|
85
|
+
before. A shelved alarm carries `shelf: { until, by }` - and cannot be
|
|
86
|
+
written without it.
|
|
87
|
+
- **Four pure transitions**, one alarm in and one out, performed by the
|
|
88
|
+
application: `shelve(alarm, until, by)`, `unshelve`, `takeOutOfService`,
|
|
89
|
+
`returnToService`. One that does not apply returns the same object. A shelf
|
|
90
|
+
never overwrites out of service or suppressed by design, and taking out of
|
|
91
|
+
service never overwrites suppressed by design - the plant's logic owns it.
|
|
92
|
+
- **`availabilityAt(alarm, asOf)`**: a shelf that has reached its end is in
|
|
93
|
+
service again at the as-of time - by the model's clock, not by a timer.
|
|
94
|
+
`AlarmRow.availability` carries that value.
|
|
95
|
+
- **`isHiddenFromOperation`, `AVAILABILITIES`, the types `Availability` and
|
|
96
|
+
`Shelf`**, and on the projection **`hiddenFromOperation`**: how many of the
|
|
97
|
+
filtered set are hidden. The model still removes nothing.
|
|
98
|
+
- **An `availability` column** in `alarmColumns` / `ALARM_COLUMNS` (its label
|
|
99
|
+
from `wording.columnAvailability`), valued by rank like the priority.
|
|
100
|
+
- **`<AlarmList>` shows what is hidden from operation**: the row stays,
|
|
101
|
+
drawn neutrally - no edge, the priority a word without its colour, the type
|
|
102
|
+
muted - with its availability as a word before its lifecycle ("Shelved until
|
|
103
|
+
11:10 by M. Keller"). The bar counts them ("Hidden from operation: 3").
|
|
104
|
+
- **`hiddenOnly` and `onHiddenOnlyChange` on `<AlarmList>`**: with the
|
|
105
|
+
handler the count becomes a switch for the view; the application filters
|
|
106
|
+
with the table's own `filter` and `isHiddenFromOperation`. The switch stays
|
|
107
|
+
while the view is on, even at zero.
|
|
108
|
+
- **Any column can be pinned**: `pin="start"` or `pin="end"` on a `Column` or
|
|
109
|
+
a `VerdictColumn` keeps it in view while the table scrolls sideways, in a
|
|
110
|
+
block before or after every other column. The selection and the expander
|
|
111
|
+
stick with the start block (and a group span with them), the row actions
|
|
112
|
+
with the end block; a group header's label and aggregates stick in their
|
|
113
|
+
blocks, and virtual rows pin like any other. A shadow on a block's inner
|
|
114
|
+
edge shows only while content lies under it.
|
|
115
|
+
- **`t.pinned` and `t.setPin(column, "start" | "end" | null)`**, and
|
|
116
|
+
**`pinned` in the view**: the user's choice, whole, once it deviates from
|
|
117
|
+
what the columns declare (`{}` when every declared pin was undone). A view
|
|
118
|
+
handed in as `initialView` restores it.
|
|
119
|
+
- **The column menu pins**: two keys per column, "Pin to start" and "Pin to
|
|
120
|
+
end"; the key of the side a column is pinned to stands in the accent and
|
|
121
|
+
reads "Unpin". The focus stays on the key that was pressed while the entry
|
|
122
|
+
moves to its block.
|
|
123
|
+
|
|
124
|
+
### Changed
|
|
125
|
+
|
|
126
|
+
- **`stickyRowHeader` is `pin="start"` on the row header.** It looks as
|
|
127
|
+
before; the difference is that the row header can now be unpinned (with
|
|
128
|
+
`setPin`) and share its block with other pinned columns. The sticky offsets
|
|
129
|
+
are measured from the head row instead of assumed from the 34 px of a
|
|
130
|
+
control cell, so a control cell that grows no longer slides under the row
|
|
131
|
+
header.
|
|
132
|
+
- **In the column menu a column moves only inside its block** (start, the
|
|
133
|
+
unpinned ones, end). Before, only the sticky row header was held in place.
|
|
134
|
+
|
|
135
|
+
- **`DEFAULT_ORDER` begins with availability**: in service above hidden, then
|
|
136
|
+
priority, acknowledgement and time as before. Only alarms with an
|
|
137
|
+
availability of their own move.
|
|
138
|
+
- **`standingUnacknowledged` counts only alarms in service.** The live figure
|
|
139
|
+
calls somebody over; it must not call them to a shelved alarm.
|
|
140
|
+
- **A done alarm's row (`keepDone`) is muted as it always claimed to be.**
|
|
141
|
+
Its colour stood on the row, and the table's cells set their own; it now
|
|
142
|
+
stands on the cells.
|
|
143
|
+
- **Final polish of pinning, grid mode and the alarm list** (table-column-pinning
|
|
144
|
+
03, table-grid-mode 05, alarm-standards 05):
|
|
145
|
+
- The shadow of a pinned block and of a stuck group header comes from core's
|
|
146
|
+
`--u-shadow-sticky`: dark as a shadow in the dark theme, no longer a glow.
|
|
147
|
+
- A group header draws its top line inside its cells in every table, as a
|
|
148
|
+
table with pinned columns already did - one drawing, one look.
|
|
149
|
+
- In grid mode the open editor lies over its cell at the cell's size, and
|
|
150
|
+
the message of a draft that does not validate hangs beneath it in a
|
|
151
|
+
popover (core `Popover`); nothing in the table shifts while editing.
|
|
152
|
+
- The scroll area carries a `scroll-padding` of the sticky head's height and
|
|
153
|
+
the pinned blocks' widths, so a cell the keys walk to is scrolled clear of
|
|
154
|
+
them; a pinned cell's own scroll target is shifted out of that padding, so
|
|
155
|
+
focusing it does not scroll the table back.
|
|
156
|
+
- Space in a grid with selection selects or deselects the Active cell's row,
|
|
157
|
+
from any of its cells (as AG Grid and MUI do); without selection it does
|
|
158
|
+
nothing - it no longer starts a text edit either.
|
|
159
|
+
- In a grid with an editable column every cell that does not edit carries
|
|
160
|
+
`aria-readonly="true"`.
|
|
161
|
+
- `AlarmList` shows the availability as a small neutral badge before the
|
|
162
|
+
lifecycle state; until when and by whom stand in its tooltip and are
|
|
163
|
+
spoken with it. The state keeps to one line. A shelf that ends on another
|
|
164
|
+
day than the as-of time shows its date beside the time. The "Hidden from
|
|
165
|
+
operation" switch's label is in the live figure's size.
|
|
166
|
+
- **`Alarm` is a type, no longer an interface** - the union with the shelf
|
|
167
|
+
needs it. `Partial<Alarm>` spread into an `Alarm` no longer compiles; name
|
|
168
|
+
the fields you mean (`Pick<Alarm, "cleared" | "acknowledgedAt">`).
|
|
169
|
+
|
|
170
|
+
### Fixed
|
|
171
|
+
|
|
172
|
+
- **A table's rounded corner stays whole** under a sticky head or pinned
|
|
173
|
+
cells: the scroll area carries the frame's radius and clips to it.
|
|
174
|
+
- **A group header whose first column carries an aggregate keeps its
|
|
175
|
+
aggregates under their columns.** Grouped by one level, its label stood in a
|
|
176
|
+
cell over no column, which a browser counts as one, and every aggregate
|
|
177
|
+
stood a column too far right. The label now takes the first column's place
|
|
178
|
+
in the header; its sum stays in the footer.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
25
182
|
## 0.3.3 – Depth work on the table (Sep. 2026)
|
|
26
183
|
|
|
27
184
|
Needs `@umriss-ui/core` 0.9: it reads `--u-tracking-figures`; the peer range moves to `^0.9.0`.
|
package/README.md
CHANGED
|
@@ -111,8 +111,18 @@ stylesheets by hand.
|
|
|
111
111
|
* **For producing plants**: `VerdictColumn` reads a measured value against a
|
|
112
112
|
limit set, and `AlarmList` shows alarms with a lifecycle — standing or
|
|
113
113
|
cleared, acknowledged or not. The library generates no alarms (ADR-0009).
|
|
114
|
-
* **
|
|
115
|
-
|
|
114
|
+
* **A million rows on a server**: in manual mode the rows are one page a server
|
|
115
|
+
answered; the table reports the view - search, conditions, sort, page -
|
|
116
|
+
once per change and shows placeholders over the previous page while the
|
|
117
|
+
next is on its way.
|
|
118
|
+
* **Twenty thousand rows** where it has to be: virtualisation, sticky parts,
|
|
119
|
+
columns pinned to either side and column widths that survive a view being
|
|
120
|
+
restored.
|
|
121
|
+
* **A grid, on request** (ADR-0034): `<Table grid>` is one tab stop whose
|
|
122
|
+
Active cell the arrows walk, and a column with `edit` is edited in place -
|
|
123
|
+
with the core field for its value, a `validate` that keeps a wrong draft
|
|
124
|
+
open, and `onCellEdit` reporting what the application applies. Without
|
|
125
|
+
`grid` the table stays a native table.
|
|
116
126
|
|
|
117
127
|
## More
|
|
118
128
|
|
|
@@ -121,6 +131,11 @@ stylesheets by hand.
|
|
|
121
131
|
shows running examples with their source and the props table generated from
|
|
122
132
|
`src/`.
|
|
123
133
|
* [`CHANGELOG.md`](CHANGELOG.md) — what changes for a caller.
|
|
134
|
+
* **For a coding agent**: `docs/llms-full.md` inside the installed package —
|
|
135
|
+
the demo as one Markdown file, pinned to the installed version: every page
|
|
136
|
+
with its examples' source, its props tables and why it is built as it is,
|
|
137
|
+
and the declaration of every other export. Online, for the latest version:
|
|
138
|
+
<https://romanhaendler.github.io/umriss-ui/table/llms.txt>.
|
|
124
139
|
* [`../../docs/design-language.md`](../../docs/design-language.md) — the design
|
|
125
140
|
language all five packages share.
|
|
126
141
|
* [`../core/README.md`](../core/README.md) — the component library underneath.
|
package/dist/index.d.ts
CHANGED
|
@@ -94,8 +94,28 @@ declare type AggregateProps<W, Z> = (AggregateOptions<W, Z> & {
|
|
|
94
94
|
|
|
95
95
|
`lifecycle` is the truth about the position; the two points in time are
|
|
96
96
|
trimmings for the display. The other way round it would be a pair of
|
|
97
|
-
booleans in disguise.
|
|
98
|
-
|
|
97
|
+
booleans in disguise.
|
|
98
|
+
|
|
99
|
+
`availability` is the second field, and its union with the shelf is why
|
|
100
|
+
this is a type and not an interface: a shelved alarm without an end cannot
|
|
101
|
+
be written down. A shelf without an end is the shelf ISA-18.2 warns
|
|
102
|
+
against - an alarm switched off that nobody will remember switching off. */
|
|
103
|
+
export declare type Alarm = AlarmBase & AlarmAvailability;
|
|
104
|
+
|
|
105
|
+
/** The columns with the default labels - for callers without a wording. */
|
|
106
|
+
export declare const ALARM_COLUMNS: readonly Column<AlarmRow, AlarmColumn>[];
|
|
107
|
+
|
|
108
|
+
declare type AlarmAvailability = {
|
|
109
|
+
/** Without a statement: in service. */
|
|
110
|
+
availability?: Exclude<Availability, "shelved">;
|
|
111
|
+
shelf?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
availability: "shelved";
|
|
114
|
+
/** Until when, and by whom. */
|
|
115
|
+
shelf: Shelf;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare interface AlarmBase {
|
|
99
119
|
id: string;
|
|
100
120
|
/** Id of the alarm type. */
|
|
101
121
|
type: string;
|
|
@@ -108,11 +128,8 @@ export declare interface Alarm {
|
|
|
108
128
|
acknowledgedAt?: number;
|
|
109
129
|
}
|
|
110
130
|
|
|
111
|
-
/** The columns with the default labels - for callers without a wording. */
|
|
112
|
-
export declare const ALARM_COLUMNS: readonly Column<AlarmRow, AlarmColumn>[];
|
|
113
|
-
|
|
114
131
|
/** Ids of the columns that are sorted, searched and ordered in. */
|
|
115
|
-
export declare type AlarmColumn = "type" | "lifecycle" | "priority" | "acknowledgement" | "raised" | "age" | "frequency";
|
|
132
|
+
export declare type AlarmColumn = "type" | "lifecycle" | "availability" | "priority" | "acknowledgement" | "raised" | "age" | "frequency";
|
|
116
133
|
|
|
117
134
|
/**
|
|
118
135
|
* The columns of the alarm model, labelled from a wording.
|
|
@@ -170,6 +187,13 @@ export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
170
187
|
statement the density of the `UmrissProvider`, without a setting
|
|
171
188
|
"compact". */
|
|
172
189
|
density?: "regular" | "compact";
|
|
190
|
+
/** The view "hidden from operation" is on. The list does not filter - the
|
|
191
|
+
projection does, with the table's own `filter` and
|
|
192
|
+
`isHiddenFromOperation`; this only says what the switch shows. */
|
|
193
|
+
hiddenOnly?: boolean;
|
|
194
|
+
/** Offers the view as a switch beside its count. Without it the count
|
|
195
|
+
stands as text. */
|
|
196
|
+
onHiddenOnlyChange?: (hiddenOnly: boolean) => void;
|
|
173
197
|
}
|
|
174
198
|
|
|
175
199
|
/**
|
|
@@ -188,8 +212,13 @@ export declare interface AlarmProjection extends TableProjection<AlarmRow, Alarm
|
|
|
188
212
|
flood: Flood | null;
|
|
189
213
|
/** Standing and unacknowledged within the filtered set - the number for the
|
|
190
214
|
polite screen reader. From the filtered set, not from the visible page,
|
|
191
|
-
like every figure in this house.
|
|
215
|
+
like every figure in this house. Only alarms in service count: the
|
|
216
|
+
number calls somebody over, and a hidden alarm is one it must not call
|
|
217
|
+
to. */
|
|
192
218
|
standingUnacknowledged: number;
|
|
219
|
+
/** Hidden from operation within the filtered set: shelved, suppressed by
|
|
220
|
+
design, out of service. They are in the list; this is how many. */
|
|
221
|
+
hiddenFromOperation: number;
|
|
193
222
|
}
|
|
194
223
|
|
|
195
224
|
/** An alarm with everything the list and the order need to know about it.
|
|
@@ -200,6 +229,8 @@ export declare interface AlarmRow {
|
|
|
200
229
|
alarm: Alarm;
|
|
201
230
|
type: AlarmType;
|
|
202
231
|
lifecycle: LifecycleState;
|
|
232
|
+
/** At the as-of time: an expired shelf is already back in service here. */
|
|
233
|
+
availability: Availability;
|
|
203
234
|
priority: Priority;
|
|
204
235
|
/** 0 is the most urgent. For the sort. */
|
|
205
236
|
rank: number;
|
|
@@ -229,6 +260,70 @@ export declare interface AlarmType {
|
|
|
229
260
|
returnBand?: ReturnBand;
|
|
230
261
|
}
|
|
231
262
|
|
|
263
|
+
/** The table holds every row and does the work itself. */
|
|
264
|
+
declare interface AutomaticMode {
|
|
265
|
+
/** Without it the table holds every row and does the work itself. */
|
|
266
|
+
manual?: false;
|
|
267
|
+
rowCount?: never;
|
|
268
|
+
onViewChange?: never;
|
|
269
|
+
filterOptions?: never;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** In service first, then by how near each is to coming back: shelved (the
|
|
273
|
+
operator's own decision, with an end), suppressed by design, out of
|
|
274
|
+
service. The order of the default sort. */
|
|
275
|
+
export declare const AVAILABILITIES: readonly Availability[];
|
|
276
|
+
|
|
277
|
+
/** Whether an alarm is in front of the operator - the second field beside the
|
|
278
|
+
lifecycle (ISA-18.2's special states).
|
|
279
|
+
|
|
280
|
+
A second field and never a fifth value of the lifecycle, by the same rule
|
|
281
|
+
that made the lifecycle one field: one state, one field. The two answer
|
|
282
|
+
different questions - what happened to the condition, and whether anyone
|
|
283
|
+
is meant to see it now - and a shelved alarm keeps its lifecycle
|
|
284
|
+
underneath: when the shelf ends it comes back standing and unacknowledged
|
|
285
|
+
if that is what it is.
|
|
286
|
+
|
|
287
|
+
`suppressed-by-design` has no transition here. It is the plant's logic that
|
|
288
|
+
suppresses (a pump that is off raises no low-flow alarm), and the
|
|
289
|
+
application writes the field from that logic. */
|
|
290
|
+
export declare type Availability = "in-service" | "shelved" | "suppressed-by-design" | "out-of-service";
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* The availability at the as-of time. A shelf that has reached its end is in
|
|
294
|
+
* service again - by the model's clock, not by a timer: nothing here reads a
|
|
295
|
+
* clock, and a timer in a user-interface library would bring a shelved alarm
|
|
296
|
+
* back only while a browser tab happens to be open.
|
|
297
|
+
*/
|
|
298
|
+
export declare function availabilityAt(alarm: Alarm, asOf: number): Availability;
|
|
299
|
+
|
|
300
|
+
/** An edit the user committed - reported, not applied. */
|
|
301
|
+
export declare interface CellEdit<Z> {
|
|
302
|
+
rowKey: string;
|
|
303
|
+
columnId: string;
|
|
304
|
+
/** The editor's value: text for `"text"`, a number or null for
|
|
305
|
+
`"number"`, a day or null for `"date"`, an option for `"select"`. */
|
|
306
|
+
value: unknown;
|
|
307
|
+
row: Z;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** What an editor of one's own receives. The table holds the draft; Enter,
|
|
311
|
+
Escape and Tab stay the table's, bubbling up from the field. */
|
|
312
|
+
export declare interface CellEditorProps<W, Z> {
|
|
313
|
+
/** The draft - the cell's value until the field changes it. */
|
|
314
|
+
value: W | null;
|
|
315
|
+
/** Changes the draft. */
|
|
316
|
+
onChange: (value: W | null) => void;
|
|
317
|
+
/** Commits - the draft, or the value given. A picker commits on its pick. */
|
|
318
|
+
commit: (value?: W | null) => void;
|
|
319
|
+
row: Z;
|
|
320
|
+
/** The draft did not validate: the field shows it; the message stands beneath. */
|
|
321
|
+
invalid: boolean;
|
|
322
|
+
/** The field's name: what is edited, for which row. The `FormField` around
|
|
323
|
+
the editor already names a core field by it. */
|
|
324
|
+
label: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
232
327
|
/** From when a type counts as chattering. */
|
|
233
328
|
export declare interface ChatterRule {
|
|
234
329
|
/** Length of the window in milliseconds. */
|
|
@@ -276,8 +371,8 @@ export declare function column<P, K extends Field<P> = Field<P>>(preset: ColumnP
|
|
|
276
371
|
declare interface ColumnBase {
|
|
277
372
|
/** Names the column in its header, in the column menu and in the header row of the export. */
|
|
278
373
|
label: string;
|
|
279
|
-
/** This column names the row: row header cells, never hideable, the
|
|
280
|
-
|
|
374
|
+
/** This column names the row: row header cells, never hideable, the column
|
|
375
|
+
`stickyRowHeader` pins, and the name by which the row's selection, expander and
|
|
281
376
|
actions are read out. At most one per table. */
|
|
282
377
|
rowHeader?: boolean;
|
|
283
378
|
/** Right-aligned with tabular figures. Without it the first value present decides. */
|
|
@@ -286,6 +381,10 @@ declare interface ColumnBase {
|
|
|
286
381
|
width?: number;
|
|
287
382
|
/** Shows the drag grip on the header cell. */
|
|
288
383
|
resizable?: boolean;
|
|
384
|
+
/** Keeps the column in view while the table scrolls sideways: in a block
|
|
385
|
+
before every other column, or after them. The user can change it in the
|
|
386
|
+
column menu; the view carries the change. */
|
|
387
|
+
pin?: Pin;
|
|
289
388
|
/** Sortable unless stated otherwise, when the value is text, a number, a point in time or a boolean. */
|
|
290
389
|
sortable?: boolean;
|
|
291
390
|
/** Takes part in the search. Without a statement: yes for text, no otherwise. */
|
|
@@ -389,6 +488,12 @@ declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
|
389
488
|
`"range"` two bounds (meaningful only for numbers and points in time), a
|
|
390
489
|
filter from `columnFilter` asks whatever it asks itself. */
|
|
391
490
|
filter?: "list" | "range" | ColumnFilter<Present<W>, any>;
|
|
491
|
+
/** Edits the column's cells in place in grid mode - see a field column's `edit`. */
|
|
492
|
+
edit?: "text" | "number" | "select" | "date" | ((editor: CellEditorProps<W, Z>) => ReactNode);
|
|
493
|
+
/** What `edit="select"` offers; without it, the values that occur. */
|
|
494
|
+
editOptions?: readonly Present<W>[];
|
|
495
|
+
/** Checks a draft before it is reported; a message keeps the editor open. */
|
|
496
|
+
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
392
497
|
};
|
|
393
498
|
|
|
394
499
|
/** How many of the named alarms an acknowledgement would actually change. The
|
|
@@ -405,9 +510,14 @@ export declare type DateFormat = "date" | "time" | "dateTime";
|
|
|
405
510
|
|
|
406
511
|
declare type DatePeriod = "day" | "week" | "month" | "year";
|
|
407
512
|
|
|
408
|
-
/**
|
|
409
|
-
As levels of the existing multi-level
|
|
410
|
-
value instead of fighting against a
|
|
513
|
+
/** In service before hidden, then priority, then acknowledgement, then time -
|
|
514
|
+
the worst first, not the newest. As levels of the existing multi-level
|
|
515
|
+
sort, so that a caller replaces one value instead of fighting against a
|
|
516
|
+
hard-wired comparison.
|
|
517
|
+
|
|
518
|
+
Availability stands first because a shelved alarm of high priority is a
|
|
519
|
+
decision already taken; above a standing one of medium priority it would
|
|
520
|
+
take the first glance from the alarm nobody has decided about. */
|
|
411
521
|
export declare const DEFAULT_ORDER: readonly SortLevel<AlarmColumn>[];
|
|
412
522
|
|
|
413
523
|
export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, asOf: number): Flood | null;
|
|
@@ -415,8 +525,28 @@ export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, a
|
|
|
415
525
|
/** What can appear as text without `children`. */
|
|
416
526
|
declare type Displayable = string | number | boolean | Date;
|
|
417
527
|
|
|
528
|
+
/** What a column accepts as `edit`: the core field for its value - `"text"`
|
|
529
|
+
for text, `"number"` for numbers, `"date"` for points in time, `"select"`
|
|
530
|
+
for text and numbers - or an editor of one's own. */
|
|
531
|
+
export declare type EditFor<W, Z> = ([Present<W>] extends [string] ? "text" | "select" : never) | ([Present<W>] extends [number] ? "number" | "select" : never) | ([Present<W>] extends [Date] ? "date" : never) | ((editor: CellEditorProps<W, Z>) => ReactNode);
|
|
532
|
+
|
|
533
|
+
/** The props a column carries for editing in grid mode (`<Table grid>`). */
|
|
534
|
+
export declare interface EditOptions<W, Z> {
|
|
535
|
+
/** Edits the column's cells in place in grid mode: Enter, F2 or typing
|
|
536
|
+
starts it, Enter or Tab commits, Escape cancels. The table applies
|
|
537
|
+
nothing - the edit is reported through the table's `onCellEdit`. */
|
|
538
|
+
edit?: EditFor<W, Z>;
|
|
539
|
+
/** What `edit="select"` offers; without it, the values that occur. */
|
|
540
|
+
editOptions?: readonly Present<W>[];
|
|
541
|
+
/** Checks a draft before it is reported: a message keeps the editor open
|
|
542
|
+
and stands beneath the field, as in a `FormField`; nothing lets it
|
|
543
|
+
through. */
|
|
544
|
+
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
545
|
+
}
|
|
546
|
+
|
|
418
547
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
419
|
-
values, not with their presentation.
|
|
548
|
+
values, not with their presentation. In manual mode the table holds one
|
|
549
|
+
page of the server's, so it writes that page, and its button says so. */
|
|
420
550
|
export declare function Export({ filename, onExport, of }: ExportProps): JSX.Element | null;
|
|
421
551
|
|
|
422
552
|
export declare interface ExportProps {
|
|
@@ -447,7 +577,7 @@ declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths<Z[K]>
|
|
|
447
577
|
filter?: FilterFor<Z[K]>;
|
|
448
578
|
/** Groups points in time by `"day"`, `"week"`, `"month"` or `"year"`. */
|
|
449
579
|
group?: GroupFor<Z[K]>;
|
|
450
|
-
} & AggregateProps<Z[K], Z> & ChildrenFor<Z[K], Z>;
|
|
580
|
+
} & AggregateProps<Z[K], Z> & EditOptions<Z[K], Z> & ChildrenFor<Z[K], Z>;
|
|
451
581
|
|
|
452
582
|
/** What can be set as a condition on a field: a list of its values, and for
|
|
453
583
|
numbers and points in time a range as well. */
|
|
@@ -567,6 +697,10 @@ declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<
|
|
|
567
697
|
/** Cleared and acknowledged: the only position that leaves the list. */
|
|
568
698
|
export declare const isDone: (state: LifecycleState) => boolean;
|
|
569
699
|
|
|
700
|
+
/** Everything but in service: still in the list, drawn neutrally and counted,
|
|
701
|
+
never removed. "Not absent, only deliberately hidden." */
|
|
702
|
+
export declare const isHiddenFromOperation: (availability: Availability) => boolean;
|
|
703
|
+
|
|
570
704
|
export declare const isStanding: (state: LifecycleState) => boolean;
|
|
571
705
|
|
|
572
706
|
/** One field, four values. `cleared-unacknowledged` is the fleeting alarm and the
|
|
@@ -603,6 +737,32 @@ declare type Line<Z> = {
|
|
|
603
737
|
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
604
738
|
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
605
739
|
|
|
740
|
+
/** Manual mode: the rows are the page a server answered for the view the table
|
|
741
|
+
reported. The table searches, filters, sorts, groups and pages nothing of
|
|
742
|
+
its own; select all, the export and the footer would act on one page and
|
|
743
|
+
call it the whole, so "select all" says it selects the page, the export
|
|
744
|
+
writes the page and says so, and there is no footer and no grouping. */
|
|
745
|
+
declare interface ManualMode {
|
|
746
|
+
/** Manual mode: the rows are one page a server answered. */
|
|
747
|
+
manual: true;
|
|
748
|
+
/** How many rows the server's filtered set has - the pages and the counts
|
|
749
|
+
read it. */
|
|
750
|
+
rowCount: number;
|
|
751
|
+
/** The view changed where it decides the rows: search, conditions, sort,
|
|
752
|
+
page or page size. Called once when the table first stands and once per
|
|
753
|
+
change, with every one of the five present. */
|
|
754
|
+
onViewChange: (view: ManualView) => void;
|
|
755
|
+
/** The values a list filter offers for a column, `null` for an absent one -
|
|
756
|
+
the table cannot count what it does not hold. */
|
|
757
|
+
filterOptions?: (column: string) => readonly unknown[];
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/** The view as manual mode reports it to `onViewChange`: the parts that decide
|
|
761
|
+
the rows - search, conditions, sort, page and page size - are always there,
|
|
762
|
+
at their default as well. A server has no default of the table's to fall
|
|
763
|
+
back on, and a view it has to complete is one it completes wrongly. */
|
|
764
|
+
export declare type ManualView<K extends string = string> = TableView<K> & Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
765
|
+
|
|
606
766
|
/**
|
|
607
767
|
* The transition as pure calculation.
|
|
608
768
|
*
|
|
@@ -642,6 +802,8 @@ export declare interface PaginationProps {
|
|
|
642
802
|
of?: TableRef;
|
|
643
803
|
}
|
|
644
804
|
|
|
805
|
+
declare type Pin = "start" | "end";
|
|
806
|
+
|
|
645
807
|
/** The value without the absence - that is what `children` gets. */
|
|
646
808
|
declare type Present<W> = Exclude<W, Absent>;
|
|
647
809
|
|
|
@@ -685,6 +847,10 @@ export declare interface ReturnBand {
|
|
|
685
847
|
returnTo: number;
|
|
686
848
|
}
|
|
687
849
|
|
|
850
|
+
/** Returns an alarm out of service to service. Only that one: a shelf ends by
|
|
851
|
+
`unshelve` or its time, a suppression by the plant's logic. */
|
|
852
|
+
export declare function returnToService(alarm: Alarm): Alarm;
|
|
853
|
+
|
|
688
854
|
export declare interface RowActionsProps {
|
|
689
855
|
/** The row's `Action`s. */
|
|
690
856
|
children: ReactNode;
|
|
@@ -741,6 +907,21 @@ export declare interface SetFilter<Z> {
|
|
|
741
907
|
<I extends string>(column: I & (I extends Field<Z> ? never : unknown), condition: unknown): void;
|
|
742
908
|
}
|
|
743
909
|
|
|
910
|
+
/** A shelf: the operator's own, time-limited decision to take an alarm out of
|
|
911
|
+
the way. */
|
|
912
|
+
export declare interface Shelf {
|
|
913
|
+
/** When it ends, in milliseconds. Reaching it is enough. */
|
|
914
|
+
until: number;
|
|
915
|
+
/** Who shelved it - a shelf is tracked, not anonymous. */
|
|
916
|
+
by: string;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/** Shelves an alarm in service, or shelves anew what is shelved. An alarm out
|
|
920
|
+
of service or suppressed by design stays as it is: the stronger removal is
|
|
921
|
+
not overwritten by the weaker one, or the end of the shelf would put a pump
|
|
922
|
+
under maintenance back in service. */
|
|
923
|
+
export declare function shelve(alarm: Alarm, until: number, by: string): Alarm;
|
|
924
|
+
|
|
744
925
|
export declare type SortDirection = "asc" | "desc";
|
|
745
926
|
|
|
746
927
|
/** One level of the sort. Several levels act in their order: the second decides
|
|
@@ -784,9 +965,18 @@ declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
784
965
|
/** The collation of text keys; the provider's, where there is one. */
|
|
785
966
|
compareText?: (a: string, b: string) => number;
|
|
786
967
|
};
|
|
968
|
+
/** Manual mode: the rows are the page a server answered, and `rowCount` is
|
|
969
|
+
its filtered set. The model then searches, filters, sorts, groups and
|
|
970
|
+
pages nothing - it would do it over one page and call that the whole. */
|
|
971
|
+
manual?: {
|
|
972
|
+
rowCount: number;
|
|
973
|
+
};
|
|
787
974
|
}
|
|
788
975
|
|
|
789
|
-
|
|
976
|
+
/** The options of `useTable`: automatic, or manual over a server. */
|
|
977
|
+
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode | ManualMode);
|
|
978
|
+
|
|
979
|
+
declare interface TableOptionsCommon<Z> {
|
|
790
980
|
/** A stable key per row – the basis of selection and expansion. */
|
|
791
981
|
rowKey: (row: Z) => string;
|
|
792
982
|
/** Default 10. */
|
|
@@ -843,7 +1033,8 @@ export declare interface TableProps<Z> {
|
|
|
843
1033
|
selectable?: boolean;
|
|
844
1034
|
/** Keeps the header row visible while scrolling. */
|
|
845
1035
|
stickyHeader?: boolean;
|
|
846
|
-
/** Keeps the row header column visible while scrolling sideways
|
|
1036
|
+
/** Keeps the row header column visible while scrolling sideways - the same as
|
|
1037
|
+
`pin="start"` on the row header. */
|
|
847
1038
|
stickyRowHeader?: boolean;
|
|
848
1039
|
/** Discreet zebra stripes. */
|
|
849
1040
|
striped?: boolean;
|
|
@@ -865,6 +1056,15 @@ export declare interface TableProps<Z> {
|
|
|
865
1056
|
/** `false`: the user cannot group this table - the column menu offers no
|
|
866
1057
|
grouping, and a grouping handed in is passed over. */
|
|
867
1058
|
groupable?: boolean;
|
|
1059
|
+
/** Grid mode: the table is one tab stop, and the arrows walk its cells -
|
|
1060
|
+
Home and End in the row, Ctrl+Home and Ctrl+End to the table's ends,
|
|
1061
|
+
PageUp and PageDown by the rows in view. A cell's own controls are
|
|
1062
|
+
reached with Enter or F2 and left with Escape; a column with `edit` is
|
|
1063
|
+
edited in place. Without it the table stays a native table. */
|
|
1064
|
+
grid?: boolean;
|
|
1065
|
+
/** Grid mode: an edit the user committed. The table applies nothing; the
|
|
1066
|
+
cell shows the new value when the rows passed in carry it. */
|
|
1067
|
+
onCellEdit?: (edit: CellEdit<Z>) => void;
|
|
868
1068
|
/** Columns, `RowDetail`, `RowActions` and the unbound parts. */
|
|
869
1069
|
children?: ReactNode;
|
|
870
1070
|
}
|
|
@@ -926,6 +1126,10 @@ export declare interface TableSnapshot<Z> {
|
|
|
926
1126
|
order: readonly string[];
|
|
927
1127
|
/** Reorders the columns – on header, body and footer at once. */
|
|
928
1128
|
setOrder: (order: readonly string[]) => void;
|
|
1129
|
+
/** The pinned columns by id - the declared ones until the user chooses. */
|
|
1130
|
+
pinned: Readonly<Record<string, Pin>>;
|
|
1131
|
+
/** Pins a column to the start or the end, or unpins it with `null`. */
|
|
1132
|
+
setPin: (column: string, pin: Pin | null) => void;
|
|
929
1133
|
/** The widths in pixels: those of the columns, and over them the dragged ones. */
|
|
930
1134
|
widths: Readonly<Record<string, number>>;
|
|
931
1135
|
/** Sets the width of a column; `undefined` takes it back. */
|
|
@@ -959,15 +1163,21 @@ export declare interface TableSnapshot<Z> {
|
|
|
959
1163
|
unfoldAll: () => void;
|
|
960
1164
|
/** The part of the state an application can keep; whatever is at its default is absent. */
|
|
961
1165
|
view: TableView;
|
|
962
|
-
/** The filtered set in the visible columns as text for a spreadsheet
|
|
1166
|
+
/** The filtered set in the visible columns as text for a spreadsheet - in
|
|
1167
|
+
manual mode the page. */
|
|
963
1168
|
asCsv: () => string;
|
|
964
1169
|
/** Whether it virtualises. */
|
|
965
1170
|
virtual: boolean;
|
|
1171
|
+
/** How many rows the filtered set has - in manual mode the server's count. */
|
|
1172
|
+
rowCount: number;
|
|
1173
|
+
/** Whether it is in manual mode: the rows are one page of a server's. */
|
|
1174
|
+
manual: boolean;
|
|
966
1175
|
}
|
|
967
1176
|
|
|
968
|
-
/** Search, conditions, sort levels, page, page size, hidden columns, order
|
|
969
|
-
dragged widths
|
|
970
|
-
belongs to it: it is a function of
|
|
1177
|
+
/** Search, conditions, sort levels, page, page size, hidden columns, order,
|
|
1178
|
+
dragged widths, the grouping and the pinned columns. Whatever is at its
|
|
1179
|
+
default is absent. The pre-filter never belongs to it: it is a function of
|
|
1180
|
+
the application. */
|
|
971
1181
|
export declare interface TableView<K extends string = string> {
|
|
972
1182
|
search?: string;
|
|
973
1183
|
/** The conditions of the column filters, per column. A condition for a column
|
|
@@ -984,8 +1194,18 @@ export declare interface TableView<K extends string = string> {
|
|
|
984
1194
|
grouping?: readonly K[];
|
|
985
1195
|
/** The paths of the folded groups. A path that no longer occurs falls out. */
|
|
986
1196
|
folded?: readonly string[];
|
|
1197
|
+
/** The pinned columns, whole, once the user's choice deviates from what the
|
|
1198
|
+
columns declare - `{}` when every declared pin was undone. A column that
|
|
1199
|
+
does not exist falls out. */
|
|
1200
|
+
pinned?: Readonly<Record<string, Pin>>;
|
|
987
1201
|
}
|
|
988
1202
|
|
|
1203
|
+
/** Takes an alarm out of service - from service or from a shelf. An alarm
|
|
1204
|
+
suppressed by design stays as it is: that field is the plant's logic's,
|
|
1205
|
+
and `returnToService` would otherwise hand it back in service with the
|
|
1206
|
+
suppression lost. */
|
|
1207
|
+
export declare function takeOutOfService(alarm: Alarm): Alarm;
|
|
1208
|
+
|
|
989
1209
|
/** The table toolbar: on the left whatever one puts into it, and the conditions
|
|
990
1210
|
of the column filters; on the right the ratio of the filtered set to all
|
|
991
1211
|
rows and "reset" as long as something restricts, and the count of the
|
|
@@ -1009,6 +1229,9 @@ export declare interface ToolbarProps {
|
|
|
1009
1229
|
model knows. */
|
|
1010
1230
|
export declare type Transition = "raised" | "acknowledged" | "cleared";
|
|
1011
1231
|
|
|
1232
|
+
/** Takes a shelved alarm off the shelf before its end. */
|
|
1233
|
+
export declare function unshelve(alarm: Alarm): Alarm;
|
|
1234
|
+
|
|
1012
1235
|
export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
|
|
1013
1236
|
|
|
1014
1237
|
/**
|
|
@@ -1043,6 +1266,8 @@ declare interface VerdictBase {
|
|
|
1043
1266
|
width?: number;
|
|
1044
1267
|
/** Shows the drag grip on the header cell. */
|
|
1045
1268
|
resizable?: boolean;
|
|
1269
|
+
/** Keeps the column in view while the table scrolls sideways, before or after every other column. */
|
|
1270
|
+
pin?: Pin;
|
|
1046
1271
|
/** A verdict column has no list filter: four verdicts are filtered through the sort. */
|
|
1047
1272
|
filter?: never;
|
|
1048
1273
|
/** `"worst"`: the worst verdict among the rows – in the footer and in a
|