@umriss-ui/table 0.16.0 → 0.34.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 -2
- package/README.md +2 -6
- package/dist/index.d.ts +18 -515
- package/dist/table.css +1 -1
- package/dist/table.js +3012 -3317
- package/docs/llms-full.md +219 -1547
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { FlatteningEntry } from '@umriss-ui/core';
|
|
3
|
-
import { FreshnessAges } from '@umriss-ui/core';
|
|
4
|
-
import { HTMLAttributes } from 'react';
|
|
5
2
|
import { JSX } from 'react';
|
|
6
3
|
import { LimitSet } from '@umriss-ui/core';
|
|
7
4
|
import { ReactNode } from 'react';
|
|
8
|
-
import { Wording } from '@umriss-ui/core';
|
|
9
5
|
|
|
10
6
|
/** A value that is not there: `null` or `undefined`. */
|
|
11
7
|
export declare type Absent = null | undefined;
|
|
12
8
|
|
|
13
|
-
/** Acknowledges the named alarms at the named time. Unknown ids are passed
|
|
14
|
-
over, what is already acknowledged stays as it is. */
|
|
15
|
-
export declare function acknowledge(alarms: readonly Alarm[], ids: Iterable<string>, time: number): Acknowledgement;
|
|
16
|
-
|
|
17
|
-
/** What `acknowledge` returns: the alarms afterwards, and how many it changed. */
|
|
18
|
-
export declare interface Acknowledgement {
|
|
19
|
-
alarms: Alarm[];
|
|
20
|
-
/** How many alarms the acknowledgement actually changed. Acknowledging twice
|
|
21
|
-
yields the same set but not the same number - which is why it stands
|
|
22
|
-
here. */
|
|
23
|
-
count: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
9
|
declare interface ActionBase {
|
|
27
10
|
/** The label – text, because it is read out together with the row's name. */
|
|
28
11
|
children: string;
|
|
@@ -80,229 +63,6 @@ export declare interface AggregateOptions<W, Z> {
|
|
|
80
63
|
share?: boolean;
|
|
81
64
|
}
|
|
82
65
|
|
|
83
|
-
/** `aggregate`, or its old name `footer` - never both. */
|
|
84
|
-
declare type AggregateProps<W, Z> = (AggregateOptions<W, Z> & {
|
|
85
|
-
/** The old name of `aggregate` – not together with it. */
|
|
86
|
-
footer?: never;
|
|
87
|
-
}) | {
|
|
88
|
-
/** Not together with `footer`, its old name. */
|
|
89
|
-
aggregate?: never;
|
|
90
|
-
/** @deprecated Is called `aggregate` now – the same values, and in a
|
|
91
|
-
grouped table the group's as well. The old name goes with the next
|
|
92
|
-
minor version. */
|
|
93
|
-
footer?: FooterFor<W>;
|
|
94
|
-
/** The share bar under a sum in a group's header. */
|
|
95
|
-
share?: boolean;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/** One occurrence of a type.
|
|
99
|
-
|
|
100
|
-
`lifecycle` is the truth about the position; the two points in time are
|
|
101
|
-
trimmings for the display. The other way round it would be a pair of
|
|
102
|
-
booleans in disguise.
|
|
103
|
-
|
|
104
|
-
`availability` is the second field, and its union with the snooze is why
|
|
105
|
-
this is a type and not an interface: a snoozed alarm without an end cannot
|
|
106
|
-
be written down. A snooze without an end is the snooze ISA-18.2 warns
|
|
107
|
-
against - an alarm switched off that nobody will remember switching off. */
|
|
108
|
-
export declare type Alarm = AlarmBase & AlarmAvailability;
|
|
109
|
-
|
|
110
|
-
/** The columns with the default labels - for callers without a wording. */
|
|
111
|
-
export declare const ALARM_COLUMNS: readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
112
|
-
|
|
113
|
-
/** Whether an alarm is in service, and while it is snoozed until when and by
|
|
114
|
-
whom. */
|
|
115
|
-
export declare type AlarmAvailability = {
|
|
116
|
-
/** Without a statement: in service. */
|
|
117
|
-
availability?: Exclude<Availability, "snoozed">;
|
|
118
|
-
snooze?: undefined;
|
|
119
|
-
} | {
|
|
120
|
-
availability: "snoozed";
|
|
121
|
-
/** Until when, and by whom. */
|
|
122
|
-
snooze: Snooze;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/** What every alarm has, whatever its availability: its id, its type, its
|
|
126
|
-
place in the lifecycle and its moments. */
|
|
127
|
-
export declare interface AlarmBase {
|
|
128
|
-
id: string;
|
|
129
|
-
/** Id of the alarm type. */
|
|
130
|
-
type: string;
|
|
131
|
-
lifecycle: LifecycleState;
|
|
132
|
-
/** The moment of coming, in milliseconds. */
|
|
133
|
-
raised: number;
|
|
134
|
-
/** The moment of resolving; while the alarm is active: none. */
|
|
135
|
-
resolved?: number;
|
|
136
|
-
/** The moment of the acknowledgement, as long as unacknowledged: none. */
|
|
137
|
-
acknowledgedAt?: number;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Ids of the columns that are sorted, searched and ordered in. */
|
|
141
|
-
export declare type AlarmColumn = "type" | "lifecycle" | "availability" | "priority" | "acknowledgement" | "raised" | "age" | "frequency";
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The columns of the alarm model, labelled from a wording.
|
|
145
|
-
*
|
|
146
|
-
* Described only for the pipeline - how a value is read and compared - not for
|
|
147
|
-
* presentation. The cells stay the caller's, exactly as with the table. The
|
|
148
|
-
* label, though, lands in the column menu and the CSV header row, and that is
|
|
149
|
-
* why it comes from the wording: the module is pure and can read no context, so
|
|
150
|
-
* it is given one - like `standardPresets`.
|
|
151
|
-
*/
|
|
152
|
-
export declare const alarmColumns: (wording: Wording) => readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
153
|
-
|
|
154
|
-
/** The input of `alarmModel`: the alarms, their types, the as-of time, and
|
|
155
|
-
the rules for chatter and floods. */
|
|
156
|
-
export declare interface AlarmInput {
|
|
157
|
-
alarms: readonly Alarm[];
|
|
158
|
-
/** The catalogue of conditions. An alarm whose type is missing is not thrown
|
|
159
|
-
away. */
|
|
160
|
-
types: readonly AlarmType[];
|
|
161
|
-
/** Milliseconds. The age and every window hang on it; nothing reads a
|
|
162
|
-
clock. */
|
|
163
|
-
asOf: number;
|
|
164
|
-
/** Without it `frequency` counts every occurrence up to the as-of time and
|
|
165
|
-
`chatters` stays false. */
|
|
166
|
-
chatter?: ChatterRule;
|
|
167
|
-
/** Without it no flood is detected and nothing is marked. */
|
|
168
|
-
flood?: FloodRule;
|
|
169
|
-
/** Show the alarms that are done as well (resolved and acknowledged).
|
|
170
|
-
Default: no - that is the only removal the model performs. */
|
|
171
|
-
keepDone?: boolean;
|
|
172
|
-
/** The columns of the projection; without a statement `ALARM_COLUMNS`.
|
|
173
|
-
Whoever changes the label in the column menu or the CSV header row passes
|
|
174
|
-
`alarmColumns(wording)`. */
|
|
175
|
-
columns?: readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** The list of alarms, operable: a table over the rows of `alarmModel`, with
|
|
179
|
-
priority, lifecycle state and age, the acknowledgement of one alarm or of
|
|
180
|
-
the selection, and - with `asOf` and `freshness` - how old the data is. It
|
|
181
|
-
acknowledges nothing itself: it hands the ids to `onAcknowledge`. */
|
|
182
|
-
export declare function AlarmList(props: AlarmListProps): JSX.Element;
|
|
183
|
-
|
|
184
|
-
/** The props of `AlarmList`: a div's attributes, the projection to show, and
|
|
185
|
-
the hooks for selection, acknowledgement and freshness. */
|
|
186
|
-
export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
187
|
-
/** The projection from `alarmModel`. */
|
|
188
|
-
view: AlarmProjection;
|
|
189
|
-
/** The caller's selection helper; without it there is no bulk
|
|
190
|
-
acknowledgement. Deliberately the same one as for any other table: the
|
|
191
|
-
rules on "everything filtered" versus "this page" are already decided
|
|
192
|
-
there. */
|
|
193
|
-
selection?: TableSelection<string>;
|
|
194
|
-
/** Gets the ids that are to be acknowledged. The component does not
|
|
195
|
-
acknowledge itself – it does not own the alarms. */
|
|
196
|
-
onAcknowledge?: (ids: readonly string[]) => void;
|
|
197
|
-
/** Gets the ids the operator wants to snooze and the end they chose
|
|
198
|
-
(`asOf` of the view plus a duration of `snoozeDurations`). The component
|
|
199
|
-
snoozes nothing – the application calls `snooze()` on its own alarms, or
|
|
200
|
-
refuses. The action stands beside "Acknowledge", on the selection, and
|
|
201
|
-
needs `selection`, `snoozeDurations` and this handler. With
|
|
202
|
-
`snoozeReason` there is a third argument: the reason, trimmed, or
|
|
203
|
-
`undefined` when it is optional and left empty. Stored with `snooze()`,
|
|
204
|
-
the reason is shown after the end and the name in the snoozed badge's
|
|
205
|
-
tip and in what is spoken. */
|
|
206
|
-
onSnooze?: (ids: readonly string[], until: number, reason?: string) => void;
|
|
207
|
-
/** Asks for a reason when snoozing: "Snooze" then opens a small panel with
|
|
208
|
-
the durations and a field for the reason, and its button reports. With
|
|
209
|
-
`"required"` the button waits for text. Without this prop "Snooze" is the
|
|
210
|
-
menu of durations and reports at once. The list keeps no draft once the
|
|
211
|
-
panel closes; Escape and a click outside close it without reporting. */
|
|
212
|
-
snoozeReason?: "optional" | "required";
|
|
213
|
-
/** The durations on offer, in milliseconds. Which are permitted is the
|
|
214
|
-
application's rule, so there is no default list; empty or missing, there is no
|
|
215
|
-
snooze action.
|
|
216
|
-
@default no default */
|
|
217
|
-
snoozeDurations?: readonly number[];
|
|
218
|
-
/** Gets the ids whose snooze the operator wants to end early. Shown, beside
|
|
219
|
-
"Acknowledge", only with this handler and a selection. */
|
|
220
|
-
onUnsnooze?: (ids: readonly string[]) => void;
|
|
221
|
-
/** When the data was true. */
|
|
222
|
-
asOf?: Date | number | null;
|
|
223
|
-
/** From when the data counts as stale and from when as disconnected. Without
|
|
224
|
-
them the list shows no freshness – a time without a rule for when it is
|
|
225
|
-
too old is no information. */
|
|
226
|
-
freshness?: FreshnessAges;
|
|
227
|
-
/** "compact" reduces the row height for very dense views.
|
|
228
|
-
@default the density of the `UmrissProvider`, else `"compact"` */
|
|
229
|
-
density?: "regular" | "compact";
|
|
230
|
-
/** The view of hidden alarms is on. The list does not filter - the
|
|
231
|
-
projection does, with the table's own `filter` and `isHidden`; this
|
|
232
|
-
only says what the switch shows. */
|
|
233
|
-
hiddenOnly?: boolean;
|
|
234
|
-
/** Offers the view as a switch beside its count. Without it the count
|
|
235
|
-
stands as text. */
|
|
236
|
-
onHiddenOnlyChange?: (hiddenOnly: boolean) => void;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Alarms, types and an as-of time become rows with derived fields and are then
|
|
241
|
-
* handed through the table's pipeline: filter -> sort -> page. Everything the
|
|
242
|
-
* table guarantees still holds.
|
|
243
|
-
*
|
|
244
|
-
* `input.sort` without a statement means the default order; expressly `null`
|
|
245
|
-
* means input order.
|
|
246
|
-
*/
|
|
247
|
-
export declare function alarmModel(input: AlarmInput, state?: TableInput<AlarmRow, AlarmColumn>): AlarmProjection;
|
|
248
|
-
|
|
249
|
-
/** What `alarmModel` returns: the table's projection of the alarm rows -
|
|
250
|
-
filtered, sorted, paged -, and beside it the flood and the counts the list
|
|
251
|
-
announces. Give it to `AlarmList` as `view`. */
|
|
252
|
-
export declare interface AlarmProjection extends TableProjection<AlarmRow, AlarmColumn> {
|
|
253
|
-
/** The flood that was detected, when a rule was given and it applies. A
|
|
254
|
-
marking beside the complete list, not a replacement for it. */
|
|
255
|
-
flood: Flood | null;
|
|
256
|
-
/** Active and unacknowledged within the filtered set - the number for the
|
|
257
|
-
polite screen reader. From the filtered set, not from the visible page,
|
|
258
|
-
like every figure in this house. Only alarms in service count: the
|
|
259
|
-
number calls somebody over, and a hidden alarm is one it must not call
|
|
260
|
-
to. */
|
|
261
|
-
activeUnacknowledged: number;
|
|
262
|
-
/** Hidden within the filtered set: snoozed, suppressed, disabled. They are
|
|
263
|
-
in the list; this is how many. */
|
|
264
|
-
hiddenAlarms: number;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/** An alarm with everything the list and the order need to know about it.
|
|
268
|
-
Derived, never stored. */
|
|
269
|
-
export declare interface AlarmRow {
|
|
270
|
-
/** Id of the alarm - the key for selection and acknowledgement. */
|
|
271
|
-
id: string;
|
|
272
|
-
alarm: Alarm;
|
|
273
|
-
type: AlarmType;
|
|
274
|
-
lifecycle: LifecycleState;
|
|
275
|
-
/** At the as-of time: an expired snooze is already back in service here. */
|
|
276
|
-
availability: Availability;
|
|
277
|
-
priority: Priority;
|
|
278
|
-
/** 0 is the most urgent. For the sort. */
|
|
279
|
-
rank: number;
|
|
280
|
-
/** Since the coming, from the as-of time passed in. */
|
|
281
|
-
age: number;
|
|
282
|
-
/** How long the condition was true - until the resolving, otherwise until the
|
|
283
|
-
as-of time. Not the same thing as the age. */
|
|
284
|
-
duration: number;
|
|
285
|
-
/** Occurrences of this TYPE within the window; without a chatter rule: all of
|
|
286
|
-
them up to the as-of time. */
|
|
287
|
-
frequency: number;
|
|
288
|
-
/** The TYPE chatters. A marking on each of its rows. */
|
|
289
|
-
chatters: boolean;
|
|
290
|
-
/** This alarm belongs to the flood that was detected. */
|
|
291
|
-
inFlood: boolean;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** The condition that can become true. Not the alarm itself.
|
|
295
|
-
|
|
296
|
-
Frequency, chatter and flood are statements about a TYPE over a window and
|
|
297
|
-
cannot be expressed without it. */
|
|
298
|
-
export declare interface AlarmType {
|
|
299
|
-
id: string;
|
|
300
|
-
label: string;
|
|
301
|
-
priority: Priority;
|
|
302
|
-
/** The dead band, when the type has one. */
|
|
303
|
-
returnBand?: ReturnBand;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
66
|
/** The table holds every row and does the work itself. */
|
|
307
67
|
declare interface AutomaticMode<Z> {
|
|
308
68
|
/** Without it the table holds every row and does the work itself. */
|
|
@@ -321,34 +81,6 @@ declare interface AutomaticMode<Z> {
|
|
|
321
81
|
filterOptions?: never;
|
|
322
82
|
}
|
|
323
83
|
|
|
324
|
-
/** In service first, then by how near each is to coming back: snoozed (a
|
|
325
|
-
person's own decision, with an end), suppressed, disabled. The order of
|
|
326
|
-
the default sort. */
|
|
327
|
-
export declare const AVAILABILITIES: readonly Availability[];
|
|
328
|
-
|
|
329
|
-
/** Whether an alarm is in front of the people watching the list - the second
|
|
330
|
-
field beside the lifecycle (ISA-18.2's special states).
|
|
331
|
-
|
|
332
|
-
A second field and never a fifth value of the lifecycle, by the same rule
|
|
333
|
-
that made the lifecycle one field: one state, one field. The two answer
|
|
334
|
-
different questions - what happened to the condition, and whether anyone
|
|
335
|
-
is meant to see it now - and a snoozed alarm keeps its lifecycle
|
|
336
|
-
underneath: when the snooze ends it comes back active and unacknowledged
|
|
337
|
-
if that is what it is.
|
|
338
|
-
|
|
339
|
-
`suppressed` has no transition here. It is the application's logic that
|
|
340
|
-
suppresses (a service that is switched off raises no error-rate alarm),
|
|
341
|
-
and the application writes the field from that logic. */
|
|
342
|
-
export declare type Availability = "in-service" | "snoozed" | "suppressed" | "disabled";
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* The availability at the as-of time. A snooze that has reached its end is in
|
|
346
|
-
* service again - by the model's clock, not by a timer: nothing here reads a
|
|
347
|
-
* clock, and a timer in a user-interface library would bring a snoozed alarm
|
|
348
|
-
* back only while a browser tab happens to be open.
|
|
349
|
-
*/
|
|
350
|
-
export declare function availabilityAt(alarm: Alarm, asOf: number): Availability;
|
|
351
|
-
|
|
352
84
|
/** An edit the user committed - reported, not applied. */
|
|
353
85
|
export declare interface CellEdit<Z> {
|
|
354
86
|
rowKey: string;
|
|
@@ -376,14 +108,6 @@ export declare interface CellEditorProps<W, Z> {
|
|
|
376
108
|
label: string;
|
|
377
109
|
}
|
|
378
110
|
|
|
379
|
-
/** From when a type counts as chattering. */
|
|
380
|
-
export declare interface ChatterRule {
|
|
381
|
-
/** Length of the window in milliseconds. */
|
|
382
|
-
windowMs: number;
|
|
383
|
-
/** From how many occurrences within the window. Reaching it is enough. */
|
|
384
|
-
atLeast: number;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
111
|
/** Without a text form `children` is required. */
|
|
388
112
|
declare type ChildrenFor<W, Z> = IsDisplayable<W> extends true ? {
|
|
389
113
|
/** How the value appears: `(value, row)`. Never called for an absent
|
|
@@ -550,44 +274,12 @@ export declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
|
550
274
|
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
551
275
|
};
|
|
552
276
|
|
|
553
|
-
/** How many of the named alarms an acknowledgement would actually change. The
|
|
554
|
-
same condition as `acknowledge`, so that the number the interface names
|
|
555
|
-
beforehand and what happens afterwards cannot drift apart. */
|
|
556
|
-
export declare function countAcknowledgeable(alarms: readonly Alarm[], ids: Iterable<string>): number;
|
|
557
|
-
|
|
558
|
-
/** How many of the points in time lie within the window. Pure, with the as-of
|
|
559
|
-
time as a parameter. */
|
|
560
|
-
export declare const countInWindow: (times: readonly number[], windowMs: number, asOf: number) => number;
|
|
561
|
-
|
|
562
277
|
/** The names of the standard presentations of a point in time. */
|
|
563
278
|
export declare type DateFormat = "date" | "time" | "dateTime";
|
|
564
279
|
|
|
565
280
|
/** The span a point in time is grouped by. */
|
|
566
281
|
export declare type DatePeriod = "day" | "week" | "month" | "year";
|
|
567
282
|
|
|
568
|
-
/** In service before hidden, then priority, then acknowledgement, then time -
|
|
569
|
-
the worst first, not the newest. As levels of the existing multi-level
|
|
570
|
-
sort, so that a caller replaces one value instead of fighting against a
|
|
571
|
-
hard-wired comparison.
|
|
572
|
-
|
|
573
|
-
Availability stands first because a snoozed alarm of high priority is a
|
|
574
|
-
decision already taken; above an active one of medium priority it would
|
|
575
|
-
take the first glance from the alarm nobody has decided about. */
|
|
576
|
-
export declare const DEFAULT_ORDER: readonly SortLevel<AlarmColumn>[];
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Is there a flood in the window before the as-of time? Pure calculation over
|
|
580
|
-
* timestamps, with window, threshold and as-of time as parameters.
|
|
581
|
-
* @returns The flood, or `null` when fewer alarms than the rule's `atLeast`
|
|
582
|
-
* were raised in its window.
|
|
583
|
-
*/
|
|
584
|
-
export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, asOf: number): Flood | null;
|
|
585
|
-
|
|
586
|
-
/** Disables an alarm - from service or from a snooze. A suppressed alarm
|
|
587
|
-
stays as it is: that field is the application's logic's, and `enable`
|
|
588
|
-
would otherwise hand it back in service with the suppression lost. */
|
|
589
|
-
export declare function disable(alarm: Alarm): Alarm;
|
|
590
|
-
|
|
591
283
|
/** What can appear as text without `children`. */
|
|
592
284
|
export declare type Displayable = string | number | boolean | Date;
|
|
593
285
|
|
|
@@ -611,10 +303,6 @@ export declare interface EditOptions<W, Z> {
|
|
|
611
303
|
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
612
304
|
}
|
|
613
305
|
|
|
614
|
-
/** Returns a disabled alarm to service. Only that one: a snooze ends by
|
|
615
|
-
`unsnooze` or its time, a suppression by the application's logic. */
|
|
616
|
-
export declare function enable(alarm: Alarm): Alarm;
|
|
617
|
-
|
|
618
306
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
619
307
|
values, not with their presentation. In server mode the table holds one
|
|
620
308
|
page of the server's, so it writes that page, and its button says so. */
|
|
@@ -657,7 +345,7 @@ export declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths
|
|
|
657
345
|
filter?: FilterFor<Z[K]>;
|
|
658
346
|
/** Groups points in time by `"day"`, `"week"`, `"month"` or `"year"`. */
|
|
659
347
|
group?: GroupFor<Z[K]>;
|
|
660
|
-
} &
|
|
348
|
+
} & AggregateOptions<Z[K], Z> & EditOptions<Z[K], Z> & ChildrenFor<Z[K], Z>;
|
|
661
349
|
|
|
662
350
|
/** What can be set as a condition on a field: a list of its values, and for
|
|
663
351
|
numbers and points in time a range as well. */
|
|
@@ -685,38 +373,10 @@ export declare interface FilterInputProps<W, B> {
|
|
|
685
373
|
};
|
|
686
374
|
}
|
|
687
375
|
|
|
688
|
-
/** A flood that has been detected. A marking, not a suppression: the alarms all
|
|
689
|
-
stay in the list. */
|
|
690
|
-
export declare interface Flood {
|
|
691
|
-
/** Earliest and latest moment of the alarms involved - so that the interface
|
|
692
|
-
can say "forty alarms in 82 seconds". */
|
|
693
|
-
from: number;
|
|
694
|
-
to: number;
|
|
695
|
-
count: number;
|
|
696
|
-
/** Ids of the alarms involved. */
|
|
697
|
-
alarms: readonly string[];
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/** From when a set of alarms is a flood. */
|
|
701
|
-
export declare interface FloodRule {
|
|
702
|
-
windowMs: number;
|
|
703
|
-
/** From how many alarms within the window - across all types, because one
|
|
704
|
-
fault drags nine others with it. Reaching it is enough. */
|
|
705
|
-
atLeast: number;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/** What the old `footer` accepts: `"sum"` and `"avg"` for numbers, nothing
|
|
709
|
-
for every other value. */
|
|
710
|
-
export declare type FooterFor<W> = [Present<W>] extends [number] ? "sum" | "avg" : never;
|
|
711
|
-
|
|
712
376
|
/** What a column accepts as `format`: a number format for numbers, a date
|
|
713
377
|
format for points in time, nothing for every other value. */
|
|
714
378
|
export declare type FormatFor<W> = [Present<W>] extends [number] ? NumberFormat : [Present<W>] extends [Date] ? DateFormat : never;
|
|
715
379
|
|
|
716
|
-
/** Frequency per alarm type within the window. Grouped by TYPE, not by
|
|
717
|
-
occurrence - a chattering source is one problem, not forty. */
|
|
718
|
-
export declare function frequencyByType(alarms: readonly Alarm[], windowMs: number, asOf: number): Map<string, number>;
|
|
719
|
-
|
|
720
380
|
/** What every group key takes, whatever its value. */
|
|
721
381
|
export declare interface GroupByBase {
|
|
722
382
|
/** Names the group key where a grouping is chosen, and in the grouping's tag in the table toolbar. */
|
|
@@ -763,75 +423,16 @@ export declare interface GroupLevel<Z> {
|
|
|
763
423
|
order?: (row: Z) => unknown;
|
|
764
424
|
}
|
|
765
425
|
|
|
766
|
-
/**
|
|
767
|
-
* Has the value come back far enough for an active alarm to resolve? The value
|
|
768
|
-
* must come back past the return value, not merely past the bound that
|
|
769
|
-
* triggered the alarm - which is why `limit` does not appear in this
|
|
770
|
-
* calculation.
|
|
771
|
-
*
|
|
772
|
-
* The condition of resolving, not that of raising: that a measured value raises
|
|
773
|
-
* an alarm the caller's process layer decides. It lives here because only this
|
|
774
|
-
* module knows what the alarm just was.
|
|
775
|
-
*
|
|
776
|
-
* The return value itself belongs to the return: reaching it is enough.
|
|
777
|
-
*/
|
|
778
|
-
export declare const hasReturned: (band: ReturnBand, value: number) => boolean;
|
|
779
|
-
|
|
780
|
-
/** Whether someone has acknowledged the alarm, active or resolved. */
|
|
781
|
-
export declare const isAcknowledged: (state: LifecycleState) => boolean;
|
|
782
|
-
|
|
783
|
-
/** Whether the condition still holds: active, acknowledged or not. */
|
|
784
|
-
export declare const isActive: (state: LifecycleState) => boolean;
|
|
785
|
-
|
|
786
426
|
/** `true` where the value present can appear as text without `children`
|
|
787
427
|
(`Displayable`), `false` otherwise - what decides the filters and
|
|
788
428
|
aggregates a column offers. */
|
|
789
429
|
export declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<W>] extends [Displayable] ? true : false;
|
|
790
430
|
|
|
791
|
-
/** Resolved and acknowledged: the only position that leaves the list. */
|
|
792
|
-
export declare const isDone: (state: LifecycleState) => boolean;
|
|
793
|
-
|
|
794
|
-
/** Everything but in service: still in the list, drawn neutrally and counted,
|
|
795
|
-
never removed. "Not absent, only deliberately hidden." */
|
|
796
|
-
export declare const isHidden: (availability: Availability) => boolean;
|
|
797
|
-
|
|
798
|
-
/** One field, four values. `resolved-unacknowledged` is the fleeting alarm and the
|
|
799
|
-
reason why no pair of booleans stands here. */
|
|
800
|
-
export declare type LifecycleState = "active-unacknowledged" | "active-acknowledged" | "resolved-unacknowledged" | "resolved-acknowledged";
|
|
801
|
-
|
|
802
|
-
/** One line of a grouped table. A header heads a group of an outer level; a row
|
|
803
|
-
of the innermost level stands in its span; a folded span is one line. */
|
|
804
|
-
declare type Line<Z> = {
|
|
805
|
-
kind: "header";
|
|
806
|
-
group: RowGroup<Z>;
|
|
807
|
-
/** The headers around it. */
|
|
808
|
-
parents: readonly RowGroup<Z>[];
|
|
809
|
-
/** Repeated at the top of a page that begins inside the group. */
|
|
810
|
-
continued: boolean;
|
|
811
|
-
} | {
|
|
812
|
-
kind: "row";
|
|
813
|
-
row: Z;
|
|
814
|
-
parents: readonly RowGroup<Z>[];
|
|
815
|
-
/** The span the row stands in - the innermost group, when there are
|
|
816
|
-
several levels; a single level has no span, its rows stand under
|
|
817
|
-
their group header. */
|
|
818
|
-
span: RowGroup<Z> | undefined;
|
|
819
|
-
/** The span shows its value on this line: the group's first row, or the
|
|
820
|
-
first of a page that begins inside it. */
|
|
821
|
-
first: boolean;
|
|
822
|
-
continued: boolean;
|
|
823
|
-
} | {
|
|
824
|
-
kind: "folded";
|
|
825
|
-
group: RowGroup<Z>;
|
|
826
|
-
parents: readonly RowGroup<Z>[];
|
|
827
|
-
};
|
|
828
|
-
|
|
829
431
|
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
830
432
|
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
831
433
|
|
|
832
434
|
/** A column as the model reads it - what sorting, search, hiding and the
|
|
833
|
-
export need of it, not its presentation.
|
|
834
|
-
`ALARM_COLUMNS` are the alarm list's. */
|
|
435
|
+
export need of it, not its presentation. */
|
|
835
436
|
export declare interface ModelColumn<Z, K extends string = string> {
|
|
836
437
|
id: K;
|
|
837
438
|
/** Human-readable label – for the column menu and the CSV header row.
|
|
@@ -857,15 +458,6 @@ export declare interface ModelColumn<Z, K extends string = string> {
|
|
|
857
458
|
width?: number;
|
|
858
459
|
}
|
|
859
460
|
|
|
860
|
-
/**
|
|
861
|
-
* The transition as pure calculation.
|
|
862
|
-
*
|
|
863
|
-
* `raised` always leads to `active-unacknowledged`, even out of an
|
|
864
|
-
* acknowledged position: a renewed occurrence of the condition is a new
|
|
865
|
-
* event and demands that somebody see it again.
|
|
866
|
-
*/
|
|
867
|
-
export declare function nextLifecycleState(state: LifecycleState, transition: Transition): LifecycleState;
|
|
868
|
-
|
|
869
461
|
/** The field names whose value is a number or may be absent. */
|
|
870
462
|
export declare type NumberField<Z> = {
|
|
871
463
|
[K in Field<Z>]: Z[K] extends number | Absent ? K : never;
|
|
@@ -906,44 +498,12 @@ export declare type Present<W> = Exclude<W, Absent>;
|
|
|
906
498
|
/** What a column draws in a cell: the value present and its row. */
|
|
907
499
|
export declare type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;
|
|
908
500
|
|
|
909
|
-
/** From the most urgent to the last - the order of the scale. */
|
|
910
|
-
export declare const PRIORITIES: readonly Priority[];
|
|
911
|
-
|
|
912
|
-
/** Three levels. Not two, because an alarm system orders the urgency of acting
|
|
913
|
-
more finely than a limit does; not seven, because every level above about
|
|
914
|
-
four gets used as a synonym of the one below it.
|
|
915
|
-
|
|
916
|
-
This is a DIFFERENT scale from the severity of a limit (which has two), on a
|
|
917
|
-
different object. The mapping between the two is the caller's, in his code,
|
|
918
|
-
where the application's convention stands. */
|
|
919
|
-
export declare type Priority = "high" | "medium" | "low";
|
|
920
|
-
|
|
921
|
-
/** 0 is the most urgent. Sorted ascending it stands on top. */
|
|
922
|
-
export declare const priorityRank: (priority: Priority) => number;
|
|
923
|
-
|
|
924
501
|
/** The condition of a range filter: both bounds inclusive, each may be absent. */
|
|
925
502
|
export declare interface RangeCondition<W> {
|
|
926
503
|
from?: W;
|
|
927
504
|
to?: W;
|
|
928
505
|
}
|
|
929
506
|
|
|
930
|
-
/** The triggering bound and the return band of an alarm type.
|
|
931
|
-
|
|
932
|
-
With an upper bound the return value lies below it, with a lower one above
|
|
933
|
-
it. That is the dead band: it keeps the value sitting on the bound from
|
|
934
|
-
producing a hundred alarms. */
|
|
935
|
-
export declare interface ReturnBand {
|
|
936
|
-
/** `upper`: the alarm comes when the value rises above the bound.
|
|
937
|
-
`lower`: it comes when the value falls below it. */
|
|
938
|
-
direction: "upper" | "lower";
|
|
939
|
-
/** The bound that triggered the alarm. Stands here so that the condition is
|
|
940
|
-
described completely in one place - for the decision about resolving it is
|
|
941
|
-
expressly not read. */
|
|
942
|
-
limit: number;
|
|
943
|
-
/** The value the reading must come back past before the alarm resolves. */
|
|
944
|
-
returnTo: number;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
507
|
/** The props of `RowActions`: the `Action`s of each row, in its menu. */
|
|
948
508
|
export declare interface RowActionsProps {
|
|
949
509
|
/** The row's `Action`s. */
|
|
@@ -1085,23 +645,6 @@ export declare interface SetFilter<Z> {
|
|
|
1085
645
|
<I extends string>(column: I & (I extends Field<Z> ? never : unknown), condition: unknown): void;
|
|
1086
646
|
}
|
|
1087
647
|
|
|
1088
|
-
/** A snooze: a person's own, time-limited decision to take an alarm out of
|
|
1089
|
-
the way. */
|
|
1090
|
-
export declare interface Snooze {
|
|
1091
|
-
/** When it ends, in milliseconds. Reaching it is enough. */
|
|
1092
|
-
until: number;
|
|
1093
|
-
/** Who snoozed it - a snooze is tracked, not anonymous. */
|
|
1094
|
-
by: string;
|
|
1095
|
-
/** Why, when the application asked for one. The list shows it in the badge's tip and in what is spoken. */
|
|
1096
|
-
reason?: string;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
/** Snoozes an alarm in service, or snoozes anew what is snoozed. A disabled
|
|
1100
|
-
or suppressed alarm stays as it is: the stronger removal is not
|
|
1101
|
-
overwritten by the weaker one, or the end of the snooze would put an alarm
|
|
1102
|
-
disabled for maintenance back in service. */
|
|
1103
|
-
export declare function snooze(alarm: Alarm, until: number, by: string, reason?: string): Alarm;
|
|
1104
|
-
|
|
1105
648
|
/** The direction of one sort level: `asc` puts the smallest value on top,
|
|
1106
649
|
`desc` the largest. */
|
|
1107
650
|
export declare type SortDirection = "asc" | "desc";
|
|
@@ -1132,8 +675,7 @@ export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1132
675
|
/** An additional filter beside the free-text search, e.g. a status choice. */
|
|
1133
676
|
filter?: (row: Z) => boolean;
|
|
1134
677
|
/** One level or several. A single level means the same as a list holding
|
|
1135
|
-
only it
|
|
1136
|
-
correct unchanged. */
|
|
678
|
+
only it. */
|
|
1137
679
|
sort?: SortLevel<K> | readonly SortLevel<K>[] | null;
|
|
1138
680
|
/** 1-based; is clamped to the valid range. */
|
|
1139
681
|
page?: number;
|
|
@@ -1159,7 +701,7 @@ export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1159
701
|
};
|
|
1160
702
|
/** Tree rows: the rows are the roots, and these read their children. The
|
|
1161
703
|
model then sorts every level on its own, filters by core's path rule and
|
|
1162
|
-
pages nothing
|
|
704
|
+
pages nothing. */
|
|
1163
705
|
tree?: TreeInput<Z>;
|
|
1164
706
|
}
|
|
1165
707
|
|
|
@@ -1185,24 +727,20 @@ declare interface TableOptionsCommon<Z> {
|
|
|
1185
727
|
admits. It may stand in the call; a change leaves the page standing, and
|
|
1186
728
|
the model clamps it. */
|
|
1187
729
|
preFilter?: (row: Z) => boolean;
|
|
1188
|
-
/** The old name of `preFilter` – the same filter, the same meaning.
|
|
1189
|
-
@deprecated Is called `preFilter` now; the old name goes with the next minor version. */
|
|
1190
|
-
filter?: (row: Z) => boolean;
|
|
1191
730
|
/** The row filters the table has: conditions the application defines over
|
|
1192
731
|
the whole row and sets with `t.setFilter(filter, condition)` from a
|
|
1193
732
|
control of its own. Named here so that a condition from `initialView`,
|
|
1194
733
|
which arrives by id, is known in the first render. */
|
|
1195
734
|
rowFilters?: readonly RowFilter<Z, any>[];
|
|
1196
|
-
/** The view to start from,
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
column carries fall out. */
|
|
735
|
+
/** The view to start from, read once when the hook first runs; a different
|
|
736
|
+
value on a later render is ignored, as React ignores a changed
|
|
737
|
+
`defaultValue`. To go to a view later, call `setView`. The table
|
|
738
|
+
remembers none: where a view is kept is the application's decision.
|
|
739
|
+
Names no column carries fall out. */
|
|
1202
740
|
initialView?: TableView;
|
|
1203
|
-
/** Every change
|
|
1204
|
-
or to hand another table
|
|
1205
|
-
|
|
741
|
+
/** Every change the reader makes, once, always the whole view - the one to
|
|
742
|
+
keep, or to hand another table's `setView`. Not called for the view the
|
|
743
|
+
table starts with, nor for one `setView` applies. */
|
|
1206
744
|
onViewChange?: (view: TableView) => void;
|
|
1207
745
|
/** Renders only what stands in the scroll area; paging is then off. Every
|
|
1208
746
|
row is one row pitch tall, which the table measures itself (ADR-0042). */
|
|
@@ -1213,40 +751,6 @@ declare interface TableOptionsCommon<Z> {
|
|
|
1213
751
|
selection?: TableSelection<string>;
|
|
1214
752
|
}
|
|
1215
753
|
|
|
1216
|
-
declare interface TableProjection<Z, K extends string = string> {
|
|
1217
|
-
/** The visible columns in their order – the basis for the header row, the
|
|
1218
|
-
column menu and the CSV export. */
|
|
1219
|
-
columns: readonly ModelColumn<Z, K>[];
|
|
1220
|
-
/** Everything the filter leaves – the basis for figures and the selection. */
|
|
1221
|
-
filtered: Z[];
|
|
1222
|
-
/** Only the current page - with a grouping, the rows among its lines. */
|
|
1223
|
-
visible: Z[];
|
|
1224
|
-
/** With a grouping: the groups, outermost first. */
|
|
1225
|
-
groups?: RowGroup<Z>[];
|
|
1226
|
-
/** With a grouping: every line of the filtered set. */
|
|
1227
|
-
lines?: Line<Z>[];
|
|
1228
|
-
/** With a grouping: the lines of the current page, with what it repeats. */
|
|
1229
|
-
visibleLines?: Line<Z>[];
|
|
1230
|
-
/** Tree rows: the flattening - the rows shown, in reading order, with
|
|
1231
|
-
their level and state. `visible` holds their rows. */
|
|
1232
|
-
entries?: readonly FlatteningEntry<Z>[];
|
|
1233
|
-
/** Tree rows: every row the flattening shows, before a virtual window. */
|
|
1234
|
-
shown?: Z[];
|
|
1235
|
-
/** Tree rows: the roots that match or lead to a match - what a footer
|
|
1236
|
-
sums, since a parent already holds its children. */
|
|
1237
|
-
roots?: Z[];
|
|
1238
|
-
/** Tree rows: every row of the filtered tree in reading order, open or
|
|
1239
|
-
not, path rows included - what the export writes. */
|
|
1240
|
-
exported?: readonly FlatteningEntry<Z>[];
|
|
1241
|
-
/** Tree rows: how many rows the tree has on every level - what "of 1,204"
|
|
1242
|
-
counts, as the rows the pre-filter admits do for a flat table. */
|
|
1243
|
-
total?: number;
|
|
1244
|
-
/** The clamped page actually shown. */
|
|
1245
|
-
page: number;
|
|
1246
|
-
pageCount: number;
|
|
1247
|
-
columnCount: number;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
754
|
/** The props of `Table`: how the table looks and behaves. Its state comes from
|
|
1251
755
|
`useTable`, its columns from the JSX inside it. */
|
|
1252
756
|
export declare interface TableProps<Z> {
|
|
@@ -1405,6 +909,12 @@ export declare interface TableSnapshot<Z> {
|
|
|
1405
909
|
grouping: readonly string[];
|
|
1406
910
|
/** Groups by these columns or group keys; `[]` ungroups. Back to page one. */
|
|
1407
911
|
setGrouping: (grouping: readonly string[]) => void;
|
|
912
|
+
/** Goes to a whole view; what it leaves out goes back to where the table
|
|
913
|
+
starts, and names no column carries fall out. Not reported through `onViewChange`:
|
|
914
|
+
two tables kept in step by `onViewChange: (v) => other.setView(v)` in
|
|
915
|
+
both directions do not answer each other. A view with the content
|
|
916
|
+
already shown changes nothing. */
|
|
917
|
+
setView: (view: TableView) => void;
|
|
1408
918
|
/** The paths of the folded groups that still occur. */
|
|
1409
919
|
folded: readonly string[];
|
|
1410
920
|
/** Folds a group or unfolds it. A group of one row does not fold. */
|
|
@@ -1493,10 +1003,6 @@ export declare interface ToolbarProps {
|
|
|
1493
1003
|
/** The size of a toolbar's controls. */
|
|
1494
1004
|
export declare type ToolbarSize = "sm" | "md";
|
|
1495
1005
|
|
|
1496
|
-
/** What can happen to an alarm. The caller reports the event; what it means the
|
|
1497
|
-
model knows. */
|
|
1498
|
-
export declare type Transition = "raised" | "acknowledged" | "resolved";
|
|
1499
|
-
|
|
1500
1006
|
/** Tree rows for the model: how a row is keyed, how its children are read,
|
|
1501
1007
|
and which branches are open. */
|
|
1502
1008
|
export declare interface TreeInput<Z> {
|
|
@@ -1509,9 +1015,6 @@ export declare interface TreeInput<Z> {
|
|
|
1509
1015
|
admit?: (row: Z) => boolean;
|
|
1510
1016
|
}
|
|
1511
1017
|
|
|
1512
|
-
/** Ends a snooze before its time. */
|
|
1513
|
-
export declare function unsnooze(alarm: Alarm): Alarm;
|
|
1514
|
-
|
|
1515
1018
|
/** A table over your rows: the hook holds its state - sort, filters, search,
|
|
1516
1019
|
grouping, page, selection, column widths -, and the parts it returns are
|
|
1517
1020
|
typed at your row, so that a field name in `Column` is checked by the
|