@umriss-ui/table 0.43.0 → 0.45.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 +37 -0
- package/README.md +39 -3
- package/dist/index.d.ts +137 -19
- package/dist/table.css +1 -1
- package/dist/table.js +2430 -2179
- package/dist/xlsx.d.ts +48 -0
- package/dist/xlsx.js +128 -0
- package/docs/llms-full.md +1272 -98
- package/package.json +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,43 @@ is one of the internal numbers from before core's first publication as `0.1.0`
|
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
+
## 0.45.0 – A table in the plant's time (Oct. 2026)
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **The table follows the time zone named in core's formats** (ADR-0076): cells, day, week, month and year groups, the date filter's days and the aggregate's year are the zone's, and the head of a `"date"`, `"time"` or `"dateTime"` column names the zone where the reader's own is another. A date editor opens on the zone's day and commits its midnight.
|
|
34
|
+
- **The exports write the zone's wall clock:** the XLSX shows the times and days the screen shows, the CSV and the copy write a column of the zone's midnights as days, and other instants stay ISO. `ExportContext.wallClock` hands a custom format the zone's wall-clock fields of an instant.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **The row-actions trigger draws core's `MoreGlyph`** instead of the text "⋯"; its name and size stay.
|
|
39
|
+
- Migration: none for the trigger; a caller that styled it by its text styles the svg instead.
|
|
40
|
+
- **The peer range on core moves to `^0.45.0`.**
|
|
41
|
+
- Migration: install the 0.45 version of `@umriss-ui/core` beside it.
|
|
42
|
+
|
|
43
|
+
## 0.44.0 – A server that answers late, and an Excel file (Oct. 2026)
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- **Server mode, answered** (ADR-0072): `answers` names the request the rows answer, so a late answer leaves the table loading, and the snapshot carries `request`; `error` shows in place of the rows with Try again, which reports the current request again; `selection.allMatching`, `except` and `selectMatching` stand for all that match, offered as "Select all N that match" on a ticked page and counted by the toolbar as `rowCount` less the exceptions; `exportRows(request)` lets Export write every match in the visible columns (busy and announced while it runs, a rejection shown beside it); `totals` shows the server's sums over every match in the footer, a skeleton while busy, each cell reading "All matches".
|
|
48
|
+
- **Excel through `@umriss-ui/table/xlsx`** (ADR-0073): a writer of the library's own - stored ZIP, typed cells, dates as local serials, limits that throw - in a second entry of under 4 kB gzipped that the main entry does not contain, with no runtime dependency. An export format is a value handed to `Export`: `format` and `label`; `csv` is one, `snapshot.exportAs(format)` writes any; the `ExportFormat`, `ExportSheet` and `ExportContext` types are exported.
|
|
49
|
+
- **Development warnings,** once each: a column's `value`, `sortValue`, `groupValue` or the `rowKey` held for its source text that reads a changed outer value (the first 1,000 rows are probed; the way out is the value in the rows or a `key` on the column); a `pageSize` with no `Pagination`; `Toolbar`, `Search`, `ColumnMenu`, `Export` or `Pagination` in no table and without `of`; a virtual table that renders every row in a scroll area taller than the viewport (it needs `maxHeight` or a parent of definite height); a date format over a column without points in time and a number format over a column without numbers; rows that are not an array, which read as none, with the warning naming what arrived.
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
|
|
53
|
+
- **In server mode a bulk action's `onSelect` receives `Z[] | AllMatching`** (`{ request, except }`) while all that match are selected; an automatic table's receives `Z[]` (was `readonly Z[]`).
|
|
54
|
+
- Migration: handle the second shape - `Array.isArray` tells the array; the `'except'` key tells `AllMatching`.
|
|
55
|
+
- **`TableSelection` gains `allMatching`, `except` and `selectMatching`, all required.** In server mode a new search or condition clears the selection's keys and `allMatching`.
|
|
56
|
+
- Migration: a hand-built `TableSelection` adds the three.
|
|
57
|
+
- **In server mode a typed search is reported after a pause of 300 ms** instead of one request per letter; Enter, an empty field, `setSearch` and any other change report at once. The field, `t.search` and the view still take each letter at once.
|
|
58
|
+
- Migration: nothing to change; a test that typed and expected a request per letter commits with Enter or waits.
|
|
59
|
+
- **A column of days exports as its local day, `YYYY-MM-DD`,** in the CSV and the copy (ADR-0061, amended); other points in time stay ISO text.
|
|
60
|
+
- Migration: nothing to change; a test or a reader of the file that expected an ISO instant for a day column reads the day.
|
|
61
|
+
- **`ariaLabel` on `Table` is removed;** 0.43.0 renamed it `aria-label`.
|
|
62
|
+
- Migration: write `aria-label` (TypeScript flags every use of `ariaLabel`).
|
|
63
|
+
- **The peer range on core moves to `^0.44.0`.**
|
|
64
|
+
- Migration: install the 0.44 version of `@umriss-ui/core` beside it.
|
|
65
|
+
|
|
29
66
|
## 0.43.0 – A current row, and a table that stays in its frame (Oct. 2026)
|
|
30
67
|
|
|
31
68
|
### Added
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ right-aligned in the provider's notation and sortable. `rowHeader` makes the
|
|
|
65
65
|
order number the name of the row — for a screen reader, and for the sticky
|
|
66
66
|
column.
|
|
67
67
|
|
|
68
|
-
The table is a composite (ADR-0068): `ref`, `className`, `style`, `id` and `data-*` reach its outer frame, a `<div>`, and `aria-label`, `aria-labelledby` and `aria-describedby` reach the `<table>`, so give the name there. `
|
|
68
|
+
The table is a composite (ADR-0068): `ref`, `className`, `style`, `id` and `data-*` reach its outer frame, a `<div>`, and `aria-label`, `aria-labelledby` and `aria-describedby` reach the `<table>`, so give the name there. `Toolbar`, `Pagination`, `Export` and `ColumnMenu` take the attributes and the `ref` of the element they render; `Search` is an `Input` and takes its props.
|
|
69
69
|
|
|
70
70
|
A table wider than its place scrolls in its own frame, never the page; in a
|
|
71
71
|
narrow place - a phone, beside a sidebar - the toolbar and the paging bar wrap
|
|
@@ -139,12 +139,31 @@ stylesheets by hand.
|
|
|
139
139
|
* **Around the table**: toolbar, search, column menu, export, paging — each
|
|
140
140
|
usable inside the table toolbar or anywhere else on the page with `of`, and
|
|
141
141
|
one `size` for the whole bar that a control of one's own can match.
|
|
142
|
+
* **A time zone named in the formats** (core's Time zone): the dates, the day
|
|
143
|
+
groups and the date filter follow it, and the head of a `"date"`, `"time"` or
|
|
144
|
+
`"dateTime"` column names it, in muted text, where the reader's own is another.
|
|
142
145
|
* **Export and copy follow the language** (ADR-0061): the CSV takes its decimal
|
|
143
146
|
mark from the formats, yes/no from the wording and its separator from the
|
|
144
147
|
mark - English gets commas and a point, `@umriss-ui/core/wording/de` the file
|
|
145
|
-
it always had.
|
|
148
|
+
it always had. A column of days is written as `YYYY-MM-DD`, any other
|
|
149
|
+
point in time as ISO text with its offset. Under a named time zone the day is
|
|
150
|
+
the zone's, and a day is a date at the zone's midnight; the ISO text stays
|
|
151
|
+
the instant, the same for every reader. Ctrl or Cmd with C copies the selected rows as tab-separated
|
|
146
152
|
text (in grid mode with no selection, the Active cell), says so in a live
|
|
147
153
|
region, and `selectionAsText()` hands the same text to a button of one's own.
|
|
154
|
+
* **An Excel file** (ADR-0073): `import { xlsx } from "@umriss-ui/table/xlsx"` and
|
|
155
|
+
`<Export format={xlsx} />` write one sheet - a header line, numbers, dates,
|
|
156
|
+
booleans and text as what they are, and the table's column widths - the rows
|
|
157
|
+
and columns of the CSV, dates as the wall clock of the formats' time zone (the reader's local time without one). No styling, no
|
|
158
|
+
formulas, no group rows, no compression (a file is about the size of its XML,
|
|
159
|
+
so 100,000 rows of ten columns are tens of megabytes). A sheet over 1,048,576
|
|
160
|
+
rows or 16,384 columns throws a `RangeError`; a text over 32,767 characters is
|
|
161
|
+
cut. A text stays a text: `=1+1` opens as those characters, a leading zero
|
|
162
|
+
stays. `label` lets a CSV and an Excel button stand side by side, `onExport`
|
|
163
|
+
gets the bytes (`Uint8Array`), and `snapshot.exportAs(xlsx)` hands them to
|
|
164
|
+
code. An application that never imports the subpath does not bundle the
|
|
165
|
+
writer (about 4 kB gzipped). To read the file back, open it in a spreadsheet
|
|
166
|
+
or unzip it: it is a ZIP of XML parts.
|
|
148
167
|
* **On a row**: a detail row that stays open across a change of filter, row
|
|
149
168
|
actions that stay quiet until the row is meant, and a bulk action that always
|
|
150
169
|
receives a list.
|
|
@@ -154,6 +173,20 @@ stylesheets by hand.
|
|
|
154
173
|
the rows are one page a server answered; the table reports the request -
|
|
155
174
|
search, conditions, sort, page, page size - through `onRequest` once per
|
|
156
175
|
change and keeps the previous page, dimmed, while the next is on its way.
|
|
176
|
+
Typing in `Search` is reported after a pause of 300 ms without a keystroke
|
|
177
|
+
(the field and `t.search` take each letter at once); Enter, an emptied field,
|
|
178
|
+
`setSearch` and any other change of the request report at once.
|
|
179
|
+
`Export` writes the page; with `exportRows(request)` it writes every match
|
|
180
|
+
instead, in the table's own columns. The application caps and refuses: the
|
|
181
|
+
table asks for what the request names, and a rejection's message shows beside
|
|
182
|
+
the button. `answers` names the request the rows answer, so a late answer
|
|
183
|
+
leaves the table loading and is never shown as current; `error` shows the
|
|
184
|
+
application's message in place of the rows, with "Try again"; with a full page
|
|
185
|
+
ticked the table offers all that match, and a bulk action then receives
|
|
186
|
+
`{ request, except }` instead of rows (the one type a caller may have to
|
|
187
|
+
answer); `totals` fill the footer over every match. What stays the
|
|
188
|
+
application's: the cap on an export, the sums and the clearing of `error`.
|
|
189
|
+
Groups from the server are the next piece, with a spec of their own.
|
|
157
190
|
* **Twenty thousand rows** where it has to be: virtualisation, sticky parts,
|
|
158
191
|
columns pinned to either side and column widths that survive a view being
|
|
159
192
|
restored.
|
|
@@ -162,7 +195,10 @@ stylesheets by hand.
|
|
|
162
195
|
The sort stays and the rows stand in its order; a row keeps its place in the
|
|
163
196
|
markup by its `rowKey`; the selection holds by key (the count follows the rows
|
|
164
197
|
there are, and a key whose row is gone waits in the set and ticks again if the
|
|
165
|
-
row returns
|
|
198
|
+
row returns; an application that holds the selection outside, with
|
|
199
|
+
`useTableSelection`, stores `allMatching` and `except` with the keys - in
|
|
200
|
+
server mode a change of search or conditions clears them through `clear()`);
|
|
201
|
+
an open Row draft stays open with what was typed and shows its
|
|
166
202
|
other fields as they were when it opened, and closes only when its row is gone
|
|
167
203
|
from `rows`; the Active cell stays on its row by key when a re-sort moves it,
|
|
168
204
|
and where its row is gone the cell now at its index takes over; the scroll
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from '@umriss-ui/core';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
|
+
import { Formats } from '@umriss-ui/core';
|
|
3
4
|
import { HTMLAttributes } from 'react';
|
|
4
5
|
import { InputProps } from '@umriss-ui/core';
|
|
5
6
|
import { JSX } from 'react';
|
|
@@ -7,6 +8,7 @@ import { LimitSet } from '@umriss-ui/core';
|
|
|
7
8
|
import { NumberOptions } from '@umriss-ui/core';
|
|
8
9
|
import { ReactNode } from 'react';
|
|
9
10
|
import { RefProp } from '@umriss-ui/core';
|
|
11
|
+
import { Wording } from '@umriss-ui/core';
|
|
10
12
|
|
|
11
13
|
/** A value that is not there: `null` or `undefined`. */
|
|
12
14
|
export declare type Absent = null | undefined;
|
|
@@ -20,7 +22,7 @@ declare interface ActionBase {
|
|
|
20
22
|
|
|
21
23
|
/** The props of `Action`: one action on a row, or with `bulk` on a list of
|
|
22
24
|
rows - then it also stands in the table toolbar for the selection. */
|
|
23
|
-
export declare type ActionProps<Z> = (ActionBase & {
|
|
25
|
+
export declare type ActionProps<Z, S extends boolean = false> = (ActionBase & {
|
|
24
26
|
bulk?: false;
|
|
25
27
|
/** Gets the row the action was triggered on. */
|
|
26
28
|
onSelect: (row: Z) => void;
|
|
@@ -29,7 +31,7 @@ export declare type ActionProps<Z> = (ActionBase & {
|
|
|
29
31
|
toolbar on the selection within the filtered set. */
|
|
30
32
|
bulk: true;
|
|
31
33
|
/** With `bulk` a list: at the row one made from it, in the table toolbar the selection. */
|
|
32
|
-
onSelect
|
|
34
|
+
onSelect(selected: S extends true ? Z[] | AllMatching : Z[]): void;
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
/** A column that carries an aggregate, as the pipeline needs it. */
|
|
@@ -68,6 +70,15 @@ export declare interface AggregateOptions<W, Z> {
|
|
|
68
70
|
share?: boolean;
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
/** What a server-mode bulk action receives, in the toolbar, while all that
|
|
74
|
+
match are selected: the request they match and the keys unticked since.
|
|
75
|
+
`Array.isArray` tells it from rows - the rows are typed as a mutable array
|
|
76
|
+
so that it narrows both ways. */
|
|
77
|
+
export declare interface AllMatching {
|
|
78
|
+
request: TableRequest;
|
|
79
|
+
except: readonly string[];
|
|
80
|
+
}
|
|
81
|
+
|
|
71
82
|
/** The table holds every row and does the work itself. */
|
|
72
83
|
declare interface AutomaticMode<Z> {
|
|
73
84
|
/** Without it the table holds every row and does the work itself. */
|
|
@@ -83,7 +94,11 @@ declare interface AutomaticMode<Z> {
|
|
|
83
94
|
defaultBranches?: readonly string[] | number;
|
|
84
95
|
rowCount?: never;
|
|
85
96
|
onRequest?: never;
|
|
97
|
+
exportRows?: never;
|
|
86
98
|
filterOptions?: never;
|
|
99
|
+
answers?: never;
|
|
100
|
+
error?: never;
|
|
101
|
+
totals?: never;
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
/** An edit the user committed - reported, not applied. */
|
|
@@ -267,6 +282,10 @@ export declare type Computed<Z, W> = ColumnBase & ValuePaths<W> & {
|
|
|
267
282
|
validate?: (value: W | null, row: Z) => string | null | undefined;
|
|
268
283
|
};
|
|
269
284
|
|
|
285
|
+
/** The CSV: the language's conventions; a column of days as the zone's day,
|
|
286
|
+
other points in time as ISO text. */
|
|
287
|
+
export declare const csv: ExportFormat;
|
|
288
|
+
|
|
270
289
|
/** The names of the standard presentations of a point in time. */
|
|
271
290
|
export declare type DateFormat = "date" | "time" | "dateTime";
|
|
272
291
|
|
|
@@ -298,17 +317,54 @@ export declare interface EditOptions<W, Z> {
|
|
|
298
317
|
|
|
299
318
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
300
319
|
values, not with their presentation. In server mode the table holds one
|
|
301
|
-
page of the server's, so it writes that page, and its button says so
|
|
302
|
-
|
|
320
|
+
page of the server's, so it writes that page, and its button says so;
|
|
321
|
+
with `exportRows` it asks the application for every row of the current
|
|
322
|
+
request instead and writes those. */
|
|
323
|
+
export declare function Export<R = string>({ format: given, filename, onExport, label, size: own, of, ...rest }: ExportProps<R>): JSX.Element | null;
|
|
324
|
+
|
|
325
|
+
/** What a spreadsheet cell holds: numbers, booleans and points in time stay
|
|
326
|
+
what they are, an absent value is `undefined`. */
|
|
327
|
+
export declare type ExportCell = string | number | boolean | Date | undefined;
|
|
328
|
+
|
|
329
|
+
/** What the language in use hands a format. */
|
|
330
|
+
export declare interface ExportContext {
|
|
331
|
+
formats: Formats;
|
|
332
|
+
wording: Wording;
|
|
333
|
+
/** The wall-clock fields of an instant in the table's time zone; absent
|
|
334
|
+
without one, where the writer reads the Date's own. A format that must
|
|
335
|
+
import nothing gets the zone this way, as data. */
|
|
336
|
+
wallClock?: (d: Date) => {
|
|
337
|
+
year: number;
|
|
338
|
+
month: number;
|
|
339
|
+
day: number;
|
|
340
|
+
hours: number;
|
|
341
|
+
minutes: number;
|
|
342
|
+
seconds: number;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** A way to write the export: the file's extension and MIME type, and the
|
|
347
|
+
function that turns the sheet into `R` - text or bytes. */
|
|
348
|
+
export declare interface ExportFormat<R = string> {
|
|
349
|
+
extension: string;
|
|
350
|
+
mime: string;
|
|
351
|
+
write: (sheet: ExportSheet, context: ExportContext) => R;
|
|
352
|
+
}
|
|
303
353
|
|
|
304
354
|
/** The props of `Export`: by default a CSV file is downloaded; with
|
|
305
355
|
`onExport` the text is handed over instead. */
|
|
306
|
-
export declare interface ExportProps extends Omit<ButtonProps, "size" | "children" | "onClick" | "variant" | "loading"> {
|
|
356
|
+
export declare interface ExportProps<R = string> extends Omit<ButtonProps, "size" | "children" | "onClick" | "variant" | "loading"> {
|
|
357
|
+
/** What is written: `csv`, or a format of one's own.
|
|
358
|
+
@default csv */
|
|
359
|
+
format?: ExportFormat<R>;
|
|
307
360
|
/** File name of the download.
|
|
308
|
-
@default the wording's "table.csv" */
|
|
361
|
+
@default the base of the wording's "table.csv" with the format's extension */
|
|
309
362
|
filename?: string;
|
|
310
|
-
/** Gets the
|
|
311
|
-
onExport?: (
|
|
363
|
+
/** Gets what the format wrote instead of triggering a file. */
|
|
364
|
+
onExport?: (content: R) => void;
|
|
365
|
+
/** The button's text.
|
|
366
|
+
@default the wording's export label */
|
|
367
|
+
label?: ReactNode;
|
|
312
368
|
/** The size of the part: `sm` or `md`.
|
|
313
369
|
@default the size of the toolbar it stands in, `"sm"` outside one */
|
|
314
370
|
size?: ToolbarSize;
|
|
@@ -316,6 +372,18 @@ export declare interface ExportProps extends Omit<ButtonProps, "size" | "childre
|
|
|
316
372
|
of?: TableRef;
|
|
317
373
|
}
|
|
318
374
|
|
|
375
|
+
/** What a format writes: the header labels, the widths the table holds, whether
|
|
376
|
+
a column's own `exportValue` made its values (`own`: written as they come),
|
|
377
|
+
and the rows as typed cells. A tree's level is its first column, a number. */
|
|
378
|
+
export declare interface ExportSheet {
|
|
379
|
+
columns: readonly {
|
|
380
|
+
label: string;
|
|
381
|
+
width?: number;
|
|
382
|
+
own?: true;
|
|
383
|
+
}[];
|
|
384
|
+
rows: readonly (readonly ExportCell[])[];
|
|
385
|
+
}
|
|
386
|
+
|
|
319
387
|
/** The field names of a row. */
|
|
320
388
|
export declare type Field<Z> = Extract<keyof Z, string>;
|
|
321
389
|
|
|
@@ -580,7 +648,9 @@ export declare interface RowSave<Z> {
|
|
|
580
648
|
|
|
581
649
|
/** The table's search field: one text over every column that searches, in
|
|
582
650
|
the table toolbar. With a search the table puts up a toolbar of its own
|
|
583
|
-
where none stands. Outside the table it needs `of`.
|
|
651
|
+
where none stands. Outside the table it needs `of`. In server mode typing is
|
|
652
|
+
reported to `onRequest` after a pause of 300 ms without a keystroke; Enter,
|
|
653
|
+
an emptied field, `setSearch` and any other change of the request report at once. */
|
|
584
654
|
export declare function Search({ placeholder, "aria-label": name, className, size: own, grow, of, ...rest }: SearchProps): JSX.Element | null;
|
|
585
655
|
|
|
586
656
|
/** The props of `Search`. */
|
|
@@ -605,10 +675,12 @@ export declare interface SearchProps extends Omit<InputProps, "size" | "type" |
|
|
|
605
675
|
|
|
606
676
|
/** Server mode: the rows are the page a server answered for the request the
|
|
607
677
|
table reported. The table searches, filters, sorts, groups and pages nothing of
|
|
608
|
-
its own;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
678
|
+
its own; there is no grouping. After a full page is ticked, select all
|
|
679
|
+
offers every row that matches, as a state a bulk action receives as
|
|
680
|
+
`AllMatching`; the export writes every match when `exportRows` is given and
|
|
681
|
+
the page, saying so, when it is not; the footer shows `totals` or nothing,
|
|
682
|
+
since a sum over one page would be called the sum. */
|
|
683
|
+
declare interface ServerMode<Z> {
|
|
612
684
|
/** Server mode: the rows are one page a server answered. */
|
|
613
685
|
server: true;
|
|
614
686
|
childRows?: never;
|
|
@@ -621,9 +693,38 @@ declare interface ServerMode {
|
|
|
621
693
|
the five present - a width, an order, a pin, a fold or a hidden column
|
|
622
694
|
asks the server nothing; `onViewChange` hears those. */
|
|
623
695
|
onRequest: (request: TableRequest) => void;
|
|
696
|
+
/** The request the rows answer. While it is not the table's current request
|
|
697
|
+
(compared by key) the table is busy as `loading` makes it: the rows dim,
|
|
698
|
+
take no pointer and `aria-busy` is set, while the search, the conditions
|
|
699
|
+
and the page already show the new request - so an answer that comes late
|
|
700
|
+
never stands as current. Without it the rows are taken as the current
|
|
701
|
+
answer. In development the table warns once when it has matched none of
|
|
702
|
+
the requests it reported. */
|
|
703
|
+
answers?: TableRequest;
|
|
704
|
+
/** The failure of the fetch, a message the application wrote: it stands in
|
|
705
|
+
place of the rows, in the height of a page, with "Try again", which calls
|
|
706
|
+
`onRequest` with the current request once more. With `answers` it is the
|
|
707
|
+
failure of that request and shows only while it is the current one;
|
|
708
|
+
without, as soon as it is set. It wins over `loading`. The table clears
|
|
709
|
+
nothing - the application does, usually in `onRequest`. */
|
|
710
|
+
error?: string;
|
|
711
|
+
/** By column id, the value of the column's declared `aggregate` over every
|
|
712
|
+
match - handed in beside `rows` and current when `answers` is. The footer
|
|
713
|
+
shows when this is passed and a column declares an `aggregate`; its cells
|
|
714
|
+
take the value instead of computing it, formatted with the column's
|
|
715
|
+
format (a `range` is `[min, max]`; every kind and an aggregate of one's
|
|
716
|
+
own are taken as given). A missing key shows the absent value; while the
|
|
717
|
+
table is busy the cells are skeleton. Without it there is no footer. */
|
|
718
|
+
totals?: Readonly<Record<string, unknown>>;
|
|
624
719
|
/** The values a list filter offers for a column, `null` for an absent one -
|
|
625
720
|
the table cannot count what it does not hold. */
|
|
626
721
|
filterOptions?: (column: string) => readonly unknown[];
|
|
722
|
+
/** Every row of a request, for the export: `Export` hands over the current
|
|
723
|
+
request unchanged and writes what comes back in the visible columns. The
|
|
724
|
+
application ignores `page` and `pageSize`, keeps the sort, and caps or
|
|
725
|
+
refuses a set that is too large - a rejection's message shows beside the
|
|
726
|
+
button. Without it `Export` writes the page. */
|
|
727
|
+
exportRows?: (request: TableRequest) => Promise<readonly Z[]>;
|
|
627
728
|
}
|
|
628
729
|
|
|
629
730
|
/** Sets a condition from outside. Typed at the field of the row, not at the
|
|
@@ -650,13 +751,13 @@ export declare interface SortLevel<K extends string = string> {
|
|
|
650
751
|
|
|
651
752
|
/** What `useTable` returns: the table's state, and its parts typed at the
|
|
652
753
|
row. Pass it as `of` to a part that stands outside the table. */
|
|
653
|
-
export declare interface Table<Z> extends TableSnapshot<Z> {
|
|
754
|
+
export declare interface Table<Z, S extends boolean = false> extends TableSnapshot<Z> {
|
|
654
755
|
Table: (props: TableProps<Z>) => ReactNode;
|
|
655
756
|
Column: ColumnComponent<Z>;
|
|
656
757
|
VerdictColumn: VerdictColumnComponent<Z>;
|
|
657
758
|
RowDetail: (props: RowDetailProps<Z>) => ReactNode;
|
|
658
759
|
RowActions: (props: RowActionsProps) => ReactNode;
|
|
659
|
-
Action: (props: ActionProps<Z>) => ReactNode;
|
|
760
|
+
Action: (props: ActionProps<Z, S>) => ReactNode;
|
|
660
761
|
GroupBy: GroupByComponent<Z>;
|
|
661
762
|
/** Brings the row with this key into view and returns `true`: in a paged table its page, in a scroll area, virtual or not, the scroll to it. `false`, with nothing changed, for a key the table does not have, a row a search, a condition or the `preFilter` hides, a row inside a folded group or branch, or a table not mounted; nothing is unfolded and no filter cleared. In server mode it reaches the rows of the page it holds. */
|
|
662
763
|
scrollToRow: (key: string) => boolean;
|
|
@@ -702,7 +803,7 @@ export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
702
803
|
}
|
|
703
804
|
|
|
704
805
|
/** The options of `useTable`: automatic, or in server mode over a server's rows. */
|
|
705
|
-
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> | ServerMode);
|
|
806
|
+
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> | ServerMode<Z>);
|
|
706
807
|
|
|
707
808
|
declare interface TableOptionsCommon<Z> {
|
|
708
809
|
/** A stable key per row – the basis of selection and expansion. */
|
|
@@ -784,9 +885,6 @@ export declare interface TableProps<Z> extends Omit<HTMLAttributes<HTMLDivElemen
|
|
|
784
885
|
grid mode Enter on a cell with nothing to edit or enter. Without a
|
|
785
886
|
`rowHeader` column the keyboard cannot choose a row. */
|
|
786
887
|
onCurrentRowChange?: (key: string, row: Z) => void;
|
|
787
|
-
/** Accessible name of the table.
|
|
788
|
-
@deprecated since 0.43 - use `aria-label`. */
|
|
789
|
-
ariaLabel?: string;
|
|
790
888
|
/** `false`: the user cannot group this table - the column menu offers no
|
|
791
889
|
grouping, and a grouping handed in is passed over. */
|
|
792
890
|
groupable?: boolean;
|
|
@@ -851,6 +949,15 @@ export declare interface TableSelection<T extends string | number> {
|
|
|
851
949
|
allSelected: boolean;
|
|
852
950
|
/** true when some - but not all - are selected. */
|
|
853
951
|
someSelected: boolean;
|
|
952
|
+
/** Every row that matches is selected, those on no page held included. While
|
|
953
|
+
it stands `selected` is empty and `count` is 0, and `isSelected(id)` is
|
|
954
|
+
`!except.has(id)`. Store it with the keys when the selection is held
|
|
955
|
+
outside. */
|
|
956
|
+
allMatching: boolean;
|
|
957
|
+
/** While `allMatching`: the keys unticked since. */
|
|
958
|
+
except: ReadonlySet<T>;
|
|
959
|
+
/** Selects all that match; the keys selected before are dropped. */
|
|
960
|
+
selectMatching: () => void;
|
|
854
961
|
count: number;
|
|
855
962
|
}
|
|
856
963
|
|
|
@@ -945,6 +1052,10 @@ export declare interface TableSnapshot<Z> {
|
|
|
945
1052
|
/** The filtered set in the visible columns as text for a spreadsheet - in
|
|
946
1053
|
server mode the page. */
|
|
947
1054
|
asCsv: () => string;
|
|
1055
|
+
/** The same rows and columns written by a format: `csv` for text, a format
|
|
1056
|
+
of one's own for anything else. `asCsv()` is `exportAs(csv)`. With
|
|
1057
|
+
`rows`, those rows instead of the filtered set. */
|
|
1058
|
+
exportAs<R>(format: ExportFormat<R>, rows?: readonly Z[]): R;
|
|
948
1059
|
/** The selected rows within the filtered set as tab-separated text under a
|
|
949
1060
|
header line - the text Ctrl+C writes. `""` with nothing selected. */
|
|
950
1061
|
selectionAsText: () => string;
|
|
@@ -954,6 +1065,9 @@ export declare interface TableSnapshot<Z> {
|
|
|
954
1065
|
rowCount: number;
|
|
955
1066
|
/** Whether it is in server mode: the rows are one page of a server's. */
|
|
956
1067
|
server: boolean;
|
|
1068
|
+
/** Server mode: the request `onRequest` last received, or is about to;
|
|
1069
|
+
`null` outside it. */
|
|
1070
|
+
request: TableRequest | null;
|
|
957
1071
|
}
|
|
958
1072
|
|
|
959
1073
|
/** Search, conditions, sort levels, page, page size, hidden columns, order,
|
|
@@ -1035,6 +1149,10 @@ export declare interface TreeInput<Z> {
|
|
|
1035
1149
|
@returns The table's state and its parts: `Table`, `Column`,
|
|
1036
1150
|
`VerdictColumn`, `RowDetail`, `RowActions`, `Action` and `GroupBy`. Pass it
|
|
1037
1151
|
as `of` to a part that stands outside the table. */
|
|
1152
|
+
export declare function useTable<Z>(rows: readonly Z[], options: Extract<TableOptions<Z>, {
|
|
1153
|
+
server: true;
|
|
1154
|
+
}>): Table<Z, true>;
|
|
1155
|
+
|
|
1038
1156
|
export declare function useTable<Z>(rows: readonly Z[], options: TableOptions<Z>): Table<Z>;
|
|
1039
1157
|
|
|
1040
1158
|
/**
|