@umriss-ui/table 0.11.2 → 0.13.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 +129 -0
- package/README.md +9 -6
- package/dist/index.d.ts +264 -125
- package/dist/table.js +2088 -2047
- package/docs/llms-full.md +5838 -2226
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,12 +7,14 @@ import { LimitSet } from '@umriss-ui/core';
|
|
|
7
7
|
import { ReactNode } from 'react';
|
|
8
8
|
import { Wording } from '@umriss-ui/core';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** A value that is not there: `null` or `undefined`. */
|
|
11
|
+
export declare type Absent = null | undefined;
|
|
11
12
|
|
|
12
13
|
/** Acknowledges the named alarms at the named time. Unknown ids are passed
|
|
13
14
|
over, what is already acknowledged stays as it is. */
|
|
14
15
|
export declare function acknowledge(alarms: readonly Alarm[], ids: Iterable<string>, time: number): Acknowledgement;
|
|
15
16
|
|
|
17
|
+
/** What `acknowledge` returns: the alarms afterwards, and how many it changed. */
|
|
16
18
|
export declare interface Acknowledgement {
|
|
17
19
|
alarms: Alarm[];
|
|
18
20
|
/** How many alarms the acknowledgement actually changed. Acknowledging twice
|
|
@@ -28,6 +30,8 @@ declare interface ActionBase {
|
|
|
28
30
|
tone?: "default" | "danger";
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/** The props of `Action`: one action on a row, or with `bulk` on a list of
|
|
34
|
+
rows - then it also stands in the table toolbar for the selection. */
|
|
31
35
|
export declare type ActionProps<Z> = (ActionBase & {
|
|
32
36
|
bulk?: false;
|
|
33
37
|
/** Gets the row the action was triggered on. */
|
|
@@ -41,7 +45,7 @@ export declare type ActionProps<Z> = (ActionBase & {
|
|
|
41
45
|
});
|
|
42
46
|
|
|
43
47
|
/** A column that carries an aggregate, as the pipeline needs it. */
|
|
44
|
-
declare interface AggregateColumn<Z> {
|
|
48
|
+
export declare interface AggregateColumn<Z> {
|
|
45
49
|
id: string;
|
|
46
50
|
read: (row: Z) => unknown;
|
|
47
51
|
aggregate: AggregateKind | OwnAggregate<Z>;
|
|
@@ -50,7 +54,7 @@ declare interface AggregateColumn<Z> {
|
|
|
50
54
|
/** What a column accepts as `aggregate`: sums and averages for numbers, the
|
|
51
55
|
extremes for numbers and points in time, the range for points in time,
|
|
52
56
|
counts for every value with a text form - or a function of one's own. */
|
|
53
|
-
declare type AggregateFor<W, Z> = ([Present<W>] extends [number] ? "sum" | "avg" | "min" | "max" : never) | ([Present<W>] extends [Date] ? "min" | "max" | "range" : never) | (IsDisplayable<W> extends true ? "count" | "distinct" : never) | AggregateFunction<W, Z>;
|
|
57
|
+
export declare type AggregateFor<W, Z> = ([Present<W>] extends [number] ? "sum" | "avg" | "min" | "max" : never) | ([Present<W>] extends [Date] ? "min" | "max" | "range" : never) | (IsDisplayable<W> extends true ? "count" | "distinct" : never) | AggregateFunction<W, Z>;
|
|
54
58
|
|
|
55
59
|
/** An aggregate of one's own: the values present and the rows of the group -
|
|
56
60
|
or of the filtered set, in the footer. Its result runs through the column's
|
|
@@ -59,7 +63,7 @@ export declare type AggregateFunction<W, Z> = (values: readonly Present<NoInfer<
|
|
|
59
63
|
|
|
60
64
|
/** The built-in aggregates. `range` is for points in time: the earliest and
|
|
61
65
|
the latest. */
|
|
62
|
-
declare type AggregateKind = "sum" | "avg" | "min" | "max" | "range" | "count" | "distinct";
|
|
66
|
+
export declare type AggregateKind = "sum" | "avg" | "min" | "max" | "range" | "count" | "distinct";
|
|
63
67
|
|
|
64
68
|
/** What a column's values come to - the props a column carries for it. */
|
|
65
69
|
export declare interface AggregateOptions<W, Z> {
|
|
@@ -104,9 +108,11 @@ declare type AggregateProps<W, Z> = (AggregateOptions<W, Z> & {
|
|
|
104
108
|
export declare type Alarm = AlarmBase & AlarmAvailability;
|
|
105
109
|
|
|
106
110
|
/** The columns with the default labels - for callers without a wording. */
|
|
107
|
-
export declare const ALARM_COLUMNS: readonly
|
|
111
|
+
export declare const ALARM_COLUMNS: readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
/** Whether an alarm is in service, and while it is snoozed until when and by
|
|
114
|
+
whom. */
|
|
115
|
+
export declare type AlarmAvailability = {
|
|
110
116
|
/** Without a statement: in service. */
|
|
111
117
|
availability?: Exclude<Availability, "snoozed">;
|
|
112
118
|
snooze?: undefined;
|
|
@@ -116,7 +122,9 @@ declare type AlarmAvailability = {
|
|
|
116
122
|
snooze: Snooze;
|
|
117
123
|
};
|
|
118
124
|
|
|
119
|
-
|
|
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 {
|
|
120
128
|
id: string;
|
|
121
129
|
/** Id of the alarm type. */
|
|
122
130
|
type: string;
|
|
@@ -141,8 +149,10 @@ export declare type AlarmColumn = "type" | "lifecycle" | "availability" | "prior
|
|
|
141
149
|
* why it comes from the wording: the module is pure and can read no context, so
|
|
142
150
|
* it is given one - like `standardPresets`.
|
|
143
151
|
*/
|
|
144
|
-
export declare const alarmColumns: (wording: Wording) => readonly
|
|
152
|
+
export declare const alarmColumns: (wording: Wording) => readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
145
153
|
|
|
154
|
+
/** The input of `alarmModel`: the alarms, their types, the as-of time, and
|
|
155
|
+
the rules for chatter and floods. */
|
|
146
156
|
export declare interface AlarmInput {
|
|
147
157
|
alarms: readonly Alarm[];
|
|
148
158
|
/** The catalogue of conditions. An alarm whose type is missing is not thrown
|
|
@@ -162,11 +172,17 @@ export declare interface AlarmInput {
|
|
|
162
172
|
/** The columns of the projection; without a statement `ALARM_COLUMNS`.
|
|
163
173
|
Whoever changes the label in the column menu or the CSV header row passes
|
|
164
174
|
`alarmColumns(wording)`. */
|
|
165
|
-
columns?: readonly
|
|
175
|
+
columns?: readonly ModelColumn<AlarmRow, AlarmColumn>[];
|
|
166
176
|
}
|
|
167
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`. */
|
|
168
182
|
export declare function AlarmList(props: AlarmListProps): JSX.Element;
|
|
169
183
|
|
|
184
|
+
/** The props of `AlarmList`: a div's attributes, the projection to show, and
|
|
185
|
+
the hooks for selection, acknowledgement and freshness. */
|
|
170
186
|
export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
171
187
|
/** The projection from `alarmModel`. */
|
|
172
188
|
view: AlarmProjection;
|
|
@@ -184,9 +200,8 @@ export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
184
200
|
them the list shows no freshness – a time without a rule for when it is
|
|
185
201
|
too old is no information. */
|
|
186
202
|
freshness?: FreshnessAges;
|
|
187
|
-
/** "compact" reduces the row height for very dense views.
|
|
188
|
-
|
|
189
|
-
"compact". */
|
|
203
|
+
/** "compact" reduces the row height for very dense views.
|
|
204
|
+
@default the density of the `UmrissProvider`, else `"compact"` */
|
|
190
205
|
density?: "regular" | "compact";
|
|
191
206
|
/** The view of hidden alarms is on. The list does not filter - the
|
|
192
207
|
projection does, with the table's own `filter` and `isHidden`; this
|
|
@@ -207,6 +222,9 @@ export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
207
222
|
*/
|
|
208
223
|
export declare function alarmModel(input: AlarmInput, state?: TableInput<AlarmRow, AlarmColumn>): AlarmProjection;
|
|
209
224
|
|
|
225
|
+
/** What `alarmModel` returns: the table's projection of the alarm rows -
|
|
226
|
+
filtered, sorted, paged -, and beside it the flood and the counts the list
|
|
227
|
+
announces. Give it to `AlarmList` as `view`. */
|
|
210
228
|
export declare interface AlarmProjection extends TableProjection<AlarmRow, AlarmColumn> {
|
|
211
229
|
/** The flood that was detected, when a rule was given and it applies. A
|
|
212
230
|
marking beside the complete list, not a replacement for it. */
|
|
@@ -264,7 +282,7 @@ export declare interface AlarmType {
|
|
|
264
282
|
/** The table holds every row and does the work itself. */
|
|
265
283
|
declare interface AutomaticMode<Z> {
|
|
266
284
|
/** Without it the table holds every row and does the work itself. */
|
|
267
|
-
|
|
285
|
+
server?: false;
|
|
268
286
|
/** Tree rows: the children of a row - `undefined` for a leaf, an array for a
|
|
269
287
|
branch. The rows passed in are then the roots, and every branch gets a
|
|
270
288
|
fold in its row header. Every level sorts on its own, a search shows a
|
|
@@ -275,7 +293,7 @@ declare interface AutomaticMode<Z> {
|
|
|
275
293
|
many levels stand open (`1` = the roots open). It is the default `view` leaves out. */
|
|
276
294
|
defaultBranches?: readonly string[] | number;
|
|
277
295
|
rowCount?: never;
|
|
278
|
-
|
|
296
|
+
onRequest?: never;
|
|
279
297
|
filterOptions?: never;
|
|
280
298
|
}
|
|
281
299
|
|
|
@@ -353,41 +371,25 @@ declare type ChildrenFor<W, Z> = IsDisplayable<W> extends true ? {
|
|
|
353
371
|
children: Presentation<W, Z>;
|
|
354
372
|
};
|
|
355
373
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
Not for the presentation of the header cell: that stays compositional. */
|
|
360
|
-
label?: string;
|
|
361
|
-
/** The value for sorting and searching. `null`, `undefined` and `NaN` are
|
|
362
|
-
absent: they stand last in both directions and match no search. */
|
|
363
|
-
value?: (row: Z) => string | number | null | undefined;
|
|
364
|
-
/** A comparison of one's own; otherwise by the kind of the value. */
|
|
365
|
-
compare?: (a: Z, b: Z) => number;
|
|
366
|
-
/** Takes part in the free-text search (default: no). */
|
|
367
|
-
searchable?: boolean;
|
|
368
|
-
/** May the user switch this column away? Default yes. `false` for columns
|
|
369
|
-
that identify the row – without them the table is no longer
|
|
370
|
-
readable. */
|
|
371
|
-
hideable?: boolean;
|
|
372
|
-
/** May the user drag the width? Default no – a column whose content fits
|
|
373
|
-
anyway needs no grip. */
|
|
374
|
-
resizable?: boolean;
|
|
375
|
-
/** Initial width in pixels; without it the browser decides. */
|
|
376
|
-
width?: number;
|
|
377
|
-
}
|
|
378
|
-
|
|
374
|
+
/** A column preset that fits every table whose rows carry its field: create it
|
|
375
|
+
once, outside the component, and spread it into a `Column`. With more than
|
|
376
|
+
one field in `P`, name the field as the second type argument. */
|
|
379
377
|
export declare function column<P, K extends Field<P> = Field<P>>(preset: ColumnPreset<P, K>): ColumnPreset<P, K>;
|
|
380
378
|
|
|
381
|
-
|
|
379
|
+
/** What every column takes, whatever its value: label, width, pinning and
|
|
380
|
+
what the user may do with it. */
|
|
381
|
+
export declare interface ColumnBase {
|
|
382
382
|
/** Names the column in its header, in the column menu and in the header row of the export. */
|
|
383
383
|
label: string;
|
|
384
384
|
/** This column names the row: row header cells, never hideable, the column
|
|
385
385
|
`stickyRowHeader` pins, and the name by which the row's selection, expander and
|
|
386
386
|
actions are read out. At most one per table. */
|
|
387
387
|
rowHeader?: boolean;
|
|
388
|
-
/** Right-aligned with tabular figures.
|
|
388
|
+
/** Right-aligned with tabular figures.
|
|
389
|
+
@default decided by the first value present */
|
|
389
390
|
numeric?: boolean;
|
|
390
|
-
/** Initial width in pixels
|
|
391
|
+
/** Initial width in pixels.
|
|
392
|
+
@default the browser's */
|
|
391
393
|
width?: number;
|
|
392
394
|
/** Shows the drag grip on the header cell. */
|
|
393
395
|
resizable?: boolean;
|
|
@@ -397,16 +399,22 @@ declare interface ColumnBase {
|
|
|
397
399
|
half of the width the table shows: on a narrower one the end block, then
|
|
398
400
|
the start block scrolls with the rest, and sticks again when there is room. */
|
|
399
401
|
pin?: Pin;
|
|
400
|
-
/**
|
|
402
|
+
/** Whether the column can be sorted by.
|
|
403
|
+
@default `true` when the value is text, a number, a point in time or a boolean */
|
|
401
404
|
sortable?: boolean;
|
|
402
|
-
/** Takes part in the search.
|
|
405
|
+
/** Takes part in the search.
|
|
406
|
+
@default `true` for text, `false` otherwise */
|
|
403
407
|
searchable?: boolean;
|
|
404
|
-
/** Can the table be grouped by this column?
|
|
405
|
-
its value is text, a number, a point in time or a
|
|
406
|
-
`groupValue
|
|
408
|
+
/** Can the table be grouped by this column?
|
|
409
|
+
@default `true` when its value is text, a number, a point in time or a
|
|
410
|
+
boolean, or it has a `groupValue` */
|
|
407
411
|
groupable?: boolean;
|
|
408
412
|
}
|
|
409
413
|
|
|
414
|
+
/** The `Column` of a table, typed at its row: a field column names a field in
|
|
415
|
+
`value`, a computed column a function and an `id`. What it accepts as
|
|
416
|
+
`aggregate`, `filter`, `format` and `edit` follows from the type of its
|
|
417
|
+
value. */
|
|
410
418
|
export declare interface ColumnComponent<Z> {
|
|
411
419
|
<W extends number | Absent>(props: Computed<Z, W> & {
|
|
412
420
|
footer: "sum" | "avg";
|
|
@@ -463,6 +471,9 @@ export declare interface ColumnComponent<Z> {
|
|
|
463
471
|
<K extends Field<Z>>(props: FieldColumn<Z, K>): ReactNode;
|
|
464
472
|
}
|
|
465
473
|
|
|
474
|
+
/** A column filter of one's own, as `columnFilter` makes it: when a value
|
|
475
|
+
satisfies a condition, the control that sets it, and its text in the table
|
|
476
|
+
toolbar. Give it to a column's `filter`. */
|
|
466
477
|
export declare interface ColumnFilter<W, B> {
|
|
467
478
|
/** Whether a value that is present satisfies the condition. Never called for
|
|
468
479
|
an absent value: that satisfies none. */
|
|
@@ -484,8 +495,10 @@ export declare function columnFilter<W, B>(definition: ColumnFilter<W, B>): Colu
|
|
|
484
495
|
focus stays on the button that was pressed. */
|
|
485
496
|
export declare function ColumnMenu({ size: own, of }: ColumnMenuProps): JSX.Element | null;
|
|
486
497
|
|
|
498
|
+
/** The props of `ColumnMenu`. */
|
|
487
499
|
export declare interface ColumnMenuProps {
|
|
488
|
-
/**
|
|
500
|
+
/** The size of the part: `sm` or `md`.
|
|
501
|
+
@default the size of the toolbar it stands in, `"sm"` outside one */
|
|
489
502
|
size?: ToolbarSize;
|
|
490
503
|
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
491
504
|
of?: TableRef;
|
|
@@ -494,7 +507,9 @@ export declare interface ColumnMenuProps {
|
|
|
494
507
|
/** The properties of a column, as `column()` supplies them. */
|
|
495
508
|
export declare type ColumnPreset<P, K extends Field<P> = Field<P>> = FieldColumn<P, K>;
|
|
496
509
|
|
|
497
|
-
|
|
510
|
+
/** A computed column's props: its value is a function of the row, so it needs
|
|
511
|
+
an `id`. */
|
|
512
|
+
export declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
498
513
|
/** The id is required where the value is a function. */
|
|
499
514
|
id: string;
|
|
500
515
|
value: (row: Z) => W;
|
|
@@ -504,7 +519,8 @@ declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
|
504
519
|
filter?: "list" | "range" | ColumnFilter<Present<W>, any>;
|
|
505
520
|
/** Edits the column's cells in place in grid mode - see a field column's `edit`. */
|
|
506
521
|
edit?: "text" | "number" | "select" | "date" | ((editor: CellEditorProps<W, Z>) => ReactNode);
|
|
507
|
-
/** What `edit="select"` offers
|
|
522
|
+
/** What `edit="select"` offers.
|
|
523
|
+
@default the values that occur */
|
|
508
524
|
editOptions?: readonly Present<W>[];
|
|
509
525
|
/** Checks a draft before it is reported; a message keeps the editor open. */
|
|
510
526
|
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
@@ -522,7 +538,8 @@ export declare const countInWindow: (times: readonly number[], windowMs: number,
|
|
|
522
538
|
/** The names of the standard presentations of a point in time. */
|
|
523
539
|
export declare type DateFormat = "date" | "time" | "dateTime";
|
|
524
540
|
|
|
525
|
-
|
|
541
|
+
/** The span a point in time is grouped by. */
|
|
542
|
+
export declare type DatePeriod = "day" | "week" | "month" | "year";
|
|
526
543
|
|
|
527
544
|
/** In service before hidden, then priority, then acknowledgement, then time -
|
|
528
545
|
the worst first, not the newest. As levels of the existing multi-level
|
|
@@ -534,6 +551,12 @@ declare type DatePeriod = "day" | "week" | "month" | "year";
|
|
|
534
551
|
take the first glance from the alarm nobody has decided about. */
|
|
535
552
|
export declare const DEFAULT_ORDER: readonly SortLevel<AlarmColumn>[];
|
|
536
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Is there a flood in the window before the as-of time? Pure calculation over
|
|
556
|
+
* timestamps, with window, threshold and as-of time as parameters.
|
|
557
|
+
* @returns The flood, or `null` when fewer alarms than the rule's `atLeast`
|
|
558
|
+
* were raised in its window.
|
|
559
|
+
*/
|
|
537
560
|
export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, asOf: number): Flood | null;
|
|
538
561
|
|
|
539
562
|
/** Disables an alarm - from service or from a snooze. A suppressed alarm
|
|
@@ -542,7 +565,7 @@ export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, a
|
|
|
542
565
|
export declare function disable(alarm: Alarm): Alarm;
|
|
543
566
|
|
|
544
567
|
/** What can appear as text without `children`. */
|
|
545
|
-
declare type Displayable = string | number | boolean | Date;
|
|
568
|
+
export declare type Displayable = string | number | boolean | Date;
|
|
546
569
|
|
|
547
570
|
/** What a column accepts as `edit`: the core field for its value - `"text"`
|
|
548
571
|
for text, `"number"` for numbers, `"date"` for points in time, `"select"`
|
|
@@ -555,7 +578,8 @@ export declare interface EditOptions<W, Z> {
|
|
|
555
578
|
starts it, Enter or Tab commits, Escape cancels. The table applies
|
|
556
579
|
nothing - the edit is reported through the table's `onCellEdit`. */
|
|
557
580
|
edit?: EditFor<W, Z>;
|
|
558
|
-
/** What `edit="select"` offers
|
|
581
|
+
/** What `edit="select"` offers.
|
|
582
|
+
@default the values that occur */
|
|
559
583
|
editOptions?: readonly Present<W>[];
|
|
560
584
|
/** Checks a draft before it is reported: a message keeps the editor open
|
|
561
585
|
and stands beneath the field, as in a `FormField`; nothing lets it
|
|
@@ -568,16 +592,20 @@ export declare interface EditOptions<W, Z> {
|
|
|
568
592
|
export declare function enable(alarm: Alarm): Alarm;
|
|
569
593
|
|
|
570
594
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
571
|
-
values, not with their presentation. In
|
|
595
|
+
values, not with their presentation. In server mode the table holds one
|
|
572
596
|
page of the server's, so it writes that page, and its button says so. */
|
|
573
597
|
export declare function Export({ filename, onExport, size: own, of }: ExportProps): JSX.Element | null;
|
|
574
598
|
|
|
599
|
+
/** The props of `Export`: by default a CSV file is downloaded; with
|
|
600
|
+
`onExport` the text is handed over instead. */
|
|
575
601
|
export declare interface ExportProps {
|
|
576
|
-
/** File name of the download.
|
|
602
|
+
/** File name of the download.
|
|
603
|
+
@default the wording's "table.csv" */
|
|
577
604
|
filename?: string;
|
|
578
605
|
/** Gets the text instead of triggering a file. */
|
|
579
606
|
onExport?: (text: string) => void;
|
|
580
|
-
/**
|
|
607
|
+
/** The size of the part: `sm` or `md`.
|
|
608
|
+
@default the size of the toolbar it stands in, `"sm"` outside one */
|
|
581
609
|
size?: ToolbarSize;
|
|
582
610
|
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
583
611
|
of?: TableRef;
|
|
@@ -586,7 +614,10 @@ export declare interface ExportProps {
|
|
|
586
614
|
/** The field names of a row. */
|
|
587
615
|
export declare type Field<Z> = Extract<keyof Z, string>;
|
|
588
616
|
|
|
589
|
-
|
|
617
|
+
/** The props of a column over a field `K` of the row `Z`: what every column
|
|
618
|
+
takes, and what the field's value decides - its format, filter, grouping,
|
|
619
|
+
aggregate and editing. */
|
|
620
|
+
export declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths<Z[K]> & {
|
|
590
621
|
/** A field of the row. Supplies the column's `id` at the same time. */
|
|
591
622
|
value: K;
|
|
592
623
|
/** An id of one's own instead of the field name – for two columns over the same field. */
|
|
@@ -611,8 +642,10 @@ export declare type FieldCondition<W> = ListCondition<W> | ([Present<W>] extends
|
|
|
611
642
|
/** What a column accepts as `filter`: `"list"` for every value with a text
|
|
612
643
|
form, `"range"` for numbers and points in time, a filter from `columnFilter`
|
|
613
644
|
only where its value type fits. */
|
|
614
|
-
declare type FilterFor<W> = (IsDisplayable<W> extends true ? "list" : never) | ([Present<W>] extends [number] ? "range" : [Present<W>] extends [Date] ? "range" : never) | ColumnFilter<Present<W>, any>;
|
|
645
|
+
export declare type FilterFor<W> = (IsDisplayable<W> extends true ? "list" : never) | ([Present<W>] extends [number] ? "range" : [Present<W>] extends [Date] ? "range" : never) | ColumnFilter<Present<W>, any>;
|
|
615
646
|
|
|
647
|
+
/** What the `Input` of a filter of one's own receives: the condition, its
|
|
648
|
+
setter, and the values the column holds. */
|
|
616
649
|
export declare interface FilterInputProps<W, B> {
|
|
617
650
|
/** The condition that holds right now; `null` as long as the filter requires nothing. */
|
|
618
651
|
condition: B | null;
|
|
@@ -648,15 +681,20 @@ export declare interface FloodRule {
|
|
|
648
681
|
atLeast: number;
|
|
649
682
|
}
|
|
650
683
|
|
|
651
|
-
|
|
684
|
+
/** What the old `footer` accepts: `"sum"` and `"avg"` for numbers, nothing
|
|
685
|
+
for every other value. */
|
|
686
|
+
export declare type FooterFor<W> = [Present<W>] extends [number] ? "sum" | "avg" : never;
|
|
652
687
|
|
|
653
|
-
|
|
688
|
+
/** What a column accepts as `format`: a number format for numbers, a date
|
|
689
|
+
format for points in time, nothing for every other value. */
|
|
690
|
+
export declare type FormatFor<W> = [Present<W>] extends [number] ? NumberFormat : [Present<W>] extends [Date] ? DateFormat : never;
|
|
654
691
|
|
|
655
692
|
/** Frequency per alarm type within the window. Grouped by TYPE, not by
|
|
656
693
|
occurrence - a chattering source is one problem, not forty. */
|
|
657
694
|
export declare function frequencyByType(alarms: readonly Alarm[], windowMs: number, asOf: number): Map<string, number>;
|
|
658
695
|
|
|
659
|
-
|
|
696
|
+
/** What every group key takes, whatever its value. */
|
|
697
|
+
export declare interface GroupByBase {
|
|
660
698
|
/** Names the group key where a grouping is chosen, and in the grouping's tag in the table toolbar. */
|
|
661
699
|
label: string;
|
|
662
700
|
}
|
|
@@ -682,7 +720,7 @@ export declare interface GroupByComponent<Z> {
|
|
|
682
720
|
|
|
683
721
|
/** `group` on a point in time: its rows are grouped by day, ISO week, month or
|
|
684
722
|
year. */
|
|
685
|
-
declare type GroupFor<W> = [Present<W>] extends [Date] ? DatePeriod : never;
|
|
723
|
+
export declare type GroupFor<W> = [Present<W>] extends [Date] ? DatePeriod : never;
|
|
686
724
|
|
|
687
725
|
/** A column or group key the table can be grouped by. The columns stand in the
|
|
688
726
|
JSX, which the hook does not see: a field name is suggested, any id is
|
|
@@ -690,7 +728,7 @@ declare type GroupFor<W> = [Present<W>] extends [Date] ? DatePeriod : never;
|
|
|
690
728
|
export declare type GroupingId<Z> = Field<Z> | (string & {});
|
|
691
729
|
|
|
692
730
|
/** One level of the grouping: what a row is grouped by on it. */
|
|
693
|
-
declare interface GroupLevel<Z> {
|
|
731
|
+
export declare interface GroupLevel<Z> {
|
|
694
732
|
id: string;
|
|
695
733
|
/** The grouping value - the column's value, or what `groupValue` or a date
|
|
696
734
|
period made of it. Absent values form one group of their own. */
|
|
@@ -715,11 +753,16 @@ declare interface GroupLevel<Z> {
|
|
|
715
753
|
*/
|
|
716
754
|
export declare const hasReturned: (band: ReturnBand, value: number) => boolean;
|
|
717
755
|
|
|
756
|
+
/** Whether someone has acknowledged the alarm, active or resolved. */
|
|
718
757
|
export declare const isAcknowledged: (state: LifecycleState) => boolean;
|
|
719
758
|
|
|
759
|
+
/** Whether the condition still holds: active, acknowledged or not. */
|
|
720
760
|
export declare const isActive: (state: LifecycleState) => boolean;
|
|
721
761
|
|
|
722
|
-
|
|
762
|
+
/** `true` where the value present can appear as text without `children`
|
|
763
|
+
(`Displayable`), `false` otherwise - what decides the filters and
|
|
764
|
+
aggregates a column offers. */
|
|
765
|
+
export declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<W>] extends [Displayable] ? true : false;
|
|
723
766
|
|
|
724
767
|
/** Resolved and acknowledged: the only position that leaves the list. */
|
|
725
768
|
export declare const isDone: (state: LifecycleState) => boolean;
|
|
@@ -762,34 +805,34 @@ declare type Line<Z> = {
|
|
|
762
805
|
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
763
806
|
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
764
807
|
|
|
765
|
-
/**
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
808
|
+
/** A column as the model reads it - what sorting, search, hiding and the
|
|
809
|
+
export need of it, not its presentation. `alarmModel` takes them, and
|
|
810
|
+
`ALARM_COLUMNS` are the alarm list's. */
|
|
811
|
+
export declare interface ModelColumn<Z, K extends string = string> {
|
|
812
|
+
id: K;
|
|
813
|
+
/** Human-readable label – for the column menu and the CSV header row.
|
|
814
|
+
Not for the presentation of the header cell: that stays compositional. */
|
|
815
|
+
label?: string;
|
|
816
|
+
/** The value for sorting and searching. `null`, `undefined` and `NaN` are
|
|
817
|
+
absent: they stand last in both directions and match no search. */
|
|
818
|
+
value?: (row: Z) => string | number | null | undefined;
|
|
819
|
+
/** A comparison of one's own; otherwise by the kind of the value. */
|
|
820
|
+
compare?: (a: Z, b: Z) => number;
|
|
821
|
+
/** Takes part in the free-text search.
|
|
822
|
+
@default false */
|
|
823
|
+
searchable?: boolean;
|
|
824
|
+
/** May the user switch this column away? `false` for columns that identify
|
|
825
|
+
the row – without them the table is no longer readable.
|
|
826
|
+
@default true */
|
|
827
|
+
hideable?: boolean;
|
|
828
|
+
/** May the user drag the width? A column whose content fits anyway needs
|
|
829
|
+
no grip.
|
|
830
|
+
@default false */
|
|
831
|
+
resizable?: boolean;
|
|
832
|
+
/** Initial width in pixels; without it the browser decides. */
|
|
833
|
+
width?: number;
|
|
785
834
|
}
|
|
786
835
|
|
|
787
|
-
/** The view as manual mode reports it to `onViewChange`: the parts that decide
|
|
788
|
-
the rows - search, conditions, sort, page and page size - are always there,
|
|
789
|
-
at their default as well. A server has no default of the table's to fall
|
|
790
|
-
back on, and a view it has to complete is one it completes wrongly. */
|
|
791
|
-
export declare type ManualView<K extends string = string> = TableView<K> & Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
792
|
-
|
|
793
836
|
/**
|
|
794
837
|
* The transition as pure calculation.
|
|
795
838
|
*
|
|
@@ -800,7 +843,7 @@ export declare type ManualView<K extends string = string> = TableView<K> & Requi
|
|
|
800
843
|
export declare function nextLifecycleState(state: LifecycleState, transition: Transition): LifecycleState;
|
|
801
844
|
|
|
802
845
|
/** The field names whose value is a number or may be absent. */
|
|
803
|
-
declare type NumberField<Z> = {
|
|
846
|
+
export declare type NumberField<Z> = {
|
|
804
847
|
[K in Field<Z>]: Z[K] extends number | Absent ? K : never;
|
|
805
848
|
}[Field<Z>];
|
|
806
849
|
|
|
@@ -810,7 +853,7 @@ export declare type NumberFormat = "percent" | "count" | {
|
|
|
810
853
|
};
|
|
811
854
|
|
|
812
855
|
/** An aggregate of one's own: the values present and the group's rows. */
|
|
813
|
-
declare type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readonly Z[]) => unknown;
|
|
856
|
+
export declare type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readonly Z[]) => unknown;
|
|
814
857
|
|
|
815
858
|
/** The pagination bar. Inside the table it stands underneath it, wherever it
|
|
816
859
|
stands in the JSX; a virtualised table does not page, and then it is not
|
|
@@ -820,8 +863,9 @@ declare type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readon
|
|
|
820
863
|
after the first frame. */
|
|
821
864
|
export declare function Pagination({ pageSizes, className, of }: PaginationProps): JSX.Element | null;
|
|
822
865
|
|
|
866
|
+
/** The props of `Pagination`. */
|
|
823
867
|
export declare interface PaginationProps {
|
|
824
|
-
/** The selectable page sizes
|
|
868
|
+
/** The selectable page sizes. */
|
|
825
869
|
pageSizes?: readonly number[];
|
|
826
870
|
/** Classes on the pagination bar. */
|
|
827
871
|
className?: string;
|
|
@@ -829,12 +873,14 @@ export declare interface PaginationProps {
|
|
|
829
873
|
of?: TableRef;
|
|
830
874
|
}
|
|
831
875
|
|
|
832
|
-
|
|
876
|
+
/** Where a pinned column stands: in the block before or after the others. */
|
|
877
|
+
export declare type Pin = "start" | "end";
|
|
833
878
|
|
|
834
879
|
/** The value without the absence - that is what `children` gets. */
|
|
835
|
-
declare type Present<W> = Exclude<W, Absent>;
|
|
880
|
+
export declare type Present<W> = Exclude<W, Absent>;
|
|
836
881
|
|
|
837
|
-
|
|
882
|
+
/** What a column draws in a cell: the value present and its row. */
|
|
883
|
+
export declare type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;
|
|
838
884
|
|
|
839
885
|
/** From the most urgent to the last - the order of the scale. */
|
|
840
886
|
export declare const PRIORITIES: readonly Priority[];
|
|
@@ -874,9 +920,16 @@ export declare interface ReturnBand {
|
|
|
874
920
|
returnTo: number;
|
|
875
921
|
}
|
|
876
922
|
|
|
923
|
+
/** The props of `RowActions`: the `Action`s of each row, in its menu. */
|
|
877
924
|
export declare interface RowActionsProps {
|
|
878
925
|
/** The row's `Action`s. */
|
|
879
926
|
children: ReactNode;
|
|
927
|
+
/** Whether the actions column sticks at the end of the row while the table
|
|
928
|
+
scrolls sideways. `false` leaves it in the flow, for a place too narrow
|
|
929
|
+
for a pinned block - the application decides, by its own measure. A
|
|
930
|
+
column pinned to the end takes the actions with it regardless.
|
|
931
|
+
@default true */
|
|
932
|
+
pin?: boolean;
|
|
880
933
|
}
|
|
881
934
|
|
|
882
935
|
/** A new row the user saved: every column that edits, by column id. */
|
|
@@ -897,13 +950,16 @@ export declare interface RowDelete<Z> {
|
|
|
897
950
|
row: Z;
|
|
898
951
|
}
|
|
899
952
|
|
|
953
|
+
/** The props of `RowDetail`: what an expanded row shows underneath it. */
|
|
900
954
|
export declare interface RowDetailProps<Z> {
|
|
901
955
|
/** What stands underneath an expanded row. */
|
|
902
956
|
children: (row: Z) => ReactNode;
|
|
903
957
|
}
|
|
904
958
|
|
|
959
|
+
/** A row filter, as `rowFilter` makes it: a condition over the whole row
|
|
960
|
+
that a control of the application sets through `setFilter`. */
|
|
905
961
|
export declare interface RowFilter<Z, B> {
|
|
906
|
-
/** Its name in `t.view.conditions` and in what
|
|
962
|
+
/** Its name in `t.view.conditions` and in what server mode reports - the one
|
|
907
963
|
place the filter is spelled. Not the id of a column of the same table. */
|
|
908
964
|
readonly id: string;
|
|
909
965
|
/** What it is called: before the text of its chip, and in the chip's
|
|
@@ -923,7 +979,7 @@ export declare interface RowFilter<Z, B> {
|
|
|
923
979
|
export declare function rowFilter<Z, B>(definition: RowFilter<Z, B>): RowFilter<Z, B>;
|
|
924
980
|
|
|
925
981
|
/** The rows of the filtered set that share one grouping value on one level. */
|
|
926
|
-
declare interface RowGroup<Z> {
|
|
982
|
+
export declare interface RowGroup<Z> {
|
|
927
983
|
/** Identifies the group across renders and in the view: the keys of its
|
|
928
984
|
path, outermost first. */
|
|
929
985
|
path: string;
|
|
@@ -946,21 +1002,51 @@ export declare interface RowSave<Z> {
|
|
|
946
1002
|
row: Z;
|
|
947
1003
|
}
|
|
948
1004
|
|
|
1005
|
+
/** The table's search field: one text over every column that searches, in
|
|
1006
|
+
the table toolbar. With a search the table puts up a toolbar of its own
|
|
1007
|
+
where none stands. Outside the table it needs `of`. */
|
|
949
1008
|
export declare function Search({ placeholder, "aria-label": name, className, size: own, of }: SearchProps): JSX.Element | null;
|
|
950
1009
|
|
|
1010
|
+
/** The props of `Search`. */
|
|
951
1011
|
export declare interface SearchProps {
|
|
952
|
-
/** The placeholder in the field
|
|
1012
|
+
/** The placeholder in the field.
|
|
1013
|
+
@default the wording's "Search …" */
|
|
953
1014
|
placeholder?: string;
|
|
954
|
-
/** Accessible name
|
|
1015
|
+
/** Accessible name.
|
|
1016
|
+
@default the wording's "Search table" */
|
|
955
1017
|
"aria-label"?: string;
|
|
956
1018
|
/** Classes on the field. */
|
|
957
1019
|
className?: string;
|
|
958
|
-
/**
|
|
1020
|
+
/** The size of the part: `sm` or `md`.
|
|
1021
|
+
@default the size of the toolbar it stands in, `"sm"` outside one */
|
|
959
1022
|
size?: ToolbarSize;
|
|
960
1023
|
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
961
1024
|
of?: TableRef;
|
|
962
1025
|
}
|
|
963
1026
|
|
|
1027
|
+
/** Server mode: the rows are the page a server answered for the request the
|
|
1028
|
+
table reported. The table searches, filters, sorts, groups and pages nothing of
|
|
1029
|
+
its own; select all, the export and the footer would act on one page and
|
|
1030
|
+
call it the whole, so "select all" says it selects the page, the export
|
|
1031
|
+
writes the page and says so, and there is no footer and no grouping. */
|
|
1032
|
+
declare interface ServerMode {
|
|
1033
|
+
/** Server mode: the rows are one page a server answered. */
|
|
1034
|
+
server: true;
|
|
1035
|
+
childRows?: never;
|
|
1036
|
+
defaultBranches?: never;
|
|
1037
|
+
/** How many rows the server's filtered set has - the pages and the counts
|
|
1038
|
+
read it. */
|
|
1039
|
+
rowCount: number;
|
|
1040
|
+
/** The request changed: search, conditions, sort, page or page size. Called
|
|
1041
|
+
once when the table first stands and once per change, with every one of
|
|
1042
|
+
the five present - a width, an order, a pin, a fold or a hidden column
|
|
1043
|
+
asks the server nothing; `onViewChange` hears those. */
|
|
1044
|
+
onRequest: (request: TableRequest) => void;
|
|
1045
|
+
/** The values a list filter offers for a column, `null` for an absent one -
|
|
1046
|
+
the table cannot count what it does not hold. */
|
|
1047
|
+
filterOptions?: (column: string) => readonly unknown[];
|
|
1048
|
+
}
|
|
1049
|
+
|
|
964
1050
|
/** Sets a condition from outside. Typed at the field of the row, not at the
|
|
965
1051
|
column: the columns stand in the JSX, and the hook does not see that
|
|
966
1052
|
(ADR-0017). An id that is not a field name – a computed column or an `id` of
|
|
@@ -987,6 +1073,8 @@ export declare interface Snooze {
|
|
|
987
1073
|
disabled for maintenance back in service. */
|
|
988
1074
|
export declare function snooze(alarm: Alarm, until: number, by: string): Alarm;
|
|
989
1075
|
|
|
1076
|
+
/** The direction of one sort level: `asc` puts the smallest value on top,
|
|
1077
|
+
`desc` the largest. */
|
|
990
1078
|
export declare type SortDirection = "asc" | "desc";
|
|
991
1079
|
|
|
992
1080
|
/** One level of the sort. Several levels act in their order: the second decides
|
|
@@ -996,6 +1084,8 @@ export declare interface SortLevel<K extends string = string> {
|
|
|
996
1084
|
direction: SortDirection;
|
|
997
1085
|
}
|
|
998
1086
|
|
|
1087
|
+
/** What `useTable` returns: the table's state, and its parts typed at the
|
|
1088
|
+
row. Pass it as `of` to a part that stands outside the table. */
|
|
999
1089
|
export declare interface Table<Z> extends TableSnapshot<Z> {
|
|
1000
1090
|
Table: (props: TableProps<Z>) => ReactNode;
|
|
1001
1091
|
Column: ColumnComponent<Z>;
|
|
@@ -1006,7 +1096,9 @@ export declare interface Table<Z> extends TableSnapshot<Z> {
|
|
|
1006
1096
|
GroupBy: GroupByComponent<Z>;
|
|
1007
1097
|
}
|
|
1008
1098
|
|
|
1009
|
-
|
|
1099
|
+
/** The view's state the model computes a table from, beside its rows and
|
|
1100
|
+
columns: search, filter, sort, page, hidden columns, order, grouping, tree. */
|
|
1101
|
+
export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
1010
1102
|
search?: string;
|
|
1011
1103
|
/** An additional filter beside the free-text search, e.g. a status choice. */
|
|
1012
1104
|
filter?: (row: Z) => boolean;
|
|
@@ -1030,10 +1122,10 @@ declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1030
1122
|
/** The collation of text keys; the provider's, where there is one. */
|
|
1031
1123
|
compareText?: (a: string, b: string) => number;
|
|
1032
1124
|
};
|
|
1033
|
-
/**
|
|
1125
|
+
/** Server mode: the rows are the page a server answered, and `rowCount` is
|
|
1034
1126
|
its filtered set. The model then searches, filters, sorts, groups and
|
|
1035
1127
|
pages nothing - it would do it over one page and call that the whole. */
|
|
1036
|
-
|
|
1128
|
+
server?: {
|
|
1037
1129
|
rowCount: number;
|
|
1038
1130
|
};
|
|
1039
1131
|
/** Tree rows: the rows are the roots, and these read their children. The
|
|
@@ -1042,19 +1134,21 @@ declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1042
1134
|
tree?: TreeInput<Z>;
|
|
1043
1135
|
}
|
|
1044
1136
|
|
|
1045
|
-
/** The options of `useTable`: automatic, or
|
|
1046
|
-
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> |
|
|
1137
|
+
/** The options of `useTable`: automatic, or in server mode over a server's rows. */
|
|
1138
|
+
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> | ServerMode);
|
|
1047
1139
|
|
|
1048
1140
|
declare interface TableOptionsCommon<Z> {
|
|
1049
1141
|
/** A stable key per row – the basis of selection and expansion. */
|
|
1050
1142
|
rowKey: (row: Z) => string;
|
|
1051
|
-
/**
|
|
1143
|
+
/** How many rows a page holds.
|
|
1144
|
+
@default 10 */
|
|
1052
1145
|
pageSize?: number;
|
|
1053
|
-
/** The application's sort; it is the default that `view` leaves out.
|
|
1146
|
+
/** The application's sort; it is the default that `view` leaves out.
|
|
1147
|
+
@default null */
|
|
1054
1148
|
defaultSort?: SortLevel | readonly SortLevel[] | null;
|
|
1055
1149
|
/** The application's grouping: a column or group key, or up to three, the
|
|
1056
|
-
outermost first. It is the default that `view` leaves out
|
|
1057
|
-
|
|
1150
|
+
outermost first. It is the default that `view` leaves out.
|
|
1151
|
+
@default ungrouped, until the user groups */
|
|
1058
1152
|
defaultGrouping?: GroupingId<Z> | readonly GroupingId<Z>[];
|
|
1059
1153
|
/** Which rows the table has at all – by permission, by tenant, by anything the
|
|
1060
1154
|
user is not meant to undo. It is invisible: never a condition, never
|
|
@@ -1070,9 +1164,17 @@ declare interface TableOptionsCommon<Z> {
|
|
|
1070
1164
|
control of its own. Named here so that a condition from `initialView`,
|
|
1071
1165
|
which arrives by id, is known in the first render. */
|
|
1072
1166
|
rowFilters?: readonly RowFilter<Z, any>[];
|
|
1073
|
-
/** The view
|
|
1074
|
-
|
|
1167
|
+
/** The view to start from, and to go to whenever one differing in content
|
|
1168
|
+
from the last is handed in - the same view again changes nothing, and
|
|
1169
|
+
what it leaves out is reset; one the table reported itself, handed back
|
|
1170
|
+
late, is its own state coming back and not gone to. The table remembers
|
|
1171
|
+
none: where a view is kept is the application's decision. Names no
|
|
1172
|
+
column carries fall out. */
|
|
1075
1173
|
initialView?: TableView;
|
|
1174
|
+
/** Every change of the view, once, always the whole view - the one to keep,
|
|
1175
|
+
or to hand another table as its `initialView`. Not called for the view
|
|
1176
|
+
the table starts with. */
|
|
1177
|
+
onViewChange?: (view: TableView) => void;
|
|
1076
1178
|
/** Renders only what stands in the scroll area; paging is then off. Every
|
|
1077
1179
|
row is one row pitch tall, which the table measures itself (ADR-0042). */
|
|
1078
1180
|
virtual?: boolean | {
|
|
@@ -1085,7 +1187,7 @@ declare interface TableOptionsCommon<Z> {
|
|
|
1085
1187
|
declare interface TableProjection<Z, K extends string = string> {
|
|
1086
1188
|
/** The visible columns in their order – the basis for the header row, the
|
|
1087
1189
|
column menu and the CSV export. */
|
|
1088
|
-
columns: readonly
|
|
1190
|
+
columns: readonly ModelColumn<Z, K>[];
|
|
1089
1191
|
/** Everything the filter leaves – the basis for figures and the selection. */
|
|
1090
1192
|
filtered: Z[];
|
|
1091
1193
|
/** Only the current page - with a grouping, the rows among its lines. */
|
|
@@ -1116,6 +1218,8 @@ declare interface TableProjection<Z, K extends string = string> {
|
|
|
1116
1218
|
columnCount: number;
|
|
1117
1219
|
}
|
|
1118
1220
|
|
|
1221
|
+
/** The props of `Table`: how the table looks and behaves. Its state comes from
|
|
1222
|
+
`useTable`, its columns from the JSX inside it. */
|
|
1119
1223
|
export declare interface TableProps<Z> {
|
|
1120
1224
|
/** Adds the selection column. "All" means: the filtered set. */
|
|
1121
1225
|
selectable?: boolean;
|
|
@@ -1126,7 +1230,8 @@ export declare interface TableProps<Z> {
|
|
|
1126
1230
|
stickyRowHeader?: boolean;
|
|
1127
1231
|
/** Discreet zebra stripes. */
|
|
1128
1232
|
striped?: boolean;
|
|
1129
|
-
/**
|
|
1233
|
+
/** How tightly the rows stand.
|
|
1234
|
+
@default the density of the `UmrissProvider`, else `"regular"` */
|
|
1130
1235
|
density?: "regular" | "compact";
|
|
1131
1236
|
/** Height of the scroll area, e.g. "480px". A virtualised table needs it. */
|
|
1132
1237
|
maxHeight?: string;
|
|
@@ -1182,6 +1287,16 @@ export declare type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "condi
|
|
|
1182
1287
|
setFilter(column: string, condition: unknown): void;
|
|
1183
1288
|
};
|
|
1184
1289
|
|
|
1290
|
+
/** The request server mode reports to `onRequest`: the parts of the view that
|
|
1291
|
+
decide the rows - search, conditions, sort, page and page size - and
|
|
1292
|
+
nothing else, each at its default as well. A server has no default of the
|
|
1293
|
+
table's to fall back on, and a request it has to complete is one it
|
|
1294
|
+
completes wrongly. A width, an order, a pin or a fold is no part of it. */
|
|
1295
|
+
export declare type TableRequest<K extends string = string> = Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
1296
|
+
|
|
1297
|
+
/** What `useTableSelection` returns: the selected keys and the gestures on
|
|
1298
|
+
them. Give it to `useTable` as `selection` when the application holds the
|
|
1299
|
+
selection. */
|
|
1185
1300
|
export declare interface TableSelection<T extends string | number> {
|
|
1186
1301
|
/** The keys currently selected. */
|
|
1187
1302
|
selected: ReadonlySet<T>;
|
|
@@ -1277,17 +1392,18 @@ export declare interface TableSnapshot<Z> {
|
|
|
1277
1392
|
unfoldAllBranches: () => void;
|
|
1278
1393
|
/** Tree rows: closes every branch. */
|
|
1279
1394
|
foldAllBranches: () => void;
|
|
1280
|
-
/** The part of the state an application can keep; whatever
|
|
1395
|
+
/** The part of the state an application can keep; whatever still stands as
|
|
1396
|
+
the options set it up is absent. */
|
|
1281
1397
|
view: TableView;
|
|
1282
1398
|
/** The filtered set in the visible columns as text for a spreadsheet - in
|
|
1283
|
-
|
|
1399
|
+
server mode the page. */
|
|
1284
1400
|
asCsv: () => string;
|
|
1285
1401
|
/** Whether it virtualises. */
|
|
1286
1402
|
virtual: boolean;
|
|
1287
|
-
/** How many rows the filtered set has - in
|
|
1403
|
+
/** How many rows the filtered set has - in server mode the server's count. */
|
|
1288
1404
|
rowCount: number;
|
|
1289
|
-
/** Whether it is in
|
|
1290
|
-
|
|
1405
|
+
/** Whether it is in server mode: the rows are one page of a server's. */
|
|
1406
|
+
server: boolean;
|
|
1291
1407
|
}
|
|
1292
1408
|
|
|
1293
1409
|
/** Search, conditions, sort levels, page, page size, hidden columns, order,
|
|
@@ -1325,13 +1441,14 @@ export declare interface TableView<K extends string = string> {
|
|
|
1325
1441
|
has one, even where none stands; where one stands, there is no second. */
|
|
1326
1442
|
export declare function Toolbar({ children, className, size, of }: ToolbarProps): JSX.Element;
|
|
1327
1443
|
|
|
1444
|
+
/** The props of `Toolbar`. */
|
|
1328
1445
|
export declare interface ToolbarProps {
|
|
1329
1446
|
/** Search, column menu, export – on the left in the table toolbar, before the conditions. */
|
|
1330
1447
|
children?: ReactNode;
|
|
1331
1448
|
/** Classes on the table toolbar. */
|
|
1332
1449
|
className?: string;
|
|
1333
1450
|
/** The size of every control the table puts into it - search, column menu,
|
|
1334
|
-
export, "reset", the bulk actions -: `sm`
|
|
1451
|
+
export, "reset", the bulk actions -: `sm` or `md`. A
|
|
1335
1452
|
control of one's own takes the same size by its own prop. */
|
|
1336
1453
|
size?: ToolbarSize;
|
|
1337
1454
|
/** The table, when the table toolbar does not stand inside it. If it then
|
|
@@ -1341,13 +1458,16 @@ export declare interface ToolbarProps {
|
|
|
1341
1458
|
of?: TableRef;
|
|
1342
1459
|
}
|
|
1343
1460
|
|
|
1344
|
-
|
|
1461
|
+
/** The size of a toolbar's controls. */
|
|
1462
|
+
export declare type ToolbarSize = "sm" | "md";
|
|
1345
1463
|
|
|
1346
1464
|
/** What can happen to an alarm. The caller reports the event; what it means the
|
|
1347
1465
|
model knows. */
|
|
1348
1466
|
export declare type Transition = "raised" | "acknowledged" | "resolved";
|
|
1349
1467
|
|
|
1350
|
-
|
|
1468
|
+
/** Tree rows for the model: how a row is keyed, how its children are read,
|
|
1469
|
+
and which branches are open. */
|
|
1470
|
+
export declare interface TreeInput<Z> {
|
|
1351
1471
|
key: (row: Z) => string;
|
|
1352
1472
|
/** `undefined` a leaf, an array a branch - the rule of core's reader. */
|
|
1353
1473
|
children: (row: Z) => readonly Z[] | undefined;
|
|
@@ -1360,6 +1480,18 @@ declare interface TreeInput<Z> {
|
|
|
1360
1480
|
/** Ends a snooze before its time. */
|
|
1361
1481
|
export declare function unsnooze(alarm: Alarm): Alarm;
|
|
1362
1482
|
|
|
1483
|
+
/** A table over your rows: the hook holds its state - sort, filters, search,
|
|
1484
|
+
grouping, page, selection, column widths -, and the parts it returns are
|
|
1485
|
+
typed at your row, so that a field name in `Column` is checked by the
|
|
1486
|
+
compiler.
|
|
1487
|
+
@param rows All rows in automatic mode; in server mode the page a server
|
|
1488
|
+
delivered for the current view.
|
|
1489
|
+
@param options How a row is keyed, the view to start from and the handler
|
|
1490
|
+
that hears every change of it, and in server mode the server's count and
|
|
1491
|
+
the handler that hears every request.
|
|
1492
|
+
@returns The table's state and its parts: `Table`, `Column`,
|
|
1493
|
+
`VerdictColumn`, `RowDetail`, `RowActions`, `Action` and `GroupBy`. Pass it
|
|
1494
|
+
as `of` to a part that stands outside the table. */
|
|
1363
1495
|
export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
|
|
1364
1496
|
|
|
1365
1497
|
/**
|
|
@@ -1370,7 +1502,7 @@ export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>
|
|
|
1370
1502
|
export declare function useTableSelection<T extends string | number>(ids: readonly T[]): TableSelection<T>;
|
|
1371
1503
|
|
|
1372
1504
|
/** How a value that does not sort or export itself does so after all. */
|
|
1373
|
-
declare interface ValuePaths<W> {
|
|
1505
|
+
export declare interface ValuePaths<W> {
|
|
1374
1506
|
/** What is sorted by, when not by the value itself. */
|
|
1375
1507
|
sortValue?: (value: Present<W>) => string | number | Absent;
|
|
1376
1508
|
/** What stands in the export, when not the value itself. */
|
|
@@ -1380,17 +1512,21 @@ declare interface ValuePaths<W> {
|
|
|
1380
1512
|
groupValue?: (value: Present<W>) => string | number | boolean | Date | Absent;
|
|
1381
1513
|
}
|
|
1382
1514
|
|
|
1383
|
-
|
|
1515
|
+
/** What every verdict column takes, whether its value is a field or a
|
|
1516
|
+
function. */
|
|
1517
|
+
export declare interface VerdictBase {
|
|
1384
1518
|
/** Names the column in its header, in the column menu and in the header row of the export. */
|
|
1385
1519
|
label: string;
|
|
1386
1520
|
/** The limit set every value is read against. */
|
|
1387
1521
|
limits: LimitSet;
|
|
1388
1522
|
/** How the value and its excess are written. */
|
|
1389
1523
|
format?: NumberFormat;
|
|
1390
|
-
/** What the column sorts by: by the weight of the verdict (
|
|
1391
|
-
|
|
1524
|
+
/** What the column sorts by: by the weight of the verdict (with equal
|
|
1525
|
+
weight the existing order stays) – or by the value.
|
|
1526
|
+
@default "verdict" */
|
|
1392
1527
|
sortBy?: "verdict" | "value";
|
|
1393
|
-
/** Initial width in pixels
|
|
1528
|
+
/** Initial width in pixels.
|
|
1529
|
+
@default the browser's */
|
|
1394
1530
|
width?: number;
|
|
1395
1531
|
/** Shows the drag grip on the header cell. */
|
|
1396
1532
|
resizable?: boolean;
|
|
@@ -1403,6 +1539,9 @@ declare interface VerdictBase {
|
|
|
1403
1539
|
aggregate?: "worst";
|
|
1404
1540
|
}
|
|
1405
1541
|
|
|
1542
|
+
/** The `VerdictColumn` of a table, typed at its row: a numeric field, or a
|
|
1543
|
+
function with an `id`, whose value is read against `limits` and shown with
|
|
1544
|
+
its verdict. */
|
|
1406
1545
|
export declare interface VerdictColumnComponent<Z> {
|
|
1407
1546
|
(props: VerdictBase & {
|
|
1408
1547
|
id: string;
|