@umriss-ui/table 0.11.2 → 0.12.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/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
- declare type Absent = null | undefined;
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 Column<AlarmRow, AlarmColumn>[];
111
+ export declare const ALARM_COLUMNS: readonly ModelColumn<AlarmRow, AlarmColumn>[];
108
112
 
109
- declare type AlarmAvailability = {
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
- declare interface AlarmBase {
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 Column<AlarmRow, AlarmColumn>[];
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 Column<AlarmRow, AlarmColumn>[];
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. Without a
188
- statement the density of the `UmrissProvider`, without a setting
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. */
@@ -353,41 +371,25 @@ declare type ChildrenFor<W, Z> = IsDisplayable<W> extends true ? {
353
371
  children: Presentation<W, Z>;
354
372
  };
355
373
 
356
- declare interface Column<Z, K extends string = string> {
357
- id: K;
358
- /** Human-readable label – for the column menu and the CSV header row.
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
- declare interface ColumnBase {
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. Without it the first value present decides. */
388
+ /** Right-aligned with tabular figures.
389
+ @default decided by the first value present */
389
390
  numeric?: boolean;
390
- /** Initial width in pixels; without it the browser decides. */
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
- /** Sortable unless stated otherwise, when the value is text, a number, a point in time or a boolean. */
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. Without a statement: yes for text, no otherwise. */
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? Without a statement: yes, when
405
- its value is text, a number, a point in time or a boolean, or it has 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
- /** `sm` or `md`; without it the size of the toolbar it stands in, `sm` outside one. */
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
- declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
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; without it, the values that occur. */
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
- declare type DatePeriod = "day" | "week" | "month" | "year";
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; without it, the values that occur. */
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
@@ -572,12 +596,16 @@ export declare function enable(alarm: Alarm): Alarm;
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. Without it the one from the wording ("table.csv"). */
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
- /** `sm` or `md`; without it the size of the toolbar it stands in, `sm` outside one. */
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
- declare type FieldColumn<Z, K extends Field<Z>> = ColumnBase & ValuePaths<Z[K]> & {
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
- declare type FooterFor<W> = [Present<W>] extends [number] ? "sum" | "avg" : never;
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
- declare type FormatFor<W> = [Present<W>] extends [number] ? NumberFormat : [Present<W>] extends [Date] ? DateFormat : never;
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
- declare interface GroupByBase {
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
- declare type IsDisplayable<W> = [Present<W>] extends [never] ? false : [Present<W>] extends [Displayable] ? true : false;
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;
@@ -790,6 +833,34 @@ declare interface ManualMode {
790
833
  back on, and a view it has to complete is one it completes wrongly. */
791
834
  export declare type ManualView<K extends string = string> = TableView<K> & Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
792
835
 
836
+ /** A column as the model reads it - what sorting, search, hiding and the
837
+ export need of it, not its presentation. `alarmModel` takes them, and
838
+ `ALARM_COLUMNS` are the alarm list's. */
839
+ export declare interface ModelColumn<Z, K extends string = string> {
840
+ id: K;
841
+ /** Human-readable label – for the column menu and the CSV header row.
842
+ Not for the presentation of the header cell: that stays compositional. */
843
+ label?: string;
844
+ /** The value for sorting and searching. `null`, `undefined` and `NaN` are
845
+ absent: they stand last in both directions and match no search. */
846
+ value?: (row: Z) => string | number | null | undefined;
847
+ /** A comparison of one's own; otherwise by the kind of the value. */
848
+ compare?: (a: Z, b: Z) => number;
849
+ /** Takes part in the free-text search.
850
+ @default false */
851
+ searchable?: boolean;
852
+ /** May the user switch this column away? `false` for columns that identify
853
+ the row – without them the table is no longer readable.
854
+ @default true */
855
+ hideable?: boolean;
856
+ /** May the user drag the width? A column whose content fits anyway needs
857
+ no grip.
858
+ @default false */
859
+ resizable?: boolean;
860
+ /** Initial width in pixels; without it the browser decides. */
861
+ width?: number;
862
+ }
863
+
793
864
  /**
794
865
  * The transition as pure calculation.
795
866
  *
@@ -800,7 +871,7 @@ export declare type ManualView<K extends string = string> = TableView<K> & Requi
800
871
  export declare function nextLifecycleState(state: LifecycleState, transition: Transition): LifecycleState;
801
872
 
802
873
  /** The field names whose value is a number or may be absent. */
803
- declare type NumberField<Z> = {
874
+ export declare type NumberField<Z> = {
804
875
  [K in Field<Z>]: Z[K] extends number | Absent ? K : never;
805
876
  }[Field<Z>];
806
877
 
@@ -810,7 +881,7 @@ export declare type NumberFormat = "percent" | "count" | {
810
881
  };
811
882
 
812
883
  /** 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;
884
+ export declare type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readonly Z[]) => unknown;
814
885
 
815
886
  /** The pagination bar. Inside the table it stands underneath it, wherever it
816
887
  stands in the JSX; a virtualised table does not page, and then it is not
@@ -820,8 +891,9 @@ declare type OwnAggregate<Z = never> = (values: readonly unknown[], rows: readon
820
891
  after the first frame. */
821
892
  export declare function Pagination({ pageSizes, className, of }: PaginationProps): JSX.Element | null;
822
893
 
894
+ /** The props of `Pagination`. */
823
895
  export declare interface PaginationProps {
824
- /** The selectable page sizes; default 10, 25, 50. */
896
+ /** The selectable page sizes. */
825
897
  pageSizes?: readonly number[];
826
898
  /** Classes on the pagination bar. */
827
899
  className?: string;
@@ -829,12 +901,14 @@ export declare interface PaginationProps {
829
901
  of?: TableRef;
830
902
  }
831
903
 
832
- declare type Pin = "start" | "end";
904
+ /** Where a pinned column stands: in the block before or after the others. */
905
+ export declare type Pin = "start" | "end";
833
906
 
834
907
  /** The value without the absence - that is what `children` gets. */
835
- declare type Present<W> = Exclude<W, Absent>;
908
+ export declare type Present<W> = Exclude<W, Absent>;
836
909
 
837
- declare type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;
910
+ /** What a column draws in a cell: the value present and its row. */
911
+ export declare type Presentation<W, Z> = (value: Present<W>, row: Z) => ReactNode;
838
912
 
839
913
  /** From the most urgent to the last - the order of the scale. */
840
914
  export declare const PRIORITIES: readonly Priority[];
@@ -874,9 +948,16 @@ export declare interface ReturnBand {
874
948
  returnTo: number;
875
949
  }
876
950
 
951
+ /** The props of `RowActions`: the `Action`s of each row, in its menu. */
877
952
  export declare interface RowActionsProps {
878
953
  /** The row's `Action`s. */
879
954
  children: ReactNode;
955
+ /** Whether the actions column sticks at the end of the row while the table
956
+ scrolls sideways. `false` leaves it in the flow, for a place too narrow
957
+ for a pinned block - the application decides, by its own measure. A
958
+ column pinned to the end takes the actions with it regardless.
959
+ @default true */
960
+ pin?: boolean;
880
961
  }
881
962
 
882
963
  /** A new row the user saved: every column that edits, by column id. */
@@ -897,11 +978,14 @@ export declare interface RowDelete<Z> {
897
978
  row: Z;
898
979
  }
899
980
 
981
+ /** The props of `RowDetail`: what an expanded row shows underneath it. */
900
982
  export declare interface RowDetailProps<Z> {
901
983
  /** What stands underneath an expanded row. */
902
984
  children: (row: Z) => ReactNode;
903
985
  }
904
986
 
987
+ /** A row filter, as `rowFilter` makes it: a condition over the whole row
988
+ that a control of the application sets through `setFilter`. */
905
989
  export declare interface RowFilter<Z, B> {
906
990
  /** Its name in `t.view.conditions` and in what manual mode reports - the one
907
991
  place the filter is spelled. Not the id of a column of the same table. */
@@ -923,7 +1007,7 @@ export declare interface RowFilter<Z, B> {
923
1007
  export declare function rowFilter<Z, B>(definition: RowFilter<Z, B>): RowFilter<Z, B>;
924
1008
 
925
1009
  /** The rows of the filtered set that share one grouping value on one level. */
926
- declare interface RowGroup<Z> {
1010
+ export declare interface RowGroup<Z> {
927
1011
  /** Identifies the group across renders and in the view: the keys of its
928
1012
  path, outermost first. */
929
1013
  path: string;
@@ -946,16 +1030,23 @@ export declare interface RowSave<Z> {
946
1030
  row: Z;
947
1031
  }
948
1032
 
1033
+ /** The table's search field: one text over every column that searches, in
1034
+ the table toolbar. With a search the table puts up a toolbar of its own
1035
+ where none stands. Outside the table it needs `of`. */
949
1036
  export declare function Search({ placeholder, "aria-label": name, className, size: own, of }: SearchProps): JSX.Element | null;
950
1037
 
1038
+ /** The props of `Search`. */
951
1039
  export declare interface SearchProps {
952
- /** The placeholder in the field; without it "Search …" from the wording. */
1040
+ /** The placeholder in the field.
1041
+ @default the wording's "Search …" */
953
1042
  placeholder?: string;
954
- /** Accessible name; without it "Search table" from the wording. */
1043
+ /** Accessible name.
1044
+ @default the wording's "Search table" */
955
1045
  "aria-label"?: string;
956
1046
  /** Classes on the field. */
957
1047
  className?: string;
958
- /** `sm` or `md`; without it the size of the toolbar it stands in, `sm` outside one. */
1048
+ /** The size of the part: `sm` or `md`.
1049
+ @default the size of the toolbar it stands in, `"sm"` outside one */
959
1050
  size?: ToolbarSize;
960
1051
  /** The table, when the part does not stand inside it: the return value of `useTable`. */
961
1052
  of?: TableRef;
@@ -987,6 +1078,8 @@ export declare interface Snooze {
987
1078
  disabled for maintenance back in service. */
988
1079
  export declare function snooze(alarm: Alarm, until: number, by: string): Alarm;
989
1080
 
1081
+ /** The direction of one sort level: `asc` puts the smallest value on top,
1082
+ `desc` the largest. */
990
1083
  export declare type SortDirection = "asc" | "desc";
991
1084
 
992
1085
  /** One level of the sort. Several levels act in their order: the second decides
@@ -996,6 +1089,8 @@ export declare interface SortLevel<K extends string = string> {
996
1089
  direction: SortDirection;
997
1090
  }
998
1091
 
1092
+ /** What `useTable` returns: the table's state, and its parts typed at the
1093
+ row. Pass it as `of` to a part that stands outside the table. */
999
1094
  export declare interface Table<Z> extends TableSnapshot<Z> {
1000
1095
  Table: (props: TableProps<Z>) => ReactNode;
1001
1096
  Column: ColumnComponent<Z>;
@@ -1006,7 +1101,9 @@ export declare interface Table<Z> extends TableSnapshot<Z> {
1006
1101
  GroupBy: GroupByComponent<Z>;
1007
1102
  }
1008
1103
 
1009
- declare interface TableInput<Z = unknown, K extends string = string> {
1104
+ /** The view's state the model computes a table from, beside its rows and
1105
+ columns: search, filter, sort, page, hidden columns, order, grouping, tree. */
1106
+ export declare interface TableInput<Z = unknown, K extends string = string> {
1010
1107
  search?: string;
1011
1108
  /** An additional filter beside the free-text search, e.g. a status choice. */
1012
1109
  filter?: (row: Z) => boolean;
@@ -1048,13 +1145,15 @@ export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z>
1048
1145
  declare interface TableOptionsCommon<Z> {
1049
1146
  /** A stable key per row – the basis of selection and expansion. */
1050
1147
  rowKey: (row: Z) => string;
1051
- /** Default 10. */
1148
+ /** How many rows a page holds.
1149
+ @default 10 */
1052
1150
  pageSize?: number;
1053
- /** The application's sort; it is the default that `view` leaves out. */
1151
+ /** The application's sort; it is the default that `view` leaves out.
1152
+ @default null */
1054
1153
  defaultSort?: SortLevel | readonly SortLevel[] | null;
1055
1154
  /** 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; without it
1057
- the table is ungrouped until the user groups it. */
1155
+ outermost first. It is the default that `view` leaves out.
1156
+ @default ungrouped, until the user groups */
1058
1157
  defaultGrouping?: GroupingId<Z> | readonly GroupingId<Z>[];
1059
1158
  /** Which rows the table has at all – by permission, by tenant, by anything the
1060
1159
  user is not meant to undo. It is invisible: never a condition, never
@@ -1085,7 +1184,7 @@ declare interface TableOptionsCommon<Z> {
1085
1184
  declare interface TableProjection<Z, K extends string = string> {
1086
1185
  /** The visible columns in their order – the basis for the header row, the
1087
1186
  column menu and the CSV export. */
1088
- columns: readonly Column<Z, K>[];
1187
+ columns: readonly ModelColumn<Z, K>[];
1089
1188
  /** Everything the filter leaves – the basis for figures and the selection. */
1090
1189
  filtered: Z[];
1091
1190
  /** Only the current page - with a grouping, the rows among its lines. */
@@ -1116,6 +1215,8 @@ declare interface TableProjection<Z, K extends string = string> {
1116
1215
  columnCount: number;
1117
1216
  }
1118
1217
 
1218
+ /** The props of `Table`: how the table looks and behaves. Its state comes from
1219
+ `useTable`, its columns from the JSX inside it. */
1119
1220
  export declare interface TableProps<Z> {
1120
1221
  /** Adds the selection column. "All" means: the filtered set. */
1121
1222
  selectable?: boolean;
@@ -1126,7 +1227,8 @@ export declare interface TableProps<Z> {
1126
1227
  stickyRowHeader?: boolean;
1127
1228
  /** Discreet zebra stripes. */
1128
1229
  striped?: boolean;
1129
- /** Without a statement the density of the `UmrissProvider`, without a provider "regular". */
1230
+ /** How tightly the rows stand.
1231
+ @default the density of the `UmrissProvider`, else `"regular"` */
1130
1232
  density?: "regular" | "compact";
1131
1233
  /** Height of the scroll area, e.g. "480px". A virtualised table needs it. */
1132
1234
  maxHeight?: string;
@@ -1182,6 +1284,9 @@ export declare type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "condi
1182
1284
  setFilter(column: string, condition: unknown): void;
1183
1285
  };
1184
1286
 
1287
+ /** What `useTableSelection` returns: the selected keys and the gestures on
1288
+ them. Give it to `useTable` as `selection` when the application holds the
1289
+ selection. */
1185
1290
  export declare interface TableSelection<T extends string | number> {
1186
1291
  /** The keys currently selected. */
1187
1292
  selected: ReadonlySet<T>;
@@ -1277,7 +1382,8 @@ export declare interface TableSnapshot<Z> {
1277
1382
  unfoldAllBranches: () => void;
1278
1383
  /** Tree rows: closes every branch. */
1279
1384
  foldAllBranches: () => void;
1280
- /** The part of the state an application can keep; whatever is at its default is absent. */
1385
+ /** The part of the state an application can keep; whatever still stands as
1386
+ the options set it up is absent. */
1281
1387
  view: TableView;
1282
1388
  /** The filtered set in the visible columns as text for a spreadsheet - in
1283
1389
  manual mode the page. */
@@ -1325,13 +1431,14 @@ export declare interface TableView<K extends string = string> {
1325
1431
  has one, even where none stands; where one stands, there is no second. */
1326
1432
  export declare function Toolbar({ children, className, size, of }: ToolbarProps): JSX.Element;
1327
1433
 
1434
+ /** The props of `Toolbar`. */
1328
1435
  export declare interface ToolbarProps {
1329
1436
  /** Search, column menu, export – on the left in the table toolbar, before the conditions. */
1330
1437
  children?: ReactNode;
1331
1438
  /** Classes on the table toolbar. */
1332
1439
  className?: string;
1333
1440
  /** The size of every control the table puts into it - search, column menu,
1334
- export, "reset", the bulk actions -: `sm` (the default) or `md`. A
1441
+ export, "reset", the bulk actions -: `sm` or `md`. A
1335
1442
  control of one's own takes the same size by its own prop. */
1336
1443
  size?: ToolbarSize;
1337
1444
  /** The table, when the table toolbar does not stand inside it. If it then
@@ -1341,13 +1448,16 @@ export declare interface ToolbarProps {
1341
1448
  of?: TableRef;
1342
1449
  }
1343
1450
 
1344
- declare type ToolbarSize = "sm" | "md";
1451
+ /** The size of a toolbar's controls. */
1452
+ export declare type ToolbarSize = "sm" | "md";
1345
1453
 
1346
1454
  /** What can happen to an alarm. The caller reports the event; what it means the
1347
1455
  model knows. */
1348
1456
  export declare type Transition = "raised" | "acknowledged" | "resolved";
1349
1457
 
1350
- declare interface TreeInput<Z> {
1458
+ /** Tree rows for the model: how a row is keyed, how its children are read,
1459
+ and which branches are open. */
1460
+ export declare interface TreeInput<Z> {
1351
1461
  key: (row: Z) => string;
1352
1462
  /** `undefined` a leaf, an array a branch - the rule of core's reader. */
1353
1463
  children: (row: Z) => readonly Z[] | undefined;
@@ -1360,6 +1470,17 @@ declare interface TreeInput<Z> {
1360
1470
  /** Ends a snooze before its time. */
1361
1471
  export declare function unsnooze(alarm: Alarm): Alarm;
1362
1472
 
1473
+ /** A table over your rows: the hook holds its state - sort, filters, search,
1474
+ grouping, page, selection, column widths -, and the parts it returns are
1475
+ typed at your row, so that a field name in `Column` is checked by the
1476
+ compiler.
1477
+ @param rows All rows in automatic mode; in manual mode the page a server
1478
+ delivered for the current view.
1479
+ @param options How a row is keyed, the initial view, and in manual mode the
1480
+ server's count and the handler that hears every change of the view.
1481
+ @returns The table's state and its parts: `Table`, `Column`,
1482
+ `VerdictColumn`, `RowDetail`, `RowActions`, `Action` and `GroupBy`. Pass it
1483
+ as `of` to a part that stands outside the table. */
1363
1484
  export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
1364
1485
 
1365
1486
  /**
@@ -1370,7 +1491,7 @@ export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>
1370
1491
  export declare function useTableSelection<T extends string | number>(ids: readonly T[]): TableSelection<T>;
1371
1492
 
1372
1493
  /** How a value that does not sort or export itself does so after all. */
1373
- declare interface ValuePaths<W> {
1494
+ export declare interface ValuePaths<W> {
1374
1495
  /** What is sorted by, when not by the value itself. */
1375
1496
  sortValue?: (value: Present<W>) => string | number | Absent;
1376
1497
  /** What stands in the export, when not the value itself. */
@@ -1380,17 +1501,21 @@ declare interface ValuePaths<W> {
1380
1501
  groupValue?: (value: Present<W>) => string | number | boolean | Date | Absent;
1381
1502
  }
1382
1503
 
1383
- declare interface VerdictBase {
1504
+ /** What every verdict column takes, whether its value is a field or a
1505
+ function. */
1506
+ export declare interface VerdictBase {
1384
1507
  /** Names the column in its header, in the column menu and in the header row of the export. */
1385
1508
  label: string;
1386
1509
  /** The limit set every value is read against. */
1387
1510
  limits: LimitSet;
1388
1511
  /** How the value and its excess are written. */
1389
1512
  format?: NumberFormat;
1390
- /** What the column sorts by: by the weight of the verdict (the default; with
1391
- equal weight the existing order stays) – or by the value. */
1513
+ /** What the column sorts by: by the weight of the verdict (with equal
1514
+ weight the existing order stays) – or by the value.
1515
+ @default "verdict" */
1392
1516
  sortBy?: "verdict" | "value";
1393
- /** Initial width in pixels; without it the browser decides. */
1517
+ /** Initial width in pixels.
1518
+ @default the browser's */
1394
1519
  width?: number;
1395
1520
  /** Shows the drag grip on the header cell. */
1396
1521
  resizable?: boolean;
@@ -1403,6 +1528,9 @@ declare interface VerdictBase {
1403
1528
  aggregate?: "worst";
1404
1529
  }
1405
1530
 
1531
+ /** The `VerdictColumn` of a table, typed at its row: a numeric field, or a
1532
+ function with an `id`, whose value is read against `limits` and shown with
1533
+ its verdict. */
1406
1534
  export declare interface VerdictColumnComponent<Z> {
1407
1535
  (props: VerdictBase & {
1408
1536
  id: string;