@speles7172/controls 0.5.0 → 0.6.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/README.md +101 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/ChipRow.d.ts +50 -0
- package/dist/ChipRow.d.ts.map +1 -0
- package/dist/ChipRow.js +35 -0
- package/dist/ChipRow.js.map +1 -0
- package/dist/DataTable.d.ts +123 -2
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +173 -36
- package/dist/DataTable.js.map +1 -1
- package/dist/DateRangeFilter.d.ts +21 -1
- package/dist/DateRangeFilter.d.ts.map +1 -1
- package/dist/DateRangeFilter.js +90 -19
- package/dist/DateRangeFilter.js.map +1 -1
- package/dist/ItemList.d.ts +54 -0
- package/dist/ItemList.d.ts.map +1 -0
- package/dist/ItemList.js +29 -0
- package/dist/ItemList.js.map +1 -0
- package/dist/Modal.d.ts +46 -1
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +155 -12
- package/dist/Modal.js.map +1 -1
- package/dist/Pagination.d.ts +25 -0
- package/dist/Pagination.d.ts.map +1 -0
- package/dist/Pagination.js +19 -0
- package/dist/Pagination.js.map +1 -0
- package/dist/SearchableMultiSelect.d.ts.map +1 -1
- package/dist/SearchableMultiSelect.js +1 -1
- package/dist/SearchableMultiSelect.js.map +1 -1
- package/dist/Toast.d.ts +36 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +68 -0
- package/dist/Toast.js.map +1 -0
- package/dist/csv.d.ts +21 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +56 -0
- package/dist/csv.js.map +1 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +790 -24
- package/dist/useDensity.d.ts +24 -0
- package/dist/useDensity.d.ts.map +1 -0
- package/dist/useDensity.js +61 -0
- package/dist/useDensity.js.map +1 -0
- package/dist/usePagination.d.ts +25 -0
- package/dist/usePagination.d.ts.map +1 -0
- package/dist/usePagination.js +59 -0
- package/dist/usePagination.js.map +1 -0
- package/dist/useTableSort.d.ts +50 -0
- package/dist/useTableSort.d.ts.map +1 -0
- package/dist/useTableSort.js +73 -0
- package/dist/useTableSort.js.map +1 -0
- package/package.json +2 -2
package/dist/DataTable.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import type { ControlTheme } from './types.js';
|
|
3
|
+
import { type SortValue } from './useTableSort.js';
|
|
4
|
+
import { type CsvValue } from './csv.js';
|
|
3
5
|
/** Which way a sorted column is ordered. */
|
|
4
6
|
export type SortDirection = 'asc' | 'desc';
|
|
5
7
|
/** One column of a {@link DataTable}. */
|
|
@@ -25,9 +27,80 @@ export interface ColumnDef<T> {
|
|
|
25
27
|
className?: string;
|
|
26
28
|
/** Extra class on the head cell. */
|
|
27
29
|
headerClassName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The value this column sorts by, when the table sorts itself (no `onSort`).
|
|
32
|
+
*
|
|
33
|
+
* `render` returns markup, which cannot be compared — so a column that sorts
|
|
34
|
+
* says how to rank its rows with a plain value here. Omit it and the column is
|
|
35
|
+
* not sortable in self-managed mode. A table given an `onSort` sorts its rows
|
|
36
|
+
* itself (server-side, or over its own state) and ignores this.
|
|
37
|
+
*/
|
|
38
|
+
sortValue?(item: T): SortValue;
|
|
28
39
|
/** The cell, given the row and its index. */
|
|
29
40
|
render(item: T, index: number): ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* The value this column writes to a CSV when the table is `exportable`.
|
|
43
|
+
*
|
|
44
|
+
* `render` returns markup, so a column says here what its cell *means* as
|
|
45
|
+
* text — a money column its decimal, a link its name. Omit it and the column
|
|
46
|
+
* exports its `sortValue` when that is a string or number; a column with
|
|
47
|
+
* neither is left out of the file (a share bar, an action column).
|
|
48
|
+
*/
|
|
49
|
+
csv?(item: T): CsvValue;
|
|
50
|
+
/**
|
|
51
|
+
* The header this column writes to the CSV when it should say more than the
|
|
52
|
+
* on-screen `label` — a money column names its currency (`Given (USD)`) so the
|
|
53
|
+
* file stands on its own, where the page's title or filter already said it.
|
|
54
|
+
*/
|
|
55
|
+
csvLabel?: string;
|
|
56
|
+
/**
|
|
57
|
+
* An optional column total for the table's footer, given **every** row the
|
|
58
|
+
* table was handed (the full set the caller passed — the filtered set, not just
|
|
59
|
+
* the visible page), so a total answers "everything matching the filter", not
|
|
60
|
+
* "this page".
|
|
61
|
+
*
|
|
62
|
+
* Define it on any column and the table grows one `<tfoot>` summary row;
|
|
63
|
+
* columns without it render an empty footer cell (kept for alignment in table
|
|
64
|
+
* layout, hidden in the stacked card layout). The footer only appears when
|
|
65
|
+
* there are rows.
|
|
66
|
+
*
|
|
67
|
+
* Supported in the self-paginated (`auto`) and un-paginated (`off`) modes,
|
|
68
|
+
* where the given `rows` are the whole set. It is suppressed under
|
|
69
|
+
* `controlled` pagination, where `rows` is one server page and a "total" would
|
|
70
|
+
* really be a per-page subtotal.
|
|
71
|
+
*/
|
|
72
|
+
footer?(rows: T[]): ReactNode;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* How a table paginates.
|
|
76
|
+
*
|
|
77
|
+
* `undefined`/`true` → the table pages itself over the rows it was given (the
|
|
78
|
+
* default): it owns the page, slices the array, and renders the footer, which
|
|
79
|
+
* appears only once the rows run past a single page. So every list paginates
|
|
80
|
+
* with no wiring, and a short one looks exactly as it did.
|
|
81
|
+
* `false` → no paging: render every row. For a report, a chart-linked table, or
|
|
82
|
+
* a sub-table already handed a single page by its parent.
|
|
83
|
+
* object → `{ pageSize?, pageSizeOptions? }` to tune the self-managed default,
|
|
84
|
+
* or `{ mode: 'controlled', … }` when a parent pages server-side.
|
|
85
|
+
*/
|
|
86
|
+
export interface DataTablePaginationAuto {
|
|
87
|
+
mode?: 'auto';
|
|
88
|
+
/** Initial rows per page, before the reader's stored choice. Defaults to 20. */
|
|
89
|
+
pageSize?: number;
|
|
90
|
+
/** The rows-per-page choices in the footer. Defaults to `[20, 50, 100]`. */
|
|
91
|
+
pageSizeOptions?: number[];
|
|
30
92
|
}
|
|
93
|
+
export interface DataTablePaginationControlled {
|
|
94
|
+
mode: 'controlled';
|
|
95
|
+
page: number;
|
|
96
|
+
pageSize: number;
|
|
97
|
+
/** The total across every page, from the server response. */
|
|
98
|
+
totalItems: number;
|
|
99
|
+
onPageChange(page: number): void;
|
|
100
|
+
onPageSizeChange(size: number): void;
|
|
101
|
+
pageSizeOptions?: number[];
|
|
102
|
+
}
|
|
103
|
+
export type DataTablePagination = boolean | DataTablePaginationAuto | DataTablePaginationControlled;
|
|
31
104
|
export interface DataTableProps<T> {
|
|
32
105
|
columns: ColumnDef<T>[];
|
|
33
106
|
rows: T[];
|
|
@@ -36,8 +109,18 @@ export interface DataTableProps<T> {
|
|
|
36
109
|
sortKey?: string | null;
|
|
37
110
|
sortDirection?: SortDirection;
|
|
38
111
|
onSort?(key: string): void;
|
|
112
|
+
/** How the table paginates. Self-managed over the given rows by default; see {@link DataTablePagination}. */
|
|
113
|
+
pagination?: DataTablePagination;
|
|
39
114
|
onRowClick?(item: T): void;
|
|
40
115
|
rowClassName?(item: T): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* A native tooltip for the whole row, shown on hover (the `title` attribute).
|
|
118
|
+
*
|
|
119
|
+
* For the detail a row carries but does not spend a column on — a donation's
|
|
120
|
+
* note, say — so hovering the row surfaces it without a column of its own.
|
|
121
|
+
* Return `undefined` for a row with nothing to add.
|
|
122
|
+
*/
|
|
123
|
+
rowTitle?(item: T): string | undefined;
|
|
41
124
|
/** Whether a row reads as the selected one. */
|
|
42
125
|
isSelected?(item: T): boolean;
|
|
43
126
|
/**
|
|
@@ -75,11 +158,49 @@ export interface DataTableProps<T> {
|
|
|
75
158
|
* consoles look on a phone, and none of them has been looked at on one.
|
|
76
159
|
*/
|
|
77
160
|
stack?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Draw a row as a card, with whatever the caller puts inside it — a master
|
|
163
|
+
* pane's name-amount-meta row, a phone list's avatar card — instead of a
|
|
164
|
+
* labelled list of its cells.
|
|
165
|
+
*
|
|
166
|
+
* Used in the stacked layout below the narrow breakpoint when `stack` is on
|
|
167
|
+
* (the table shape stays above it), or always with `cards`. A card keeps the
|
|
168
|
+
* table's opening by click and keyboard, its selection, its leading and
|
|
169
|
+
* trailing cells and its pagination; the column heads, sorting and the totals
|
|
170
|
+
* footer belong to the table shape and are not drawn.
|
|
171
|
+
*/
|
|
172
|
+
rowCard?(item: T, index: number): ReactNode;
|
|
173
|
+
/** Always draw the rows as cards (needs `rowCard`), not only when stacked. */
|
|
174
|
+
cards?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Offer the reader a compact row height, remembered across screens.
|
|
177
|
+
*
|
|
178
|
+
* Off by default: turning it on adds a small toolbar above the table with a
|
|
179
|
+
* "Compact rows" toggle, and honours the shared choice (`useDensity`) by
|
|
180
|
+
* tightening every row. The preference is one `localStorage` key, so a list
|
|
181
|
+
* that opts in stays in step with every other that does — a reviewer who wants
|
|
182
|
+
* more rows on screen says so once (CRM.md §18.6). A table that does not opt in
|
|
183
|
+
* is unchanged, toolbar and all.
|
|
184
|
+
*/
|
|
185
|
+
density?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Offer the reader the table as a CSV file: an **Export CSV** button in the
|
|
188
|
+
* toolbar that writes **every row the table was given** (the whole filtered
|
|
189
|
+
* set, in the table's current order — not just the page on screen), one
|
|
190
|
+
* column per `ColumnDef` that has a `csv` or a plain `sortValue`, headed by
|
|
191
|
+
* the column labels. The file is named after `label` unless `filename` says
|
|
192
|
+
* otherwise. The button is disabled when there is nothing to export.
|
|
193
|
+
*/
|
|
194
|
+
exportable?: boolean | {
|
|
195
|
+
filename?: string;
|
|
196
|
+
};
|
|
78
197
|
/** Accessible name, when the surrounding heading is not adjacent to it. */
|
|
79
198
|
label?: string;
|
|
80
199
|
className?: string;
|
|
81
200
|
theme?: ControlTheme;
|
|
82
201
|
}
|
|
202
|
+
/** The whole table as CSV text over `rows` — the columns that can export, headed by their labels. */
|
|
203
|
+
export declare function tableToCsv<T>(columns: ColumnDef<T>[], rows: readonly T[]): string;
|
|
83
204
|
/**
|
|
84
205
|
* A sortable column head.
|
|
85
206
|
*
|
|
@@ -124,5 +245,5 @@ export declare function SortableColumn({ label, sortKey, activeKey, direction, o
|
|
|
124
245
|
* />
|
|
125
246
|
* ```
|
|
126
247
|
*/
|
|
127
|
-
export declare function DataTable<T>({ columns, rows, rowKey, sortKey, sortDirection, onSort, onRowClick, rowClassName, isSelected, rowHeader, leadingHeader, leadingCell, trailingHeader, trailingCell, stack, empty, label, className, theme, }: DataTableProps<T>): import("react").JSX.Element;
|
|
248
|
+
export declare function DataTable<T>({ columns, rows, rowKey, sortKey, sortDirection, onSort, onRowClick, rowClassName, rowTitle, isSelected, rowHeader, leadingHeader, leadingCell, trailingHeader, trailingCell, stack, rowCard, cards, density, exportable, empty, label, className, theme, pagination, }: DataTableProps<T>): import("react").JSX.Element;
|
|
128
249
|
//# sourceMappingURL=DataTable.d.ts.map
|
package/dist/DataTable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1E,4CAA4C;AAC5C,MAAM,M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,EACrB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,KAAa,EACb,OAAO,EACP,KAAa,EACb,OAAe,EACf,UAAkB,EAClB,KAA0B,EAC1B,KAAK,EACL,SAAS,EACT,KAAe,EACf,UAAU,GACX,EAAE,cAAc,CAAC,CAAC,CAAC,+BAkOnB"}
|
package/dist/DataTable.js
CHANGED
|
@@ -1,11 +1,114 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { SortAscendingIcon, SortDescendingIcon, SortableIcon } from './icons.js';
|
|
4
|
+
import { Pagination } from './Pagination.js';
|
|
5
|
+
import { usePagination } from './usePagination.js';
|
|
6
|
+
import { useDensity } from './useDensity.js';
|
|
7
|
+
import { useTableSort } from './useTableSort.js';
|
|
8
|
+
import { csvFileName, downloadCsv, toCsv } from './csv.js';
|
|
9
|
+
function resolvePagination(pagination) {
|
|
10
|
+
if (pagination === false)
|
|
11
|
+
return { mode: 'off' };
|
|
12
|
+
if (pagination === undefined || pagination === true)
|
|
13
|
+
return { mode: 'auto' };
|
|
14
|
+
if ('mode' in pagination && pagination.mode === 'controlled')
|
|
15
|
+
return { ...pagination, mode: 'controlled' };
|
|
16
|
+
return {
|
|
17
|
+
mode: 'auto',
|
|
18
|
+
...(pagination.pageSize === undefined ? {} : { pageSize: pagination.pageSize }),
|
|
19
|
+
...(pagination.pageSizeOptions === undefined ? {} : { pageSizeOptions: pagination.pageSizeOptions }),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** A column's exported text: its `csv`, else a plain `sortValue`; `undefined` means it has none. */
|
|
23
|
+
function csvValue(column, item) {
|
|
24
|
+
if (column.csv !== undefined)
|
|
25
|
+
return column.csv(item);
|
|
26
|
+
const value = column.sortValue?.(item);
|
|
27
|
+
return typeof value === 'string' || typeof value === 'number' ? value : undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The columns that can export: a `csv`, or a `sortValue` (whose text is checked per row). */
|
|
30
|
+
function exportableColumns(columns) {
|
|
31
|
+
return columns.filter((column) => column.csv !== undefined || column.sortValue !== undefined);
|
|
32
|
+
}
|
|
33
|
+
/** The whole table as CSV text over `rows` — the columns that can export, headed by their labels. */
|
|
34
|
+
export function tableToCsv(columns, rows) {
|
|
35
|
+
const exported = exportableColumns(columns);
|
|
36
|
+
return toCsv(exported.map((column) => column.csvLabel ?? column.label), rows.map((item) => exported.map((column) => csvValue(column, item))));
|
|
37
|
+
}
|
|
3
38
|
/** Everything that handles its own click, for a row that also handles clicks. */
|
|
4
39
|
const INTERACTIVE = 'button, a[href], input, select, textarea, label, [role="button"]';
|
|
5
40
|
/** Whether an event landed on a control inside the row rather than on the row. */
|
|
6
41
|
function interactive(target) {
|
|
7
42
|
return target instanceof Element && target.closest(INTERACTIVE) !== null;
|
|
8
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* The handlers that make a row openable — by click, by Enter/Space, and
|
|
46
|
+
* walked with the arrow keys (or j/k) — shared by the table row and the card,
|
|
47
|
+
* so the two shapes open and move the same way.
|
|
48
|
+
*/
|
|
49
|
+
function rowInteraction(onRowClick, item) {
|
|
50
|
+
if (onRowClick === undefined)
|
|
51
|
+
return {};
|
|
52
|
+
return {
|
|
53
|
+
// A clickable row is reachable by keyboard, or the whole table is
|
|
54
|
+
// mouse-only — which is how a "click the row for detail" console ends up
|
|
55
|
+
// with no way to open a record at all.
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
onClick: (event) => {
|
|
58
|
+
// A control inside a cell is its own: without this, the delete button in
|
|
59
|
+
// the action column also opens the record it just deleted.
|
|
60
|
+
if (interactive(event.target))
|
|
61
|
+
return;
|
|
62
|
+
onRowClick(item);
|
|
63
|
+
},
|
|
64
|
+
onKeyDown: (event) => {
|
|
65
|
+
// A key pressed inside a cell's own control (a button, a link) is that
|
|
66
|
+
// control's — the row only answers keys that landed on the row itself.
|
|
67
|
+
if (event.target !== event.currentTarget)
|
|
68
|
+
return;
|
|
69
|
+
// Open on Enter/Space; Space would scroll the page.
|
|
70
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
onRowClick(item);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Move the focus down or up the rows without leaving the keyboard — a
|
|
76
|
+
// long list is walked one row at a time (Arrow keys, or j/k for a reader
|
|
77
|
+
// who keeps to them), and Enter opens the one the focus rests on. Arrow
|
|
78
|
+
// keys would otherwise scroll the surrounding page.
|
|
79
|
+
const next = event.key === 'ArrowDown' || event.key === 'j'
|
|
80
|
+
? event.currentTarget.nextElementSibling
|
|
81
|
+
: event.key === 'ArrowUp' || event.key === 'k'
|
|
82
|
+
? event.currentTarget.previousElementSibling
|
|
83
|
+
: null;
|
|
84
|
+
if (next === null)
|
|
85
|
+
return;
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
next.focus();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** The breakpoint below which a `stack` table lays its rows out as cards — the same one as the stylesheet's. */
|
|
92
|
+
const STACK_QUERY = '(max-width: 640px)';
|
|
93
|
+
/**
|
|
94
|
+
* Whether the viewport is below the stacking breakpoint — only watched when a
|
|
95
|
+
* table has a card shape to switch to, and `false` wherever `matchMedia` is
|
|
96
|
+
* absent (jsdom), which keeps the table shape in tests.
|
|
97
|
+
*/
|
|
98
|
+
function useStacked(enabled) {
|
|
99
|
+
const supported = enabled && typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
100
|
+
const [stacked, setStacked] = useState(() => supported && window.matchMedia(STACK_QUERY).matches);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (!supported)
|
|
103
|
+
return undefined;
|
|
104
|
+
const mql = window.matchMedia(STACK_QUERY);
|
|
105
|
+
const update = () => setStacked(mql.matches);
|
|
106
|
+
update();
|
|
107
|
+
mql.addEventListener('change', update);
|
|
108
|
+
return () => mql.removeEventListener('change', update);
|
|
109
|
+
}, [supported]);
|
|
110
|
+
return supported && stacked;
|
|
111
|
+
}
|
|
9
112
|
/**
|
|
10
113
|
* The class per alignment.
|
|
11
114
|
*
|
|
@@ -63,42 +166,76 @@ export function SortableColumn({ label, sortKey, activeKey, direction = 'asc', o
|
|
|
63
166
|
* />
|
|
64
167
|
* ```
|
|
65
168
|
*/
|
|
66
|
-
export function DataTable({ columns, rows, rowKey, sortKey = null, sortDirection = 'asc', onSort, onRowClick, rowClassName, isSelected, rowHeader, leadingHeader, leadingCell, trailingHeader, trailingCell, stack = false, empty = 'Nothing to show.', label, className, theme = 'light', }) {
|
|
169
|
+
export function DataTable({ columns, rows, rowKey, sortKey = null, sortDirection = 'asc', onSort, onRowClick, rowClassName, rowTitle, isSelected, rowHeader, leadingHeader, leadingCell, trailingHeader, trailingCell, stack = false, rowCard, cards = false, density = false, exportable = false, empty = 'Nothing to show.', label, className, theme = 'light', pagination, }) {
|
|
67
170
|
const span = columns.length + (leadingHeader === undefined ? 0 : 1) + (trailingHeader === undefined ? 0 : 1);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
171
|
+
// Sorting: a caller with `onSort` owns it (server-side, or over its own
|
|
172
|
+
// state); otherwise the table sorts itself over the rows it was given, on the
|
|
173
|
+
// columns that declared a `sortValue`.
|
|
174
|
+
const selfSort = onSort === undefined;
|
|
175
|
+
const self = useTableSort({
|
|
176
|
+
getSortValue: (item, key) => columns.find((column) => column.key === key)?.sortValue?.(item),
|
|
177
|
+
});
|
|
178
|
+
const activeKey = selfSort ? self.sortKey : sortKey;
|
|
179
|
+
const activeDirection = selfSort ? self.sortDirection : sortDirection;
|
|
180
|
+
const handleSort = selfSort ? self.toggle : onSort;
|
|
181
|
+
const sortable = (column) => column.sortable !== false && (selfSort ? column.sortValue !== undefined : true);
|
|
182
|
+
const sorted = selfSort ? self.sort(rows) : rows;
|
|
183
|
+
// Pagination: self-managed over the given rows by default, controlled when a
|
|
184
|
+
// parent pages server-side, off for a table fed a single page already. The
|
|
185
|
+
// hooks run unconditionally (rules of hooks) and stay inert when unused.
|
|
186
|
+
const resolved = resolvePagination(pagination);
|
|
187
|
+
const auto = usePagination(resolved.mode === 'auto' ? sorted.length : 0, resolved.mode === 'auto' ? resolved.pageSize : undefined);
|
|
188
|
+
const pageRows = resolved.mode === 'auto' ? auto.paginate(sorted) : sorted;
|
|
189
|
+
// Density: the hook runs unconditionally (rules of hooks) and is only read
|
|
190
|
+
// when the table opted in, so a table without `density` is untouched.
|
|
191
|
+
const { compact, toggle } = useDensity();
|
|
192
|
+
const dense = density && compact;
|
|
193
|
+
// Export: every row the table was given, in its current order — the whole
|
|
194
|
+
// filtered set, never just the page on screen.
|
|
195
|
+
const canExport = exportable !== false;
|
|
196
|
+
const exportFile = typeof exportable === 'object' && exportable.filename !== undefined ? exportable.filename : csvFileName(label);
|
|
197
|
+
const exportCsv = () => downloadCsv(exportFile, tableToCsv(columns, sorted));
|
|
198
|
+
// The card shape: asked for outright, or the stacked layout of a table that
|
|
199
|
+
// gave its rows a card to become. The hook runs unconditionally (rules of
|
|
200
|
+
// hooks) and watches the viewport only when there is a card to switch to.
|
|
201
|
+
const stacked = useStacked(stack && rowCard !== undefined);
|
|
202
|
+
const asCards = rowCard !== undefined && (cards || stacked);
|
|
203
|
+
/** The class of a row or a card, with its clickable/selected states and the caller's own. */
|
|
204
|
+
const rowClass = (item, base) => {
|
|
205
|
+
const extra = rowClassName?.(item);
|
|
206
|
+
return `${base}${onRowClick === undefined ? '' : ` ${base}-clickable`}${isSelected?.(item) === true ? ` ${base}-selected` : ''}${extra === undefined || extra === '' ? '' : ` ${extra}`}`;
|
|
207
|
+
};
|
|
208
|
+
// A totals footer appears only when a column asked for one and there are rows
|
|
209
|
+
// to total. It aggregates every row the table was given — which is the full
|
|
210
|
+
// filtered set in the self-paginated ('auto') and un-paginated ('off') modes.
|
|
211
|
+
// In 'controlled' mode `rows` is only the current server page, so a total
|
|
212
|
+
// would silently be a per-page subtotal; the footer is suppressed there until
|
|
213
|
+
// a caller can supply the aggregate separately.
|
|
214
|
+
const hasFooter = resolved.mode !== 'controlled' && columns.some((column) => column.footer !== undefined);
|
|
215
|
+
let footer = null;
|
|
216
|
+
if (resolved.mode === 'auto' && auto.totalPages > 1) {
|
|
217
|
+
footer = (_jsx(Pagination, { page: auto.page, totalPages: auto.totalPages, pageSize: auto.pageSize, totalItems: sorted.length, onPageChange: auto.setPage, onPageSizeChange: auto.setPageSize, ...(resolved.pageSizeOptions ? { pageSizeOptions: resolved.pageSizeOptions } : {}), theme: theme }));
|
|
218
|
+
}
|
|
219
|
+
else if (resolved.mode === 'controlled') {
|
|
220
|
+
const totalPages = Math.max(1, Math.ceil(resolved.totalItems / resolved.pageSize));
|
|
221
|
+
if (totalPages > 1) {
|
|
222
|
+
footer = (_jsx(Pagination, { page: resolved.page, totalPages: totalPages, pageSize: resolved.pageSize, totalItems: resolved.totalItems, onPageChange: resolved.onPageChange, onPageSizeChange: resolved.onPageSizeChange, ...(resolved.pageSizeOptions ? { pageSizeOptions: resolved.pageSizeOptions } : {}), theme: theme }));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return (_jsxs("div", { className: `ctl ctl-table-wrap${stack ? ' ctl-table-stacks' : ''}${dense ? ' ctl-table-compact' : ''}${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, children: [((density && !asCards) || canExport) && (
|
|
226
|
+
// View controls, so they sit above the rows they act on rather than in
|
|
227
|
+
// the pagination footer, which a short list never shows. A card has no
|
|
228
|
+
// row height to tighten, so the density toggle is left out of the card
|
|
229
|
+
// shape; the export, which writes the rows not their shape, stays.
|
|
230
|
+
_jsxs("div", { className: "ctl-table-toolbar", children: [canExport && (_jsx("button", { type: "button", className: "ctl-density-toggle ctl-table-export", onClick: exportCsv, disabled: sorted.length === 0, children: "Export CSV" })), density && !asCards && (_jsx("button", { type: "button", className: "ctl-density-toggle", onClick: toggle, "aria-pressed": compact, children: "Compact rows" }))] })), asCards ? (_jsx("ul", { className: "ctl-cards", "aria-label": label, children: pageRows.length === 0 ? (_jsx("li", { className: "ctl-card-empty", children: empty })) : (pageRows.map((item, index) => (_jsxs("li", { className: rowClass(item, 'ctl-card-row'), title: rowTitle?.(item), ...rowInteraction(onRowClick, item), children: [leadingCell?.(item, index), _jsx("div", { className: "ctl-card-body", children: rowCard?.(item, index) }), trailingCell?.(item, index)] }, rowKey(item, index))))) })) : (_jsx("div", { className: "ctl-table-scroll", children: _jsxs("table", { className: "ctl-table", "aria-label": label, children: [_jsx("thead", { children: _jsxs("tr", { children: [leadingHeader, columns.map((column) => {
|
|
231
|
+
const align = ALIGN[column.align ?? 'start'] ?? '';
|
|
232
|
+
const head = `${align}${column.headerClassName === undefined ? '' : ` ${column.headerClassName}`}`;
|
|
233
|
+
return sortable(column) && handleSort !== undefined ? (_jsx(SortableColumn, { label: column.label, sortKey: column.key, activeKey: activeKey, direction: activeDirection, onSort: handleSort, className: head.trim() }, column.key)) : (_jsx("th", { scope: "col", className: `ctl-th${head}`, children: column.label }, column.key));
|
|
234
|
+
}), trailingHeader] }) }), _jsx("tbody", { children: rows.length === 0 ? (_jsx("tr", { children: _jsx("td", { className: "ctl-td ctl-table-empty", colSpan: span === 0 ? 1 : span, children: empty }) })) : (pageRows.map((item, index) => {
|
|
235
|
+
return (_jsxs("tr", { className: rowClass(item, 'ctl-row'), title: rowTitle?.(item), ...rowInteraction(onRowClick, item), children: [leadingCell?.(item, index), columns.map((column) => {
|
|
236
|
+
const Cell = column.key === rowHeader ? 'th' : 'td';
|
|
237
|
+
return (_jsx(Cell, { scope: column.key === rowHeader ? 'row' : undefined, className: `ctl-td${ALIGN[column.align ?? 'start'] ?? ''}${column.className === undefined ? '' : ` ${column.className}`}`, "data-label": column.label, children: column.render(item, index) }, column.key));
|
|
238
|
+
}), trailingCell?.(item, index)] }, rowKey(item, index)));
|
|
239
|
+
})) }), hasFooter && rows.length > 0 && (_jsx("tfoot", { children: _jsxs("tr", { className: "ctl-row", children: [leadingHeader === undefined ? null : _jsx("td", { className: "ctl-td ctl-td-foot" }), columns.map((column) => (_jsx("td", { className: `ctl-td ctl-td-foot${ALIGN[column.align ?? 'start'] ?? ''}`, "data-label": column.label, children: column.footer?.(rows) ?? null }, column.key))), trailingHeader === undefined ? null : _jsx("td", { className: "ctl-td ctl-td-foot" })] }) }))] }) })), footer] }));
|
|
103
240
|
}
|
|
104
241
|
//# sourceMappingURL=DataTable.js.map
|
package/dist/DataTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../src/DataTable.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8FjF,iFAAiF;AACjF,MAAM,WAAW,GAAG,kEAAkE,CAAC;AAEvF,kFAAkF;AAClF,SAAS,WAAW,CAAC,MAA0B;IAC7C,OAAO,MAAM,YAAY,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;AAC3E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,KAAK,GAA2B;IACpC,KAAK,EAAE,EAAE;IACT,GAAG,EAAE,gBAAg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GAAG,IACzE,GACC,CACT,IACK,GACF,CACL,EACA,MAAM,IACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -25,6 +25,9 @@ export interface DateRangeFilterLabels extends DateRangeLabels {
|
|
|
25
25
|
/** The two ends of a custom range. */
|
|
26
26
|
fromLabel?: string;
|
|
27
27
|
toLabel?: string;
|
|
28
|
+
/** The time box beside each end, with `withTime`. */
|
|
29
|
+
fromTimeLabel?: string;
|
|
30
|
+
toTimeLabel?: string;
|
|
28
31
|
/** What each calendar is called, for the switch between them. */
|
|
29
32
|
calendars?: Partial<Record<DateRangeCalendar, string>>;
|
|
30
33
|
/** The button that clears the range back to "any time". */
|
|
@@ -51,6 +54,23 @@ export interface DateRangeFilterProps {
|
|
|
51
54
|
*/
|
|
52
55
|
presets?: readonly DateRangePreset[];
|
|
53
56
|
includeFuture?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Ranges offered above the named ones, as one tap each — "last 15 minutes",
|
|
59
|
+
* "last 24 hours" — for a screen where a handful of rolling windows is what
|
|
60
|
+
* people reach for. Any value works; each is labelled by
|
|
61
|
+
* `describeDateRange`.
|
|
62
|
+
*/
|
|
63
|
+
shortcuts?: readonly DateRangeValue[];
|
|
64
|
+
/**
|
|
65
|
+
* Let each end of a custom range carry a time of day.
|
|
66
|
+
*
|
|
67
|
+
* Off by default, and then nothing changes. On, a time box sits beside each
|
|
68
|
+
* date: left empty, the end still means its whole day; filled, the range
|
|
69
|
+
* starts — or stops, exclusively — at that time in the filter's zone. Picking
|
|
70
|
+
* days on the grid keeps the times already set, and does not close the
|
|
71
|
+
* popover, since the times are usually the next thing set.
|
|
72
|
+
*/
|
|
73
|
+
withTime?: boolean;
|
|
54
74
|
/** Offer an absolute range picked on a calendar. On by default. */
|
|
55
75
|
allowCustom?: boolean;
|
|
56
76
|
/** Offer "the last N hours / days / weeks / months / years". On by default. */
|
|
@@ -109,5 +129,5 @@ export interface DateRangeFilterProps {
|
|
|
109
129
|
* Markup is plain semantic HTML with `ctl-` class names and no styling
|
|
110
130
|
* dependency, the same as every other control here.
|
|
111
131
|
*/
|
|
112
|
-
export declare function DateRangeFilter({ value, onChange, label, presets, includeFuture, allowCustom, allowRelative, units, calendars, hebrewLanguage, locale, weekStartsOn, min, max, today, clearable, labels, disabled, name, className, theme, 'data-testid': testId, }: DateRangeFilterProps): import("react").JSX.Element;
|
|
132
|
+
export declare function DateRangeFilter({ value, onChange, label, presets, includeFuture, shortcuts, withTime, allowCustom, allowRelative, units, calendars, hebrewLanguage, locale, weekStartsOn, min, max, today, clearable, labels, disabled, name, className, theme, 'data-testid': testId, }: DateRangeFilterProps): import("react").JSX.Element;
|
|
113
133
|
//# sourceMappingURL=DateRangeFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeFilter.d.ts","sourceRoot":"","sources":["../src/DateRangeFilter.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"DateRangeFilter.d.ts","sourceRoot":"","sources":["../src/DateRangeFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAWL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,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