@umriss-ui/table 0.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/LICENSE +20 -0
- package/README.md +108 -0
- package/dist/index.d.ts +842 -0
- package/dist/table.css +1 -0
- package/dist/table.js +2184 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { FreshnessAges } from '@umriss-ui/core';
|
|
3
|
+
import { HTMLAttributes } from 'react';
|
|
4
|
+
import { JSX } from 'react';
|
|
5
|
+
import { LimitSet } from '@umriss-ui/core';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
import { Wording } from '@umriss-ui/core';
|
|
8
|
+
|
|
9
|
+
declare type Absent = null | undefined;
|
|
10
|
+
|
|
11
|
+
/** Acknowledges the named alarms at the named time. Unknown ids are passed
|
|
12
|
+
over, what is already acknowledged stays as it is. */
|
|
13
|
+
export declare function acknowledge(alarms: readonly Alarm[], ids: Iterable<string>, time: number): Acknowledgement;
|
|
14
|
+
|
|
15
|
+
export declare interface Acknowledgement {
|
|
16
|
+
alarms: Alarm[];
|
|
17
|
+
/** How many alarms the acknowledgement actually changed. Acknowledging twice
|
|
18
|
+
yields the same set but not the same number - which is why it stands
|
|
19
|
+
here. */
|
|
20
|
+
count: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare interface ActionBase {
|
|
24
|
+
/** The label – text, because it is read out together with the row's name. */
|
|
25
|
+
children: string;
|
|
26
|
+
/** `"danger"` for an action that destroys something – that is how it appears in the menu and in the table toolbar. */
|
|
27
|
+
tone?: "default" | "danger";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare type ActionProps<Z> = (ActionBase & {
|
|
31
|
+
bulk?: false;
|
|
32
|
+
/** Gets the row the action was triggered on. */
|
|
33
|
+
onSelect: (row: Z) => void;
|
|
34
|
+
}) | (ActionBase & {
|
|
35
|
+
/** Acts on a list: at the row on a list made from it, in the table
|
|
36
|
+
toolbar on the selection within the filtered set. */
|
|
37
|
+
bulk: true;
|
|
38
|
+
/** With `bulk` a list: at the row one made from it, in the table toolbar the selection. */
|
|
39
|
+
onSelect: (rows: readonly Z[]) => void;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** One occurrence of a type.
|
|
43
|
+
|
|
44
|
+
`lifecycle` is the truth about the position; the two points in time are
|
|
45
|
+
trimmings for the display. The other way round it would be a pair of
|
|
46
|
+
booleans in disguise. */
|
|
47
|
+
export declare interface Alarm {
|
|
48
|
+
id: string;
|
|
49
|
+
/** Id of the alarm type. */
|
|
50
|
+
type: string;
|
|
51
|
+
lifecycle: LifecycleState;
|
|
52
|
+
/** The moment of coming, in milliseconds. */
|
|
53
|
+
raised: number;
|
|
54
|
+
/** The moment of clearing, as long as it stands: none. */
|
|
55
|
+
cleared?: number;
|
|
56
|
+
/** The moment of the acknowledgement, as long as unacknowledged: none. */
|
|
57
|
+
acknowledgedAt?: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The columns with the default labels - for callers without a wording. */
|
|
61
|
+
export declare const ALARM_COLUMNS: readonly Column<AlarmRow, AlarmColumn>[];
|
|
62
|
+
|
|
63
|
+
/** Ids of the columns that are sorted, searched and ordered in. */
|
|
64
|
+
export declare type AlarmColumn = "type" | "lifecycle" | "priority" | "acknowledgement" | "raised" | "age" | "frequency";
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The columns of the alarm model, labelled from a wording.
|
|
68
|
+
*
|
|
69
|
+
* Described only for the pipeline - how a value is read and compared - not for
|
|
70
|
+
* presentation. The cells stay the caller's, exactly as with the table. The
|
|
71
|
+
* label, though, lands in the column menu and the CSV header row, and that is
|
|
72
|
+
* why it comes from the wording: the module is pure and can read no context, so
|
|
73
|
+
* it is given one - like `standardPresets`.
|
|
74
|
+
*/
|
|
75
|
+
export declare const alarmColumns: (wording: Wording) => readonly Column<AlarmRow, AlarmColumn>[];
|
|
76
|
+
|
|
77
|
+
export declare interface AlarmInput {
|
|
78
|
+
alarms: readonly Alarm[];
|
|
79
|
+
/** The catalogue of conditions. An alarm whose type is missing is not thrown
|
|
80
|
+
away. */
|
|
81
|
+
types: readonly AlarmType[];
|
|
82
|
+
/** Milliseconds. The age and every window hang on it; nothing reads a
|
|
83
|
+
clock. */
|
|
84
|
+
asOf: number;
|
|
85
|
+
/** Without it `frequency` counts every occurrence up to the as-of time and
|
|
86
|
+
`chatters` stays false. */
|
|
87
|
+
chatter?: ChatterRule;
|
|
88
|
+
/** Without it no flood is detected and nothing is marked. */
|
|
89
|
+
flood?: FloodRule;
|
|
90
|
+
/** Show the alarms that are done as well (cleared and acknowledged).
|
|
91
|
+
Default: no - that is the only removal the model performs. */
|
|
92
|
+
keepDone?: boolean;
|
|
93
|
+
/** The columns of the projection; without a statement `ALARM_COLUMNS`.
|
|
94
|
+
Whoever changes the label in the column menu or the CSV header row passes
|
|
95
|
+
`alarmColumns(wording)`. */
|
|
96
|
+
columns?: readonly Column<AlarmRow, AlarmColumn>[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export declare function AlarmList(props: AlarmListProps): JSX.Element;
|
|
100
|
+
|
|
101
|
+
export declare interface AlarmListProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
102
|
+
/** The projection from `alarmModel`. */
|
|
103
|
+
view: AlarmProjection;
|
|
104
|
+
/** The caller's selection helper; without it there is no bulk
|
|
105
|
+
acknowledgement. Deliberately the same one as for any other table: the
|
|
106
|
+
rules on "everything filtered" versus "this page" are already decided
|
|
107
|
+
there. */
|
|
108
|
+
selection?: TableSelection<string>;
|
|
109
|
+
/** Gets the ids that are to be acknowledged. The component does not
|
|
110
|
+
acknowledge itself – it does not own the alarms. */
|
|
111
|
+
onAcknowledge?: (ids: readonly string[]) => void;
|
|
112
|
+
/** When the data was true. */
|
|
113
|
+
asOf?: Date | number | null;
|
|
114
|
+
/** From when the data counts as stale and from when as disconnected. Without
|
|
115
|
+
them the list shows no freshness – a time without a rule for when it is
|
|
116
|
+
too old is no information. */
|
|
117
|
+
freshness?: FreshnessAges;
|
|
118
|
+
/** "compact" reduces the row height for very dense views. Without a
|
|
119
|
+
statement the density of the `UmrissProvider`, without a setting
|
|
120
|
+
"compact". */
|
|
121
|
+
density?: "regular" | "compact";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Alarms, types and an as-of time become rows with derived fields and are then
|
|
126
|
+
* handed through the table's pipeline: filter -> sort -> page. Everything the
|
|
127
|
+
* table guarantees still holds.
|
|
128
|
+
*
|
|
129
|
+
* `input.sort` without a statement means the default order; expressly `null`
|
|
130
|
+
* means input order.
|
|
131
|
+
*/
|
|
132
|
+
export declare function alarmModel(input: AlarmInput, state?: TableInput<AlarmRow, AlarmColumn>): AlarmProjection;
|
|
133
|
+
|
|
134
|
+
export declare interface AlarmProjection extends TableProjection<AlarmRow, AlarmColumn> {
|
|
135
|
+
/** The flood that was detected, when a rule was given and it applies. A
|
|
136
|
+
marking beside the complete list, not a replacement for it. */
|
|
137
|
+
flood: Flood | null;
|
|
138
|
+
/** Standing and unacknowledged within the filtered set - the number for the
|
|
139
|
+
polite screen reader. From the filtered set, not from the visible page,
|
|
140
|
+
like every figure in this house. */
|
|
141
|
+
standingUnacknowledged: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** An alarm with everything the list and the order need to know about it.
|
|
145
|
+
Derived, never stored. */
|
|
146
|
+
export declare interface AlarmRow {
|
|
147
|
+
/** Id of the alarm - the key for selection and acknowledgement. */
|
|
148
|
+
id: string;
|
|
149
|
+
alarm: Alarm;
|
|
150
|
+
type: AlarmType;
|
|
151
|
+
lifecycle: LifecycleState;
|
|
152
|
+
priority: Priority;
|
|
153
|
+
/** 0 is the most urgent. For the sort. */
|
|
154
|
+
rank: number;
|
|
155
|
+
/** Since the coming, from the as-of time passed in. */
|
|
156
|
+
age: number;
|
|
157
|
+
/** How long the condition was true - until the clearing, otherwise until the
|
|
158
|
+
as-of time. Not the same thing as the age. */
|
|
159
|
+
duration: number;
|
|
160
|
+
/** Occurrences of this TYPE within the window; without a chatter rule: all of
|
|
161
|
+
them up to the as-of time. */
|
|
162
|
+
frequency: number;
|
|
163
|
+
/** The TYPE chatters. A marking on each of its rows. */
|
|
164
|
+
chatters: boolean;
|
|
165
|
+
/** This alarm belongs to the flood that was detected. */
|
|
166
|
+
inFlood: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** The condition that can become true. Not the alarm itself.
|
|
170
|
+
|
|
171
|
+
Frequency, chatter and flood are statements about a TYPE over a window and
|
|
172
|
+
cannot be expressed without it. */
|
|
173
|
+
export declare interface AlarmType {
|
|
174
|
+
id: string;
|
|
175
|
+
label: string;
|
|
176
|
+
priority: Priority;
|
|
177
|
+
/** The dead band, when the type has one. */
|
|
178
|
+
returnBand?: ReturnBand;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** From when a type counts as chattering. */
|
|
182
|
+
export declare interface ChatterRule {
|
|
183
|
+
/** Length of the window in milliseconds. */
|
|
184
|
+
windowMs: number;
|
|
185
|
+
/** From how many occurrences within the window. Reaching it is enough. */
|
|
186
|
+
atLeast: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Without a text form `children` is required. */
|
|
190
|
+
declare type ChildrenFor<W, Z> = IsDisplayable<W> extends true ? {
|
|
191
|
+
/** How the value appears: `(value, row)`. Never called for an absent
|
|
192
|
+
value. Required where the value has no text form. */
|
|
193
|
+
children?: Presentation<W, Z>;
|
|
194
|
+
} : {
|
|
195
|
+
/** How the value appears: `(value, row)`. Never called for an absent
|
|
196
|
+
value. Required where the value has no text form. */
|
|
197
|
+
children: Presentation<W, Z>;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
declare interface Column<Z, K extends string = string> {
|
|
201
|
+
id: K;
|
|
202
|
+
/** Human-readable label – for the column menu and the CSV header row.
|
|
203
|
+
Not for the presentation of the header cell: that stays compositional. */
|
|
204
|
+
label?: string;
|
|
205
|
+
/** The value for sorting and searching. `null`, `undefined` and `NaN` are
|
|
206
|
+
absent: they stand last in both directions and match no search. */
|
|
207
|
+
value?: (row: Z) => string | number | null | undefined;
|
|
208
|
+
/** A comparison of one's own; otherwise by the kind of the value. */
|
|
209
|
+
compare?: (a: Z, b: Z) => number;
|
|
210
|
+
/** Takes part in the free-text search (default: no). */
|
|
211
|
+
searchable?: boolean;
|
|
212
|
+
/** May the user switch this column away? Default yes. `false` for columns
|
|
213
|
+
that identify the row – without them the table is no longer
|
|
214
|
+
readable. */
|
|
215
|
+
hideable?: boolean;
|
|
216
|
+
/** May the user drag the width? Default no – a column whose content fits
|
|
217
|
+
anyway needs no grip. */
|
|
218
|
+
resizable?: boolean;
|
|
219
|
+
/** Initial width in pixels; without it the browser decides. */
|
|
220
|
+
width?: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export declare function column<P, K extends Field<P> = Field<P>>(preset: ColumnPreset<P, K>): ColumnPreset<P, K>;
|
|
224
|
+
|
|
225
|
+
declare interface ColumnBase {
|
|
226
|
+
/** Names the column in its header, in the column menu and in the header row of the export. */
|
|
227
|
+
label: string;
|
|
228
|
+
/** This column names the row: row header cells, never hideable, the sticky
|
|
229
|
+
first column, and the name by which the row's selection, expander and
|
|
230
|
+
actions are read out. At most one per table. */
|
|
231
|
+
rowHeader?: boolean;
|
|
232
|
+
/** Right-aligned with tabular figures. Without it the first value present decides. */
|
|
233
|
+
numeric?: boolean;
|
|
234
|
+
/** Initial width in pixels; without it the browser decides. */
|
|
235
|
+
width?: number;
|
|
236
|
+
/** Shows the drag grip on the header cell. */
|
|
237
|
+
resizable?: boolean;
|
|
238
|
+
/** Sortable unless stated otherwise, when the value is text, a number, a point in time or a boolean. */
|
|
239
|
+
sortable?: boolean;
|
|
240
|
+
/** Takes part in the search. Without a statement: yes for text, no otherwise. */
|
|
241
|
+
searchable?: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export declare interface ColumnComponent<Z> {
|
|
245
|
+
<W extends number | Absent>(props: Computed<Z, W> & {
|
|
246
|
+
footer: "sum" | "avg";
|
|
247
|
+
format?: NumberFormat;
|
|
248
|
+
children?: Presentation<W, Z>;
|
|
249
|
+
}): ReactNode;
|
|
250
|
+
<W extends number | Absent>(props: Computed<Z, W> & {
|
|
251
|
+
format: NumberFormat;
|
|
252
|
+
children?: Presentation<W, Z>;
|
|
253
|
+
}): ReactNode;
|
|
254
|
+
<W extends Date | Absent>(props: Computed<Z, W> & {
|
|
255
|
+
format: DateFormat;
|
|
256
|
+
children?: Presentation<W, Z>;
|
|
257
|
+
}): ReactNode;
|
|
258
|
+
<W>(props: Computed<Z, W> & {
|
|
259
|
+
footer?: never;
|
|
260
|
+
format?: never;
|
|
261
|
+
children: Presentation<W, Z>;
|
|
262
|
+
}): ReactNode;
|
|
263
|
+
<W extends Displayable | Absent>(props: Computed<Z, W> & {
|
|
264
|
+
footer?: never;
|
|
265
|
+
format?: never;
|
|
266
|
+
children?: never;
|
|
267
|
+
}): ReactNode;
|
|
268
|
+
<K extends Field<Z>>(props: FieldColumn<Z, K>): ReactNode;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export declare interface ColumnFilter<W, B> {
|
|
272
|
+
/** Whether a value that is present satisfies the condition. Never called for
|
|
273
|
+
an absent value: that satisfies none. */
|
|
274
|
+
matches: (value: Present<W>, condition: B) => boolean;
|
|
275
|
+
/** What stands in the filter's panel. The footer with "reset" and "done" the
|
|
276
|
+
table puts underneath it. */
|
|
277
|
+
Input: ComponentType<FilterInputProps<W, B>>;
|
|
278
|
+
/** The text of the condition in the table toolbar, behind the column's name. */
|
|
279
|
+
describe: (condition: B) => string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** A filter for columns with values of type `W` and conditions of type `B`.
|
|
283
|
+
The compiler accepts it at every column whose value fits, and rejects it
|
|
284
|
+
otherwise. Create it outside the component, like a preset. */
|
|
285
|
+
export declare function columnFilter<W, B>(definition: ColumnFilter<W, B>): ColumnFilter<W, B>;
|
|
286
|
+
|
|
287
|
+
/** Show and hide columns and arrange them. Every control is a real control -
|
|
288
|
+
a box or a button -, so it is reachable without a pointer; after a move the
|
|
289
|
+
focus stays on the button that was pressed. */
|
|
290
|
+
export declare function ColumnMenu({ of }: ColumnMenuProps): JSX.Element | null;
|
|
291
|
+
|
|
292
|
+
export declare interface ColumnMenuProps {
|
|
293
|
+
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
294
|
+
of?: TableRef;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** The properties of a column, as `column()` supplies them. */
|
|
298
|
+
export declare type ColumnPreset<P, K extends Field<P> = Field<P>> = FieldColumn<P, K>;
|
|
299
|
+
|
|
300
|
+
declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
301
|
+
/** The id is required where the value is a function. */
|
|
302
|
+
id: string;
|
|
303
|
+
value: (row: Z) => W;
|
|
304
|
+
/** A filter in the column header: `"list"` offers the values that occur,
|
|
305
|
+
`"range"` two bounds (meaningful only for numbers and points in time), a
|
|
306
|
+
filter from `columnFilter` asks whatever it asks itself. */
|
|
307
|
+
filter?: "list" | "range" | ColumnFilter<Present<W>, any>;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/** How many of the named alarms an acknowledgement would actually change. The
|
|
311
|
+
same condition as `acknowledge`, so that the number the interface names
|
|
312
|
+
beforehand and what happens afterwards cannot drift apart. */
|
|
313
|
+
export declare function countAcknowledgeable(alarms: readonly Alarm[], ids: Iterable<string>): number;
|
|
314
|
+
|
|
315
|
+
/** How many of the points in time lie within the window. Pure, with the as-of
|
|
316
|
+
time as a parameter. */
|
|
317
|
+
export declare const countInWindow: (times: readonly number[], windowMs: number, asOf: number) => number;
|
|
318
|
+
|
|
319
|
+
/** The names of the standard presentations of a point in time. */
|
|
320
|
+
export declare type DateFormat = "date" | "time" | "dateTime";
|
|
321
|
+
|
|
322
|
+
/** Priority, then acknowledgement, then time - the worst first, not the newest.
|
|
323
|
+
As levels of the existing multi-level sort, so that a caller replaces one
|
|
324
|
+
value instead of fighting against a hard-wired comparison. */
|
|
325
|
+
export declare const DEFAULT_ORDER: readonly SortLevel<AlarmColumn>[];
|
|
326
|
+
|
|
327
|
+
export declare function detectFlood(alarms: readonly Alarm[], rule: FloodRule, asOf: number): Flood | null;
|
|
328
|
+
|
|
329
|
+
/** What can appear as text without `children`. */
|
|
330
|
+
declare type Displayable = string | number | boolean | Date;
|
|
331
|
+
|
|
332
|
+
/** Writes the filtered set in the visible columns and their order – with the
|
|
333
|
+
values, not with their presentation. */
|
|
334
|
+
export declare function Export({ filename, onExport, of }: ExportProps): JSX.Element | null;
|
|
335
|
+
|
|
336
|
+
export declare interface ExportProps {
|
|
337
|
+
/** File name of the download. Without it the one from the wording ("tabelle.csv"). */
|
|
338
|
+
filename?: string;
|
|
339
|
+
/** Gets the text instead of triggering a file. */
|
|
340
|
+
onExport?: (text: string) => void;
|
|
341
|
+
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
342
|
+
of?: TableRef;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** The field names of a row. */
|
|
346
|
+
export declare type Field<Z> = Extract<keyof Z, string>;
|
|
347
|
+
|
|
348
|
+
declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths<Z[K]> & {
|
|
349
|
+
/** A field of the row. Supplies the column's `id` at the same time. */
|
|
350
|
+
value: K;
|
|
351
|
+
/** An id of one's own instead of the field name – for two columns over the same field. */
|
|
352
|
+
id?: string;
|
|
353
|
+
/** A standard presentation by name: `"percent"`, `"count"` or
|
|
354
|
+
`{ decimals }` for numbers, `"date"`, `"time"` or `"dateTime"` for
|
|
355
|
+
points in time. Alignment, sorting, export and footer stay with the value. */
|
|
356
|
+
format?: FormatFor<Z[K]>;
|
|
357
|
+
/** A sum or an average over the filtered set. Numbers only; absent values
|
|
358
|
+
do not count towards it. */
|
|
359
|
+
footer?: FooterFor<Z[K]>;
|
|
360
|
+
/** A filter in the column header: `"list"` offers the values that occur,
|
|
361
|
+
`"range"` two bounds (numbers or points in time), a filter from
|
|
362
|
+
`columnFilter` asks whatever it asks itself. Its condition stands in the
|
|
363
|
+
table toolbar. */
|
|
364
|
+
filter?: FilterFor<Z[K]>;
|
|
365
|
+
} & ChildrenFor<Z[K], Z>;
|
|
366
|
+
|
|
367
|
+
/** What can be set as a condition on a field: a list of its values, and for
|
|
368
|
+
numbers and points in time a range as well. */
|
|
369
|
+
export declare type FieldCondition<W> = ListCondition<W> | ([Present<W>] extends [number] ? RangeCondition<number> : [Present<W>] extends [Date] ? RangeCondition<Date> : never);
|
|
370
|
+
|
|
371
|
+
/** What a column accepts as `filter`: `"list"` for every value with a text
|
|
372
|
+
form, `"range"` for numbers and points in time, a filter from `columnFilter`
|
|
373
|
+
only where its value type fits. */
|
|
374
|
+
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>;
|
|
375
|
+
|
|
376
|
+
export declare interface FilterInputProps<W, B> {
|
|
377
|
+
/** The condition that holds right now; `null` as long as the filter requires nothing. */
|
|
378
|
+
condition: B | null;
|
|
379
|
+
/** Sets the condition; `null` lifts it. */
|
|
380
|
+
setCondition: (condition: B | null) => void;
|
|
381
|
+
/** The values that occur in the rows the pre-filter admits – each one once,
|
|
382
|
+
ordered, without the absent one. */
|
|
383
|
+
values: readonly Present<W>[];
|
|
384
|
+
/** The column whose filter this is. */
|
|
385
|
+
column: {
|
|
386
|
+
id: string;
|
|
387
|
+
label: string;
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** A flood that has been detected. A marking, not a suppression: the alarms all
|
|
392
|
+
stay in the list. */
|
|
393
|
+
export declare interface Flood {
|
|
394
|
+
/** Earliest and latest moment of the alarms involved - so that the interface
|
|
395
|
+
can say "forty alarms in 82 seconds". */
|
|
396
|
+
from: number;
|
|
397
|
+
to: number;
|
|
398
|
+
count: number;
|
|
399
|
+
/** Ids of the alarms involved. */
|
|
400
|
+
alarms: readonly string[];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** From when a set of alarms is a flood. */
|
|
404
|
+
export declare interface FloodRule {
|
|
405
|
+
windowMs: number;
|
|
406
|
+
/** From how many alarms within the window - across all types, because one
|
|
407
|
+
fault drags nine interlocks with it. Reaching it is enough. */
|
|
408
|
+
atLeast: number;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare type FooterFor<W> = [Present<W>] extends [number] ? "sum" | "avg" : never;
|
|
412
|
+
|
|
413
|
+
declare type FormatFor<W> = [Present<W>] extends [number] ? NumberFormat : [Present<W>] extends [Date] ? DateFormat : never;
|
|
414
|
+
|
|
415
|
+
/** Frequency per alarm type within the window. Grouped by TYPE, not by
|
|
416
|
+
occurrence - a chattering measuring point is one problem, not forty. */
|
|
417
|
+
export declare function frequencyByType(alarms: readonly Alarm[], windowMs: number, asOf: number): Map<string, number>;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Has the value come back far enough for a standing alarm to clear? The value
|
|
421
|
+
* must come back past the return value, not merely past the bound that
|
|
422
|
+
* triggered the alarm - which is why `limit` does not appear in this
|
|
423
|
+
* calculation.
|
|
424
|
+
*
|
|
425
|
+
* The condition of clearing, not that of raising: that a measured value raises
|
|
426
|
+
* an alarm the caller's process layer decides. It lives here because only this
|
|
427
|
+
* module knows what the alarm just was.
|
|
428
|
+
*
|
|
429
|
+
* The return value itself belongs to the return: reaching it is enough.
|
|
430
|
+
*/
|
|
431
|
+
export declare const hasReturned: (band: ReturnBand, value: number) => boolean;
|
|
432
|
+
|
|
433
|
+
export declare const isAcknowledged: (state: LifecycleState) => boolean;
|
|
434
|
+
|
|
435
|
+
declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<W>] extends [Displayable] ? true : false;
|
|
436
|
+
|
|
437
|
+
/** Cleared and acknowledged: the only position that leaves the list. */
|
|
438
|
+
export declare const isDone: (state: LifecycleState) => boolean;
|
|
439
|
+
|
|
440
|
+
export declare const isStanding: (state: LifecycleState) => boolean;
|
|
441
|
+
|
|
442
|
+
/** One field, four values. `cleared-unacknowledged` is the fleeting alarm and the
|
|
443
|
+
reason why no pair of booleans stands here. */
|
|
444
|
+
export declare type LifecycleState = "standing-unacknowledged" | "standing-acknowledged" | "cleared-unacknowledged" | "cleared-acknowledged";
|
|
445
|
+
|
|
446
|
+
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
447
|
+
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* The transition as pure calculation.
|
|
451
|
+
*
|
|
452
|
+
* `raised` always leads to `standing-unacknowledged`, even out of an
|
|
453
|
+
* acknowledged position: a renewed occurrence of the condition is a new
|
|
454
|
+
* event and demands that somebody see it again.
|
|
455
|
+
*/
|
|
456
|
+
export declare function nextLifecycleState(state: LifecycleState, transition: Transition): LifecycleState;
|
|
457
|
+
|
|
458
|
+
/** The field names whose value is a number or may be absent. */
|
|
459
|
+
declare type NumberField<Z> = {
|
|
460
|
+
[K in Field<Z>]: Z[K] extends number | Absent ? K : never;
|
|
461
|
+
}[Field<Z>];
|
|
462
|
+
|
|
463
|
+
/** The names of the standard presentations of a number. */
|
|
464
|
+
export declare type NumberFormat = "percent" | "count" | {
|
|
465
|
+
decimals: number;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/** The pagination bar. Inside the table it stands underneath it, wherever it
|
|
469
|
+
stands in the JSX; a virtualised table does not page, and then it is not
|
|
470
|
+
there. Without it the table does not page but shows all filtered rows –
|
|
471
|
+
`pageSize` holds as soon as a pagination bar stands. Whoever places it
|
|
472
|
+
outside the table puts it before the table: after it, it registers only
|
|
473
|
+
after the first frame. */
|
|
474
|
+
export declare function Pagination({ pageSizes, className, of }: PaginationProps): JSX.Element | null;
|
|
475
|
+
|
|
476
|
+
export declare interface PaginationProps {
|
|
477
|
+
/** The selectable page sizes; default 10, 25, 50. */
|
|
478
|
+
pageSizes?: readonly number[];
|
|
479
|
+
/** Classes on the pagination bar. */
|
|
480
|
+
className?: string;
|
|
481
|
+
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
482
|
+
of?: TableRef;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** The value without the absence - that is what `children` gets. */
|
|
486
|
+
declare type Present<W> = Exclude<W, Absent>;
|
|
487
|
+
|
|
488
|
+
declare type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;
|
|
489
|
+
|
|
490
|
+
/** From the most urgent to the last - the order of the scale. */
|
|
491
|
+
export declare const PRIORITIES: readonly Priority[];
|
|
492
|
+
|
|
493
|
+
/** Three levels. Not two, because an alarm system orders the urgency of acting
|
|
494
|
+
more finely than a limit does; not seven, because every level above about
|
|
495
|
+
four gets used as a synonym of the one below it.
|
|
496
|
+
|
|
497
|
+
This is a DIFFERENT scale from the severity of a limit (which has two), on a
|
|
498
|
+
different object. The mapping between the two is the caller's, in his code,
|
|
499
|
+
where the plant's convention stands. */
|
|
500
|
+
export declare type Priority = "high" | "medium" | "low";
|
|
501
|
+
|
|
502
|
+
/** 0 is the most urgent. Sorted ascending it stands on top. */
|
|
503
|
+
export declare const priorityRank: (priority: Priority) => number;
|
|
504
|
+
|
|
505
|
+
/** The condition of a range filter: both bounds inclusive, each may be absent. */
|
|
506
|
+
export declare interface RangeCondition<W> {
|
|
507
|
+
from?: W;
|
|
508
|
+
to?: W;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** The triggering bound and the return band of an alarm type.
|
|
512
|
+
|
|
513
|
+
With an upper bound the return value lies below it, with a lower one above
|
|
514
|
+
it. That is the dead band: it keeps the value sitting on the bound from
|
|
515
|
+
producing a hundred alarms. */
|
|
516
|
+
export declare interface ReturnBand {
|
|
517
|
+
/** `obere`: the alarm comes when the value rises above the bound.
|
|
518
|
+
`untere`: it comes when the value falls below it. */
|
|
519
|
+
direction: "obere" | "untere";
|
|
520
|
+
/** The bound that triggered the alarm. Stands here so that the condition is
|
|
521
|
+
described completely in one place - for the decision about clearing it is
|
|
522
|
+
expressly not read. */
|
|
523
|
+
limit: number;
|
|
524
|
+
/** The value the reading must come back past before the alarm clears. */
|
|
525
|
+
returnTo: number;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export declare interface RowActionsProps {
|
|
529
|
+
/** The row's `Action`s. */
|
|
530
|
+
children: ReactNode;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/** What a row carries in classes and data attributes. */
|
|
534
|
+
export declare type RowAttributes = {
|
|
535
|
+
className?: string;
|
|
536
|
+
} & {
|
|
537
|
+
[data: `data-${string}`]: string | undefined;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export declare interface RowDetailProps<Z> {
|
|
541
|
+
/** What stands underneath an expanded row. */
|
|
542
|
+
children: (row: Z) => ReactNode;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export declare function Search({ placeholder, "aria-label": name, className, of }: SearchProps): JSX.Element | null;
|
|
546
|
+
|
|
547
|
+
export declare interface SearchProps {
|
|
548
|
+
/** The placeholder in the field; without it "Suchen …" from the wording. */
|
|
549
|
+
placeholder?: string;
|
|
550
|
+
/** Accessible name; without it "Tabelle durchsuchen". */
|
|
551
|
+
"aria-label"?: string;
|
|
552
|
+
/** Classes on the field. */
|
|
553
|
+
className?: string;
|
|
554
|
+
/** The table, when the part does not stand inside it: the return value of `useTable`. */
|
|
555
|
+
of?: TableRef;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** Sets a condition from outside. Typed at the field of the row, not at the
|
|
559
|
+
column: the columns stand in the JSX, and the hook does not see that
|
|
560
|
+
(ADR-0017). An id that is not a field name – a computed column or an `id` of
|
|
561
|
+
one's own – takes any condition; through it the condition of a filter of
|
|
562
|
+
one's own is set as well. */
|
|
563
|
+
export declare interface SetFilter<Z> {
|
|
564
|
+
<K extends Field<Z>>(column: K, condition: FieldCondition<Z[K]> | null): void;
|
|
565
|
+
<I extends string>(column: I & (I extends Field<Z> ? never : unknown), condition: unknown): void;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export declare type SortDirection = "asc" | "desc";
|
|
569
|
+
|
|
570
|
+
/** One level of the sort. Several levels act in their order: the second decides
|
|
571
|
+
only what the first leaves open. */
|
|
572
|
+
export declare interface SortLevel<K extends string = string> {
|
|
573
|
+
column: K;
|
|
574
|
+
direction: SortDirection;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export declare interface Table<Z> extends TableSnapshot<Z> {
|
|
578
|
+
Table: (props: TableProps<Z>) => ReactNode;
|
|
579
|
+
Column: ColumnComponent<Z>;
|
|
580
|
+
VerdictColumn: VerdictColumnComponent<Z>;
|
|
581
|
+
RowDetail: (props: RowDetailProps<Z>) => ReactNode;
|
|
582
|
+
RowActions: (props: RowActionsProps) => ReactNode;
|
|
583
|
+
Action: (props: ActionProps<Z>) => ReactNode;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
declare interface TableInput<Z = unknown, K extends string = string> {
|
|
587
|
+
search?: string;
|
|
588
|
+
/** An additional filter beside the free-text search, e.g. a status choice. */
|
|
589
|
+
filter?: (row: Z) => boolean;
|
|
590
|
+
/** One level or several. A single level means the same as a list holding
|
|
591
|
+
only it – which is why callers that still pass a single object remain
|
|
592
|
+
correct unchanged. */
|
|
593
|
+
sort?: SortLevel<K> | readonly SortLevel<K>[] | null;
|
|
594
|
+
/** 1-based; is clamped to the valid range. */
|
|
595
|
+
page?: number;
|
|
596
|
+
pageSize?: number;
|
|
597
|
+
/** Ids of columns switched away. Columns that are not hideable stay. */
|
|
598
|
+
hidden?: readonly K[];
|
|
599
|
+
/** The wanted column order. Columns not named follow in their natural
|
|
600
|
+
order; unknown ids are passed over. */
|
|
601
|
+
order?: readonly K[];
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export declare interface TableOptions<Z> {
|
|
605
|
+
/** A stable key per row – the basis of selection and expansion. */
|
|
606
|
+
rowKey: (row: Z) => string;
|
|
607
|
+
/** Default 10. */
|
|
608
|
+
pageSize?: number;
|
|
609
|
+
/** The application's sort; it is the default that `view` leaves out. */
|
|
610
|
+
defaultSort?: SortLevel | readonly SortLevel[] | null;
|
|
611
|
+
/** Which rows the table has at all – by permission, by plant, by anything the
|
|
612
|
+
user is not meant to undo. It is invisible: never a condition, never
|
|
613
|
+
reset, never part of the view, and "43 of 1,204" counts only the rows it
|
|
614
|
+
admits. It may stand in the call; a change leaves the page standing, and
|
|
615
|
+
the model clamps it. */
|
|
616
|
+
preFilter?: (row: Z) => boolean;
|
|
617
|
+
/** The old name of `preFilter` – the same filter, the same meaning.
|
|
618
|
+
@deprecated Is called `preFilter` now; the old name goes with the next minor version. */
|
|
619
|
+
filter?: (row: Z) => boolean;
|
|
620
|
+
/** The view on the first render. The table remembers none: where a view is
|
|
621
|
+
kept is the application's decision. Names no column carries fall out. */
|
|
622
|
+
initialView?: TableView;
|
|
623
|
+
/** Renders only what stands in the scroll area; paging is then off. */
|
|
624
|
+
virtual?: {
|
|
625
|
+
rowHeight: number;
|
|
626
|
+
overscan?: number;
|
|
627
|
+
};
|
|
628
|
+
/** A selection from outside instead of its own – when the application holds it. */
|
|
629
|
+
selection?: TableSelection<string>;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare interface TableProjection<Z, K extends string = string> {
|
|
633
|
+
/** The visible columns in their order – the basis for the header row, the
|
|
634
|
+
column menu and the CSV export. */
|
|
635
|
+
columns: readonly Column<Z, K>[];
|
|
636
|
+
/** Everything the filter leaves – the basis for figures and the selection. */
|
|
637
|
+
filtered: Z[];
|
|
638
|
+
/** Only the current page. */
|
|
639
|
+
visible: Z[];
|
|
640
|
+
/** The clamped page actually shown. */
|
|
641
|
+
page: number;
|
|
642
|
+
pageCount: number;
|
|
643
|
+
columnCount: number;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export declare interface TableProps<Z> {
|
|
647
|
+
/** Adds the selection column. "All" means: the filtered set. */
|
|
648
|
+
selectable?: boolean;
|
|
649
|
+
/** Keeps the header row visible while scrolling. */
|
|
650
|
+
stickyHeader?: boolean;
|
|
651
|
+
/** Keeps the row header column visible while scrolling sideways; it then stands first. */
|
|
652
|
+
stickyRowHeader?: boolean;
|
|
653
|
+
/** Discreet zebra stripes. */
|
|
654
|
+
striped?: boolean;
|
|
655
|
+
/** Without a statement the density of the `UmrissProvider`, without a provider "regular". */
|
|
656
|
+
density?: "regular" | "compact";
|
|
657
|
+
/** Height of the scroll area, e.g. "480px". A virtualised table needs it. */
|
|
658
|
+
maxHeight?: string;
|
|
659
|
+
/** What stands in the body when there are no rows. Empty because of a filter
|
|
660
|
+
the table shows itself – with the way back. */
|
|
661
|
+
empty?: ReactNode;
|
|
662
|
+
/** Shows placeholder rows instead of the rows. */
|
|
663
|
+
loading?: boolean;
|
|
664
|
+
/** Classes and data attributes per row. */
|
|
665
|
+
rowProps?: (row: Z) => RowAttributes;
|
|
666
|
+
/** Accessible name of the table (not of the outer frame). */
|
|
667
|
+
ariaLabel?: string;
|
|
668
|
+
/** Classes on the outer frame of the table. */
|
|
669
|
+
className?: string;
|
|
670
|
+
/** Columns, `RowDetail`, `RowActions` and the unbound parts. */
|
|
671
|
+
children?: ReactNode;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** What a part without a row type needs from a table – for `of`. */
|
|
675
|
+
export declare type TableRef = Omit<TableSnapshot<unknown>, "setFilter"> & {
|
|
676
|
+
readonly Table: unknown;
|
|
677
|
+
/** Without a row kind: any id, any condition. */
|
|
678
|
+
setFilter(column: string, condition: unknown): void;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
export declare interface TableSelection<T extends string | number> {
|
|
682
|
+
/** The keys currently selected. */
|
|
683
|
+
selected: ReadonlySet<T>;
|
|
684
|
+
isSelected: (id: T) => boolean;
|
|
685
|
+
toggle: (id: T) => void;
|
|
686
|
+
/** Selects all the keys passed in, or clears the selection. */
|
|
687
|
+
toggleAll: () => void;
|
|
688
|
+
clear: () => void;
|
|
689
|
+
/** true when every currently visible key is selected. */
|
|
690
|
+
allSelected: boolean;
|
|
691
|
+
/** true when some - but not all - are selected. */
|
|
692
|
+
someSelected: boolean;
|
|
693
|
+
count: number;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/** The state of a table, as everything outside the columns reads it. */
|
|
697
|
+
export declare interface TableSnapshot<Z> {
|
|
698
|
+
/** All the rows passed in, including those the pre-filter does not admit. */
|
|
699
|
+
rows: readonly Z[];
|
|
700
|
+
/** The filtered set: what the pre-filter admits and search and filters leave, across all pages. */
|
|
701
|
+
filtered: readonly Z[];
|
|
702
|
+
/** What is rendered right now: the page or the window. */
|
|
703
|
+
visible: readonly Z[];
|
|
704
|
+
/** The page shown, from 1. Without `Pagination` always 1. */
|
|
705
|
+
page: number;
|
|
706
|
+
/** How many pages the filtered set makes. */
|
|
707
|
+
pageCount: number;
|
|
708
|
+
/** Rows per page. */
|
|
709
|
+
pageSize: number;
|
|
710
|
+
/** Changes the page, clamped to those that exist. */
|
|
711
|
+
setPage: (page: number) => void;
|
|
712
|
+
/** Sets the rows per page; back to page one. */
|
|
713
|
+
setPageSize: (size: number) => void;
|
|
714
|
+
/** The search text. */
|
|
715
|
+
search: string;
|
|
716
|
+
/** Sets the search text; back to page one. */
|
|
717
|
+
setSearch: (search: string) => void;
|
|
718
|
+
/** The sort levels, the first one first – only over columns that registered. */
|
|
719
|
+
sort: readonly SortLevel[];
|
|
720
|
+
/** Sorts by a column. With `additive` a level is added instead of replacing the sort. */
|
|
721
|
+
toggleSort: (column: string, additive?: boolean) => void;
|
|
722
|
+
/** The ids of the hidden columns. */
|
|
723
|
+
hidden: readonly string[];
|
|
724
|
+
/** Hides a column or shows it again. The row header stays. */
|
|
725
|
+
toggleColumn: (column: string) => void;
|
|
726
|
+
/** The order of the columns as ids, as the user chose it. */
|
|
727
|
+
order: readonly string[];
|
|
728
|
+
/** Reorders the columns – on header, body and footer at once. */
|
|
729
|
+
setOrder: (order: readonly string[]) => void;
|
|
730
|
+
/** The widths in pixels: those of the columns, and over them the dragged ones. */
|
|
731
|
+
widths: Readonly<Record<string, number>>;
|
|
732
|
+
/** Sets the width of a column; `undefined` takes it back. */
|
|
733
|
+
setWidth: (column: string, width: number | undefined) => void;
|
|
734
|
+
/** The keys of the expanded rows. */
|
|
735
|
+
expanded: readonly string[];
|
|
736
|
+
/** Expands a row or collapses it. */
|
|
737
|
+
toggleRow: (key: string) => void;
|
|
738
|
+
/** The conditions of the column filters per column, in the order in which
|
|
739
|
+
they were set. Whatever fits no column is absent. */
|
|
740
|
+
filter: Readonly<Record<string, unknown>>;
|
|
741
|
+
/** Sets the condition of a column filter; `null` clears it. Back to page one.
|
|
742
|
+
A condition that does not fit the kind of the filter – a range on a list
|
|
743
|
+
filter, a column without a filter – is passed over with a warning in
|
|
744
|
+
development. */
|
|
745
|
+
setFilter: SetFilter<Z>;
|
|
746
|
+
/** The selection – its own or the one handed in through `selection`. */
|
|
747
|
+
selection: TableSelection<string>;
|
|
748
|
+
/** The part of the state an application can keep; whatever is at its default is absent. */
|
|
749
|
+
view: TableView;
|
|
750
|
+
/** The filtered set in the visible columns as text for a spreadsheet. */
|
|
751
|
+
asCsv: () => string;
|
|
752
|
+
/** Whether it virtualises. */
|
|
753
|
+
virtual: boolean;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** Search, conditions, sort levels, page, page size, hidden columns, order and
|
|
757
|
+
dragged widths. Whatever is at its default is absent. The pre-filter never
|
|
758
|
+
belongs to it: it is a function of the application. */
|
|
759
|
+
export declare interface TableView<K extends string = string> {
|
|
760
|
+
search?: string;
|
|
761
|
+
/** The conditions of the column filters, per column. A condition for a column
|
|
762
|
+
that does not exist, or whose filter is of another kind, falls out. */
|
|
763
|
+
conditions?: Readonly<Record<string, unknown>>;
|
|
764
|
+
sort?: readonly SortLevel<K>[];
|
|
765
|
+
page?: number;
|
|
766
|
+
pageSize?: number;
|
|
767
|
+
hidden?: readonly K[];
|
|
768
|
+
order?: readonly K[];
|
|
769
|
+
/** Column widths the user has dragged, in pixels. */
|
|
770
|
+
widths?: Readonly<Record<string, number>>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** The table toolbar: on the left whatever one puts into it, and the conditions
|
|
774
|
+
of the column filters; on the right the ratio of the filtered set to all
|
|
775
|
+
rows and "reset" as long as something restricts, and the count of the
|
|
776
|
+
selection with the bulk actions. A table with a search or a column filter
|
|
777
|
+
has one, even where none stands; where one stands, there is no second. */
|
|
778
|
+
export declare function Toolbar({ children, className, of }: ToolbarProps): JSX.Element;
|
|
779
|
+
|
|
780
|
+
export declare interface ToolbarProps {
|
|
781
|
+
/** Search, column menu, export – on the left in the table toolbar, before the conditions. */
|
|
782
|
+
children?: ReactNode;
|
|
783
|
+
/** Classes on the table toolbar. */
|
|
784
|
+
className?: string;
|
|
785
|
+
/** The table, when the table toolbar does not stand inside it. If it then
|
|
786
|
+
stands behind the table in the tree, it registers only after the first
|
|
787
|
+
frame – until then a table with a search or a column filter shows its own
|
|
788
|
+
toolbar. Placed before the table, there is no such change. */
|
|
789
|
+
of?: TableRef;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/** What can happen to an alarm. The caller reports the event; what it means the
|
|
793
|
+
model knows. */
|
|
794
|
+
export declare type Transition = "raised" | "acknowledged" | "cleared";
|
|
795
|
+
|
|
796
|
+
export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* A small headless helper for row selection: it holds the selection as a set
|
|
800
|
+
* and supplies the states for "select all" (including indeterminate).
|
|
801
|
+
* What the selection means in the domain stays the application's business.
|
|
802
|
+
*/
|
|
803
|
+
export declare function useTableSelection<T extends string | number>(ids: readonly T[]): TableSelection<T>;
|
|
804
|
+
|
|
805
|
+
/** How a value that does not sort or export itself does so after all. */
|
|
806
|
+
declare interface ValuePaths<W> {
|
|
807
|
+
/** What is sorted by, when not by the value itself. */
|
|
808
|
+
sortValue?: (value: Present<W>) => string | number | Absent;
|
|
809
|
+
/** What stands in the export, when not the value itself. */
|
|
810
|
+
exportValue?: (value: Present<W>) => string | number | Absent;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare interface VerdictBase {
|
|
814
|
+
/** Names the column in its header, in the column menu and in the header row of the export. */
|
|
815
|
+
label: string;
|
|
816
|
+
/** The limit set every value is read against. */
|
|
817
|
+
limits: LimitSet;
|
|
818
|
+
/** How the value and its excess are written. */
|
|
819
|
+
format?: NumberFormat;
|
|
820
|
+
/** What the column sorts by: by the weight of the verdict (the default; with
|
|
821
|
+
equal weight the existing order stays) – or by the value. */
|
|
822
|
+
sortBy?: "verdict" | "value";
|
|
823
|
+
/** Initial width in pixels; without it the browser decides. */
|
|
824
|
+
width?: number;
|
|
825
|
+
/** Shows the drag grip on the header cell. */
|
|
826
|
+
resizable?: boolean;
|
|
827
|
+
/** A verdict column has no list filter: four verdicts are filtered through the sort. */
|
|
828
|
+
filter?: never;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
export declare interface VerdictColumnComponent<Z> {
|
|
832
|
+
(props: VerdictBase & {
|
|
833
|
+
id: string;
|
|
834
|
+
value: (row: Z) => number | Absent;
|
|
835
|
+
}): ReactNode;
|
|
836
|
+
<K extends NumberField<Z>>(props: VerdictBase & {
|
|
837
|
+
value: K;
|
|
838
|
+
id?: string;
|
|
839
|
+
}): ReactNode;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export { }
|