@makoai/app-sdk 2.26.0 → 2.28.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 +273 -1
- package/components/combobox.tsx +137 -0
- package/components/filter-bar.tsx +218 -0
- package/components/index.ts +6 -1
- package/components/period-picker.tsx +153 -0
- package/components/period.ts +83 -0
- package/index.d.ts +9 -0
- package/index.js +27 -1
- package/lint.js +81 -5
- package/package.json +5 -1
- package/ui-core.js +66 -3
- package/ui.css +86 -2
- package/ui.d.ts +143 -0
- package/ui.js +531 -93
package/ui.css
CHANGED
|
@@ -217,6 +217,9 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
217
217
|
padding: 7px 10px; text-align: left; white-space: nowrap; vertical-align: middle; overflow: hidden;
|
|
218
218
|
border-bottom: 1px solid var(--mk-row-line); background: var(--card);
|
|
219
219
|
}
|
|
220
|
+
/* A row tint (rowClassName) sets --mk-dt-row-bg on the <tr>. Every body cell,
|
|
221
|
+
* the pinned one included, paints it, so the tint survives the solid pin. */
|
|
222
|
+
.mk-dt-table tbody td { background: var(--mk-dt-row-bg, var(--card)); }
|
|
220
223
|
.mk-dt-table thead th {
|
|
221
224
|
position: sticky; top: 0; z-index: 2; padding: 0; border-bottom: 0;
|
|
222
225
|
font-size: 12px; font-weight: 500; color: var(--muted-foreground);
|
|
@@ -243,17 +246,80 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
243
246
|
/* The corner cell is pinned both ways and keeps BOTH borders: one box-shadow
|
|
244
247
|
* would otherwise override the other and drop the header's bottom rule. */
|
|
245
248
|
.mk-dt-table thead th.mk-dt-pin { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border); }
|
|
246
|
-
|
|
249
|
+
/* Column groups: a 2-row header. The whole <thead> sticks (two rows of
|
|
250
|
+
* sticky cells would stack at top: 0) and the pinned corner still sticks
|
|
251
|
+
* left. A group label spans its columns, centred, uppercase, with no rule
|
|
252
|
+
* under it. A line runs down the left of each section, head to foot. */
|
|
253
|
+
.mk-dt-table--grouped thead { position: sticky; top: 0; z-index: 2; }
|
|
254
|
+
.mk-dt-table--grouped thead th { position: static; }
|
|
255
|
+
.mk-dt-table--grouped thead th.mk-dt-pin { position: sticky; top: auto; left: 0; }
|
|
256
|
+
.mk-dt-table thead th.mk-dt-group {
|
|
257
|
+
height: 26px; padding: 0 10px; text-align: center; box-shadow: none;
|
|
258
|
+
font-size: 11px; font-weight: 600; letter-spacing: .075em; text-transform: uppercase;
|
|
259
|
+
}
|
|
260
|
+
.mk-dt-table .mk-dt-section { border-left: 1px solid var(--border); }
|
|
261
|
+
.mk-dt-table tbody tr:hover > td { background: color-mix(in srgb, var(--muted) 50%, var(--mk-dt-row-bg, var(--card))); }
|
|
247
262
|
.mk-dt-table tbody tr:last-child > td { border-bottom: 0; }
|
|
248
263
|
.mk-dt-click { cursor: pointer; }
|
|
249
264
|
.mk-dt-click:focus-visible { outline: none; }
|
|
250
|
-
.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 70%, var(--card)); }
|
|
265
|
+
.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 70%, var(--mk-dt-row-bg, var(--card))); }
|
|
251
266
|
.mk-dt-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
252
267
|
/* A render() that returns blocks (a name over its links) ellipsizes each line. */
|
|
253
268
|
.mk-dt-cell :where(div, p) { overflow: hidden; text-overflow: ellipsis; }
|
|
254
269
|
/* `truncate: false`: the text wraps inside the column; the width still holds. */
|
|
255
270
|
.mk-dt-wrap { white-space: normal; overflow-wrap: anywhere; }
|
|
256
271
|
.mk-dt-table td.mk-dt-empty { text-align: center; color: var(--muted-foreground); padding: 48px 10px; white-space: normal; }
|
|
272
|
+
/* `wrapHeaders`: a header label takes up to 2 lines instead of one ellipsized
|
|
273
|
+
* line, so a client reads every word. The sort icon keeps its place beside it. */
|
|
274
|
+
.mk-dt--wrap-heads .mk-dt-sort, .mk-dt--wrap-heads .mk-dt-label { white-space: normal; }
|
|
275
|
+
.mk-dt--wrap-heads thead .mk-dt-th-text {
|
|
276
|
+
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
|
|
277
|
+
white-space: normal; overflow-wrap: break-word; line-height: 1.3;
|
|
278
|
+
}
|
|
279
|
+
/* A column's `info`: the "i" sits after the sort button, never inside it. */
|
|
280
|
+
.mk-dt-th-row { display: flex; align-items: center; min-width: 0; }
|
|
281
|
+
.mk-dt-th-row > :is(.mk-dt-sort, .mk-dt-label) { flex: 1 1 auto; width: auto; min-width: 0; padding-right: 2px; }
|
|
282
|
+
.mk-dt-info-wrap { flex: none; display: inline-flex; padding-right: 6px; }
|
|
283
|
+
.mk-dt-info {
|
|
284
|
+
appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
|
|
285
|
+
padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); cursor: pointer;
|
|
286
|
+
}
|
|
287
|
+
.mk-dt-info:hover, .mk-dt-info.open { color: var(--foreground); background: var(--muted); }
|
|
288
|
+
.mk-dt-info:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; }
|
|
289
|
+
.mk-dt-info-pop {
|
|
290
|
+
position: fixed; top: 0; left: 0; z-index: 90; width: max-content; max-width: min(320px, calc(100vw - 16px));
|
|
291
|
+
padding: 10px 12px; font-size: 12px; line-height: 1.45; white-space: normal; text-align: left;
|
|
292
|
+
}
|
|
293
|
+
.mk-dt-info-pop:focus { outline: none; }
|
|
294
|
+
.mk-dt-info-title { display: block; margin-bottom: 4px; font-weight: 600; }
|
|
295
|
+
.mk-dt-info-body > :first-child { margin-top: 0; }
|
|
296
|
+
.mk-dt-info-body > :last-child { margin-bottom: 0; }
|
|
297
|
+
@media (max-width: 640px) { .mk-dt-info-pop { top: auto; width: auto; max-width: none; padding: 16px; } }
|
|
298
|
+
/* Expandable rows: a chevron in the first cell opens a full-width detail row. */
|
|
299
|
+
.mk-dt-xcell { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
300
|
+
.mk-dt-xcell > :is(.mk-dt-cell, .mk-dt-wrap) { flex: 1 1 auto; min-width: 0; }
|
|
301
|
+
.mk-dt-expander, .mk-dt-expander-none { flex: none; width: 20px; height: 20px; margin-left: -4px; }
|
|
302
|
+
.mk-dt-expander {
|
|
303
|
+
appearance: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0;
|
|
304
|
+
border-radius: var(--mk-radius-sm); background: none; color: var(--muted-foreground); cursor: pointer;
|
|
305
|
+
}
|
|
306
|
+
.mk-dt-expander:hover { color: var(--foreground); background: var(--muted); }
|
|
307
|
+
.mk-dt-expander:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
308
|
+
.mk-dt-expander svg { transform: rotate(-90deg); transition: transform .14s var(--mk-ease); }
|
|
309
|
+
.mk-dt-expander[aria-expanded="true"] svg { transform: none; }
|
|
310
|
+
.mk-dt-table tbody tr.mk-dt-open > td { border-bottom-color: transparent; }
|
|
311
|
+
.mk-dt-table tbody tr.mk-dt-detail > td,
|
|
312
|
+
.mk-dt-table tbody tr.mk-dt-detail:hover > td { padding: 0; white-space: normal; background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
|
|
313
|
+
.mk-dt-detail-body { position: sticky; left: 0; padding: 10px 16px 14px 34px; overflow-wrap: anywhere; }
|
|
314
|
+
/* `totalRow`: a <tfoot> pinned to the bottom of the scroll box, bold, with a
|
|
315
|
+
* rule on top. Its first cell stays pinned left with the column. */
|
|
316
|
+
.mk-dt-table tfoot td {
|
|
317
|
+
position: sticky; bottom: 0; z-index: 2; border-bottom: 0; font-weight: 600;
|
|
318
|
+
background: var(--card); box-shadow: inset 0 1px 0 var(--border);
|
|
319
|
+
}
|
|
320
|
+
.mk-dt-table tfoot td.mk-dt-pin { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 1px 0 var(--border); }
|
|
321
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:hover > td,
|
|
322
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 50%, var(--card)); }
|
|
257
323
|
.mk-dt-foot {
|
|
258
324
|
flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
|
|
259
325
|
padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground);
|
|
@@ -321,7 +387,25 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
321
387
|
/* Ticked in the brand blue (white tick), --primary where a theme has no --brand. */
|
|
322
388
|
.mk-ms-box.on { background: var(--brand, var(--primary)); border-color: var(--brand, var(--primary)); color: #fff; }
|
|
323
389
|
.mk-ms-swatch { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
|
|
390
|
+
/* An option's `count` (2.28): muted, right-aligned, tabular figures. */
|
|
391
|
+
.mk-ms-count { flex-shrink: 0; margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
|
|
324
392
|
.mk-ms-sep { height: 1px; background: var(--border); margin: 4px -4px; flex: none; }
|
|
393
|
+
/* MultiSelect `searchable` (2.27): shadcn's CommandInput (36px, a search icon,
|
|
394
|
+
* a hairline under it), pinned at the top while the rows scroll. The
|
|
395
|
+
* highlighted row is cmdk's data-selected one. */
|
|
396
|
+
.mk-ms-search {
|
|
397
|
+
position: sticky; top: -4px; z-index: 1; flex: none;
|
|
398
|
+
display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin: -4px -4px 4px;
|
|
399
|
+
background: var(--popover); border-bottom: 1px solid var(--border);
|
|
400
|
+
}
|
|
401
|
+
.mk-ms-search-icon { flex-shrink: 0; opacity: .5; }
|
|
402
|
+
.mk-ms-search-input {
|
|
403
|
+
flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; box-shadow: none;
|
|
404
|
+
background: transparent; color: var(--foreground); font: inherit; font-size: 14px;
|
|
405
|
+
}
|
|
406
|
+
.mk-ms-search-input::placeholder { color: var(--muted-foreground); }
|
|
407
|
+
.mk-ms-opt[data-selected="true"] { background: var(--accent); }
|
|
408
|
+
.mk-ms-empty { padding: 24px 8px; text-align: center; font-size: 14px; color: var(--muted-foreground); }
|
|
325
409
|
.mk-ms-only {
|
|
326
410
|
appearance: none; border: 0; background: transparent; color: var(--muted-foreground);
|
|
327
411
|
font-size: 12px; font-weight: 500; padding: 0 4px; border-radius: var(--mk-radius-sm); visibility: hidden;
|
package/ui.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export interface MultiSelectOption<V extends string = string> {
|
|
|
71
71
|
color?: string;
|
|
72
72
|
/** What the option covers, shown on hover. */
|
|
73
73
|
title?: string;
|
|
74
|
+
/** A count shown muted at the row's right edge (2.28). Search ignores it; the trigger never shows it. A number is formatted (1,234). */
|
|
75
|
+
count?: number | string;
|
|
74
76
|
/** A group (2.20): its row ticks every leaf under it; hover submenus: FilterMenu in `@makoai/app-sdk/menu`. */
|
|
75
77
|
children?: ReadonlyArray<MultiSelectOption<V>>;
|
|
76
78
|
}
|
|
@@ -97,6 +99,17 @@ export interface FilterItemsProps<V extends string = string> {
|
|
|
97
99
|
/** The "nothing ticked" draft, when the parent shows it; else FilterItems keeps it. */
|
|
98
100
|
none?: boolean;
|
|
99
101
|
onNoneChange?: (none: boolean) => void;
|
|
102
|
+
/**
|
|
103
|
+
* A search input above the rows (2.27), as shadcn's Command: it takes focus,
|
|
104
|
+
* filters rows by label as you type (a group whose label matches keeps its
|
|
105
|
+
* rows) and hides All while a query is typed. ArrowDown/ArrowUp move the
|
|
106
|
+
* highlighted row, Enter ticks it. Default false: no input, rows unchanged.
|
|
107
|
+
*/
|
|
108
|
+
searchable?: boolean;
|
|
109
|
+
/** The search input's placeholder and accessible name. Default "Search". */
|
|
110
|
+
searchPlaceholder?: string;
|
|
111
|
+
/** Shown when no row matches. Default "No match". */
|
|
112
|
+
searchEmpty?: string;
|
|
100
113
|
className?: string;
|
|
101
114
|
"aria-label"?: string;
|
|
102
115
|
}
|
|
@@ -142,6 +155,12 @@ export interface MultiSelectProps<V extends string = string> {
|
|
|
142
155
|
maxChips?: number;
|
|
143
156
|
/** Which edge the menu aligns to before flipping. Default "start". */
|
|
144
157
|
align?: "start" | "end";
|
|
158
|
+
/** A search input at the top of the menu (2.27): search, All, a separator, the values. See FilterItemsProps. */
|
|
159
|
+
searchable?: boolean;
|
|
160
|
+
/** Default "Search". */
|
|
161
|
+
searchPlaceholder?: string;
|
|
162
|
+
/** Default "No match". */
|
|
163
|
+
searchEmpty?: string;
|
|
145
164
|
className?: string;
|
|
146
165
|
"aria-label"?: string;
|
|
147
166
|
}
|
|
@@ -285,6 +304,8 @@ export interface TableTooltipProps {
|
|
|
285
304
|
total?: TooltipRow;
|
|
286
305
|
/** Rows after the total, apart: a value on another axis. */
|
|
287
306
|
after?: TooltipRow[];
|
|
307
|
+
/** The value columns' minimum width: "9ch", or px as a number. Default 7ch. */
|
|
308
|
+
colWidth?: number | string;
|
|
288
309
|
className?: string;
|
|
289
310
|
}
|
|
290
311
|
/** The house chart tooltip: a table with swatches, right-aligned numbers and a total row. */
|
|
@@ -303,6 +324,8 @@ export interface TooltipSeriesRow<K extends string = string> {
|
|
|
303
324
|
/** null when missing. */
|
|
304
325
|
value: number | null;
|
|
305
326
|
state: TooltipValueState;
|
|
327
|
+
/** With `share: true`: value ÷ the sum of the non-missing values; null when missing or the sum is not above 0. */
|
|
328
|
+
share?: number | null;
|
|
306
329
|
}
|
|
307
330
|
export interface TooltipSeriesRowsOptions {
|
|
308
331
|
/** Pass series bottom-up, as drawn; the rows read top segment first. */
|
|
@@ -311,6 +334,10 @@ export interface TooltipSeriesRowsOptions {
|
|
|
311
334
|
hideEmpty?: boolean;
|
|
312
335
|
/** Opt-out: sort non-stacked rows highest value first, missing last (pre-2.15). */
|
|
313
336
|
byValue?: boolean;
|
|
337
|
+
/** A null or absent key counts as 0 (a muted "0"): a stack segment with no rows in the bucket. NaN stays missing. */
|
|
338
|
+
absentAsZero?: boolean;
|
|
339
|
+
/** Adds `share`: value ÷ the sum of the non-missing values; null when missing or the sum is not above 0. */
|
|
340
|
+
share?: boolean;
|
|
314
341
|
}
|
|
315
342
|
/**
|
|
316
343
|
* Every series of the hovered datum, in a fixed order: stacked = top segment
|
|
@@ -383,6 +410,18 @@ export interface DataTableColumn<R = any> {
|
|
|
383
410
|
sortable?: boolean;
|
|
384
411
|
/** Header hover text, e.g. the column's definition. */
|
|
385
412
|
hint?: string;
|
|
413
|
+
/**
|
|
414
|
+
* The column's definition behind an "i" button beside its header. The
|
|
415
|
+
* button sits outside the sort button, so a click on it never sorts. It
|
|
416
|
+
* opens a popover with the label and this content. Default none.
|
|
417
|
+
*/
|
|
418
|
+
info?: React.ReactNode;
|
|
419
|
+
/**
|
|
420
|
+
* The column group's id. Adjacent columns with the same `group` share one
|
|
421
|
+
* label in a header row on top (see `DataTableProps.groups`); ungrouped
|
|
422
|
+
* columns span both header rows.
|
|
423
|
+
*/
|
|
424
|
+
group?: string;
|
|
386
425
|
/**
|
|
387
426
|
* false leaves the column out of CSV; a function exports a readable cell (a
|
|
388
427
|
* level name). Numbers export as is; a Date at local or UTC midnight exports
|
|
@@ -390,6 +429,66 @@ export interface DataTableColumn<R = any> {
|
|
|
390
429
|
*/
|
|
391
430
|
csv?: false | ((row: R) => unknown);
|
|
392
431
|
}
|
|
432
|
+
/** A column group's header: its label spans the adjacent columns with `group: id`. */
|
|
433
|
+
export interface DataTableGroup {
|
|
434
|
+
id: string;
|
|
435
|
+
label?: React.ReactNode;
|
|
436
|
+
/** On the group's header cell, e.g. a colour per section. */
|
|
437
|
+
className?: string;
|
|
438
|
+
}
|
|
439
|
+
/** The header runs of a DataTable's columns; null when no column has a `group`. */
|
|
440
|
+
export function columnGroupRuns<C extends { id: string; group?: string; sticky?: boolean }>(
|
|
441
|
+
columns: readonly C[],
|
|
442
|
+
): { group: string | null; start: boolean; columns: C[] }[] | null;
|
|
443
|
+
/**
|
|
444
|
+
* Every piece of text a DataTable renders itself: the footer, the pager's
|
|
445
|
+
* aria-labels, the sort hint and the export button. Text with numbers is a
|
|
446
|
+
* function that gets the raw numbers, so the app formats them in its locale.
|
|
447
|
+
*/
|
|
448
|
+
export interface DataTableLabels {
|
|
449
|
+
/** The footer with rows. Default `<b>1–50</b> of <b>312</b> customers`. */
|
|
450
|
+
range: (from: number, to: number, total: number, noun: string) => React.ReactNode;
|
|
451
|
+
/** The footer with no rows. Default "No customers". */
|
|
452
|
+
none: (noun: string) => React.ReactNode;
|
|
453
|
+
/** The body cell with no rows. Default "No rows match these filters." The `empty` prop wins over it. */
|
|
454
|
+
empty: React.ReactNode;
|
|
455
|
+
/** Default "Page 2 of 7". */
|
|
456
|
+
page: (page: number, pageCount: number) => string;
|
|
457
|
+
/** One page-size option. Default "50 per page". */
|
|
458
|
+
perPage: (size: number) => string;
|
|
459
|
+
/** The page-size select's aria-label. Default "Rows per page". */
|
|
460
|
+
rowsPerPage: string;
|
|
461
|
+
/** The « button's aria-label. Default "First page". */
|
|
462
|
+
first: string;
|
|
463
|
+
/** The ‹ button's aria-label. Default "Previous page". */
|
|
464
|
+
previous: string;
|
|
465
|
+
/** The › button's aria-label. Default "Next page". */
|
|
466
|
+
next: string;
|
|
467
|
+
/** The » button's aria-label. Default "Last page". */
|
|
468
|
+
last: string;
|
|
469
|
+
/** A sortable header's hover title. Default "MRR · click to sort". */
|
|
470
|
+
sortHint: (label: string) => string;
|
|
471
|
+
/** Default "Export CSV". */
|
|
472
|
+
exportCsv: string;
|
|
473
|
+
/** The export button's hover title. Default "Export every row on every page, as sorted". */
|
|
474
|
+
exportTitle: string;
|
|
475
|
+
/** Shown when the browser blocks the CSV download. */
|
|
476
|
+
exportFailed: string;
|
|
477
|
+
/** An expand chevron's aria-label, per row. Default "Show details". */
|
|
478
|
+
expand: (row: any) => string;
|
|
479
|
+
/** An open chevron's aria-label, per row. Default "Hide details". */
|
|
480
|
+
collapse: (row: any) => string;
|
|
481
|
+
/** A header "i" button's aria-label. Default "About MRR". */
|
|
482
|
+
info: (label: string) => string;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Which rows show their detail row: `true` for every row, or the open rows'
|
|
486
|
+
* ids, `{ [String(rowKey(row))]: true }`. The shape of TanStack Table's
|
|
487
|
+
* `ExpandedState`, so one state can drive both.
|
|
488
|
+
*/
|
|
489
|
+
export type DataTableExpanded = true | Record<string, boolean>;
|
|
490
|
+
/** The English defaults of `DataTableLabels`. */
|
|
491
|
+
export const DATA_TABLE_LABELS: DataTableLabels;
|
|
393
492
|
export interface DataTableProps<R = any> {
|
|
394
493
|
/** Default [] (renders the empty state while loading). */
|
|
395
494
|
rows?: readonly R[];
|
|
@@ -428,6 +527,12 @@ export interface DataTableProps<R = any> {
|
|
|
428
527
|
noun?: string;
|
|
429
528
|
/** Shown when there are no rows. Default "No rows match these filters." */
|
|
430
529
|
empty?: React.ReactNode;
|
|
530
|
+
/**
|
|
531
|
+
* Override any footer, pager, sort-hint or export text, e.g. French:
|
|
532
|
+
* `{ page: (p, n) => "Page " + p + " sur " + n }`. Missing keys keep the
|
|
533
|
+
* English default (`DATA_TABLE_LABELS`). The README has a full French set.
|
|
534
|
+
*/
|
|
535
|
+
labels?: Partial<DataTableLabels>;
|
|
431
536
|
/** Fill the parent's height; the body scrolls inside the card. */
|
|
432
537
|
fill?: boolean;
|
|
433
538
|
/** Body scroll height when not `fill`. Default 70vh. */
|
|
@@ -436,8 +541,46 @@ export interface DataTableProps<R = any> {
|
|
|
436
541
|
onRowClick?: (row: R, event: React.SyntheticEvent) => void;
|
|
437
542
|
/** The accessible name of a clickable row, e.g. `c => \`Open ${c.name}\``. */
|
|
438
543
|
rowLabel?: (row: R) => string;
|
|
544
|
+
/**
|
|
545
|
+
* A class for a body row, e.g. `d => d.status === "lost" ? "deal-lost" : undefined`.
|
|
546
|
+
* Tint the row by setting `--mk-dt-row-bg` in that class: every cell paints
|
|
547
|
+
* it, the pinned first column included. Use an opaque colour, such as
|
|
548
|
+
* `color-mix(in srgb, var(--negative) 12%, var(--card))`, so scrolled cells
|
|
549
|
+
* stay hidden behind the pin. Default undefined: rows get no class.
|
|
550
|
+
*/
|
|
551
|
+
rowClassName?: (row: R) => string | undefined;
|
|
439
552
|
/** Adds an "Export CSV" button: downloads every row, as sorted. */
|
|
440
553
|
exportFilename?: string;
|
|
554
|
+
/** Labels and classes for the column groups, by `DataTableColumn.group`. A group not listed shows its id. */
|
|
555
|
+
groups?: readonly DataTableGroup[];
|
|
556
|
+
/** Header labels wrap to 2 lines instead of ellipsizing on one. The sort icon stays beside them. Default false. */
|
|
557
|
+
wrapHeaders?: boolean;
|
|
558
|
+
/**
|
|
559
|
+
* Makes rows expandable: a chevron in each row's first cell opens a
|
|
560
|
+
* full-width detail row under it with this content. Enter or Space on the
|
|
561
|
+
* chevron toggles it. Detail rows never count in the pager, the sort or the
|
|
562
|
+
* CSV. Give rows a stable `rowKey` (or `id`): the state is keyed by it.
|
|
563
|
+
*/
|
|
564
|
+
renderExpanded?: (row: R) => React.ReactNode;
|
|
565
|
+
/** Which rows get a chevron. Default every row. */
|
|
566
|
+
canExpand?: (row: R) => boolean;
|
|
567
|
+
/** Controlled open rows; pair with `onExpandedChange`. */
|
|
568
|
+
expanded?: DataTableExpanded;
|
|
569
|
+
/** The open rows when uncontrolled. Default `{}`. */
|
|
570
|
+
defaultExpanded?: DataTableExpanded;
|
|
571
|
+
onExpandedChange?: (expanded: Record<string, boolean>) => void;
|
|
572
|
+
/**
|
|
573
|
+
* A total row pinned to the bottom of the scroll box (a sticky `<tfoot>`),
|
|
574
|
+
* bold with a rule on top. A row object, or a function of `rows` (the
|
|
575
|
+
* filtered rows the table got). Each column renders it with its `value`
|
|
576
|
+
* and `render`. It never sorts or pages and stays out of the CSV unless
|
|
577
|
+
* `exportTotalRow`. Hidden while there are no rows.
|
|
578
|
+
*/
|
|
579
|
+
totalRow?: R | ((rows: readonly R[]) => R | null | undefined) | null;
|
|
580
|
+
/** A click (or Enter or Space) on the total row, e.g. a drill-down. `rowLabel` names it. */
|
|
581
|
+
onTotalRowClick?: (row: R, event: React.SyntheticEvent) => void;
|
|
582
|
+
/** Append the total row to the CSV export. Default false. */
|
|
583
|
+
exportTotalRow?: boolean;
|
|
441
584
|
className?: string;
|
|
442
585
|
style?: React.CSSProperties;
|
|
443
586
|
}
|