@umriss-ui/table 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +4 -4
- package/dist/index.d.ts +56 -45
- package/dist/table.js +2033 -1996
- package/docs/llms-full.md +118 -115
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,62 @@ is one of the internal numbers from before core's first publication as `0.1.0`
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
+
## 0.13.0 – The table holds its view, and server mode (Oct. 2026)
|
|
26
|
+
|
|
27
|
+
Released together with `@umriss-ui/charts` and `@umriss-ui/schedule`, which
|
|
28
|
+
break in the same release (ADR-0047). A view handed in applies whenever its
|
|
29
|
+
content changes, every change of it is reported in every mode, and manual mode
|
|
30
|
+
is called what it is: server mode, reporting the **Request** - the five parts
|
|
31
|
+
that decide the rows - and nothing else. The old names are removed, not
|
|
32
|
+
deprecated.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
**Moving over.** Every name that went, and what stands in its place:
|
|
37
|
+
|
|
38
|
+
| Was | Is |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `useTable(rows, { manual: true, rowCount, onViewChange })` | `useTable(rows, { server: true, rowCount, onRequest })` |
|
|
41
|
+
| `ManualView` (the whole view, the five parts always present) | `TableRequest` - search, conditions, sort, page and page size, and nothing else |
|
|
42
|
+
| `onViewChange(view: ManualView)` in manual mode | `onRequest(request: TableRequest)`; `onViewChange` is the general report of every mode now (see Added) |
|
|
43
|
+
| `t.manual`, `TableSnapshot.manual`, `TableRef.manual` | `t.server`, `TableSnapshot.server`, `TableRef.server` |
|
|
44
|
+
| a `key` to start a table again from another view | the view handed in as `initialView` - a `key` still restarts |
|
|
45
|
+
|
|
46
|
+
- **Manual mode is server mode.** The option, the snapshot's flag, the type
|
|
47
|
+
of its report and the report itself are renamed as above; what the mode
|
|
48
|
+
does is unchanged. The DEV warnings say so and their ids read
|
|
49
|
+
`server-prefilter`, `server-virtual`, `server-grouping`,
|
|
50
|
+
`server-groupable`, `server-groupable-column` and `server-filter-options`.
|
|
51
|
+
- **The request is the five parts and nothing else.** `ManualView` carried
|
|
52
|
+
the whole view, widths, order and pins included, though it was reported
|
|
53
|
+
only when one of the five changed; `TableRequest` is exactly search,
|
|
54
|
+
conditions, sort, page and page size, each present at its default too. It
|
|
55
|
+
is still reported once when the table first stands and once per change.
|
|
56
|
+
- **`initialView` applies whenever its content differs from the last one
|
|
57
|
+
handed in**, no longer on the first render only. The same view again
|
|
58
|
+
changes nothing - a view written in the call is compared by its content,
|
|
59
|
+
not its identity; what a new one leaves out goes back to its default,
|
|
60
|
+
conditions, grouping, folds, pins and branches included; leaving it out
|
|
61
|
+
keeps the table's own. A table that was handed a changing `initialView`
|
|
62
|
+
and ignored it now goes to it. **A known limit:** a view handed in that
|
|
63
|
+
equals one the table reported less than a second ago, and that has not
|
|
64
|
+
come back yet, is taken for the table's own report coming back late and is
|
|
65
|
+
not applied - so that tables kept in step do not jump back. An application
|
|
66
|
+
that restores a just-reported view within that second sees no change.
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
|
|
70
|
+
- **`onViewChange(view)` in every mode**: every change of the view, once,
|
|
71
|
+
always the whole view - the one to keep, or to hand another table as its
|
|
72
|
+
`initialView`; not the view the table starts with. In server mode it hears
|
|
73
|
+
what `onRequest` does not: a width, an order, a pin, a fold, a hidden
|
|
74
|
+
column.
|
|
75
|
+
- **The demo**: the page 'Manual mode' is 'Server mode' at `/server-mode/`;
|
|
76
|
+
the old address lands there. The 'View' example keeps the reported view
|
|
77
|
+
and hands it back, without a `key`.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
25
81
|
## 0.12.0 – Every export explained, and actions that may scroll (Oct. 2026)
|
|
26
82
|
|
|
27
83
|
The package explains itself where it is used: every export carries a comment,
|
package/README.md
CHANGED
|
@@ -126,10 +126,10 @@ stylesheets by hand.
|
|
|
126
126
|
* **For monitoring**: `VerdictColumn` reads a measured value against a
|
|
127
127
|
limit set, and `AlarmList` shows alarms with a lifecycle — active or
|
|
128
128
|
resolved, acknowledged or not. The library generates no alarms (ADR-0009).
|
|
129
|
-
* **A million rows on a server**: in
|
|
130
|
-
answered; the table reports the
|
|
131
|
-
|
|
132
|
-
its way.
|
|
129
|
+
* **A million rows on a server**: in server mode (`server: true`, `rowCount`)
|
|
130
|
+
the rows are one page a server answered; the table reports the request -
|
|
131
|
+
search, conditions, sort, page, page size - through `onRequest` once per
|
|
132
|
+
change and keeps the previous page, dimmed, while the next is on its way.
|
|
133
133
|
* **Twenty thousand rows** where it has to be: virtualisation, sticky parts,
|
|
134
134
|
columns pinned to either side and column widths that survive a view being
|
|
135
135
|
restored.
|
package/dist/index.d.ts
CHANGED
|
@@ -282,7 +282,7 @@ export declare interface AlarmType {
|
|
|
282
282
|
/** The table holds every row and does the work itself. */
|
|
283
283
|
declare interface AutomaticMode<Z> {
|
|
284
284
|
/** Without it the table holds every row and does the work itself. */
|
|
285
|
-
|
|
285
|
+
server?: false;
|
|
286
286
|
/** Tree rows: the children of a row - `undefined` for a leaf, an array for a
|
|
287
287
|
branch. The rows passed in are then the roots, and every branch gets a
|
|
288
288
|
fold in its row header. Every level sorts on its own, a search shows a
|
|
@@ -293,7 +293,7 @@ declare interface AutomaticMode<Z> {
|
|
|
293
293
|
many levels stand open (`1` = the roots open). It is the default `view` leaves out. */
|
|
294
294
|
defaultBranches?: readonly string[] | number;
|
|
295
295
|
rowCount?: never;
|
|
296
|
-
|
|
296
|
+
onRequest?: never;
|
|
297
297
|
filterOptions?: never;
|
|
298
298
|
}
|
|
299
299
|
|
|
@@ -592,7 +592,7 @@ export declare interface EditOptions<W, Z> {
|
|
|
592
592
|
export declare function enable(alarm: Alarm): Alarm;
|
|
593
593
|
|
|
594
594
|
/** Writes the filtered set in the visible columns and their order – with the
|
|
595
|
-
values, not with their presentation. In
|
|
595
|
+
values, not with their presentation. In server mode the table holds one
|
|
596
596
|
page of the server's, so it writes that page, and its button says so. */
|
|
597
597
|
export declare function Export({ filename, onExport, size: own, of }: ExportProps): JSX.Element | null;
|
|
598
598
|
|
|
@@ -805,34 +805,6 @@ declare type Line<Z> = {
|
|
|
805
805
|
/** The condition of a list filter: the chosen values, an absent one as `null`. */
|
|
806
806
|
export declare type ListCondition<W> = readonly (Present<W> | null)[];
|
|
807
807
|
|
|
808
|
-
/** Manual mode: the rows are the page a server answered for the view the table
|
|
809
|
-
reported. The table searches, filters, sorts, groups and pages nothing of
|
|
810
|
-
its own; select all, the export and the footer would act on one page and
|
|
811
|
-
call it the whole, so "select all" says it selects the page, the export
|
|
812
|
-
writes the page and says so, and there is no footer and no grouping. */
|
|
813
|
-
declare interface ManualMode {
|
|
814
|
-
/** Manual mode: the rows are one page a server answered. */
|
|
815
|
-
manual: true;
|
|
816
|
-
childRows?: never;
|
|
817
|
-
defaultBranches?: never;
|
|
818
|
-
/** How many rows the server's filtered set has - the pages and the counts
|
|
819
|
-
read it. */
|
|
820
|
-
rowCount: number;
|
|
821
|
-
/** The view changed where it decides the rows: search, conditions, sort,
|
|
822
|
-
page or page size. Called once when the table first stands and once per
|
|
823
|
-
change, with every one of the five present. */
|
|
824
|
-
onViewChange: (view: ManualView) => void;
|
|
825
|
-
/** The values a list filter offers for a column, `null` for an absent one -
|
|
826
|
-
the table cannot count what it does not hold. */
|
|
827
|
-
filterOptions?: (column: string) => readonly unknown[];
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
/** The view as manual mode reports it to `onViewChange`: the parts that decide
|
|
831
|
-
the rows - search, conditions, sort, page and page size - are always there,
|
|
832
|
-
at their default as well. A server has no default of the table's to fall
|
|
833
|
-
back on, and a view it has to complete is one it completes wrongly. */
|
|
834
|
-
export declare type ManualView<K extends string = string> = TableView<K> & Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
835
|
-
|
|
836
808
|
/** A column as the model reads it - what sorting, search, hiding and the
|
|
837
809
|
export need of it, not its presentation. `alarmModel` takes them, and
|
|
838
810
|
`ALARM_COLUMNS` are the alarm list's. */
|
|
@@ -987,7 +959,7 @@ export declare interface RowDetailProps<Z> {
|
|
|
987
959
|
/** A row filter, as `rowFilter` makes it: a condition over the whole row
|
|
988
960
|
that a control of the application sets through `setFilter`. */
|
|
989
961
|
export declare interface RowFilter<Z, B> {
|
|
990
|
-
/** Its name in `t.view.conditions` and in what
|
|
962
|
+
/** Its name in `t.view.conditions` and in what server mode reports - the one
|
|
991
963
|
place the filter is spelled. Not the id of a column of the same table. */
|
|
992
964
|
readonly id: string;
|
|
993
965
|
/** What it is called: before the text of its chip, and in the chip's
|
|
@@ -1052,6 +1024,29 @@ export declare interface SearchProps {
|
|
|
1052
1024
|
of?: TableRef;
|
|
1053
1025
|
}
|
|
1054
1026
|
|
|
1027
|
+
/** Server mode: the rows are the page a server answered for the request the
|
|
1028
|
+
table reported. The table searches, filters, sorts, groups and pages nothing of
|
|
1029
|
+
its own; select all, the export and the footer would act on one page and
|
|
1030
|
+
call it the whole, so "select all" says it selects the page, the export
|
|
1031
|
+
writes the page and says so, and there is no footer and no grouping. */
|
|
1032
|
+
declare interface ServerMode {
|
|
1033
|
+
/** Server mode: the rows are one page a server answered. */
|
|
1034
|
+
server: true;
|
|
1035
|
+
childRows?: never;
|
|
1036
|
+
defaultBranches?: never;
|
|
1037
|
+
/** How many rows the server's filtered set has - the pages and the counts
|
|
1038
|
+
read it. */
|
|
1039
|
+
rowCount: number;
|
|
1040
|
+
/** The request changed: search, conditions, sort, page or page size. Called
|
|
1041
|
+
once when the table first stands and once per change, with every one of
|
|
1042
|
+
the five present - a width, an order, a pin, a fold or a hidden column
|
|
1043
|
+
asks the server nothing; `onViewChange` hears those. */
|
|
1044
|
+
onRequest: (request: TableRequest) => void;
|
|
1045
|
+
/** The values a list filter offers for a column, `null` for an absent one -
|
|
1046
|
+
the table cannot count what it does not hold. */
|
|
1047
|
+
filterOptions?: (column: string) => readonly unknown[];
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1055
1050
|
/** Sets a condition from outside. Typed at the field of the row, not at the
|
|
1056
1051
|
column: the columns stand in the JSX, and the hook does not see that
|
|
1057
1052
|
(ADR-0017). An id that is not a field name – a computed column or an `id` of
|
|
@@ -1127,10 +1122,10 @@ export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1127
1122
|
/** The collation of text keys; the provider's, where there is one. */
|
|
1128
1123
|
compareText?: (a: string, b: string) => number;
|
|
1129
1124
|
};
|
|
1130
|
-
/**
|
|
1125
|
+
/** Server mode: the rows are the page a server answered, and `rowCount` is
|
|
1131
1126
|
its filtered set. The model then searches, filters, sorts, groups and
|
|
1132
1127
|
pages nothing - it would do it over one page and call that the whole. */
|
|
1133
|
-
|
|
1128
|
+
server?: {
|
|
1134
1129
|
rowCount: number;
|
|
1135
1130
|
};
|
|
1136
1131
|
/** Tree rows: the rows are the roots, and these read their children. The
|
|
@@ -1139,8 +1134,8 @@ export declare interface TableInput<Z = unknown, K extends string = string> {
|
|
|
1139
1134
|
tree?: TreeInput<Z>;
|
|
1140
1135
|
}
|
|
1141
1136
|
|
|
1142
|
-
/** The options of `useTable`: automatic, or
|
|
1143
|
-
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> |
|
|
1137
|
+
/** The options of `useTable`: automatic, or in server mode over a server's rows. */
|
|
1138
|
+
export declare type TableOptions<Z> = TableOptionsCommon<Z> & (AutomaticMode<Z> | ServerMode);
|
|
1144
1139
|
|
|
1145
1140
|
declare interface TableOptionsCommon<Z> {
|
|
1146
1141
|
/** A stable key per row – the basis of selection and expansion. */
|
|
@@ -1169,9 +1164,17 @@ declare interface TableOptionsCommon<Z> {
|
|
|
1169
1164
|
control of its own. Named here so that a condition from `initialView`,
|
|
1170
1165
|
which arrives by id, is known in the first render. */
|
|
1171
1166
|
rowFilters?: readonly RowFilter<Z, any>[];
|
|
1172
|
-
/** The view
|
|
1173
|
-
|
|
1167
|
+
/** The view to start from, and to go to whenever one differing in content
|
|
1168
|
+
from the last is handed in - the same view again changes nothing, and
|
|
1169
|
+
what it leaves out is reset; one the table reported itself, handed back
|
|
1170
|
+
late, is its own state coming back and not gone to. The table remembers
|
|
1171
|
+
none: where a view is kept is the application's decision. Names no
|
|
1172
|
+
column carries fall out. */
|
|
1174
1173
|
initialView?: TableView;
|
|
1174
|
+
/** Every change of the view, once, always the whole view - the one to keep,
|
|
1175
|
+
or to hand another table as its `initialView`. Not called for the view
|
|
1176
|
+
the table starts with. */
|
|
1177
|
+
onViewChange?: (view: TableView) => void;
|
|
1175
1178
|
/** Renders only what stands in the scroll area; paging is then off. Every
|
|
1176
1179
|
row is one row pitch tall, which the table measures itself (ADR-0042). */
|
|
1177
1180
|
virtual?: boolean | {
|
|
@@ -1284,6 +1287,13 @@ export declare type TableRef = Omit<TableSnapshot<unknown>, "setFilter" | "condi
|
|
|
1284
1287
|
setFilter(column: string, condition: unknown): void;
|
|
1285
1288
|
};
|
|
1286
1289
|
|
|
1290
|
+
/** The request server mode reports to `onRequest`: the parts of the view that
|
|
1291
|
+
decide the rows - search, conditions, sort, page and page size - and
|
|
1292
|
+
nothing else, each at its default as well. A server has no default of the
|
|
1293
|
+
table's to fall back on, and a request it has to complete is one it
|
|
1294
|
+
completes wrongly. A width, an order, a pin or a fold is no part of it. */
|
|
1295
|
+
export declare type TableRequest<K extends string = string> = Required<Pick<TableView<K>, "search" | "conditions" | "sort" | "page" | "pageSize">>;
|
|
1296
|
+
|
|
1287
1297
|
/** What `useTableSelection` returns: the selected keys and the gestures on
|
|
1288
1298
|
them. Give it to `useTable` as `selection` when the application holds the
|
|
1289
1299
|
selection. */
|
|
@@ -1386,14 +1396,14 @@ export declare interface TableSnapshot<Z> {
|
|
|
1386
1396
|
the options set it up is absent. */
|
|
1387
1397
|
view: TableView;
|
|
1388
1398
|
/** The filtered set in the visible columns as text for a spreadsheet - in
|
|
1389
|
-
|
|
1399
|
+
server mode the page. */
|
|
1390
1400
|
asCsv: () => string;
|
|
1391
1401
|
/** Whether it virtualises. */
|
|
1392
1402
|
virtual: boolean;
|
|
1393
|
-
/** How many rows the filtered set has - in
|
|
1403
|
+
/** How many rows the filtered set has - in server mode the server's count. */
|
|
1394
1404
|
rowCount: number;
|
|
1395
|
-
/** Whether it is in
|
|
1396
|
-
|
|
1405
|
+
/** Whether it is in server mode: the rows are one page of a server's. */
|
|
1406
|
+
server: boolean;
|
|
1397
1407
|
}
|
|
1398
1408
|
|
|
1399
1409
|
/** Search, conditions, sort levels, page, page size, hidden columns, order,
|
|
@@ -1474,10 +1484,11 @@ export declare function unsnooze(alarm: Alarm): Alarm;
|
|
|
1474
1484
|
grouping, page, selection, column widths -, and the parts it returns are
|
|
1475
1485
|
typed at your row, so that a field name in `Column` is checked by the
|
|
1476
1486
|
compiler.
|
|
1477
|
-
@param rows All rows in automatic mode; in
|
|
1487
|
+
@param rows All rows in automatic mode; in server mode the page a server
|
|
1478
1488
|
delivered for the current view.
|
|
1479
|
-
@param options How a row is keyed, the
|
|
1480
|
-
|
|
1489
|
+
@param options How a row is keyed, the view to start from and the handler
|
|
1490
|
+
that hears every change of it, and in server mode the server's count and
|
|
1491
|
+
the handler that hears every request.
|
|
1481
1492
|
@returns The table's state and its parts: `Table`, `Column`,
|
|
1482
1493
|
`VerdictColumn`, `RowDetail`, `RowActions`, `Action` and `GroupBy`. Pass it
|
|
1483
1494
|
as `of` to a part that stands outside the table. */
|