@makoai/app-sdk 2.29.1 → 2.30.2
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 +64 -3
- package/components/period-picker.tsx +2 -2
- package/components/period.ts +10 -5
- package/index.js +1 -1
- package/locale.d.ts +64 -1
- package/locale.js +105 -8
- package/menu/filter-menu.tsx +4 -1
- package/package.json +1 -1
- package/tailwind.css +11 -0
- package/ui-core.js +56 -6
- package/ui.css +53 -20
- package/ui.d.ts +105 -1
- package/ui.js +280 -61
package/ui.css
CHANGED
|
@@ -183,6 +183,8 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
183
183
|
padding: 8px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap;
|
|
184
184
|
}
|
|
185
185
|
.mk-tip-title { font-weight: 600; margin-bottom: 4px; }
|
|
186
|
+
/* `note` (2.30): a muted line under the table, e.g. a click hint. */
|
|
187
|
+
.mk-tip-note { margin-top: 6px; font-size: 11px; color: var(--muted-foreground); white-space: normal; }
|
|
186
188
|
.mk-tip table { border-collapse: collapse; }
|
|
187
189
|
.mk-tip thead th { color: var(--muted-foreground); font-weight: 500; text-align: right; padding-left: 12px; }
|
|
188
190
|
.mk-tip tbody th { text-align: left; font-weight: 400; padding-top: 2px; }
|
|
@@ -213,19 +215,19 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
213
215
|
* resize a column. The table fills the card; its inline min-width (the sum of
|
|
214
216
|
* the columns) makes it scroll sideways in a narrower card. */
|
|
215
217
|
.mk-dt-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
|
|
216
|
-
.mk-dt-table th, .mk-dt-table td {
|
|
218
|
+
.mk-dt-table th:where(.mk-dt-table > * > tr > *), .mk-dt-table td:where(.mk-dt-table > * > tr > *) {
|
|
217
219
|
padding: 7px 10px; text-align: left; white-space: nowrap; vertical-align: middle; overflow: hidden;
|
|
218
220
|
border-bottom: 1px solid var(--mk-row-line); background: var(--card);
|
|
219
221
|
}
|
|
220
222
|
/* A row tint (rowClassName) sets --mk-dt-row-bg on the <tr>. Every body cell,
|
|
221
223
|
* 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)); }
|
|
223
|
-
.mk-dt-table thead th {
|
|
224
|
+
.mk-dt-table tbody td:where(.mk-dt-table > * > tr > *) { background: var(--mk-dt-row-bg, var(--card)); }
|
|
225
|
+
.mk-dt-table thead th:where(.mk-dt-table > * > tr > *) {
|
|
224
226
|
position: sticky; top: 0; z-index: 2; padding: 0; border-bottom: 0;
|
|
225
227
|
font-size: 12px; font-weight: 500; color: var(--muted-foreground);
|
|
226
228
|
box-shadow: inset 0 -1px 0 var(--border);
|
|
227
229
|
}
|
|
228
|
-
.mk-dt-table thead th.mk-dt-sorted { color: var(--foreground); }
|
|
230
|
+
.mk-dt-table thead th.mk-dt-sorted:where(.mk-dt-table > * > tr > *) { color: var(--foreground); }
|
|
229
231
|
.mk-dt-label { display: flex; padding: 8px 10px; }
|
|
230
232
|
.mk-dt-sort {
|
|
231
233
|
appearance: none; display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; padding: 8px 10px;
|
|
@@ -238,28 +240,28 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
238
240
|
.mk-dt-sort svg { flex: none; }
|
|
239
241
|
.mk-dt-faint { opacity: .35; }
|
|
240
242
|
.mk-dt-table .mk-dt-num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
241
|
-
.mk-dt-table th.mk-dt-num :is(.mk-dt-sort, .mk-dt-label) { justify-content: flex-end; }
|
|
243
|
+
.mk-dt-table th.mk-dt-num:where(.mk-dt-table > * > tr > *) :is(.mk-dt-sort, .mk-dt-label) { justify-content: flex-end; }
|
|
242
244
|
.mk-dt-table .mk-dt-center { text-align: center; }
|
|
243
|
-
.mk-dt-table th.mk-dt-center :is(.mk-dt-sort, .mk-dt-label) { justify-content: center; }
|
|
245
|
+
.mk-dt-table th.mk-dt-center:where(.mk-dt-table > * > tr > *) :is(.mk-dt-sort, .mk-dt-label) { justify-content: center; }
|
|
244
246
|
/* The pinned column: solid background and a hairline on its right edge. */
|
|
245
247
|
.mk-dt-table .mk-dt-pin { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--border); }
|
|
246
248
|
/* The corner cell is pinned both ways and keeps BOTH borders: one box-shadow
|
|
247
249
|
* would otherwise override the other and drop the header's bottom rule. */
|
|
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); }
|
|
250
|
+
.mk-dt-table thead th.mk-dt-pin:where(.mk-dt-table > * > tr > *) { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border); }
|
|
249
251
|
/* Column groups: a 2-row header. The whole <thead> sticks (two rows of
|
|
250
252
|
* sticky cells would stack at top: 0) and the pinned corner still sticks
|
|
251
253
|
* left. A group label spans its columns, centred, uppercase, with no rule
|
|
252
254
|
* under it. A line runs down the left of each section, head to foot. */
|
|
253
255
|
.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 {
|
|
256
|
+
.mk-dt-table--grouped thead th:where(.mk-dt-table > * > tr > *) { position: static; }
|
|
257
|
+
.mk-dt-table--grouped thead th.mk-dt-pin:where(.mk-dt-table > * > tr > *) { position: sticky; top: auto; left: 0; }
|
|
258
|
+
.mk-dt-table thead th.mk-dt-group:where(.mk-dt-table > * > tr > *) {
|
|
257
259
|
height: 26px; padding: 0 10px; text-align: center; box-shadow: none;
|
|
258
260
|
font-size: 11px; font-weight: 600; letter-spacing: .075em; text-transform: uppercase;
|
|
259
261
|
}
|
|
260
262
|
.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))); }
|
|
262
|
-
.mk-dt-table tbody tr:last-child > td { border-bottom: 0; }
|
|
263
|
+
.mk-dt-table tbody tr:hover > td:where(.mk-dt-table > * > tr > *) { background: color-mix(in srgb, var(--muted) 50%, var(--mk-dt-row-bg, var(--card))); }
|
|
264
|
+
.mk-dt-table tbody tr:last-child > td:where(.mk-dt-table > * > tr > *) { border-bottom: 0; }
|
|
263
265
|
.mk-dt-click { cursor: pointer; }
|
|
264
266
|
.mk-dt-click:focus-visible { outline: none; }
|
|
265
267
|
.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 70%, var(--mk-dt-row-bg, var(--card))); }
|
|
@@ -268,7 +270,7 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
268
270
|
.mk-dt-cell :where(div, p) { overflow: hidden; text-overflow: ellipsis; }
|
|
269
271
|
/* `truncate: false`: the text wraps inside the column; the width still holds. */
|
|
270
272
|
.mk-dt-wrap { white-space: normal; overflow-wrap: anywhere; }
|
|
271
|
-
.mk-dt-table td.mk-dt-empty { text-align: center; color: var(--muted-foreground); padding: 48px 10px; white-space: normal; }
|
|
273
|
+
.mk-dt-table td.mk-dt-empty:where(.mk-dt-table > * > tr > *) { text-align: center; color: var(--muted-foreground); padding: 48px 10px; white-space: normal; }
|
|
272
274
|
/* `wrapHeaders`: a header label takes up to 2 lines instead of one ellipsized
|
|
273
275
|
* line, so a client reads every word. The sort icon keeps its place beside it. */
|
|
274
276
|
.mk-dt--wrap-heads .mk-dt-sort, .mk-dt--wrap-heads .mk-dt-label { white-space: normal; }
|
|
@@ -307,19 +309,48 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
307
309
|
.mk-dt-expander:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
308
310
|
.mk-dt-expander svg { transform: rotate(-90deg); transition: transform .14s var(--mk-ease); }
|
|
309
311
|
.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)); }
|
|
312
|
+
.mk-dt-table tbody tr.mk-dt-open > td:where(.mk-dt-table > * > tr > *) { border-bottom-color: transparent; }
|
|
313
|
+
.mk-dt-table tbody tr.mk-dt-detail > td:where(.mk-dt-table > * > tr > *),
|
|
314
|
+
.mk-dt-table tbody tr.mk-dt-detail:hover > td:where(.mk-dt-table > * > tr > *) { padding: 0; white-space: normal; background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
|
|
313
315
|
.mk-dt-detail-body { position: sticky; left: 0; padding: 10px 16px 14px 34px; overflow-wrap: anywhere; }
|
|
314
316
|
/* `totalRow`: a <tfoot> pinned to the bottom of the scroll box, bold, with a
|
|
315
317
|
* rule on top. Its first cell stays pinned left with the column. */
|
|
316
|
-
.mk-dt-table tfoot td {
|
|
318
|
+
.mk-dt-table tfoot td:where(.mk-dt-table > * > tr > *) {
|
|
317
319
|
position: sticky; bottom: 0; z-index: 2; border-bottom: 0; font-weight: 600;
|
|
318
320
|
background: var(--card); box-shadow: inset 0 1px 0 var(--border);
|
|
319
321
|
}
|
|
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)); }
|
|
322
|
+
.mk-dt-table tfoot td.mk-dt-pin:where(.mk-dt-table > * > tr > *) { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 1px 0 var(--border); }
|
|
323
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:hover > td:where(.mk-dt-table > * > tr > *),
|
|
324
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:focus-visible > td:where(.mk-dt-table > * > tr > *) { background: color-mix(in srgb, var(--muted) 50%, var(--card)); }
|
|
325
|
+
/* Section rows (2.30): one cell across the columns, a small muted heading
|
|
326
|
+
* on a tinted band (agent-acquisition-funnel's "Inbound" / "Outbound"). */
|
|
327
|
+
.mk-dt-table tbody tr.mk-dt-section-row > td:where(.mk-dt-table > * > tr > *),
|
|
328
|
+
.mk-dt-table tbody tr.mk-dt-section-row:hover > td:where(.mk-dt-table > * > tr > *) {
|
|
329
|
+
padding: 0; background: color-mix(in srgb, var(--muted) 40%, var(--card));
|
|
330
|
+
}
|
|
331
|
+
.mk-dt-section-label {
|
|
332
|
+
position: sticky; left: 0; width: max-content; max-width: 100%; padding: 12px 10px 4px;
|
|
333
|
+
font-size: 11px; font-weight: 600; color: var(--muted-foreground); white-space: normal;
|
|
334
|
+
}
|
|
335
|
+
/* `loading` (2.30): shadcn's Skeleton (bg-accent animate-pulse rounded-md)
|
|
336
|
+
* in each cell while there are no rows; rows on screen dim instead. */
|
|
337
|
+
.mk-dt-skeleton { display: block; height: 14px; border-radius: calc(var(--radius, .625rem) - 2px); background: var(--accent); animation: mk-skeleton-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
|
|
338
|
+
.mk-dt-table .mk-dt-num .mk-dt-skeleton { margin-left: auto; }
|
|
339
|
+
.mk-dt-table .mk-dt-center .mk-dt-skeleton { margin-inline: auto; }
|
|
340
|
+
.mk-dt-table tbody tr.mk-dt-skeleton-row:hover > td:where(.mk-dt-table > * > tr > *) { background: var(--card); }
|
|
341
|
+
@keyframes mk-skeleton-pulse { 50% { opacity: .5; } }
|
|
342
|
+
.mk-dt-busy { opacity: .5; transition: opacity .15s; }
|
|
343
|
+
/* Column resizing (2.30): a drag handle on each header's right edge, after
|
|
344
|
+
* idx-portal's: a 2px line shows on hover, in brand while dragging. */
|
|
345
|
+
.mk-dt-table--grouped thead th.mk-dt-resizable:not(.mk-dt-pin):where(.mk-dt-table > * > tr > *) { position: relative; }
|
|
346
|
+
.mk-dt-resizer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 4; width: 8px; cursor: col-resize; touch-action: none; user-select: none; }
|
|
347
|
+
.mk-dt-resizer::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: 0; width: 2px; border-radius: 1px; background: transparent; }
|
|
348
|
+
.mk-dt-table th:hover:where(.mk-dt-table > * > tr > *) > .mk-dt-resizer::after { background: var(--border); }
|
|
349
|
+
.mk-dt-table th:where(.mk-dt-table > * > tr > *) > .mk-dt-resizer:hover::after, .mk-dt-resizer--active::after { background: var(--brand); }
|
|
350
|
+
body.mk-dt-col-resizing { cursor: col-resize; user-select: none; }
|
|
351
|
+
/* "onEnd": the handle travels past its header while dragging, so that header
|
|
352
|
+
* stops clipping and paints above its neighbours until release. */
|
|
353
|
+
.mk-dt-table thead th:has(> .mk-dt-resizer--active):where(.mk-dt-table > * > tr > *) { overflow: visible; z-index: 5; }
|
|
323
354
|
.mk-dt-foot {
|
|
324
355
|
flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
|
|
325
356
|
padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground);
|
|
@@ -347,6 +378,8 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
347
378
|
transition: background .15s var(--mk-ease), border-color .15s var(--mk-ease);
|
|
348
379
|
}
|
|
349
380
|
.mk-ms-trigger:hover { background: var(--accent); }
|
|
381
|
+
/* `disabled` (2.30): shadcn Button's disabled look (disabled:pointer-events-none disabled:opacity-50). */
|
|
382
|
+
.mk-ms-trigger:disabled { pointer-events: none; opacity: .5; }
|
|
350
383
|
.mk-ms-trigger:focus-visible { outline: none; }
|
|
351
384
|
.mk-ms-trigger.open, .mk-ms-trigger:focus-visible { border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
|
|
352
385
|
.mk-ms-value { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
|
package/ui.d.ts
CHANGED
|
@@ -175,6 +175,8 @@ export interface MultiSelectProps<V extends string = string> {
|
|
|
175
175
|
locale?: string;
|
|
176
176
|
/** Override single texts on top of the locale (2.29). The explicit props win. */
|
|
177
177
|
labels?: Partial<FilterLabels>;
|
|
178
|
+
/** Disables the trigger as shadcn's Button does (2.30): half opacity, no pointer, not focusable. An open menu closes. */
|
|
179
|
+
disabled?: boolean;
|
|
178
180
|
className?: string;
|
|
179
181
|
"aria-label"?: string;
|
|
180
182
|
}
|
|
@@ -274,6 +276,8 @@ export interface FreshnessBadgeProps {
|
|
|
274
276
|
action?: React.ReactNode;
|
|
275
277
|
footer?: React.ReactNode;
|
|
276
278
|
align?: "start" | "end";
|
|
279
|
+
/** BCP 47 tag (2.30), e.g. "fr-CH": the panel's and the source list's screen-reader names in that language. Default English. */
|
|
280
|
+
locale?: string;
|
|
277
281
|
className?: string;
|
|
278
282
|
}
|
|
279
283
|
export function FreshnessBadge(props: FreshnessBadgeProps): React.ReactElement;
|
|
@@ -295,6 +299,12 @@ export interface RefreshAllButtonProps {
|
|
|
295
299
|
schedule?: string;
|
|
296
300
|
/** Override the rebuild (tests, custom engines). Default refreshBinding. */
|
|
297
301
|
refresh?: (name: string) => Promise<unknown>;
|
|
302
|
+
/**
|
|
303
|
+
* BCP 47 tag (2.30), e.g. "fr-CH": the button, the modal, each source's
|
|
304
|
+
* state and the finish time in that language (STRINGS[lang].refresh).
|
|
305
|
+
* Default English, exactly as before. `labels` stays the binding names' map.
|
|
306
|
+
*/
|
|
307
|
+
locale?: string;
|
|
298
308
|
className?: string;
|
|
299
309
|
}
|
|
300
310
|
export function RefreshAllButton(props: RefreshAllButtonProps): React.ReactElement;
|
|
@@ -307,6 +317,8 @@ export interface TooltipRow {
|
|
|
307
317
|
/** A null or undefined cell shows a muted "–"; "" stays blank. */
|
|
308
318
|
cells: React.ReactNode[];
|
|
309
319
|
key?: string;
|
|
320
|
+
/** A rule above this row (2.30), e.g. an "Ending MRR" line before the total. Default false. */
|
|
321
|
+
rule?: boolean;
|
|
310
322
|
}
|
|
311
323
|
export interface TableTooltipProps {
|
|
312
324
|
title?: React.ReactNode;
|
|
@@ -320,6 +332,8 @@ export interface TableTooltipProps {
|
|
|
320
332
|
after?: TooltipRow[];
|
|
321
333
|
/** The value columns' minimum width: "9ch", or px as a number. Default 7ch. */
|
|
322
334
|
colWidth?: number | string;
|
|
335
|
+
/** A muted line under the table (2.30): a caveat, "Click to list the opportunities". */
|
|
336
|
+
note?: React.ReactNode;
|
|
323
337
|
className?: string;
|
|
324
338
|
}
|
|
325
339
|
/** The house chart tooltip: a table with swatches, right-aligned numbers and a total row. */
|
|
@@ -412,6 +426,21 @@ export interface DataTableColumn<R = any> {
|
|
|
412
426
|
grow?: boolean;
|
|
413
427
|
/** A growing column's floor; defaults to its `width`. Other columns are exactly `width`. */
|
|
414
428
|
minWidth?: number | string;
|
|
429
|
+
/** TanStack Table's width in px (2.30): the column's width when `width` is unset, and its start width for resizing. */
|
|
430
|
+
size?: number;
|
|
431
|
+
/** The narrowest a drag makes the column, px (2.30, TanStack's). Default 20. */
|
|
432
|
+
minSize?: number;
|
|
433
|
+
/** The widest a drag makes the column, px (2.30, TanStack's). Default none. */
|
|
434
|
+
maxSize?: number;
|
|
435
|
+
/** false: no resize handle on this column (2.30, TanStack's). Default true under `enableColumnResizing`. */
|
|
436
|
+
enableResizing?: boolean;
|
|
437
|
+
/**
|
|
438
|
+
* A class for each body cell (2.30), from the cell's value and row, e.g. a
|
|
439
|
+
* heat cell: `(v) => v > 0.5 ? "heat-high" : undefined`. Not on the total row.
|
|
440
|
+
*/
|
|
441
|
+
cellClassName?: string | ((value: any, row: R) => string | undefined);
|
|
442
|
+
/** An inline style for each body cell (2.30), e.g. a heat colour from the value. Not on the total row. */
|
|
443
|
+
cellStyle?: React.CSSProperties | ((value: any, row: R) => React.CSSProperties | undefined);
|
|
415
444
|
/**
|
|
416
445
|
* Default true: the cell stays on one line and ellipsizes at the column's
|
|
417
446
|
* width, the raw value (text or number) as its hover title. false wraps the
|
|
@@ -500,6 +529,8 @@ export interface DataTableLabels {
|
|
|
500
529
|
collapse: (row: any) => string;
|
|
501
530
|
/** A header "i" button's aria-label. Default "About MRR". */
|
|
502
531
|
info: (label: string) => string;
|
|
532
|
+
/** A column resize handle's hover title (2.30). Default "Drag to resize · double-click to reset". */
|
|
533
|
+
resizeHint: string;
|
|
503
534
|
}
|
|
504
535
|
/**
|
|
505
536
|
* Which rows show their detail row: `true` for every row, or the open rows'
|
|
@@ -507,6 +538,18 @@ export interface DataTableLabels {
|
|
|
507
538
|
* `ExpandedState`, so one state can drive both.
|
|
508
539
|
*/
|
|
509
540
|
export type DataTableExpanded = true | Record<string, boolean>;
|
|
541
|
+
/** TanStack Table's SortingState (2.30). DataTable reads the first entry only. */
|
|
542
|
+
export type SortingState = { id: string; desc: boolean }[];
|
|
543
|
+
/** TanStack Table's PaginationState (2.30): a 0-based page index and the page size. */
|
|
544
|
+
export interface PaginationState {
|
|
545
|
+
pageIndex: number;
|
|
546
|
+
pageSize: number;
|
|
547
|
+
}
|
|
548
|
+
/** TanStack Table's ColumnSizingState (2.30): dragged widths in px, by column id. */
|
|
549
|
+
export type ColumnSizingState = Record<string, number>;
|
|
550
|
+
/** TanStack Table's Updater and OnChangeFn. DataTable always passes the next value, never a function. */
|
|
551
|
+
export type Updater<T> = T | ((old: T) => T);
|
|
552
|
+
export type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
|
|
510
553
|
/** The English defaults of `DataTableLabels`. */
|
|
511
554
|
export const DATA_TABLE_LABELS: DataTableLabels;
|
|
512
555
|
/** The labels a DataTable uses for a locale (2.29), `labels` on top. */
|
|
@@ -609,6 +652,55 @@ export interface DataTableProps<R = any> {
|
|
|
609
652
|
onTotalRowClick?: (row: R, event: React.SyntheticEvent) => void;
|
|
610
653
|
/** Append the total row to the CSV export. Default false. */
|
|
611
654
|
exportTotalRow?: boolean;
|
|
655
|
+
/**
|
|
656
|
+
* Server-side sort (2.30, TanStack's): the rows come sorted, the table
|
|
657
|
+
* never reorders them. A header click still reports the next sort through
|
|
658
|
+
* `onSortingChange` / `onSortChange`. Default false.
|
|
659
|
+
*/
|
|
660
|
+
manualSorting?: boolean;
|
|
661
|
+
/**
|
|
662
|
+
* Server-side paging (2.30, TanStack's): `rows` is the current page, shown
|
|
663
|
+
* as given, and `rowCount` the total behind the footer and the pager.
|
|
664
|
+
* The built-in CSV export is off (the table holds one page). Default false.
|
|
665
|
+
*/
|
|
666
|
+
manualPagination?: boolean;
|
|
667
|
+
/** The total row count for `manualPagination` (TanStack's). Without it the pager knows only the pages so far. */
|
|
668
|
+
rowCount?: number;
|
|
669
|
+
/** Controlled sort in TanStack's shape (2.30). Wins over `sort`. */
|
|
670
|
+
sorting?: SortingState;
|
|
671
|
+
/** Gets `[{ id, desc }]` on a header click (2.30). A `useState` setter works. */
|
|
672
|
+
onSortingChange?: OnChangeFn<SortingState>;
|
|
673
|
+
/** Controlled page and size in TanStack's shape (2.30), 0-based. Wins over `page` and `pageSize`. */
|
|
674
|
+
pagination?: PaginationState;
|
|
675
|
+
/** Gets `{ pageIndex, pageSize }` once per page or size change (2.30). A `useState` setter works. */
|
|
676
|
+
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
677
|
+
/**
|
|
678
|
+
* The rows are loading (2.30): with no rows, up to 10 skeleton rows (shadcn's
|
|
679
|
+
* Skeleton) fill the body; with rows, they dim until the next ones land.
|
|
680
|
+
* The footer counts `rowCount` meanwhile. Default false.
|
|
681
|
+
*/
|
|
682
|
+
loading?: boolean;
|
|
683
|
+
/**
|
|
684
|
+
* A drag handle on each header's right edge (2.30, TanStack's). A double
|
|
685
|
+
* click resets the column. Widths clamp to `minSize` / `maxSize`. Pointer
|
|
686
|
+
* only, as TanStack: no keyboard resize. Default false.
|
|
687
|
+
*/
|
|
688
|
+
enableColumnResizing?: boolean;
|
|
689
|
+
/** "onEnd" (TanStack's default): the handle moves and the width changes on release. "onChange": the width follows the pointer. */
|
|
690
|
+
columnResizeMode?: "onChange" | "onEnd";
|
|
691
|
+
/** Controlled widths `{ [id]: px }` (2.30); pair with `onColumnSizingChange` to keep them per viewer. */
|
|
692
|
+
columnSizing?: ColumnSizingState;
|
|
693
|
+
onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
|
|
694
|
+
/**
|
|
695
|
+
* Flags section rows (2.30): each renders one cell across every column, a
|
|
696
|
+
* heading for the rows after it ("Inbound", "Outbound"). Rows sort inside
|
|
697
|
+
* their section, and section rows stay out of the pager, the footer
|
|
698
|
+
* count, the CSV and `totalRow`. A section repeats at the top of a page
|
|
699
|
+
* its rows continue on.
|
|
700
|
+
*/
|
|
701
|
+
isSectionRow?: (row: R) => boolean;
|
|
702
|
+
/** A section row's content. Default the first column's `render` (else `value`) of that row. */
|
|
703
|
+
renderSection?: (row: R) => React.ReactNode;
|
|
612
704
|
className?: string;
|
|
613
705
|
style?: React.CSSProperties;
|
|
614
706
|
}
|
|
@@ -627,10 +719,22 @@ export function defaultColumnWidth(column: Pick<DataTableColumn, "num" | "align"
|
|
|
627
719
|
* The fixed layout a DataTable renders: each `<col>` width (null for a
|
|
628
720
|
* growing column) and the table's min-width, the sum of the columns.
|
|
629
721
|
*/
|
|
630
|
-
export function columnLayout(
|
|
722
|
+
export function columnLayout(
|
|
723
|
+
columns: readonly Pick<DataTableColumn, "id" | "num" | "align" | "date" | "sticky" | "width" | "minWidth" | "grow" | "size">[],
|
|
724
|
+
sizing?: ColumnSizingState,
|
|
725
|
+
): {
|
|
631
726
|
cols: { id: string; width: string | null }[];
|
|
632
727
|
minWidth: string;
|
|
728
|
+
/** Set when `sizing` left no growing column: the table is exactly `minWidth` wide. */
|
|
729
|
+
fixed?: true;
|
|
633
730
|
};
|
|
731
|
+
/** A width after a drag (2.30): start + travel, rounded, within `minSize` (default 20) and `maxSize`. */
|
|
732
|
+
export function resizeWidth(column: Pick<DataTableColumn, "minSize" | "maxSize">, startWidth: number, delta: number): number;
|
|
733
|
+
/** Runs of rows split at each section row (2.30). Rows before the first section run with `section: null`. */
|
|
734
|
+
export function splitSections<R>(rows: readonly R[], isSection: (row: R) => boolean): { section: R | null; rows: R[] }[];
|
|
735
|
+
/** TanStack's SortingState as a DataTable sort (first entry only), and back. */
|
|
736
|
+
export function fromSorting(sorting: SortingState | null | undefined): DataTableSort | null;
|
|
737
|
+
export function toSorting(sort: DataTableSort | null | undefined): SortingState;
|
|
634
738
|
/** A sorted copy: stable, by `value(row)`, empty values (null, "", NaN) last both ways. */
|
|
635
739
|
export function sortRows<R>(rows: readonly R[], columns: readonly DataTableColumn<R>[], sort: DataTableSort | null | undefined): R[];
|
|
636
740
|
/** The sort after a header click: same column flips; a new one starts desc for `num`, else asc. */
|