@umriss-ui/table 0.3.3 → 0.5.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 +198 -4
- package/README.md +20 -5
- package/dist/index.d.ts +267 -43
- package/dist/table.css +1 -1
- package/dist/table.js +2254 -1557
- package/docs/llms-full.md +7366 -0
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -94,25 +94,42 @@ 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 snooze is why
|
|
100
|
+
this is a type and not an interface: a snoozed alarm without an end cannot
|
|
101
|
+
be written down. A snooze without an end is the snooze 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, "snoozed">;
|
|
111
|
+
snooze?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
availability: "snoozed";
|
|
114
|
+
/** Until when, and by whom. */
|
|
115
|
+
snooze: Snooze;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare interface AlarmBase {
|
|
99
119
|
id: string;
|
|
100
120
|
/** Id of the alarm type. */
|
|
101
121
|
type: string;
|
|
102
122
|
lifecycle: LifecycleState;
|
|
103
123
|
/** The moment of coming, in milliseconds. */
|
|
104
124
|
raised: number;
|
|
105
|
-
/** The moment of
|
|
106
|
-
|
|
125
|
+
/** The moment of resolving; while the alarm is active: none. */
|
|
126
|
+
resolved?: number;
|
|
107
127
|
/** The moment of the acknowledgement, as long as unacknowledged: none. */
|
|
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.
|
|
@@ -138,7 +155,7 @@ export declare interface AlarmInput {
|
|
|
138
155
|
chatter?: ChatterRule;
|
|
139
156
|
/** Without it no flood is detected and nothing is marked. */
|
|
140
157
|
flood?: FloodRule;
|
|
141
|
-
/** Show the alarms that are done as well (
|
|
158
|
+
/** Show the alarms that are done as well (resolved and acknowledged).
|
|
142
159
|
Default: no - that is the only removal the model performs. */
|
|
143
160
|
keepDone?: boolean;
|
|
144
161
|
/** The columns of the projection; without a statement `ALARM_COLUMNS`.
|
|
@@ -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 of hidden alarms is on. The list does not filter - the
|
|
191
|
+
projection does, with the table's own `filter` and `isHidden`; this
|
|
192
|
+
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
|
/**
|
|
@@ -186,10 +210,15 @@ export declare interface AlarmProjection extends TableProjection<AlarmRow, Alarm
|
|
|
186
210
|
/** The flood that was detected, when a rule was given and it applies. A
|
|
187
211
|
marking beside the complete list, not a replacement for it. */
|
|
188
212
|
flood: Flood | null;
|
|
189
|
-
/**
|
|
213
|
+
/** Active 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.
|
|
192
|
-
|
|
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. */
|
|
218
|
+
activeUnacknowledged: number;
|
|
219
|
+
/** Hidden within the filtered set: snoozed, suppressed, disabled. They are
|
|
220
|
+
in the list; this is how many. */
|
|
221
|
+
hiddenAlarms: number;
|
|
193
222
|
}
|
|
194
223
|
|
|
195
224
|
/** An alarm with everything the list and the order need to know about it.
|
|
@@ -200,12 +229,14 @@ export declare interface AlarmRow {
|
|
|
200
229
|
alarm: Alarm;
|
|
201
230
|
type: AlarmType;
|
|
202
231
|
lifecycle: LifecycleState;
|
|
232
|
+
/** At the as-of time: an expired snooze 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;
|
|
206
237
|
/** Since the coming, from the as-of time passed in. */
|
|
207
238
|
age: number;
|
|
208
|
-
/** How long the condition was true - until the
|
|
239
|
+
/** How long the condition was true - until the resolving, otherwise until the
|
|
209
240
|
as-of time. Not the same thing as the age. */
|
|
210
241
|
duration: number;
|
|
211
242
|
/** Occurrences of this TYPE within the window; without a chatter rule: all of
|
|
@@ -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: snoozed (a
|
|
273
|
+
person's own decision, with an end), suppressed, disabled. The order of
|
|
274
|
+
the default sort. */
|
|
275
|
+
export declare const AVAILABILITIES: readonly Availability[];
|
|
276
|
+
|
|
277
|
+
/** Whether an alarm is in front of the people watching the list - the second
|
|
278
|
+
field beside the 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 snoozed alarm keeps its lifecycle
|
|
284
|
+
underneath: when the snooze ends it comes back active and unacknowledged
|
|
285
|
+
if that is what it is.
|
|
286
|
+
|
|
287
|
+
`suppressed` has no transition here. It is the application's logic that
|
|
288
|
+
suppresses (a service that is switched off raises no error-rate alarm),
|
|
289
|
+
and the application writes the field from that logic. */
|
|
290
|
+
export declare type Availability = "in-service" | "snoozed" | "suppressed" | "disabled";
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* The availability at the as-of time. A snooze 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 snoozed 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,18 +510,52 @@ 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 snoozed alarm of high priority is a
|
|
519
|
+
decision already taken; above an active 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;
|
|
414
524
|
|
|
525
|
+
/** Disables an alarm - from service or from a snooze. A suppressed alarm
|
|
526
|
+
stays as it is: that field is the application's logic's, and `enable`
|
|
527
|
+
would otherwise hand it back in service with the suppression lost. */
|
|
528
|
+
export declare function disable(alarm: Alarm): Alarm;
|
|
529
|
+
|
|
415
530
|
/** What can appear as text without `children`. */
|
|
416
531
|
declare type Displayable = string | number | boolean | Date;
|
|
417
532
|
|
|
533
|
+
/** What a column accepts as `edit`: the core field for its value - `"text"`
|
|
534
|
+
for text, `"number"` for numbers, `"date"` for points in time, `"select"`
|
|
535
|
+
for text and numbers - or an editor of one's own. */
|
|
536
|
+
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);
|
|
537
|
+
|
|
538
|
+
/** The props a column carries for editing in grid mode (`<Table grid>`). */
|
|
539
|
+
export declare interface EditOptions<W, Z> {
|
|
540
|
+
/** Edits the column's cells in place in grid mode: Enter, F2 or typing
|
|
541
|
+
starts it, Enter or Tab commits, Escape cancels. The table applies
|
|
542
|
+
nothing - the edit is reported through the table's `onCellEdit`. */
|
|
543
|
+
edit?: EditFor<W, Z>;
|
|
544
|
+
/** What `edit="select"` offers; without it, the values that occur. */
|
|
545
|
+
editOptions?: readonly Present<W>[];
|
|
546
|
+
/** Checks a draft before it is reported: a message keeps the editor open
|
|
547
|
+
and stands beneath the field, as in a `FormField`; nothing lets it
|
|
548
|
+
through. */
|
|
549
|
+
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** Returns a disabled alarm to service. Only that one: a snooze ends by
|
|
553
|
+
`unsnooze` or its time, a suppression by the application's logic. */
|
|
554
|
+
export declare function enable(alarm: Alarm): Alarm;
|
|
555
|
+
|
|
418
556
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
419
|
-
values, not with their presentation.
|
|
557
|
+
values, not with their presentation. In manual mode the table holds one
|
|
558
|
+
page of the server's, so it writes that page, and its button says so. */
|
|
420
559
|
export declare function Export({ filename, onExport, of }: ExportProps): JSX.Element | null;
|
|
421
560
|
|
|
422
561
|
export declare interface ExportProps {
|
|
@@ -447,7 +586,7 @@ declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths<Z[K]>
|
|
|
447
586
|
filter?: FilterFor<Z[K]>;
|
|
448
587
|
/** Groups points in time by `"day"`, `"week"`, `"month"` or `"year"`. */
|
|
449
588
|
group?: GroupFor<Z[K]>;
|
|
450
|
-
} & AggregateProps<Z[K], Z> & ChildrenFor<Z[K], Z>;
|
|
589
|
+
} & AggregateProps<Z[K], Z> & EditOptions<Z[K], Z> & ChildrenFor<Z[K], Z>;
|
|
451
590
|
|
|
452
591
|
/** What can be set as a condition on a field: a list of its values, and for
|
|
453
592
|
numbers and points in time a range as well. */
|
|
@@ -489,7 +628,7 @@ export declare interface Flood {
|
|
|
489
628
|
export declare interface FloodRule {
|
|
490
629
|
windowMs: number;
|
|
491
630
|
/** From how many alarms within the window - across all types, because one
|
|
492
|
-
fault drags nine
|
|
631
|
+
fault drags nine others with it. Reaching it is enough. */
|
|
493
632
|
atLeast: number;
|
|
494
633
|
}
|
|
495
634
|
|
|
@@ -498,7 +637,7 @@ declare type FooterFor<W> = [Present<W>] extends [number] ? "sum" | "avg" : neve
|
|
|
498
637
|
declare type FormatFor<W> = [Present<W>] extends [number] ? NumberFormat : [Present<W>] extends [Date] ? DateFormat : never;
|
|
499
638
|
|
|
500
639
|
/** Frequency per alarm type within the window. Grouped by TYPE, not by
|
|
501
|
-
occurrence - a chattering
|
|
640
|
+
occurrence - a chattering source is one problem, not forty. */
|
|
502
641
|
export declare function frequencyByType(alarms: readonly Alarm[], windowMs: number, asOf: number): Map<string, number>;
|
|
503
642
|
|
|
504
643
|
declare interface GroupByBase {
|
|
@@ -547,12 +686,12 @@ declare interface GroupLevel<Z> {
|
|
|
547
686
|
}
|
|
548
687
|
|
|
549
688
|
/**
|
|
550
|
-
* Has the value come back far enough for
|
|
689
|
+
* Has the value come back far enough for an active alarm to resolve? The value
|
|
551
690
|
* must come back past the return value, not merely past the bound that
|
|
552
691
|
* triggered the alarm - which is why `limit` does not appear in this
|
|
553
692
|
* calculation.
|
|
554
693
|
*
|
|
555
|
-
* The condition of
|
|
694
|
+
* The condition of resolving, not that of raising: that a measured value raises
|
|
556
695
|
* an alarm the caller's process layer decides. It lives here because only this
|
|
557
696
|
* module knows what the alarm just was.
|
|
558
697
|
*
|
|
@@ -562,16 +701,20 @@ export declare const hasReturned: (band: ReturnBand, value: number) => boolean;
|
|
|
562
701
|
|
|
563
702
|
export declare const isAcknowledged: (state: LifecycleState) => boolean;
|
|
564
703
|
|
|
704
|
+
export declare const isActive: (state: LifecycleState) => boolean;
|
|
705
|
+
|
|
565
706
|
declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<W>] extends [Displayable] ? true : false;
|
|
566
707
|
|
|
567
|
-
/**
|
|
708
|
+
/** Resolved and acknowledged: the only position that leaves the list. */
|
|
568
709
|
export declare const isDone: (state: LifecycleState) => boolean;
|
|
569
710
|
|
|
570
|
-
|
|
711
|
+
/** Everything but in service: still in the list, drawn neutrally and counted,
|
|
712
|
+
never removed. "Not absent, only deliberately hidden." */
|
|
713
|
+
export declare const isHidden: (availability: Availability) => boolean;
|
|
571
714
|
|
|
572
|
-
/** One field, four values. `
|
|
715
|
+
/** One field, four values. `resolved-unacknowledged` is the fleeting alarm and the
|
|
573
716
|
reason why no pair of booleans stands here. */
|
|
574
|
-
export declare type LifecycleState = "
|
|
717
|
+
export declare type LifecycleState = "active-unacknowledged" | "active-acknowledged" | "resolved-unacknowledged" | "resolved-acknowledged";
|
|
575
718
|
|
|
576
719
|
/** One line of a grouped table. A header heads a group of an outer level; a row
|
|
577
720
|
of the innermost level stands in its span; a folded span is one line. */
|
|
@@ -603,10 +746,36 @@ declare type Line<Z> = {
|
|
|
603
746
|
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
604
747
|
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
605
748
|
|
|
749
|
+
/** Manual mode: the rows are the page a server answered for the view the table
|
|
750
|
+
reported. The table searches, filters, sorts, groups and pages nothing of
|
|
751
|
+
its own; select all, the export and the footer would act on one page and
|
|
752
|
+
call it the whole, so "select all" says it selects the page, the export
|
|
753
|
+
writes the page and says so, and there is no footer and no grouping. */
|
|
754
|
+
declare interface ManualMode {
|
|
755
|
+
/** Manual mode: the rows are one page a server answered. */
|
|
756
|
+
manual: true;
|
|
757
|
+
/** How many rows the server's filtered set has - the pages and the counts
|
|
758
|
+
read it. */
|
|
759
|
+
rowCount: number;
|
|
760
|
+
/** The view changed where it decides the rows: search, conditions, sort,
|
|
761
|
+
page or page size. Called once when the table first stands and once per
|
|
762
|
+
change, with every one of the five present. */
|
|
763
|
+
onViewChange: (view: ManualView) => void;
|
|
764
|
+
/** The values a list filter offers for a column, `null` for an absent one -
|
|
765
|
+
the table cannot count what it does not hold. */
|
|
766
|
+
filterOptions?: (column: string) => readonly unknown[];
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/** The view as manual mode reports it to `onViewChange`: the parts that decide
|
|
770
|
+
the rows - search, conditions, sort, page and page size - are always there,
|
|
771
|
+
at their default as well. A server has no default of the table's to fall
|
|
772
|
+
back on, and a view it has to complete is one it completes wrongly. */
|
|
773
|
+
export declare type ManualView<K extends string = string> = TableView<K> & Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
774
|
+
|
|
606
775
|
/**
|
|
607
776
|
* The transition as pure calculation.
|
|
608
777
|
*
|
|
609
|
-
* `raised` always leads to `
|
|
778
|
+
* `raised` always leads to `active-unacknowledged`, even out of an
|
|
610
779
|
* acknowledged position: a renewed occurrence of the condition is a new
|
|
611
780
|
* event and demands that somebody see it again.
|
|
612
781
|
*/
|
|
@@ -642,6 +811,8 @@ export declare interface PaginationProps {
|
|
|
642
811
|
of?: TableRef;
|
|
643
812
|
}
|
|
644
813
|
|
|
814
|
+
declare type Pin = "start" | "end";
|
|
815
|
+
|
|
645
816
|
/** The value without the absence - that is what `children` gets. */
|
|
646
817
|
declare type Present<W> = Exclude<W, Absent>;
|
|
647
818
|
|
|
@@ -656,7 +827,7 @@ export declare const PRIORITIES: readonly Priority[];
|
|
|
656
827
|
|
|
657
828
|
This is a DIFFERENT scale from the severity of a limit (which has two), on a
|
|
658
829
|
different object. The mapping between the two is the caller's, in his code,
|
|
659
|
-
where the
|
|
830
|
+
where the application's convention stands. */
|
|
660
831
|
export declare type Priority = "high" | "medium" | "low";
|
|
661
832
|
|
|
662
833
|
/** 0 is the most urgent. Sorted ascending it stands on top. */
|
|
@@ -674,14 +845,14 @@ export declare interface RangeCondition<W> {
|
|
|
674
845
|
it. That is the dead band: it keeps the value sitting on the bound from
|
|
675
846
|
producing a hundred alarms. */
|
|
676
847
|
export declare interface ReturnBand {
|
|
677
|
-
/** `
|
|
678
|
-
`
|
|
679
|
-
direction: "
|
|
848
|
+
/** `upper`: the alarm comes when the value rises above the bound.
|
|
849
|
+
`lower`: it comes when the value falls below it. */
|
|
850
|
+
direction: "upper" | "lower";
|
|
680
851
|
/** The bound that triggered the alarm. Stands here so that the condition is
|
|
681
|
-
described completely in one place - for the decision about
|
|
852
|
+
described completely in one place - for the decision about resolving it is
|
|
682
853
|
expressly not read. */
|
|
683
854
|
limit: number;
|
|
684
|
-
/** The value the reading must come back past before the alarm
|
|
855
|
+
/** The value the reading must come back past before the alarm resolves. */
|
|
685
856
|
returnTo: number;
|
|
686
857
|
}
|
|
687
858
|
|
|
@@ -741,6 +912,21 @@ export declare interface SetFilter<Z> {
|
|
|
741
912
|
<I extends string>(column: I & (I extends Field<Z> ? never : unknown), condition: unknown): void;
|
|
742
913
|
}
|
|
743
914
|
|
|
915
|
+
/** A snooze: a person's own, time-limited decision to take an alarm out of
|
|
916
|
+
the way. */
|
|
917
|
+
export declare interface Snooze {
|
|
918
|
+
/** When it ends, in milliseconds. Reaching it is enough. */
|
|
919
|
+
until: number;
|
|
920
|
+
/** Who snoozed it - a snooze is tracked, not anonymous. */
|
|
921
|
+
by: string;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/** Snoozes an alarm in service, or snoozes anew what is snoozed. A disabled
|
|
925
|
+
or suppressed alarm stays as it is: the stronger removal is not
|
|
926
|
+
overwritten by the weaker one, or the end of the snooze would put an alarm
|
|
927
|
+
disabled for maintenance back in service. */
|
|
928
|
+
export declare function snooze(alarm: Alarm, until: number, by: string): Alarm;
|
|
929
|
+
|
|
744
930
|
export declare type SortDirection = "asc" | "desc";
|
|
745
931
|
|
|
746
932
|
/** One level of the sort. Several levels act in their order: the second decides
|
|
@@ -784,9 +970,18 @@ declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
784
970
|
/** The collation of text keys; the provider's, where there is one. */
|
|
785
971
|
compareText?: (a: string, b: string) => number;
|
|
786
972
|
};
|
|
973
|
+
/** Manual mode: the rows are the page a server answered, and `rowCount` is
|
|
974
|
+
its filtered set. The model then searches, filters, sorts, groups and
|
|
975
|
+
pages nothing - it would do it over one page and call that the whole. */
|
|
976
|
+
manual?: {
|
|
977
|
+
rowCount: number;
|
|
978
|
+
};
|
|
787
979
|
}
|
|
788
980
|
|
|
789
|
-
|
|
981
|
+
/** The options of `useTable`: automatic, or manual over a server. */
|
|
982
|
+
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode | ManualMode);
|
|
983
|
+
|
|
984
|
+
declare interface TableOptionsCommon<Z> {
|
|
790
985
|
/** A stable key per row – the basis of selection and expansion. */
|
|
791
986
|
rowKey: (row: Z) => string;
|
|
792
987
|
/** Default 10. */
|
|
@@ -797,7 +992,7 @@ export declare interface TableOptions<Z> {
|
|
|
797
992
|
outermost first. It is the default that `view` leaves out; without it
|
|
798
993
|
the table is ungrouped until the user groups it. */
|
|
799
994
|
defaultGrouping?: GroupingId<Z> | readonly GroupingId<Z>[];
|
|
800
|
-
/** Which rows the table has at all – by permission, by
|
|
995
|
+
/** Which rows the table has at all – by permission, by tenant, by anything the
|
|
801
996
|
user is not meant to undo. It is invisible: never a condition, never
|
|
802
997
|
reset, never part of the view, and "43 of 1,204" counts only the rows it
|
|
803
998
|
admits. It may stand in the call; a change leaves the page standing, and
|
|
@@ -843,7 +1038,8 @@ export declare interface TableProps<Z> {
|
|
|
843
1038
|
selectable?: boolean;
|
|
844
1039
|
/** Keeps the header row visible while scrolling. */
|
|
845
1040
|
stickyHeader?: boolean;
|
|
846
|
-
/** Keeps the row header column visible while scrolling sideways
|
|
1041
|
+
/** Keeps the row header column visible while scrolling sideways - the same as
|
|
1042
|
+
`pin="start"` on the row header. */
|
|
847
1043
|
stickyRowHeader?: boolean;
|
|
848
1044
|
/** Discreet zebra stripes. */
|
|
849
1045
|
striped?: boolean;
|
|
@@ -865,6 +1061,15 @@ export declare interface TableProps<Z> {
|
|
|
865
1061
|
/** `false`: the user cannot group this table - the column menu offers no
|
|
866
1062
|
grouping, and a grouping handed in is passed over. */
|
|
867
1063
|
groupable?: boolean;
|
|
1064
|
+
/** Grid mode: the table is one tab stop, and the arrows walk its cells -
|
|
1065
|
+
Home and End in the row, Ctrl+Home and Ctrl+End to the table's ends,
|
|
1066
|
+
PageUp and PageDown by the rows in view. A cell's own controls are
|
|
1067
|
+
reached with Enter or F2 and left with Escape; a column with `edit` is
|
|
1068
|
+
edited in place. Without it the table stays a native table. */
|
|
1069
|
+
grid?: boolean;
|
|
1070
|
+
/** Grid mode: an edit the user committed. The table applies nothing; the
|
|
1071
|
+
cell shows the new value when the rows passed in carry it. */
|
|
1072
|
+
onCellEdit?: (edit: CellEdit<Z>) => void;
|
|
868
1073
|
/** Columns, `RowDetail`, `RowActions` and the unbound parts. */
|
|
869
1074
|
children?: ReactNode;
|
|
870
1075
|
}
|
|
@@ -926,6 +1131,10 @@ export declare interface TableSnapshot<Z> {
|
|
|
926
1131
|
order: readonly string[];
|
|
927
1132
|
/** Reorders the columns – on header, body and footer at once. */
|
|
928
1133
|
setOrder: (order: readonly string[]) => void;
|
|
1134
|
+
/** The pinned columns by id - the declared ones until the user chooses. */
|
|
1135
|
+
pinned: Readonly<Record<string, Pin>>;
|
|
1136
|
+
/** Pins a column to the start or the end, or unpins it with `null`. */
|
|
1137
|
+
setPin: (column: string, pin: Pin | null) => void;
|
|
929
1138
|
/** The widths in pixels: those of the columns, and over them the dragged ones. */
|
|
930
1139
|
widths: Readonly<Record<string, number>>;
|
|
931
1140
|
/** Sets the width of a column; `undefined` takes it back. */
|
|
@@ -959,15 +1168,21 @@ export declare interface TableSnapshot<Z> {
|
|
|
959
1168
|
unfoldAll: () => void;
|
|
960
1169
|
/** The part of the state an application can keep; whatever is at its default is absent. */
|
|
961
1170
|
view: TableView;
|
|
962
|
-
/** The filtered set in the visible columns as text for a spreadsheet
|
|
1171
|
+
/** The filtered set in the visible columns as text for a spreadsheet - in
|
|
1172
|
+
manual mode the page. */
|
|
963
1173
|
asCsv: () => string;
|
|
964
1174
|
/** Whether it virtualises. */
|
|
965
1175
|
virtual: boolean;
|
|
1176
|
+
/** How many rows the filtered set has - in manual mode the server's count. */
|
|
1177
|
+
rowCount: number;
|
|
1178
|
+
/** Whether it is in manual mode: the rows are one page of a server's. */
|
|
1179
|
+
manual: boolean;
|
|
966
1180
|
}
|
|
967
1181
|
|
|
968
|
-
/** Search, conditions, sort levels, page, page size, hidden columns, order
|
|
969
|
-
dragged widths
|
|
970
|
-
belongs to it: it is a function of
|
|
1182
|
+
/** Search, conditions, sort levels, page, page size, hidden columns, order,
|
|
1183
|
+
dragged widths, the grouping and the pinned columns. Whatever is at its
|
|
1184
|
+
default is absent. The pre-filter never belongs to it: it is a function of
|
|
1185
|
+
the application. */
|
|
971
1186
|
export declare interface TableView<K extends string = string> {
|
|
972
1187
|
search?: string;
|
|
973
1188
|
/** The conditions of the column filters, per column. A condition for a column
|
|
@@ -984,6 +1199,10 @@ export declare interface TableView<K extends string = string> {
|
|
|
984
1199
|
grouping?: readonly K[];
|
|
985
1200
|
/** The paths of the folded groups. A path that no longer occurs falls out. */
|
|
986
1201
|
folded?: readonly string[];
|
|
1202
|
+
/** The pinned columns, whole, once the user's choice deviates from what the
|
|
1203
|
+
columns declare - `{}` when every declared pin was undone. A column that
|
|
1204
|
+
does not exist falls out. */
|
|
1205
|
+
pinned?: Readonly<Record<string, Pin>>;
|
|
987
1206
|
}
|
|
988
1207
|
|
|
989
1208
|
/** The table toolbar: on the left whatever one puts into it, and the conditions
|
|
@@ -1007,7 +1226,10 @@ export declare interface ToolbarProps {
|
|
|
1007
1226
|
|
|
1008
1227
|
/** What can happen to an alarm. The caller reports the event; what it means the
|
|
1009
1228
|
model knows. */
|
|
1010
|
-
export declare type Transition = "raised" | "acknowledged" | "
|
|
1229
|
+
export declare type Transition = "raised" | "acknowledged" | "resolved";
|
|
1230
|
+
|
|
1231
|
+
/** Ends a snooze before its time. */
|
|
1232
|
+
export declare function unsnooze(alarm: Alarm): Alarm;
|
|
1011
1233
|
|
|
1012
1234
|
export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
|
|
1013
1235
|
|
|
@@ -1043,6 +1265,8 @@ declare interface VerdictBase {
|
|
|
1043
1265
|
width?: number;
|
|
1044
1266
|
/** Shows the drag grip on the header cell. */
|
|
1045
1267
|
resizable?: boolean;
|
|
1268
|
+
/** Keeps the column in view while the table scrolls sideways, before or after every other column. */
|
|
1269
|
+
pin?: Pin;
|
|
1046
1270
|
/** A verdict column has no list filter: four verdicts are filtered through the sort. */
|
|
1047
1271
|
filter?: never;
|
|
1048
1272
|
/** `"worst"`: the worst verdict among the rows – in the footer and in a
|